@@ -19,4 +19,8 @@ public class ExistsSqlConst { | |||
public static final String PURCHASE_EXISTS_OPERATION = " select 1 from nd_project_operation npo where npo.bid_id = nd_purchase.id "; | |||
public static final String PROJECT_EXISTS_STATUS_CHANGE = "select 1 from nd_project_status_change npsc where npsc.project_code = nd_project.project_code "; | |||
public static final String PROJECT_EXISTS_PURCHASE_STATUS_CHANGE = "select 1 from nd_purchase_status_change npsc where npsc.project_code = nd_project.project_code "; | |||
} |
@@ -1,18 +0,0 @@ | |||
package com.hz.pm.api.dashboard.constant; | |||
/** | |||
* @author liuxinxin | |||
* @date 2023/8/2 下午2:46 | |||
*/ | |||
public class AnalysisBasicConstant { | |||
private AnalysisBasicConstant() { | |||
} | |||
/** | |||
* 丽水市区域编码 | |||
*/ | |||
public static final String LS_REGION_CODE = "331100"; | |||
} |
@@ -21,10 +21,13 @@ import org.springframework.stereotype.Component; | |||
import java.math.BigDecimal; | |||
import java.math.RoundingMode; | |||
import java.time.LocalDate; | |||
import java.util.*; | |||
import java.util.stream.Collectors; | |||
import java.util.stream.Stream; | |||
import static com.hz.pm.api.dashboard.constant.DashboardConstant.CockpitStats.*; | |||
import static com.hz.pm.api.dashboard.constant.DashboardConstant.CockpitStats.NONE_YEAR; | |||
import static com.hz.pm.api.dashboard.constant.DashboardConstant.CockpitStats.TOTAL; | |||
/** | |||
* @Classname CockpitStatsHandler | |||
@@ -41,10 +44,16 @@ public class CockpitStatsHandler { | |||
private final ICockpitStatsService cockpitStatsService; | |||
private static final List<Integer> years = Lists.newArrayList(2021, 2022, 2023, 2024, 2025); | |||
private static final List<Integer> YEARS; | |||
static { | |||
Integer startYear = LocalDate.now().getYear() - 3; | |||
YEARS = Stream.iterate(startYear, i -> ++i).limit(5).collect(Collectors.toList()); | |||
} | |||
public CockpitStatsVO convertCockpitStats(CockpitStats cockpitStats, String regionCode, Integer year | |||
, List<CockpitApplication> appDatas) { | |||
CockpitStatsVO res = BeanUtil.copyProperties(cockpitStats, CockpitStatsVO.class); | |||
if (Objects.isNull(cockpitStats)) { | |||
@@ -57,7 +66,7 @@ public class CockpitStatsHandler { | |||
//顶部数据 | |||
res.setTopData(convertTopData(cockpitStats)); | |||
//地图数据 | |||
res.setMapProjectData(convertMapProjectsData(cockpitStats, year)); | |||
res.setMapProjectData(convertMapProjectsData(year)); | |||
//项目项目数据 | |||
res.setStatusProjectsData(convertStatusProjectsData(cockpitStats)); | |||
//项目效益 优秀项目 | |||
@@ -106,8 +115,8 @@ public class CockpitStatsHandler { | |||
return res; | |||
} | |||
private CockpitStatsVO.PerformanceData convertPerformanceData(CockpitStats cockpitStats) { | |||
CockpitStatsVO.PerformanceData data = BeanUtil.copyProperties(cockpitStats, CockpitStatsVO.PerformanceData.class); | |||
private PerformanceData convertPerformanceData(CockpitStats cockpitStats) { | |||
PerformanceData data = BeanUtil.copyProperties(cockpitStats, PerformanceData.class); | |||
data.setPerformanceTops(convertTops(cockpitStats)); | |||
return data; | |||
} | |||
@@ -150,7 +159,7 @@ public class CockpitStatsHandler { | |||
return BeanUtil.copyProperties(cockpitStats, CockpitStatsVO.StatusProjectsData.class); | |||
} | |||
private List<CockpitStatsVO.MapProjectsData> convertMapProjectsData(CockpitStats cockpitStats, Integer year) { | |||
private List<CockpitStatsVO.MapProjectsData> convertMapProjectsData(Integer year) { | |||
List<CockpitStatsVO.MapProjectsData> mapProjectsDatas = Lists.newArrayList(); | |||
List<RegionDTO> regions = regionCacheHelper.listChildren(RegionConst.RC_HZ, RegionConst.RL_CITY); | |||
regions = regions.stream().filter(r -> r.getRegionLevel() != 2).sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); | |||
@@ -217,7 +226,7 @@ public class CockpitStatsHandler { | |||
List<CockpitStats> cocks = cockpitStatsService.list(Wrappers.lambdaQuery(CockpitStats.class) | |||
.eq(StringUtils.isNotBlank(regionCode), CockpitStats::getRegionCode, regionCode) | |||
.eq(StringUtils.isBlank(regionCode), CockpitStats::getRegionCode, TOTAL) | |||
.in(CockpitStats::getYear, years) | |||
.in(CockpitStats::getYear, YEARS) | |||
.orderByAsc(CockpitStats::getYear)); | |||
return cocks.stream().map(c -> { | |||
CockpitStatsVO.SafetyInput safetyInput = new CockpitStatsVO.SafetyInput(); | |||
@@ -247,4 +256,5 @@ public class CockpitStatsHandler { | |||
chars.add(new PasswordGradeChart(5, cockpitStats.getMonitorPasswordGrade5Num())); | |||
return chars; | |||
} | |||
} |
@@ -1,144 +0,0 @@ | |||
package com.hz.pm.api.dashboard.handle; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.util.BizUtils; | |||
import com.hz.pm.api.dashboard.constant.DashboardConstant; | |||
import com.hz.pm.api.dashboard.model.vo.ProtraitProjectStatusSituationVO; | |||
import com.hz.pm.api.performance.model.entity.PerformanceAppraisalProject; | |||
import com.hz.pm.api.performance.service.IPerformanceAppraisalProjectService; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectInst; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; | |||
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; | |||
import com.hz.pm.api.projectlib.service.IProjectStatusChangeService; | |||
import com.hz.pm.api.projectlib.service.IProjectInstService; | |||
import com.hz.pm.api.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 IProjectStatusChangeService statusChangeService; | |||
private final HistoryService historyService; | |||
private final IPerformanceAppraisalProjectService performanceAppraisalProjectService; | |||
/** | |||
* 不同的项目状态 去求不同的审批完成时间 审批类型的 | |||
* | |||
* @param project \ | |||
* @return \ | |||
*/ | |||
public ProtraitProjectStatusSituationVO genApproveStatus(Project project, String statusName, InstTypeEnum 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.getCode()) | |||
.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 genStatus(Project project, String statusName, | |||
ProjectStatus currStatus, ProjectStatus nextStatus) { | |||
ProtraitProjectStatusSituationVO vo = new ProtraitProjectStatusSituationVO(); | |||
if (Objects.isNull(project)) { | |||
return vo; | |||
} | |||
vo.setStatusName(statusName); | |||
//查询 单位内部审核完成的时间 | |||
String projectCode = project.getProjectCode(); | |||
//查询 状态机流转的时间点 | |||
LambdaQueryWrapper<ProjectStatusChange> pscQuery = Wrappers | |||
.lambdaQuery(ProjectStatusChange.class) | |||
.eq(ProjectStatusChange::getBeforeStatus, currStatus.getCode()) | |||
.eq(ProjectStatusChange::getProjectCode, projectCode) | |||
.eq(ProjectStatusChange::getAfterStatus, nextStatus.getCode()) | |||
.last(BizConst.LIMIT_1); | |||
ProjectStatusChange statusChange = statusChangeService.getOne(pscQuery); | |||
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(); | |||
LambdaQueryWrapper<PerformanceAppraisalProject> papQuery = Wrappers | |||
.lambdaQuery(PerformanceAppraisalProject.class) | |||
.eq(PerformanceAppraisalProject::getProjectCode, projectCode) | |||
.isNotNull(PerformanceAppraisalProject::getVerifyTotalScore) | |||
.isNotNull(PerformanceAppraisalProject::getVerifyScoreTime) | |||
.last(BizConst.LIMIT_1); | |||
PerformanceAppraisalProject performance = performanceAppraisalProjectService.getOne(papQuery); | |||
if (Objects.nonNull(performance)) { | |||
vo.setStatusTime(performance.getVerifyScoreTime()); | |||
} | |||
return vo; | |||
} | |||
} |
@@ -1,24 +0,0 @@ | |||
package com.hz.pm.api.dashboard.manage; | |||
import com.hz.pm.api.dashboard.model.vo.ProjectStatisticsVO; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Component; | |||
/** | |||
* @Classname ProjectStatisticsManage | |||
* @Description | |||
* @Date 2023/12/05 17:44 | |||
* @Author PoffyZhang | |||
*/ | |||
@Component | |||
@RequiredArgsConstructor | |||
@Slf4j | |||
public class ProjectStatisticsManage { | |||
public ProjectStatisticsVO statistics(Integer year) { | |||
ProjectStatisticsVO res = new ProjectStatisticsVO(); | |||
return res; | |||
} | |||
} |
@@ -6,8 +6,10 @@ import com.hz.pm.api.user.manage.SyncMhUserOrgManage; | |||
import com.hz.pm.api.user.util.LoginUserUtil; | |||
import com.wflow.bean.entity.WflowModels; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import org.springframework.security.access.prepost.PreAuthorize; | |||
import org.springframework.web.bind.annotation.*; | |||
import java.time.LocalDateTime; | |||
@@ -30,34 +32,45 @@ public class MhSyncController { | |||
private final ProcessModelManage processModelManage; | |||
@GetMapping("/wflow/{type}") | |||
@ApiOperation("获取当前用户的流程模型") | |||
public WflowModels syncWflow(@PathVariable Integer type) { | |||
return processModelManage.getWflowModelsNoNull(ProjectProcessType.getNoNull(type), | |||
LoginUserUtil.loginUserDetail().getMhUnitId()); | |||
} | |||
@GetMapping("/users") | |||
@PreAuthorize("hasAuthority('SUPER_ADMIN')") | |||
@ApiOperation("同步用户信息") | |||
public void getUsers(@RequestParam(value = "syncTime", required = false) | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime syncTime) { | |||
syncMhUserOrgManage.syncUsers(syncTime); | |||
} | |||
@GetMapping("/projects") | |||
@PreAuthorize("hasAuthority('SUPER_ADMIN')") | |||
@ApiOperation("同步项目信息") | |||
public void getUsers() { | |||
syncMhUserOrgManage.syncMhProjects(); | |||
} | |||
@GetMapping("/units") | |||
@ApiOperation("同步单位信息") | |||
@PreAuthorize("hasAuthority('SUPER_ADMIN')") | |||
public void getUnits() { | |||
syncMhUserOrgManage.syncUnits(); | |||
} | |||
@GetMapping("/experts") | |||
@ApiOperation("同步专家信息") | |||
@PreAuthorize("hasAuthority('SUPER_ADMIN')") | |||
public void getExperts(@RequestParam(value = "syncTime", required = false) | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime syncTime) { | |||
syncMhUserOrgManage.syncExperts(syncTime); | |||
} | |||
@GetMapping("/company") | |||
@ApiOperation("同步企业信息") | |||
@PreAuthorize("hasAuthority('SUPER_ADMIN')") | |||
public void getExperts() { | |||
syncMhUserOrgManage.syncCompany(); | |||
} | |||
@@ -1,19 +0,0 @@ | |||
package com.hz.pm.api.organization.controller; | |||
import org.springframework.stereotype.Controller; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
/** | |||
* <p> | |||
* 前端控制器 | |||
* </p> | |||
* | |||
* @author Liuxinxin | |||
* @since 2023-03-08 | |||
*/ | |||
@Controller | |||
@RequestMapping("/pmapi.organization/meta-organization-line-tag") | |||
public class MetaOrganizationLineTagController { | |||
} |
@@ -1,20 +0,0 @@ | |||
package com.hz.pm.api.organization.controller; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.stereotype.Controller; | |||
/** | |||
* <p> | |||
* 前端控制器 | |||
* </p> | |||
* | |||
* @author Liuxinxin | |||
* @since 2023-03-09 | |||
*/ | |||
@Controller | |||
@RequestMapping("/pmapi.organization/organization-main-manage-tag") | |||
public class OrganizationMainManageTagController { | |||
} |
@@ -1,24 +0,0 @@ | |||
package com.hz.pm.api.organization.controller; | |||
import io.swagger.annotations.Api; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
/** | |||
* <p> | |||
* 前端控制器 | |||
* </p> | |||
* | |||
* @author Liuxinxin | |||
* @since 2023-03-06 | |||
*/ | |||
@RestController | |||
@Api(tags = "组织标签(条线标签)") | |||
@RequestMapping("/api/v1/organization-tag") | |||
public class OrganizationTagController { | |||
// @PostMapping("条线单位") | |||
// private | |||
} |
@@ -2,6 +2,7 @@ package com.hz.pm.api.projectdeclared.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.core.date.DateUtil; | |||
import cn.hutool.core.util.StrUtil; | |||
import cn.hutool.json.JSONUtil; | |||
import com.alibaba.excel.EasyExcelFactory; | |||
@@ -430,7 +431,7 @@ public class DeclaredProjectManage { | |||
BeanUtils.copyProperties(r, item); | |||
item.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType())); | |||
item.setStatusName(ProjectStatus.getDesc(r.getStatus())); | |||
String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); | |||
String createOnStr = DateUtil.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); | |||
item.setCreateOn(createOnStr); | |||
item.setSerialNumber(serialNumber.incrementAndGet()); | |||
return item; | |||
@@ -3,7 +3,6 @@ package com.hz.pm.api.projectdeclared.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Assert; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil; | |||
import com.hz.pm.api.common.statemachine.util.TenderStateMachineUtil; | |||
@@ -79,10 +78,8 @@ public class OperationManage { | |||
if (!TenderStatus.TO_BE_SUBMIT_OPERATION_PLAN.eq(purchase.getStatus())) { | |||
throw BizException.wrap("该标段不支持填写实施计划"); | |||
} | |||
Operation operation = operationService.getByBidId(req.getBidId()); | |||
if (operation == null) { | |||
operation = new Operation(); | |||
} | |||
Operation operation = operationService.getByBidId(req.getBidId()) | |||
.orElseGet(Operation::new); | |||
Project project = projectService.getNewProject(req.getProjectId()); | |||
LocalDateTime now = LocalDateTime.now(); | |||
BeanUtil.copyProperties(req, operation); | |||
@@ -446,12 +446,13 @@ public class PurchaseManage { | |||
LocalDateTime now = LocalDateTime.now(); | |||
// 保存合同信息 | |||
Contract contract = contractService.getByBidId(req.getBidId()); | |||
if (contract == null) { | |||
contract = new Contract(); | |||
contract.setCreateBy(user.getUserIdStr()); | |||
contract.setCreateOn(now); | |||
} | |||
Contract contract = contractService.getByBidId(req.getBidId()) | |||
.orElseGet(() -> { | |||
Contract newContract = new Contract(); | |||
newContract.setCreateBy(user.getUserIdStr()); | |||
newContract.setCreateOn(now); | |||
return newContract; | |||
}); | |||
contract.setContractTime(req.getContractTime()); | |||
contract.setAttachment(req.getAttachment()); | |||
contract.setName(req.getName()); | |||
@@ -600,15 +601,16 @@ public class PurchaseManage { | |||
String instanceId = processInstanceService.startProcessLs(model, instParam, orgMap); | |||
testValidStateMachineUtil.pass(purchase); | |||
purchaseService.updateById(purchase); | |||
Operation operation = operationService.getByBidId(purchase.getId()); | |||
if (operation == null) { | |||
operation = new Operation(); | |||
operation.setBidId(purchase.getId()); | |||
operation.setCreateBy(user.getUsername()); | |||
operation.setCreateOn(now); | |||
operation.setProjectId(projectId); | |||
operation.setProjectCode(project.getProjectCode()); | |||
} | |||
Operation operation = operationService.getByBidId(purchase.getId()) | |||
.orElseGet(() -> { | |||
Operation newOperation = new Operation(); | |||
newOperation.setBidId(purchase.getId()); | |||
newOperation.setCreateBy(user.getUsername()); | |||
newOperation.setCreateOn(now); | |||
newOperation.setProjectId(projectId); | |||
newOperation.setProjectCode(project.getProjectCode()); | |||
return newOperation; | |||
}); | |||
operation.setUpdateBy(user.getUsername()); | |||
operation.setUpdateOn(now); | |||
operation.setActualTestValidTime(req.getActualTime()); | |||
@@ -664,15 +666,16 @@ public class PurchaseManage { | |||
String instanceId = processInstanceService.startProcessLs(model, instParam, orgMap); | |||
selfTestStateMachineUtil.pass(purchase); | |||
purchaseService.updateById(purchase); | |||
Operation operation = operationService.getByBidId(purchase.getId()); | |||
if (operation == null) { | |||
operation = new Operation(); | |||
operation.setBidId(purchase.getId()); | |||
operation.setCreateBy(user.getUsername()); | |||
operation.setCreateOn(now); | |||
operation.setProjectId(projectId); | |||
operation.setProjectCode(project.getProjectCode()); | |||
} | |||
Operation operation = operationService.getByBidId(purchase.getId()) | |||
.orElseGet(() -> { | |||
Operation newOperation = new Operation(); | |||
newOperation.setBidId(purchase.getId()); | |||
newOperation.setCreateBy(user.getUsername()); | |||
newOperation.setCreateOn(now); | |||
newOperation.setProjectId(projectId); | |||
newOperation.setProjectCode(project.getProjectCode()); | |||
return newOperation; | |||
}); | |||
operation.setActualSelfTestTime(req.getActualTime()); | |||
operation.setSelfTestFiles(req.getFiles()); | |||
operation.setSelfTestRemark(req.getRemark()); | |||
@@ -709,15 +712,16 @@ public class PurchaseManage { | |||
String instanceId = processInstanceService.startProcessLs(model, instParam, orgMap); | |||
adaptStateMachineUtil.pass(purchase); | |||
purchaseService.updateById(purchase); | |||
Operation operation = operationService.getByBidId(purchase.getId()); | |||
if (operation == null) { | |||
operation = new Operation(); | |||
operation.setBidId(purchase.getId()); | |||
operation.setCreateBy(user.getUsername()); | |||
operation.setCreateOn(now); | |||
operation.setProjectId(projectId); | |||
operation.setProjectCode(project.getProjectCode()); | |||
} | |||
Operation operation = operationService.getByBidId(purchase.getId()) | |||
.orElseGet(() -> { | |||
Operation newOperation = new Operation(); | |||
newOperation.setBidId(purchase.getId()); | |||
newOperation.setCreateBy(user.getUsername()); | |||
newOperation.setCreateOn(now); | |||
newOperation.setProjectId(projectId); | |||
newOperation.setProjectCode(project.getProjectCode()); | |||
return newOperation; | |||
}); | |||
operation.setActualAdaptionTime(req.getActualTime()); | |||
operation.setAdaptionFiles(req.getFiles()); | |||
operation.setAdaptionRemark(req.getRemark()); | |||
@@ -793,12 +797,12 @@ public class PurchaseManage { | |||
public Long addSystem(XcfhxApplySaveDTO dto) { | |||
Xinchuang xinchuang = BeanUtil.copyProperties(dto, Xinchuang.class); | |||
xinchuang.setSourceType(PurchaseSourceTypeEnum.MANUAL_ADDITION.getCode()); | |||
if (Boolean.TRUE.equals(dto.getMatchXcfhx())) { | |||
if (StrUtils.isNotBlank(dto.getMhXcfhxReportFile())) { | |||
String fileName = xinchuang.getBidName() + "-信创符合性测评报告."; | |||
xinchuang.setXcfhxReportFiles(mhXchxFileHelper.getXchxFile(dto.getMhXcfhxReportFile(), fileName)); | |||
} | |||
if (Boolean.TRUE.equals(dto.getMatchXcfhx()) | |||
&& StrUtils.isNotBlank(dto.getMhXcfhxReportFile())) { | |||
String fileName = xinchuang.getBidName() + "-信创符合性测评报告."; | |||
xinchuang.setXcfhxReportFiles(mhXchxFileHelper.getXchxFile(dto.getMhXcfhxReportFile(), fileName)); | |||
} | |||
if (xinchuangService.save(xinchuang)) { | |||
return xinchuang.getId(); | |||
} | |||
@@ -809,7 +813,8 @@ public class PurchaseManage { | |||
Xinchuang old = xinchuangService.getById(dto.getId()); | |||
VUtils.isTrue(Objects.isNull(old)).throwMessage("数据不存在"); | |||
Xinchuang xinchuang = BeanUtil.copyProperties(dto, Xinchuang.class); | |||
if (Boolean.TRUE.equals(dto.getMatchXcfhx()) && StrUtils.isNotBlank(dto.getMhXcfhxReportFile()) && | |||
if (Boolean.TRUE.equals(dto.getMatchXcfhx()) | |||
&& StrUtils.isNotBlank(dto.getMhXcfhxReportFile()) && | |||
!dto.getMhXcfhxReportFile().equals(old.getMhXcfhxReportFile())) { | |||
String fileName = xinchuang.getBidName() + "-信创符合性测评报告."; | |||
xinchuang.setXcfhxReportFiles(mhXchxFileHelper.getXchxFile(dto.getMhXcfhxReportFile(), fileName)); | |||
@@ -23,4 +23,8 @@ public enum BidTypeEnum { | |||
private final Integer code; | |||
private final String val; | |||
public boolean eq(Integer code) { | |||
return this.getCode().equals(code); | |||
} | |||
} |
@@ -9,6 +9,7 @@ import com.ningdatech.basic.util.CollUtils; | |||
import java.util.Collection; | |||
import java.util.Map; | |||
import java.util.Optional; | |||
/** | |||
* <p> | |||
@@ -26,11 +27,11 @@ public interface IContractService extends IService<Contract> { | |||
return CollUtils.listToMap(list(query), Contract::getBidId); | |||
} | |||
default Contract getByBidId(Long bidId) { | |||
default Optional<Contract> getByBidId(Long bidId) { | |||
LambdaQueryWrapper<Contract> query = Wrappers.lambdaQuery(Contract.class) | |||
.eq(Contract::getBidId, bidId) | |||
.last(BizConst.LIMIT_1); | |||
return getOne(query); | |||
return Optional.ofNullable(getOne(query)); | |||
} | |||
default Map<Long, Contract> listByProjectIds(Collection<Long> projectIds) { | |||
@@ -4,10 +4,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.hz.pm.api.projectdeclared.model.entity.Operation; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import java.util.Collection; | |||
import java.util.List; | |||
import java.util.Optional; | |||
/** | |||
* <p> | |||
@@ -19,10 +19,10 @@ import java.util.List; | |||
*/ | |||
public interface IOperationService extends IService<Operation> { | |||
default Operation getByBidId(Long bidId) { | |||
default Optional<Operation> getByBidId(Long bidId) { | |||
LambdaQueryWrapper<Operation> query = Wrappers.lambdaQuery(Operation.class) | |||
.eq(Operation::getBidId, bidId); | |||
return getOne(query); | |||
return Optional.ofNullable(getOne(query)); | |||
} | |||
default List<Operation> listByBidIds(Collection<Long> bidIds) { | |||
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.hz.pm.api.common.enumeration.CommonEnum; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.common.model.constant.CommonConst; | |||
import com.hz.pm.api.common.model.constant.ExistsSqlConst; | |||
import com.hz.pm.api.common.model.entity.ExcelExportWriter; | |||
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; | |||
import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil; | |||
@@ -73,8 +74,7 @@ public class AnnualPlanLibManage { | |||
ProjectManageUtil.projectQuery(query, req); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
query.and(q1 -> q1.in(Project::getStatus, ON_ANNUAL_PLAN.getCode()) | |||
.or(q2 -> q2.exists("select 1 from nd_project_status_change npsc" + | |||
" where npsc.project_code = nd_project.project_code and event = {0}", | |||
.or(q2 -> q2.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + " and event = {0}", | |||
ProjectStateChangeEvent.ANNUAL_PLAN_PASS))); | |||
Page<Project> page = projectService.page(req.page(), query); | |||
long total = page.getTotal(); | |||
@@ -33,7 +33,7 @@ public enum TenderAdaptStatus implements IStatus<Integer, String> { | |||
} | |||
public static TenderAdaptStatus getNoNull(Integer code) { | |||
return get(code).orElseThrow(() -> BizException.wrap("无效的适配改造状态:%s", code)); | |||
return get(code).orElseThrow(() -> BizException.wrap("无效的开工文件状态:%s", code)); | |||
} | |||
public static String getDesc(Integer code) { | |||
@@ -1,20 +0,0 @@ | |||
package com.hz.pm.api.signature.controller; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.stereotype.Controller; | |||
/** | |||
* <p> | |||
* 前端控制器 | |||
* </p> | |||
* | |||
* @author Lierbao | |||
* @since 2023-02-10 | |||
*/ | |||
@Controller | |||
@RequestMapping("/pmapi.signature/nd-company-signature") | |||
public class NdCompanySignatureController { | |||
} |
@@ -116,6 +116,7 @@ public class SyncMhUserOrgManage { | |||
if (CollUtil.isEmpty(mhUsers)) { | |||
return; | |||
} | |||
log.info("同步用户信息:{}条", mhUsers.size()); | |||
List<MhUnit> units = mhUnitService.list(); | |||
Map<Long, MhUnit> unitMap = CollUtils.listToMap(units, MhUnit::getId); | |||
Integer batchSize = syncMhUserProperties.getBatchSize(); | |||
@@ -171,6 +172,7 @@ public class SyncMhUserOrgManage { | |||
log.info("未获取到组织信息"); | |||
return; | |||
} | |||
log.info("同步组织信息:{}条", mhUnits.size()); | |||
List<MhUnit> updateUnits = new ArrayList<>(); | |||
for (MhUnitDTO org : mhUnits) { | |||
MhUnit unit = new MhUnit(); | |||
@@ -193,38 +195,33 @@ public class SyncMhUserOrgManage { | |||
MhRetDTO<List<MhCompanyDTO>> mhRet = mhApiClient.queryCompany(); | |||
if (mhRet.isOk()) { | |||
List<MhCompanyDTO> mhUnits = mhRet.getData(); | |||
if (mhUnits == null || mhUnits.isEmpty()) { | |||
log.info("未获取到组织信息"); | |||
return; | |||
} | |||
List<MhCompany> updateList = new ArrayList<>(); | |||
for (MhCompanyDTO org : mhUnits) { | |||
MhCompany company = new MhCompany(); | |||
company.setCompanyCode(org.getCode()); | |||
company.setCompanyName(org.getCompanyName()); | |||
company.setId(org.getId()); | |||
updateList.add(company); | |||
if (CollUtil.isNotEmpty(mhUnits)) { | |||
List<MhCompany> updateList = new ArrayList<>(); | |||
for (MhCompanyDTO org : mhUnits) { | |||
MhCompany company = new MhCompany(); | |||
company.setCompanyCode(org.getCode()); | |||
company.setCompanyName(org.getCompanyName()); | |||
company.setId(org.getId()); | |||
updateList.add(company); | |||
} | |||
mhCompanyService.saveOrUpdateBatch(updateList); | |||
log.info("同步企业信息:{}条", mhUnits.size()); | |||
} | |||
mhCompanyService.saveOrUpdateBatch(updateList); | |||
} else { | |||
log.error("同步组织信息失败:{}", JSONUtil.toJsonStr(mhRet)); | |||
log.error("同步企业信息失败:{}", JSONUtil.toJsonStr(mhRet)); | |||
} | |||
} | |||
@Transactional(rollbackFor = Exception.class) | |||
public void syncExperts(LocalDateTime syncDateTime) { | |||
MhRetDTO<MhExpertDTO> mhRet = mhApiClient.queryExperts(syncDateTime); | |||
if (mhRet.isOk()) { | |||
MhExpertDTO data = mhRet.getData(); | |||
if (data == null) { | |||
return; | |||
} | |||
List<MhReviewExpertDTO> reviewExperts = data.getReviewExpertVOList(); | |||
if (CollUtil.isNotEmpty(reviewExperts)) { | |||
saveReviewExperts(reviewExperts); | |||
} | |||
List<MhTechExpertDTO> techExperts = data.getTechnicalExpertVOList(); | |||
if (CollUtil.isNotEmpty(techExperts)) { | |||
saveTechExperts(techExperts); | |||
if (data != null) { | |||
// 保存评审专家 | |||
BizUtils.notEmpty(data.getReviewExpertVOList(), this::saveReviewExperts); | |||
// 保存技术专家 | |||
BizUtils.notEmpty(data.getTechnicalExpertVOList(), this::saveTechExperts); | |||
} | |||
} else { | |||
log.error("同步专家信息失败:{}", JSONUtil.toJsonStr(mhRet)); | |||
@@ -31,7 +31,7 @@ public class SyncMhUserTask { | |||
@Scheduled(fixedRateString = "#{syncMhUserProperties.getFixedRate()}", timeUnit = TimeUnit.MINUTES) | |||
public void execute() { | |||
Integer fixedRate = syncMhUserProperties.getFixedRate(); | |||
LocalDateTime syncDateTime = LocalDateTime.now().minusMinutes(fixedRate + 1L); | |||
LocalDateTime syncDateTime = LocalDateTime.now().minusMinutes(fixedRate + 5L); | |||
syncMhUserOrgManage.syncUsers(syncDateTime); | |||
} | |||
@@ -4,7 +4,7 @@ import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; | |||
import com.hz.pm.api.workbench.manage.WorkbenchManage; | |||
import com.hz.pm.api.workbench.model.WorkbenchProjectLibReq; | |||
import com.hz.pm.api.workbench.model.WorkbenchReq; | |||
import com.hz.pm.api.workbench.model.vo.ProjectProcessStageStatisticsVO; | |||
import com.hz.pm.api.workbench.model.vo.ProjectProcessStatVO; | |||
import com.hz.pm.api.workbench.model.vo.ProjectTotalViewVO; | |||
import com.hz.pm.api.workbench.model.vo.WorkbenchVO; | |||
import com.ningdatech.basic.model.PageVo; | |||
@@ -60,7 +60,7 @@ public class WorkbenchController { | |||
@GetMapping("/projectProcessStageStatistics") | |||
@ApiOperation("各阶段项目数据统计") | |||
public List<ProjectProcessStageStatisticsVO> projectProcessStageStatistics(WorkbenchReq req) { | |||
public List<ProjectProcessStatVO> projectProcessStageStatistics(WorkbenchReq req) { | |||
return workbenchManage.projectProcessStageStatistics(req); | |||
} | |||
@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.model.constant.ExistsSqlConst; | |||
import com.hz.pm.api.common.statemachine.event.*; | |||
import com.hz.pm.api.common.util.DecimalUtil; | |||
import com.hz.pm.api.projectdeclared.model.entity.Contract; | |||
@@ -19,7 +20,6 @@ import com.hz.pm.api.projectdeclared.service.IPurchaseService; | |||
import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil; | |||
import com.hz.pm.api.projectlib.entity.ProjectGovSystemReplaceInfos; | |||
import com.hz.pm.api.projectlib.entity.PurchaseStatusChange; | |||
import com.hz.pm.api.projectlib.handle.AbstractProcessHandle.ProcessNode; | |||
import com.hz.pm.api.projectlib.manage.ProjectLibManage; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; | |||
@@ -43,9 +43,10 @@ import com.hz.pm.api.user.helper.MhUnitCache; | |||
import com.hz.pm.api.user.security.model.UserFullInfoDTO; | |||
import com.hz.pm.api.user.util.LoginUserUtil; | |||
import com.hz.pm.api.workbench.converter.WorkbenchConverter; | |||
import com.hz.pm.api.workbench.model.WorkbenchProcessNode; | |||
import com.hz.pm.api.workbench.model.WorkbenchProjectLibReq; | |||
import com.hz.pm.api.workbench.model.WorkbenchReq; | |||
import com.hz.pm.api.workbench.model.vo.ProjectProcessStageStatisticsVO; | |||
import com.hz.pm.api.workbench.model.vo.ProjectProcessStatVO; | |||
import com.hz.pm.api.workbench.model.vo.ProjectTotalViewVO; | |||
import com.hz.pm.api.workbench.model.vo.SystemReplaceStatVO; | |||
import com.hz.pm.api.workbench.model.vo.WorkbenchVO; | |||
@@ -57,6 +58,7 @@ import com.wflow.service.IEarlyWarningService; | |||
import lombok.AllArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.apache.commons.math3.util.Pair; | |||
import org.springframework.stereotype.Component; | |||
import java.math.BigDecimal; | |||
@@ -64,9 +66,8 @@ import java.time.LocalDate; | |||
import java.time.LocalDateTime; | |||
import java.time.temporal.ChronoUnit; | |||
import java.util.*; | |||
import java.util.function.BiFunction; | |||
import java.util.function.Predicate; | |||
import java.util.function.ToLongBiFunction; | |||
import java.util.function.ToLongFunction; | |||
import java.util.stream.Collectors; | |||
/** | |||
@@ -219,7 +220,6 @@ public class WorkbenchManage { | |||
replaceInfosMap.computeIfAbsent(replaceType, k -> new ArrayList<>()).add(systemReplaceInfo); | |||
} | |||
} | |||
Predicate<String> isValidSystem = x -> StrUtil.isNotBlank(x) && !"/".equals(x); | |||
replaceInfosMap.remove("其他"); | |||
List<SystemReplaceStatVO> systemReplaceStat = replaceInfosMap.entrySet().stream().map(w -> { | |||
String replaceType = w.getKey(); | |||
@@ -238,34 +238,50 @@ public class WorkbenchManage { | |||
return retDetail; | |||
} | |||
public long getProjectCount(List<Long> projectIds, ProjectStateChangeEvent event) { | |||
return projectStatusChangeService.count(Wrappers.lambdaQuery(ProjectStatusChange.class) | |||
static Predicate<String> isValidSystem = x -> StrUtil.isNotBlank(x) && !"/".equals(x); | |||
private Pair<Integer, Integer> countReplaceSystemByProjectIds(Collection<Long> projectIds) { | |||
List<String> projectCodes = CollUtils.convert(projectIds, ProjectIdCodeCacheUtil::get); | |||
return countReplaceSystemByProjectCodes(projectCodes); | |||
} | |||
private Pair<Integer, Integer> countReplaceSystemByProjectCodes(List<String> projectCodes) { | |||
if (CollUtil.isEmpty(projectCodes)) { | |||
return Pair.create(0, 0); | |||
} | |||
Wrapper<ProjectGovSystemReplaceInfos> query = Wrappers.lambdaQuery(ProjectGovSystemReplaceInfos.class) | |||
.select(ProjectGovSystemReplaceInfos::getSourceSystem, ProjectGovSystemReplaceInfos::getTargetSystem) | |||
.in(ProjectGovSystemReplaceInfos::getProjectCode, projectCodes); | |||
List<ProjectGovSystemReplaceInfos> systemReplaceInfos = systemReplaceInfosService.list(query); | |||
int sourceCount = CollUtil.count(systemReplaceInfos, x -> isValidSystem.test(x.getSourceSystem())); | |||
int targetCount = CollUtil.count(systemReplaceInfos, x -> isValidSystem.test(x.getTargetSystem())); | |||
return Pair.create(sourceCount, targetCount); | |||
} | |||
public List<String> getProjectCodes(List<Long> projectIds, ProjectStateChangeEvent event) { | |||
Wrapper<ProjectStatusChange> query = Wrappers.lambdaQuery(ProjectStatusChange.class) | |||
.select(ProjectStatusChange::getProjectCode) | |||
.in(ProjectStatusChange::getProjectId, projectIds) | |||
.eq(ProjectStatusChange::getEvent, event)); | |||
.eq(ProjectStatusChange::getEvent, event); | |||
return CollUtils.fieldList(projectStatusChangeService.list(query), ProjectStatusChange::getProjectCode); | |||
} | |||
public List<ProjectProcessStageStatisticsVO> projectProcessStageStatistics(WorkbenchReq req) { | |||
public List<ProjectProcessStatVO> projectProcessStageStatistics(WorkbenchReq req) { | |||
initWorkbenchDefaultParam(req); | |||
List<ProjectProcessStageStatisticsVO> retData = new ArrayList<>(); | |||
List<Long> allVersionProjectIds = new ArrayList<>(); | |||
List<ProjectProcessStatVO> retData = new ArrayList<>(); | |||
List<Long> allProjectIds = new ArrayList<>(); | |||
Map<String, Map<Long, Long>> purchaseEventMap = new HashMap<>(); | |||
Map<Long, Long> projectPurchaseCountMap = new HashMap<>(); | |||
ToLongFunction<AbstractStateChangeEvent> countPurchase = event -> { | |||
BiFunction<AbstractStateChangeEvent, WorkbenchProcessNode, List<Long>> computeProjectIds = (event, node) -> { | |||
Map<Long, Long> projBizMap = purchaseEventMap.getOrDefault(event.name(), Collections.emptyMap()); | |||
return projBizMap.values().stream().mapToLong(l -> l).sum(); | |||
}; | |||
ToLongBiFunction<AbstractStateChangeEvent, ProcessNode> countProject = (event, node) -> { | |||
Map<Long, Long> projBizMap = purchaseEventMap.getOrDefault(event.name(), Collections.emptyMap()); | |||
if (node.equals(ProcessNode.PROJECT_ADAPTION) | |||
|| node.equals(ProcessNode.SYSTEM_SELF_TEST) | |||
|| node.equals(ProcessNode.SYSTEM_TEST_VALID) | |||
|| node.equals(ProcessNode.XCFHX_REVIEW)) { | |||
return projBizMap.size(); | |||
if (node.equals(WorkbenchProcessNode.PROJECT_ADAPTION)) { | |||
return new ArrayList<>(projBizMap.keySet()); | |||
} else { | |||
return projectPurchaseCountMap.entrySet().stream().filter(w -> { | |||
Long finishedBizCount = projBizMap.get(w.getKey()); | |||
return finishedBizCount != null && finishedBizCount.equals(w.getValue()); | |||
}).count(); | |||
}).map(Map.Entry::getKey).collect(Collectors.toList()); | |||
} | |||
}; | |||
// 查询完成立项备案的项目 | |||
@@ -274,93 +290,117 @@ public class WorkbenchManage { | |||
.select(Project::getId, Project::getApprovalAmount, Project::getProjectCode) | |||
.eq(Project::getProjectYear, req.getProjectYear()) | |||
.eq(Project::getNewest, Boolean.TRUE) | |||
.exists("select 1 from nd_project_status_change npsc " + | |||
"where npsc.project_code = nd_project.project_code and " + | |||
"npsc.event = {0}", ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS) | |||
.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + " and npsc.event = {0}", | |||
ProjectStateChangeEvent.PROJECT_APPLICATION_SUBMIT) | |||
.in(Project::getBuildOrgCode, CollUtils.convert(viewUnitIds, String::valueOf)); | |||
List<Project> projects = projectService.list(query); | |||
for (ProcessNode node : ProcessNode.ALL) { | |||
long projectCount = 0; | |||
long bidCount = 0; | |||
for (WorkbenchProcessNode node : WorkbenchProcessNode.ALL) { | |||
int projectCount; | |||
int targetCount; | |||
int sourceCount; | |||
if (!projects.isEmpty()) { | |||
switch (node) { | |||
case PROJECT_DECLARED: | |||
case PROJECT_DECLARED: { | |||
projectCount = projects.size(); | |||
for (Project project : projects) { | |||
allVersionProjectIds.addAll(ProjectIdCodeCacheUtil.get(project.getProjectCode())); | |||
allProjectIds.addAll(ProjectIdCodeCacheUtil.get(project.getProjectCode())); | |||
} | |||
break; | |||
case PROJECT_REVIEW: | |||
projectCount = getProjectCount(allVersionProjectIds, ProjectStateChangeEvent.PROJECT_REVIEW_PASS); | |||
break; | |||
case APPROVAL_AMOUNT: | |||
projectCount = projects.stream() | |||
.filter(w -> w.getApprovalAmount() != null) | |||
.filter(w -> w.getApprovalAmount().compareTo(BigDecimal.ZERO) > 0) | |||
.count(); | |||
break; | |||
case PROJECT_APPROVAL: | |||
projectCount = getProjectCount(allVersionProjectIds, ProjectStateChangeEvent.DECLARED_RECORD_PASS); | |||
break; | |||
case PROJECT_PURCHASE: | |||
Pair<Integer, Integer> replaceSystemCount = countReplaceSystemByProjectIds(allProjectIds); | |||
sourceCount = replaceSystemCount.getKey(); | |||
targetCount = replaceSystemCount.getValue(); | |||
} | |||
break; | |||
case PROJECT_REVIEW: { | |||
List<String> projectCodes = getProjectCodes(allProjectIds, ProjectStateChangeEvent.PROJECT_REVIEW_PASS); | |||
projectCount = projectCodes.size(); | |||
Pair<Integer, Integer> systemReplaceCount = countReplaceSystemByProjectCodes(projectCodes); | |||
sourceCount = systemReplaceCount.getKey(); | |||
targetCount = systemReplaceCount.getValue(); | |||
} | |||
break; | |||
case APPROVAL_AMOUNT: { | |||
List<String> projectCodes = projects.stream() | |||
.filter(w -> w.getApprovalAmount() != null | |||
&& NumberUtil.isGreater(w.getApprovalAmount(), BigDecimal.ZERO)) | |||
.map(Project::getProjectCode) | |||
.collect(Collectors.toList()); | |||
projectCount = projectCodes.size(); | |||
Pair<Integer, Integer> systemReplaceCount = countReplaceSystemByProjectCodes(projectCodes); | |||
sourceCount = systemReplaceCount.getKey(); | |||
targetCount = systemReplaceCount.getValue(); | |||
} | |||
break; | |||
case PROJECT_APPROVAL: { | |||
List<String> projectCodes = getProjectCodes(allProjectIds, ProjectStateChangeEvent.DECLARED_RECORD_SUBMIT); | |||
projectCount = projectCodes.size(); | |||
Pair<Integer, Integer> systemReplaceCount = countReplaceSystemByProjectCodes(projectCodes); | |||
sourceCount = systemReplaceCount.getKey(); | |||
targetCount = systemReplaceCount.getValue(); | |||
} | |||
break; | |||
case PROJECT_PURCHASE: { | |||
List<Purchase> purchases = purchaseService.list(Wrappers.lambdaQuery(Purchase.class) | |||
.select(Purchase::getId, Purchase::getProjectId) | |||
.in(Purchase::getProjectId, allVersionProjectIds)); | |||
bidCount = purchases.size(); | |||
.in(Purchase::getProjectId, allProjectIds)); | |||
projectPurchaseCountMap.putAll(CollUtils.groupCount(purchases, Purchase::getProjectId)); | |||
projectCount = projectPurchaseCountMap.size(); | |||
if (bidCount > 0) { | |||
Pair<Integer, Integer> systemReplaceCount = countReplaceSystemByProjectIds(projectPurchaseCountMap.keySet()); | |||
sourceCount = systemReplaceCount.getKey(); | |||
targetCount = systemReplaceCount.getValue(); | |||
if (!purchases.isEmpty()) { | |||
Wrapper<PurchaseStatusChange> pQuery = Wrappers.lambdaQuery(PurchaseStatusChange.class) | |||
.select(PurchaseStatusChange::getEvent, PurchaseStatusChange::getProjectId) | |||
.in(PurchaseStatusChange::getProjectId, allVersionProjectIds) | |||
.in(PurchaseStatusChange::getEvent, AdaptStateChangeEvent.ADAPT_INFO_PASSED, | |||
.in(PurchaseStatusChange::getProjectId, allProjectIds) | |||
.in(PurchaseStatusChange::getEvent, | |||
AdaptStateChangeEvent.ADAPT_INFO_PASSED, | |||
SelfTestStateChangeEvent.SELF_TEST_PASSED, | |||
TestValidStateChangeEvent.TEST_VALID_INFO_PASSED, | |||
TenderStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES, | |||
XcfhxStateChangeEvent.XCFHX_APPLY_PASSED, | |||
TenderStateChangeEvent.FINALLY_INSPECTED_PASSED); | |||
List<PurchaseStatusChange> changes = purchaseStatusChangeService.list(pQuery); | |||
Map<String, Map<Long, Long>> purchaseEventMapTmp = changes.stream() | |||
List<PurchaseStatusChange> purchaseChanges = purchaseStatusChangeService.list(pQuery); | |||
Map<String, Map<Long, Long>> purchaseEventMapTmp = purchaseChanges.stream() | |||
.collect(Collectors.groupingBy(PurchaseStatusChange::getEvent, | |||
Collectors.collectingAndThen(Collectors.toList(), | |||
w -> CollUtils.groupCount(w, PurchaseStatusChange::getProjectId)))); | |||
purchaseEventMap.putAll(purchaseEventMapTmp); | |||
} | |||
break; | |||
case PROJECT_ADAPTION: | |||
bidCount = countPurchase.applyAsLong(AdaptStateChangeEvent.ADAPT_INFO_PASSED); | |||
projectCount = countProject.applyAsLong(AdaptStateChangeEvent.ADAPT_INFO_PASSED, node); | |||
break; | |||
case SYSTEM_SELF_TEST: | |||
bidCount = countPurchase.applyAsLong(SelfTestStateChangeEvent.SELF_TEST_PASSED); | |||
projectCount = countProject.applyAsLong(SelfTestStateChangeEvent.SELF_TEST_PASSED, node); | |||
break; | |||
case SYSTEM_TEST_VALID: | |||
bidCount = countPurchase.applyAsLong(TestValidStateChangeEvent.TEST_VALID_INFO_PASSED); | |||
projectCount = countProject.applyAsLong(TestValidStateChangeEvent.TEST_VALID_INFO_PASSED, node); | |||
break; | |||
case FIRST_INSPECTED: | |||
case PILOT_RUNNING: | |||
// 初验试运行数量同步 | |||
bidCount = countPurchase.applyAsLong(TenderStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES); | |||
projectCount = countProject.applyAsLong(TenderStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES, node); | |||
break; | |||
case XCFHX_REVIEW: | |||
bidCount = countPurchase.applyAsLong(XcfhxStateChangeEvent.XCFHX_APPLY_PASSED); | |||
projectCount = countProject.applyAsLong(XcfhxStateChangeEvent.XCFHX_APPLY_PASSED, node); | |||
break; | |||
case FINAL_INSPECTED: | |||
bidCount = countPurchase.applyAsLong(TenderStateChangeEvent.FINALLY_INSPECTED_PASSED); | |||
projectCount = countProject.applyAsLong(TenderStateChangeEvent.FINALLY_INSPECTED_PASSED, node); | |||
break; | |||
} | |||
break; | |||
case PROJECT_ADAPTION: { | |||
List<Long> projectIds = computeProjectIds.apply(AdaptStateChangeEvent.ADAPT_INFO_PASSED, node); | |||
Pair<Integer, Integer> replaceSystemCount = countReplaceSystemByProjectIds(projectIds); | |||
targetCount = replaceSystemCount.getKey(); | |||
sourceCount = replaceSystemCount.getValue(); | |||
projectCount = projectIds.size(); | |||
} | |||
break; | |||
case FIRST_INSPECTED: { | |||
List<Long> projectIds = computeProjectIds.apply(TenderStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES, node); | |||
Pair<Integer, Integer> replaceSystemCount = countReplaceSystemByProjectIds(projectIds); | |||
targetCount = replaceSystemCount.getKey(); | |||
sourceCount = replaceSystemCount.getValue(); | |||
projectCount = projectIds.size(); | |||
} | |||
break; | |||
case FINAL_INSPECTED: { | |||
List<Long> projectIds = computeProjectIds.apply(TenderStateChangeEvent.FINALLY_INSPECTED_PASSED, node); | |||
Pair<Integer, Integer> replaceSystemCount = countReplaceSystemByProjectIds(projectIds); | |||
projectCount = projectIds.size(); | |||
targetCount = replaceSystemCount.getKey(); | |||
sourceCount = replaceSystemCount.getValue(); | |||
} | |||
break; | |||
default: | |||
projectCount = targetCount = sourceCount = 0; | |||
break; | |||
} | |||
retData.add(ProjectProcessStageStatisticsVO.builder() | |||
retData.add(ProjectProcessStatVO.builder() | |||
.stage(node) | |||
.stageName(node.getName()) | |||
.projectCount((int) projectCount) | |||
.bidCount((int) bidCount) | |||
.projectCount(projectCount) | |||
.targetCount(targetCount) | |||
.sourceCount(sourceCount) | |||
.build()); | |||
} | |||
} | |||
@@ -461,15 +501,13 @@ public class WorkbenchManage { | |||
private static void projectQueryByProjectStatusChange | |||
(LambdaQueryWrapper<Project> query, AbstractStateChangeEvent event) { | |||
query.exists("select 1 from nd_project_status_change npsc" + | |||
" where nd_project.project_code = npsc.project_code" + | |||
query.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + | |||
" and npsc.event = {0}", event); | |||
} | |||
private static void projectQueryByPurchaseStatusChange | |||
(LambdaQueryWrapper<Project> query, AbstractStateChangeEvent event) { | |||
query.exists("select 1 from nd_purchase_status_change npsc" + | |||
" where nd_project.project_code = npsc.project_code" + | |||
query.exists(ExistsSqlConst.PROJECT_EXISTS_PURCHASE_STATUS_CHANGE + | |||
" and npsc.event ={0}", event.name()); | |||
} | |||
@@ -0,0 +1,40 @@ | |||
package com.hz.pm.api.workbench.model; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Getter; | |||
import java.util.Arrays; | |||
import java.util.Comparator; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
/** | |||
* <p> | |||
* WorkbenchProcessNode | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 11:42 2024/8/14 | |||
*/ | |||
@Getter | |||
@AllArgsConstructor | |||
public enum WorkbenchProcessNode { | |||
PROJECT_DECLARED("已申报", 1), | |||
PROJECT_REVIEW("已评审通过", 2), | |||
APPROVAL_AMOUNT("资金已下达", 3), | |||
PROJECT_APPROVAL("已立项", 4), | |||
PROJECT_PURCHASE("已采购", 5), | |||
PROJECT_ADAPTION("已改造", 6), | |||
FIRST_INSPECTED("已初验", 9), | |||
FINAL_INSPECTED("已终验", 12); | |||
private final String name; | |||
private final Integer order; | |||
public static final List<WorkbenchProcessNode> ALL = Arrays.stream(WorkbenchProcessNode.values()) | |||
.sorted(Comparator.comparingInt(WorkbenchProcessNode::getOrder)) | |||
.collect(Collectors.toList()); | |||
} |
@@ -1,13 +1,13 @@ | |||
package com.hz.pm.api.workbench.model.vo; | |||
import com.hz.pm.api.projectlib.handle.AbstractProcessHandle.ProcessNode; | |||
import com.hz.pm.api.workbench.model.WorkbenchProcessNode; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Builder; | |||
import lombok.Data; | |||
/** | |||
* <p> | |||
* ProjectProcessStageStatisticsVO | |||
* ProjectProcessStatsVO | |||
* </p> | |||
* | |||
* @author WendyYang | |||
@@ -15,9 +15,9 @@ import lombok.Data; | |||
*/ | |||
@Data | |||
@Builder | |||
public class ProjectProcessStageStatisticsVO { | |||
public class ProjectProcessStatVO { | |||
private ProcessNode stage; | |||
private WorkbenchProcessNode stage; | |||
private String stageName; | |||
@@ -27,4 +27,10 @@ public class ProjectProcessStageStatisticsVO { | |||
@ApiModelProperty("项目数量") | |||
private Integer projectCount; | |||
@ApiModelProperty("替代前系统数量") | |||
private Integer sourceCount; | |||
@ApiModelProperty("替代后系统数量") | |||
private Integer targetCount; | |||
} |