合约规划调整
This commit is contained in:
parent
90708aeb71
commit
621e6dabfa
@ -7,9 +7,13 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.xmgl.modules.cost.dto.CostBudgetDto;
|
||||
import com.zhgd.xmgl.modules.cost.entity.CostBudget;
|
||||
import com.zhgd.xmgl.modules.cost.entity.CostContract;
|
||||
import com.zhgd.xmgl.modules.cost.entity.CostContractPay;
|
||||
import com.zhgd.xmgl.modules.cost.entity.CostSubject;
|
||||
import com.zhgd.xmgl.modules.cost.mapper.CostBudgetMapper;
|
||||
import com.zhgd.xmgl.modules.cost.service.ICostBudgetService;
|
||||
import com.zhgd.xmgl.modules.cost.service.ICostContractPayService;
|
||||
import com.zhgd.xmgl.modules.cost.service.ICostContractService;
|
||||
import com.zhgd.xmgl.modules.cost.service.ICostSubjectService;
|
||||
import com.zhgd.xmgl.modules.project.entity.vo.ProjectInfoExtVo;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@ -36,6 +40,12 @@ public class CostBudgetServiceImpl extends ServiceImpl<CostBudgetMapper, CostBud
|
||||
@Autowired
|
||||
private ICostSubjectService costSubjectService;
|
||||
|
||||
@Autowired
|
||||
private ICostContractService costContractService;
|
||||
|
||||
@Autowired
|
||||
private ICostContractPayService costContractPayService;
|
||||
|
||||
@Override
|
||||
public List<CostBudgetDto> tree(QueryWrapper<CostSubject> wrapper, ProjectInfoExtVo projectInfoBySn) {
|
||||
wrapper.lambda().eq(CostSubject::getParentId, 0);
|
||||
@ -49,6 +59,21 @@ public class CostBudgetServiceImpl extends ServiceImpl<CostBudgetMapper, CostBud
|
||||
List<CostBudgetDto> allDtoList = convert(allList);
|
||||
List<CostBudget> budgetList = this.list(Wrappers.<CostBudget>lambdaQuery()
|
||||
.eq(CostBudget::getProjectSn, projectInfoBySn.getProjectSn()));
|
||||
List<CostContract> contractList = costContractService.list(Wrappers.<CostContract>lambdaQuery()
|
||||
.eq(CostContract::getProjectSn, projectInfoBySn.getProjectSn()));
|
||||
List<CostContractPay> costContractPayList = new ArrayList<>();
|
||||
if (contractList.size() > 0) {
|
||||
costContractPayList = costContractPayService.list(Wrappers.<CostContractPay>lambdaQuery()
|
||||
.in(CostContractPay::getHtmc, contractList.stream().map(c -> c.getId()).collect(Collectors.toList())));
|
||||
}
|
||||
for (CostBudget costBudget : budgetList) {
|
||||
List<String> contractIds = contractList.stream().filter(c -> c.getSubjectId().toString().equals(costBudget.getSubjectId().toString())).map(c -> c.getId().toString()).collect(Collectors.toList());
|
||||
BigDecimal reduce = costContractPayList.stream().filter(c -> contractIds.contains(c.getHtmc())).map(c -> new BigDecimal(c.getBczfje()))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
costBudget.setActualCost(reduce.toString());
|
||||
BigDecimal ratio = reduce.subtract(new BigDecimal(costBudget.getBudgetCost())).divide(new BigDecimal(costBudget.getBudgetCost()), 2, BigDecimal.ROUND_HALF_UP);
|
||||
costBudget.setCostDifference(ratio.multiply(new BigDecimal(100)).toString());
|
||||
}
|
||||
getChildren(dtoList, allDtoList, budgetList, true);
|
||||
}
|
||||
return dtoList;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user