fix: 82901 工作组--批量新增成员单位--工作组成员单位已存在--建议明确提示
This commit is contained in:
+13
-1
@@ -251,6 +251,7 @@ public class PayDraftingGroupSubItemController extends JeroController<PayDraftin
|
||||
return Result.error("起草组ids不能为空!");
|
||||
}
|
||||
String[] draftingGroupIdsArr = draftingGroupIds.split(",");
|
||||
List<String> errInfoList = new ArrayList<>();
|
||||
for (String draftingGroupId : draftingGroupIdsArr) {
|
||||
payDraftingGroupSubItem.setId(null);
|
||||
List<PayDraftingGroupSubItemContacts> payDraftingGroupSubItemContacts =
|
||||
@@ -261,7 +262,18 @@ public class PayDraftingGroupSubItemController extends JeroController<PayDraftin
|
||||
if (!StringUtils.isBlank(msg)) {
|
||||
return Result.error(msg.toString());
|
||||
}
|
||||
payDraftingGroupSubItemService.addPayDraftingGroupSubItem(payDraftingGroupSubItem);
|
||||
try {
|
||||
payDraftingGroupSubItemService.addPayDraftingGroupSubItem(payDraftingGroupSubItem);
|
||||
} catch (Exception e) {
|
||||
errInfoList.add(e.getMessage().replace("成员单位在起草组 ", "").replace(" 中已存在!",""));
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(errInfoList)) {
|
||||
StringBuilder sb = new StringBuilder("成员单位在起草组 ");
|
||||
errInfoList.forEach(e -> sb.append(e).append(","));
|
||||
sb.deleteCharAt(sb.length() - 1);
|
||||
sb.append(" 中已存在!");
|
||||
throw new JeroBootException(sb.toString());
|
||||
}
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
+2
-2
@@ -155,10 +155,10 @@ public class PayDraftingGroupSubItemServiceImpl extends ServiceImpl<PayDraftingG
|
||||
PayDraftingGroupSubItem payDraftingGroupSubItemNew = payDraftingGroupSubItemService.getOne(queryWrapper);
|
||||
// 企业和联系人同时存在,则校验不通过
|
||||
if (!Objects.isNull(payDraftingGroupSubItemNew)) {
|
||||
throw new JeroBootException("起草组成员单位已存在!");
|
||||
throw new JeroBootException("成员单位在起草组 " + payDraftingGroup.getDraftingGroupProject() + " 中已存在!");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new JeroBootException("起草组成员单位已存在!");
|
||||
throw new JeroBootException("成员单位在起草组 " + payDraftingGroup.getDraftingGroupProject() + " 中已存在!");
|
||||
}
|
||||
setPayDraftingGroupSubItemAdd(payDraftingGroupSubItem);
|
||||
payDraftingGroupSubItemService.save(payDraftingGroupSubItem);
|
||||
|
||||
+33
-21
@@ -430,27 +430,39 @@ public class PayWorkingGroupSubItemController extends JeroController<PayWorkingG
|
||||
@ApiOperation(value = "工作组成员-批量添加", notes = "工作组成员-批量添加")
|
||||
@PostMapping(value = "/batchAdd")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result<?> batchAdd(@RequestBody PayWorkingGroupSubItem payWorkingGroupSubItem) {
|
||||
String workingGroupIds = payWorkingGroupSubItem.getWorkingGroupIds();
|
||||
if (StringUtils.isBlank(workingGroupIds)) {
|
||||
return Result.error("工作组ids不能为空!");
|
||||
}
|
||||
String[] workingGroupIdsArr = workingGroupIds.split(",");
|
||||
for (String workingGroupId : workingGroupIdsArr) {
|
||||
payWorkingGroupSubItem.setId(null);
|
||||
List<PayWorkingGroupSubItemContacts> payWorkingGroupSubItemContactsList =
|
||||
payWorkingGroupSubItem.getPayWorkingGroupSubItemContactsList();
|
||||
payWorkingGroupSubItemContactsList.forEach(p-> p.setId(null));
|
||||
payWorkingGroupSubItem.setWorkingGroupId(workingGroupId);
|
||||
payWorkingGroupService.validAndSetDefaultValue(payWorkingGroupSubItem);
|
||||
StringBuilder msg = ValidUtil.validateAll(payWorkingGroupSubItem);
|
||||
if (!StringUtils.isBlank(msg)) {
|
||||
return Result.error(msg.toString());
|
||||
}
|
||||
payWorkingGroupSubItemService.addPayWorkingGroupSubItem(payWorkingGroupSubItem);
|
||||
}
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
public Result<?> batchAdd(@RequestBody PayWorkingGroupSubItem payWorkingGroupSubItem) {
|
||||
String workingGroupIds = payWorkingGroupSubItem.getWorkingGroupIds();
|
||||
if (StringUtils.isBlank(workingGroupIds)) {
|
||||
return Result.error("工作组ids不能为空!");
|
||||
}
|
||||
String[] workingGroupIdsArr = workingGroupIds.split(",");
|
||||
List<String> errInfoList = new ArrayList<>();
|
||||
for (String workingGroupId : workingGroupIdsArr) {
|
||||
payWorkingGroupSubItem.setId(null);
|
||||
List<PayWorkingGroupSubItemContacts> payWorkingGroupSubItemContactsList =
|
||||
payWorkingGroupSubItem.getPayWorkingGroupSubItemContactsList();
|
||||
payWorkingGroupSubItemContactsList.forEach(p -> p.setId(null));
|
||||
payWorkingGroupSubItem.setWorkingGroupId(workingGroupId);
|
||||
payWorkingGroupService.validAndSetDefaultValue(payWorkingGroupSubItem);
|
||||
StringBuilder msg = ValidUtil.validateAll(payWorkingGroupSubItem);
|
||||
if (!StringUtils.isBlank(msg)) {
|
||||
return Result.error(msg.toString());
|
||||
}
|
||||
try {
|
||||
payWorkingGroupSubItemService.addPayWorkingGroupSubItem(payWorkingGroupSubItem);
|
||||
} catch (Exception e) {
|
||||
errInfoList.add(e.getMessage().replace("成员单位在工作组 ", "").replace(" 中已存在!",""));
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(errInfoList)) {
|
||||
StringBuilder sb = new StringBuilder("成员单位在工作组 ");
|
||||
errInfoList.forEach(e -> sb.append(e).append(","));
|
||||
sb.deleteCharAt(sb.length() - 1);
|
||||
sb.append(" 中已存在!");
|
||||
throw new JeroBootException(sb.toString());
|
||||
}
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
|
||||
+2
-2
@@ -222,11 +222,11 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
|
||||
PayWorkingGroupSubItem payWorkingGroupSubItemNew = payWorkingGroupSubItemService.getOne(queryWrapper);
|
||||
// 企业和联系人同时存在,则校验不通过
|
||||
if (!Objects.isNull(payWorkingGroupSubItemNew)) {
|
||||
throw new JeroBootException("工作组成员单位已存在!");
|
||||
throw new JeroBootException("成员单位在工作组 " + payWorkingGroup.getWorkingGroupProject() + " 中已存在!");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info("工作组成员-添加异常", e);
|
||||
throw new JeroBootException("工作组成员单位已存在!");
|
||||
throw new JeroBootException("成员单位在工作组 " + payWorkingGroup.getWorkingGroupProject() + " 中已存在!");
|
||||
}
|
||||
if (!Objects.isNull(payWorkingGroupSubItem.getReceivableAmount()) && payWorkingGroupSubItem.getReceivableAmount().compareTo(new BigDecimal("0")) > 0) {
|
||||
payWorkingGroupSubItem.setPaymentStatus(PayProjectCommon.PAYMENT_STATUS);
|
||||
|
||||
Reference in New Issue
Block a user