|
|
@@ -13,6 +13,8 @@ import cn.hutool.json.JSONUtil;
|
|
|
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.annotation.DataScope;
|
|
|
import com.fs.common.config.FSSysConfig;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
@@ -34,6 +36,7 @@ import com.fs.course.service.IFsCourseRedPacketLogService;
|
|
|
import com.fs.his.config.FsSysConfig;
|
|
|
import com.fs.his.domain.FsUser;
|
|
|
import com.fs.his.domain.FsUserWx;
|
|
|
+import com.fs.his.mapper.FsUserWxMapper;
|
|
|
import com.fs.his.service.IFsUserService;
|
|
|
import com.fs.his.service.IFsUserWxService;
|
|
|
import com.fs.his.utils.ConfigUtil;
|
|
|
@@ -851,6 +854,8 @@ public class FsStorePaymentScrmServiceImpl implements IFsStorePaymentScrmService
|
|
|
|
|
|
@Autowired
|
|
|
private IFsUserService fsUserService;
|
|
|
+ @Autowired
|
|
|
+ private FsUserWxMapper fsUserWxMapper;
|
|
|
|
|
|
@Override
|
|
|
public R paymentByWxaCode(FsStorePaymentPayParam param) {
|
|
|
@@ -874,6 +879,26 @@ public class FsStorePaymentScrmServiceImpl implements IFsStorePaymentScrmService
|
|
|
|
|
|
//生成支付流水
|
|
|
String orderSn = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
|
+
|
|
|
+ //获取用户openid
|
|
|
+ String openId = null;
|
|
|
+ String appId = param.getAppId();
|
|
|
+
|
|
|
+ //查询fs_user_wx的openId
|
|
|
+ Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
|
|
|
+ .eq(FsUserWx::getFsUserId, param.getUserId())
|
|
|
+ .eq(FsUserWx::getAppId, appId);
|
|
|
+ FsUserWx fsUserWx = fsUserWxMapper.selectOne(queryWrapper);
|
|
|
+ if (fsUserWx != null) {
|
|
|
+ openId = fsUserWx.getOpenId();
|
|
|
+ }else {
|
|
|
+ openId = user.getMaOpenId();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(openId)){
|
|
|
+ return R.error("openId参数错误!");
|
|
|
+ }
|
|
|
+
|
|
|
FsStorePaymentScrm storePayment=new FsStorePaymentScrm();
|
|
|
storePayment.setCompanyId(param.getCompanyId());
|
|
|
//判断销售是否存在
|
|
|
@@ -887,7 +912,7 @@ public class FsStorePaymentScrmServiceImpl implements IFsStorePaymentScrmService
|
|
|
storePayment.setPayTypeCode("weixin");
|
|
|
storePayment.setBusinessType(1);//微信收款
|
|
|
storePayment.setRemark(StringUtils.isNotBlank(param.getRemark()) ? param.getRemark() : "商城收款订单支付");
|
|
|
- storePayment.setOpenId(user.getMaOpenId());
|
|
|
+ storePayment.setOpenId(openId);
|
|
|
storePayment.setUserId(user.getUserId());
|
|
|
storePayment.setPayMode("hf");//目前微信收款仅支持汇付
|
|
|
storePayment.setAppId(param.getAppId());
|
|
|
@@ -896,7 +921,7 @@ public class FsStorePaymentScrmServiceImpl implements IFsStorePaymentScrmService
|
|
|
//汇付支付
|
|
|
HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
|
o.setTradeType("T_MINIAPP");
|
|
|
- o.setOpenid(user.getMaOpenId());
|
|
|
+ o.setOpenid(openId);
|
|
|
o.setReqSeqId("payment-"+storePayment.getPayCode());
|
|
|
o.setTransAmt(storePayment.getPayMoney().toString());
|
|
|
o.setGoodsDesc("商城订单支付");
|