diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionConst.java index 2d28d0e..87854aa 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionConst.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionConst.java @@ -1,5 +1,9 @@ package com.ningdatech.pmapi.common.constant; +import com.google.common.collect.Lists; + +import java.util.List; + /** *

* RegionConst @@ -44,6 +48,24 @@ public interface RegionConst { String RC_ZJ = "330000"; String NINE_CODE_LAST = "000"; + //莲都 + String LD = "331102"; + //青田 + String QT = "331121"; + //缙云 + String JY = "331122"; + //遂昌 + String SC = "331123"; + //松阳 + String SY = "331124"; + //云和 + String YH = "331125"; + //庆元 + String QY = "331126"; + String QN = "331127"; + String LQ = "331181"; + + List LS_ARR = Lists.newArrayList(RC_LS,LS_KF,LD,QT,JY,SC,SY,YH,QY,QN,LQ); //----------------------------------------地区父级ID(缩写PID)--------------------------------------------------------- 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 6398e2f..dbcbf21 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 @@ -396,6 +396,7 @@ public class DashboardProjectManage { } projectInfo.setProjectIntroduction(apply.getBaseProjIntro()); projectInfo.setBuildCycle(apply.getBaseProjDuration()); + projectInfo.setApprovalAmount(apply.getBaseProjTotalAmount()); } projectInfo.setProjectCode(projectCode); projectInfo.setProjectName(baseInfo.getBaseProjName()); @@ -416,6 +417,7 @@ public class DashboardProjectManage { } projectInfo.setProjectIntroduction(apply.getBaseProjIntro()); projectInfo.setBuildCycle(apply.getBaseProjDuration()); + projectInfo.setApprovalAmount(apply.getBaseProjTotalAmount()); } projectInfo.setProjectCode(projectCode); projectInfo.setProjectName(operationBase.getBaseProjName()); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/entity/CockpitStats.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/entity/CockpitStats.java index 2b8f96e..432cbee 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/entity/CockpitStats.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/entity/CockpitStats.java @@ -101,27 +101,33 @@ public class CockpitStats implements Serializable { @ApiModelProperty("专家-总人数") private Integer expertTotalNum = 0; - @ApiModelProperty("专家-方案合理性") + @ApiModelProperty("专家-总人数-包含这些标签的专家总人数") + private Integer specialExpertNum = 0; + + @ApiModelProperty("专家-方案合理性-擅长") private Integer expertPlanRationalityNum = 0; - @ApiModelProperty("专家-计数可行性评估") + @ApiModelProperty("专家-计数可行性评估-擅长") private Integer expertTechnicalFeasibilityAssessmentNum = 0; - @ApiModelProperty("专家-信创") + @ApiModelProperty("专家-信创-擅长") private Integer expertXinchuangNum = 0; - @ApiModelProperty("专家-软硬件核价") + @ApiModelProperty("专家-软硬件核价-擅长") private Integer expertSoftHardPricingNum = 0; - @ApiModelProperty("专家-党政信息") + @ApiModelProperty("专家-党政信息-擅长") private Integer expertPartyGovInfoNum = 0; - @ApiModelProperty("专家-网络安全") + @ApiModelProperty("专家-网络安全-擅长") private Integer expertNetworkSecurityNum = 0; @ApiModelProperty("专家-信息化专家") private Integer expertPromotionInfoTechnologyNum = 0; + @ApiModelProperty("专家-信创专家") + private Integer expertXinchuangOtherNum = 0; + @ApiModelProperty("专家-财务专家") private Integer expertFinancialNum = 0; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/CockpitStatsVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/CockpitStatsVO.java index 342900c..4713fbe 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/CockpitStatsVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/CockpitStatsVO.java @@ -150,6 +150,9 @@ public class CockpitStatsVO implements Serializable { @ApiModelProperty("专家-总人数") private Integer expertTotalNum; + @ApiModelProperty("专家-总人数-包含这些标签的专家总人数") + private Integer specialExpertNum; + @ApiModelProperty("专家-方案合理性 数量") private Integer expertPlanRationalityNum; @@ -173,6 +176,9 @@ public class CockpitStatsVO implements Serializable { @ApiModelProperty("专家-财务专家 数量") private Integer expertFinancialNum; + + @ApiModelProperty("专家-信创专家 数量") + private Integer expertXinchuangOtherNum; } @Data diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/ProtraitProjectInfoVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/ProtraitProjectInfoVO.java index e0b2234..d9e0c20 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/ProtraitProjectInfoVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/ProtraitProjectInfoVO.java @@ -54,5 +54,8 @@ public class ProtraitProjectInfoVO { @ApiModelProperty("项目状态情况") private List statusSituation; + + @ApiModelProperty("系统定位") + private String systemPosition; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java index 16d47e8..2236e8a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java @@ -15,6 +15,7 @@ import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.StrPool; +import com.ningdatech.file.service.FileService; import com.ningdatech.pmapi.common.constant.BizConst; import com.ningdatech.pmapi.common.constant.RegionConst; import com.ningdatech.pmapi.common.helper.RegionCacheHelper; @@ -58,6 +59,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.util.IOUtils; import org.flowable.engine.HistoryService; import org.flowable.engine.RuntimeService; import org.springframework.beans.factory.annotation.Autowired; @@ -70,10 +72,8 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.client.RestTemplate; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; + +import java.io.*; import java.lang.reflect.Field; import java.time.LocalDate; import java.time.LocalDateTime; @@ -121,6 +121,8 @@ public class GovProjectCollectionManage { private final ThreadPoolTaskScheduler threadPoolTaskScheduler; + private final FileService fileService; + @Value("${project.push-url}") private String pushUrl; @@ -1695,7 +1697,9 @@ public class GovProjectCollectionManage { StringJoiner sj = convertAndUpload(procure.getBiddingFile()); saveProcure.setBiddingFilePdf(sj.toString()); } - if(checkFieldNotPdf(procure.getPurchaseContract(),o,"purchaseContract")){ + Boolean purchaseContract = checkFieldNotPdf(procure.getPurchaseContract(), o, "purchaseContract"); + log.info("是否转换 采购合同 purchaseContract:{}",purchaseContract); + if(purchaseContract){ StringJoiner sj = convertAndUpload(procure.getPurchaseContract()); saveProcure.setPurchaseContractPdf(sj.toString()); } @@ -1710,9 +1714,25 @@ public class GovProjectCollectionManage { JSONArray fileArray = JSON.parseArray(bpb); fileArray.forEach(j -> { JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(j)); - byte[] btyes = wpsConvertManage.downloadToPdfStream(jsonObject.getLong("id")); String suffix = jsonObject.getString("suffix"); + //如果已经是PDF 就不用转换了 + byte[] btyes = null; String originalFileName = jsonObject.getString("originalFileName"); + if(StringUtils.isNotBlank(suffix) && suffix.equals("pdf")){ + com.ningdatech.file.entity.File file = fileService.getById(jsonObject.getLong("id")); + if(Objects.isNull(file)){ + throw new RuntimeException("转换PDF文件失败:" + originalFileName); + } + InputStream inputStream = fileService.getFileInputStream(file); + try { + btyes = IOUtils.toByteArray(inputStream); + } catch (IOException e) { + throw new RuntimeException("转换PDF文件失败:" + originalFileName,e); + } + }else{ + btyes = wpsConvertManage.downloadToPdfStream(jsonObject.getLong("id")); + } + if(!BizConst.DEV.equals(active)){ originalFileName = originalFileName.replace(StrPool.DOT + suffix, ".pdf"); } @@ -1787,69 +1807,156 @@ public class GovProjectCollectionManage { if(CollUtil.isEmpty(baseProjIds)){ throw new BizException("项目编号不能为空"); } + Integer successNum = 0; for(String baseProjId : baseProjIds){ + //两种情况 + //1.项目归集 GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) .eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId) .orderByDesc(GovBizProjectBaseinfo::getTongTime) .last(BizConst.LIMIT_1)); - GovBizProjectApply apply = projectApplyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjId, baseProjId) - .orderByDesc(GovBizProjectApply::getTongTime) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(baseinfo)){ - System.out.println("项目不存在 直接下一个"); - continue; + if(Objects.nonNull(baseinfo)){ + rebuildGuiji(baseProjId); + successNum ++; } - GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); - saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class)); - saveDTO.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfoDTO.class)); - String newProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); - - baseinfo.setBaseProjId(newProjId); - baseinfoService.updateById(baseinfo); - apply.setBaseProjId(newProjId); - projectApplyService.updateById(apply); - GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaUpdate(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getBaseProjId, baseProjId) - .orderByDesc(GovBizProjectApprove::getTongTime) + //2.运维备案 + GovOperationProjectBaseinfo operation = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) + .eq(GovOperationProjectBaseinfo::getBaseProjId, baseProjId) + .orderByDesc(GovOperationProjectBaseinfo::getTongTime) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(approve)){ - approve.setBaseProjId(newProjId); - approveService.updateById(approve); + if(Objects.nonNull(operation)){ + rebuildOperation(baseProjId); + successNum ++; } + } + return "运行成功 重新生成" + successNum + "个项目编号"; + } + + private void rebuildGuiji(String baseProjId) { + GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectBaseinfo::getTongTime) + .last(BizConst.LIMIT_1)); + GovBizProjectApply apply = projectApplyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectApply::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(baseinfo)){ + System.out.println("项目不存在 直接下一个"); + return; + } + GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); + saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class)); + saveDTO.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfoDTO.class)); + String newProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); + baseinfo.setBaseProjId(newProjId); + baseinfoService.updateById(baseinfo); + apply.setBaseProjId(newProjId); + projectApplyService.updateById(apply); - GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) - .eq(GovBizProjectCimplement::getBaseProjId, baseProjId) - .orderByDesc(GovBizProjectCimplement::getTongTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(cimplement)){ - cimplement.setBaseProjId(newProjId); - cimplement.setBaseBidCode(newProjId); - cimplementService.updateById(cimplement); - } + GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaUpdate(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectApprove::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(approve)){ + approve.setBaseProjId(newProjId); + approveService.updateById(approve); + } - GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) - .eq(GovBizProjectMimplement::getBaseProjId, baseProjId) - .orderByDesc(GovBizProjectMimplement::getTongTime) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(mimplement)){ - mimplement.setBaseProjId(newProjId); - mimplement.setBaseBidCode(newProjId); - mimplementService.updateById(mimplement); - } - List procures = procureService.list(Wrappers.lambdaUpdate(GovBizProjectProcure.class) - .eq(GovBizProjectProcure::getBaseProjId, baseProjId)); + GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) + .eq(GovBizProjectCimplement::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectCimplement::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(cimplement)){ + cimplement.setBaseProjId(newProjId); + cimplement.setBaseBidCode(newProjId); + cimplementService.updateById(cimplement); + } - for(GovBizProjectProcure procure : procures){ - procure.setBaseProjId(newProjId); - procure.setBaseBidCode(newProjId + "-" + procure.getBaseBidCode().split("-")[1]); - procureService.updateById(procure); - } + GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) + .eq(GovBizProjectMimplement::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectMimplement::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(mimplement)){ + mimplement.setBaseProjId(newProjId); + mimplement.setBaseBidCode(newProjId); + mimplementService.updateById(mimplement); + } + + List procures = procureService.list(Wrappers.lambdaUpdate(GovBizProjectProcure.class) + .eq(GovBizProjectProcure::getBaseProjId, baseProjId)); + + for(GovBizProjectProcure procure : procures){ + procure.setBaseProjId(newProjId); + procure.setBaseBidCode(newProjId + "-" + procure.getBaseBidCode().split("-")[1]); + procureService.updateById(procure); + } + } + + private void rebuildOperation(String baseProjId) { + GovOperationProjectBaseinfo operationBase = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) + .eq(GovOperationProjectBaseinfo::getBaseProjId, baseProjId) + .orderByDesc(GovOperationProjectBaseinfo::getTongTime) + .last(BizConst.LIMIT_1)); + GovBizProjectApply apply = projectApplyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectApply::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(operationBase)){ + System.out.println("运维备案项目不存在 直接下一个"); + return; + } + GovOperationProjectSaveDTO saveDTO = new GovOperationProjectSaveDTO(); + saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class)); + saveDTO.setBaseinfo(BeanUtil.copyProperties(operationBase, GovOperationProjectBaseinfoDTO.class)); + String newProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); + + operationBase.setBaseProjId(newProjId); + operationProjectBaseinfoService.updateById(operationBase); + apply.setBaseProjId(newProjId); + projectApplyService.updateById(apply); + + GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaUpdate(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectApprove::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(approve)){ + approve.setBaseProjId(newProjId); + approveService.updateById(approve); + } + + + GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) + .eq(GovBizProjectCimplement::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectCimplement::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(cimplement)){ + cimplement.setBaseProjId(newProjId); + cimplement.setBaseBidCode(newProjId); + cimplementService.updateById(cimplement); + } + + GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) + .eq(GovBizProjectMimplement::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectMimplement::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(mimplement)){ + mimplement.setBaseProjId(newProjId); + mimplement.setBaseBidCode(newProjId); + mimplementService.updateById(mimplement); + } + + List procures = procureService.list(Wrappers.lambdaUpdate(GovBizProjectProcure.class) + .eq(GovBizProjectProcure::getBaseProjId, baseProjId)); + + for(GovBizProjectProcure procure : procures){ + procure.setBaseProjId(newProjId); + procure.setBaseBidCode(newProjId + "-" + procure.getBaseBidCode().split("-")[1]); + procureService.updateById(procure); } - return "运行成功 重新生成" + baseProjIds.size() + "个项目编号"; } public String removeProject(List projectCodes) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectBaseinfoDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectBaseinfoDTO.java index 61f9d61..78f8829 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectBaseinfoDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectBaseinfoDTO.java @@ -91,6 +91,9 @@ public class GovBizProjectBaseinfoDTO implements Serializable { @ApiModelProperty("数据来源") private String areaCode; + @ApiModelProperty("系统定位") + private String systemPosition; + @ApiModelProperty("生产时间") private LocalDateTime bizTime; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovOperationProjectBaseinfoDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovOperationProjectBaseinfoDTO.java index e2b7bf4..01fa14d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovOperationProjectBaseinfoDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovOperationProjectBaseinfoDTO.java @@ -93,6 +93,9 @@ public class GovOperationProjectBaseinfoDTO implements Serializable { @ApiModelProperty("数据来源") private String areaCode; + @ApiModelProperty("系统定位") + private String systemPosition; + @ApiModelProperty("生产时间") private LocalDateTime bizTime; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectBaseinfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectBaseinfo.java index d3a0ec1..28b4172 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectBaseinfo.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectBaseinfo.java @@ -111,6 +111,9 @@ public class GovBizProjectBaseinfo implements Serializable { @ApiModelProperty("逻辑删除") private Boolean deleted; + @ApiModelProperty("系统定位") + private String systemPosition; + @ApiModelProperty("最后修改时间") private LocalDateTime updateOn; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovOperationProjectBaseinfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovOperationProjectBaseinfo.java index f82f5a0..b29057b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovOperationProjectBaseinfo.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovOperationProjectBaseinfo.java @@ -113,6 +113,9 @@ public class GovOperationProjectBaseinfo implements Serializable { @ApiModelProperty("逻辑删除") private Boolean deleted; + @ApiModelProperty("系统定位") + private String systemPosition; + @ApiModelProperty("最后修改时间") private LocalDateTime updateOn; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectBaseinfoVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectBaseinfoVO.java index 2132e55..3acbdcd 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectBaseinfoVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectBaseinfoVO.java @@ -93,6 +93,9 @@ public class GovBizProjectBaseinfoVO implements Serializable { @ApiModelProperty("数据来源") private String areaCode; + @ApiModelProperty("系统定位") + private String systemPosition; + @ApiModelProperty("生产时间") private LocalDateTime bizTime; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovOperationProjectBaseinfoVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovOperationProjectBaseinfoVO.java index 18e8f3e..c8b99d2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovOperationProjectBaseinfoVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovOperationProjectBaseinfoVO.java @@ -96,6 +96,9 @@ public class GovOperationProjectBaseinfoVO implements Serializable { @ApiModelProperty("数据来源") private String areaCode; + @ApiModelProperty("系统定位") + private String systemPosition; + @ApiModelProperty("生产时间") private LocalDateTime bizTime; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/utils/ProjectConvertUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/utils/ProjectConvertUtil.java new file mode 100644 index 0000000..8f518fa --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/utils/ProjectConvertUtil.java @@ -0,0 +1,34 @@ +package com.ningdatech.pmapi.gov.utils; + +import com.ningdatech.pmapi.gov.model.vo.GovBizProjectDetailVO; +import com.ningdatech.pmapi.projectlib.model.entity.Project; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.Objects; + +/** + * @Classname ProjectCollectionUtil + * @Description + * @Date 2023/9/14 9:07 + * @Author PoffyZhang + */ +public class ProjectConvertUtil { + + /** + * 申报项目 转为 项目归集 + * @param project + * @return + */ + public static GovBizProjectDetailVO declaredToCollection(Project project){ + GovBizProjectDetailVO projectCollection = new GovBizProjectDetailVO(); + if(Objects.isNull(project)){ + return projectCollection; + } + String projectCode = project.getProjectCode(); + String projectName = project.getProjectName(); + projectCollection.setBaseProjId(projectCode); + return projectCollection; + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectDraft.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectDraft.java index b3c0a9b..8fdde15 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectDraft.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectDraft.java @@ -358,4 +358,7 @@ public class ProjectDraft implements Serializable { @ApiModelProperty("是否推送省里") private Boolean push; + + @ApiModelProperty("系统定位") + private String systemPosition; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDraftVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDraftVO.java index 422107b..9b1b712 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDraftVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDraftVO.java @@ -361,4 +361,7 @@ public class ProjectDraftVO implements Serializable { @ApiModelProperty("是否推送省里") private Boolean push; + + @ApiModelProperty("系统定位") + private String systemPosition; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index 2df0300..34f3854 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -297,9 +297,8 @@ public class ProjectLibManage { } UserFullInfoDTO finalUser = user; - Set projectCodes = page.getRecords().stream() - .map(Project::getProjectCode).collect(Collectors.toSet()); Set instCodes = page.getRecords().stream() + .filter(p -> StringUtils.isNotBlank(p.getInstCode())) .map(Project::getInstCode).collect(Collectors.toSet()); List tasks = taskService.createTaskQuery() .processInstanceIdIn(instCodes) @@ -542,6 +541,66 @@ public class ProjectLibManage { return PageVo.of(records, page.getTotal()); } + public PageVo listWithPermissionWorkbentch(ProjectListReq req, + UserFullInfoDTO user) { + req = buildProjectLibPermission(req,user); + Page page = projectService.pagelibWithPermission(req.page(), req); + long total; + if (CollUtil.isEmpty(page.getRecords())) { + return PageVo.empty(); + } + UserFullInfoDTO finalUser = user; + + Set instCodes = page.getRecords().stream() + .filter(p -> StringUtils.isNotBlank(p.getInstCode())) + .map(ProjectPO::getInstCode).collect(Collectors.toSet()); + List tasks = taskService.createTaskQuery() + .processInstanceIdIn(instCodes) + .orderByTaskCreateTime() + .asc() + .list(); + Map> map = Maps.newHashMap(); + Map userMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(tasks)){ + map = tasks.stream() + .collect(Collectors.groupingBy(Task::getProcessInstanceId)); + userMap = searchUser(tasks,userInfoHelper); + } + + List records = Lists.newArrayList(); + for(ProjectPO w : page.getRecords()){ + ProjectLibListItemVO item = new ProjectLibListItemVO(); + item.setId(w.getId()); + item.setProjectName(w.getProjectName()); + item.setProjectCode(w.getProjectCode()); + item.setArea(w.getArea()); + item.setAreaCode(w.getAreaCode()); + item.setCreateOn(w.getCreateOn()); + item.setDeclaredAmount(w.getDeclareAmount()); + item.setStage(w.getStage()); + item.setStatus(w.getStatus()); + item.setProjectType(w.getProjectType()); + item.setProjectYear(w.getProjectYear()); + item.setBuildOrg(w.getBuildOrgName()); + item.setBizDomain(w.getBizDomain()); + item.setProcessStatus(w.getProcessStatus()); + item.setInstCode(w.getInstCode()); + item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); + item.setApproveUsers(buildApproveUsers(w.getInstCode(),map,userMap)); + if (finalUser.getIsOrgAdmin() && + ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) + && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) + && w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) { + item.setCanPreDeclared(Boolean.TRUE); + } + item.setApprovedAmount(w.getApprovalAmount()); + item.setAnnualPlanAmount(w.getAnnualPlanAmount()); + item.setPrePlanProjectId(w.getPrePlanProjectId()); + records.add(item); + } + return PageVo.of(records, page.getTotal()); + } + public static BigDecimal computeAmount(BigDecimal cuurentAmount,List prfs) { BigDecimal res = Objects.isNull(cuurentAmount) ? BigDecimal.ZERO : cuurentAmount; for(ProjectRenewalFundDeclaration prf : prfs){ diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java index dd1ce2c..7232413 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java @@ -381,7 +381,7 @@ public class ProjectRenewalFundManage { } //判断金额 - checkPaymentAmount(projectCode,projectYear,dto.getAnnualPaymentAmount()); +// checkPaymentAmount(projectCode,projectYear,dto.getAnnualPaymentAmount()); declaration.setApprovalStatus(ProjectRenewalApprovalStatusEnum.PENDING.name()); if(Objects.nonNull(project)){ diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java index 9e424a4..5160dae 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java @@ -370,4 +370,7 @@ public class ProjectDTO implements Serializable { @ApiModelProperty("是否推送省里") private Boolean push; + + @ApiModelProperty("系统定位") + private String systemPosition; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java index f03d0fa..34a2076 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java @@ -567,4 +567,7 @@ public class Project implements Serializable { @ApiModelProperty("是否推送省里") private Boolean push; + + @ApiModelProperty("系统定位") + private String systemPosition; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java index fcdc5da..32ea859 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java @@ -549,4 +549,7 @@ public class ProjectDetailVO { @ApiModelProperty("是否推送省里") private Boolean push; + + @ApiModelProperty("系统定位") + private String systemPosition; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/EarlyWarningListener.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/EarlyWarningListener.java index 24ea2fd..1e3bde8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/EarlyWarningListener.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/EarlyWarningListener.java @@ -58,6 +58,7 @@ public class EarlyWarningListener { String noticeMethod = event.getNoticeMethod(); String noticeContent = event.getNoticeContent(); Integer noticeType = event.getNoticeType(); + Integer overTimeout = event.getOverTimeout(); //1.根据nodeId 查询到 node 去查找 未完成 项目实例关系表 找到实例 List hais = historyService.createHistoricActivityInstanceQuery() @@ -122,7 +123,7 @@ public class EarlyWarningListener { String taskId = hai.getTaskId(); String path = "toDoCenter/handleDuringExamine?instanceId=" + instanceId + "&projectId=" + projectId + "&nodeId=" + nodeId + "&taskId=" + taskId; - earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,timeout,pi.getInstType(), + earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,timeout,overTimeout, pi.getInstType(), hai.getStartTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime() ,employeeCode,project,WarningRuleTypeEnum.PROCESS_WARNING.getCode(),noticeType, path,batchEmployees,nodeId); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java index 28b1eb1..1b6f69e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CockpitStatsStatisticsTask.java @@ -21,6 +21,9 @@ import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; import com.ningdatech.pmapi.gov.enumeration.GovProjectStatusEnum; import com.ningdatech.pmapi.gov.model.entity.*; import com.ningdatech.pmapi.gov.service.*; +import com.ningdatech.pmapi.meta.model.entity.ExpertTag; +import com.ningdatech.pmapi.meta.service.IExpertTagService; +import com.ningdatech.pmapi.meta.service.IMetaTagService; import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject; import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectService; import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; @@ -102,13 +105,14 @@ public class CockpitStatsStatisticsTask { private IGovBizProjectCimplementService cimplementService; @Autowired - private IGovOperationProjectBaseinfoService operationBaseInfoService; - - @Autowired private IEarlyWarningRecordsService earlyWarningRecordsService; private List years = Lists.newArrayList(2021,2022,2023,2024,2025); + private final IMetaTagService metaTagService; + + private final IExpertTagService expertTagService; + /** * 定义统计 驾驶舱数据 每天3点开始执行一次 * @@ -363,18 +367,84 @@ public class CockpitStatsStatisticsTask { } //2.专家统计 + List lsRegionCodes = RegionConst.LS_ARR; List experts = expertUserFullInfoService.list(Wrappers.lambdaQuery(ExpertUserFullInfo.class) .eq(StringUtils.isNotBlank(regionCode) && !DashboardConstant.CockpitStats.TOTAL.equals(regionCode), - ExpertUserFullInfo::getRegionCode, regionCode)); + ExpertUserFullInfo::getRegionCode, regionCode) + .in(StringUtils.isBlank(regionCode) || DashboardConstant.CockpitStats.TOTAL.equals(regionCode), + ExpertUserFullInfo::getRegionCode,lsRegionCodes) + .eq(ExpertUserFullInfo::getExpertAccountStatus,"available")); + + List goodAt = expertTagService.list(Wrappers.lambdaQuery(ExpertTag.class)); + Map> tagMap = goodAt.stream() + .collect(Collectors.groupingBy(ExpertTag::getUserId)); + + String networkCode = "1030000"; + String xinchuangCode = "2040000"; + String fanganCode = "2030000"; + String jishuCode = "2010000"; + String dangzhengCode = "1020000"; + String ruanyingCode = "2020000"; + String caiwuCode = "5600000"; + List specialTags = Lists.newArrayList(networkCode,xinchuangCode,fanganCode,jishuCode, + dangzhengCode,ruanyingCode,caiwuCode); + cockpitStats.setExpertTotalNum(experts.size()); - cockpitStats.setExpertFinancialNum(0); - cockpitStats.setExpertNetworkSecurityNum(0); - cockpitStats.setExpertXinchuangNum(0); - cockpitStats.setExpertPlanRationalityNum(0); - cockpitStats.setExpertPromotionInfoTechnologyNum(0); - cockpitStats.setExpertPartyGovInfoNum(0); - cockpitStats.setExpertSoftHardPricingNum(0); - cockpitStats.setExpertTechnicalFeasibilityAssessmentNum(0); + Integer financialNum = 0; + Integer networkSecurityNum = 0; + Integer xinchuangNum = 0; + Integer planRationalityNum = 0; + Integer promotionInfoTechnologyNum = 0; + Integer partyGovInfoNum = 0; + Integer softHardPricingNum = 0; + Integer technicalFeasibilityAssessmentNum = 0; + Integer specialExpertNum = 0; + for(ExpertUserFullInfo e : experts){ + if(tagMap.containsKey(e.getUserId())){ + List expertTags = tagMap.get(e.getUserId()); + Boolean isContain = Boolean.FALSE; + for(ExpertTag expertTag : expertTags){ + if(expertTag.getTagCode().equals(networkCode)){ + networkSecurityNum++; + } + if(expertTag.getTagCode().equals(caiwuCode)){ + financialNum ++; + } + if(expertTag.getTagCode().equals(xinchuangCode)){ + xinchuangNum ++; + } + if(expertTag.getTagCode().equals(fanganCode)){ + planRationalityNum++; + } + if(expertTag.getTagCode().equals(jishuCode)){ + technicalFeasibilityAssessmentNum ++; + } + if(expertTag.getTagCode().equals(dangzhengCode)){ + partyGovInfoNum ++; + } + if(expertTag.getTagCode().equals(ruanyingCode)){ + softHardPricingNum ++; + } + if(specialTags.contains(expertTag.getTagCode())){ + isContain = Boolean.TRUE; + } + } + if(isContain){ + specialExpertNum ++; + } + } + } + //财务专家 + cockpitStats.setExpertFinancialNum(financialNum); + //网络安全 + cockpitStats.setExpertNetworkSecurityNum(networkSecurityNum); + cockpitStats.setExpertXinchuangNum(xinchuangNum); + cockpitStats.setExpertPlanRationalityNum(planRationalityNum); + cockpitStats.setExpertPromotionInfoTechnologyNum(promotionInfoTechnologyNum); + cockpitStats.setExpertPartyGovInfoNum(partyGovInfoNum); + cockpitStats.setExpertSoftHardPricingNum(softHardPricingNum); + cockpitStats.setExpertTechnicalFeasibilityAssessmentNum(technicalFeasibilityAssessmentNum); + cockpitStats.setSpecialExpertNum(specialExpertNum); //3.顶部数据 //3.1 计划项目数(申报项目:完成年度计划的项目总数 diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java index 274310c..5a76310 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java @@ -32,14 +32,12 @@ import com.wflow.service.IEarlyWarningService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.checkerframework.checker.nullness.qual.Nullable; import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.net.InetAddress; import java.net.UnknownHostException; import java.time.*; -import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; @@ -231,9 +229,11 @@ public class EarlyWarningInstanceNotStartTask { List noticeTypes = noticeMap.get(needToWaringProject.getProjectCode()); for(Integer noticeType : noticeTypes) { for (String employeeCode : batchEmployees) { - earlyWarningManage.doEarlyWarning(noticeMethod, Objects.nonNull(noticeType) && noticeType.equals(1) ? noticeContent : adventContent, time, biz, + earlyWarningManage.doEarlyWarning(noticeMethod, Objects.nonNull(noticeType) && noticeType.equals(1) ? noticeContent : adventContent, + adventTime,time, biz, needToWaringProject.getUpdateOn(),employeeCode, needToWaringProject, - WarningRuleTypeEnum.DECLARED_WARNING.getCode(), noticeType, path, batchEmployeesStr,null); + WarningRuleTypeEnum.DECLARED_WARNING.getCode(), noticeType, path, batchEmployeesStr, + null); } } } @@ -287,6 +287,7 @@ public class EarlyWarningInstanceNotStartTask { Integer time = rJson.getInteger("time"); Integer adventTime = rJson.getInteger("adventTime"); Integer biz = rJson.getInteger("biz"); + String notice = rJson.getString("notice"); if((Objects.isNull(time) && Objects.isNull(adventTime)) || Objects.isNull(biz)){ log.info("规则数据 错误 :{}",rJson); return; @@ -379,13 +380,60 @@ public class EarlyWarningInstanceNotStartTask { for(Project needToWaringProject : needToWaringProjects){ //去预警通知 - String employeeCode = needToWaringProject.getSponsor(); + List batchEmployees = Lists.newArrayList(); + + if(StringUtils.isBlank(notice)){ + String sponsor = needToWaringProject.getSponsor(); + batchEmployees.add(sponsor); + }else{ + //去预警通知人 1.项目联系人 2.项目负责人 如果都包含 都要发 + + if(notice.contains(WarningNoticeTypeEnum.CONTACT.getCode().toString())){ + String employeeCode = null; + String username = needToWaringProject.getContactName(); + String mobile = needToWaringProject.getContactPhone(); + if(StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)){ + UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) + .eq(UserInfo::getUsername, username) + .eq(UserInfo::getMobile, mobile) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(user)){ + employeeCode = user.getEmployeeCode(); + } + if(Objects.nonNull(employeeCode)){ + batchEmployees.add(employeeCode); + } + } + } + if(notice.contains(WarningNoticeTypeEnum.RESPONSIBLE.getCode().toString())){ + String employeeCode = null; + String username = needToWaringProject.getResponsibleMan(); + String mobile = needToWaringProject.getResponsibleManMobile(); + if(StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)){ + UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) + .eq(UserInfo::getUsername, username) + .eq(UserInfo::getMobile, mobile) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(user)){ + employeeCode = user.getEmployeeCode(); + } + if(Objects.nonNull(employeeCode)){ + batchEmployees.add(employeeCode); + } + } + } + } + if(noticeMap.containsKey(needToWaringProject.getProjectCode())){ List noticeTypes = noticeMap.get(needToWaringProject.getProjectCode()); for(Integer noticeType : noticeTypes){ - earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&¬iceType.equals(1) ? noticeContent : adventContent,time,biz, - needToWaringProject.getUpdateOn(),employeeCode,needToWaringProject, - WarningRuleTypeEnum.OPERATION_WARNING.getCode(),noticeType,path,employeeCode,null); + for (String employeeCode : batchEmployees) { + earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&¬iceType.equals(1) ? noticeContent : adventContent, + adventTime,time,biz, + needToWaringProject.getUpdateOn(),employeeCode,needToWaringProject, + WarningRuleTypeEnum.OPERATION_WARNING.getCode(),noticeType,path, + batchEmployees.stream().collect(Collectors.joining(StrPool.COMMA)),null); + } } } @@ -498,7 +546,8 @@ public class EarlyWarningInstanceNotStartTask { if(noticeTypeMap.containsKey(needToWaringProject.getProjectCode())){ List noticeTypes = noticeTypeMap.get(needToWaringProject.getProjectCode()); for(Integer noticeType : noticeTypes){ - earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&¬iceType.equals(1) ? noticeContent : adventContent,time,null, + earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&¬iceType.equals(1) ? noticeContent : adventContent, + adventTime,time,null, needToWaringProject.getUpdateOn(),user.getEmployeeCode(),project, WarningRuleTypeEnum.RENEWAL_FUND.getCode(),noticeType,path,employeesStr,needToWaringProject.getId().toString()); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningProjectTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningProjectTask.java index 85676ee..f003f65 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningProjectTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningProjectTask.java @@ -3,6 +3,7 @@ package com.ningdatech.pmapi.scheduler.task; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.StopWatch; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Sets; import com.ningdatech.pmapi.common.constant.BizConst; import com.ningdatech.pmapi.projectlib.enumeration.ProjectRenewalApprovalStatusEnum; import com.ningdatech.pmapi.projectlib.enumeration.WarningFlowTypeEnum; @@ -29,7 +30,9 @@ import java.net.InetAddress; import java.net.UnknownHostException; import java.time.LocalDateTime; import java.util.List; +import java.util.Map; import java.util.Objects; +import java.util.Set; import java.util.stream.Collectors; /** @@ -74,6 +77,10 @@ public class EarlyWarningProjectTask { log.info("=========== 预警项目维度任务结束 耗时{}s", stopWatch.getTotalTimeSeconds()); return; } + + Set projectSet = Sets.newHashSet(); + Map projectMap = projects.stream().filter(p -> projectSet.add(p.getProjectCode())) + .collect(Collectors.toMap(Project::getProjectCode, p -> p)); List warnings = projectEarlyWarningService.list(); List warningProjectCodes = warnings.stream().map(ProjectEarlyWarning::getProjectCode) .collect(Collectors.toList()); @@ -105,7 +112,17 @@ public class EarlyWarningProjectTask { projectEarlyWarningService.saveBatch(toAdd); } - //2.去查询 各个报警 是否已经正常 + //2.删除 已经不存在的项目 + List toRemove = warnings.stream() + .filter(w -> !projectMap.containsKey(w.getProjectCode())) + .collect(Collectors.toList()); + if(CollUtil.isNotEmpty(toRemove)){ + List removeIds = toRemove.stream().map(ProjectEarlyWarning::getId) + .collect(Collectors.toList()); + projectEarlyWarningService.removeBatchByIds(removeIds); + } + + //3.去查询 各个报警 是否已经正常 List trueWarnings = warnings.stream().filter(w -> Objects.nonNull(w.getNormal()) && !w.getNormal()).collect(Collectors.toList()); if(CollUtil.isEmpty(trueWarnings)){ log.info("没有异常的项目 要去查询"); @@ -113,36 +130,40 @@ public class EarlyWarningProjectTask { log.info("=========== 预警项目维度任务结束 耗时{}s", stopWatch.getTotalTimeSeconds()); return; } - //2.1 预警预警 如果正常了 要改会正常 + checkNormal(trueWarnings); + + stopWatch.stop(); + log.info("=========== 预警项目维度任务结束 耗时{}s", stopWatch.getTotalTimeSeconds()); + } + + //3.去查询 各个报警 是否已经正常 + private void checkNormal(List trueWarnings) { + //3.1 预警预警 如果正常了 要改会正常 List processWarning = trueWarnings.stream().filter(w -> Objects.nonNull(w.getProcessWarning()) && w.getProcessWarning()) .collect(Collectors.toList()); checkProcessWarning(processWarning); - //2.2 填报预警 如果正常了 要改会正常 + //3.2 填报预警 如果正常了 要改会正常 List declaredWarning = trueWarnings.stream().filter(w -> Objects.nonNull(w.getDeclaredWarning()) - && w.getDeclaredWarning()) + && w.getDeclaredWarning()) .collect(Collectors.toList()); checkDeclaredWarning(declaredWarning); - //2.3 实施预警 如果正常了 要改会正常 + //3.3 实施预警 如果正常了 要改会正常 List operationWarning = trueWarnings.stream().filter(w -> Objects.nonNull(w.getOperationWarning()) - && w.getOperationWarning()) + && w.getOperationWarning()) .collect(Collectors.toList()); checkOperationWarning(operationWarning); - //2.4 续建资金预警 如果正常了 要改会正常 + //3.4 续建资金预警 如果正常了 要改回正常 List renewalFundWarning = trueWarnings.stream().filter(w -> Objects.nonNull(w.getRenewalFundWarning()) - && w.getRenewalFundWarning()) + && w.getRenewalFundWarning()) .collect(Collectors.toList()); checkRenewalFundWarning(renewalFundWarning); - - - stopWatch.stop(); - log.info("=========== 预警项目维度任务结束 耗时{}s", stopWatch.getTotalTimeSeconds()); } private void checkRenewalFundWarning(List renewalFundWarnings) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/EarlyWarningManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/EarlyWarningManage.java index b686e57..2e2a3b9 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/EarlyWarningManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/EarlyWarningManage.java @@ -16,6 +16,7 @@ import com.ningdatech.pmapi.sys.service.INotifyService; import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; import com.ningdatech.yxt.model.cmd.SendSmsCmd; +import com.wflow.enums.WarningNoticeTypeEnum; import com.wflow.enums.WarningRuleTypeEnum; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -51,12 +52,12 @@ public class EarlyWarningManage { * 预警通知 * @param noticeMethod * @param noticeContent - * @param timeout + * @param adventTimeout * @param employeeCode * @param project */ - public void doEarlyWarning(String noticeMethod,String noticeContent, Integer timeout,Integer biz, - LocalDateTime startTime,String employeeCode, + public void doEarlyWarning(String noticeMethod,String noticeContent, Integer adventTimeout,Integer overTimeout, + Integer biz, LocalDateTime startTime,String employeeCode, Project project,Integer ruleType,Integer noticeType, String path,String batchEmployees,String nodeId) { //1.存入 预警记录 @@ -66,22 +67,53 @@ public class EarlyWarningManage { switch (WarningRuleTypeEnum.checkByCode(ruleType)){ case PROCESS_WARNING: - content = convertContent(noticeContent,project.getProjectName(), - InstTypeEnum.getByCode(biz),timeout); + if(Objects.isNull(noticeType)){ + content = convertContent(noticeContent,project.getProjectName(), + InstTypeEnum.getByCode(biz),overTimeout); + }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { + content = convertAdventContent(noticeContent,project.getProjectName(), + InstTypeEnum.getByCode(biz),adventTimeout,overTimeout); + }else{ + content = convertContent(noticeContent,project.getProjectName(), + InstTypeEnum.getByCode(biz),overTimeout); + } records.setRuleType(WarningRuleTypeEnum.PROCESS_WARNING.getCode()); break; case DECLARED_WARNING: - content = convertContent(noticeContent,project.getProjectName(), - WarningFlowTypeEnum.getByCode(biz),timeout); + if(Objects.isNull(noticeType)){ + content = convertContent(noticeContent,project.getProjectName(), + WarningFlowTypeEnum.getByCode(biz),overTimeout); + }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { + content = convertAdventContent(noticeContent,project.getProjectName(), + WarningFlowTypeEnum.getByCode(biz),adventTimeout,overTimeout); + }else{ + content = convertContent(noticeContent,project.getProjectName(), + WarningFlowTypeEnum.getByCode(biz),overTimeout); + } records.setRuleType(WarningRuleTypeEnum.DECLARED_WARNING.getCode()); break; case OPERATION_WARNING: - content = convertContent(noticeContent,project.getProjectName(), - WarningOperationTypeEnum.getByCode(biz),timeout); + if(Objects.isNull(noticeType)){ + content = convertContent(noticeContent,project.getProjectName(), + WarningOperationTypeEnum.getByCode(biz),overTimeout); + }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { + content = convertAdventContent(noticeContent,project.getProjectName(), + WarningOperationTypeEnum.getByCode(biz),adventTimeout,overTimeout); + }else{ + content = convertContent(noticeContent,project.getProjectName(), + WarningOperationTypeEnum.getByCode(biz),overTimeout); + } records.setRuleType(WarningRuleTypeEnum.OPERATION_WARNING.getCode()); break; case RENEWAL_FUND: - content = convertContent(noticeContent,project.getProjectName(),timeout); + if(Objects.isNull(noticeType)){ + content = convertContent(noticeContent,project.getProjectName(),overTimeout); + }else if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { + content = convertAdventContent(noticeContent,project.getProjectName(),adventTimeout,overTimeout); + }else{ + content = convertContent(noticeContent,project.getProjectName(),overTimeout); + } + records.setRuleType(WarningRuleTypeEnum.RENEWAL_FUND.getCode()); break; default: @@ -147,6 +179,13 @@ public class EarlyWarningManage { log.info("通知内容 :{}",noticeContent); return noticeContent; } + private String convertAdventContent(String noticeContent, String projectName, Integer timeout,Integer overTimeOut) { + noticeContent = noticeContent.replace("{projectName}",projectName) + .replace("{time}",String.valueOf(timeout)) + .replace("{time2}",String.valueOf((overTimeOut - timeout))); + log.info("通知内容 :{}",noticeContent); + return noticeContent; + } /** * 转换出 通知的内容 @@ -165,6 +204,16 @@ public class EarlyWarningManage { return noticeContent; } + private String convertAdventContent(String noticeContent, String projectName, InstTypeEnum instTypeEnum, Integer timeout,Integer overTimeOut) { + noticeContent = noticeContent.replace("{projectName}",projectName) + .replace("{flowType}",Objects.nonNull(instTypeEnum) ? instTypeEnum.getDesc() : "{flowType}") + .replace("{stepName}",Objects.nonNull(instTypeEnum) ? instTypeEnum.getDesc() : "{stepName}") + .replace("{time}",String.valueOf(timeout)) + .replace("{time2}",String.valueOf((overTimeOut - timeout))); + log.info("通知内容 :{}",noticeContent); + return noticeContent; + } + private String convertContent(String noticeContent, String projectName, WarningFlowTypeEnum warningFlowTypeEnum, Integer timeout) { noticeContent = noticeContent.replace("{projectName}",projectName) .replace("{flowType}",Objects.nonNull(warningFlowTypeEnum) ? warningFlowTypeEnum.getDesc() : "{flowType}") @@ -174,6 +223,16 @@ public class EarlyWarningManage { return noticeContent; } + private String convertAdventContent(String noticeContent, String projectName, WarningFlowTypeEnum warningFlowTypeEnum, Integer timeout,Integer overTimeout) { + noticeContent = noticeContent.replace("{projectName}",projectName) + .replace("{flowType}",Objects.nonNull(warningFlowTypeEnum) ? warningFlowTypeEnum.getDesc() : "{flowType}") + .replace("{stepName}",Objects.nonNull(warningFlowTypeEnum) ? warningFlowTypeEnum.getDesc() : "{stepName}") + .replace("{time}",String.valueOf(timeout)) + .replace("{time2}",String.valueOf((overTimeout - timeout))); + log.info("通知内容 :{}",noticeContent); + return noticeContent; + } + private String convertContent(String noticeContent, String projectName, WarningOperationTypeEnum operationTypeEnum, Integer timeout) { noticeContent = noticeContent.replace("{projectName}",projectName) .replace("{flowType}",Objects.nonNull(operationTypeEnum) ? operationTypeEnum.getDesc() : "{flowType}") @@ -182,4 +241,14 @@ public class EarlyWarningManage { log.info("通知内容 :{}",noticeContent); return noticeContent; } + + private String convertAdventContent(String noticeContent, String projectName, WarningOperationTypeEnum operationTypeEnum, Integer timeout,Integer overTimeout) { + noticeContent = noticeContent.replace("{projectName}",projectName) + .replace("{flowType}",Objects.nonNull(operationTypeEnum) ? operationTypeEnum.getDesc() : "{flowType}") + .replace("{stepName}",Objects.nonNull(operationTypeEnum) ? operationTypeEnum.getDesc() : "{stepName}") + .replace("{time}",String.valueOf(timeout)) + .replace("{time2}",String.valueOf((overTimeout - timeout))); + log.info("通知内容 :{}",noticeContent); + return noticeContent; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java index 9da1750..45984c3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java @@ -115,10 +115,9 @@ public class WorkbenchManage { //这个不能放入子线程 ProjectListReq projectListReq = new ProjectListReq(); projectListReq.setPageNumber(1); - projectListReq.setPageSize(5); + projectListReq.setPageSize(2000); projectListReq.setProjectYear(year); - projectListReq.setBuildOrgCode(user.getEmpPosUnitCode()); - res.setProjects(new ArrayList<>(projectLibManage.projectLibListApprove(projectListReq, user).getRecords())); + res.setProjects(new ArrayList<>(projectLibManage.listWithPermissionWorkbentch(projectListReq,user).getRecords())); return res; } @@ -294,7 +293,8 @@ public class WorkbenchManage { Long between = ChronoUnit.HOURS.between(instStart,LocalDateTime.now()); Integer times = 0; for(String employee : employees){ - earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,between.intValue(),biz, + earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,between.intValue() + ,between.intValue(),biz, instStart,employee,project, ruleType,noticeType,path,batchEmployees,record.getNodeId()); times++;