成本管理调整
This commit is contained in:
parent
d4c315941d
commit
623deaca6c
@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.zhgd.annotation.OperLog;
|
import com.zhgd.annotation.OperLog;
|
||||||
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
|
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
|
||||||
|
import com.zhgd.xmgl.modules.project.entity.vo.ProjectInfoExtVo;
|
||||||
|
import com.zhgd.xmgl.modules.project.service.IProjectService;
|
||||||
import com.zhgd.xmgl.util.PageUtil;
|
import com.zhgd.xmgl.util.PageUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
@ -65,6 +67,9 @@ public class CostQuantityController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ISystemUserService systemUserService;
|
private ISystemUserService systemUserService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IProjectService projectService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页列表查询
|
* 分页列表查询
|
||||||
*
|
*
|
||||||
@ -158,6 +163,9 @@ public class CostQuantityController {
|
|||||||
Long userId = Long.valueOf(object.getJSONArray("reportId").get(0).toString());
|
Long userId = Long.valueOf(object.getJSONArray("reportId").get(0).toString());
|
||||||
costQuantity.setReportId(userId);
|
costQuantity.setReportId(userId);
|
||||||
costQuantity.setReportBy(systemUserService.getById(userId).getRealName());
|
costQuantity.setReportBy(systemUserService.getById(userId).getRealName());
|
||||||
|
ProjectInfoExtVo projectInfoBySn = projectService.getProjectInfoBySn(costQuantity.getProjectSn());
|
||||||
|
costQuantity.setProjectId(projectInfoBySn == null ? "" : projectInfoBySn.getProjectId().toString());
|
||||||
|
costQuantity.setAmount(object.getString("amount"));
|
||||||
costQuantityService.save(costQuantity);
|
costQuantityService.save(costQuantity);
|
||||||
return Result.success("添加成功!");
|
return Result.success("添加成功!");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,15 +22,45 @@ public class DynamicCostDto {
|
|||||||
@ApiModelProperty(value = "目标+调整")
|
@ApiModelProperty(value = "目标+调整")
|
||||||
private BigDecimal goal = new BigDecimal(0);
|
private BigDecimal goal = new BigDecimal(0);
|
||||||
|
|
||||||
@ApiModelProperty(value = "动态成本")
|
@ApiModelProperty(value = "动态目标")
|
||||||
private BigDecimal dynamicCost = new BigDecimal(0);
|
private BigDecimal dynamicCost = new BigDecimal(0);
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "差额")
|
||||||
|
private BigDecimal allowance = new BigDecimal(0);
|
||||||
|
|
||||||
@ApiModelProperty(value = "差额比例")
|
@ApiModelProperty(value = "差额比例")
|
||||||
private String costDifference = "0";
|
private String costDifference = "0";
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "合同总额")
|
||||||
|
private BigDecimal contractAmountTotal = new BigDecimal(0);
|
||||||
|
|
||||||
@ApiModelProperty(value = "合同金额")
|
@ApiModelProperty(value = "合同金额")
|
||||||
private BigDecimal contractAmount = new BigDecimal(0);
|
private BigDecimal contractAmount = new BigDecimal(0);
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "合同变更金额")
|
||||||
|
private BigDecimal contractAmountChange = new BigDecimal(0);
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "合同产值")
|
||||||
|
private BigDecimal costQuantity = new BigDecimal(0);
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "待发产值")
|
||||||
|
private BigDecimal costQuantityUnComplete = new BigDecimal(0);
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "付款申请")
|
||||||
|
private BigDecimal payApply = new BigDecimal(0);
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "开票金额")
|
||||||
|
private BigDecimal invoiceAmount = new BigDecimal(0);
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "实付登记")
|
||||||
|
private BigDecimal payAmount = new BigDecimal(0);
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "申请未付")
|
||||||
|
private BigDecimal unPayAmount = new BigDecimal(0);
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "应付账款")
|
||||||
|
private BigDecimal accountsPayAmount = new BigDecimal(0);
|
||||||
|
|
||||||
@ApiModelProperty(value = "在途成本")
|
@ApiModelProperty(value = "在途成本")
|
||||||
private BigDecimal underApproval = new BigDecimal(0);
|
private BigDecimal underApproval = new BigDecimal(0);
|
||||||
|
|
||||||
@ -40,9 +70,6 @@ public class DynamicCostDto {
|
|||||||
@ApiModelProperty(value = "预估变更")
|
@ApiModelProperty(value = "预估变更")
|
||||||
private BigDecimal estimatedChange = new BigDecimal(0);
|
private BigDecimal estimatedChange = new BigDecimal(0);
|
||||||
|
|
||||||
@ApiModelProperty(value = "规划余量")
|
|
||||||
private BigDecimal allowance = new BigDecimal(0);
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "子级动态成本信息")
|
@ApiModelProperty(value = "子级动态成本信息")
|
||||||
private List<DynamicCostDto> children = new ArrayList<>();
|
private List<DynamicCostDto> children = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -116,11 +116,11 @@ public class CostContract implements Serializable {
|
|||||||
@ApiModelProperty(value = "合同类型")
|
@ApiModelProperty(value = "合同类型")
|
||||||
private String htlxnew;
|
private String htlxnew;
|
||||||
/**
|
/**
|
||||||
* 相对方签约主体
|
* 乙方单位
|
||||||
*/
|
*/
|
||||||
@Excel(name = "相对方签约主体", width = 15)
|
@Excel(name = "乙方单位", width = 15)
|
||||||
@ApiModelProperty(value = "相对方签约主体")
|
@ApiModelProperty(value = "乙方单位")
|
||||||
private String xdfqyzt;
|
private String yfdw;
|
||||||
/**
|
/**
|
||||||
* 统一社会信用代码
|
* 统一社会信用代码
|
||||||
*/
|
*/
|
||||||
@ -438,11 +438,17 @@ public class CostContract implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@Excel(name = "科目", width = 15)
|
@Excel(name = "科目", width = 15)
|
||||||
@ApiModelProperty(value = "科目")
|
@ApiModelProperty(value = "科目")
|
||||||
private String km;
|
private String kmlkd;
|
||||||
/**
|
/**
|
||||||
* 合约规划
|
* 合约规划
|
||||||
*/
|
*/
|
||||||
@Excel(name = "合约规划", width = 15)
|
@Excel(name = "合约规划", width = 15)
|
||||||
@ApiModelProperty(value = "合约规划")
|
@ApiModelProperty(value = "合约规划")
|
||||||
private String hygh;
|
private String hygh;
|
||||||
|
/**
|
||||||
|
* 是否关联主合同
|
||||||
|
*/
|
||||||
|
@Excel(name = "是否关联主合同", width = 15)
|
||||||
|
@ApiModelProperty(value = "是否关联主合同")
|
||||||
|
private String sfglzht;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -266,6 +266,12 @@ public class CostContractPay implements Serializable {
|
|||||||
@Excel(name = "所属项目", width = 15)
|
@Excel(name = "所属项目", width = 15)
|
||||||
@ApiModelProperty(value = "所属项目")
|
@ApiModelProperty(value = "所属项目")
|
||||||
private String sxm;
|
private String sxm;
|
||||||
|
/**
|
||||||
|
* 开票金额
|
||||||
|
*/
|
||||||
|
@Excel(name = "开票金额", width = 15)
|
||||||
|
@ApiModelProperty(value = "开票金额")
|
||||||
|
private String jshj;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@ApiModelProperty(value = "经办人")
|
@ApiModelProperty(value = "经办人")
|
||||||
|
|||||||
@ -109,4 +109,16 @@ public class CostQuantity implements Serializable {
|
|||||||
@Excel(name = "资金计划ID", width = 15)
|
@Excel(name = "资金计划ID", width = 15)
|
||||||
@ApiModelProperty(value = "资金计划ID")
|
@ApiModelProperty(value = "资金计划ID")
|
||||||
private Long payPlanId;
|
private Long payPlanId;
|
||||||
|
/**
|
||||||
|
* 产值金额
|
||||||
|
*/
|
||||||
|
@Excel(name = "产值金额", width = 15)
|
||||||
|
@ApiModelProperty(value = "产值金额")
|
||||||
|
private String amount;
|
||||||
|
/**
|
||||||
|
* 项目ID
|
||||||
|
*/
|
||||||
|
@Excel(name = "项目ID", width = 15)
|
||||||
|
@ApiModelProperty(value = "项目ID")
|
||||||
|
private String projectId;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,7 +69,7 @@ public class CostBudgetServiceImpl extends ServiceImpl<CostBudgetMapper, CostBud
|
|||||||
for (CostBudget costBudget : budgetList) {
|
for (CostBudget costBudget : budgetList) {
|
||||||
List<CostSubject> children = allList.stream().filter(a -> a.getParentId().toString().equals(costBudget.getSubjectId().toString())).collect(Collectors.toList());
|
List<CostSubject> children = allList.stream().filter(a -> a.getParentId().toString().equals(costBudget.getSubjectId().toString())).collect(Collectors.toList());
|
||||||
if (children.size() > 0) {
|
if (children.size() > 0) {
|
||||||
List<String> contractIds = contractList.stream().filter(c -> children.stream().map(d -> d.getId().toString()).collect(Collectors.toList()).contains(c.getKm().toString())).map(c -> c.getId().toString()).collect(Collectors.toList());
|
List<String> contractIds = contractList.stream().filter(c -> children.stream().map(d -> d.getId().toString()).collect(Collectors.toList()).contains(c.getKmlkd().toString())).map(c -> c.getId().toString()).collect(Collectors.toList());
|
||||||
BigDecimal reduce = costContractPayList.stream().filter(c -> contractIds.contains(c.getHtmc())).map(c -> new BigDecimal(c.getSfje()))
|
BigDecimal reduce = costContractPayList.stream().filter(c -> contractIds.contains(c.getHtmc())).map(c -> new BigDecimal(c.getSfje()))
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
costBudget.setActualCost(reduce.toString());
|
costBudget.setActualCost(reduce.toString());
|
||||||
@ -80,7 +80,7 @@ public class CostBudgetServiceImpl extends ServiceImpl<CostBudgetMapper, CostBud
|
|||||||
costBudget.setCostDifference(ratio.multiply(new BigDecimal(100)).toString());
|
costBudget.setCostDifference(ratio.multiply(new BigDecimal(100)).toString());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
List<String> contractIds = contractList.stream().filter(c -> c.getKm().toString().equals(costBudget.getSubjectId().toString())).map(c -> c.getId().toString()).collect(Collectors.toList());
|
List<String> contractIds = contractList.stream().filter(c -> c.getKmlkd().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.getSfje()))
|
BigDecimal reduce = costContractPayList.stream().filter(c -> contractIds.contains(c.getHtmc())).map(c -> new BigDecimal(c.getSfje()))
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
costBudget.setActualCost(reduce.toString());
|
costBudget.setActualCost(reduce.toString());
|
||||||
|
|||||||
@ -42,7 +42,7 @@ public class CostContractDetailServiceImpl extends ServiceImpl<CostContractDetai
|
|||||||
this.saveBatch(contractDetails);
|
this.saveBatch(contractDetails);
|
||||||
CostContract contractPlan = costContractService.getById(contractDetails.get(0).getContractPlanId());
|
CostContract contractPlan = costContractService.getById(contractDetails.get(0).getContractPlanId());
|
||||||
String collect = contractDetails.stream().map(c -> c.getSubjectId().toString()).collect(Collectors.joining(","));
|
String collect = contractDetails.stream().map(c -> c.getSubjectId().toString()).collect(Collectors.joining(","));
|
||||||
contractPlan.setKm(collect);
|
contractPlan.setKmlkd(collect);
|
||||||
return costContractService.updateById(contractPlan);
|
return costContractService.updateById(contractPlan);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import org.springframework.beans.BeanUtils;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.ws.rs.GET;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -45,6 +46,15 @@ public class CostContractPlanServiceImpl extends ServiceImpl<CostContractPlanMap
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ICostContractService costContractService;
|
private ICostContractService costContractService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ICostPayPlanService costPayPlanService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ICostContractPayService costContractPayService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ICostQuantityService costQuantityService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ICostContractDetailService costContractDetailService;
|
private ICostContractDetailService costContractDetailService;
|
||||||
|
|
||||||
@ -113,7 +123,10 @@ public class CostContractPlanServiceImpl extends ServiceImpl<CostContractPlanMap
|
|||||||
.eq(CostContract::getProjectSn, projectInfoBySn.getProjectSn()));
|
.eq(CostContract::getProjectSn, projectInfoBySn.getProjectSn()));
|
||||||
// List<CostContractDetail> contractDetailList = costContractDetailService.list(Wrappers.<CostContractDetail>lambdaQuery()
|
// List<CostContractDetail> contractDetailList = costContractDetailService.list(Wrappers.<CostContractDetail>lambdaQuery()
|
||||||
// .eq(CostContractDetail::getProjectId, projectInfoBySn.getProjectId()));
|
// .eq(CostContractDetail::getProjectId, projectInfoBySn.getProjectId()));
|
||||||
resultList = getDynamicChildren(parentSubList, allSubList, costBudgetList, contractList);
|
List<CostPayPlan> costPayPlanList = costPayPlanService.list();
|
||||||
|
List<CostContractPay> costContractPayList = costContractPayService.list();
|
||||||
|
List<CostQuantity> costQuantityList = costQuantityService.list(Wrappers.<CostQuantity>lambdaQuery().eq(CostQuantity::getProjectSn, projectInfoBySn.getProjectSn()));
|
||||||
|
resultList = getDynamicChildren(parentSubList, allSubList, costBudgetList, contractList, costPayPlanList, costContractPayList, costQuantityList);
|
||||||
}
|
}
|
||||||
return resultList;
|
return resultList;
|
||||||
}
|
}
|
||||||
@ -205,7 +218,7 @@ public class CostContractPlanServiceImpl extends ServiceImpl<CostContractPlanMap
|
|||||||
costContractPlanDto.setSubjectId(costSubject.getParentId());
|
costContractPlanDto.setSubjectId(costSubject.getParentId());
|
||||||
costContractPlanDto.setContractName(costSubject.getName());
|
costContractPlanDto.setContractName(costSubject.getName());
|
||||||
// 查询合约
|
// 查询合约
|
||||||
List<CostContract> contracts = contractList.stream().filter(c -> c.getKm().toString().equals(costSubject.getId().toString())).collect(Collectors.toList());
|
List<CostContract> contracts = contractList.stream().filter(c -> c.getKmlkd().toString().equals(costSubject.getId().toString())).collect(Collectors.toList());
|
||||||
costContractPlanDto.setGoal(costBudgetList.stream().filter(c -> c.getSubjectId().toString().equals(costSubject.getId().toString()))
|
costContractPlanDto.setGoal(costBudgetList.stream().filter(c -> c.getSubjectId().toString().equals(costSubject.getId().toString()))
|
||||||
.map(c -> new BigDecimal(c.getBudgetCost())).reduce(BigDecimal.ZERO, BigDecimal::add));
|
.map(c -> new BigDecimal(c.getBudgetCost())).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
costContractPlanDto.setUnderApproval(contracts.stream().map(c -> new BigDecimal(c.getHtjea())).reduce(BigDecimal.ZERO, BigDecimal::add));
|
costContractPlanDto.setUnderApproval(contracts.stream().map(c -> new BigDecimal(c.getHtjea())).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
@ -228,39 +241,103 @@ public class CostContractPlanServiceImpl extends ServiceImpl<CostContractPlanMap
|
|||||||
return costContractPlanDtoList;
|
return costContractPlanDtoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<DynamicCostDto> getDynamicChildren(List<CostSubject> list, List<CostSubject> allList, List<CostBudget> costBudgetList, List<CostContract> contractList) {
|
private List<DynamicCostDto> getDynamicChildren(List<CostSubject> list, List<CostSubject> allList, List<CostBudget> costBudgetList, List<CostContract> contractList
|
||||||
|
, List<CostPayPlan> costPayPlanList, List<CostContractPay> costContractPayList, List<CostQuantity> costQuantityList) {
|
||||||
List<DynamicCostDto> dynamicCostDtoList = new ArrayList<>();
|
List<DynamicCostDto> dynamicCostDtoList = new ArrayList<>();
|
||||||
for (CostSubject costSubject : list) {
|
for (CostSubject costSubject : list) {
|
||||||
DynamicCostDto dynamicCostDto = new DynamicCostDto();
|
DynamicCostDto dynamicCostDto = new DynamicCostDto();
|
||||||
dynamicCostDto.setSubjectId(costSubject.getId());
|
dynamicCostDto.setSubjectId(costSubject.getId());
|
||||||
dynamicCostDto.setSubjectName(costSubject.getName());
|
dynamicCostDto.setSubjectName(costSubject.getName());
|
||||||
|
|
||||||
// 查询合约
|
// 查询合约
|
||||||
List<CostSubject> children = allList.stream().filter(a -> a.getParentId().toString().equals(costSubject.getId().toString())).collect(Collectors.toList());
|
List<CostSubject> children = allList.stream().filter(a -> a.getParentId().toString().equals(costSubject.getId().toString())).collect(Collectors.toList());
|
||||||
if (children.size() > 0) {
|
if (children.size() > 0) {
|
||||||
List<String> stringList = children.stream().map(d -> d.getId().toString()).collect(Collectors.toList());
|
List<String> stringList = children.stream().map(d -> d.getId().toString()).collect(Collectors.toList());
|
||||||
List<CostContract> contracts = contractList.stream().filter(c -> stringList.contains(c.getKm().toString())).collect(Collectors.toList());
|
List<CostContract> contracts = contractList.stream().filter(c -> stringList.contains(c.getKmlkd().toString())
|
||||||
|
&& c.getHtqszt().equals("履约完毕")).collect(Collectors.toList());
|
||||||
|
List<String> htbhList = contracts.stream().map(c -> c.getHtbh()).collect(Collectors.toList());
|
||||||
|
List<String> htidList = contracts.stream().map(c -> c.getId().toString()).collect(Collectors.toList());
|
||||||
|
List<CostContract> subContracts = contracts.stream().filter(c -> htidList.contains(c.getGlzht())).collect(Collectors.toList());
|
||||||
dynamicCostDto.setGoal(costBudgetList.stream().filter(c -> stringList.contains(c.getSubjectId().toString()))
|
dynamicCostDto.setGoal(costBudgetList.stream().filter(c -> stringList.contains(c.getSubjectId().toString()))
|
||||||
.map(c -> new BigDecimal(c.getBudgetCost())).reduce(BigDecimal.ZERO, BigDecimal::add));
|
.map(c -> new BigDecimal(c.getBudgetCost())).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
dynamicCostDto.setContractAmount(contracts.stream().filter(c -> c.getHtqszt().equals("履约完毕")).map(c -> new BigDecimal(c.getHtjea())).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
||||||
dynamicCostDto.setUnderApproval(contracts.stream().filter(c -> c.getHtqszt().equals("审核中")).map(c -> new BigDecimal(c.getHtjea())).reduce(BigDecimal.ZERO, BigDecimal::add));
|
dynamicCostDto.setUnderApproval(contracts.stream().filter(c -> c.getHtqszt().equals("审核中")).map(c -> new BigDecimal(c.getHtjea())).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
dynamicCostDto.setDynamicCost(dynamicCostDto.getContractAmount().add(dynamicCostDto.getUnderApproval()).add(dynamicCostDto.getToOccur()).add(dynamicCostDto.getContractAmount()));
|
dynamicCostDto.setDynamicCost(dynamicCostDto.getContractAmount().add(dynamicCostDto.getUnderApproval()).add(dynamicCostDto.getToOccur()).add(dynamicCostDto.getContractAmount()));
|
||||||
BigDecimal subtract = dynamicCostDto.getGoal().subtract(dynamicCostDto.getDynamicCost());
|
BigDecimal subtract = dynamicCostDto.getGoal().subtract(dynamicCostDto.getDynamicCost());
|
||||||
dynamicCostDto.setCostDifference(dynamicCostDto.getGoal().compareTo(new BigDecimal(0)) > 0 ? subtract.divide(dynamicCostDto.getGoal(), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).toString() : "0");
|
dynamicCostDto.setCostDifference(dynamicCostDto.getGoal().compareTo(new BigDecimal(0)) > 0 ? subtract.divide(dynamicCostDto.getGoal(), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).toString() : "0");
|
||||||
dynamicCostDto.setAllowance(subtract);
|
dynamicCostDto.setAllowance(subtract);
|
||||||
|
//合同金额
|
||||||
|
dynamicCostDto.setContractAmount(contracts.stream().map(c -> new BigDecimal(c.getHtjea())).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
|
//变更金额
|
||||||
|
dynamicCostDto.setContractAmountChange(subContracts.stream().map(c -> new BigDecimal(c.getHtjea())).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
|
//合同总额
|
||||||
|
dynamicCostDto.setContractAmountTotal(dynamicCostDto.getContractAmount().add(dynamicCostDto.getContractAmountChange()));
|
||||||
|
//合同产值
|
||||||
|
dynamicCostDto.setCostQuantity(costQuantityList.stream().filter(c -> htidList.contains(c.getContractId().toString())).map(c -> new BigDecimal(c.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
|
//待发产值=合同金额-合同产值
|
||||||
|
dynamicCostDto.setCostQuantityUnComplete(dynamicCostDto.getContractAmount().subtract(dynamicCostDto.getCostQuantity()));
|
||||||
|
//付款申请=合同产值*付款条件
|
||||||
|
List<String> jhfkjeList = costPayPlanList.stream().filter(c -> htbhList.contains(c.getHtbh())).map(c -> c.getJhfkje()).collect(Collectors.toList());
|
||||||
|
dynamicCostDto.setPayApply(jhfkjeList.stream().map(j -> new BigDecimal(j)).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
|
//开票金额
|
||||||
|
dynamicCostDto.setInvoiceAmount(costContractPayList.stream().filter(c -> htbhList.contains(c.getHtbh()))
|
||||||
|
.map(c -> new BigDecimal(c.getJshj())).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
|
//实付登记
|
||||||
|
List<String> sfjeList = costContractPayList.stream().filter(c -> htbhList.contains(c.getHtbh())).map(c -> c.getSfje()).collect(Collectors.toList());
|
||||||
|
dynamicCostDto.setPayAmount(sfjeList.stream().map(j -> new BigDecimal(j)).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
|
//申请未付=付款申请-实付登记
|
||||||
|
dynamicCostDto.setUnPayAmount(dynamicCostDto.getPayApply().subtract(dynamicCostDto.getPayAmount()));
|
||||||
|
//应付账款=合同产值-实付登记
|
||||||
|
dynamicCostDto.setAccountsPayAmount(dynamicCostDto.getCostQuantity().subtract(dynamicCostDto.getPayAmount()));
|
||||||
} else {
|
} else {
|
||||||
List<CostContract> contracts = contractList.stream().filter(c -> c.getKm().toString().equals(costSubject.getId().toString())).collect(Collectors.toList());
|
List<CostContract> contracts = contractList.stream().filter(c -> c.getKmlkd().toString().equals(costSubject.getId().toString())).collect(Collectors.toList());
|
||||||
|
List<String> htbhList = contracts.stream().map(c -> c.getHtbh()).collect(Collectors.toList());
|
||||||
|
List<String> htidList = contracts.stream().map(c -> c.getId().toString()).collect(Collectors.toList());
|
||||||
|
List<CostContract> subContracts = contracts.stream().filter(c -> htidList.contains(c.getGlzht())).collect(Collectors.toList());
|
||||||
dynamicCostDto.setGoal(costBudgetList.stream().filter(c -> c.getSubjectId().toString().equals(costSubject.getId().toString()))
|
dynamicCostDto.setGoal(costBudgetList.stream().filter(c -> c.getSubjectId().toString().equals(costSubject.getId().toString()))
|
||||||
.map(c -> new BigDecimal(c.getBudgetCost())).reduce(BigDecimal.ZERO, BigDecimal::add));
|
.map(c -> new BigDecimal(c.getBudgetCost())).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
dynamicCostDto.setContractAmount(contracts.stream().filter(c -> c.getHtqszt().equals("履约完毕")).map(c -> new BigDecimal(c.getHtjea())).reduce(BigDecimal.ZERO, BigDecimal::add));
|
// dynamicCostDto.setContractAmount(contracts.stream().filter(c -> c.getHtqszt().equals("履约完毕")).map(c -> new BigDecimal(c.getHtjea())).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
dynamicCostDto.setUnderApproval(contracts.stream().filter(c -> c.getHtqszt().equals("审核中")).map(c -> new BigDecimal(c.getHtjea())).reduce(BigDecimal.ZERO, BigDecimal::add));
|
dynamicCostDto.setUnderApproval(contracts.stream().filter(c -> c.getHtqszt().equals("审核中")).map(c -> new BigDecimal(c.getHtjea())).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
dynamicCostDto.setDynamicCost(dynamicCostDto.getContractAmount().add(dynamicCostDto.getUnderApproval()).add(dynamicCostDto.getToOccur()).add(dynamicCostDto.getContractAmount()));
|
dynamicCostDto.setDynamicCost(dynamicCostDto.getContractAmount().add(dynamicCostDto.getUnderApproval()).add(dynamicCostDto.getToOccur()).add(dynamicCostDto.getContractAmount()));
|
||||||
BigDecimal subtract = dynamicCostDto.getGoal().subtract(dynamicCostDto.getDynamicCost());
|
BigDecimal subtract = dynamicCostDto.getGoal().subtract(dynamicCostDto.getDynamicCost());
|
||||||
dynamicCostDto.setCostDifference(dynamicCostDto.getGoal().compareTo(new BigDecimal(0)) > 0 ? subtract.divide(dynamicCostDto.getGoal(), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).toString() : "0");
|
dynamicCostDto.setCostDifference(dynamicCostDto.getGoal().compareTo(new BigDecimal(0)) > 0 ? subtract.divide(dynamicCostDto.getGoal(), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).toString() : "0");
|
||||||
dynamicCostDto.setAllowance(subtract);
|
dynamicCostDto.setAllowance(subtract);
|
||||||
|
dynamicCostDto.setChildren(getDynamicChildren(contracts.stream().filter(c -> c.getHtqszt().equals("履约完毕")).collect(Collectors.toList()), costSubject.getId().toString()));
|
||||||
|
//合同金额
|
||||||
|
dynamicCostDto.setContractAmount(contracts.stream().map(c -> new BigDecimal(c.getHtjea())).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
|
//变更金额
|
||||||
|
dynamicCostDto.setContractAmountChange(subContracts.stream().map(c -> new BigDecimal(c.getHtjea())).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
|
//合同总额
|
||||||
|
dynamicCostDto.setContractAmountTotal(dynamicCostDto.getContractAmount().add(dynamicCostDto.getContractAmountChange()));
|
||||||
|
//合同产值
|
||||||
|
dynamicCostDto.setCostQuantity(costQuantityList.stream().filter(c -> htidList.contains(c.getContractId().toString())).map(c -> new BigDecimal(c.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
|
//待发产值=合同金额-合同产值
|
||||||
|
dynamicCostDto.setCostQuantityUnComplete(dynamicCostDto.getContractAmount().subtract(dynamicCostDto.getCostQuantity()));
|
||||||
|
//付款申请=合同产值*付款条件
|
||||||
|
List<String> jhfkjeList = costPayPlanList.stream().filter(c -> htbhList.contains(c.getHtbh())).map(c -> c.getJhfkje()).collect(Collectors.toList());
|
||||||
|
dynamicCostDto.setPayApply(jhfkjeList.stream().map(j -> new BigDecimal(j)).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
|
//开票金额
|
||||||
|
dynamicCostDto.setInvoiceAmount(costContractPayList.stream().filter(c -> htbhList.contains(c.getHtbh()))
|
||||||
|
.map(c -> new BigDecimal(c.getJshj())).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
|
//实付登记
|
||||||
|
List<String> sfjeList = costContractPayList.stream().filter(c -> htbhList.contains(c.getHtbh())).map(c -> c.getSfje()).collect(Collectors.toList());
|
||||||
|
dynamicCostDto.setPayAmount(sfjeList.stream().map(j -> new BigDecimal(j)).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
|
//申请未付=付款申请-实付登记
|
||||||
|
dynamicCostDto.setUnPayAmount(dynamicCostDto.getPayApply().subtract(dynamicCostDto.getPayAmount()));
|
||||||
|
//应付账款=合同产值-实付登记
|
||||||
|
dynamicCostDto.setAccountsPayAmount(dynamicCostDto.getCostQuantity().subtract(dynamicCostDto.getPayAmount()));
|
||||||
}
|
}
|
||||||
// List<CostSubject> allChildren = allList.stream().filter(a -> Arrays.asList(a.getAncestors().split(",")).contains(costSubject.getId().toString())).collect(Collectors.toList());
|
// List<CostSubject> allChildren = allList.stream().filter(a -> Arrays.asList(a.getAncestors().split(",")).contains(costSubject.getId().toString())).collect(Collectors.toList());
|
||||||
dynamicCostDto.setChildren(getDynamicChildren(children, allList, costBudgetList, contractList));
|
dynamicCostDto.setChildren(getDynamicChildren(children, allList, costBudgetList, contractList, costPayPlanList, costContractPayList, costQuantityList));
|
||||||
|
dynamicCostDtoList.add(dynamicCostDto);
|
||||||
|
}
|
||||||
|
return dynamicCostDtoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<DynamicCostDto> getDynamicChildren(List<CostContract> contracts, String subjectId) {
|
||||||
|
List<DynamicCostDto> dynamicCostDtoList = new ArrayList<>();
|
||||||
|
for (CostContract contract : contracts) {
|
||||||
|
DynamicCostDto dynamicCostDto = new DynamicCostDto();
|
||||||
|
dynamicCostDto.setSubjectName(contract.getHtmc());
|
||||||
|
dynamicCostDto.setContractAmount(new BigDecimal(contract.getHtjea()));
|
||||||
dynamicCostDtoList.add(dynamicCostDto);
|
dynamicCostDtoList.add(dynamicCostDto);
|
||||||
}
|
}
|
||||||
return dynamicCostDtoList;
|
return dynamicCostDtoList;
|
||||||
|
|||||||
@ -161,4 +161,10 @@ public class JzProjectStart implements Serializable {
|
|||||||
@Excel(name = "工程内容", width = 15)
|
@Excel(name = "工程内容", width = 15)
|
||||||
@ApiModelProperty(value = "工程内容")
|
@ApiModelProperty(value = "工程内容")
|
||||||
private String gcnr;
|
private String gcnr;
|
||||||
|
/**
|
||||||
|
* 附件
|
||||||
|
*/
|
||||||
|
@Excel(name = "附件", width = 15)
|
||||||
|
@ApiModelProperty(value = "附件")
|
||||||
|
private String fileUrl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -103,7 +103,7 @@ public class JzQualityInspectionRecord implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@Excel(name = "整改时限", width = 15)
|
@Excel(name = "整改时限", width = 15)
|
||||||
@ApiModelProperty(value = "整改时限")
|
@ApiModelProperty(value = "整改时限")
|
||||||
private String changeLimitTime;
|
private Date changeLimitTime;
|
||||||
/**
|
/**
|
||||||
* 检查人id
|
* 检查人id
|
||||||
*/
|
*/
|
||||||
@ -133,7 +133,7 @@ public class JzQualityInspectionRecord implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@Excel(name = "整改完成时间", width = 15)
|
@Excel(name = "整改完成时间", width = 15)
|
||||||
@ApiModelProperty(value = "整改完成时间")
|
@ApiModelProperty(value = "整改完成时间")
|
||||||
private String completeTime;
|
private Date completeTime;
|
||||||
/**
|
/**
|
||||||
* 项目唯一标识
|
* 项目唯一标识
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -40,6 +40,10 @@ public class JiuzhuDataTask {
|
|||||||
public void projectData() {
|
public void projectData() {
|
||||||
jiuzhuDateUtil.getSubCompanyData();
|
jiuzhuDateUtil.getSubCompanyData();
|
||||||
jiuzhuDateUtil.getProjectSupplier();
|
jiuzhuDateUtil.getProjectSupplier();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Scheduled(cron = "0 0/2 * * * ?")
|
||||||
|
public void projectData1() {
|
||||||
jiuzhuDateUtil.getContract();
|
jiuzhuDateUtil.getContract();
|
||||||
jiuzhuDateUtil.getContractPay();
|
jiuzhuDateUtil.getContractPay();
|
||||||
jiuzhuDateUtil.getPayPlan();
|
jiuzhuDateUtil.getPayPlan();
|
||||||
|
|||||||
@ -36,6 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
@ -202,10 +203,17 @@ public class JiuzhuDateUtil {
|
|||||||
for (int i = 0; i < jsonArray.size(); i++) {
|
for (int i = 0; i < jsonArray.size(); i++) {
|
||||||
JSONObject projectObj = jsonArray.getJSONObject(i).getJSONObject("mainTable");
|
JSONObject projectObj = jsonArray.getJSONObject(i).getJSONObject("mainTable");
|
||||||
CostContractPay costContractPay = JSONObject.parseObject(JSON.toJSONString(projectObj), CostContractPay.class);
|
CostContractPay costContractPay = JSONObject.parseObject(JSON.toJSONString(projectObj), CostContractPay.class);
|
||||||
|
JSONArray detailArray = jsonArray.getJSONObject(i).getJSONArray("detail6");
|
||||||
|
BigDecimal jshjTotal = new BigDecimal(0);
|
||||||
|
for (Object o : detailArray) {
|
||||||
|
JSONObject detail6Obj = JSONObject.parseObject(JSON.toJSONString(o));
|
||||||
|
String jshj = detail6Obj.getString("jshj");
|
||||||
|
if (StringUtils.isNotBlank(jshj)) {
|
||||||
|
jshjTotal.add(new BigDecimal(jshj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
costContractPay.setJshj(jshjTotal.toString());
|
||||||
contractPayList.add(costContractPay);
|
contractPayList.add(costContractPay);
|
||||||
|
|
||||||
// JSONArray detailArray = jsonArray.getJSONObject(i).getJSONArray("detail1");
|
|
||||||
// System.out.println(detailArray);
|
|
||||||
}
|
}
|
||||||
costContractPayService.saveOrUpdateBatch(contractPayList);
|
costContractPayService.saveOrUpdateBatch(contractPayList);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user