|
|
@@ -4,6 +4,8 @@ import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.fs.app.domain.FsAppRole;
|
|
|
import com.fs.app.mapper.FsAppRoleMapper;
|
|
|
import com.fs.common.exception.CustomException;
|
|
|
@@ -291,6 +293,9 @@ public class Task {
|
|
|
@Autowired
|
|
|
private IJdHttpService jdHttpService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private FsUserWxMapper fsUserWxMapper;
|
|
|
+
|
|
|
public static final String SOP_TEMP_VOICE_KEY = "sop:tempVoice";
|
|
|
|
|
|
// sop升单客户类型
|
|
|
@@ -325,6 +330,7 @@ public class Task {
|
|
|
FsUser fsUser = fsUserMapper.selectFsUserById(fsWxExpressTask.getUserId());
|
|
|
FsStoreOrderScrm fsStoreOrder = fsStoreOrderMapper.selectFsStoreOrderByOrderCodeScrm(fsWxExpressTask.getOrderCode());
|
|
|
|
|
|
+ String appId = null;
|
|
|
|
|
|
if(ObjectUtil.isNotNull(fsStoreOrder)){
|
|
|
List<FsStorePaymentScrm> fsStorePayments = paymentScrmService.selectFsStorePaymentByOrderScrmStatus1(fsStoreOrder.getId());
|
|
|
@@ -333,6 +339,7 @@ public class Task {
|
|
|
if(CollectionUtils.isNotEmpty(fsStorePayments)){
|
|
|
FsStorePaymentScrm fsStorePayment = fsStorePayments.get(0);
|
|
|
orderKey.setTransactionId(fsStorePayment.getBankTransactionId());
|
|
|
+ appId = fsStorePayment.getAppId();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -344,8 +351,19 @@ public class Task {
|
|
|
}
|
|
|
|
|
|
Payer payer = new Payer();
|
|
|
- if(StringUtils.isNotBlank(fsUser.getMaOpenId())){
|
|
|
- payer.setOpenid(fsUser.getMaOpenId());
|
|
|
+ if (StringUtils.isNotEmpty(appId)) {
|
|
|
+ //查询fs_user_wx的openId
|
|
|
+ Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
|
|
|
+ .eq(FsUserWx::getFsUserId, fsUser.getUserId())
|
|
|
+ .eq(FsUserWx::getAppId, appId);
|
|
|
+ FsUserWx fsUserWx = fsUserWxMapper.selectOne(queryWrapper);
|
|
|
+ if (fsUserWx != null) {
|
|
|
+ payer.setOpenid(fsUserWx.getOpenId());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if(StringUtils.isNotBlank(fsUser.getMaOpenId())){
|
|
|
+ payer.setOpenid(fsUser.getMaOpenId());
|
|
|
+ }
|
|
|
}
|
|
|
request.setPayer(payer);
|
|
|
request.setOrderKey(orderKey);
|