Bläddra i källkod

app 版本的销售公司 多商户号

三七 1 månad sedan
förälder
incheckning
aae219cd39

+ 2 - 2
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java

@@ -5472,7 +5472,7 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
                 // 调用第三方接口(锁外操作)
                 R sendRedPacket;
                 try {
-                    sendRedPacket = paymentService.sendAppRedPacket(packetParam);
+                    sendRedPacket = paymentService.sendAppRedPacket(packetParam, config);
                 } catch (Exception e) {
                     logger.error("红包发送异常: 异常请求参数{}", packetParam, e);
                     // 异常时回滚余额
@@ -5538,7 +5538,7 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
 
                 try{
                     // 发送红包
-                    R sendRedPacket = paymentService.sendAppRedPacket(packetParam);
+                    R sendRedPacket = paymentService.sendAppRedPacket(packetParam,config);
                     if (sendRedPacket.get("code").equals(200)) {
                         FsCourseRedPacketLog redPacketLog = new FsCourseRedPacketLog();
                         TransferBillsResult transferBillsResult;

+ 2 - 1
fs-service/src/main/java/com/fs/his/service/IFsStorePaymentService.java

@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.fs.common.core.domain.R;
 import com.fs.company.param.FsStoreStatisticsParam;
 import com.fs.company.vo.FsStorePaymentStatisticsVO;
+import com.fs.course.config.CourseConfig;
 import com.fs.his.domain.FsStorePayment;
 import com.fs.his.param.FsStorePaymentParam;
 import com.fs.his.param.PayOrderParam;
@@ -145,5 +146,5 @@ public interface IFsStorePaymentService
 
     List<FsStorePayment> selectAllPayment();
 
-    R sendAppRedPacket(WxSendRedPacketParam packetParam);
+    R sendAppRedPacket(WxSendRedPacketParam packetParam,CourseConfig config);
 }

+ 27 - 8
fs-service/src/main/java/com/fs/his/service/impl/FsStorePaymentServiceImpl.java

@@ -39,6 +39,7 @@ import com.fs.company.vo.FsStorePaymentStatisticsVO;
 import com.fs.config.cloud.CloudHostProper;
 import com.fs.core.config.WxMaConfiguration;
 import com.fs.core.utils.OrderCodeUtils;
+import com.fs.course.config.CourseConfig;
 import com.fs.course.config.RedPacketConfig;
 import com.fs.course.domain.FsCoursePlaySourceConfig;
 import com.fs.course.mapper.FsCoursePlaySourceConfigMapper;
@@ -2025,19 +2026,37 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
 
     @Override
     @Transactional
-    public R sendAppRedPacket(WxSendRedPacketParam param) {
+    public R sendAppRedPacket(WxSendRedPacketParam param, CourseConfig config) {
         //组合返回参数
         R result = new R();
-        String json = configService.selectConfigByKey("his.AppRedPacket");
-        AppRedPacketConfig config = JSONUtil.toBean(json, AppRedPacketConfig.class);
-        if (config.getIsNew() != null && config.getIsNew() == 1) {
-            result = sendRedPacketV3(param, config);
+
+        String json;
+        // 根据红包模式获取配置
+        switch (config.getRedPacketMode()){
+            case 1:
+                json = configService.selectConfigByKey("his.AppRedPacket");
+                break;
+            case 2:
+                 json = companyConfigService.selectRedPacketConfigByKeyApp(param.getCompanyId());
+                //如果分公司配置为空就走总后台的配置
+                if (StringUtils.isEmpty(json)){
+                    json = configService.selectConfigByKey("his.AppRedPacket");
+                }
+                break;
+            default:
+                throw new UnsupportedOperationException("当前红包模式不支持!");
+        }
+
+//        String json = configService.selectConfigByKey("his.AppRedPacket");
+        AppRedPacketConfig appRedConfig = JSONUtil.toBean(json, AppRedPacketConfig.class);
+        if (appRedConfig.getIsNew() != null && appRedConfig.getIsNew() == 1) {
+            result = sendRedPacketV3(param, appRedConfig);
         } else {
-            result= sendRedPacketLegacy(param, config);
+            result= sendRedPacketLegacy(param, appRedConfig);
         }
 
-        result.put("mchId", config.getMchId());
-        result.put("isNew",config.getIsNew());
+        result.put("mchId", appRedConfig.getMchId());
+        result.put("isNew",appRedConfig.getIsNew());
         logger.info("App提现返回:{}",result);
         return result;
     }