zx 4 日 前
コミット
2a84132756

+ 2 - 0
fs-service/src/main/java/com/fs/hisStore/param/FsStorePaymentPayParam.java

@@ -20,4 +20,6 @@ public class FsStorePaymentPayParam implements Serializable
     private Long companyUserId;
 
     private String code;
+
+    private String appId;
 }

+ 9 - 5
fs-user-app/src/main/java/com/fs/app/controller/InquiryOrderController.java

@@ -248,13 +248,18 @@ public class InquiryOrderController extends  AppBaseController {
     @PostMapping("/payment")
     public R payment(HttpServletRequest request, @Validated @RequestBody FsInquiryOrderDoPayParam param)
     {
-        FsUser user = userService.selectFsUserByUserId(param.getUserId());
+
+        Long userId = Long.parseLong(getUserId());
+
+        FsUser user = userService.selectFsUserByUserId(userId);
+
         //在线支付
         String json = configService.selectConfigByKey("his.pay");
         PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
         String openId = "";
+
         if (StringUtils.isNotEmpty(param.getAppId())) {
-            FsUserWx fsUserWx = userWxService.selectByAppIdAndUserId(param.getAppId(), param.getUserId(), 1);
+            FsUserWx fsUserWx = userWxService.selectByAppIdAndUserId(param.getAppId(), userId, 1);
             if (fsUserWx != null) {
                 openId = fsUserWx.getOpenId();
             }
@@ -262,8 +267,8 @@ public class InquiryOrderController extends  AppBaseController {
             openId = Objects.isNull(user) ? "" : user.getMaOpenId();
             if (StringUtils.isBlank(openId)){
                 Wrapper<FsUserWx> queryWrapper = Wrappers.<FsUserWx>lambdaQuery()
-                        .eq(FsUserWx::getFsUserId, param.getUserId())
-                        .eq(FsUserWx::getAppId, payConfigDTO.getAppId());
+                        .eq(FsUserWx::getFsUserId, userId)
+                        .eq(FsUserWx::getAppId, param.getAppId());
                 FsUserWx fsUserWx = fsUserWxMapper.selectOne(queryWrapper);
                 if (Objects.nonNull(fsUserWx)){
                     openId = fsUserWx.getOpenId();
@@ -396,7 +401,6 @@ public class InquiryOrderController extends  AppBaseController {
                     return R.ok().put("isPay",0).put("data",result).put("type","tz");
                 }else if(payConfigDTO.getType().equals("hf")){
                     HuiFuCreateOrder o = new HuiFuCreateOrder();
-                    o.setAppId(param.getAppId());
                     o.setTradeType("T_MINIAPP");
                     o.setOpenid(openId);
                     o.setReqSeqId("inquiry-"+storePayment.getPayCode());

+ 8 - 1
fs-user-app/src/main/java/com/fs/app/controller/store/PaymentScrmController.java

@@ -44,7 +44,14 @@ public class PaymentScrmController extends AppBaseController {
     @PostMapping("/payment")
     @RepeatSubmit
     public R payment(@Validated @RequestBody FsStorePaymentPayParam payment, HttpServletRequest request){
-        final WxMaService wxService = WxMaConfiguration.getMaService(properties.getConfigs().get(0).getAppid());
+        String appId = null;
+        if (payment.getAppId()!=null && !"".equals(payment.getAppId())){
+            appId= payment.getAppId();
+        }else {
+            appId=properties.getConfigs().get(0).getAppid();
+        }
+
+        final WxMaService wxService = WxMaConfiguration.getMaService(appId);
         try {
             String ip = IpUtil.getRequestIp();
             WxMaJscode2SessionResult session = wxService.getUserService().getSessionInfo(payment.getCode());