Commit 59489d02 by guojuxing

商户规则rule_level校验修复

parent 2df022b1
...@@ -165,7 +165,7 @@ public class ConfigRuleApiServiceImpl implements ConfigRuleApiService { ...@@ -165,7 +165,7 @@ public class ConfigRuleApiServiceImpl implements ConfigRuleApiService {
if (record == null) { if (record == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "分类ID错误,分类不存在"); return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "分类ID错误,分类不存在");
} }
if (TWO.equals(record.getRuleLevel())) { if (isNotRightRuleLevel(record.getRuleLevel(), TWO)) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "分类ID错误,不是分类类型"); return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "分类ID错误,不是分类类型");
} }
dto.setParentRuleId(record.getParentRuleId()); dto.setParentRuleId(record.getParentRuleId());
...@@ -208,7 +208,7 @@ public class ConfigRuleApiServiceImpl implements ConfigRuleApiService { ...@@ -208,7 +208,7 @@ public class ConfigRuleApiServiceImpl implements ConfigRuleApiService {
if (record == null) { if (record == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "场景ID错误,场景不存在"); return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "场景ID错误,场景不存在");
} }
if (THREE.equals(record.getRuleLevel())) { if (isNotRightRuleLevel(record.getRuleLevel(), THREE)) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "场景ID错误,不是场景类型"); return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "场景ID错误,不是场景类型");
} }
dto.setParentRuleId(record.getParentRuleId()); dto.setParentRuleId(record.getParentRuleId());
...@@ -237,7 +237,7 @@ public class ConfigRuleApiServiceImpl implements ConfigRuleApiService { ...@@ -237,7 +237,7 @@ public class ConfigRuleApiServiceImpl implements ConfigRuleApiService {
if (record == null) { if (record == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "分类ID错误,分类不存在"); return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "分类ID错误,分类不存在");
} }
if (TWO.equals(record.getRuleLevel())) { if (isNotRightRuleLevel(record.getRuleLevel(), TWO)) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "分类ID错误,不是分类类型"); return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "分类ID错误,不是分类类型");
} }
configRuleService.update(new TabConfigRule().setRuleId(ruleId).setDeleteFlag(0)); configRuleService.update(new TabConfigRule().setRuleId(ruleId).setDeleteFlag(0));
...@@ -257,7 +257,7 @@ public class ConfigRuleApiServiceImpl implements ConfigRuleApiService { ...@@ -257,7 +257,7 @@ public class ConfigRuleApiServiceImpl implements ConfigRuleApiService {
if (record == null) { if (record == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "场景ID错误,场景不存在"); return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "场景ID错误,场景不存在");
} }
if (THREE.equals(record.getRuleLevel())) { if (isNotRightRuleLevel(record.getRuleLevel(), THREE)) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "场景ID错误,不是场景类型"); return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "场景ID错误,不是场景类型");
} }
configRuleService.update(new TabConfigRule().setRuleId(ruleId).setDeleteFlag(0)); configRuleService.update(new TabConfigRule().setRuleId(ruleId).setDeleteFlag(0));
...@@ -626,7 +626,7 @@ public class ConfigRuleApiServiceImpl implements ConfigRuleApiService { ...@@ -626,7 +626,7 @@ public class ConfigRuleApiServiceImpl implements ConfigRuleApiService {
if (StringUtils.isBlank(dto.getMarketName())) { if (StringUtils.isBlank(dto.getMarketName())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "手动输入名称不能为空"); return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "手动输入名称不能为空");
} }
if (TWO.equals(record.getRuleLevel())) { if (isNotRightRuleLevel(record.getRuleLevel(), TWO)) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "分类ID错误,不是分类类型"); return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "分类ID错误,不是分类类型");
} }
if (StringUtils.isBlank(dto.getMarketScene())) { if (StringUtils.isBlank(dto.getMarketScene())) {
...@@ -666,4 +666,8 @@ public class ConfigRuleApiServiceImpl implements ConfigRuleApiService { ...@@ -666,4 +666,8 @@ public class ConfigRuleApiServiceImpl implements ConfigRuleApiService {
return result; return result;
} }
private static boolean isNotRightRuleLevel(Integer ruleLevel, Integer constants) {
return !constants.equals(ruleLevel);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment