|
@ -13,6 +13,7 @@ import com.yihu.jw.entity.order.BusinessOrderRefundDO;
|
|
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
|
|
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
|
|
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
|
|
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
|
|
import com.yihu.jw.hospital.ykyy.service.YkyyService;
|
|
import com.yihu.jw.hospital.ykyy.service.YkyyService;
|
|
|
|
import com.yihu.jw.internet.service.ykyy.YkyyInternetService;
|
|
import com.yihu.jw.order.dao.BusinessOrderDao;
|
|
import com.yihu.jw.order.dao.BusinessOrderDao;
|
|
import com.yihu.jw.order.dao.BusinessOrderRefundDao;
|
|
import com.yihu.jw.order.dao.BusinessOrderRefundDao;
|
|
import com.yihu.jw.order.pay.wx.WeChatConfig;
|
|
import com.yihu.jw.order.pay.wx.WeChatConfig;
|
|
@ -33,11 +34,14 @@ import org.apache.commons.collections.map.HashedMap;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.checkerframework.checker.units.qual.A;
|
|
import org.checkerframework.checker.units.qual.A;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import java.net.InetAddress;
|
|
import java.net.InetAddress;
|
|
import java.net.UnknownHostException;
|
|
import java.net.UnknownHostException;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@ -49,6 +53,8 @@ import java.util.*;
|
|
@Service
|
|
@Service
|
|
public class BusinessOrderService {
|
|
public class BusinessOrderService {
|
|
|
|
|
|
|
|
private Logger logger = LoggerFactory.getLogger(BusinessOrderService.class);
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private BusinessOrderDao businessOrderDao;
|
|
private BusinessOrderDao businessOrderDao;
|
|
@Autowired
|
|
@Autowired
|
|
@ -198,6 +204,9 @@ public class BusinessOrderService {
|
|
|
|
|
|
String url = wxWechatDO.getBaseUrl();
|
|
String url = wxWechatDO.getBaseUrl();
|
|
String notifyUrl =url+"/ykyy"+BaseHospitalRequestMapping.WxPay.Notify;
|
|
String notifyUrl =url+"/ykyy"+BaseHospitalRequestMapping.WxPay.Notify;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String,Object> map = unifiedorder(wechatId,body,totalFee,WeChatConfig.TRADE_TYPE_JSAPI,openid,ourTradeNo,notifyUrl);
|
|
Map<String,Object> map = unifiedorder(wechatId,body,totalFee,WeChatConfig.TRADE_TYPE_JSAPI,openid,ourTradeNo,notifyUrl);
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|
|
@ -214,7 +223,6 @@ public class BusinessOrderService {
|
|
* @return
|
|
* @return
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public Map<String,Object> unifiedorder(String wechatId,String body,String totalFee,String tradeType,String openId,String ourTradeNo,String notifyUrl) throws Exception {
|
|
public Map<String,Object> unifiedorder(String wechatId,String body,String totalFee,String tradeType,String openId,String ourTradeNo,String notifyUrl) throws Exception {
|
|
WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
|
|
WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
|
|
if(wxWechatDO==null){
|
|
if(wxWechatDO==null){
|
|
@ -240,6 +248,7 @@ public class BusinessOrderService {
|
|
map.put("mch_id",wxWechatDO.getMchId());
|
|
map.put("mch_id",wxWechatDO.getMchId());
|
|
map.put("body",body);
|
|
map.put("body",body);
|
|
map.put("out_trade_no",ourTradeNo);
|
|
map.put("out_trade_no",ourTradeNo);
|
|
|
|
map.put("fee_type","CNY");
|
|
map.put("total_fee",totalFee);
|
|
map.put("total_fee",totalFee);
|
|
map.put("spbill_create_ip",getServerIp());
|
|
map.put("spbill_create_ip",getServerIp());
|
|
map.put("notify_url",notifyUrl);
|
|
map.put("notify_url",notifyUrl);
|
|
@ -257,6 +266,7 @@ public class BusinessOrderService {
|
|
String result1 = HttpUtil.sendGet(openidList_url, params1);
|
|
String result1 = HttpUtil.sendGet(openidList_url, params1);
|
|
JSONObject json1 = new JSONObject(result1);
|
|
JSONObject json1 = new JSONObject(result1);
|
|
}*/
|
|
}*/
|
|
|
|
logger.info("map:"+map.toString());
|
|
Map<String, Object> pay = unifiedorder(map, wxWechatDO.getAppKey());
|
|
Map<String, Object> pay = unifiedorder(map, wxWechatDO.getAppKey());
|
|
String returnCode = pay.get("return_code").toString();
|
|
String returnCode = pay.get("return_code").toString();
|
|
|
|
|
|
@ -267,12 +277,11 @@ public class BusinessOrderService {
|
|
String prepayId = pay.get("prepay_id").toString();
|
|
String prepayId = pay.get("prepay_id").toString();
|
|
|
|
|
|
Map<String,String> param = new HashedMap();
|
|
Map<String,String> param = new HashedMap();
|
|
param.put("appid",appid);
|
|
|
|
param.put("partnerid",mchId);
|
|
|
|
param.put("prepayid",prepayId);
|
|
|
|
param.put("package","Sign=WXPay");
|
|
|
|
param.put("noncestr",nonceStr);
|
|
|
|
param.put("timestamp",getTimeStamp());
|
|
|
|
|
|
param.put("appId",appid);
|
|
|
|
param.put("package","prepay_id="+prepayId);
|
|
|
|
param.put("nonceStr",nonceStr);
|
|
|
|
param.put("signType","MD5");
|
|
|
|
param.put("timeStamp",getTimeStamp());
|
|
param = WeiXinPayUtils.getMapAfterUnifiedorder(param,wxWechatDO.getAppKey());
|
|
param = WeiXinPayUtils.getMapAfterUnifiedorder(param,wxWechatDO.getAppKey());
|
|
pay.put("jsapi",param);
|
|
pay.put("jsapi",param);
|
|
}
|
|
}
|