Browse Source

红包领取

xgb 1 ngày trước cách đây
mục cha
commit
421f009d79

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

@@ -580,11 +580,7 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
     public R sendRedPacket(WxSendRedPacketParam param) {
     public R sendRedPacket(WxSendRedPacketParam param) {
         IFsStorePaymentService service = (IFsStorePaymentService) AopContext.currentProxy();
         IFsStorePaymentService service = (IFsStorePaymentService) AopContext.currentProxy();
 
 
-        if(StringUtils.equals(ENABLE_RED_PACK_ACCOUNT,"1")) {
-            return service.sendRedPacketDeduction(param);
-        } else {
-            return service.sendRedPacketLimit(param);
-        }
+        return service.sendRedPacketLimit(param);
     }
     }
 
 
 
 
@@ -627,28 +623,9 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
                 return R.error("[红包领取] 当前用户当前已经领取红包已经达到限制!");
                 return R.error("[红包领取] 当前用户当前已经领取红包已经达到限制!");
             }
             }
 
 
-            String json;
-            RedPacketConfig config = new RedPacketConfig();
             // 根据红包模式获取配置
             // 根据红包模式获取配置
-            switch (param.getRedPacketMode()){
-                case 1:
-                    json = redisCache.getCacheObject("sys_config:redPacket.config.new");
-                    if (StringUtil.isNullOrEmpty(json) || json.isEmpty()) {
-                        json = configService.selectConfigByKey("redPacket.config");
-                    }
-                    config = JSONUtil.toBean(json, RedPacketConfig.class);
-                    break;
-                case 2:
-                    json = companyConfigService.selectRedPacketConfigByKey(param.getCompanyId());
-                    //如果分公司配置为空就走总后台的配置
-                    if (StringUtils.isEmpty(json)){
-                        json = configService.selectConfigByKey("redPacket.config");
-                    }
-                    config = JSONUtil.toBean(json, RedPacketConfig.class);
-                    break;
-                default:
-                    throw new UnsupportedOperationException("当前红包模式不支持!");
-            }
+            String json = redisCache.getCacheObject("sys_config:redPacket.config.new");
+            RedPacketConfig config = JSONUtil.toBean(json, RedPacketConfig.class);
             //H5的用公众号的appid发,小程序的用小程序的appid来发
             //H5的用公众号的appid发,小程序的用小程序的appid来发
             if (param.getSource()==2){
             if (param.getSource()==2){
                 // 传参appId为空时,仍然使用配置里面的
                 // 传参appId为空时,仍然使用配置里面的
@@ -849,7 +826,23 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
     private R sendRedPacketV3Internal(WxSendRedPacketParam param, RedPacketConfig config) {
     private R sendRedPacketV3Internal(WxSendRedPacketParam param, RedPacketConfig config) {
 
 
         WxPayConfig payConfig = new WxPayConfig();
         WxPayConfig payConfig = new WxPayConfig();
-        BeanUtils.copyProperties(config, payConfig);
+
+        // 手动赋值,只复制非空属性
+        payConfig.setAppId(config.getAppId());
+        payConfig.setMchId(config.getMchId());
+        payConfig.setMchKey(config.getMchKey());
+        payConfig.setApiV3Key(config.getApiV3Key());
+        payConfig.setPrivateKeyPath(config.getPrivateKeyPath());
+        payConfig.setPrivateCertPath(config.getPrivateCertPath());
+        // ... 其他基础属性
+
+        // 公钥相关:仅当存在时才设置
+        if (StringUtils.isNotBlank(config.getPublicKeyPath())) {
+            payConfig.setPublicKeyPath(config.getPublicKeyPath());
+        }
+        if (StringUtils.isNotBlank(config.getPublicKeyId())) {
+            payConfig.setPublicKeyId(config.getPublicKeyId());
+        }
         WxPayService wxPayService = new WxPayServiceImpl();
         WxPayService wxPayService = new WxPayServiceImpl();
         wxPayService.setConfig(payConfig);
         wxPayService.setConfig(payConfig);
         TransferService transferService = wxPayService.getTransferService();
         TransferService transferService = wxPayService.getTransferService();