diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/project/controller/PayWorkingGroupSubItemController.java b/jero-boot-incoming-payment/src/main/java/com/jero/project/controller/PayWorkingGroupSubItemController.java index 89a7c272..57c2650a 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/project/controller/PayWorkingGroupSubItemController.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/project/controller/PayWorkingGroupSubItemController.java @@ -561,6 +561,24 @@ public class PayWorkingGroupSubItemController extends JeroController editAccount(@RequestParam(name = "workGroupId") String workGroupId, + @RequestParam(name = "companyId") String companyId) { + payWorkingGroupSubItemService.editAccount(workGroupId, companyId); + payWorkingGroupSubItemService.delete(companyId); + return Result.OK("调账成功!"); + } + /** * 批量删除 * diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/project/service/IPayWorkingGroupSubItemService.java b/jero-boot-incoming-payment/src/main/java/com/jero/project/service/IPayWorkingGroupSubItemService.java index 4ba05752..f4374d11 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/project/service/IPayWorkingGroupSubItemService.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/project/service/IPayWorkingGroupSubItemService.java @@ -136,4 +136,12 @@ public interface IPayWorkingGroupSubItemService extends IService queryList(QueryWrapper queryPayWorkingGroupSubItem); + + /** + * 调账 + * + * @param workGroupId 工作组id + * @param companyId 成员单位id + */ + void editAccount(String workGroupId, String companyId); } diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/project/service/impl/PayWorkingGroupSubItemServiceImpl.java b/jero-boot-incoming-payment/src/main/java/com/jero/project/service/impl/PayWorkingGroupSubItemServiceImpl.java index 1e1052c5..231f9d23 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/project/service/impl/PayWorkingGroupSubItemServiceImpl.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/project/service/impl/PayWorkingGroupSubItemServiceImpl.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.jero.common.api.vo.Result; import com.jero.common.common.ProjectCommon; import com.jero.common.dto.PaySendContactsMessageDTO; import com.jero.common.dto.SendMessageDTO; @@ -43,6 +44,7 @@ import com.jero.project.common.PayProjectCommon; import com.jero.project.entity.*; import com.jero.project.mapper.PayWorkingGroupSubItemContactsMapper; import com.jero.project.mapper.PayWorkingGroupSubItemMapper; +import com.jero.project.service.IPayCommonProjectService; import com.jero.project.service.IPayWorkingGroupService; import com.jero.project.service.IPayWorkingGroupSubItemContactsService; import com.jero.project.service.IPayWorkingGroupSubItemService; @@ -79,7 +81,7 @@ import java.util.stream.Collectors; /** * @Description: pay_working_group_subitem * @Author: jeecg-boot - * @Date: 2021-08-27 + * @Date: 2021-08-27 * @Version: V1.0 */ @Slf4j @@ -130,19 +132,21 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl queryPageList(Page page, PayWorkingGroupSubItem payWorkingGroupSubitem,String paymentDate) { + public IPage queryPageList(Page page, PayWorkingGroupSubItem payWorkingGroupSubitem, String paymentDate) { IPage payWorkingGroupSubItemIPage = payWorkingGroupSubItemMapper.queryPageList(page, payWorkingGroupSubitem, paymentDate); List records = payWorkingGroupSubItemIPage.getRecords(); - if(!CollectionUtils.isEmpty(records)){ + if (!CollectionUtils.isEmpty(records)) { // 获取企业联系人 List listIds = records.stream().map(PayWorkingGroupSubItem::getId).collect(Collectors.toList()); LambdaQueryWrapper queryPayWorkingGroupSubItemContacts = new LambdaQueryWrapper<>(); - queryPayWorkingGroupSubItemContacts.in(PayWorkingGroupSubItemContacts::getWorkingGroupSubId,listIds); + queryPayWorkingGroupSubItemContacts.in(PayWorkingGroupSubItemContacts::getWorkingGroupSubId, listIds); List payWorkingGroupSubItemContactsList = payWorkingGroupSubItemContactsService.list(queryPayWorkingGroupSubItemContacts); for (PayWorkingGroupSubItem workingGroupSubItem : records) { if (StringUtils.isNotBlank(payWorkingGroupSubitem.getMeetingId())) { @@ -157,17 +161,17 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl pwg = payWorkingGroupSubItemContactsList.stream().filter(p->Objects.equals(p.getWorkingGroupSubId(),workingGroupSubItem.getId())).collect(Collectors.toList()); - if(!CollectionUtils.isEmpty(pwg)){ + if (!CollectionUtils.isEmpty(payWorkingGroupSubItemContactsList)) { + List pwg = payWorkingGroupSubItemContactsList.stream().filter(p -> Objects.equals(p.getWorkingGroupSubId(), workingGroupSubItem.getId())).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(pwg)) { pwg.sort(Comparator.comparing(PayWorkingGroupSubItemContacts::getOrderNum)); workingGroupSubItem.setContactsTemporaryNameOne(pwg.get(0).getContactsTemporaryName()); workingGroupSubItem.setPayWorkingGroupSubItemContactsList(pwg); - }else{ + } else { workingGroupSubItem.setContactsTemporaryNameOne(""); workingGroupSubItem.setPayWorkingGroupSubItemContactsList(null); } - }else{ + } else { workingGroupSubItem.setContactsTemporaryNameOne(""); workingGroupSubItem.setPayWorkingGroupSubItemContactsList(null); } @@ -180,51 +184,51 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl listPayWorkingGroupSubItemContacts = payWorkingGroupSubItem.getPayWorkingGroupSubItemContactsList(); - if(!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContacts)){ + if (!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContacts)) { long oldNum = listPayWorkingGroupSubItemContacts.size(); long newNum = listPayWorkingGroupSubItemContacts.stream().map(PayWorkingGroupSubItemContacts::getContactsId).collect(Collectors.toList()).stream().distinct().count(); - if(oldNum != newNum){ + if (oldNum != newNum) { throw new JeroBootException("企业联系人重复"); } } - if(Objects.equals(payWorkingGroupSubItem.getChargeWay(),PayProjectCommon.CHARGE_WAY2)){ - if(Objects.isNull(payWorkingGroupSubItem.getReceivableAmount())){ + if (Objects.equals(payWorkingGroupSubItem.getChargeWay(), PayProjectCommon.CHARGE_WAY2)) { + if (Objects.isNull(payWorkingGroupSubItem.getReceivableAmount())) { throw new JeroBootException("待确收金额不能为空"); } - if(StringUtils.isBlank(payWorkingGroupSubItem.getContractNum())){ + if (StringUtils.isBlank(payWorkingGroupSubItem.getContractNum())) { throw new JeroBootException("合同号不能为空"); } } - if(Objects.equals(payWorkingGroupSubItem.getChargeWay(),PayProjectCommon.CHARGE_WAY3)){ - if(Objects.isNull(payWorkingGroupSubItem.getChargeNoticeNo())){ + if (Objects.equals(payWorkingGroupSubItem.getChargeWay(), PayProjectCommon.CHARGE_WAY3)) { + if (Objects.isNull(payWorkingGroupSubItem.getChargeNoticeNo())) { throw new JeroBootException("收费通知号不能为空"); } - if(Objects.isNull(payWorkingGroupSubItem.getReceivableAmount())){ + if (Objects.isNull(payWorkingGroupSubItem.getReceivableAmount())) { throw new JeroBootException("待确收金额不能为空"); } } PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(payWorkingGroupSubItem.getWorkingGroupId()); - if(Objects.isNull(payWorkingGroup)){ + if (Objects.isNull(payWorkingGroup)) { throw new JeroBootException("工作组不存在!"); } try { // 编辑保存前再次校验来款项目是否存在 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(PayWorkingGroupSubItem::getWorkingGroupId,payWorkingGroupSubItem.getWorkingGroupId()); - queryWrapper.eq(PayWorkingGroupSubItem::getChargeCompanyId,payWorkingGroupSubItem.getChargeCompanyId()); + queryWrapper.eq(PayWorkingGroupSubItem::getWorkingGroupId, payWorkingGroupSubItem.getWorkingGroupId()); + queryWrapper.eq(PayWorkingGroupSubItem::getChargeCompanyId, payWorkingGroupSubItem.getChargeCompanyId()); PayWorkingGroupSubItem payWorkingGroupSubItemNew = payWorkingGroupSubItemService.getOne(queryWrapper); // 企业和联系人同时存在,则校验不通过 - if(!Objects.isNull(payWorkingGroupSubItemNew)) { + if (!Objects.isNull(payWorkingGroupSubItemNew)) { throw new JeroBootException("工作组成员单位已存在!"); } - }catch (Exception e){ - log.info("工作组成员-添加异常",e); + } catch (Exception e) { + log.info("工作组成员-添加异常", e); throw new JeroBootException("工作组成员单位已存在!"); } - 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); } setPayWorkingGroupSubItemAdd(payWorkingGroupSubItem); @@ -236,9 +240,9 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl listPayWorkingGroupSubItemContactsNew = payWorkingGroupSubItem.getPayWorkingGroupSubItemContactsList(); // 添加联系人表 - if(!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContactsNew)){ + if (!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContactsNew)) { for (int i = 0; i < listPayWorkingGroupSubItemContactsNew.size(); i++) { - listPayWorkingGroupSubItemContactsNew.get(i).setOrderNum(i+1); + listPayWorkingGroupSubItemContactsNew.get(i).setOrderNum(i + 1); listPayWorkingGroupSubItemContactsNew.get(i).setWorkingGroupId(payWorkingGroupSubItem.getWorkingGroupId()); listPayWorkingGroupSubItemContactsNew.get(i).setWorkingGroupSubId(payWorkingGroupSubItem.getId()); } @@ -246,46 +250,46 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl listFile = new ArrayList<>(); // 获取收费通知 - if(Objects.equals(payWorkingGroupSubItem.getChargeWay(),PayProjectCommon.CHARGE_WAY3) && StringUtils.isNotBlank(payWorkingGroupSubItem.getChargeNoticeId())){ + if (Objects.equals(payWorkingGroupSubItem.getChargeWay(), PayProjectCommon.CHARGE_WAY3) && StringUtils.isNotBlank(payWorkingGroupSubItem.getChargeNoticeId())) { OSSFile file = iossFileService.getById(payWorkingGroupSubItem.getChargeNoticeId()); String path = env.getProperty("jero.path.upload") + File.separator; listFile.add(path + file.getUrl()); } // 来款方式为合同,校验合同编号 - if(Objects.equals(payWorkingGroupSubItem.getChargeWay(),PayProjectCommon.CHARGE_WAY2)){ - PayIncomeContract payIncomeContract = payIncomeContractService.setPayIncomeContractAssociated(payWorkingGroupSubItem.getContractNum(),payWorkingGroupSubItem.getChargeCompanyId(),payWorkingGroupSubItem.getId()); - if(!Objects.isNull(payIncomeContract)){ + if (Objects.equals(payWorkingGroupSubItem.getChargeWay(), PayProjectCommon.CHARGE_WAY2)) { + PayIncomeContract payIncomeContract = payIncomeContractService.setPayIncomeContractAssociated(payWorkingGroupSubItem.getContractNum(), payWorkingGroupSubItem.getChargeCompanyId(), payWorkingGroupSubItem.getId()); + if (!Objects.isNull(payIncomeContract)) { // 合同存在 && 合同状态不为草稿,不为未通过 关联合同 - payIncomeContractService.insertPayIncomeContract(payIncomeContract,payWorkingGroupSubItem.getId(),Integer.parseInt(PayProjectCommon.PROJECT_TYPE2)); + payIncomeContractService.insertPayIncomeContract(payIncomeContract, payWorkingGroupSubItem.getId(), Integer.parseInt(PayProjectCommon.PROJECT_TYPE2)); // 关联了合同,判断合同是否打包,更新项目打包状态,添加打包 - if(Objects.equals(payIncomeContract.getPack(),PayProjectCommon.PACKAGING1)){ + if (Objects.equals(payIncomeContract.getPack(), PayProjectCommon.PACKAGING1)) { String contactsIdOne = payWorkingGroupSubItem.getPayWorkingGroupSubItemContactsList().get(0).getContactsId(); - payPackCompanyProjectService.setPack(payWorkingGroupSubItem.getChargeCompanyId(), contactsIdOne,payIncomeContract.getPackYear(),payWorkingGroupSubItem.getId(),PayProjectCommon.PROJECT_TYPE2,payIncomeContract.getPack()); + payPackCompanyProjectService.setPack(payWorkingGroupSubItem.getChargeCompanyId(), contactsIdOne, payIncomeContract.getPackYear(), payWorkingGroupSubItem.getId(), PayProjectCommon.PROJECT_TYPE2, payIncomeContract.getPack()); LambdaUpdateWrapper update = new LambdaUpdateWrapper<>(); - update.eq(PayWorkingGroupSubItem::getId,payWorkingGroupSubItem.getId()); - update.set(PayWorkingGroupSubItem::getPack,PayProjectCommon.PACKAGING1); + update.eq(PayWorkingGroupSubItem::getId, payWorkingGroupSubItem.getId()); + update.set(PayWorkingGroupSubItem::getPack, PayProjectCommon.PACKAGING1); payWorkingGroupSubItemService.update(update); } } } // 收入合同创建项目发送消息到项目负责人 - if(Objects.equals(ProjectCommon.FLAG,payWorkingGroupSubItem.getFlag())){ - contractCreateProjectSendMessageService.contractCreateProjectSendMessageService(payWorkingGroup.getWorkingGroupProject() + "的" + payWorkingGroupSubItem.getChargeCompanyTemporaryName(),payWorkingGroupSubItem.getId(),payWorkingGroup.getPrincipalIdA()); + if (Objects.equals(ProjectCommon.FLAG, payWorkingGroupSubItem.getFlag())) { + contractCreateProjectSendMessageService.contractCreateProjectSendMessageService(payWorkingGroup.getWorkingGroupProject() + "的" + payWorkingGroupSubItem.getChargeCompanyTemporaryName(), payWorkingGroupSubItem.getId(), payWorkingGroup.getPrincipalIdA()); } SysUser sysUserInfo = sysUserService.getById(payWorkingGroup.getPrincipalIdA()); - if(Objects.isNull(sysUserInfo)){ + if (Objects.isNull(sysUserInfo)) { throw new JeroBootException("负责人不存在!"); } JSONObject json = new JSONObject(); - json.put("type",ProjectCommon.PROJECT_TYPE2); - json.put("workingGroupId",payWorkingGroupSubItem.getWorkingGroupId()); - json.put("projectId",payWorkingGroupSubItem.getId()); - json.put("path","/workTeam/WorkTeamDetail"); + json.put("type", ProjectCommon.PROJECT_TYPE2); + json.put("workingGroupId", payWorkingGroupSubItem.getWorkingGroupId()); + json.put("projectId", payWorkingGroupSubItem.getId()); + json.put("path", "/workTeam/WorkTeamDetail"); //新建项目 给企业联系人发消息 - if(!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContactsNew)){ + if (!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContactsNew)) { for (PayWorkingGroupSubItemContacts subItemContacts : listPayWorkingGroupSubItemContactsNew) { PayContactsManagement payContactsManagement = payContactsManagementService.getById(subItemContacts.getContactsId()); if (!Objects.isNull(payContactsManagement)) { @@ -295,12 +299,12 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl 0){ + if (!Objects.isNull(payWorkingGroupSubItem.getReceivableAmount()) && payWorkingGroupSubItem.getReceivableAmount().compareTo(new BigDecimal("0")) > 0) { paySendContactsMessageDTO.setFlag(ProjectCommon.FLAG0 + "," + ProjectCommon.FLAG1); } paySendContactsMessageDTO.setJson(json); @@ -315,40 +319,40 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(PayWorkingGroupSubItem::getWorkingGroupId,payWorkingGroupSubItem.getWorkingGroupId()); - queryWrapper.eq(PayWorkingGroupSubItem::getChargeCompanyId,payWorkingGroupSubItem.getChargeCompanyId()); + queryWrapper.eq(PayWorkingGroupSubItem::getWorkingGroupId, payWorkingGroupSubItem.getWorkingGroupId()); + queryWrapper.eq(PayWorkingGroupSubItem::getChargeCompanyId, payWorkingGroupSubItem.getChargeCompanyId()); // queryWrapper.eq(PayWorkingGroupSubItem::getContactsIdOne,payWorkingGroupSubItem.getContactsIdOne()); PayWorkingGroupSubItem payWorkingGroupSubItemNew = payWorkingGroupSubItemService.getOne(queryWrapper); // 来款项目存在,并且编辑id与查询不同,则校验不通过 - if(!Objects.isNull(payWorkingGroupSubItemNew) + if (!Objects.isNull(payWorkingGroupSubItemNew) && !Objects.equals(payWorkingGroupSubItemNew.getId(), workingGroupSubItemId)) { throw new JeroBootException("工作组成员单位已存在!"); } - }catch (Exception e){ - log.info("工作组成员-编辑异常",e); + } catch (Exception e) { + log.info("工作组成员-编辑异常", e); throw new JeroBootException("工作组成员单位已存在!"); } // 校验项目是否已关联合同 PayIncomeContract payIncomeContract = payIncomeContractService.checkPayIncomeContractAssociated(workingGroupSubItemId); - if(!Objects.isNull(payIncomeContract)){ - if(!Objects.equals(payWorkingGroupSubItem.getChargeWay(),payWorkingGroupSubItemOld.getChargeWay())){ + if (!Objects.isNull(payIncomeContract)) { + if (!Objects.equals(payWorkingGroupSubItem.getChargeWay(), payWorkingGroupSubItemOld.getChargeWay())) { throw new JeroBootException("项目已关联合同,来款方式不可修改!"); } - if(Objects.equals(payWorkingGroupSubItemOld.getChargeWay(),PayProjectCommon.CHARGE_WAY2) && !Objects.equals(payWorkingGroupSubItemOld.getContractNum(),payWorkingGroupSubItem.getContractNum())){ + if (Objects.equals(payWorkingGroupSubItemOld.getChargeWay(), PayProjectCommon.CHARGE_WAY2) && !Objects.equals(payWorkingGroupSubItemOld.getContractNum(), payWorkingGroupSubItem.getContractNum())) { throw new JeroBootException("项目已关联合同,合同编号不可修改!"); } - }else{ + } else { PayIncomeContract payIncomeContractAdd = null; // 来款方式为合同,校验合同编号 - if(Objects.equals(payWorkingGroupSubItem.getChargeWay(),PayProjectCommon.CHARGE_WAY2)){ - payIncomeContractAdd = payIncomeContractService.setPayIncomeContractAssociated(payWorkingGroupSubItem.getContractNum(),payWorkingGroupSubItem.getChargeCompanyId(), workingGroupSubItemId); + if (Objects.equals(payWorkingGroupSubItem.getChargeWay(), PayProjectCommon.CHARGE_WAY2)) { + payIncomeContractAdd = payIncomeContractService.setPayIncomeContractAssociated(payWorkingGroupSubItem.getContractNum(), payWorkingGroupSubItem.getChargeCompanyId(), workingGroupSubItemId); } - if(!Objects.isNull(payIncomeContractAdd)){ + if (!Objects.isNull(payIncomeContractAdd)) { // 合同存在 && 合同状态不为草稿,不为未通过 关联合同 - payIncomeContractService.insertPayIncomeContract(payIncomeContractAdd, workingGroupSubItemId,Integer.parseInt(PayProjectCommon.PROJECT_TYPE2)); + payIncomeContractService.insertPayIncomeContract(payIncomeContractAdd, workingGroupSubItemId, Integer.parseInt(PayProjectCommon.PROJECT_TYPE2)); Integer pack = payIncomeContractAdd.getPack(); - if (Objects.equals(pack,PayProjectCommon.PACKAGING1)){ + if (Objects.equals(pack, PayProjectCommon.PACKAGING1)) { payWorkingGroupSubItem.setPack(PayProjectCommon.PACKAGING1); } - }else{ + } else { payWorkingGroupSubItem.setPack(payWorkingGroupSubItemOld.getPack()); } // 关联了合同,判断合同是否打包,更新项目打包状态,添加打包 - if(!Objects.isNull(payIncomeContractAdd) && Objects.equals(payIncomeContractAdd.getPack(),PayProjectCommon.PACKAGING1)){ + if (!Objects.isNull(payIncomeContractAdd) && Objects.equals(payIncomeContractAdd.getPack(), PayProjectCommon.PACKAGING1)) { String masterContactsId = payWorkingGroupSubItemContactsMapper.getMasterContactsId(workingGroupSubItemId); - payPackCompanyProjectService.setPack(payWorkingGroupSubItem.getChargeCompanyId(),masterContactsId,payIncomeContractAdd.getPackYear(), workingGroupSubItemId,PayProjectCommon.PROJECT_TYPE2,payIncomeContractAdd.getPack()); + payPackCompanyProjectService.setPack(payWorkingGroupSubItem.getChargeCompanyId(), masterContactsId, payIncomeContractAdd.getPackYear(), workingGroupSubItemId, PayProjectCommon.PROJECT_TYPE2, payIncomeContractAdd.getPack()); } } LambdaQueryWrapper queryPayWorkingGroupSubItemContacts = new LambdaQueryWrapper<>(); - queryPayWorkingGroupSubItemContacts.eq(PayWorkingGroupSubItemContacts::getWorkingGroupSubId,payWorkingGroupSubItemOld.getId()); + queryPayWorkingGroupSubItemContacts.eq(PayWorkingGroupSubItemContacts::getWorkingGroupSubId, payWorkingGroupSubItemOld.getId()); List listPayWorkingGroupSubItemContacts = payWorkingGroupSubItemContactsService.list(queryPayWorkingGroupSubItemContacts); - if(!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContacts)){ + if (!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContacts)) { payWorkingGroupSubItemOld.setPayWorkingGroupSubItemContactsList(listPayWorkingGroupSubItemContacts); } - setPayWorkingGroupSubItemEdit(payWorkingGroupSubItem,payWorkingGroupSubItemOld); + setPayWorkingGroupSubItemEdit(payWorkingGroupSubItem, payWorkingGroupSubItemOld); List listPayWorkingGroupSubItemContactsNew = payWorkingGroupSubItem.getPayWorkingGroupSubItemContactsList(); // 添加联系人表 - if(!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContactsNew)){ + if (!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContactsNew)) { for (int i = 0; i < listPayWorkingGroupSubItemContactsNew.size(); i++) { - listPayWorkingGroupSubItemContactsNew.get(i).setOrderNum(i+1); + listPayWorkingGroupSubItemContactsNew.get(i).setOrderNum(i + 1); listPayWorkingGroupSubItemContactsNew.get(i).setWorkingGroupId(payWorkingGroupSubItem.getWorkingGroupId()); listPayWorkingGroupSubItemContactsNew.get(i).setWorkingGroupSubId(workingGroupSubItemId); } @@ -419,19 +423,19 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl updatePayWorkingGroupSubItem = new LambdaUpdateWrapper<>(); updatePayWorkingGroupSubItem.eq(PayWorkingGroupSubItem::getId, workingGroupSubItemId); // 选择无 - if(Objects.equals(payWorkingGroupSubItem.getChargeWay(),PayProjectCommon.CHARGE_WAY1)){ + if (Objects.equals(payWorkingGroupSubItem.getChargeWay(), PayProjectCommon.CHARGE_WAY1)) { //updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getReceivableAmount,null); - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getContractNum,null); - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getCharge,null); - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getChargeNoticeNo,null); - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getChargeNoticeId,null); + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getContractNum, null); + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getCharge, null); + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getChargeNoticeNo, null); + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getChargeNoticeId, null); } // 选择合同 - if(Objects.equals(payWorkingGroupSubItem.getChargeWay(),PayProjectCommon.CHARGE_WAY2)){ - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getCharge,null); - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getChargeNoticeNo,null); - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getChargeNoticeId,null); + if (Objects.equals(payWorkingGroupSubItem.getChargeWay(), PayProjectCommon.CHARGE_WAY2)) { + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getCharge, null); + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getChargeNoticeNo, null); + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getChargeNoticeId, null); } // 选择收费通知 - if(Objects.equals(payWorkingGroupSubItem.getChargeWay(),PayProjectCommon.CHARGE_WAY3)){ - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getContractNum,null); + if (Objects.equals(payWorkingGroupSubItem.getChargeWay(), PayProjectCommon.CHARGE_WAY3)) { + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getContractNum, null); } payWorkingGroupSubItemService.update(updatePayWorkingGroupSubItem); // 如果有邮寄信息更新邮寄联系人信息 @@ -474,44 +478,44 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl queryWorkingGroupSubItemContacts = new LambdaQueryWrapper<>(); queryWorkingGroupSubItemContacts.eq(PayWorkingGroupSubItemContacts::getWorkingGroupSubId, workingGroupSubItemId); - queryWorkingGroupSubItemContacts.eq(PayWorkingGroupSubItemContacts::getContactsId,sysUser.getId()); - long l = payWorkingGroupSubItemContactsService.count(queryWorkingGroupSubItemContacts); - if(l == 0){ + queryWorkingGroupSubItemContacts.eq(PayWorkingGroupSubItemContacts::getContactsId, sysUser.getId()); + long l = payWorkingGroupSubItemContactsService.count(queryWorkingGroupSubItemContacts); + if (l == 0) { throw new JeroBootException("非工作组成员不可操作!"); } // 项目为打包状态 || 到账!=0 || 开票!=0 || 邮寄!=0 - if(!Objects.equals(payWorkingGroupSubItem.getChargeCompanyId(),payWorkingGroupSubItemOld.getChargeCompanyId()) - && (Objects.equals(payWorkingGroupSubItem.getPack(),PayProjectCommon.PACKAGING1) - || !Objects.equals(payWorkingGroupSubItem.getInAccount(),PayProjectCommon.IN_ACCOUNT0) - || !Objects.equals(payWorkingGroupSubItem.getMakeInvoice(),PayProjectCommon.MAKE_INVOICE0) - || !Objects.equals(payWorkingGroupSubItem.getMail(),PayProjectCommon.MAIL0))){ + if (!Objects.equals(payWorkingGroupSubItem.getChargeCompanyId(), payWorkingGroupSubItemOld.getChargeCompanyId()) + && (Objects.equals(payWorkingGroupSubItem.getPack(), PayProjectCommon.PACKAGING1) + || !Objects.equals(payWorkingGroupSubItem.getInAccount(), PayProjectCommon.IN_ACCOUNT0) + || !Objects.equals(payWorkingGroupSubItem.getMakeInvoice(), PayProjectCommon.MAKE_INVOICE0) + || !Objects.equals(payWorkingGroupSubItem.getMail(), PayProjectCommon.MAIL0))) { throw new JeroBootException("来款企业不可更改!"); } - if(Objects.equals(payWorkingGroupSubItem.getChargeWay(),PayProjectCommon.CHARGE_WAY2)){ - if(Objects.isNull(payWorkingGroupSubItem.getReceivableAmount())){ + if (Objects.equals(payWorkingGroupSubItem.getChargeWay(), PayProjectCommon.CHARGE_WAY2)) { + if (Objects.isNull(payWorkingGroupSubItem.getReceivableAmount())) { throw new JeroBootException("待确收金额不能为空"); } - if(StringUtils.isBlank(payWorkingGroupSubItem.getContractNum())){ + if (StringUtils.isBlank(payWorkingGroupSubItem.getContractNum())) { throw new JeroBootException("合同号不能为空"); } } - if(Objects.equals(payWorkingGroupSubItem.getChargeWay(),PayProjectCommon.CHARGE_WAY3)){ - if(Objects.isNull(payWorkingGroupSubItem.getChargeNoticeNo())){ + if (Objects.equals(payWorkingGroupSubItem.getChargeWay(), PayProjectCommon.CHARGE_WAY3)) { + if (Objects.isNull(payWorkingGroupSubItem.getChargeNoticeNo())) { throw new JeroBootException("收费通知号不能为空"); } - if(Objects.isNull(payWorkingGroupSubItem.getReceivableAmount())){ + if (Objects.isNull(payWorkingGroupSubItem.getReceivableAmount())) { throw new JeroBootException("待确收金额不能为空"); } } @@ -519,62 +523,62 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(PayWorkingGroupSubItem::getWorkingGroupId,payWorkingGroupSubItem.getWorkingGroupId()); - queryWrapper.eq(PayWorkingGroupSubItem::getChargeCompanyId,payWorkingGroupSubItem.getChargeCompanyId()); + queryWrapper.eq(PayWorkingGroupSubItem::getWorkingGroupId, payWorkingGroupSubItem.getWorkingGroupId()); + queryWrapper.eq(PayWorkingGroupSubItem::getChargeCompanyId, payWorkingGroupSubItem.getChargeCompanyId()); // queryWrapper.eq(PayWorkingGroupSubItem::getContactsIdOne,payWorkingGroupSubItem.getContactsIdOne()); PayWorkingGroupSubItem payWorkingGroupSubItemNew = payWorkingGroupSubItemService.getOne(queryWrapper); // 来款项目存在,并且编辑id与查询不同,则校验不通过 - if(!Objects.isNull(payWorkingGroupSubItemNew) + if (!Objects.isNull(payWorkingGroupSubItemNew) && !Objects.equals(payWorkingGroupSubItemNew.getId(), workingGroupSubItemId)) { throw new JeroBootException("工作组成员单位已存在!"); } - }catch (Exception e){ - log.info("工作组成员-编辑异常",e); + } catch (Exception e) { + log.info("工作组成员-编辑异常", e); throw new JeroBootException("工作组成员单位已存在!"); } // 校验项目是否已关联合同 PayIncomeContract payIncomeContract = payIncomeContractService.checkPayIncomeContractAssociated(workingGroupSubItemId); - if(!Objects.isNull(payIncomeContract)){ - if(!Objects.equals(payWorkingGroupSubItem.getChargeWay(),payWorkingGroupSubItemOld.getChargeWay())){ + if (!Objects.isNull(payIncomeContract)) { + if (!Objects.equals(payWorkingGroupSubItem.getChargeWay(), payWorkingGroupSubItemOld.getChargeWay())) { throw new JeroBootException("项目已关联合同,来款方式不可修改!"); } - if(Objects.equals(payWorkingGroupSubItemOld.getChargeWay(),PayProjectCommon.CHARGE_WAY2) && !Objects.equals(payWorkingGroupSubItemOld.getContractNum(),payWorkingGroupSubItem.getContractNum())){ + if (Objects.equals(payWorkingGroupSubItemOld.getChargeWay(), PayProjectCommon.CHARGE_WAY2) && !Objects.equals(payWorkingGroupSubItemOld.getContractNum(), payWorkingGroupSubItem.getContractNum())) { throw new JeroBootException("项目已关联合同,合同编号不可修改!"); } - }else{ + } else { PayIncomeContract payIncomeContractAdd = null; // 来款方式为合同,校验合同编号 - if(Objects.equals(payWorkingGroupSubItem.getChargeWay(),PayProjectCommon.CHARGE_WAY2)){ - payIncomeContractAdd = payIncomeContractService.setPayIncomeContractAssociated(payWorkingGroupSubItem.getContractNum(),payWorkingGroupSubItem.getChargeCompanyId(), workingGroupSubItemId); + if (Objects.equals(payWorkingGroupSubItem.getChargeWay(), PayProjectCommon.CHARGE_WAY2)) { + payIncomeContractAdd = payIncomeContractService.setPayIncomeContractAssociated(payWorkingGroupSubItem.getContractNum(), payWorkingGroupSubItem.getChargeCompanyId(), workingGroupSubItemId); } - if(!Objects.isNull(payIncomeContractAdd)){ + if (!Objects.isNull(payIncomeContractAdd)) { // 合同存在 && 合同状态不为草稿,不为未通过 关联合同 - payIncomeContractService.insertPayIncomeContract(payIncomeContractAdd, workingGroupSubItemId,Integer.parseInt(PayProjectCommon.PROJECT_TYPE2)); + payIncomeContractService.insertPayIncomeContract(payIncomeContractAdd, workingGroupSubItemId, Integer.parseInt(PayProjectCommon.PROJECT_TYPE2)); Integer pack = payIncomeContractAdd.getPack(); - if (Objects.equals(pack,PayProjectCommon.PACKAGING1)){ + if (Objects.equals(pack, PayProjectCommon.PACKAGING1)) { payWorkingGroupSubItem.setPack(PayProjectCommon.PACKAGING1); } - }else{ + } else { payWorkingGroupSubItem.setPack(payWorkingGroupSubItemOld.getPack()); } // 关联了合同,判断合同是否打包,更新项目打包状态,添加打包 - if(!Objects.isNull(payIncomeContractAdd) && Objects.equals(payIncomeContractAdd.getPack(),PayProjectCommon.PACKAGING1)){ + if (!Objects.isNull(payIncomeContractAdd) && Objects.equals(payIncomeContractAdd.getPack(), PayProjectCommon.PACKAGING1)) { String masterContactsId = payWorkingGroupSubItemContactsMapper.getMasterContactsId(workingGroupSubItemId); - payPackCompanyProjectService.setPack(payWorkingGroupSubItem.getChargeCompanyId(),masterContactsId,payIncomeContractAdd.getPackYear(), workingGroupSubItemId,PayProjectCommon.PROJECT_TYPE2,payIncomeContractAdd.getPack()); + payPackCompanyProjectService.setPack(payWorkingGroupSubItem.getChargeCompanyId(), masterContactsId, payIncomeContractAdd.getPackYear(), workingGroupSubItemId, PayProjectCommon.PROJECT_TYPE2, payIncomeContractAdd.getPack()); } } LambdaQueryWrapper queryPayWorkingGroupSubItemContacts = new LambdaQueryWrapper<>(); - queryPayWorkingGroupSubItemContacts.eq(PayWorkingGroupSubItemContacts::getWorkingGroupSubId,payWorkingGroupSubItemOld.getId()); + queryPayWorkingGroupSubItemContacts.eq(PayWorkingGroupSubItemContacts::getWorkingGroupSubId, payWorkingGroupSubItemOld.getId()); List listPayWorkingGroupSubItemContacts = payWorkingGroupSubItemContactsService.list(queryPayWorkingGroupSubItemContacts); - if(!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContacts)){ + if (!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContacts)) { payWorkingGroupSubItemOld.setPayWorkingGroupSubItemContactsList(listPayWorkingGroupSubItemContacts); } - setPayWorkingGroupSubItemEdit(payWorkingGroupSubItem,payWorkingGroupSubItemOld); + setPayWorkingGroupSubItemEdit(payWorkingGroupSubItem, payWorkingGroupSubItemOld); List listPayWorkingGroupSubItemContactsNew = payWorkingGroupSubItem.getPayWorkingGroupSubItemContactsList(); // 添加联系人表 - if(!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContactsNew)){ + if (!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContactsNew)) { for (int i = 0; i < listPayWorkingGroupSubItemContactsNew.size(); i++) { - listPayWorkingGroupSubItemContactsNew.get(i).setOrderNum(i+1); + listPayWorkingGroupSubItemContactsNew.get(i).setOrderNum(i + 1); listPayWorkingGroupSubItemContactsNew.get(i).setWorkingGroupId(payWorkingGroupSubItem.getWorkingGroupId()); listPayWorkingGroupSubItemContactsNew.get(i).setWorkingGroupSubId(workingGroupSubItemId); } @@ -582,19 +586,19 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl updatePayWorkingGroupSubItem = new LambdaUpdateWrapper<>(); updatePayWorkingGroupSubItem.eq(PayWorkingGroupSubItem::getId, workingGroupSubItemId); // 选择无 - if(Objects.equals(payWorkingGroupSubItem.getChargeWay(),PayProjectCommon.CHARGE_WAY1)){ + if (Objects.equals(payWorkingGroupSubItem.getChargeWay(), PayProjectCommon.CHARGE_WAY1)) { //updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getReceivableAmount,null); - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getContractNum,null); - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getCharge,null); - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getChargeNoticeNo,null); - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getChargeNoticeId,null); + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getContractNum, null); + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getCharge, null); + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getChargeNoticeNo, null); + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getChargeNoticeId, null); } // 选择合同 - if(Objects.equals(payWorkingGroupSubItem.getChargeWay(),PayProjectCommon.CHARGE_WAY2)){ - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getCharge,null); - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getChargeNoticeNo,null); - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getChargeNoticeId,null); + if (Objects.equals(payWorkingGroupSubItem.getChargeWay(), PayProjectCommon.CHARGE_WAY2)) { + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getCharge, null); + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getChargeNoticeNo, null); + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getChargeNoticeId, null); } // 选择收费通知 - if(Objects.equals(payWorkingGroupSubItem.getChargeWay(),PayProjectCommon.CHARGE_WAY3)){ - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getContractNum,null); + if (Objects.equals(payWorkingGroupSubItem.getChargeWay(), PayProjectCommon.CHARGE_WAY3)) { + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getContractNum, null); } payWorkingGroupSubItemService.update(updatePayWorkingGroupSubItem); // 如果有邮寄信息更新邮寄联系人信息 @@ -639,11 +643,11 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl entity : fileMap.entrySet()) { MultipartFile file = entity.getValue();// 获取上传文件对象 // 校验文件是否为excel - if(!ImportExcelUtil.checkExcelFile(file)){ + if (!ImportExcelUtil.checkExcelFile(file)) { throw new JeroBootException("请导入excel文件!"); } ImportParams params = new ImportParams(); @@ -660,7 +664,7 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl list = ExcelImportUtil.importExcel(file.getInputStream(), PayWorkingGroupSubItem.class, params); - if(!CollectionUtils.isEmpty(list)){ + if (!CollectionUtils.isEmpty(list)) { // 校验重复成员的集合 List listCompanyAndContacts = new ArrayList<>(); // 获取excel中的企业名称 List listCompanyName = list.stream().map(PayWorkingGroupSubItem::getChargeCompanyTemporaryName).collect(Collectors.toList()); // 获取excel企业信息 LambdaQueryWrapper companyWrapper = new LambdaQueryWrapper<>(); - companyWrapper.in(PayCompanyManagement::getCompanyName,listCompanyName); + companyWrapper.in(PayCompanyManagement::getCompanyName, listCompanyName); List listCompanyInfo = payCompanyManagementService.list(companyWrapper); // if(CollectionUtils.isEmpty(listCompanyInfo)){ // msg.append("excel中企业不存在 !"); @@ -684,72 +688,72 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl listContactsName = new ArrayList<>(); // 获取excel中联系人1名称 List listContactsName1 = list.stream().map(PayWorkingGroupSubItem::getContactsNameOne).collect(Collectors.toList()); - if(!CollectionUtils.isEmpty(listContactsName1)){ + if (!CollectionUtils.isEmpty(listContactsName1)) { listContactsName.addAll(listContactsName1); } // 获取excel中联系人2名称 List listContactsName2 = list.stream().map(PayWorkingGroupSubItem::getContactsNameTwo).collect(Collectors.toList()); - if(!CollectionUtils.isEmpty(listContactsName2)){ + if (!CollectionUtils.isEmpty(listContactsName2)) { listContactsName.addAll(listContactsName2); } // 获取excel中联系人3名称 List listContactsName3 = list.stream().map(PayWorkingGroupSubItem::getContactsNameThree).collect(Collectors.toList()); - if(!CollectionUtils.isEmpty(listContactsName3)){ + if (!CollectionUtils.isEmpty(listContactsName3)) { listContactsName.addAll(listContactsName3); } // 获取excel中联系人4名称 List listContactsName4 = list.stream().map(PayWorkingGroupSubItem::getContactsNameFour).collect(Collectors.toList()); - if(!CollectionUtils.isEmpty(listContactsName4)){ + if (!CollectionUtils.isEmpty(listContactsName4)) { listContactsName.addAll(listContactsName4); } // 获取excel中联系人5名称 List listContactsName5 = list.stream().map(PayWorkingGroupSubItem::getContactsNameFive).collect(Collectors.toList()); - if(!CollectionUtils.isEmpty(listContactsName5)){ + if (!CollectionUtils.isEmpty(listContactsName5)) { listContactsName.addAll(listContactsName5); } // 获取excel中联系人6名称 List listContactsName6 = list.stream().map(PayWorkingGroupSubItem::getContactsNameSix).collect(Collectors.toList()); - if(!CollectionUtils.isEmpty(listContactsName6)){ + if (!CollectionUtils.isEmpty(listContactsName6)) { listContactsName.addAll(listContactsName6); } // 获取excel中联系人7名称 List listContactsName7 = list.stream().map(PayWorkingGroupSubItem::getContactsNameSeven).collect(Collectors.toList()); - if(!CollectionUtils.isEmpty(listContactsName7)){ + if (!CollectionUtils.isEmpty(listContactsName7)) { listContactsName.addAll(listContactsName7); } // 获取excel中联系人8名称 List listContactsName8 = list.stream().map(PayWorkingGroupSubItem::getContactsNameEight).collect(Collectors.toList()); - if(!CollectionUtils.isEmpty(listContactsName8)){ + if (!CollectionUtils.isEmpty(listContactsName8)) { listContactsName.addAll(listContactsName8); } // 获取excel中联系人9名称 List listContactsName9 = list.stream().map(PayWorkingGroupSubItem::getContactsNameNine).collect(Collectors.toList()); - if(!CollectionUtils.isEmpty(listContactsName9)){ + if (!CollectionUtils.isEmpty(listContactsName9)) { listContactsName.addAll(listContactsName9); } // 获取excel中联系人10名称 List listContactsName10 = list.stream().map(PayWorkingGroupSubItem::getContactsNameTen).collect(Collectors.toList()); - if(!CollectionUtils.isEmpty(listContactsName10)){ + if (!CollectionUtils.isEmpty(listContactsName10)) { listContactsName.addAll(listContactsName10); } // 获取excel中邮寄联系人名称 List listContactsNameMail = list.stream().map(PayWorkingGroupSubItem::getMailContactsTemporaryName).collect(Collectors.toList()); - if(!CollectionUtils.isEmpty(listContactsNameMail)){ + if (!CollectionUtils.isEmpty(listContactsNameMail)) { listContactsName.addAll(listContactsNameMail); } // 获取excel联系人信息 LambdaQueryWrapper contactsWrapper = new LambdaQueryWrapper<>(); - contactsWrapper.in(PayContactsManagement::getName,listContactsName); + contactsWrapper.in(PayContactsManagement::getName, listContactsName); List listContactsInfo = payContactsManagementService.list(contactsWrapper); // if(CollectionUtils.isEmpty(listContactsInfo)){ // msg.append("excel中联系人不存在 !"); // } // 获取工作组信息 PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(workGroupId); - if(Objects.isNull(payWorkingGroup)){ + if (Objects.isNull(payWorkingGroup)) { msg.append("工作组不存在 !"); } - if(StringUtils.isBlank(msg)) { + if (StringUtils.isBlank(msg)) { // 校验预估到账日期 list.forEach( @@ -761,10 +765,10 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl"); - }else { + } else { try { - LocalDate.parse(estimatedArrivalDate,DateTimeFormatter.ofPattern("yyyy-MM-dd")); - }catch (Exception e) { + LocalDate.parse(estimatedArrivalDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")); + } catch (Exception e) { msg.append("第").append(list.indexOf(p) + 3).append("行预估到账日期格式不正确,请修改。
"); } } @@ -799,7 +803,7 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl listPayWorkingGroupSubItemContacts = checkRepeat(p,msg,count,listCompany,listContactsInfo); + List listPayWorkingGroupSubItemContacts = checkRepeat(p, msg, count, listCompany, listContactsInfo); p.setPayWorkingGroupSubItemContactsList(listPayWorkingGroupSubItemContacts); // 校验邮寄联系人 if (StringUtils.isBlank(p.getMailContactsTemporaryName())) { @@ -831,15 +835,15 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl"); - }else{ + } else { // 合同编号验证 LambdaQueryWrapper queryPayIncomeContract = new LambdaQueryWrapper(); - queryPayIncomeContract.eq(PayIncomeContract::getContractNum,p.getContractNum()); - queryPayIncomeContract.eq(PayIncomeContract::getSignedCompanyId,p.getChargeCompanyId()); + queryPayIncomeContract.eq(PayIncomeContract::getContractNum, p.getContractNum()); + queryPayIncomeContract.eq(PayIncomeContract::getSignedCompanyId, p.getChargeCompanyId()); List listPayIncomeContract = payIncomeContractService.list(queryPayIncomeContract); - if(CollectionUtils.isEmpty(listPayIncomeContract)){ + if (CollectionUtils.isEmpty(listPayIncomeContract)) { msg.append("第").append(count + 3).append("行:合同号不存在,请修改。
"); - }else{ + } else { p.setPayIncomeContract(listPayIncomeContract.get(0)); } } @@ -878,10 +882,10 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl{ + list.forEach(p -> { String workingGroupSubItemId = p.getId(); List listPayWorkingGroupSubItemContacts = p.getPayWorkingGroupSubItemContactsList(); - if(!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContacts)){ + if (!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContacts)) { for (int i = 0; i < listPayWorkingGroupSubItemContacts.size(); i++) { listPayWorkingGroupSubItemContacts.get(i).setWorkingGroupId(p.getWorkingGroupId()); listPayWorkingGroupSubItemContacts.get(i).setWorkingGroupSubId(workingGroupSubItemId); @@ -890,7 +894,7 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl update = new LambdaUpdateWrapper<>(); update.eq(PayWorkingGroupSubItem::getId, workingGroupSubItemId); - update.set(PayWorkingGroupSubItem::getPack,PayProjectCommon.PACKAGING1); + update.set(PayWorkingGroupSubItem::getPack, PayProjectCommon.PACKAGING1); payWorkingGroupSubItemService.update(update); } }); } } - }else{ + } else { throw new JeroBootException("没有数据可导入!"); } } catch (Exception e) { - log.error(e.getMessage(),e); + log.error(e.getMessage(), e); throw new JeroBootException("文件导入失败!"); } finally { try { @@ -924,77 +928,78 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl checkRepeat(PayWorkingGroupSubItem p,StringBuilder msg,int count,List listCompany,List listContactsInfo){ + * @return java.lang.String + * @Description // 验证重复 + * @Date 2022/4/20 10:26 + */ + private List checkRepeat(PayWorkingGroupSubItem p, StringBuilder msg, int count, List listCompany, List listContactsInfo) { List list = new ArrayList<>(); - HashMap map = new HashMap<>(); - if(!StringUtils.isBlank(p.getContactsNameOne())){ - PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts = setContactsId(msg,p.getContactsNameOne(),1,count,listCompany,listContactsInfo,map); + HashMap map = new HashMap<>(); + if (!StringUtils.isBlank(p.getContactsNameOne())) { + PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts = setContactsId(msg, p.getContactsNameOne(), 1, count, listCompany, listContactsInfo, map); list.add(payWorkingGroupSubItemContacts); - }else{ + } else { msg.append("第").append(count + 3).append("行:企业联系人1不能为空,请修改。
"); } - if(!StringUtils.isBlank(p.getContactsNameTwo())){ - PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts = setContactsId(msg,p.getContactsNameTwo(),2,count,listCompany,listContactsInfo,map); + if (!StringUtils.isBlank(p.getContactsNameTwo())) { + PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts = setContactsId(msg, p.getContactsNameTwo(), 2, count, listCompany, listContactsInfo, map); list.add(payWorkingGroupSubItemContacts); } - if(!StringUtils.isBlank(p.getContactsNameThree())){ - PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts = setContactsId(msg,p.getContactsNameThree(),3,count,listCompany,listContactsInfo,map); + if (!StringUtils.isBlank(p.getContactsNameThree())) { + PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts = setContactsId(msg, p.getContactsNameThree(), 3, count, listCompany, listContactsInfo, map); list.add(payWorkingGroupSubItemContacts); } - if(!StringUtils.isBlank(p.getContactsNameFour())){ - PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts = setContactsId(msg,p.getContactsNameFour(),4,count,listCompany,listContactsInfo,map); + if (!StringUtils.isBlank(p.getContactsNameFour())) { + PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts = setContactsId(msg, p.getContactsNameFour(), 4, count, listCompany, listContactsInfo, map); list.add(payWorkingGroupSubItemContacts); } - if(!StringUtils.isBlank(p.getContactsNameFive())){ - PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts = setContactsId(msg,p.getContactsNameFive(),5,count,listCompany,listContactsInfo,map); + if (!StringUtils.isBlank(p.getContactsNameFive())) { + PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts = setContactsId(msg, p.getContactsNameFive(), 5, count, listCompany, listContactsInfo, map); list.add(payWorkingGroupSubItemContacts); } - if(!StringUtils.isBlank(p.getContactsNameSix())){ - PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts = setContactsId(msg,p.getContactsNameSix(),6,count,listCompany,listContactsInfo,map); + if (!StringUtils.isBlank(p.getContactsNameSix())) { + PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts = setContactsId(msg, p.getContactsNameSix(), 6, count, listCompany, listContactsInfo, map); list.add(payWorkingGroupSubItemContacts); } - if(!StringUtils.isBlank(p.getContactsNameSeven())){ - PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts = setContactsId(msg,p.getContactsNameSeven(),7,count,listCompany,listContactsInfo,map); + if (!StringUtils.isBlank(p.getContactsNameSeven())) { + PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts = setContactsId(msg, p.getContactsNameSeven(), 7, count, listCompany, listContactsInfo, map); list.add(payWorkingGroupSubItemContacts); } - if(!StringUtils.isBlank(p.getContactsNameEight())){ - PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts = setContactsId(msg,p.getContactsNameEight(),8,count,listCompany,listContactsInfo,map); + if (!StringUtils.isBlank(p.getContactsNameEight())) { + PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts = setContactsId(msg, p.getContactsNameEight(), 8, count, listCompany, listContactsInfo, map); list.add(payWorkingGroupSubItemContacts); } - if(!StringUtils.isBlank(p.getContactsNameNine())){ - PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts = setContactsId(msg,p.getContactsNameNine(),9,count,listCompany,listContactsInfo,map); + if (!StringUtils.isBlank(p.getContactsNameNine())) { + PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts = setContactsId(msg, p.getContactsNameNine(), 9, count, listCompany, listContactsInfo, map); list.add(payWorkingGroupSubItemContacts); } - if(!StringUtils.isBlank(p.getContactsNameTen())){ - PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts = setContactsId(msg,p.getContactsNameTen(),10,count,listCompany,listContactsInfo,map); + if (!StringUtils.isBlank(p.getContactsNameTen())) { + PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts = setContactsId(msg, p.getContactsNameTen(), 10, count, listCompany, listContactsInfo, map); list.add(payWorkingGroupSubItemContacts); } return list; } - private PayWorkingGroupSubItemContacts setContactsId(StringBuilder msg,String name,int num,int count,List listCompany,List listContactsInfo,HashMap map){ + private PayWorkingGroupSubItemContacts setContactsId(StringBuilder msg, String name, int num, int count, List listCompany, List listContactsInfo, HashMap map) { PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts = new PayWorkingGroupSubItemContacts(); - if(map.containsKey(name)){ + if (map.containsKey(name)) { int c = map.get(name); msg.append("第").append(count + 3).append("行:企业联系人").append(c).append("与企业联系人").append(num).append("重复,请修改。
"); - }else{ - map.put(name,num); + } else { + map.put(name, num); } if (!CollectionUtils.isEmpty(listCompany)) { // 通过联系人获取联系人id @@ -1012,13 +1017,13 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl queryPageList2(Page page, PayWorkingGroupSubletSearch payWorkingGroupSubletSearch,String id) { - return payWorkingGroupSubItemMapper.queryPageList2(page,payWorkingGroupSubletSearch,id); + public IPage queryPageList2(Page page, PayWorkingGroupSubletSearch payWorkingGroupSubletSearch, String id) { + return payWorkingGroupSubItemMapper.queryPageList2(page, payWorkingGroupSubletSearch, id); } @Override - public List importExcelStatistics(PayWorkingGroupSubletSearch payWorkingGroupSubletSearch,String id) { - return payWorkingGroupSubItemMapper.queryPageList2(payWorkingGroupSubletSearch,id); + public List importExcelStatistics(PayWorkingGroupSubletSearch payWorkingGroupSubletSearch, String id) { + return payWorkingGroupSubItemMapper.queryPageList2(payWorkingGroupSubletSearch, id); } @@ -1028,11 +1033,11 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl updatePayWorkingGroupSubItemContacts = new LambdaUpdateWrapper<>(); - updatePayWorkingGroupSubItemContacts.eq(PayWorkingGroupSubItemContacts::getWorkingGroupSubId,id); + updatePayWorkingGroupSubItemContacts.eq(PayWorkingGroupSubItemContacts::getWorkingGroupSubId, id); payWorkingGroupSubItemContactsService.remove(updatePayWorkingGroupSubItemContacts); } @@ -1047,23 +1052,23 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl updatePayWorkingGroupSubItemContacts = new LambdaUpdateWrapper<>(); - updatePayWorkingGroupSubItemContacts.in(PayWorkingGroupSubItemContacts::getWorkingGroupSubId,Arrays.asList(ids.split(","))); + updatePayWorkingGroupSubItemContacts.in(PayWorkingGroupSubItemContacts::getWorkingGroupSubId, Arrays.asList(ids.split(","))); payWorkingGroupSubItemContactsService.remove(updatePayWorkingGroupSubItemContacts); } @Override - public IPage queryCompanyPageList(Page page, PayWorkingGroupSubItem payWorkingGroupSubItem,List listNeedInvoice, List listProjectIds) { - return payWorkingGroupSubItemMapper.queryCompanyPageList( page, payWorkingGroupSubItem,listNeedInvoice, listProjectIds); + public IPage queryCompanyPageList(Page page, PayWorkingGroupSubItem payWorkingGroupSubItem, List listNeedInvoice, List listProjectIds) { + return payWorkingGroupSubItemMapper.queryCompanyPageList(page, payWorkingGroupSubItem, listNeedInvoice, listProjectIds); } @Override - public IPage queryCompanyPageListByCompanyManager(Page page, PayWorkingGroupSubItem payWorkingGroupSubItem, List listNeedInvoice,String companyId) { - return payWorkingGroupSubItemMapper.queryCompanyPageListByCompanyManager( page, payWorkingGroupSubItem,listNeedInvoice,companyId); + public IPage queryCompanyPageListByCompanyManager(Page page, PayWorkingGroupSubItem payWorkingGroupSubItem, List listNeedInvoice, String companyId) { + return payWorkingGroupSubItemMapper.queryCompanyPageListByCompanyManager(page, payWorkingGroupSubItem, listNeedInvoice, companyId); } @Override @@ -1079,11 +1084,11 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl listFile = new ArrayList<>(); - if(!StringUtils.isBlank(input.getChargeNoticeId())){ + if (!StringUtils.isBlank(input.getChargeNoticeId())) { OSSFile file = iossFileService.getById(input.getChargeNoticeId()); String path = env.getProperty("jero.path.upload") + File.separator; File fi = new File(path + file.getUrl()); - if(!fi.exists()){ + if (!fi.exists()) { throw new JeroBootException("附件不存在!"); } listFile.add(path + file.getUrl()); @@ -1091,18 +1096,18 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl list = payWorkingGroupSubItemService.listByIds(Arrays.asList(s)); LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); List listMsg = new ArrayList<>(); - if(!CollectionUtils.isEmpty(list)){ + if (!CollectionUtils.isEmpty(list)) { List listStr = list.stream().map(PayWorkingGroupSubItem::getId).collect(Collectors.toList()); LambdaQueryWrapper queryPayWorkingGroupSubItemContacts = new LambdaQueryWrapper<>(); - queryPayWorkingGroupSubItemContacts.in(PayWorkingGroupSubItemContacts::getWorkingGroupSubId,listStr); + queryPayWorkingGroupSubItemContacts.in(PayWorkingGroupSubItemContacts::getWorkingGroupSubId, listStr); List listPayWorkingGroupSubItemContacts = payWorkingGroupSubItemContactsService.list(queryPayWorkingGroupSubItemContacts); List listPayContactsManagementTemporary = new ArrayList<>(); - if(!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContacts)){ + if (!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContacts)) { List listContacts = listPayWorkingGroupSubItemContacts.stream().map(PayWorkingGroupSubItemContacts::getContactsTemporaryId).collect(Collectors.toList()); - if(!CollectionUtils.isEmpty(listContacts)){ + if (!CollectionUtils.isEmpty(listContacts)) { // 获取所有联系人 listPayContactsManagementTemporary = payContactsManagementTemporaryService.listByIds(listContacts); - if(CollectionUtils.isEmpty(listPayContactsManagementTemporary)){ + if (CollectionUtils.isEmpty(listPayContactsManagementTemporary)) { throw new JeroBootException("联系人不存在!"); } } @@ -1111,84 +1116,84 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl finalListPayContactsManagementTemporary = listPayContactsManagementTemporary; // 获取工作组信息 PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(list.get(0).getWorkingGroupId()); - if(Objects.isNull(payWorkingGroup)){ + if (Objects.isNull(payWorkingGroup)) { throw new JeroBootException("工作组不存在!"); } SysUser sysUserInfo = sysUserService.getById(payWorkingGroup.getPrincipalIdA()); - if(Objects.isNull(sysUserInfo)){ + if (Objects.isNull(sysUserInfo)) { throw new JeroBootException("负责人不存在!"); } - list.forEach(p->{ + list.forEach(p -> { // 收费通知为合同的,不进行变更,其他方式直接变更 - if(Objects.equals(p.getChargeWay(),PayProjectCommon.CHARGE_WAY2)){ + if (Objects.equals(p.getChargeWay(), PayProjectCommon.CHARGE_WAY2)) { return; } LambdaUpdateWrapper updatePayWorkingGroupSubItem = new LambdaUpdateWrapper<>(); // 变更待确收金额,重新校验状态 - ProjectStatusVO projectStatusVO = projectDetailService.getStatus(p.getId(),input.getReceivableAmount(),p.getNeedInvoice()); - if(!Objects.isNull(projectStatusVO)){ - if(!Objects.isNull(projectStatusVO.getInAccount())){ - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getInAccount,projectStatusVO.getInAccount()); + ProjectStatusVO projectStatusVO = projectDetailService.getStatus(p.getId(), input.getReceivableAmount(), p.getNeedInvoice()); + if (!Objects.isNull(projectStatusVO)) { + if (!Objects.isNull(projectStatusVO.getInAccount())) { + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getInAccount, projectStatusVO.getInAccount()); } - if(!Objects.isNull(projectStatusVO.getMakeInvoice())){ - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getMakeInvoice,projectStatusVO.getMakeInvoice()); + if (!Objects.isNull(projectStatusVO.getMakeInvoice())) { + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getMakeInvoice, projectStatusVO.getMakeInvoice()); } - if(!Objects.isNull(projectStatusVO.getMail())){ - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getMail,projectStatusVO.getMail()); + if (!Objects.isNull(projectStatusVO.getMail())) { + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getMail, projectStatusVO.getMail()); } } - String paymentStatus = payPaymentCheckService.getPaymentStatus(input.getReceivableAmount(),p.getPaidAmount(),p.getPaymentStatus()); - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getPaymentStatus,paymentStatus); - updatePayWorkingGroupSubItem.eq(PayWorkingGroupSubItem::getId,p.getId()); - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getChargeWay,PayProjectCommon.CHARGE_WAY3); - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getCharge,input.getCharge()); - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getReceivableAmount,input.getReceivableAmount()); - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getChargeNoticeNo,input.getChargeNoticeNo()); - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getChargeNoticeId,input.getChargeNoticeId()); - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getUpdateBy,sysUser.getUsername()); - updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getUpdateTime,new Date()); + String paymentStatus = payPaymentCheckService.getPaymentStatus(input.getReceivableAmount(), p.getPaidAmount(), p.getPaymentStatus()); + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getPaymentStatus, paymentStatus); + updatePayWorkingGroupSubItem.eq(PayWorkingGroupSubItem::getId, p.getId()); + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getChargeWay, PayProjectCommon.CHARGE_WAY3); + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getCharge, input.getCharge()); + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getReceivableAmount, input.getReceivableAmount()); + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getChargeNoticeNo, input.getChargeNoticeNo()); + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getChargeNoticeId, input.getChargeNoticeId()); + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getUpdateBy, sysUser.getUsername()); + updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getUpdateTime, new Date()); payWorkingGroupSubItemService.update(updatePayWorkingGroupSubItem); - if(CollectionUtils.isEmpty(listFile)){ + if (CollectionUtils.isEmpty(listFile)) { return; } - if(CollectionUtils.isEmpty(listPayWorkingGroupSubItemContacts)){ + if (CollectionUtils.isEmpty(listPayWorkingGroupSubItemContacts)) { return; } - List listNew = listPayWorkingGroupSubItemContacts.stream().filter(n->Objects.equals(n.getWorkingGroupSubId(),p.getId())).collect(Collectors.toList()); - if(CollectionUtils.isEmpty(listNew)){ + List listNew = listPayWorkingGroupSubItemContacts.stream().filter(n -> Objects.equals(n.getWorkingGroupSubId(), p.getId())).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(listNew)) { return; } List listIds = listNew.stream().map(PayWorkingGroupSubItemContacts::getContactsTemporaryId).collect(Collectors.toList()); // 发消息 项目负责人发给企业联系人、工作组联系人 - List listContacts = finalListPayContactsManagementTemporary.stream().filter(item->listIds.contains(item.getId())).collect(Collectors.toList()); - if(CollectionUtils.isEmpty(listContacts)) { + List listContacts = finalListPayContactsManagementTemporary.stream().filter(item -> listIds.contains(item.getId())).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(listContacts)) { return; } - listContacts.forEach(m->{ + listContacts.forEach(m -> { try { // 发送消息 SendMessageDTO sendMessageDTO = new SendMessageDTO(); - if(!StringUtils.isBlank(m.getEmail())){ + if (!StringUtils.isBlank(m.getEmail())) { sendMessageDTO.setEmail(PasswordUtil.decrypt(m.getEmail())); } - if(!StringUtils.isBlank(m.getPhone())){ + if (!StringUtils.isBlank(m.getPhone())) { sendMessageDTO.setToUser(PasswordUtil.decrypt(m.getPhone())); sendMessageDTO.setPhone(PasswordUtil.decrypt(m.getPhone())); } - HashMap map = new HashMap<>(); - map.put("projectName",payWorkingGroup.getWorkingGroupProject()); + HashMap map = new HashMap<>(); + map.put("projectName", payWorkingGroup.getWorkingGroupProject()); sendMessageDTO.setFromUser(sysUserInfo.getUsername()); sendMessageDTO.setTemplateCode(CompanyMessageEnums.MSG22.getCode()); sendMessageDTO.setTemplateParam(map); sendMessageDTO.setBusType("C_OPEN_TYPE22"); sendMessageDTO.setListFile(listFile); JSONObject json = new JSONObject(); - json.put("id",p.getId()); + json.put("id", p.getId()); sendMessageDTO.setBusId(json.toJSONString()); sendMessageService.SendMessageService(sendMessageDTO); - }catch (Exception e){ - if(e.getMessage().contains("邮件发送") && !listMsg.contains(p.getChargeCompanyTemporaryName() + "单位" + m.getName() + "邮箱发送失败")){ - listMsg.add(p.getChargeCompanyTemporaryName() + "单位" + m.getName() + "邮箱发送失败"); + } catch (Exception e) { + if (e.getMessage().contains("邮件发送") && !listMsg.contains(p.getChargeCompanyTemporaryName() + "单位" + m.getName() + "邮箱发送失败")) { + listMsg.add(p.getChargeCompanyTemporaryName() + "单位" + m.getName() + "邮箱发送失败"); } } }); @@ -1199,7 +1204,7 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl updateWrapper = new LambdaUpdateWrapper<>(); - updateWrapper.in(PayWorkingGroupSubItem::getId,Arrays.asList(subIds.split(","))); - updateWrapper.set(PayWorkingGroupSubItem::getLabel,label); + updateWrapper.in(PayWorkingGroupSubItem::getId, Arrays.asList(subIds.split(","))); + updateWrapper.set(PayWorkingGroupSubItem::getLabel, label); payWorkingGroupSubItemMapper.update(null, updateWrapper); } @@ -1222,8 +1227,8 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl updateWrapper = new LambdaUpdateWrapper<>(); - updateWrapper.in(PayWorkingGroupSubItem::getId,Arrays.asList(subIds.split(","))); - updateWrapper.set(PayWorkingGroupSubItem::getLabel,null); + updateWrapper.in(PayWorkingGroupSubItem::getId, Arrays.asList(subIds.split(","))); + updateWrapper.set(PayWorkingGroupSubItem::getLabel, null); payWorkingGroupSubItemMapper.update(null, updateWrapper); } @@ -1233,43 +1238,114 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl page = new Page<>(1, Integer.MAX_VALUE); + PayWorkingGroupSubItem payWorkingGroupSubItem = new PayWorkingGroupSubItem(); + payWorkingGroupSubItem.setWorkingGroupId(workGroupId); + IPage pageList = this.queryPageList(page, payWorkingGroupSubItem, null); + List records = pageList.getRecords(); + if (CollectionUtils.isEmpty(records)) { + throw new JeroBootException("成员单位不存在!"); + } + // 获取对应成员单位数据 + PayWorkingGroupSubItem data = records.stream() + .filter(item -> Objects.equals(item.getChargeCompanyId(), companyId)).findFirst().orElse(null); + if (Objects.isNull(data)) { + throw new JeroBootException("成员单位不存在!"); + } + // 判断 只有待确收金额不为0,未开票、未到账、未邮寄可以操作 + if (data.getReceivableAmount().compareTo(BigDecimal.ZERO) != 0) { + if (data.getMakeInvoice() != 0 || data.getInAccount() != 0 || data.getMail() != 0) { + throw new JeroBootException("只有待确收金额不为0,未开票、未到账、未邮寄可以操作!"); + } + } + // 构建普通项目对象并添加 + PayCommonProject payCommonProject = new PayCommonProject(); + // 项目 + payCommonProject.setChargeProject(payWorkingGroup.getWorkingGroupProject() + + "-" + data.getChargeCompanyTemporaryName() + "-调账"); + // 运行年份 + payCommonProject.setYear(String.valueOf(LocalDate.now().getYear())); + // 负责人-工作组负责人A + payCommonProject.setPrincipalId(payWorkingGroup.getPrincipalIdA()); + // 来款企业-成员单位 + payCommonProject.setChargeCompanyId(data.getChargeCompanyId()); + // 来款用途 + payCommonProject.setChargeUse(PayProjectCommon.CHARGE_USE1); + // 联系人 + payCommonProject.setContactsId(data.getContactsIdOne()); + // 邮寄联系人 + payCommonProject.setMailContactsId(data.getMailContactsId()); + // 待确收金额 + payCommonProject.setReceivableAmount(data.getReceivableAmount()); + // 税率 + payCommonProject.setTaxRate(new BigDecimal("0.06")); + BigDecimal zero = new BigDecimal(0); + // 税额 + payCommonProject.setTax(zero); + // 未税金额 + payCommonProject.setNoTaxAmount(zero); + // 预计到账日期 + payCommonProject.setEstimatedArrivalDate(data.getEstimatedArrivalDate()); + // 需要发票 + payCommonProject.setNeedInvoice(data.getNeedInvoice()); + // 来款方式 + payCommonProject.setChargeWay(data.getChargeWay()); + // 来款方式为收费通知的时候,收费通知号和文件 和成员对应的工作组的相同 + if (Objects.equals(data.getChargeWay(), PayProjectCommon.CHARGE_WAY3)) { + // 收费通知号 + payCommonProject.setChargeNoticeNo(data.getChargeNoticeNo()); + // 收费通知文件 + payCommonProject.setChargeNoticeId(data.getChargeNoticeId()); + } + // 备注 + payCommonProject.setRemarks(data.getRemarks()); + payCommonProjectService.addPayCommonProject(payCommonProject); + } + /** * @Description 删除项目打包关联,临时企业、联系信息 - * @Author lqt - * @Date 2021/9/18 - * @Param id 项目id + * @Author lqt + * @Date 2021/9/18 + * @Param id 项目id * @Return * @Exception */ - private void deleteProject(String id,String perm){ + private void deleteProject(String id, String perm) { PayWorkingGroupSubItem payWorkingGroupSubItem = payWorkingGroupSubItemService.getById(id); // 到账!=0 - if(!Objects.equals(payWorkingGroupSubItem.getInAccount(),PayProjectCommon.IN_ACCOUNT0)){ + if (!Objects.equals(payWorkingGroupSubItem.getInAccount(), PayProjectCommon.IN_ACCOUNT0)) { throw new JeroBootException("项目已有到账信息不可删除!"); } // 开票!=0 - if(!Objects.equals(payWorkingGroupSubItem.getMakeInvoice(),PayProjectCommon.MAKE_INVOICE0)){ + if (!Objects.equals(payWorkingGroupSubItem.getMakeInvoice(), PayProjectCommon.MAKE_INVOICE0)) { throw new JeroBootException("项目已有开票信息不可删除!"); } // 邮寄!=0 - if(!Objects.equals(payWorkingGroupSubItem.getMail(),PayProjectCommon.MAIL0)){ + if (!Objects.equals(payWorkingGroupSubItem.getMail(), PayProjectCommon.MAIL0)) { throw new JeroBootException("项目已有邮寄信息不可删除!"); } PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(payWorkingGroupSubItem.getWorkingGroupId()); - if(Objects.isNull(payWorkingGroup)){ + if (Objects.isNull(payWorkingGroup)) { throw new JeroBootException("工作组不存在!"); } LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - if(!rolePermissionService.getRolePermission(perm) - && !Objects.equals(payWorkingGroup.getPrincipalIdA(),sysUser.getId()) - && !Objects.equals(payWorkingGroup.getPrincipalIdB(),sysUser.getId())){ + if (!rolePermissionService.getRolePermission(perm) + && !Objects.equals(payWorkingGroup.getPrincipalIdA(), sysUser.getId()) + && !Objects.equals(payWorkingGroup.getPrincipalIdB(), sysUser.getId())) { throw new JeroBootException("工作组成员不可操作!"); } // 校验项目是否已关联合同 抛异常 payIncomeContractService.getPayIncomeContractAssociated(Collections.singletonList(payWorkingGroupSubItem.getId())); // 如果已打报,同步删除打包关联 LambdaUpdateWrapper update = new LambdaUpdateWrapper<>(); - update.eq(PayPackCompanyProject::getProjectId,payWorkingGroupSubItem.getId()); + update.eq(PayPackCompanyProject::getProjectId, payWorkingGroupSubItem.getId()); payPackCompanyProjectService.remove(update); // 删除企业联系人临时数据 payCompanyManagementTemporaryService.removeById(payWorkingGroupSubItem.getChargeCompanyTemporaryId()); @@ -1280,26 +1356,26 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl payWorkingGroupSubItemContactsList = payWorkingGroupSubItem.getPayWorkingGroupSubItemContactsList(); - if(!CollectionUtils.isEmpty(payWorkingGroupSubItemContactsList)){ + if (!CollectionUtils.isEmpty(payWorkingGroupSubItemContactsList)) { for (int i = 0; i < payWorkingGroupSubItemContactsList.size(); i++) { // 企业联系人 PayContactsManagementTemporary contactsName = payContactsManagementTemporaryService.insertContactsManagementTemporary(payWorkingGroupSubItemContactsList.get(i).getContactsId()); - if(Objects.isNull(contactsName)){ + if (Objects.isNull(contactsName)) { throw new JeroBootException("企业联系人" + (i + 1) + "名称为空!"); } payWorkingGroupSubItemContactsList.get(i).setContactsTemporaryId(contactsName.getId()); @@ -1308,44 +1384,45 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl payWorkingGroupSubItemContactsList = payWorkingGroupSubItem.getPayWorkingGroupSubItemContactsList(); - if(!CollectionUtils.isEmpty(payWorkingGroupSubItemContactsList)){ + if (!CollectionUtils.isEmpty(payWorkingGroupSubItemContactsList)) { // 删除临时表历史记录 - if(!CollectionUtils.isEmpty(payWorkingGroupSubItemOld.getPayWorkingGroupSubItemContactsList())){ + if (!CollectionUtils.isEmpty(payWorkingGroupSubItemOld.getPayWorkingGroupSubItemContactsList())) { List list = payWorkingGroupSubItemOld.getPayWorkingGroupSubItemContactsList().stream().map(PayWorkingGroupSubItemContacts::getContactsTemporaryId).collect(Collectors.toList()); payContactsManagementTemporaryService.removeByIds(list); } // 删除联系人记录 LambdaUpdateWrapper updatePayWorkingGroupSubItemContacts = new LambdaUpdateWrapper<>(); - updatePayWorkingGroupSubItemContacts.eq(PayWorkingGroupSubItemContacts::getWorkingGroupSubId,payWorkingGroupSubItem.getId()); + updatePayWorkingGroupSubItemContacts.eq(PayWorkingGroupSubItemContacts::getWorkingGroupSubId, payWorkingGroupSubItem.getId()); payWorkingGroupSubItemContactsService.remove(updatePayWorkingGroupSubItemContacts); // 新增 for (int i = 0; i < payWorkingGroupSubItemContactsList.size(); i++) { @@ -1358,16 +1435,16 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl