|
@@ -29,6 +29,8 @@ import com.alibaba.fastjson.JSON;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
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.config.FSSysConfig;
|
|
|
import com.fs.common.core.domain.R;
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.core.redis.RedisCache;
|
|
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.FsHfpayConfigMapper;
|
|
|
import com.fs.his.mapper.FsStoreProductAttrValueMapper;
|
|
import com.fs.his.mapper.FsStoreProductAttrValueMapper;
|
|
|
import com.fs.his.mapper.FsUserMapper;
|
|
import com.fs.his.mapper.FsUserMapper;
|
|
|
|
|
+import com.fs.his.mapper.FsUserWxMapper;
|
|
|
import com.fs.his.service.IFsExpressService;
|
|
import com.fs.his.service.IFsExpressService;
|
|
|
import com.fs.his.service.IFsStoreProductService;
|
|
import com.fs.his.service.IFsStoreProductService;
|
|
|
import com.fs.his.service.IFsUserService;
|
|
import com.fs.his.service.IFsUserService;
|
|
@@ -136,6 +139,8 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
private final RedisCache redisCache;
|
|
private final RedisCache redisCache;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private LiveOrderMapper baseMapper;
|
|
private LiveOrderMapper baseMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private FsUserWxMapper fsUserWxMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -2851,9 +2856,25 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
if(StringUtils.isNotEmpty(orderId)&&order.getOrderId().toString().equals(orderId)){
|
|
if(StringUtils.isNotEmpty(orderId)&&order.getOrderId().toString().equals(orderId)){
|
|
|
return R.error("正在支付中...");
|
|
return R.error("正在支付中...");
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
FsUserScrm user=userMapper.selectFsUserById(Long.valueOf(order.getUserId()));
|
|
FsUserScrm user=userMapper.selectFsUserById(Long.valueOf(order.getUserId()));
|
|
|
- if(user!=null&& StringUtils.isNotEmpty(user.getMaOpenId())){
|
|
|
|
|
|
|
+ if(user == null){
|
|
|
|
|
+ return R.error("未找到用户信息,请联系管理员!");
|
|
|
|
|
+ }
|
|
|
|
|
+ String json = configService.selectConfigByKey("his.pay");
|
|
|
|
|
+ FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
|
|
|
|
|
+ String openId;
|
|
|
|
|
+ if(StringUtils.isNotEmpty(user.getMaOpenId())){
|
|
|
|
|
+ log.info("用户信息有openid:{}", user.getMaOpenId());
|
|
|
|
|
+ openId = user.getMaOpenId();
|
|
|
|
|
+ }else{
|
|
|
|
|
+ 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);
|
|
|
|
|
+ openId = fsUserWx.getOpenId();
|
|
|
|
|
+ }
|
|
|
|
|
+ if(StringUtils.isNotEmpty(openId)){
|
|
|
//已改价处理
|
|
//已改价处理
|
|
|
if(order.getIsEditMoney()!=null&&order.getIsEditMoney()==1){
|
|
if(order.getIsEditMoney()!=null&&order.getIsEditMoney()==1){
|
|
|
//改过价不做处理
|
|
//改过价不做处理
|
|
@@ -2892,8 +2913,6 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
// order.setOrderCode(orderCode);
|
|
// order.setOrderCode(orderCode);
|
|
|
// if(order.getPayType().equals("1")||order.getPayType().equals("2")){
|
|
// if(order.getPayType().equals("1")||order.getPayType().equals("2")){
|
|
|
if((order.getPayType().equals("1")||order.getPayType().equals("2")||order.getPayType().equals("3")) && order.getPayMoney().compareTo(new BigDecimal(0))>0){
|
|
if((order.getPayType().equals("1")||order.getPayType().equals("2")||order.getPayType().equals("3")) && order.getPayMoney().compareTo(new BigDecimal(0))>0){
|
|
|
- String json = configService.selectConfigByKey("his.pay");
|
|
|
|
|
- FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
|
|
|
|
|
LiveOrderPayment storePayment=new LiveOrderPayment();
|
|
LiveOrderPayment storePayment=new LiveOrderPayment();
|
|
|
storePayment.setCompanyId(order.getCompanyId());
|
|
storePayment.setCompanyId(order.getCompanyId());
|
|
|
storePayment.setCompanyUserId(order.getCompanyUserId());
|
|
storePayment.setCompanyUserId(order.getCompanyUserId());
|
|
@@ -2905,7 +2924,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
storePayment.setPayTypeCode("weixin");
|
|
storePayment.setPayTypeCode("weixin");
|
|
|
storePayment.setBusinessType(5);
|
|
storePayment.setBusinessType(5);
|
|
|
storePayment.setRemark("直播订单支付");
|
|
storePayment.setRemark("直播订单支付");
|
|
|
- storePayment.setOpenId(user.getRealName());
|
|
|
|
|
|
|
+ storePayment.setOpenId(openId);
|
|
|
storePayment.setUserId(user.getUserId());
|
|
storePayment.setUserId(user.getUserId());
|
|
|
storePayment.setBusinessId(String.valueOf(order.getOrderId()));
|
|
storePayment.setBusinessId(String.valueOf(order.getOrderId()));
|
|
|
storePayment.setAppId(fsPayConfig.getAppId() == null ? "" : fsPayConfig.getAppId());
|
|
storePayment.setAppId(fsPayConfig.getAppId() == null ? "" : fsPayConfig.getAppId());
|
|
@@ -2914,11 +2933,11 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
if (fsPayConfig.getType().equals("hf")){
|
|
if (fsPayConfig.getType().equals("hf")){
|
|
|
HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
|
o.setTradeType("T_MINIAPP");
|
|
o.setTradeType("T_MINIAPP");
|
|
|
- o.setOpenid(user.getMaOpenId());
|
|
|
|
|
|
|
+ o.setOpenid(storePayment.getOpenId());
|
|
|
o.setReqSeqId("live-"+storePayment.getPayCode());
|
|
o.setReqSeqId("live-"+storePayment.getPayCode());
|
|
|
o.setTransAmt(storePayment.getPayMoney().toString());
|
|
o.setTransAmt(storePayment.getPayMoney().toString());
|
|
|
o.setGoodsDesc("直播订单支付");
|
|
o.setGoodsDesc("直播订单支付");
|
|
|
- if (param != null && StringUtils.isNotBlank(param.getAppId())) {
|
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(param.getAppId())) {
|
|
|
o.setAppId(param.getAppId());
|
|
o.setAppId(param.getAppId());
|
|
|
}
|
|
}
|
|
|
HuifuCreateOrderResult result = huiFuService.createOrder(o);
|
|
HuifuCreateOrderResult result = huiFuService.createOrder(o);
|
|
@@ -2930,6 +2949,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
mt.setBusinessCode(order.getOrderCode());
|
|
mt.setBusinessCode(order.getOrderCode());
|
|
|
liveOrderPaymentMapper.updateLiveOrderPayment(mt);
|
|
liveOrderPaymentMapper.updateLiveOrderPayment(mt);
|
|
|
redisCache.setCacheObject("isPaying:"+order.getOrderId(),order.getOrderId().toString(),1, TimeUnit.MINUTES);
|
|
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>>() {});
|
|
Map<String, Object> resultMap = JSON.parseObject(result.getPay_info(), new TypeReference<Map<String, Object>>() {});
|
|
|
String s = (String) resultMap.get("package");
|
|
String s = (String) resultMap.get("package");
|
|
|
resultMap.put("packageValue",s);
|
|
resultMap.put("packageValue",s);
|
|
@@ -2949,7 +2969,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
payConfig.setNotifyUrl(fsPayConfig.getNotifyUrlScrm());
|
|
payConfig.setNotifyUrl(fsPayConfig.getNotifyUrlScrm());
|
|
|
wxPayService.setConfig(payConfig);
|
|
wxPayService.setConfig(payConfig);
|
|
|
WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest();
|
|
WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest();
|
|
|
- orderRequest.setOpenid(user.getMaOpenId());//公众号支付提供用户openid
|
|
|
|
|
|
|
+ orderRequest.setOpenid(storePayment.getOpenId());
|
|
|
orderRequest.setBody("直播订单支付");
|
|
orderRequest.setBody("直播订单支付");
|
|
|
orderRequest.setOutTradeNo("live-" + storePayment.getPayCode());
|
|
orderRequest.setOutTradeNo("live-" + storePayment.getPayCode());
|
|
|
orderRequest.setTotalFee(WxPayUnifiedOrderRequest.yuanToFen(storePayment.getPayMoney().toString()));//测试
|
|
orderRequest.setTotalFee(WxPayUnifiedOrderRequest.yuanToFen(storePayment.getPayMoney().toString()));//测试
|