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