Bladeren bron

修改项目库状态

tags/24080901
WendyYang 8 maanden geleden
bovenliggende
commit
73b673f95d
8 gewijzigde bestanden met toevoegingen van 120 en 51 verwijderingen
  1. +16
    -12
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectDeclareHandle.java
  2. +16
    -12
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectReviewHandle.java
  3. +1
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectManageUtil.java
  4. +5
    -14
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java
  5. +6
    -6
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectDTO.java
  6. +3
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/Project.java
  7. +3
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java
  8. +70
    -7
      hz-pm-api/src/test/java/com/hz/pm/api/todocenter/MhApiClientTest.java

+ 16
- 12
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectDeclareHandle.java Bestand weergeven

@@ -62,22 +62,26 @@ public class ProjectDeclareHandle extends AbstractProcessHandle {
w -> InstTypeEnum.getNoNull(w.getInstType()),
Comparator.comparing(ProjectInst::getCreateOn).reversed());
ctx.setProjectInstMap(instMap);
ProjectInst inst = instMap.get(InstTypeEnum.COMPLIANCE_REVIEW);
if (inst == null) {
detail.setStepStatus(StepStatusEnum.NOT_START);
} else {
Optional<ProjectStatusChange> event = eventMap.values().stream()
.filter(w -> PROJECT_APPLICATION_SUBMIT.eq(w.getEvent())
|| COMPLIANCE_REVIEW_FAILED.eq(w.getEvent())
|| COMPLIANCE_REVIEW_RESUBMIT.eq(w.getEvent())
|| COMPLIANCE_REVIEW_PASS.eq(w.getEvent())
).max(Comparator.comparing(ProjectStatusChange::getCreateOn));
if (event.isPresent()) {
Optional<ProjectStatusChange> event = eventMap.values().stream()
.filter(w -> PROJECT_APPLICATION_SUBMIT.eq(w.getEvent())
|| COMPLIANCE_REVIEW_FAILED.eq(w.getEvent())
|| COMPLIANCE_REVIEW_RESUBMIT.eq(w.getEvent())
|| COMPLIANCE_REVIEW_PASS.eq(w.getEvent())
).max(Comparator.comparing(ProjectStatusChange::getCreateOn));
if (event.isPresent()) {
ProjectStatusChange change = event.get();
ProjectInst inst = instMap.get(InstTypeEnum.COMPLIANCE_REVIEW);
if (COMPLIANCE_REVIEW_PASS.eq(change.getEvent()) && inst == null) {
detail.setStepStatus(StepStatusEnum.COMPLETED);
detail.setFinishTime(change.getCreateOn());
} else if (inst != null) {
ProcessProgressVo progress = processInstanceService.getProgressInstanceDetail(null, inst.getInstCode());
buildStepStatus(detail, progress, event.get());
buildStepStatus(detail, progress, change);
} else {
detail.setStepStatus(StepStatusEnum.NOT_START);
}
} else {
detail.setStepStatus(StepStatusEnum.NOT_START);
}
}
ctx.setPreStepStatus(detail.getStepStatus());


+ 16
- 12
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectReviewHandle.java Bestand weergeven

@@ -55,22 +55,26 @@ public class ProjectReviewHandle extends AbstractProcessHandle {
if (!eventMap.containsKey(PROJECT_REVIEW_SUBMIT)) {
detail.setStepStatus(StepStatusEnum.NOT_START);
} else {
ProjectInst inst = ctx.getProjectInstMap().get(InstTypeEnum.PROJECT_REVIEW);
if (inst == null) {
detail.setStepStatus(StepStatusEnum.NOT_START);
} else {
Optional<ProjectStatusChange> event = eventMap.values().stream()
.filter(w -> PROJECT_REVIEW_PASS.eq(w.getEvent())
|| PROJECT_REVIEW_RESUBMIT.eq(w.getEvent())
|| PROJECT_REVIEW_FAILED.eq(w.getEvent())
|| PROJECT_REVIEW_SUBMIT.eq(w.getEvent())
).max(Comparator.comparing(ProjectStatusChange::getCreateOn));
if (event.isPresent()) {
Optional<ProjectStatusChange> event = eventMap.values().stream()
.filter(w -> PROJECT_REVIEW_PASS.eq(w.getEvent())
|| PROJECT_REVIEW_RESUBMIT.eq(w.getEvent())
|| PROJECT_REVIEW_FAILED.eq(w.getEvent())
|| PROJECT_REVIEW_SUBMIT.eq(w.getEvent())
).max(Comparator.comparing(ProjectStatusChange::getCreateOn));
if (event.isPresent()) {
ProjectStatusChange change = event.get();
ProjectInst inst = ctx.getProjectInstMap().get(InstTypeEnum.PROJECT_REVIEW);
if (PROJECT_REVIEW_PASS.eq(change.getEvent()) && inst == null) {
detail.setStepStatus(StepStatusEnum.COMPLETED);
detail.setFinishTime(change.getCreateOn());
} else if (inst != null) {
ProcessProgressVo progress = processInstanceService.getProgressInstanceDetail(null, inst.getInstCode());
buildStepStatus(detail, progress, event.get());
buildStepStatus(detail, progress, change);
} else {
detail.setStepStatus(StepStatusEnum.NOT_START);
}
} else {
detail.setStepStatus(StepStatusEnum.NOT_START);
}
}
ctx.setPreStepStatus(detail.getStepStatus());


+ 1
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectManageUtil.java Bestand weergeven

@@ -69,6 +69,7 @@ public class ProjectManageUtil {
.in(CollUtil.isNotEmpty(req.getInstCodes()), Project::getInstCode, req.getInstCodes())
//已添加评价计划的项目code
.notIn(CollUtil.isNotEmpty(req.getProjectCodes()), Project::getProjectCode, req.getProjectCodes())
.eq(req.getIsStartDeclaredProject() != null, Project::getAnnualPlanOpened, req.getIsStartDeclaredProject())
.orderByDesc(Project::getUpdateOn);
}



+ 5
- 14
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java Bestand weergeven

@@ -1,9 +1,7 @@
package com.hz.pm.api.projectlib.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.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hz.pm.api.common.enumeration.CommonEnum;
import com.hz.pm.api.common.helper.UserInfoHelper;
@@ -18,7 +16,6 @@ import com.hz.pm.api.datascope.utils.DataScopeUtil;
import com.hz.pm.api.projectlib.helper.ProjectManageUtil;
import com.hz.pm.api.projectlib.model.dto.ProjectDTO;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange;
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus;
import com.hz.pm.api.projectlib.model.req.ProjectApprovedReq;
import com.hz.pm.api.projectlib.model.req.ProjectIdReq;
@@ -27,7 +24,6 @@ import com.hz.pm.api.projectlib.model.req.StartProjectDeclareReq;
import com.hz.pm.api.projectlib.model.vo.AnnualPlanListItemVO;
import com.hz.pm.api.projectlib.service.IProjectApplicationService;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.projectlib.service.IProjectStatusChangeService;
import com.hz.pm.api.todocenter.constant.TodoCenterConst;
import com.hz.pm.api.user.helper.MhUnitCache;
import com.hz.pm.api.user.security.model.UserFullInfoDTO;
@@ -67,7 +63,6 @@ public class AnnualPlanLibManage {
private final IProjectApplicationService applicationService;
private final ProjectStateMachineUtil stateMachine;
private final UserInfoHelper userInfoHelper;
private final IProjectStatusChangeService projectStatusChangeService;

public PageVo<AnnualPlanListItemVO> annulPlanLibList(ProjectListReq req) {
LambdaQueryWrapper<Project> query = ProjectManageUtil.initQuery();
@@ -86,13 +81,6 @@ public class AnnualPlanLibManage {
if (total == 0) {
return PageVo.empty();
}
List<String> projCodes = CollUtils.fieldList(page.getRecords(), Project::getProjectCode);
Wrapper<ProjectStatusChange> pscQuery = Wrappers.lambdaQuery(ProjectStatusChange.class)
.select(ProjectStatusChange::getProjectCode)
.eq(ProjectStatusChange::getEvent, ProjectStateChangeEvent.ANNUAL_PLAN_PASS)
.in(ProjectStatusChange::getProjectCode, projCodes);
List<ProjectStatusChange> changes = projectStatusChangeService.list(pscQuery);
List<String> annualPlanProjCodes = CollUtils.fieldList(changes, ProjectStatusChange::getProjectCode);
List<AnnualPlanListItemVO> records = CollUtils.convert(page.getRecords(), w -> {
AnnualPlanListItemVO item = new AnnualPlanListItemVO();
item.setProjectId(w.getId());
@@ -106,7 +94,7 @@ public class AnnualPlanLibManage {
item.setBuildOrg(w.getBuildOrgName());
item.setCreateOn(w.getCreateOn());
item.setApprovalAmount(w.getApprovalAmount());
item.setIsStartDeclaredProject(annualPlanProjCodes.contains(w.getProjectCode()));
item.setIsStartDeclaredProject(w.getAnnualPlanOpened());
return item;
});
return PageVo.of(records, total);
@@ -120,7 +108,10 @@ public class AnnualPlanLibManage {
throw BizException.wrap("开启方案申报失败");
}
});
projects.forEach(stateMachine::pass);
projects.forEach(w -> {
stateMachine.pass(w);
w.setAnnualPlanOpened(Boolean.TRUE);
});
projectService.updateBatchById(projects);
}



+ 6
- 6
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/dto/ProjectDTO.java Bestand weergeven

@@ -146,22 +146,22 @@ public class ProjectDTO {
@ApiModelProperty("项目简介")
private String projectIntroduction;

@ApiModelProperty("资金情况-下达情况-申报金额(总计)(万元)")
@ApiModelProperty("资金情况-申报-申报金额(总计)(万元)")
private BigDecimal declareAmount;

@ApiModelProperty("资金情况-下达情况-自有金额(万元)")
@ApiModelProperty("资金情况-申报-自有金额(万元)")
private BigDecimal declareHaveAmount;

@ApiModelProperty("资金情况-下达情况-政府投资-本级财政资金(万元)")
@ApiModelProperty("资金情况-申报-政府投资-本级财政资金(万元)")
private BigDecimal declareGovOwnFinanceAmount;

@ApiModelProperty("资金情况-下达情况-政府投资-上级补助资金(万元)")
@ApiModelProperty("资金情况-申报-政府投资-上级补助资金(万元)")
private BigDecimal declareGovSuperiorFinanceAmount;

@ApiModelProperty("银行贷款(万元)")
@ApiModelProperty("申报-银行贷款(万元)")
private BigDecimal declareBankLendingAmount;

@ApiModelProperty("其它资金(万元)")
@ApiModelProperty("申报-其它资金(万元)")
private BigDecimal declareOtherAmount;

@ApiModelProperty("申报资金-分配情况-软件开发(万元)")


+ 3
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/Project.java Bestand weergeven

@@ -580,4 +580,7 @@ public class Project implements Serializable {
@ApiModelProperty("置顶")
private Integer topped;

@ApiModelProperty("是否已开启年度计划")
private Boolean annualPlanOpened;

}

+ 3
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java Bestand weergeven

@@ -114,4 +114,7 @@ public class ProjectListReq extends PagePo {

@ApiModelProperty("评审金额最大值")
private BigDecimal reviewAmountMax;

private Boolean isStartDeclaredProject;

}

+ 70
- 7
hz-pm-api/src/test/java/com/hz/pm/api/todocenter/MhApiClientTest.java Bestand weergeven

@@ -1,25 +1,29 @@
package com.hz.pm.api.todocenter;

import cn.hutool.core.io.FileUtil;
import cn.hutool.http.HttpUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.AppTests;
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent;
import com.hz.pm.api.external.MhApiClient;
import com.hz.pm.api.external.MhFileClient;
import com.hz.pm.api.external.model.dto.MhZwddWorkNoticeDTO;
import com.hz.pm.api.external.todo.MHTodoClient;
import com.hz.pm.api.external.todo.dto.MhTodoExtraParamDTO;
import com.hz.pm.api.external.todo.enumerization.MHTodoTypeEnum;
import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil;
import com.hz.pm.api.projectlib.model.entity.MhProject;
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange;
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus;
import com.hz.pm.api.projectlib.service.IMhProjectService;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.projectlib.service.IProjectStatusChangeService;
import com.hz.pm.api.user.security.model.UserFullInfoDTO;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.file.entity.File;
import com.ningdatech.file.entity.vo.result.FileResultVO;
import com.ningdatech.file.service.FileService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Arrays;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
* <p>
@@ -68,4 +72,63 @@ public class MhApiClientTest extends AppTests {
mhApiClient.sendZwddWorkNotice(notice);
}

@Autowired
private IProjectService projectService;
@Autowired
private IProjectStatusChangeService projectStatusChangeService;
@Autowired
private IMhProjectService mhProjectService;


@Test
public void test1() {
List<MhProject> projects = mhProjectService.list();
for (MhProject project : projects) {
if (project.getProjectCode() == null) {
continue;
}
projectStatusChangeService.remove(Wrappers.lambdaQuery(ProjectStatusChange.class)
.in(ProjectStatusChange::getEvent,
ProjectStateChangeEvent.PROJECT_APPLICATION_SUBMIT,
ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS,
ProjectStateChangeEvent.PROJECT_REVIEW_SUBMIT,
ProjectStateChangeEvent.PROJECT_REVIEW_PASS)
.eq(ProjectStatusChange::getProjectCode, project.getProjectCode()));
List<ProjectStatusChange> changes = new ArrayList<>();
changes.add(new ProjectStatusChange() {{
setAfterStatus(ProjectStatus.ON_COMPLIANCE_REVIEW.getCode());
setBeforeStatus(ProjectStatus.TO_BE_DECLARED.getCode());
setEvent(ProjectStateChangeEvent.PROJECT_APPLICATION_SUBMIT.name());
setCreateOn(LocalDateTime.now());
setProjectCode(project.getProjectCode());
setProjectId(ProjectIdCodeCacheUtil.newest(project.getProjectCode()));
}});
changes.add(new ProjectStatusChange() {{
setAfterStatus(ProjectStatus.WITHOUT_PROJECT_REVIEW.getCode());
setBeforeStatus(ProjectStatus.ON_COMPLIANCE_REVIEW.getCode());
setEvent(ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS.name());
setCreateOn(LocalDateTime.now().plusMinutes(1));
setProjectCode(project.getProjectCode());
setProjectId(ProjectIdCodeCacheUtil.newest(project.getProjectCode()));
}});
changes.add(new ProjectStatusChange() {{
setAfterStatus(ProjectStatus.ON_PROJECT_REVIEW.getCode());
setBeforeStatus(ProjectStatus.WITHOUT_PROJECT_REVIEW.getCode());
setEvent(ProjectStateChangeEvent.PROJECT_REVIEW_SUBMIT.name());
setCreateOn(LocalDateTime.now().plusMinutes(2));
setProjectCode(project.getProjectCode());
setProjectId(ProjectIdCodeCacheUtil.newest(project.getProjectCode()));
}});
changes.add(new ProjectStatusChange() {{
setAfterStatus(ProjectStatus.ON_ANNUAL_PLAN.getCode());
setBeforeStatus(ProjectStatus.ON_PROJECT_REVIEW.getCode());
setEvent(ProjectStateChangeEvent.PROJECT_REVIEW_PASS.name());
setCreateOn(LocalDateTime.now().plusMinutes(3));
setProjectCode(project.getProjectCode());
setProjectId(ProjectIdCodeCacheUtil.newest(project.getProjectCode()));
}});
projectStatusChangeService.saveBatch(changes);
}
}

}

Laden…
Annuleren
Opslaan