|
@@ -1,6 +1,9 @@ |
|
|
package com.ningdatech.pmapi.dashboard.manage; |
|
|
package com.ningdatech.pmapi.dashboard.manage; |
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.google.common.collect.Lists; |
|
|
import com.google.common.collect.Lists; |
|
@@ -24,11 +27,18 @@ import com.ningdatech.pmapi.projectlib.model.entity.Project; |
|
|
import com.ningdatech.pmapi.projectlib.model.entity.ProjectDelayApply; |
|
|
import com.ningdatech.pmapi.projectlib.model.entity.ProjectDelayApply; |
|
|
import com.ningdatech.pmapi.projectlib.service.INdProjectDelayApplyService; |
|
|
import com.ningdatech.pmapi.projectlib.service.INdProjectDelayApplyService; |
|
|
import com.ningdatech.pmapi.projectlib.service.IProjectService; |
|
|
import com.ningdatech.pmapi.projectlib.service.IProjectService; |
|
|
|
|
|
import com.ningdatech.pmapi.sys.model.req.NoticeListReq; |
|
|
|
|
|
import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedReq; |
|
|
|
|
|
import com.ningdatech.pmapi.todocenter.model.vo.TodoCenterStatisticsVO; |
|
|
|
|
|
import com.ningdatech.pmapi.workbench.converter.WorkbenchConverter; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import org.springframework.stereotype.Component; |
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
import java.math.BigDecimal; |
|
|
|
|
|
import java.math.RoundingMode; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
|
|
|
import java.util.concurrent.CompletableFuture; |
|
|
|
|
|
import java.util.concurrent.ForkJoinPool; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@@ -341,8 +351,9 @@ public class DashboardProjectManage { |
|
|
|
|
|
|
|
|
//2.转换项目信息 |
|
|
//2.转换项目信息 |
|
|
ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(project,ProtraitProjectInfoVO.class); |
|
|
ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(project,ProtraitProjectInfoVO.class); |
|
|
|
|
|
//todo: 超期逻辑 |
|
|
projectInfo.setOverdueSituation("即将超期"); |
|
|
projectInfo.setOverdueSituation("即将超期"); |
|
|
projectInfo.setSafetyInputRate("3%"); |
|
|
|
|
|
|
|
|
projectInfo.setSafetyInputRate(convertSafetyInputRate(project)); |
|
|
//3.项目状态情况 |
|
|
//3.项目状态情况 |
|
|
projectInfo.setStatusSituation(generateProjectStatus(project)); |
|
|
projectInfo.setStatusSituation(generateProjectStatus(project)); |
|
|
res.setProjectInfo(projectInfo); |
|
|
res.setProjectInfo(projectInfo); |
|
@@ -357,29 +368,79 @@ public class DashboardProjectManage { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
|
|
|
* 计算安全投入 |
|
|
|
|
|
* @param project |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
private String convertSafetyInputRate(Project project) { |
|
|
|
|
|
String safetyInputDescribe = project.getSafetyInputDescribe(); |
|
|
|
|
|
if(org.apache.commons.lang3.StringUtils.isNotBlank(safetyInputDescribe)){ |
|
|
|
|
|
JSONArray array = JSON.parseArray(safetyInputDescribe); |
|
|
|
|
|
final Integer[] total = {0}; |
|
|
|
|
|
array.forEach(j -> { |
|
|
|
|
|
JSONObject json = JSON.parseObject(JSON.toJSONString(j)); |
|
|
|
|
|
Integer safetyInputAmount = json.getInteger("safetyInputAmount"); |
|
|
|
|
|
total[0] += safetyInputAmount; |
|
|
|
|
|
}); |
|
|
|
|
|
Integer totalAmount = total[0]; |
|
|
|
|
|
//申报金额 |
|
|
|
|
|
BigDecimal declareAmount = project.getDeclareAmount(); |
|
|
|
|
|
if(Objects.isNull(declareAmount) || declareAmount.compareTo(BigDecimal.ZERO) == 0){ |
|
|
|
|
|
return "0%"; |
|
|
|
|
|
} |
|
|
|
|
|
BigDecimal rate = BigDecimal.valueOf(totalAmount).multiply(BigDecimal.valueOf(100)) |
|
|
|
|
|
.divide(declareAmount,BigDecimal.ROUND_CEILING, RoundingMode.HALF_UP) |
|
|
|
|
|
.stripTrailingZeros(); |
|
|
|
|
|
return rate.toPlainString() + "%"; |
|
|
|
|
|
} |
|
|
|
|
|
return "0%"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
* 生成项目 状态流转信息 |
|
|
* 生成项目 状态流转信息 |
|
|
* @param project |
|
|
* @param project |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
private List<ProtraitProjectStatusSituationVO> generateProjectStatus(Project project) { |
|
|
private List<ProtraitProjectStatusSituationVO> generateProjectStatus(Project project) { |
|
|
List<ProtraitProjectStatusSituationVO> res = Lists.newArrayList(); |
|
|
|
|
|
|
|
|
final List<ProtraitProjectStatusSituationVO> res = Lists.newArrayList(); |
|
|
//1.计划(单位内部审核) |
|
|
//1.计划(单位内部审核) |
|
|
res.add(statusHandler.generateApproveStatus(project,DashboardConstant.Protrait.PLAN,InstTypeEnum.UNIT_INNER_AUDIT.getCode())); |
|
|
|
|
|
|
|
|
res.add(new ProtraitProjectStatusSituationVO()); |
|
|
//2.申报(项目预审) |
|
|
//2.申报(项目预审) |
|
|
res.add(statusHandler.generateApproveStatus(project,DashboardConstant.Protrait.DECLARED,InstTypeEnum.PRELIMINARY_PREVIEW.getCode())); |
|
|
|
|
|
|
|
|
res.add(new ProtraitProjectStatusSituationVO()); |
|
|
//3.审批(建设方案审批) |
|
|
//3.审批(建设方案审批) |
|
|
res.add(statusHandler.generateApproveStatus(project,DashboardConstant.Protrait.APPROVE,InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode())); |
|
|
|
|
|
|
|
|
res.add(new ProtraitProjectStatusSituationVO()); |
|
|
//4.建设(立项后的建设中) |
|
|
//4.建设(立项后的建设中) |
|
|
res.add(statusHandler.generateStatus(project,DashboardConstant.Protrait.CONSTRUCTION, |
|
|
|
|
|
ProjectStatusEnum.UNDER_CONSTRUCTION.getCode(),ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode())); |
|
|
|
|
|
|
|
|
res.add(new ProtraitProjectStatusSituationVO()); |
|
|
//5.验收(终验) |
|
|
//5.验收(终验) |
|
|
res.add(statusHandler.generateApproveStatus(project,DashboardConstant.Protrait.ACCEPT,InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode())); |
|
|
|
|
|
|
|
|
res.add(new ProtraitProjectStatusSituationVO()); |
|
|
//6.运维(todo: 运维时间还没有) |
|
|
//6.运维(todo: 运维时间还没有) |
|
|
res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.OPERATION).build()); |
|
|
res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.OPERATION).build()); |
|
|
//7.绩效 |
|
|
//7.绩效 |
|
|
res.add(statusHandler.generatePerformanceStatus(project)); |
|
|
|
|
|
|
|
|
res.add(new ProtraitProjectStatusSituationVO()); |
|
|
//8.注销(todo: 还没有注销功能) |
|
|
//8.注销(todo: 还没有注销功能) |
|
|
res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.LOG_OFF).build()); |
|
|
res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.LOG_OFF).build()); |
|
|
|
|
|
|
|
|
|
|
|
CompletableFuture.allOf( |
|
|
|
|
|
CompletableFuture.runAsync(() -> { |
|
|
|
|
|
res.set(0,statusHandler.generateApproveStatus(project,DashboardConstant.Protrait.PLAN,InstTypeEnum.UNIT_INNER_AUDIT.getCode())); |
|
|
|
|
|
}, ForkJoinPool.commonPool()), |
|
|
|
|
|
CompletableFuture.runAsync(() -> { |
|
|
|
|
|
res.set(1,statusHandler.generateApproveStatus(project,DashboardConstant.Protrait.DECLARED,InstTypeEnum.PRELIMINARY_PREVIEW.getCode())); |
|
|
|
|
|
}, ForkJoinPool.commonPool()), |
|
|
|
|
|
CompletableFuture.runAsync(() -> { |
|
|
|
|
|
res.set(2,statusHandler.generateApproveStatus(project,DashboardConstant.Protrait.APPROVE,InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode())); |
|
|
|
|
|
}, ForkJoinPool.commonPool()), |
|
|
|
|
|
CompletableFuture.runAsync(() -> { |
|
|
|
|
|
res.set(3,statusHandler.generateStatus(project,DashboardConstant.Protrait.CONSTRUCTION, |
|
|
|
|
|
ProjectStatusEnum.UNDER_CONSTRUCTION.getCode(),ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode())); |
|
|
|
|
|
}, ForkJoinPool.commonPool()), |
|
|
|
|
|
CompletableFuture.runAsync(() -> { |
|
|
|
|
|
res.set(4,statusHandler.generateApproveStatus(project,DashboardConstant.Protrait.ACCEPT,InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode())); |
|
|
|
|
|
}, ForkJoinPool.commonPool()), |
|
|
|
|
|
CompletableFuture.runAsync(() -> { |
|
|
|
|
|
res.set(6, statusHandler.generatePerformanceStatus(project)); |
|
|
|
|
|
}, ForkJoinPool.commonPool()) |
|
|
|
|
|
).join(); |
|
|
return res; |
|
|
return res; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |