Commit 1054309f by zhangxingmin

push

parent dc01a705
......@@ -56,10 +56,7 @@ public class ApiAnnouncementCommissionRatioServiceImpl implements ApiAnnouncemen
*/
@Override
public Result batchSave(ApiAnnouncementCommissionRatioBatchSaveRequest request) {
Result result = checkBatchSaveRequestPram(request.getRatioBatchSaveDtoList());
if (result.getCode() != 200) {
return result;
}
checkBatchSaveRequestPram(request.getRatioBatchSaveDtoList());
List<String> announcementSpeciesBizIdList = new ArrayList<>();
announcementSpeciesBizIdList.add(request.getAnnouncementSpeciesBizId());
//先删后新增
......@@ -184,30 +181,19 @@ public class ApiAnnouncementCommissionRatioServiceImpl implements ApiAnnouncemen
* @return
*/
public Result checkBatchSaveRequestPram(List<ApiAnnouncementCommissionRatioBatchSaveDto> ratioBatchSaveDtoList) {
if (ratioBatchSaveDtoList == null || ratioBatchSaveDtoList.isEmpty()) {
return Result.success("数据为空,无需校验");
}
try {
// 1. 验证并准备数据
List<DtoWithParsedData> preparedDataList = prepareData(ratioBatchSaveDtoList);
if (preparedDataList == null) {
return Result.fail("数据准备失败,请检查输入数据");
}
// 2. 检查所有数据对的年限重叠情况(考虑scope交集)
List<OverlapError> errors = checkAllDataPairs(preparedDataList);
// 1. 验证并准备数据
List<DtoWithParsedData> preparedDataList = prepareData(ratioBatchSaveDtoList);
// 3. 如果有错误,返回错误信息
if (!errors.isEmpty()) {
String errorMsg = buildErrorMessage(errors, ratioBatchSaveDtoList);
return Result.fail(errorMsg);
}
// 2. 检查所有数据对的年限重叠情况(考虑scope交集)
List<OverlapError> errors = checkAllDataPairs(preparedDataList);
return Result.success("校验通过,无重叠数据");
} catch (Exception e) {
return Result.fail("数据校验异常:" + e.getMessage());
// 3. 如果有错误,返回错误信息
if (!errors.isEmpty()) {
String errorMsg = buildErrorMessage(errors, ratioBatchSaveDtoList);
throw new BusinessException(1004,errorMsg);
}
return Result.success();
}
/**
......
......@@ -70,6 +70,7 @@ public class ApiExpectedCommissionRatioServiceImpl implements ApiExpectedCommiss
.map(dto -> {
ExpectedCommissionRatio ratio = new ExpectedCommissionRatio();
BeanUtils.copyProperties(dto,ratio);
// ratio.setExpectedSpeciesBizId(request.getAnnouncementSpeciesBizId());
ratio.setExpectedCommissionRatioBizId(RandomStringGenerator.generateBizId16(CommonEnum.UID_TYPE_EXPECTED_COMMISSION_RATIO.getCode()));
return ratio;
}).collect(Collectors.toList());
......
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