工作组成员导入修改

This commit is contained in:
梁琦涛
2021-09-02 18:00:21 +08:00
parent 9e9f234ced
commit cc9625f26c
2 changed files with 25 additions and 3 deletions
@@ -346,6 +346,17 @@ public class PayWorkingGroupSubItemController extends JeroController<PayWorkingG
@Transactional
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
String workGroupId;
try {
workGroupId = multipartRequest.getParameter("workGroupId");
}catch (Exception e){
log.error("获取工作组id异常",e);
throw new RuntimeException("工作组id不能为空 !");
}
if(StringUtils.isBlank(workGroupId)){
throw new RuntimeException("工作组id不能为空 !");
}
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
@@ -381,7 +392,12 @@ public class PayWorkingGroupSubItemController extends JeroController<PayWorkingG
if(CollectionUtils.isEmpty(listContactsInfo)){
throw new RuntimeException("excel中联系人不存在 !");
}
// 获取工作组成员
LambdaQueryWrapper<PayWorkingGroupSubItem> query = new LambdaQueryWrapper<>();
query.eq(PayWorkingGroupSubItem::getWorkingGroupId,workGroupId);
List<PayWorkingGroupSubItem> listData = payWorkingGroupSubItemService.list(query);
list.forEach(p->{
p.setWorkingGroupId(workGroupId);
int count = list.indexOf(p);
// 校验企业名称
List<PayCompanyManagement> listCompany = new ArrayList<>();
@@ -395,7 +411,6 @@ public class PayWorkingGroupSubItemController extends JeroController<PayWorkingG
msg.append("第 ").append(count + 3).append(" 行:企业名称不存在,请修改。</br>");
}else{
p.setChargeCompanyId(listCompany.get(0).getId());
}
}
// 校验联系人一
@@ -415,6 +430,14 @@ public class PayWorkingGroupSubItemController extends JeroController<PayWorkingG
}
}
}
// 校验工作组是否已存在成员
if(!StringUtils.isBlank(p.getChargeCompanyId()) && !StringUtils.isBlank(p.getContactsIdOne())){
List<PayWorkingGroupSubItem> listDateNew = listData.stream().filter(item->Objects.equals(p.getChargeCompanyId(),item.getChargeCompanyId())
&& Objects.equals(p.getContactsIdOne(),item.getContactsIdOne())).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(listDateNew)){
msg.append("第 ").append(count + 3).append(" 行:工作组成员已存在,请修改。</br>");
}
}
// 校验联系人二
if(!StringUtils.isBlank(p.getContactsTemporaryNameTwo()) && !CollectionUtils.isEmpty(listCompany)){
if(!CollectionUtils.isEmpty(listCompany)){
@@ -456,7 +479,7 @@ public class PayWorkingGroupSubItemController extends JeroController<PayWorkingG
Objects.equals(item.getName(),p.getMailContactsTemporaryName())
&& Objects.equals(item.getCompanyId(), finalListCompany.get(0).getId())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(listContacts)){
msg.append("第 ").append(count + 3).append(" 行:该企业下不存在该:邮寄联系人,请修改。</br>");
msg.append("第 ").append(count + 3).append(" 行:该企业下不存在该邮寄联系人,请修改。</br>");
}else{
p.setMailContactsId(listContacts.get(0).getId());
}
@@ -94,7 +94,6 @@ public class PayWorkingGroupSubItem implements Serializable {
@Excel(name = "应收金额(元)", width = 15)
@ApiModelProperty(value = "应收金额(元)")
@Max(value = 999999999,message = "应收金额(元)格式错误")
@NotNull(message = "应收金额(元)不能为空!")
private java.lang.Integer receivableAmount;
/**实收金额(元)*/
@ApiModelProperty(value = "实收金额(元)")