|
|
@@ -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());
|