Commit 1b0e7b09 by 章家宝

提成参数非空判断

1 parent 1478b8a5
...@@ -9,6 +9,7 @@ import cn.com.glsx.dj.staff.util.CommonUtil; ...@@ -9,6 +9,7 @@ import cn.com.glsx.dj.staff.util.CommonUtil;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse; import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.rop.response.RopResponse; import cn.com.glsx.framework.rop.response.RopResponse;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -28,6 +29,10 @@ public class PerformanceConfigService { ...@@ -28,6 +29,10 @@ public class PerformanceConfigService {
} }
PerformanceConfigDTO performanceConfig = CommonUtil.convertRequest(PerformanceConfigDTO.class); PerformanceConfigDTO performanceConfig = CommonUtil.convertRequest(PerformanceConfigDTO.class);
if (!check(performanceConfig)) {
log.error("参数错误, 参数为空.");
return RopResponse.error(RopErrorEnum.PERFORMANCE_SCHEME_REQUIREMENT_PARAM_ERROR);
};
// 名称不能重复, 除非id相同 // 名称不能重复, 除非id相同
RpcResponse<PerformanceConfigDTO> performanceConfigDTORpcResponse = performanceConfigRemote.selectByName(performanceConfig); RpcResponse<PerformanceConfigDTO> performanceConfigDTORpcResponse = performanceConfigRemote.selectByName(performanceConfig);
PerformanceConfigDTO result = performanceConfigDTORpcResponse.getResult(); PerformanceConfigDTO result = performanceConfigDTORpcResponse.getResult();
...@@ -40,7 +45,7 @@ public class PerformanceConfigService { ...@@ -40,7 +45,7 @@ public class PerformanceConfigService {
performanceConfig.setEnableFlag("N"); performanceConfig.setEnableFlag("N");
List<PerformanceParamConfigDTO> performanceParamConfigList = request.getParamConfigList(); List<PerformanceParamConfigDTO> performanceParamConfigList = request.getParamConfigList();
if (performanceParamConfigList == null) { if (performanceParamConfigList == null) {
performanceParamConfigList = new ArrayList<>(); return RopResponse.error(RopErrorEnum.PERFORMANCE_SCHEME_REQUIREMENT_PARAM_ERROR, "提成参数为空,错误。");
} }
// 一个考核因子最多有十个不同的产品,或者套餐,如果选择了全部产品,则不能选择商品分类 // 一个考核因子最多有十个不同的产品,或者套餐,如果选择了全部产品,则不能选择商品分类
PerformanceConfigRuleDTO performanceConfigRule = request.getPerformanceConfigRule(); PerformanceConfigRuleDTO performanceConfigRule = request.getPerformanceConfigRule();
...@@ -118,6 +123,47 @@ public class PerformanceConfigService { ...@@ -118,6 +123,47 @@ public class PerformanceConfigService {
return RopResponse.success(performanceConfigRemote.performanceConfigSave(performanceConfig).getResult()); return RopResponse.success(performanceConfigRemote.performanceConfigSave(performanceConfig).getResult());
} }
private boolean check(PerformanceConfigDTO performanceConfig) {
if (performanceConfig == null) {
log.info(" 方案为空,错误。");
return false;
}
if (performanceConfig.getSchemeName() == null) {
log.info(" 方案名称为空,错误。");
return false;
}
if (performanceConfig.getSchemeType() == null) {
log.info(" 方案类型为空,错误。");
return false;
}
if (StringUtils.isBlank(performanceConfig.getEffectiveMonth())) {
log.info(" 生效月份为空,错误。");
return false;
}
PerformanceConfigRuleDTO performanceConfigRule = performanceConfig.getPerformanceConfigRule();
if (performanceConfigRule == null) {
log.info(" 提成方案配置为空,错误。");
return false;
}
if (StringUtils.isBlank(performanceConfigRule.getAssessmentFactors())) {
log.info(" 考核因子为空,错误。");
return false;
}
if (StringUtils.isBlank(performanceConfigRule.getCommissionBases())) {
log.info(" 提成基数为空,错误。");
return false;
}
if (StringUtils.isBlank(performanceConfigRule.getCommissionTypes())) {
log.info(" 提成方式为空,错误。");
return false;
}
if (StringUtils.isBlank(performanceConfigRule.getGoodsConfigTypes())) {
log.info(" 商品配置方式为空,错误。");
return false;
}
return true;
}
/** /**
* 检测考核因子配置的数量是否符合规定 * 检测考核因子配置的数量是否符合规定
*/ */
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!