Ver Fonte

更新!

TRX há 1 ano atrás
pai
commit
da0199e6ed

+ 0 - 1
FullCardClient/src/main/java/com/zhongshu/card/client/model/paySetting/paySetting/ProjectMainPaySettingParam.java

@@ -45,7 +45,6 @@ public class ProjectMainPaySettingParam {
     //---------------定期结算 设置
 
     @Schema(description = "定期类型")
-    @NotNull
     private RegularType regularType;
 
     @Schema(description = "定期结算时间")

+ 1 - 1
FullCardServer/src/main/java/com/zhongshu/card/server/core/domain/paySetting/ProjectMainPaySetting.java

@@ -95,7 +95,7 @@ public class ProjectMainPaySetting extends SuperMain {
     private BigDecimal orgScale = BigDecimal.ZERO;
 
     @Schema(description = "锁过期时间")
-    private long expireAt;
+    private Long expireAt;
 
     @Schema(description = "锁token")
     private String token;

+ 55 - 5
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/paySetting/ProjectMainPaySettingService.java

@@ -15,12 +15,14 @@ import com.zhongshu.card.server.core.domain.paySetting.ProjectOrgPaySettingInfo;
 import com.zhongshu.card.server.core.service.base.SuperService;
 import com.zhongshu.card.server.core.service.schedule.ScheduleTaskConfigService;
 import com.zhongshu.card.server.core.util.BeanUtils;
+import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -71,11 +73,37 @@ public class ProjectMainPaySettingService extends SuperService {
         if (orgPaySettingInfo.getIsDefault() == null || !orgPaySettingInfo.getIsDefault()) {
             return ResultContent.buildFail("选择的不是主账户类型");
         }
-        if (param.getSettlementRulesType() == SettlementRulesType.Dn && StringUtils.isEmpty(param.getDnTimeStr())) {
-            return ResultContent.buildFail("dnTimeStr不能为空");
+        if (param.getSettlementRulesType() == SettlementRulesType.Dn) {
+            if (StringUtils.isEmpty(param.getDnTimeStr())) {
+                return ResultContent.buildFail("dnTimeStr不能为空");
+            }
+            param.setRegularTimeStr("");
+        }
+        if (param.getSettlementRulesType() == SettlementRulesType.Regular) {
+            if (StringUtils.isEmpty(param.getRegularTimeStr())) {
+                return ResultContent.buildFail("regularTimeStr不能为空");
+            }
+            param.setDnTimeStr("");
+        }
+        // 项目 的分成
+        BigDecimal projectScale = param.getProjectScale();
+        if (projectScale != null) {
+            if (BigDecimal.ZERO.compareTo(projectScale) == 1 ||
+                    BigDecimal.valueOf(100).compareTo(projectScale) == -1) {
+                return ResultContent.buildFail("projectScale不符合要求");
+            }
+        }
+        // 机构 的分成
+        BigDecimal orgScale = param.getOrgScale();
+        if (projectScale != null) {
+            if (BigDecimal.ZERO.compareTo(orgScale) == 1 ||
+                    BigDecimal.valueOf(100).compareTo(orgScale) == -1) {
+                return ResultContent.buildFail("orgScale不符合要求");
+            }
         }
-        if (param.getSettlementRulesType() == SettlementRulesType.Regular && StringUtils.isEmpty(param.getRegularTimeStr())) {
-            return ResultContent.buildFail("regularTimeStr不能为空");
+        BigDecimal all = orgScale.add(projectScale);
+        if (all.compareTo(BigDecimal.valueOf(100)) != 0) {
+            return ResultContent.buildFail("项目分成和机构分成之和不等100");
         }
 
         ProjectMainPaySetting mainPaySetting = projectMainPaySettingDao.findTopByProjectOidAndChannelType(
@@ -93,7 +121,7 @@ public class ProjectMainPaySettingService extends SuperService {
 
         projectMainPaySettingDao.save(mainPaySetting);
         // 加入结算定时任务
-        scheduleTaskConfigService.initProjectSettlementRulesTask(mainPaySetting);
+//        scheduleTaskConfigService.initProjectSettlementRulesTask(mainPaySetting);
         return ResultContent.buildSuccess();
     }
 
@@ -140,6 +168,28 @@ public class ProjectMainPaySettingService extends SuperService {
             entity = new PayShareList();
             initEntityNoCheckOid(entity);
         }
+
+        // 项目 的分成
+        BigDecimal projectScale = param.getProjectScale();
+        if (projectScale != null) {
+            if (BigDecimal.ZERO.compareTo(projectScale) == 1 ||
+                    BigDecimal.valueOf(100).compareTo(projectScale) == -1) {
+                return ResultContent.buildFail("projectScale不符合要求");
+            }
+        }
+        // 机构 的分成
+        BigDecimal orgScale = param.getOrgScale();
+        if (projectScale != null) {
+            if (BigDecimal.ZERO.compareTo(orgScale) == 1 ||
+                    BigDecimal.valueOf(100).compareTo(orgScale) == -1) {
+                return ResultContent.buildFail("orgScale不符合要求");
+            }
+        }
+        BigDecimal all = orgScale.add(projectScale);
+        if (all.compareTo(BigDecimal.valueOf(100)) != 0) {
+            return ResultContent.buildFail("项目分成和机构分成之和不等100");
+        }
+
         BeanUtils.copyProperties(param, entity);
         entity.setProjectInfo(projectInfo);
         entity.setProjectCode(projectInfo.getCode());

+ 2 - 2
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/schedule/ScheduleTaskConfigService.java

@@ -59,7 +59,7 @@ public class ScheduleTaskConfigService {
             try {
                 String lockKey = projectMainPaySettingDao.acquire(entity.getId(), 5000L);
                 if (StringUtils.isNotEmpty(lockKey)) {
-                    String aboutDataId = entity.getProjectOid();
+                    String aboutDataId = entity.getProjectOid() + "_" + entity.getChannelType().name();
                     ScheduleTaskConfig taskConfig = scheduleTaskConfigDao.findTopByAboutDataId(aboutDataId);
                     if (ObjectUtils.isNotEmpty(taskConfig)) {
                         taskConfig = new ScheduleTaskConfig();
@@ -69,7 +69,7 @@ public class ScheduleTaskConfigService {
                     taskConfig.setScheduleType(ScheduleType.SettlementTask);
                     String expression = "";
                     String timeStr = entity.getTimeStr();
-                    
+
                     String[] timeParts = timeStr.split(":");
                     String hour = timeParts[0];
                     String minute = timeParts[1];