Commit a1121b01 by zhouhaibao

fix(excel): 修复门店Excel导入验证逻辑

- 移动字段验证方法调用位置以确保正确执行
- 修复比例验证范围从0-100改为0-1的逻辑错误
- 添加固定值最大限制99999的验证规则
- 统一错误提示信息格式为"超出范围"
1 parent e0b17d18
......@@ -477,6 +477,14 @@ public class StoreExcelImportService {
categoryIdList.add(ruleDTO.getProductCategoryId());
}
}
validateTrafficPartyFields(ruleDTO, rowNum, errors);
validateProductCostOwnership(ruleDTO, rowNum, errors);
validateServiceProviderFields(ruleDTO, rowNum, errors);
validateResourceFeeFields(ruleDTO, rowNum, errors);
validateOtherFeeFields(ruleDTO, rowNum, errors);
validateManagementMarketFeeFields(ruleDTO, rowNum, errors);
validateSunshineFields(ruleDTO, rowNum, errors);
}
}
......@@ -494,14 +502,6 @@ public class StoreExcelImportService {
} else {
validateProductCategoryExists(ruleDTO, rowNum, errors, baseSceneCode);
}
validateTrafficPartyFields(ruleDTO, rowNum, errors);
validateProductCostOwnership(ruleDTO, rowNum, errors);
validateServiceProviderFields(ruleDTO, rowNum, errors);
validateResourceFeeFields(ruleDTO, rowNum, errors);
validateOtherFeeFields(ruleDTO, rowNum, errors);
validateManagementMarketFeeFields(ruleDTO, rowNum, errors);
validateSunshineFields(ruleDTO, rowNum, errors);
}
private void validateTrafficPartyFields(StoreWithProductsDTO.ProductCategoryRuleDTO ruleDTO, Integer rowNum,
......@@ -895,7 +895,7 @@ public class StoreExcelImportService {
}
if (isProportion) {
if (ratio.compareTo(new BigDecimal(0)) < 0 || ratio.compareTo(new BigDecimal(100)) > 0) {
if (ratio.compareTo(new BigDecimal(0)) < 0 || ratio.compareTo(new BigDecimal(1)) > 0) {
errors.add(new ImportErrorInfo(rowNum, fieldName + "超出范围", errors));
return ratio;
}
......@@ -906,8 +906,8 @@ public class StoreExcelImportService {
return ratio.multiply(new BigDecimal(100));
} else if (isFixed) {
if (ratio.compareTo(new BigDecimal(0)) < 0) {
errors.add(new ImportErrorInfo(rowNum, fieldName + "不能为负数", errors));
if (ratio.compareTo(new BigDecimal(0)) < 0 || ratio.compareTo(new BigDecimal(999999)) > 0) {
errors.add(new ImportErrorInfo(rowNum, fieldName + "超出范围", errors));
}
if (ratio.scale() > 2) {
errors.add(new ImportErrorInfo(rowNum, fieldName + "精度超出范围", errors));
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!