|
|
@@ -63,6 +63,7 @@ import com.fs.pay.pay.dto.RefundDTO;
|
|
|
import com.fs.pay.pay.dto.WxJspayDTO;
|
|
|
import com.fs.pay.pay.service.PayService;
|
|
|
import com.fs.store.cache.IFsUserCacheService;
|
|
|
+import com.fs.store.cache.IFsWarehouseCacheService;
|
|
|
import com.fs.store.cache.impl.IFsStoreProductCacheServiceImpl;
|
|
|
import com.fs.store.config.StoreConfig;
|
|
|
import com.fs.store.config.StoreIntegralConfig;
|
|
|
@@ -80,6 +81,9 @@ import com.fs.store.strategy.ShippingOrder;
|
|
|
import com.fs.store.strategy.ShippingTemplateManager;
|
|
|
import com.fs.store.vo.*;
|
|
|
import com.fs.system.config.SnowflakeUtils;
|
|
|
+import com.fs.system.domain.WxMiniProgramConfig;
|
|
|
+import com.fs.system.mapper.FsCoursePlaySourceConfigMapper;
|
|
|
+import com.fs.system.mapper.WxMiniProgramConfigMapper;
|
|
|
import com.fs.system.service.ISysConfigService;
|
|
|
import com.fs.tzBank.TzBankService;
|
|
|
import com.fs.tzBank.utils.TzConfigUtils;
|
|
|
@@ -90,6 +94,12 @@ import com.fs.wx.miniapp.config.WxMaConfiguration;
|
|
|
import com.fs.wx.miniapp.config.WxMaProperties;
|
|
|
import com.fs.wx.service.OrderQueryService;
|
|
|
import com.fs.wx.service.ShippingService;
|
|
|
+import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
|
|
|
+import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
|
|
|
+import com.github.binarywang.wxpay.bean.result.WxPayRefundQueryResult;
|
|
|
+import com.github.binarywang.wxpay.bean.result.WxPayRefundResult;
|
|
|
+import com.github.binarywang.wxpay.config.WxPayConfig;
|
|
|
+import com.github.binarywang.wxpay.exception.WxPayException;
|
|
|
import lombok.Synchronized;
|
|
|
import me.chanjar.weixin.common.error.WxErrorException;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
@@ -125,6 +135,13 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
@Autowired
|
|
|
private CompanyMoneyLogsMapper moneyLogsMapper;
|
|
|
@Autowired
|
|
|
+ private FsUserWxMapper fsUserWxMapper;
|
|
|
+ @Autowired
|
|
|
+ private FsCoursePlaySourceConfigMapper fsCoursePlaySourceConfigMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private WxMiniProgramConfigMapper wxMiniProgramConfigMapper;
|
|
|
+ @Autowired
|
|
|
private IFsStoreOrderStatusService orderStatusService;
|
|
|
@Autowired
|
|
|
private FsStoreCartMapper cartMapper;
|
|
|
@@ -415,7 +432,35 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
}
|
|
|
|
|
|
FsUser user=userService.selectFsUserById(order.getUserId());
|
|
|
- if(user!=null&& StringUtils.isNotEmpty(user.getMaOpenId())){
|
|
|
+// String json = configService.selectConfigByKey("store.pay");
|
|
|
+// FsPayConfig fsPayConfig = JSON.parseObject(json, FsPayConfig.class);
|
|
|
+ WxMiniProgramConfig wxMiniProgramConfig = new WxMiniProgramConfig();
|
|
|
+ wxMiniProgramConfig.setAppid(param.getAppId());
|
|
|
+ List<WxMiniProgramConfig> wxMiniProgramConfigs = wxMiniProgramConfigMapper.selectWxMiniProgramConfigList(wxMiniProgramConfig);
|
|
|
+ WxMiniProgramConfig wConfig = wxMiniProgramConfigs.get(0);
|
|
|
+ String openId = null;
|
|
|
+ String appId = param.getAppId();
|
|
|
+ if (StringUtils.isNotBlank(appId)) {
|
|
|
+ //查询fs_user_wx的openId
|
|
|
+ FsUserWx fsUserWx = fsUserWxMapper.selectListByUserIdAndAppId(user.getUserId(),appId);
|
|
|
+ logger.info("用户微信信息==============={}",fsUserWx);
|
|
|
+ if (fsUserWx != null) {
|
|
|
+ openId = fsUserWx.getOpenId();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ appId = fsCoursePlaySourceConfigMapper.selectFsCoursePlaySourceConfigByAppId(param.getAppId()).getAppid();
|
|
|
+ openId = Objects.isNull(user) ? "" : user.getMaOpenId();
|
|
|
+ if (StringUtils.isBlank(openId)){
|
|
|
+ FsUserWx fsUserWx = fsUserWxMapper.selectListByUserIdAndAppId(user.getUserId(),appId);
|
|
|
+ logger.info("用户微信信息==============={}",fsUserWx);
|
|
|
+ if (Objects.nonNull(fsUserWx)){
|
|
|
+ openId = fsUserWx.getOpenId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if(user!=null&& StringUtils.isNotEmpty(openId)){
|
|
|
//已改价处理
|
|
|
if(order.getIsEditMoney()!=null&&order.getIsEditMoney()==1){
|
|
|
//改过价不做处理
|
|
|
@@ -446,15 +491,14 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
String payCode = SnowflakeUtils.nextId();
|
|
|
|
|
|
if(order.getPayType().equals("1")||order.getPayType().equals("2")){
|
|
|
- String json = configService.selectConfigByKey("store.pay");
|
|
|
- FsPayConfig fsPayConfig = JSON.parseObject(json, FsPayConfig.class);
|
|
|
+
|
|
|
List<FsStorePayment> fsStorePayments = fsStorePaymentMapper.selectFsStorePaymentByOrderIdNew(order.getId());
|
|
|
FsStorePayment storePayment;
|
|
|
if(CollectionUtils.isEmpty(fsStorePayments)){
|
|
|
storePayment=new FsStorePayment();
|
|
|
storePayment.setCompanyId(order.getCompanyId());
|
|
|
storePayment.setCompanyUserId(order.getCompanyUserId());
|
|
|
- storePayment.setPayMode(fsPayConfig.getType());
|
|
|
+ storePayment.setPayMode("wx");
|
|
|
storePayment.setStatus(0);
|
|
|
storePayment.setPayCode(payCode);
|
|
|
storePayment.setPayMoney(order.getPayMoney());
|
|
|
@@ -462,14 +506,15 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
storePayment.setPayTypeCode("weixin");
|
|
|
storePayment.setBusinessType(2);
|
|
|
storePayment.setRemark("商城订单支付");
|
|
|
- storePayment.setOpenId(user.getRealName());
|
|
|
+ storePayment.setOpenId(openId);
|
|
|
storePayment.setUserId(user.getUserId());
|
|
|
+ storePayment.setAppId(appId);
|
|
|
storePayment.setBusinessOrderId(order.getId().toString());
|
|
|
storePayment.setOrderId(order.getId());
|
|
|
fsStorePaymentMapper.insertFsStorePayment(storePayment);
|
|
|
} else {
|
|
|
storePayment = fsStorePayments.get(0);
|
|
|
- storePayment.setPayMode(fsPayConfig.getType());
|
|
|
+ storePayment.setPayMode("wx");
|
|
|
storePayment.setStatus(0);
|
|
|
storePayment.setPayMoney(order.getPayMoney());
|
|
|
storePayment.setCreateTime(new Date());
|
|
|
@@ -477,8 +522,9 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
storePayment.setBusinessType(2);
|
|
|
storePayment.setRemark("商城订单支付");
|
|
|
storePayment.setPayCode(payCode);
|
|
|
- storePayment.setOpenId(user.getRealName());
|
|
|
+ storePayment.setOpenId(openId);
|
|
|
storePayment.setUserId(user.getUserId());
|
|
|
+ storePayment.setAppId(appId);
|
|
|
storePayment.setBusinessOrderId(order.getId().toString());
|
|
|
storePayment.setOrderId(order.getId());
|
|
|
fsStorePaymentMapper.updateFsStorePayment(storePayment);
|
|
|
@@ -489,11 +535,12 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
processContext.setPayType(param.getPayType());
|
|
|
processContext.setPaymentId(storePayment.getPaymentId());
|
|
|
processContext.setPayCode(storePayment.getPayCode());
|
|
|
- processContext.setFsPayConfig(fsPayConfig);
|
|
|
+ processContext.setWxMiniProgramConfig(wConfig);
|
|
|
+ processContext.setStorePayment(storePayment);
|
|
|
processContext.setUserId(order.getUserId());
|
|
|
processContext.setGoodsInfo("商城订单支付");
|
|
|
processContext.setOrderPrefix("store-");
|
|
|
- PaymentHandler payment = PaymentHandlerHolder.findBest(fsPayConfig.getType());
|
|
|
+ PaymentHandler payment = PaymentHandlerHolder.findBest("wx");
|
|
|
if(ObjectUtil.isNull(payment)){
|
|
|
throw new CustomException("支付方式不存在");
|
|
|
}
|
|
|
@@ -1191,6 +1238,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
List<FsStorePayment> fsStorePayments = fsStorePaymentService.selectFsStorePaymentByOrderIdNew(order.getId());
|
|
|
if(CollectionUtils.isNotEmpty(fsStorePayments)){
|
|
|
FsStorePayment fsStorePayment = fsStorePayments.get(0);
|
|
|
+ fsWxExpressTask.setAppid(fsStorePayment.getAppId());
|
|
|
fsWxExpressTask.setPayCode(fsStorePayment.getPayCode());
|
|
|
}
|
|
|
fsWxExpressTaskMapper.insert(fsWxExpressTask);
|
|
|
@@ -2444,6 +2492,12 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
payProcessContext.setPayCode(payment.getPayCode());
|
|
|
payProcessContext.setUserId(order.getUserId());
|
|
|
payProcessContext.setOrderPrefix("refund-");
|
|
|
+ WxMiniProgramConfig wxMiniProgramConfig = new WxMiniProgramConfig();
|
|
|
+ wxMiniProgramConfig.setAppid(payment.getAppId());
|
|
|
+ List<WxMiniProgramConfig> wxMiniProgramConfigs = wxMiniProgramConfigMapper.selectWxMiniProgramConfigList(wxMiniProgramConfig);
|
|
|
+ WxMiniProgramConfig wConfig = wxMiniProgramConfigs.get(0);
|
|
|
+ payProcessContext.setWxMiniProgramConfig(wConfig);
|
|
|
+ payProcessContext.setStorePayment(payment);
|
|
|
best.refundOrder(payProcessContext);
|
|
|
}
|
|
|
}
|
|
|
@@ -3144,7 +3198,25 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
@Transactional(rollbackFor = Throwable.class,propagation = Propagation.REQUIRED)
|
|
|
public R otherPayment(FsStoreOrderOtherPayParam param) {
|
|
|
|
|
|
- final WxMaService wxService = WxMaConfiguration.getMaService(properties.getConfigs().get(0).getAppid());
|
|
|
+ String courseMa_appId;
|
|
|
+
|
|
|
+ System.out.println("appid"+param.getCode());
|
|
|
+ logger.info("appid"+param.getCode());
|
|
|
+ if(org.apache.commons.lang3.StringUtils.isNotEmpty(param.getAppId())){
|
|
|
+ try {
|
|
|
+ courseMa_appId = fsCoursePlaySourceConfigMapper.selectFsCoursePlaySourceConfigByAppId(param.getAppId()).getAppid();
|
|
|
+ } catch (Exception e) {
|
|
|
+ courseMa_appId = param.getAppId();
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ courseMa_appId = properties.getConfigs().get(0).getAppid();
|
|
|
+ }
|
|
|
+ WxMiniProgramConfig wxMiniProgramConfig = new WxMiniProgramConfig();
|
|
|
+ wxMiniProgramConfig.setAppid(param.getAppId());
|
|
|
+ List<WxMiniProgramConfig> wxMiniProgramConfigs = wxMiniProgramConfigMapper.selectWxMiniProgramConfigList(wxMiniProgramConfig);
|
|
|
+ WxMiniProgramConfig wConfig = wxMiniProgramConfigs.get(0);
|
|
|
+
|
|
|
+ final WxMaService wxService = WxMaConfiguration.getMaService(courseMa_appId);
|
|
|
try {
|
|
|
String ip = IpUtil.getRequestIp();
|
|
|
WxMaJscode2SessionResult session = wxService.getUserService().getSessionInfo(param.getCode());
|
|
|
@@ -3180,8 +3252,8 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
|
|
|
|
|
|
String payCode = SnowflakeUtils.nextId();
|
|
|
- String json = configService.selectConfigByKey("store.pay");
|
|
|
- FsPayConfig fsPayConfig = JSON.parseObject(json, FsPayConfig.class);
|
|
|
+ /* String json = configService.selectConfigByKey("store.pay");
|
|
|
+ FsPayConfig fsPayConfig = JSON.parseObject(json, FsPayConfig.class);*/
|
|
|
List<FsStorePayment> fsStorePayments = fsStorePaymentMapper.selectFsStorePaymentByOrderIdNew(order.getId());
|
|
|
|
|
|
FsStorePayment storePayment;
|
|
|
@@ -3190,7 +3262,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
storePayment.setCompanyId(order.getCompanyId());
|
|
|
storePayment.setCompanyUserId(order.getCompanyUserId());
|
|
|
storePayment.setStatus(0);
|
|
|
- storePayment.setPayMode(fsPayConfig.getType());
|
|
|
+ storePayment.setPayMode("wx");
|
|
|
storePayment.setPayCode(payCode);
|
|
|
storePayment.setPayMoney(order.getPayMoney());
|
|
|
storePayment.setCreateTime(new Date());
|
|
|
@@ -3198,6 +3270,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
storePayment.setBusinessType(2);
|
|
|
storePayment.setRemark("商城订单支付");
|
|
|
storePayment.setOpenId(session.getOpenid());
|
|
|
+ storePayment.setAppId(courseMa_appId);
|
|
|
storePayment.setUserId(user.getUserId());
|
|
|
storePayment.setBusinessOrderId(order.getId().toString());
|
|
|
storePayment.setOrderId(order.getId());
|
|
|
@@ -3209,6 +3282,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
storePayment.setCreateTime(new Date());
|
|
|
storePayment.setPayTypeCode("weixin");
|
|
|
storePayment.setBusinessType(2);
|
|
|
+ storePayment.setAppId(courseMa_appId);
|
|
|
storePayment.setRemark("商城订单支付");
|
|
|
storePayment.setOpenId(session.getOpenid());
|
|
|
storePayment.setUserId(user.getUserId());
|
|
|
@@ -3217,7 +3291,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
fsStorePaymentMapper.updateFsStorePayment(storePayment);
|
|
|
}
|
|
|
|
|
|
- PaymentHandler payment = PaymentHandlerHolder.findBest(fsPayConfig.getType());
|
|
|
+ PaymentHandler payment = PaymentHandlerHolder.findBest("wx");
|
|
|
if(ObjectUtil.isNull(payment)){
|
|
|
throw new CustomException("支付方式不存在");
|
|
|
}
|
|
|
@@ -3226,7 +3300,8 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
processContext.setPayType(null);
|
|
|
processContext.setPaymentId(storePayment.getPaymentId());
|
|
|
processContext.setPayCode(storePayment.getPayCode());
|
|
|
- processContext.setFsPayConfig(fsPayConfig);
|
|
|
+ processContext.setWxMiniProgramConfig(wConfig);
|
|
|
+ processContext.setStorePayment(storePayment);
|
|
|
processContext.setUserId(order.getUserId());
|
|
|
processContext.setGoodsInfo("商城订单支付");
|
|
|
processContext.setOrderPrefix("store-");
|
|
|
@@ -3246,7 +3321,22 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED)
|
|
|
public R otherPaymentRemain(FsStoreOrderOtherPayParam param) {
|
|
|
- final WxMaService wxService = WxMaConfiguration.getMaService(properties.getConfigs().get(0).getAppid());
|
|
|
+ String courseMa_appId;
|
|
|
+
|
|
|
+ System.out.println("appid"+param.getCode());
|
|
|
+ logger.info("appid"+param.getCode());
|
|
|
+ if(org.apache.commons.lang3.StringUtils.isNotEmpty(param.getAppId())){
|
|
|
+ try {
|
|
|
+ courseMa_appId = fsCoursePlaySourceConfigMapper.selectFsCoursePlaySourceConfigByAppId(param.getAppId()).getAppid();
|
|
|
+ } catch (Exception e) {
|
|
|
+ courseMa_appId = param.getAppId();
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ courseMa_appId = properties.getConfigs().get(0).getAppid();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ final WxMaService wxService = WxMaConfiguration.getMaService(courseMa_appId);
|
|
|
try {
|
|
|
String ip = IpUtil.getRequestIp();
|
|
|
WxMaJscode2SessionResult session = wxService.getUserService().getSessionInfo(param.getCode());
|
|
|
@@ -3286,6 +3376,33 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
//易宝支付
|
|
|
String json = configService.selectConfigByKey("store.pay");
|
|
|
FsPayConfig fsPayConfig = JSON.parseObject(json, FsPayConfig.class);
|
|
|
+ WxMiniProgramConfig wxMiniProgramConfig = new WxMiniProgramConfig();
|
|
|
+ wxMiniProgramConfig.setAppid(param.getAppId());
|
|
|
+ List<WxMiniProgramConfig> wxMiniProgramConfigs = wxMiniProgramConfigMapper.selectWxMiniProgramConfigList(wxMiniProgramConfig);
|
|
|
+ WxMiniProgramConfig wConfig = wxMiniProgramConfigs.get(0);
|
|
|
+ String openId = null;
|
|
|
+ String appId = param.getAppId();
|
|
|
+ if (StringUtils.isNotBlank(appId)) {
|
|
|
+ //查询fs_user_wx的openId
|
|
|
+ FsUserWx fsUserWx = fsUserWxMapper.selectListByUserIdAndAppId(user.getUserId(),appId);
|
|
|
+ logger.info("用户微信信息==============={}",fsUserWx);
|
|
|
+ if (fsUserWx != null) {
|
|
|
+ openId = fsUserWx.getOpenId();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ appId = fsCoursePlaySourceConfigMapper.selectFsCoursePlaySourceConfigByAppId(param.getAppId()).getAppid();
|
|
|
+ openId = Objects.isNull(user) ? "" : user.getMaOpenId();
|
|
|
+ if (StringUtils.isBlank(openId)){
|
|
|
+ FsUserWx fsUserWx = fsUserWxMapper.selectListByUserIdAndAppId(user.getUserId(),appId);
|
|
|
+ logger.info("用户微信信息==============={}",fsUserWx);
|
|
|
+ if (Objects.nonNull(fsUserWx)){
|
|
|
+ openId = fsUserWx.getOpenId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
FsStorePayment storePayment=new FsStorePayment();
|
|
|
storePayment.setCompanyId(order.getCompanyId());
|
|
|
storePayment.setCompanyUserId(order.getCompanyUserId());
|
|
|
@@ -3296,7 +3413,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
storePayment.setPayTypeCode("weixin");
|
|
|
storePayment.setBusinessType(2);
|
|
|
storePayment.setRemark("商城订单尾款支付");
|
|
|
- storePayment.setOpenId(user.getRealName());
|
|
|
+ storePayment.setOpenId(openId);
|
|
|
storePayment.setUserId(user.getUserId());
|
|
|
storePayment.setBusinessOrderId(order.getId().toString());
|
|
|
storePayment.setOrderId(order.getId());
|
|
|
@@ -3306,7 +3423,8 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
if (fsPayConfig.getType().equals("hf")){
|
|
|
HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
|
o.setTradeType("T_MINIAPP");
|
|
|
- o.setOpenid(user.getMaOpenId());
|
|
|
+ o.setOpenid(openId);
|
|
|
+ o.setAppId(appId);
|
|
|
o.setReqSeqId("store_remain-"+storePayment.getPayCode());
|
|
|
o.setTransAmt(storePayment.getPayMoney().toString());
|
|
|
o.setGoodsDesc("支付订单尾款");
|
|
|
@@ -3315,12 +3433,15 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
FsStorePayment mt=new FsStorePayment();
|
|
|
mt.setPaymentId(storePayment.getPaymentId());
|
|
|
mt.setTradeNo(result.getHf_seq_id());
|
|
|
+ mt.setAppId(appId);
|
|
|
fsStorePaymentMapper.updateFsStorePayment(mt);
|
|
|
redisCache.setCacheObject("isPaying:"+order.getId(),order.getId().toString(),1, TimeUnit.MINUTES);
|
|
|
return R.ok().put("result",result.getPay_info());
|
|
|
}else{
|
|
|
return R.error(result.getResp_desc());
|
|
|
}
|
|
|
+ }else if (fsPayConfig.getType().equals("wx")){
|
|
|
+ return orderService.otherPayment(param);
|
|
|
}else if (fsPayConfig.getType().equals("yb")){
|
|
|
WxJspayDTO p = new WxJspayDTO();
|
|
|
// 使用setter方法为对象赋值
|
|
|
@@ -3329,7 +3450,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
p.setBody("支付订单尾款");
|
|
|
p.setIsMinipg("1");
|
|
|
p.setReturnUrl(fsPayConfig.getYbNotifyUrl());
|
|
|
- p.setOpenId(user.getMaOpenId());
|
|
|
+ p.setOpenId(openId);
|
|
|
p.setAttach("");
|
|
|
p.setStoreid("0");
|
|
|
CreateWxOrderResult wxOrder = ybPayService.createWxOrder(p);
|
|
|
@@ -3686,10 +3807,36 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
return R.error("此订单已支付");
|
|
|
}
|
|
|
FsUser user=userService.selectFsUserById(order.getUserId());
|
|
|
- if(user!=null&& StringUtils.isNotEmpty(user.getMaOpenId())){
|
|
|
+ String json = configService.selectConfigByKey("store.pay");
|
|
|
+ FsPayConfig fsPayConfig = JSON.parseObject(json, FsPayConfig.class);
|
|
|
+ WxMiniProgramConfig wxMiniProgramConfig = new WxMiniProgramConfig();
|
|
|
+ wxMiniProgramConfig.setAppid(param.getAppId());
|
|
|
+ List<WxMiniProgramConfig> wxMiniProgramConfigs = wxMiniProgramConfigMapper.selectWxMiniProgramConfigList(wxMiniProgramConfig);
|
|
|
+ WxMiniProgramConfig wConfig = wxMiniProgramConfigs.get(0);
|
|
|
+ String openId = null;
|
|
|
+ String appId = param.getAppId();
|
|
|
+ if (StringUtils.isNotBlank(appId)) {
|
|
|
+ //查询fs_user_wx的openId
|
|
|
+ FsUserWx fsUserWx = fsUserWxMapper.selectListByUserIdAndAppId(user.getUserId(),appId);
|
|
|
+ logger.info("用户微信信息==============={}",fsUserWx);
|
|
|
+ if (fsUserWx != null) {
|
|
|
+ openId = fsUserWx.getOpenId();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ appId = fsCoursePlaySourceConfigMapper.selectFsCoursePlaySourceConfigByAppId(param.getAppId()).getAppid();
|
|
|
+ openId = Objects.isNull(user) ? "" : user.getMaOpenId();
|
|
|
+ if (StringUtils.isBlank(openId)){
|
|
|
+ FsUserWx fsUserWx = fsUserWxMapper.selectListByUserIdAndAppId(user.getUserId(),appId);
|
|
|
+ logger.info("用户微信信息==============={}",fsUserWx);
|
|
|
+ if (Objects.nonNull(fsUserWx)){
|
|
|
+ openId = fsUserWx.getOpenId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(user!=null&& StringUtils.isNotEmpty(openId)){
|
|
|
String payCode = SnowflakeUtils.nextId();
|
|
|
- String json = configService.selectConfigByKey("store.pay");
|
|
|
- FsPayConfig fsPayConfig = JSON.parseObject(json, FsPayConfig.class);
|
|
|
+
|
|
|
|
|
|
FsStorePayment storePayment=new FsStorePayment();
|
|
|
storePayment.setCompanyId(order.getCompanyId());
|
|
|
@@ -3702,7 +3849,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
storePayment.setPayTypeCode("weixin");
|
|
|
storePayment.setBusinessType(2);
|
|
|
storePayment.setRemark("商城订单尾款支付");
|
|
|
- storePayment.setOpenId(user.getRealName());
|
|
|
+ storePayment.setOpenId(openId);
|
|
|
storePayment.setUserId(user.getUserId());
|
|
|
storePayment.setBusinessOrderId(order.getId().toString());
|
|
|
storePayment.setOrderId(order.getId());
|
|
|
@@ -3711,7 +3858,8 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
if (fsPayConfig.getType().equals("hf")){
|
|
|
HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
|
o.setTradeType("T_MINIAPP");
|
|
|
- o.setOpenid(user.getMaOpenId());
|
|
|
+ o.setOpenid(openId);
|
|
|
+ o.setAppId(appId);
|
|
|
o.setReqSeqId("store_remain-"+storePayment.getPayCode());
|
|
|
o.setTransAmt(storePayment.getPayMoney().toString());
|
|
|
o.setGoodsDesc("商城订单尾款支付");
|
|
|
@@ -3721,6 +3869,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
FsStorePayment mt=new FsStorePayment();
|
|
|
mt.setPaymentId(storePayment.getPaymentId());
|
|
|
mt.setTradeNo(result.getHf_seq_id());
|
|
|
+ mt.setAppId(appId);
|
|
|
fsStorePaymentMapper.updateFsStorePayment(mt);
|
|
|
redisCache.setCacheObject("isPaying:"+order.getId(),order.getId().toString(),1, TimeUnit.MINUTES);
|
|
|
return R.ok().put("result",result.getPay_info());
|
|
|
@@ -3728,6 +3877,8 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
else{
|
|
|
return R.error(result.getResp_desc());
|
|
|
}
|
|
|
+ }else if (fsPayConfig.getType().equals("wx")){
|
|
|
+ return orderService.pay(param);
|
|
|
}else if(fsPayConfig.getType().equals("yb")){
|
|
|
WxJspayDTO p = new WxJspayDTO();
|
|
|
// 使用setter方法为对象赋值
|
|
|
@@ -3736,7 +3887,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
|
|
|
p.setBody("商城订单尾款支付");
|
|
|
p.setIsMinipg("1");
|
|
|
p.setReturnUrl(fsPayConfig.getYbNotifyUrl());
|
|
|
- p.setOpenId(user.getMaOpenId());
|
|
|
+ p.setOpenId(openId);
|
|
|
p.setAttach("");
|
|
|
p.setStoreid("0");
|
|
|
CreateWxOrderResult wxOrder = ybPayService.createWxOrder(p);
|