|
@@ -1,7 +1,9 @@
|
|
|
package org.jeecg.modules.payment.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import io.swagger.annotations.ApiModel;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.jeecg.common.dto.archives.ExpensePriceReqDTO;
|
|
|
import org.jeecg.common.dto.archives.ExpensePriceRespDTO;
|
|
@@ -13,6 +15,8 @@ import org.jeecg.common.dto.payment.SlipContentAddReqDTO;
|
|
|
import org.jeecg.common.dto.payment.SlipContentRespDTO;
|
|
|
import org.jeecg.common.dto.payment.SlipRespDTO;
|
|
|
import org.jeecg.modules.archives.entity.ProjectManageArchives;
|
|
|
+import org.jeecg.modules.archives.entity.ProjectManageArchivesAndBusiness;
|
|
|
+import org.jeecg.modules.archives.service.ProjectManageArchivesAndBusinessService;
|
|
|
import org.jeecg.modules.archives.service.ProjectManageArchivesService;
|
|
|
import org.jeecg.modules.payment.entity.ManagePaymentAndReceiptContent;
|
|
|
import org.jeecg.modules.payment.entity.ManagerPaymentAndReceiptSlip;
|
|
@@ -25,8 +29,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -47,6 +53,8 @@ public class ManagerPaymentAndReceiptSlipServiceImpl extends ServiceImpl<Manager
|
|
|
private ManagerPaymentAndReceiptSlipMapper managerPaymentAndReceiptSlipMapper;
|
|
|
@Autowired
|
|
|
private ProjectManageArchivesService projectManageArchivesService;
|
|
|
+ @Autowired
|
|
|
+ private ProjectManageArchivesAndBusinessService projectManageArchivesAndBusinessService;
|
|
|
|
|
|
/**
|
|
|
* @desc 新增
|
|
@@ -176,14 +184,67 @@ public class ManagerPaymentAndReceiptSlipServiceImpl extends ServiceImpl<Manager
|
|
|
QueryWrapper<ManagePaymentAndReceiptContent> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("del_flag", "0");
|
|
|
queryWrapper.eq("slip_id", id);
|
|
|
+
|
|
|
+ List<ManagePaymentAndReceiptContent> contents = managePaymentAndReceiptContentService.list(queryWrapper);
|
|
|
+
|
|
|
managePaymentAndReceiptContentService.update(new ManagePaymentAndReceiptContent("1"), queryWrapper);
|
|
|
|
|
|
+ //删除回写金额
|
|
|
+ deleteReWriterProArchvicePrice(contents);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @dsec 回写项目档案里程碑金额
|
|
|
+ */
|
|
|
+ private void deleteReWriterProArchvicePrice(List<ManagePaymentAndReceiptContent> contents) {
|
|
|
+ //获取项目档案里程碑数据
|
|
|
+ List<ProjectManageArchivesAndBusiness> businesses = projectManageArchivesAndBusinessService.list(new LambdaQueryWrapper<ProjectManageArchivesAndBusiness>()
|
|
|
+ .eq(ProjectManageArchivesAndBusiness::getDelFlag, "0").in(ProjectManageArchivesAndBusiness::getPlanType, new String[]{"2","4"}));
|
|
|
+ Map<String, List<ProjectManageArchivesAndBusiness>> businessMap = businesses.stream().collect(Collectors.groupingBy(t -> t.getId()));
|
|
|
+
|
|
|
+ for(ManagePaymentAndReceiptContent content : contents){
|
|
|
+ List<ProjectManageArchivesAndBusiness> businessList = businessMap.get(content.getCoArchivesId());
|
|
|
+ if(!CollectionUtils.isEmpty(businessList)){
|
|
|
+ for(ProjectManageArchivesAndBusiness business : businessList){
|
|
|
+ if(business.getMilestone1().equals(content.getProArchivesMilestone())){
|
|
|
+ business.setPrice1(BigDecimal.ZERO);
|
|
|
+ projectManageArchivesAndBusinessService.updateById(business);
|
|
|
+ }
|
|
|
+ if(business.getMilestone2().equals(content.getProArchivesMilestone())){
|
|
|
+ business.setPrice2(BigDecimal.ZERO);
|
|
|
+ projectManageArchivesAndBusinessService.updateById(business);
|
|
|
+ }
|
|
|
+ if(business.getMilestone3().equals(content.getProArchivesMilestone())){
|
|
|
+ business.setPrice3(BigDecimal.ZERO);
|
|
|
+ projectManageArchivesAndBusinessService.updateById(business);
|
|
|
+ }
|
|
|
+ if(business.getMilestone4().equals(content.getProArchivesMilestone())){
|
|
|
+ business.setPrice4(BigDecimal.ZERO);
|
|
|
+ projectManageArchivesAndBusinessService.updateById(business);
|
|
|
+ }
|
|
|
+ if(business.getMilestone5().equals(content.getProArchivesMilestone())){
|
|
|
+ business.setPrice5(BigDecimal.ZERO);
|
|
|
+ projectManageArchivesAndBusinessService.updateById(business);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @desc 添加子表
|
|
|
*/
|
|
|
private void saveChildren(SlipAddReqDTO slipAddReqDTO, String id) {
|
|
|
+ //获取项目档案里程碑数据
|
|
|
+ List<ProjectManageArchivesAndBusiness> businesses = projectManageArchivesAndBusinessService.list(new LambdaQueryWrapper<ProjectManageArchivesAndBusiness>()
|
|
|
+ .eq(ProjectManageArchivesAndBusiness::getDelFlag, "0").in(ProjectManageArchivesAndBusiness::getPlanType, new String[]{"2","4"}));
|
|
|
+ Map<String, List<ProjectManageArchivesAndBusiness>> businessMap = businesses.stream().collect(Collectors.groupingBy(t -> t.getId()));
|
|
|
+
|
|
|
List<ManagePaymentAndReceiptContent> list = Lists.newArrayList();
|
|
|
int sort = 1;
|
|
|
for(SlipContentAddReqDTO reqDTO : slipAddReqDTO.getDetailList()){
|
|
@@ -192,7 +253,44 @@ public class ManagerPaymentAndReceiptSlipServiceImpl extends ServiceImpl<Manager
|
|
|
content.setSlipId(id);
|
|
|
content.setSort(sort++);
|
|
|
list.add(content);
|
|
|
+
|
|
|
+ //回写项目档案里程碑信息表的金额
|
|
|
+ reWriterProArchvicePrice(reqDTO, businessMap);
|
|
|
+
|
|
|
}
|
|
|
managePaymentAndReceiptContentService.saveBatch(list);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc 回写项目档案里程碑信息表的金额
|
|
|
+ */
|
|
|
+ private void reWriterProArchvicePrice(SlipContentAddReqDTO reqDTO, Map<String, List<ProjectManageArchivesAndBusiness>> businessMap) {
|
|
|
+ List<ProjectManageArchivesAndBusiness> businesses = businessMap.get(reqDTO.getCoArchivesId());
|
|
|
+ if(!CollectionUtils.isEmpty(businesses)){
|
|
|
+ for(ProjectManageArchivesAndBusiness business : businesses){
|
|
|
+ if(business.getMilestone1().equals(reqDTO.getProArchivesMilestone())){
|
|
|
+ business.setPrice1(reqDTO.getCoPrvice());
|
|
|
+ projectManageArchivesAndBusinessService.updateById(business);
|
|
|
+ }
|
|
|
+ if(business.getMilestone2().equals(reqDTO.getProArchivesMilestone())){
|
|
|
+ business.setPrice2(reqDTO.getCoPrvice());
|
|
|
+ projectManageArchivesAndBusinessService.updateById(business);
|
|
|
+ }
|
|
|
+ if(business.getMilestone3().equals(reqDTO.getProArchivesMilestone())){
|
|
|
+ business.setPrice3(reqDTO.getCoPrvice());
|
|
|
+ projectManageArchivesAndBusinessService.updateById(business);
|
|
|
+ }
|
|
|
+ if(business.getMilestone4().equals(reqDTO.getProArchivesMilestone())){
|
|
|
+ business.setPrice4(reqDTO.getCoPrvice());
|
|
|
+ projectManageArchivesAndBusinessService.updateById(business);
|
|
|
+ }
|
|
|
+ if(business.getMilestone5().equals(reqDTO.getProArchivesMilestone())){
|
|
|
+ business.setPrice5(reqDTO.getCoPrvice());
|
|
|
+ projectManageArchivesAndBusinessService.updateById(business);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|