|
@@ -1,13 +1,14 @@
|
|
|
package com.zjugis.business.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import com.zjugis.business.bean.dto.ContractSubCostDto;
|
|
|
import com.zjugis.business.bean.dto.ProjectCostDto;
|
|
|
import com.zjugis.business.bean.entity.ProjectCost;
|
|
|
import com.zjugis.business.bean.response.ProjectCostResponse;
|
|
|
import com.zjugis.business.bean.response.ProjectMonthCostResponse;
|
|
|
import com.zjugis.business.flow.commoncost.service.CommonCostService;
|
|
|
import com.zjugis.business.flow.travelcost.service.TravelCostService;
|
|
|
+import com.zjugis.business.flow.usemoney.controller.vo.UseMoneyTypeRespVO;
|
|
|
+import com.zjugis.business.flow.usemoney.service.UseMoneyService;
|
|
|
import com.zjugis.business.mapper.ContractMapper;
|
|
|
import com.zjugis.business.mapper.ProjectCostMapper;
|
|
|
import com.zjugis.business.service.ContractApplyService;
|
|
@@ -21,7 +22,6 @@ import java.math.BigDecimal;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
-import java.util.Optional;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -40,6 +40,9 @@ public class ProjectCostServiceImpl implements ProjectCostService {
|
|
|
@Autowired
|
|
|
private ContractMapper contractMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private UseMoneyService useMoneyService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private ContractApplyService contractApplyService;
|
|
|
|
|
@@ -85,12 +88,12 @@ public class ProjectCostServiceImpl implements ProjectCostService {
|
|
|
@Override
|
|
|
public Map<String,ProjectCostResponse> calculateCostMap(ProjectCostDto projectCostDto) {
|
|
|
List<ProjectCostResponse> costList = projectCostMapper.calculateList(projectCostDto);
|
|
|
- List<ContractSubCostDto> subCostList = contractApplyService.selectSubCostByProjectIds(projectCostDto.getProjectIds());
|
|
|
+ List<UseMoneyTypeRespVO> subCostList = useMoneyService.getDataByProject(projectCostDto.getProjectIds());
|
|
|
Map<String, BigDecimal> commonCostMap = commonCostService.getProjectCostMap(projectCostDto.getProjectIds());
|
|
|
Map<String, BigDecimal> travelCostMap = travelCostService.getProjectCostMap(projectCostDto.getProjectIds());
|
|
|
- Map<String, List<ContractSubCostDto>> subCostMap = null;
|
|
|
+ Map<String, List<UseMoneyTypeRespVO>> subCostMap = null;
|
|
|
if(subCostList != null){
|
|
|
- subCostMap = subCostList.stream().collect(Collectors.groupingBy(ContractSubCostDto::getProjectId));
|
|
|
+ subCostMap = subCostList.stream().collect(Collectors.groupingBy(UseMoneyTypeRespVO::getProjectId));
|
|
|
}
|
|
|
Map<String,ProjectCostResponse> costMap = new HashMap<>(costList.size());
|
|
|
for (ProjectCostResponse item : costList) {
|
|
@@ -99,12 +102,14 @@ public class ProjectCostServiceImpl implements ProjectCostService {
|
|
|
item.setReimbursementCost(commonCost == null ?BigDecimal.ZERO : commonCost);
|
|
|
item.setTravelCost(travelCost== null ?BigDecimal.ZERO : travelCost);
|
|
|
if(subCostMap != null && !subCostMap.isEmpty()){
|
|
|
- List<ContractSubCostDto> list = subCostMap.get(item.getProjectId());
|
|
|
+ List<UseMoneyTypeRespVO> list = subCostMap.get(item.getProjectId());
|
|
|
if(list != null) {
|
|
|
- Optional<ContractSubCostDto> subCost = list.stream().filter(i -> (i.getContractType() != null && i.getContractType() == 1)).findFirst();
|
|
|
- Optional<ContractSubCostDto> outCost = list.stream().filter(i -> (i.getContractType() != null && i.getContractType() == 2)).findFirst();
|
|
|
- item.setSubcontractCost(subCost.isPresent() ? subCost.get().getSubCost() : BigDecimal.ZERO);
|
|
|
- item.setOutsourceCost(outCost.isPresent() ? outCost.get().getOutCost() : BigDecimal.ZERO);
|
|
|
+ BigDecimal subCost = list.get(0).getSubAmount();
|
|
|
+ BigDecimal outCost = list.get(0).getOutAmount();
|
|
|
+ BigDecimal otherAmount = list.get(0).getOtherAmount();
|
|
|
+ item.setSubcontractCost(subCost != null ? subCost : BigDecimal.ZERO);
|
|
|
+ item.setOutsourceCost(outCost != null ? outCost : BigDecimal.ZERO);
|
|
|
+ item.setPaymentCost(otherAmount != null ? otherAmount : BigDecimal.ZERO);
|
|
|
}
|
|
|
}
|
|
|
item.calcCost();
|