@@ -7,6 +7,8 @@ import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.util.NumberUtils; | |||
import java.time.LocalDateTime; | |||
import java.time.ZoneId; | |||
import java.util.*; | |||
import java.util.function.Consumer; | |||
import java.util.function.Function; | |||
@@ -117,4 +119,11 @@ public class BizUtils { | |||
} | |||
return StringUtils.EMPTY; | |||
} | |||
public static LocalDateTime convertDate(Date date) { | |||
if (Objects.nonNull(date)) { | |||
return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); | |||
} | |||
return null; | |||
} | |||
} |
@@ -0,0 +1,25 @@ | |||
package com.ningdatech.pmapi.dashboard.constant; | |||
/** | |||
* @author liuxinxin | |||
* @date 2023/8/2 下午2:46 | |||
*/ | |||
public class DashboardConstant { | |||
public class Protrait{ | |||
public static final String NONE = "暂无"; | |||
public static final String PLAN = "计划"; | |||
public static final String DECLARED = "申报"; | |||
public static final String APPROVE = "审批"; | |||
public static final String CONSTRUCTION = "建设"; | |||
public static final String ACCEPT = "验收"; | |||
public static final String OPERATION = "运维"; | |||
public static final String PERFORMANCE = "绩效"; | |||
public static final String LOG_OFF = "注销"; | |||
public static final String PROJECT_SIGNS = "项目体征"; | |||
} | |||
} |
@@ -4,19 +4,12 @@ import com.ningdatech.log.annotation.WebLog; | |||
import com.ningdatech.pmapi.dashboard.manage.DashboardExpertManage; | |||
import com.ningdatech.pmapi.dashboard.manage.DashboardProjectManage; | |||
import com.ningdatech.pmapi.dashboard.model.po.QueryYearPO; | |||
import com.ningdatech.pmapi.dashboard.model.vo.DashboardInvestmentSummaryVO; | |||
import com.ningdatech.pmapi.dashboard.model.vo.DashboardProjectCntSummaryVO; | |||
import com.ningdatech.pmapi.dashboard.model.vo.DashboardProjectSummaryVO; | |||
import com.ningdatech.pmapi.dashboard.model.vo.ExpertDashboardSummaryVO; | |||
import com.ningdatech.pmapi.dashboard.model.vo.*; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.validation.annotation.Validated; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.validation.Valid; | |||
/** | |||
@@ -62,4 +55,9 @@ public class DashboardController { | |||
return dashboardProjectManage.getInvestmentSummary(queryYearPO); | |||
} | |||
@GetMapping("/project-portrait/{projectCode}") | |||
@ApiOperation("驾驶舱-项目画像接口") | |||
public DashboardProjectProtraitVO projectPortrait(@PathVariable String projectCode) { | |||
return dashboardProjectManage.getProjectPortrait(projectCode); | |||
} | |||
} |
@@ -0,0 +1,64 @@ | |||
package com.ningdatech.pmapi.dashboard.handle; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.google.common.collect.Maps; | |||
import com.ningdatech.pmapi.dashboard.constant.DashboardConstant; | |||
import com.ningdatech.pmapi.dashboard.model.vo.ProtraitProjectOutputVO; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.stereotype.Component; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* @Classname ApplicationHandler | |||
* @Description | |||
* @Date 2023/10/9 14:11 | |||
* @Author PoffyZhang | |||
*/ | |||
@Component | |||
@RequiredArgsConstructor | |||
@Slf4j | |||
public class ApplicationHandler { | |||
private final IProjectApplicationService applicationService; | |||
private final IProjectService projectService; | |||
/** | |||
* 生成项目产出 | |||
* @param projectCode | |||
* @return | |||
*/ | |||
public Map<String, ProtraitProjectOutputVO> generateOutput(String projectCode) { | |||
Map<String, ProtraitProjectOutputVO> res = Maps.newHashMap(); | |||
//1.初始化 项目体征 | |||
res.put(DashboardConstant.Protrait.PROJECT_SIGNS, | |||
generateOutputEntity(DashboardConstant.Protrait.PROJECT_SIGNS)); | |||
//2.查询应用 | |||
Project project = projectService.getProjectByCode(projectCode); | |||
List<ProjectApplication> apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) | |||
.eq(ProjectApplication::getProjectVersion, project.getVersion()) | |||
.eq(ProjectApplication::getProjectCode, projectCode)); | |||
for(ProjectApplication app : apps){ | |||
String appName = StringUtils.isNotBlank(app.getApplicationName()) ? app.getApplicationName() : app.getRelatedExistsApplication(); | |||
res.put(appName,generateOutputEntity(appName)); | |||
} | |||
return res; | |||
} | |||
private ProtraitProjectOutputVO generateOutputEntity(String name){ | |||
return ProtraitProjectOutputVO.builder() | |||
.name(DashboardConstant.Protrait.PROJECT_SIGNS) | |||
.generateData(new ProtraitProjectOutputVO.GenerateData()) | |||
.componentUsage(new ProtraitProjectOutputVO.ComponentUsage()) | |||
.cloudResourceUsage(new ProtraitProjectOutputVO.CloudResourceUsage()) | |||
.dataUsage(new ProtraitProjectOutputVO.DataUsage()) | |||
.operationReport(new ProtraitProjectOutputVO.OperationReport()) | |||
.build(); | |||
} | |||
} |
@@ -0,0 +1,140 @@ | |||
package com.ningdatech.pmapi.dashboard.handle; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.github.xiaoymin.knife4j.core.util.CommonUtils; | |||
import com.ningdatech.pmapi.common.constant.BizConst; | |||
import com.ningdatech.pmapi.common.util.BizUtils; | |||
import com.ningdatech.pmapi.dashboard.constant.DashboardConstant; | |||
import com.ningdatech.pmapi.dashboard.model.vo.ProtraitProjectStatusSituationVO; | |||
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject; | |||
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectService; | |||
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; | |||
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.flowable.engine.HistoryService; | |||
import org.flowable.engine.history.HistoricProcessInstance; | |||
import org.springframework.stereotype.Component; | |||
import java.util.Date; | |||
import java.util.List; | |||
import java.util.Objects; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @Classname ProjectStatusHandler | |||
* @Description | |||
* @Date 2023/10/9 14:11 | |||
* @Author PoffyZhang | |||
*/ | |||
@Component | |||
@RequiredArgsConstructor | |||
@Slf4j | |||
public class ProjectStatusHandler { | |||
private final IProjectService projectService; | |||
private final IProjectInstService projectInstService; | |||
private final INdProjectStatusChangeService statusChangeService; | |||
private final HistoryService historyService; | |||
private final IPerformanceAppraisalProjectService performanceAppraisalProjectService; | |||
/** | |||
* 不同的项目状态 去求不同的审批完成时间 审批类型的 | |||
* @param project | |||
* @return | |||
*/ | |||
public ProtraitProjectStatusSituationVO generateApproveStatus(Project project,String statusName,Integer instType) { | |||
ProtraitProjectStatusSituationVO vo = new ProtraitProjectStatusSituationVO(); | |||
if(Objects.isNull(project)){ | |||
return vo; | |||
} | |||
vo.setStatusName(statusName); | |||
//查询 单位内部审核完成的时间 | |||
String projectCode = project.getProjectCode(); | |||
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getProjectCode, projectCode)); | |||
List<Long> ids = projects.stream().map(Project::getId).collect(Collectors.toList()); | |||
//查询 项目与实例关联表 | |||
ProjectInst unitInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | |||
.in(ProjectInst::getProjectId, ids) | |||
.eq(ProjectInst::getInstType, instType) | |||
.last(BizConst.LIMIT_1)); | |||
if(Objects.isNull(unitInst)){ | |||
return vo; | |||
} | |||
//查询 这个实例 的完成时间 | |||
HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() | |||
.finished() | |||
.processInstanceId(unitInst.getInstCode()) | |||
.singleResult(); | |||
if(Objects.isNull(instance)){ | |||
return vo; | |||
} | |||
Date endTime = instance.getEndTime(); | |||
vo.setStatusTime(BizUtils.convertDate(endTime)); | |||
return vo; | |||
} | |||
/** | |||
* 不同的项目状态 去求不同的审批完成时间 非审批类型的 | |||
* @param project | |||
* @return | |||
*/ | |||
public ProtraitProjectStatusSituationVO generateStatus(Project project,String statusName, | |||
Integer beforeStatusCode,Integer afterStatusCode) { | |||
ProtraitProjectStatusSituationVO vo = new ProtraitProjectStatusSituationVO(); | |||
if(Objects.isNull(project)){ | |||
return vo; | |||
} | |||
vo.setStatusName(statusName); | |||
//查询 单位内部审核完成的时间 | |||
String projectCode = project.getProjectCode(); | |||
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getProjectCode, projectCode)); | |||
List<Long> ids = projects.stream().map(Project::getId).collect(Collectors.toList()); | |||
//查询 状态机流转的时间点 | |||
ProjectStatusChange statusChange = statusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) | |||
.eq(ProjectStatusChange::getBeforeStatus, beforeStatusCode) | |||
.eq(ProjectStatusChange::getProjectCode, projectCode) | |||
.eq(ProjectStatusChange::getAfterStatus, afterStatusCode) | |||
.last(BizConst.LIMIT_1)); | |||
if(Objects.isNull(statusChange)){ | |||
return vo; | |||
} | |||
vo.setStatusTime(statusChange.getCreateOn()); | |||
return vo; | |||
} | |||
/** | |||
* 绩效 | |||
* @param project | |||
* @return | |||
*/ | |||
public ProtraitProjectStatusSituationVO generatePerformanceStatus(Project project) { | |||
ProtraitProjectStatusSituationVO vo = new ProtraitProjectStatusSituationVO(); | |||
vo.setStatusName(DashboardConstant.Protrait.PERFORMANCE); | |||
if(Objects.isNull(project)){ | |||
return vo; | |||
} | |||
//查询 绩效完成 核查时间 | |||
String projectCode = project.getProjectCode(); | |||
PerformanceAppraisalProject performance = performanceAppraisalProjectService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) | |||
.eq(PerformanceAppraisalProject::getProjectCode,projectCode) | |||
.isNotNull(PerformanceAppraisalProject::getVerifyTotalScore) | |||
.isNotNull(PerformanceAppraisalProject::getVerifyScoreTime) | |||
.last(BizConst.LIMIT_1)); | |||
if(Objects.nonNull(performance)){ | |||
vo.setStatusTime(performance.getVerifyScoreTime()); | |||
} | |||
return vo; | |||
} | |||
} |
@@ -1,19 +1,24 @@ | |||
package com.ningdatech.pmapi.dashboard.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import com.baomidou.mybatisplus.core.toolkit.StringUtils; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.google.common.collect.Lists; | |||
import com.ningdatech.pmapi.dashboard.constant.ChartTypeEnum; | |||
import com.ningdatech.pmapi.dashboard.constant.DashboardConstant; | |||
import com.ningdatech.pmapi.dashboard.handle.ApplicationHandler; | |||
import com.ningdatech.pmapi.dashboard.handle.ProjectStatusHandler; | |||
import com.ningdatech.pmapi.dashboard.helper.DashboardChartAssembler; | |||
import com.ningdatech.pmapi.dashboard.helper.DashboardHelper; | |||
import com.ningdatech.pmapi.dashboard.model.basic.AnalysisChart; | |||
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.DashboardInvestmentSummaryVO; | |||
import com.ningdatech.pmapi.dashboard.model.vo.DashboardProjectCntSummaryVO; | |||
import com.ningdatech.pmapi.dashboard.model.vo.DashboardProjectSummaryVO; | |||
import com.ningdatech.pmapi.dashboard.model.vo.*; | |||
import com.ningdatech.pmapi.portrait.service.IProjectTagService; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase; | |||
import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService; | |||
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectDelayApply; | |||
@@ -40,6 +45,12 @@ public class DashboardProjectManage { | |||
private final DashboardHelper dashboardHelper; | |||
private final IPurchaseService iPurchaseService; | |||
private final ProjectStatusHandler statusHandler; | |||
private final IProjectTagService projectTagService; | |||
private final ApplicationHandler applicationHandler; | |||
public DashboardProjectSummaryVO getProjectSummary(QueryYearPO queryYearPO) { | |||
// 预算年度 | |||
Integer year = queryYearPO.getYear(); | |||
@@ -314,4 +325,61 @@ public class DashboardProjectManage { | |||
return dashboardInvestmentSummaryVO; | |||
} | |||
/** | |||
* 驾驶舱-项目画像 | |||
* @param projectCode | |||
* @return | |||
*/ | |||
public DashboardProjectProtraitVO getProjectPortrait(String projectCode) { | |||
DashboardProjectProtraitVO res = new DashboardProjectProtraitVO(); | |||
//1.先查询项目 | |||
Project project = iProjectService.getProjectByCode(projectCode); | |||
if(Objects.isNull(project)){ | |||
return res; | |||
} | |||
//2.转换项目信息 | |||
ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(project,ProtraitProjectInfoVO.class); | |||
projectInfo.setOverdueSituation("即将超期"); | |||
projectInfo.setSafetyInputRate("3%"); | |||
//3.项目状态情况 | |||
projectInfo.setStatusSituation(generateProjectStatus(project)); | |||
res.setProjectInfo(projectInfo); | |||
//4.查询项目特征 | |||
res.setProjectFeatures(projectTagService.getProjectTas(projectCode)); | |||
//5.查询项目产出 | |||
res.setProjectOutput(applicationHandler.generateOutput(projectCode)); | |||
return res; | |||
} | |||
/** | |||
* 生成项目 状态流转信息 | |||
* @param project | |||
* @return | |||
*/ | |||
private List<ProtraitProjectStatusSituationVO> generateProjectStatus(Project project) { | |||
List<ProtraitProjectStatusSituationVO> res = Lists.newArrayList(); | |||
//1.计划(单位内部审核) | |||
res.add(statusHandler.generateApproveStatus(project,DashboardConstant.Protrait.PLAN,InstTypeEnum.UNIT_INNER_AUDIT.getCode())); | |||
//2.申报(项目预审) | |||
res.add(statusHandler.generateApproveStatus(project,DashboardConstant.Protrait.DECLARED,InstTypeEnum.PRELIMINARY_PREVIEW.getCode())); | |||
//3.审批(建设方案审批) | |||
res.add(statusHandler.generateApproveStatus(project,DashboardConstant.Protrait.APPROVE,InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode())); | |||
//4.建设(立项后的建设中) | |||
res.add(statusHandler.generateStatus(project,DashboardConstant.Protrait.CONSTRUCTION, | |||
ProjectStatusEnum.UNDER_CONSTRUCTION.getCode(),ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode())); | |||
//5.验收(终验) | |||
res.add(statusHandler.generateApproveStatus(project,DashboardConstant.Protrait.ACCEPT,InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode())); | |||
//6.运维(todo: 运维时间还没有) | |||
res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.OPERATION).build()); | |||
//7.绩效 | |||
res.add(statusHandler.generatePerformanceStatus(project)); | |||
//8.注销(todo: 还没有注销功能) | |||
res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.LOG_OFF).build()); | |||
return res; | |||
} | |||
} |
@@ -0,0 +1,30 @@ | |||
package com.ningdatech.pmapi.dashboard.model.vo; | |||
import com.ningdatech.pmapi.portrait.model.entity.Tag; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* @author ZPF | |||
* @date 2023/10/9 下午3:07 | |||
*/ | |||
@Data | |||
@ApiModel("驾驶舱项目画像VO") | |||
public class DashboardProjectProtraitVO { | |||
@ApiModelProperty("项目信息") | |||
private ProtraitProjectInfoVO projectInfo; | |||
@ApiModelProperty("项目特征(就是标签)") | |||
private List<Tag> projectFeatures; | |||
@ApiModelProperty("项目产出") | |||
private Map<String,ProtraitProjectOutputVO> projectOutput; | |||
} | |||
@@ -0,0 +1,52 @@ | |||
package com.ningdatech.pmapi.dashboard.model.vo; | |||
import com.ningdatech.pmapi.common.compare.Compare; | |||
import com.ningdatech.pmapi.dashboard.model.basic.AnalysisChart; | |||
import com.ningdatech.pmapi.dashboard.model.basic.StarExpertBO; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.math.BigDecimal; | |||
import java.util.List; | |||
/** | |||
* @author ZPF | |||
* @date 2023/10/9 下午3:07 | |||
*/ | |||
@Data | |||
@ApiModel("驾驶舱项目画像里的项目信息VO") | |||
public class ProtraitProjectInfoVO { | |||
@ApiModelProperty("项目名字") | |||
private String projectName; | |||
@ApiModelProperty("项目编号") | |||
private String projectCode; | |||
@ApiModelProperty("建设单位code") | |||
private String buildOrgCode; | |||
@ApiModelProperty("建设单位名") | |||
private String buildOrgName; | |||
@ApiModelProperty("批复金额") | |||
private BigDecimal approvalAmount; | |||
@ApiModelProperty("项目预算年度") | |||
private Integer projectYear; | |||
@ApiModelProperty("建设周期(月)") | |||
private String buildCycle; | |||
@ApiModelProperty("项目安全投入占比") | |||
private String safetyInputRate; | |||
@ApiModelProperty("超期情况") | |||
private String overdueSituation; | |||
@ApiModelProperty("项目状态情况") | |||
private List<ProtraitProjectStatusSituationVO> statusSituation; | |||
} | |||
@@ -0,0 +1,117 @@ | |||
package com.ningdatech.pmapi.dashboard.model.vo; | |||
import com.ningdatech.pmapi.dashboard.constant.DashboardConstant; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Builder; | |||
import lombok.Data; | |||
/** | |||
* @author ZPF | |||
* @date 2023/10/9 下午3:07 | |||
*/ | |||
@Data | |||
@Builder | |||
@ApiModel("驾驶舱项目画像里的项目产出VO") | |||
public class ProtraitProjectOutputVO { | |||
public ProtraitProjectOutputVO(){ | |||
} | |||
public ProtraitProjectOutputVO(String name,CloudResourceUsage cloudResourceUsage,DataUsage dataUsage, | |||
ComponentUsage componentUsage,GenerateData generateData,OperationReport operationReport){ | |||
this.name = name; | |||
this.cloudResourceUsage = cloudResourceUsage; | |||
this.dataUsage = dataUsage; | |||
this.componentUsage = componentUsage; | |||
this.generateData = generateData; | |||
this.operationReport = operationReport; | |||
} | |||
@ApiModelProperty("名称") | |||
private String name; | |||
@ApiModelProperty("云资源使用情况") | |||
private CloudResourceUsage cloudResourceUsage = new CloudResourceUsage(); | |||
@ApiModelProperty("数据使用情况") | |||
private DataUsage dataUsage = new DataUsage(); | |||
@ApiModelProperty("组件使用情况") | |||
private ComponentUsage componentUsage = new ComponentUsage(); | |||
@ApiModelProperty("产生数据") | |||
private GenerateData generateData = new GenerateData(); | |||
@ApiModelProperty("试运行报告") | |||
private OperationReport operationReport = new OperationReport(); | |||
@Data | |||
public static class CloudResourceUsage{ | |||
@ApiModelProperty("云资源实例使用数") | |||
private String instancesNum = DashboardConstant.Protrait.NONE; | |||
@ApiModelProperty("云资源实例利用率") | |||
private String utilizationRate = DashboardConstant.Protrait.NONE; | |||
} | |||
@Data | |||
public static class DataUsage{ | |||
@ApiModelProperty("数据共享申请量") | |||
private String sharedApplicationVolume = DashboardConstant.Protrait.NONE; | |||
@ApiModelProperty("数据共享使用量") | |||
private String sharedUsage = DashboardConstant.Protrait.NONE; | |||
@ApiModelProperty("数据共享接口调用量") | |||
private String sharedInterfaceCallVolume = DashboardConstant.Protrait.NONE; | |||
@ApiModelProperty("协同接口使用量") | |||
private String collaborativeInterfaceCallVolume= DashboardConstant.Protrait.NONE; | |||
} | |||
@Data | |||
public static class ComponentUsage{ | |||
@ApiModelProperty("组件申请量") | |||
private String applicationVolume = DashboardConstant.Protrait.NONE; | |||
@ApiModelProperty("组件使用量") | |||
private String useVolume = DashboardConstant.Protrait.NONE; | |||
@ApiModelProperty("组件调用量") | |||
private String callVolume = DashboardConstant.Protrait.NONE; | |||
@ApiModelProperty("统一组件调用量") | |||
private String unifyCallolVolume = DashboardConstant.Protrait.NONE; | |||
} | |||
@Data | |||
public static class GenerateData{ | |||
@ApiModelProperty("产生数据量") | |||
private String volume = DashboardConstant.Protrait.NONE; | |||
@ApiModelProperty("产生数据共享申请量") | |||
private String sharedApplicationVolume = DashboardConstant.Protrait.NONE; | |||
@ApiModelProperty("产生数据共享使用量") | |||
private String sharedUseVolume = DashboardConstant.Protrait.NONE; | |||
@ApiModelProperty("产生数据审批通过率") | |||
private String approvalPassRate = DashboardConstant.Protrait.NONE; | |||
@ApiModelProperty("数据接口被调用量") | |||
private String dataInterfaceCallsVolume = DashboardConstant.Protrait.NONE; | |||
@ApiModelProperty("协同接口使用量") | |||
private String collaborativeInterfaceCallVolume = DashboardConstant.Protrait.NONE; | |||
} | |||
@Data | |||
public static class OperationReport{ | |||
@ApiModelProperty("试运行报告通过率") | |||
private String passRate = DashboardConstant.Protrait.NONE; | |||
} | |||
} | |||
@@ -0,0 +1,34 @@ | |||
package com.ningdatech.pmapi.dashboard.model.vo; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Builder; | |||
import lombok.Data; | |||
import java.time.LocalDateTime; | |||
/** | |||
* @author ZPF | |||
* @date 2023/10/9 下午3:07 | |||
*/ | |||
@Data | |||
@Builder | |||
@ApiModel("驾驶舱项目画像里的项目状态信息VO") | |||
public class ProtraitProjectStatusSituationVO { | |||
public ProtraitProjectStatusSituationVO(){ | |||
} | |||
public ProtraitProjectStatusSituationVO(String statusName,LocalDateTime statusTime){ | |||
this.statusName = statusName; | |||
this.statusTime = statusTime; | |||
} | |||
@ApiModelProperty("状态名") | |||
private String statusName; | |||
@ApiModelProperty("状态时间节点") | |||
private LocalDateTime statusTime; | |||
} | |||
@@ -2,6 +2,9 @@ package com.ningdatech.pmapi.portrait.service; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.ningdatech.pmapi.portrait.model.entity.ProjectTag; | |||
import com.ningdatech.pmapi.portrait.model.entity.Tag; | |||
import java.util.List; | |||
/** | |||
* @Classname ITagService | |||
@@ -10,5 +13,10 @@ import com.ningdatech.pmapi.portrait.model.entity.ProjectTag; | |||
* @Author PoffyZhang | |||
*/ | |||
public interface IProjectTagService extends IService<ProjectTag> { | |||
/** | |||
* 获取项目 标签 | |||
* @param projectCode | |||
* @return | |||
*/ | |||
List<Tag> getProjectTas(String projectCode); | |||
} |
@@ -1,11 +1,20 @@ | |||
package com.ningdatech.pmapi.portrait.service.impl; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import com.ningdatech.pmapi.portrait.mapper.ProjectTagMapper; | |||
import com.ningdatech.pmapi.portrait.model.entity.ProjectTag; | |||
import com.ningdatech.pmapi.portrait.model.entity.Tag; | |||
import com.ningdatech.pmapi.portrait.service.IProjectTagService; | |||
import com.ningdatech.pmapi.portrait.service.ITagService; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.stereotype.Service; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
/** | |||
* <p> | |||
* </p> | |||
@@ -14,8 +23,25 @@ import org.springframework.stereotype.Service; | |||
* @since 2023-08-2 | |||
*/ | |||
@Service | |||
@RequiredArgsConstructor | |||
public class ProjectTagServiceImpl extends ServiceImpl<ProjectTagMapper, | |||
ProjectTag> implements IProjectTagService { | |||
private final ITagService tagService; | |||
/** | |||
* 获取项目标签 | |||
* @param projectCode | |||
* @return | |||
*/ | |||
@Override | |||
public List<Tag> getProjectTas(String projectCode) { | |||
List<ProjectTag> proTags = this.list(Wrappers.lambdaQuery(ProjectTag.class) | |||
.eq(ProjectTag::getProjectCode, projectCode)); | |||
if(CollUtil.isEmpty(proTags)){ | |||
return Collections.emptyList(); | |||
} | |||
List<Long> tagIds = proTags.stream().map(ProjectTag::getTagId).collect(Collectors.toList()); | |||
return tagService.listByIds(tagIds); | |||
} | |||
} |
@@ -75,7 +75,7 @@ public class ProjectCollectionTest extends AppTests { | |||
@Test | |||
public void test(){ | |||
List<String> baseProjIds = Lists.newArrayList("null00020220100001"); | |||
List<String> baseProjIds = Lists.newArrayList("33110000020220100244"); | |||
for(String baseProjId : baseProjIds){ | |||
GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) | |||
.eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId) | |||
@@ -0,0 +1,180 @@ | |||
package com.ningdatech.pmapi.projectCollection; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.JSONArray; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.google.common.collect.Lists; | |||
import com.ningdatech.basic.util.StrPool; | |||
import com.ningdatech.log.model.domain.OptLog; | |||
import com.ningdatech.log.service.OptLogService; | |||
import com.ningdatech.pmapi.AppTests; | |||
import com.ningdatech.pmapi.common.constant.BizConst; | |||
import com.ningdatech.pmapi.gov.model.dto.GovBizProjectApplyDTO; | |||
import com.ningdatech.pmapi.gov.model.dto.GovBizProjectBaseinfoDTO; | |||
import com.ningdatech.pmapi.gov.model.dto.GovBizProjectSaveDTO; | |||
import com.ningdatech.pmapi.gov.model.entity.*; | |||
import com.ningdatech.pmapi.gov.service.*; | |||
import com.ningdatech.pmapi.portrait.model.entity.ProjectTag; | |||
import com.ningdatech.pmapi.portrait.service.IProjectTagService; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.Operation; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.PreInsAcceptancePerson; | |||
import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase; | |||
import com.ningdatech.pmapi.projectdeclared.service.IOperationService; | |||
import com.ningdatech.pmapi.projectdeclared.service.IPreInsAcceptancePersonService; | |||
import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService; | |||
import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; | |||
import com.ningdatech.pmapi.projectlib.model.entity.*; | |||
import com.ningdatech.pmapi.projectlib.service.*; | |||
import com.ningdatech.pmapi.safety.model.entity.PersonSafetyInfo; | |||
import com.ningdatech.pmapi.safety.model.entity.SupplierSafetyQualification; | |||
import com.ningdatech.pmapi.safety.service.IPersonSafetyInfoService; | |||
import com.ningdatech.pmapi.safety.service.ISupplierSafetyQualificationService; | |||
import com.ningdatech.pmapi.scheduler.task.SynProjectCollectionTask; | |||
import com.ningdatech.pmapi.scheduler.task.SynProjectCoreBizTask; | |||
import com.ningdatech.pmapi.staging.model.entity.ProjectStaging; | |||
import com.ningdatech.pmapi.staging.service.IProjectStagingService; | |||
import com.wflow.bean.entity.WflowCcTasks; | |||
import com.wflow.service.WflowCcTasksService; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.flowable.engine.HistoryService; | |||
import org.flowable.engine.RuntimeService; | |||
import org.junit.Test; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import java.net.UnknownHostException; | |||
import java.time.LocalDateTime; | |||
import java.time.temporal.ChronoUnit; | |||
import java.time.temporal.Temporal; | |||
import java.util.List; | |||
import java.util.Objects; | |||
import java.util.StringJoiner; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @Classname ProjectCollectionTest | |||
* @Description | |||
* @Date 2023/9/7 15:08 | |||
* @Author PoffyZhang | |||
*/ | |||
public class ProjectRemoveTest extends AppTests { | |||
@Autowired | |||
private IProjectService projectService; | |||
@Autowired | |||
private IProjectApplicationService applicationService; | |||
@Autowired | |||
private IProjectInstService projectInstService; | |||
@Autowired | |||
private IProjectStagingService stagingService; | |||
@Autowired | |||
private INdProjectStatusChangeService statusChangeService; | |||
@Autowired | |||
private ISupplierSafetyQualificationService supplierSafetyQualificationService; | |||
@Autowired | |||
private IPersonSafetyInfoService personService; | |||
@Autowired | |||
private IOperationService operationService; | |||
@Autowired | |||
private IPurchaseService purchaseService; | |||
@Autowired | |||
private IProjectTagService projectTagService; | |||
@Autowired | |||
private IPreInsAcceptancePersonService preInsAcceptancePersonService; | |||
@Autowired | |||
private IProjectRenewalFundDeclarationService renewalFundDeclarationService; | |||
@Autowired | |||
private HistoryService historyService; | |||
@Autowired | |||
private RuntimeService runtimeService; | |||
@Autowired | |||
private WflowCcTasksService ccTasksService; | |||
@Test | |||
@Transactional | |||
public void test(){ | |||
List<String> projectCodes = Lists.newArrayList("33110000020230100008","33111800020230200007"); | |||
for(String projectCode : projectCodes){ | |||
//项目 | |||
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getProjectCode, projectCode)); | |||
List<Long> projectIds = projects.stream().map(Project::getId).collect(Collectors.toList()); | |||
//1.删除应用 | |||
applicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) | |||
.eq(ProjectApplication::getProjectCode,projectCode)); | |||
//2.删除相关流程 | |||
List<ProjectInst> projectInsts = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) | |||
.in(ProjectInst::getProjectId, projectIds)); | |||
for(ProjectInst projectInst : projectInsts){ | |||
//实例 | |||
runtimeService.deleteProcessInstance(projectInst.getInstCode(),"删除"); | |||
historyService.deleteHistoricProcessInstance(projectInst.getInstCode()); | |||
//抄送 | |||
ccTasksService.remove(Wrappers.lambdaQuery(WflowCcTasks.class) | |||
.eq(WflowCcTasks::getInstanceId,projectInst.getInstCode())); | |||
} | |||
projectInstService.removeByIds(projectInsts.stream().map(ProjectInst::getId).collect(Collectors.toList())); | |||
//3.删除实施表 | |||
operationService.remove(Wrappers.lambdaQuery(Operation.class) | |||
.eq(Operation::getProjectCode,projectCode)); | |||
//4.删除续建项目资金表 | |||
renewalFundDeclarationService.remove(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) | |||
.eq(ProjectRenewalFundDeclaration::getProjectCode,projectCode)); | |||
//5.暂存表 | |||
stagingService.remove(Wrappers.lambdaQuery(ProjectStaging.class) | |||
.in(ProjectStaging::getProjectId,projectIds)); | |||
//6.状态变更表 | |||
statusChangeService.remove(Wrappers.lambdaQuery(ProjectStatusChange.class) | |||
.in(ProjectStatusChange::getProjectId,projectIds)); | |||
//7.采购表 | |||
purchaseService.remove(Wrappers.lambdaQuery(Purchase.class) | |||
.in(Purchase::getProjectId,projectIds)); | |||
//8.标签 | |||
projectTagService.remove(Wrappers.lambdaQuery(ProjectTag.class) | |||
.eq(ProjectTag::getProjectCode,projectCode)); | |||
//9.初验人员 | |||
preInsAcceptancePersonService.remove(Wrappers.lambdaQuery(PreInsAcceptancePerson.class) | |||
.in(PreInsAcceptancePerson::getProjectId,projectIds)); | |||
//10.供应商安全质量 | |||
supplierSafetyQualificationService.remove(Wrappers.lambdaQuery(SupplierSafetyQualification.class) | |||
.eq(SupplierSafetyQualification::getProjectCode,projectCode)); | |||
//11.安全人员 | |||
personService.remove(Wrappers.lambdaQuery(PersonSafetyInfo.class) | |||
.eq(PersonSafetyInfo::getProjectCode,projectCode)); | |||
//12.最后删除项目 | |||
projectService.removeByIds(projectIds); | |||
} | |||
} | |||
} |