|
|
@@ -29,6 +29,8 @@ import com.alibaba.fastjson.JSON;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.fs.common.config.FSSysConfig;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.core.redis.RedisCache;
|
|
|
@@ -63,6 +65,7 @@ import com.fs.his.enums.FsStoreOrderLogEnum;
|
|
|
import com.fs.his.mapper.FsHfpayConfigMapper;
|
|
|
import com.fs.his.mapper.FsStoreProductAttrValueMapper;
|
|
|
import com.fs.his.mapper.FsUserMapper;
|
|
|
+import com.fs.his.mapper.FsUserWxMapper;
|
|
|
import com.fs.his.service.IFsExpressService;
|
|
|
import com.fs.his.service.IFsStoreProductService;
|
|
|
import com.fs.his.service.IFsUserService;
|
|
|
@@ -136,6 +139,8 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
private final RedisCache redisCache;
|
|
|
@Autowired
|
|
|
private LiveOrderMapper baseMapper;
|
|
|
+ @Autowired
|
|
|
+ private FsUserWxMapper fsUserWxMapper;
|
|
|
|
|
|
|
|
|
|
|
|
@@ -2905,7 +2910,13 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
storePayment.setPayTypeCode("weixin");
|
|
|
storePayment.setBusinessType(5);
|
|
|
storePayment.setRemark("直播订单支付");
|
|
|
- storePayment.setOpenId(user.getRealName());
|
|
|
+ Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
|
|
|
+ .eq(FsUserWx::getFsUserId, order.getUserId())
|
|
|
+ .eq(FsUserWx::getAppId, fsPayConfig.getAppId());
|
|
|
+ FsUserWx fsUserWx = fsUserWxMapper.selectOne(queryWrapper);
|
|
|
+ log.info("查到的openId信息:{}", fsUserWx);
|
|
|
+ storePayment.setOpenId(fsUserWx == null ? user.getMaOpenId() : fsUserWx.getOpenId());
|
|
|
+ log.info("用户openid:{}", storePayment.getOpenId());
|
|
|
storePayment.setUserId(user.getUserId());
|
|
|
storePayment.setBusinessId(String.valueOf(order.getOrderId()));
|
|
|
storePayment.setAppId(fsPayConfig.getAppId() == null ? "" : fsPayConfig.getAppId());
|
|
|
@@ -2914,11 +2925,11 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
if (fsPayConfig.getType().equals("hf")){
|
|
|
HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
|
o.setTradeType("T_MINIAPP");
|
|
|
- o.setOpenid(user.getMaOpenId());
|
|
|
+ o.setOpenid(storePayment.getOpenId());
|
|
|
o.setReqSeqId("live-"+storePayment.getPayCode());
|
|
|
o.setTransAmt(storePayment.getPayMoney().toString());
|
|
|
o.setGoodsDesc("直播订单支付");
|
|
|
- if (param != null && StringUtils.isNotBlank(param.getAppId())) {
|
|
|
+ if (StringUtils.isNotBlank(param.getAppId())) {
|
|
|
o.setAppId(param.getAppId());
|
|
|
}
|
|
|
HuifuCreateOrderResult result = huiFuService.createOrder(o);
|
|
|
@@ -2930,6 +2941,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
mt.setBusinessCode(order.getOrderCode());
|
|
|
liveOrderPaymentMapper.updateLiveOrderPayment(mt);
|
|
|
redisCache.setCacheObject("isPaying:"+order.getOrderId(),order.getOrderId().toString(),1, TimeUnit.MINUTES);
|
|
|
+ log.info("汇付支付");
|
|
|
Map<String, Object> resultMap = JSON.parseObject(result.getPay_info(), new TypeReference<Map<String, Object>>() {});
|
|
|
String s = (String) resultMap.get("package");
|
|
|
resultMap.put("packageValue",s);
|
|
|
@@ -2949,7 +2961,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
payConfig.setNotifyUrl(fsPayConfig.getNotifyUrlScrm());
|
|
|
wxPayService.setConfig(payConfig);
|
|
|
WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest();
|
|
|
- orderRequest.setOpenid(user.getMaOpenId());//公众号支付提供用户openid
|
|
|
+ orderRequest.setOpenid(storePayment.getOpenId());
|
|
|
orderRequest.setBody("直播订单支付");
|
|
|
orderRequest.setOutTradeNo("live-" + storePayment.getPayCode());
|
|
|
orderRequest.setTotalFee(WxPayUnifiedOrderRequest.yuanToFen(storePayment.getPayMoney().toString()));//测试
|