@@ -179,7 +179,7 @@ public class ProjectReviewManage { | |||
if (!projectQueryPermission(query, user, req.getDeclaredUnitId())) { | |||
return PageVo.empty(); | |||
} | |||
Integer status = req.getStatus(); | |||
Integer status = req.clearStatus(); | |||
if (status != null) { | |||
req.setStatus(null); | |||
if (ProjectStatus.PROJECT_REVIEW_PASSED.eq(status)) { | |||
@@ -272,6 +272,7 @@ public class ProjectReviewManage { | |||
" and npsc.event = {0}", ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS); | |||
} | |||
ProjectManageUtil.projectQuery(query, req); | |||
ProjectManageUtil.projectBaseQuery(query); | |||
query.eq(Project::getNewest, Boolean.TRUE) | |||
.ne(Project::getStage, ProjectStatus.STOPPED.getCode()); | |||
Page<Project> page = projectService.page(req.page(), query); | |||
@@ -9,6 +9,8 @@ import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RequestParam; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import javax.servlet.http.HttpServletResponse; | |||
/** | |||
* <p> | |||
* ProjectGovSystemReplaceInfoController | |||
@@ -30,4 +32,9 @@ public class ProjectGovSystemReplaceInfoController { | |||
return systemReplaceInfoManage.systemReplaceInfos(targetSystem); | |||
} | |||
@GetMapping("/down") | |||
public void downTmp(HttpServletResponse response) { | |||
systemReplaceInfoManage.downTmp(response); | |||
} | |||
} |
@@ -3,13 +3,16 @@ package com.hz.pm.api.projectlib.helper; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.core.util.ArrayUtil; | |||
import cn.hutool.json.JSONUtil; | |||
import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.hz.pm.api.common.enumeration.CommonEnum; | |||
import com.hz.pm.api.performance.model.dto.ProjectCoreBusinessDTO; | |||
import com.hz.pm.api.performance.model.entity.ProjectCoreBusinessIndicators; | |||
import com.hz.pm.api.performance.service.IProjectCoreBusinessIndicatorsService; | |||
import com.hz.pm.api.projectlib.entity.ProjectGovSystemReplaceInfos; | |||
import com.hz.pm.api.projectlib.model.dto.GovSystemReplaceInfoUpgradeContentDTO; | |||
import com.hz.pm.api.projectlib.model.dto.GovSystemReplaceInfoDTO; | |||
import com.hz.pm.api.projectlib.model.dto.ProjectDTO; | |||
import com.hz.pm.api.projectlib.model.dto.ProjectPaymentPlanDTO; | |||
@@ -19,6 +22,7 @@ import com.hz.pm.api.projectlib.model.entity.ProjectApplication; | |||
import com.hz.pm.api.projectlib.service.IProjectAnnualPaymentPlanService; | |||
import com.hz.pm.api.projectlib.service.IProjectApplicationService; | |||
import com.hz.pm.api.projectlib.service.IProjectGovSystemReplaceInfosService; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.user.security.model.UserInfoDetails; | |||
import com.hz.pm.api.user.util.LoginUserUtil; | |||
import lombok.RequiredArgsConstructor; | |||
@@ -44,6 +48,7 @@ import java.util.stream.Collectors; | |||
@RequiredArgsConstructor | |||
public class ProjectSaveHelper { | |||
private final IProjectService projectService; | |||
private final IProjectApplicationService projectApplicationService; | |||
private final IProjectGovSystemReplaceInfosService projectGovSystemReplaceInfosService; | |||
private final IProjectCoreBusinessIndicatorsService projectCoreBusinessIndicatorsService; | |||
@@ -142,27 +147,40 @@ public class ProjectSaveHelper { | |||
Wrapper<ProjectGovSystemReplaceInfos> delQuery = Wrappers.lambdaQuery(ProjectGovSystemReplaceInfos.class) | |||
.eq(ProjectGovSystemReplaceInfos::getProjectCode, projectCode); | |||
projectGovSystemReplaceInfosService.remove(delQuery); | |||
if (CollUtil.isEmpty(systemReplaceInfos)) { | |||
return; | |||
} | |||
List<ProjectGovSystemReplaceInfos> replaceInfos = new ArrayList<>(); | |||
for (int i = 0; i < systemReplaceInfos.size(); i++) { | |||
GovSystemReplaceInfoDTO curr = systemReplaceInfos.get(i); | |||
for (int i1 = 0; i1 < curr.getSourceSystemNames().size(); i1++) { | |||
ProjectGovSystemReplaceInfos replaceInfo = new ProjectGovSystemReplaceInfos(); | |||
replaceInfo.setProjectId(projectId); | |||
replaceInfo.setProjectCode(projectCode); | |||
replaceInfo.setReplaceType(curr.getReplaceType()); | |||
replaceInfo.setSourceSystem(curr.getSourceSystemNames().get(i1)); | |||
replaceInfo.setTargetSystem(curr.getTargetSystemName()); | |||
replaceInfo.setBatchNo(i + 1); | |||
if (ArrayUtil.isNotEmpty(curr.getSourceSystemIds())) { | |||
replaceInfo.setSourceSystemId(curr.getSourceSystemIds().get(i1)); | |||
LambdaUpdateWrapper<Project> projectUpdate = Wrappers.lambdaUpdate(Project.class) | |||
.eq(Project::getProjectCode, projectCode) | |||
.eq(Project::getNewest, Boolean.TRUE); | |||
if (CollUtil.isNotEmpty(systemReplaceInfos)) { | |||
List<ProjectGovSystemReplaceInfos> replaceInfos = new ArrayList<>(); | |||
List<GovSystemReplaceInfoUpgradeContentDTO> upgradeContents = new ArrayList<>(); | |||
for (int i = 0; i < systemReplaceInfos.size(); i++) { | |||
int batchNo = i + 1; | |||
GovSystemReplaceInfoDTO curr = systemReplaceInfos.get(i); | |||
for (int i1 = 0; i1 < curr.getSourceSystemNames().size(); i1++) { | |||
ProjectGovSystemReplaceInfos replaceInfo = new ProjectGovSystemReplaceInfos(); | |||
replaceInfo.setProjectId(projectId); | |||
replaceInfo.setProjectCode(projectCode); | |||
replaceInfo.setReplaceType(curr.getReplaceType()); | |||
replaceInfo.setSourceSystem(curr.getSourceSystemNames().get(i1)); | |||
replaceInfo.setTargetSystem(curr.getTargetSystemName()); | |||
replaceInfo.setBatchNo(batchNo); | |||
if (ArrayUtil.isNotEmpty(curr.getSourceSystemIds())) { | |||
replaceInfo.setSourceSystemId(curr.getSourceSystemIds().get(i1)); | |||
} | |||
replaceInfos.add(replaceInfo); | |||
} | |||
replaceInfos.add(replaceInfo); | |||
GovSystemReplaceInfoUpgradeContentDTO upgradeContent = new GovSystemReplaceInfoUpgradeContentDTO(); | |||
upgradeContent.setBatchNo(batchNo); | |||
upgradeContent.setIterativeUpgradeContent(curr.getIterativeUpgradeContent()); | |||
upgradeContent.setIsAddIterativeUpgradeContent(curr.getIsAddIterativeUpgradeContent()); | |||
upgradeContents.add(upgradeContent); | |||
} | |||
projectUpdate.set(Project::getIterativeUpgradeContent, JSONUtil.toJsonStr(upgradeContents)); | |||
projectGovSystemReplaceInfosService.saveBatch(replaceInfos); | |||
} else { | |||
projectUpdate.set(Project::getIterativeUpgradeContent, null); | |||
} | |||
projectGovSystemReplaceInfosService.saveBatch(replaceInfos); | |||
projectService.update(projectUpdate); | |||
} | |||
} |
@@ -2,11 +2,14 @@ package com.hz.pm.api.projectlib.manage; | |||
import cn.hutool.core.util.NumberUtil; | |||
import cn.hutool.core.util.StrUtil; | |||
import cn.hutool.poi.excel.ExcelUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.hz.pm.api.common.exception.ReturnException; | |||
import com.hz.pm.api.projectlib.entity.ProjectGovSystemReplaceInfos; | |||
import com.hz.pm.api.projectlib.model.dto.GovSystemReplaceInfoDTO; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.enumeration.GovSystemReplaceTypeEnum; | |||
import com.hz.pm.api.projectlib.model.vo.SystemReplaceInfoVO; | |||
import com.hz.pm.api.projectlib.model.vo.UnitProjectGovSystemReplaceVO; | |||
import com.hz.pm.api.projectlib.model.vo.UnitProjectGovSystemReplaceVO.ProjectGovSystemReplaceVO; | |||
@@ -18,10 +21,9 @@ import com.ningdatech.basic.util.CollUtils; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.stereotype.Component; | |||
import java.util.ArrayList; | |||
import java.util.Comparator; | |||
import java.util.List; | |||
import java.util.Map; | |||
import javax.servlet.ServletOutputStream; | |||
import javax.servlet.http.HttpServletResponse; | |||
import java.util.*; | |||
import java.util.concurrent.atomic.AtomicInteger; | |||
import java.util.stream.Collectors; | |||
@@ -112,4 +114,34 @@ public class ProjectGovSystemReplaceInfoManage { | |||
return retDetail; | |||
} | |||
public void downTmp(HttpServletResponse response) { | |||
List<ProjectGovSystemReplaceInfos> replaceInfos = systemReplaceInfosService.list(); | |||
replaceInfos.removeIf(w -> StrUtil.isNotBlank(w.getSourceSystemId())); | |||
if (replaceInfos.isEmpty()) { | |||
throw ReturnException.wrap("暂无数据可供导出"); | |||
} | |||
for (ProjectGovSystemReplaceInfos replaceInfo : replaceInfos) { | |||
if (StrUtil.isNotBlank(replaceInfo.getReplaceType())) { | |||
String replaceType = replaceInfo.getReplaceType(); | |||
String[] split = replaceType.split(","); | |||
String replaceTypeStr = Arrays.stream(split) | |||
.filter(NumberUtil::isNumber) | |||
.map(w -> GovSystemReplaceTypeEnum.getVal(Integer.parseInt(w))) | |||
.collect(Collectors.joining(",")); | |||
replaceInfo.setReplaceType(replaceTypeStr); | |||
} else { | |||
replaceInfo.setReplaceType(StrUtil.EMPTY); | |||
} | |||
} | |||
try (ServletOutputStream sos = response.getOutputStream()) { | |||
response.setContentType("application/vnd.ms-excel"); | |||
ExcelUtil.getWriter() | |||
.write(replaceInfos) | |||
.flush(sos) | |||
.close(); | |||
} catch (Exception e) { | |||
throw ReturnException.wrap("导出失败"); | |||
} | |||
} | |||
} |
@@ -5,6 +5,7 @@ import cn.hutool.core.bean.copier.CopyOptions; | |||
import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.core.lang.Assert; | |||
import cn.hutool.core.util.NumberUtil; | |||
import cn.hutool.json.JSONUtil; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
@@ -60,6 +61,7 @@ import com.hz.pm.api.projectlib.handle.ProcessProgressHelper; | |||
import com.hz.pm.api.projectlib.helper.ProjectManageUtil; | |||
import com.hz.pm.api.projectlib.helper.ProjectSaveHelper; | |||
import com.hz.pm.api.projectlib.model.constant.ProjectConstant; | |||
import com.hz.pm.api.projectlib.model.dto.GovSystemReplaceInfoUpgradeContentDTO; | |||
import com.hz.pm.api.projectlib.model.dto.GovSystemReplaceInfoDTO; | |||
import com.hz.pm.api.projectlib.model.dto.ProjectApprovalAmountDTO; | |||
import com.hz.pm.api.projectlib.model.dto.ProjectDTO; | |||
@@ -676,7 +678,7 @@ public class ProjectLibManage { | |||
* @param projectId \ | |||
* @return \ | |||
*/ | |||
private List<GovSystemReplaceInfoDTO> getGovSystemReplaceInfos(Long projectId) { | |||
private List<GovSystemReplaceInfoDTO> getGovSystemReplaceInfos(Long projectId, String upgradeContent) { | |||
Wrapper<ProjectGovSystemReplaceInfos> query = Wrappers.lambdaQuery(ProjectGovSystemReplaceInfos.class) | |||
.eq(ProjectGovSystemReplaceInfos::getProjectId, projectId) | |||
.orderByAsc(ProjectGovSystemReplaceInfos::getId) | |||
@@ -685,6 +687,11 @@ public class ProjectLibManage { | |||
if (govSystemReplaceInfos.isEmpty()) { | |||
return Collections.emptyList(); | |||
} | |||
Map<Integer, GovSystemReplaceInfoUpgradeContentDTO> upgradeContentMap = new HashMap<>(); | |||
if (StrUtil.isNotBlank(upgradeContent)) { | |||
List<GovSystemReplaceInfoUpgradeContentDTO> upgradeContents = JSONUtil.toList(upgradeContent, GovSystemReplaceInfoUpgradeContentDTO.class); | |||
upgradeContentMap.putAll(CollUtils.listToMap(upgradeContents, GovSystemReplaceInfoUpgradeContentDTO::getBatchNo)); | |||
} | |||
Map<Integer, List<ProjectGovSystemReplaceInfos>> replaceInfoGroup = CollUtils.group(govSystemReplaceInfos, ProjectGovSystemReplaceInfos::getBatchNo); | |||
return replaceInfoGroup.entrySet().stream() | |||
.sorted(Comparator.comparingInt(Map.Entry::getKey)) | |||
@@ -696,6 +703,10 @@ public class ProjectLibManage { | |||
replaceInfo.setTargetSystemName(firstReplaceInfo.getTargetSystem()); | |||
List<String> sourceSystemNames = CollUtils.fieldList(currBatchValues, ProjectGovSystemReplaceInfos::getSourceSystem); | |||
replaceInfo.setSourceSystemNames(sourceSystemNames); | |||
Optional.ofNullable(upgradeContentMap.get(w.getKey())).ifPresent(uc -> { | |||
replaceInfo.setIterativeUpgradeContent(uc.getIterativeUpgradeContent()); | |||
replaceInfo.setIsAddIterativeUpgradeContent(uc.getIsAddIterativeUpgradeContent()); | |||
}); | |||
return replaceInfo; | |||
}).collect(Collectors.toList()); | |||
} | |||
@@ -720,7 +731,7 @@ public class ProjectLibManage { | |||
Map<Long, List<ProjectCoreBusinessIndicators>> coreBizMap = CollUtils.group(coreBizs, ProjectCoreBusinessIndicators::getApplicationId); | |||
retProjectDetail.setProjectApplications(CollUtils.convert(applications, app -> ProjectManageUtil.to(app, coreBizMap))); | |||
} | |||
retProjectDetail.setSystemReplaceInfos(getGovSystemReplaceInfos(project.getId())); | |||
retProjectDetail.setSystemReplaceInfos(getGovSystemReplaceInfos(project.getId(), project.getIterativeUpgradeContent())); | |||
//审批信息 | |||
if (StrUtils.isNotBlank(project.getInstCode())) { | |||
ProcessDetailReq req = new ProcessDetailReq(); | |||
@@ -39,6 +39,12 @@ public class GovSystemReplaceInfoDTO implements Serializable { | |||
@ApiModelProperty("替代前系统id") | |||
private List<String> sourceSystemIds; | |||
@ApiModelProperty("是否新增迭代升级内容") | |||
private Boolean isAddIterativeUpgradeContent; | |||
@ApiModelProperty("迭代升级内容") | |||
private String iterativeUpgradeContent; | |||
@Override | |||
public boolean equals(Object o) { | |||
if (this == o) { | |||
@@ -0,0 +1,26 @@ | |||
package com.hz.pm.api.projectlib.model.dto; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
/** | |||
* <p> | |||
* GOvSystemReplaceInfoUpgradeContent | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 14:03 2024/10/14 | |||
*/ | |||
@Data | |||
public class GovSystemReplaceInfoUpgradeContentDTO { | |||
@ApiModelProperty("保存时批次号") | |||
private Integer batchNo; | |||
@ApiModelProperty("是否新增迭代升级内容") | |||
private Boolean isAddIterativeUpgradeContent; | |||
@ApiModelProperty("迭代升级内容") | |||
private String iterativeUpgradeContent; | |||
} |
@@ -503,4 +503,7 @@ public class Project implements Serializable { | |||
@ApiModelProperty("是否是重大项目") | |||
private Boolean isMajorProject; | |||
@ApiModelProperty("迭代升级内容") | |||
private String iterativeUpgradeContent; | |||
} |
@@ -143,4 +143,12 @@ public class ProjectListReq extends PagePo { | |||
return NumberUtil.parseLong(tmpBuildOrgCode, null); | |||
} | |||
public Integer clearStatus() { | |||
Integer tmpStatus = this.getStatus(); | |||
if (tmpStatus != null) { | |||
this.setStatus(null); | |||
} | |||
return tmpStatus; | |||
} | |||
} |
@@ -74,12 +74,25 @@ public class UserTaskCreateOrFinishListener { | |||
@EventListener(classes = NodeCreateEvent.class) | |||
public void onEvent(NodeCreateEvent event) { | |||
SCHEDULER.schedule(() -> handleEvent(event), instantDelay10s()); | |||
SCHEDULER.schedule(() -> { | |||
try { | |||
handleEvent(event); | |||
} catch (Exception e) { | |||
log.error("任务节点创建监听异常:{}", event, e); | |||
} | |||
}, instantDelay10s()); | |||
} | |||
@EventListener(classes = NodeCompleteEvent.class) | |||
public void onEvent(NodeCompleteEvent event) { | |||
SCHEDULER.schedule(() -> handleEvent(event), instantDelay10s()); | |||
SCHEDULER.schedule(() -> { | |||
try { | |||
handleEvent(event); | |||
} catch (Exception e) { | |||
log.error("任务节点完成监听异常:{}", event, e); | |||
} | |||
}, instantDelay10s()); | |||
} | |||
public void handleEvent(NodeCreateEvent event) { | |||
@@ -15,7 +15,10 @@ import com.google.common.collect.Sets; | |||
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.statemachine.event.AbstractStateChangeEvent; | |||
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; | |||
import com.hz.pm.api.common.statemachine.event.TenderStateChangeEvent; | |||
import com.hz.pm.api.common.statemachine.event.XcfhxStateChangeEvent; | |||
import com.hz.pm.api.common.util.DecimalUtil; | |||
import com.hz.pm.api.projectdeclared.model.entity.Contract; | |||
import com.hz.pm.api.projectdeclared.model.entity.Purchase; | |||
@@ -86,6 +89,10 @@ import java.util.function.BiFunction; | |||
import java.util.function.Predicate; | |||
import java.util.stream.Collectors; | |||
import static com.hz.pm.api.common.statemachine.event.AdaptStateChangeEvent.ADAPT_INFO_PASSED; | |||
import static com.hz.pm.api.common.statemachine.event.SelfTestStateChangeEvent.SELF_TEST_PASSED; | |||
import static com.hz.pm.api.common.statemachine.event.TenderStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM; | |||
import static com.hz.pm.api.common.statemachine.event.TestValidStateChangeEvent.TEST_VALID_INFO_PASSED; | |||
import static com.hz.pm.api.projectlib.helper.ProjectManageUtil.projectQueryByProjectStatusChange; | |||
import static com.hz.pm.api.workbench.model.vo.ProjectProcessStatVO.TenderAdaptFinishStatVO; | |||
@@ -355,6 +362,13 @@ public class WorkbenchManage { | |||
List<Project> projects = projectService.list(query); | |||
Map<String, List<ProjectStatusChange>> projectStatusChangeMap = new HashMap<>(); | |||
for (WorkbenchProcessNode node : WorkbenchProcessNode.ALL) { | |||
if (Arrays.asList(WorkbenchProcessNode.FINISHED, | |||
WorkbenchProcessNode.SUBMIT_START_FILE, | |||
WorkbenchProcessNode.ORG_CONFIRM, | |||
WorkbenchProcessNode.SELF_TEST, | |||
WorkbenchProcessNode.TEST_VALID).contains(node)) { | |||
continue; | |||
} | |||
if (!projects.isEmpty()) { | |||
ProjectProcessStatVO currStat = ProjectProcessStatVO.builder() | |||
.stageName(node.getName()) | |||
@@ -436,13 +450,13 @@ public class WorkbenchManage { | |||
.select(PurchaseStatusChange::getEvent, PurchaseStatusChange::getProjectId) | |||
.in(PurchaseStatusChange::getProjectId, projectIds) | |||
.in(PurchaseStatusChange::getEvent, | |||
AdaptStateChangeEvent.ADAPT_INFO_PASSED, | |||
SelfTestStateChangeEvent.SELF_TEST_PASSED, | |||
TestValidStateChangeEvent.TEST_VALID_INFO_PASSED, | |||
ADAPT_INFO_PASSED, | |||
SELF_TEST_PASSED, | |||
TEST_VALID_INFO_PASSED, | |||
TenderStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES, | |||
XcfhxStateChangeEvent.XCFHX_APPLY_PASSED, | |||
TenderStateChangeEvent.FINALLY_INSPECTED_PASSED, | |||
TenderStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM, | |||
SUBMIT_PURCHASE_ORG_CONFIRM, | |||
TenderStateChangeEvent.SUBMIT_PURCHASE_CONSTRUCTION_INFO); | |||
List<PurchaseStatusChange> purchaseChanges = purchaseStatusChangeService.list(pQuery); | |||
Map<String, Map<Long, Long>> purchaseEventMapTmp = purchaseChanges.stream() | |||
@@ -454,7 +468,7 @@ public class WorkbenchManage { | |||
} | |||
break; | |||
case PROJECT_ADAPTION: { | |||
List<Long> projectIds = computeProjectIds.apply(TenderStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM, node); | |||
List<Long> projectIds = computeProjectIds.apply(SUBMIT_PURCHASE_ORG_CONFIRM, node); | |||
currStat.setProjectCount(projectIds.size()); | |||
Pair<Integer, Integer> replaceSystemCount = countReplaceSystemByProjectIds(projectIds); | |||
currStat.setSourceCount(replaceSystemCount.getKey()); | |||
@@ -468,7 +482,7 @@ public class WorkbenchManage { | |||
.map(Map.Entry::getKey) | |||
.collect(Collectors.toList()); | |||
if (!tmpProjectIds.isEmpty()) { | |||
currStat.setAdaptFinishStat(tenderAdaptStatistics(tmpProjectIds)); | |||
currStat.setAdaptFinishStat(tenderAdaptStatistics(tmpProjectIds, projectPurchaseCountMap)); | |||
} | |||
} | |||
long finishPurchaseByWithoutApp = CollUtil.count(projectPurchaseCountMap.entrySet(), w -> { | |||
@@ -514,26 +528,42 @@ public class WorkbenchManage { | |||
return retData; | |||
} | |||
private TenderAdaptFinishStatVO tenderAdaptStatistics(List<Long> projectIds) { | |||
private TenderAdaptFinishStatVO tenderAdaptStatistics(List<Long> projectIds, Map<Long, List<Purchase>> projectPurchaseCountMap) { | |||
Wrapper<PurchaseStatusChange> purchaseQuery = Wrappers.lambdaQuery(PurchaseStatusChange.class) | |||
.select(PurchaseStatusChange::getEvent, PurchaseStatusChange::getBidId) | |||
.select(PurchaseStatusChange::getEvent, PurchaseStatusChange::getBidId, PurchaseStatusChange::getProjectId) | |||
.in(PurchaseStatusChange::getProjectId, projectIds) | |||
.in(PurchaseStatusChange::getEvent, AdaptStateChangeEvent.SUBMIT_ADAPT_INFO, | |||
SelfTestStateChangeEvent.SUBMIT_SELF_TEST_INFO, | |||
TestValidStateChangeEvent.SUBMIT_TEST_VALID_INFO, | |||
TenderStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM); | |||
.in(PurchaseStatusChange::getEvent, ADAPT_INFO_PASSED, | |||
SELF_TEST_PASSED, | |||
TEST_VALID_INFO_PASSED, | |||
SUBMIT_PURCHASE_ORG_CONFIRM); | |||
List<PurchaseStatusChange> statusChanges = purchaseStatusChangeService.list(purchaseQuery); | |||
Map<String, Integer> eventMap = statusChanges.stream() | |||
.collect(Collectors.groupingBy(PurchaseStatusChange::getEvent, | |||
Collectors.collectingAndThen(Collectors.mapping(PurchaseStatusChange::getBidId, Collectors.toSet()), Set::size))); | |||
Map<Long, List<PurchaseStatusChange>> projectPurchaseStatusChangeMap = CollUtils.group(statusChanges, PurchaseStatusChange::getProjectId); | |||
TenderAdaptFinishStatVO stat = new TenderAdaptFinishStatVO(); | |||
stat.setFinishTestValidCount(eventMap.getOrDefault(TestValidStateChangeEvent.SUBMIT_TEST_VALID_INFO.name(), 0)); | |||
stat.setFinishAdaptionInfo(eventMap.getOrDefault(AdaptStateChangeEvent.SUBMIT_ADAPT_INFO.name(), 0)); | |||
stat.setFinishOrgConfirmCount(eventMap.getOrDefault(TenderStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM.name(), 0)); | |||
stat.setFinishSelfTestCount(eventMap.getOrDefault(SelfTestStateChangeEvent.SUBMIT_SELF_TEST_INFO.name(), 0)); | |||
stat.setFinishTestValidCount(countAdaptBranchStatus(TEST_VALID_INFO_PASSED, projectIds, projectPurchaseCountMap, projectPurchaseStatusChangeMap)); | |||
stat.setFinishAdaptionInfo(countAdaptBranchStatus(ADAPT_INFO_PASSED, projectIds, projectPurchaseCountMap, projectPurchaseStatusChangeMap)); | |||
stat.setFinishOrgConfirmCount(countAdaptBranchStatus(SUBMIT_PURCHASE_ORG_CONFIRM, projectIds, projectPurchaseCountMap, projectPurchaseStatusChangeMap)); | |||
stat.setFinishSelfTestCount(countAdaptBranchStatus(SELF_TEST_PASSED, projectIds, projectPurchaseCountMap, projectPurchaseStatusChangeMap)); | |||
return stat; | |||
} | |||
private static <T extends AbstractStateChangeEvent> int countAdaptBranchStatus(T event, | |||
List<Long> projectIds, | |||
Map<Long, List<Purchase>> projectPurchaseCountMap, | |||
Map<Long, List<PurchaseStatusChange>> projectPurchaseChangeMap) { | |||
return (int) projectIds.stream().filter(w -> { | |||
int bidCount = CollUtil.count(projectPurchaseCountMap.getOrDefault(w, Collections.emptyList()), | |||
w1 -> BidTypeEnum.BUILD_APP.eq(w1.getBidType())); | |||
List<PurchaseStatusChange> purchaseStatusChanges = projectPurchaseChangeMap.getOrDefault(w, Collections.emptyList()); | |||
int finishedBidCount = purchaseStatusChanges.stream() | |||
.filter(w1 -> w1.getProjectId().equals(w) && event.eq(w1.getEvent())) | |||
.map(PurchaseStatusChange::getBidId) | |||
.collect(Collectors.toSet()).size(); | |||
return finishedBidCount != 0 && finishedBidCount == bidCount; | |||
}).count(); | |||
} | |||
private static int stoppedProjectCount(Map<String, List<ProjectStatusChange>> projectStatusChangeMap, List<String> projectCodes) { | |||
return CollUtil.count(projectStatusChangeMap.entrySet(), | |||
w -> projectCodes.contains(w.getKey()) | |||
@@ -552,6 +582,9 @@ public class WorkbenchManage { | |||
public PageVo<ProjectLibListItemVO> pageProjectLib(WorkbenchProjectLibReq req) { | |||
LambdaQueryWrapper<Project> query = workbenchProjectLibQuery(req); | |||
if (query == null) { | |||
return PageVo.empty(); | |||
} | |||
ProjectManageUtil.projectBaseQuery(query); | |||
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.PROJECT_APPLICATION_SUBMIT); | |||
switch (req.getProcessNode()) { | |||
@@ -572,12 +605,33 @@ public class WorkbenchManage { | |||
case FIRST_INSPECTED: | |||
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES); | |||
break; | |||
case ORG_CONFIRM: | |||
case PROJECT_ADAPTION: | |||
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM); | |||
break; | |||
case FINAL_INSPECTED: | |||
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.FINAL_ACCEPTANCE_PASS); | |||
break; | |||
case FINISHED: | |||
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.SUBMIT_PURCHASE_CONTRACT_RECORD); | |||
query.notExists("select 1 from nd_purchase np where np.project_id = nd_project.id and bid_type = {0}", | |||
BidTypeEnum.BUILD_APP.getCode()); | |||
break; | |||
case TEST_VALID: | |||
query.apply("(select count(1) from nd_purchase np where np.project_id = nd_project.id and bid_type = {0}) " + | |||
"= (select count(distinct bid_id) from nd_purchase_status_change npsc where npsc.project_code = nd_project.project_code " + | |||
"and event = {1})", BidTypeEnum.BUILD_APP.getCode(), TEST_VALID_INFO_PASSED); | |||
break; | |||
case SELF_TEST: | |||
query.apply("(select count(1) from nd_purchase np where np.project_id = nd_project.id and bid_type = {0}) " + | |||
"= (select count(distinct bid_id) from nd_purchase_status_change npsc where npsc.project_code = nd_project.project_code " + | |||
"and event = {1})", BidTypeEnum.BUILD_APP.getCode(), SELF_TEST_PASSED); | |||
break; | |||
case SUBMIT_START_FILE: | |||
query.apply("(select count(1) from nd_purchase np where np.project_id = nd_project.id and bid_type = {0}) " + | |||
"= (select count(distinct bid_id) from nd_purchase_status_change npsc where npsc.project_code = nd_project.project_code " + | |||
"and event = {1})", BidTypeEnum.BUILD_APP.getCode(), ADAPT_INFO_PASSED); | |||
break; | |||
default: | |||
return PageVo.empty(); | |||
} | |||
@@ -606,9 +660,12 @@ public class WorkbenchManage { | |||
} | |||
public SystemReplaceInfoVO listSystemReplaceInfos(WorkbenchProjectLibReq req) { | |||
LambdaQueryWrapper<Project> query = workbenchProjectLibQuery(req) | |||
.select(Project::getProjectCode, Project::getProjectName, | |||
Project::getBuildOrgCode, Project::getBuildOrgName); | |||
LambdaQueryWrapper<Project> query = workbenchProjectLibQuery(req); | |||
if (query == null) { | |||
return null; | |||
} | |||
query.select(Project::getProjectCode, Project::getProjectName, | |||
Project::getBuildOrgCode, Project::getBuildOrgName); | |||
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.PROJECT_APPLICATION_SUBMIT); | |||
switch (req.getProcessNode()) { | |||
case PROJECT_DECLARED: | |||
@@ -643,13 +700,15 @@ public class WorkbenchManage { | |||
private LambdaQueryWrapper<Project> workbenchProjectLibQuery(WorkbenchProjectLibReq req) { | |||
Assert.notNull(req.getProcessNode(), "节点不能为空"); | |||
Long unitId = Optional.ofNullable(req.getUnitId()).orElseGet(LoginUserUtil::getMhUnitId); | |||
List<Long> viewUnitIds = mhUnitCache.getViewChildIdsRecursion(unitId); | |||
return Wrappers.lambdaQuery(Project.class) | |||
Long unitId = req.getUnitId(); | |||
UnitQueryState unitQueryState = mhUnitQueryAuthHelper.listCanViewUnitIds(unitId); | |||
if (!unitQueryState.isState()) { | |||
return null; | |||
} | |||
LambdaQueryWrapper<Project> query = Wrappers.lambdaQuery(Project.class) | |||
.eq(req.getProjectYear() != null, Project::getProjectYear, req.getProjectYear()) | |||
.like(StrUtil.isNotBlank(req.getBuildOrg()), Project::getBuildOrgName, req.getBuildOrg()) | |||
.like(StrUtil.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()) | |||
.in(Project::getBuildOrgCode, CollUtils.convert(viewUnitIds, String::valueOf)) | |||
.ge(req.getReviewAmountMin() != null, Project::getReviewAmount, req.getReviewAmountMin()) | |||
.le(req.getReviewAmountMax() != null, Project::getReviewAmount, req.getReviewAmountMax()) | |||
.ge(req.getApproveAmountMin() != null, Project::getApprovalAmount, req.getApproveAmountMin()) | |||
@@ -657,6 +716,11 @@ public class WorkbenchManage { | |||
.eq(req.getUnitStrip() != null, Project::getUnitStrip, req.getUnitStrip()) | |||
.eq(Project::getNewest, Boolean.TRUE) | |||
.orderByDesc(Project::getUpdateOn); | |||
List<Long> unitIds = unitQueryState.getUnitIds(); | |||
if (CollUtil.isNotEmpty(unitIds)) { | |||
query.in(Project::getBuildOrgCode, CollUtils.convert(unitIds, String::valueOf)); | |||
} | |||
return query; | |||
} | |||
private SystemReplaceInfoVO buildSystemReplaceInfos(List<Project> projects) { | |||
@@ -27,7 +27,12 @@ public enum WorkbenchProcessNode { | |||
PROJECT_PURCHASE("已采购", 5), | |||
PROJECT_ADAPTION("已适配改造", 6), | |||
FIRST_INSPECTED("已初验", 9), | |||
FINAL_INSPECTED("已终验", 12); | |||
FINAL_INSPECTED("已终验", 12), | |||
FINISHED("已完成", 13), | |||
SUBMIT_START_FILE("上传开工文件", 10), | |||
TEST_VALID("监理核实验证", 14), | |||
SELF_TEST("系统自测", 15), | |||
ORG_CONFIRM("单位确认", 16); | |||
private final String name; | |||