diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/DashboardConstant.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/DashboardConstant.java index 8db4f5a..9c0a083 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/DashboardConstant.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/DashboardConstant.java @@ -22,7 +22,7 @@ public class DashboardConstant { public static final String PROJECT_SIGNS = "项目体征"; public static final String FEILD_SAFETYMONEY = "safetyInputAmount"; - public static final String ZREO_PERCEN = "0%"; + public static final String ZREO_PERCEN = "0"; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardProjectManage.java index 108dffd..899fc86 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardProjectManage.java @@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; import com.ningdatech.basic.util.StrPool; +import com.ningdatech.pmapi.common.constant.BizConst; import com.ningdatech.pmapi.dashboard.constant.ChartTypeEnum; import com.ningdatech.pmapi.dashboard.constant.DashboardConstant; import com.ningdatech.pmapi.dashboard.handle.ApplicationHandler; @@ -19,6 +20,12 @@ import com.ningdatech.pmapi.dashboard.model.basic.CompanyProjectCntBO; import com.ningdatech.pmapi.dashboard.model.basic.ProjectATIISBO; import com.ningdatech.pmapi.dashboard.model.po.QueryYearPO; import com.ningdatech.pmapi.dashboard.model.vo.*; +import com.ningdatech.pmapi.gov.model.entity.GovBizProjectApply; +import com.ningdatech.pmapi.gov.model.entity.GovBizProjectBaseinfo; +import com.ningdatech.pmapi.gov.model.entity.GovOperationProjectBaseinfo; +import com.ningdatech.pmapi.gov.service.IGovBizProjectApplyService; +import com.ningdatech.pmapi.gov.service.IGovBizProjectBaseinfoService; +import com.ningdatech.pmapi.gov.service.IGovOperationProjectBaseinfoService; import com.ningdatech.pmapi.portrait.service.IProjectTagService; import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase; import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService; @@ -52,6 +59,13 @@ import java.util.stream.Collectors; public class DashboardProjectManage { private final IProjectService iProjectService; + + private final IGovBizProjectBaseinfoService baseinfoService; + + private final IGovBizProjectApplyService applyService; + + + private final IGovOperationProjectBaseinfoService operationBaseService; private final INdProjectDelayApplyService iProjectDelayApplyService; private final DashboardHelper dashboardHelper; private final IPurchaseService iPurchaseService; @@ -346,18 +360,73 @@ public class DashboardProjectManage { //1.先查询项目 Project project = iProjectService.getProjectByCode(projectCode); - if(Objects.isNull(project)){ + GovBizProjectBaseinfo baseInfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjId, projectCode) + .last(BizConst.LIMIT_1)); + + GovOperationProjectBaseinfo operationBase = operationBaseService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) + .eq(GovOperationProjectBaseinfo::getBaseProjId, projectCode) + .last(BizConst.LIMIT_1)); + + GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjId, projectCode) + .last(BizConst.LIMIT_1)); + + if(Objects.isNull(project) && Objects.isNull(baseInfo) && Objects.isNull(operationBase)){ return res; } //2.转换项目信息 - ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(project,ProtraitProjectInfoVO.class); - //todo: 超期逻辑 - projectInfo.setOverdueSituation("即将超期"); - projectInfo.setSafetyInputRate(convertSafetyInputRate(project)); - //3.项目状态情况 - projectInfo.setStatusSituation(generateProjectStatus(project)); - res.setProjectInfo(projectInfo); + if(Objects.nonNull(project)){ + ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(project,ProtraitProjectInfoVO.class); + //todo: 超期逻辑 + projectInfo.setOverdueSituation("即将超期"); + projectInfo.setSafetyInputRate(convertSafetyInputRate(project)); + //3.项目状态情况 + projectInfo.setStatusSituation(generateProjectStatus(project)); + res.setProjectInfo(projectInfo); + }else if(Objects.nonNull(baseInfo)){ + ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(baseInfo,ProtraitProjectInfoVO.class); + //todo: 超期逻辑 + projectInfo.setOverdueSituation("即将超期"); + projectInfo.setSafetyInputRate("0"); + if(Objects.nonNull(apply)){ + try{ + projectInfo.setProjectYear(Integer.valueOf(apply.getBaseProjSetYear())); + }catch (Exception e){ + } + projectInfo.setProjectIntroduction(apply.getBaseProjIntro()); + projectInfo.setBuildCycle(apply.getBaseProjDuration()); + } + projectInfo.setProjectCode(projectCode); + projectInfo.setProjectName(baseInfo.getBaseProjName()); + projectInfo.setBuildOrgName(baseInfo.getBaseBuildDeprt()); + projectInfo.setBuildOrgCode(baseInfo.getBaseBuildDeprtDing()); + //3.项目状态情况 + projectInfo.setStatusSituation(generateProjectStatus(baseInfo)); + res.setProjectInfo(projectInfo); + }else if(Objects.nonNull(operationBase)){ + ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(operationBase,ProtraitProjectInfoVO.class); + //todo: 超期逻辑 + projectInfo.setOverdueSituation("即将超期"); + projectInfo.setSafetyInputRate("0"); + if(Objects.nonNull(apply)){ + try{ + projectInfo.setProjectYear(Integer.valueOf(apply.getBaseProjSetYear())); + }catch (Exception e){ + } + projectInfo.setProjectIntroduction(apply.getBaseProjIntro()); + projectInfo.setBuildCycle(apply.getBaseProjDuration()); + } + projectInfo.setProjectCode(projectCode); + projectInfo.setProjectName(operationBase.getBaseProjName()); + projectInfo.setBuildOrgName(operationBase.getBaseBuildDeprt()); + projectInfo.setBuildOrgCode(operationBase.getBaseBuildDeprtDing()); + //3.项目状态情况 + projectInfo.setStatusSituation(generateProjectStatus(operationBase)); + res.setProjectInfo(projectInfo); + } + //4.查询项目特征 res.setProjectFeatures(projectTagService.getProjectTas(projectCode)); @@ -394,7 +463,7 @@ public class DashboardProjectManage { BigDecimal rate = BigDecimal.valueOf(totalAmount).multiply(BigDecimal.valueOf(100)) .divide(declareAmount,BigDecimal.ROUND_CEILING, RoundingMode.HALF_UP) .stripTrailingZeros(); - return rate.toPlainString() + StrPool.PERCENT; + return rate.toPlainString(); } return DashboardConstant.Protrait.ZREO_PERCEN; } @@ -446,4 +515,48 @@ public class DashboardProjectManage { ).join(); return res; } + + private List generateProjectStatus(GovBizProjectBaseinfo baseinfo) { + final List res = Lists.newArrayList(); + //1.计划(单位内部审核) + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.PLAN,null)); + //2.申报(项目预审) + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.DECLARED,null)); + //3.审批(建设方案审批) + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.APPROVE,null)); + //4.建设(立项后的建设中) + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.CONSTRUCTION,null)); + //5.验收(终验) + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.ACCEPT, + Objects.nonNull(baseinfo.getBaseProjSetProg()) && "07".equals(baseinfo.getBaseProjSetProg()) ? baseinfo.getTongTime() : null)); + //6.运维(todo: 运维时间还没有) + res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.OPERATION).build()); + //7.绩效 + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.ACCEPT,null)); + //8.注销(todo: 还没有注销功能) + res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.LOG_OFF).build()); + return res; + } + + private List generateProjectStatus(GovOperationProjectBaseinfo baseinfo) { + final List res = Lists.newArrayList(); + //1.计划(单位内部审核) + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.PLAN,null)); + //2.申报(项目预审) + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.DECLARED,null)); + //3.审批(建设方案审批) + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.APPROVE,null)); + //4.建设(立项后的建设中) + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.CONSTRUCTION,null)); + //5.验收(终验) + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.ACCEPT, + Objects.nonNull(baseinfo.getBaseProjSetProg()) && "07".equals(baseinfo.getBaseProjSetProg()) ? baseinfo.getTongTime() : null)); + //6.运维(todo: 运维时间还没有) + res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.OPERATION).build()); + //7.绩效 + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.ACCEPT,null)); + //8.注销(todo: 还没有注销功能) + res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.LOG_OFF).build()); + return res; + } }