@@ -62,22 +62,26 @@ public class ProjectDeclareHandle extends AbstractProcessHandle { | |||||
w -> InstTypeEnum.getNoNull(w.getInstType()), | w -> InstTypeEnum.getNoNull(w.getInstType()), | ||||
Comparator.comparing(ProjectInst::getCreateOn).reversed()); | Comparator.comparing(ProjectInst::getCreateOn).reversed()); | ||||
ctx.setProjectInstMap(instMap); | 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()); | ProcessProgressVo progress = processInstanceService.getProgressInstanceDetail(null, inst.getInstCode()); | ||||
buildStepStatus(detail, progress, event.get()); | |||||
buildStepStatus(detail, progress, change); | |||||
} else { | } else { | ||||
detail.setStepStatus(StepStatusEnum.NOT_START); | detail.setStepStatus(StepStatusEnum.NOT_START); | ||||
} | } | ||||
} else { | |||||
detail.setStepStatus(StepStatusEnum.NOT_START); | |||||
} | } | ||||
} | } | ||||
ctx.setPreStepStatus(detail.getStepStatus()); | ctx.setPreStepStatus(detail.getStepStatus()); | ||||
@@ -55,22 +55,26 @@ public class ProjectReviewHandle extends AbstractProcessHandle { | |||||
if (!eventMap.containsKey(PROJECT_REVIEW_SUBMIT)) { | if (!eventMap.containsKey(PROJECT_REVIEW_SUBMIT)) { | ||||
detail.setStepStatus(StepStatusEnum.NOT_START); | detail.setStepStatus(StepStatusEnum.NOT_START); | ||||
} else { | } 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()); | ProcessProgressVo progress = processInstanceService.getProgressInstanceDetail(null, inst.getInstCode()); | ||||
buildStepStatus(detail, progress, event.get()); | |||||
buildStepStatus(detail, progress, change); | |||||
} else { | } else { | ||||
detail.setStepStatus(StepStatusEnum.NOT_START); | detail.setStepStatus(StepStatusEnum.NOT_START); | ||||
} | } | ||||
} else { | |||||
detail.setStepStatus(StepStatusEnum.NOT_START); | |||||
} | } | ||||
} | } | ||||
ctx.setPreStepStatus(detail.getStepStatus()); | ctx.setPreStepStatus(detail.getStepStatus()); | ||||
@@ -69,6 +69,7 @@ public class ProjectManageUtil { | |||||
.in(CollUtil.isNotEmpty(req.getInstCodes()), Project::getInstCode, req.getInstCodes()) | .in(CollUtil.isNotEmpty(req.getInstCodes()), Project::getInstCode, req.getInstCodes()) | ||||
//已添加评价计划的项目code | //已添加评价计划的项目code | ||||
.notIn(CollUtil.isNotEmpty(req.getProjectCodes()), Project::getProjectCode, req.getProjectCodes()) | .notIn(CollUtil.isNotEmpty(req.getProjectCodes()), Project::getProjectCode, req.getProjectCodes()) | ||||
.eq(req.getIsStartDeclaredProject() != null, Project::getAnnualPlanOpened, req.getIsStartDeclaredProject()) | |||||
.orderByDesc(Project::getUpdateOn); | .orderByDesc(Project::getUpdateOn); | ||||
} | } | ||||
@@ -1,9 +1,7 @@ | |||||
package com.hz.pm.api.projectlib.manage; | package com.hz.pm.api.projectlib.manage; | ||||
import cn.hutool.core.bean.BeanUtil; | 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.conditions.query.LambdaQueryWrapper; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.hz.pm.api.common.enumeration.CommonEnum; | import com.hz.pm.api.common.enumeration.CommonEnum; | ||||
import com.hz.pm.api.common.helper.UserInfoHelper; | 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.helper.ProjectManageUtil; | ||||
import com.hz.pm.api.projectlib.model.dto.ProjectDTO; | 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.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.enumeration.status.ProjectStatus; | ||||
import com.hz.pm.api.projectlib.model.req.ProjectApprovedReq; | import com.hz.pm.api.projectlib.model.req.ProjectApprovedReq; | ||||
import com.hz.pm.api.projectlib.model.req.ProjectIdReq; | 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.model.vo.AnnualPlanListItemVO; | ||||
import com.hz.pm.api.projectlib.service.IProjectApplicationService; | import com.hz.pm.api.projectlib.service.IProjectApplicationService; | ||||
import com.hz.pm.api.projectlib.service.IProjectService; | 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.todocenter.constant.TodoCenterConst; | ||||
import com.hz.pm.api.user.helper.MhUnitCache; | import com.hz.pm.api.user.helper.MhUnitCache; | ||||
import com.hz.pm.api.user.security.model.UserFullInfoDTO; | import com.hz.pm.api.user.security.model.UserFullInfoDTO; | ||||
@@ -67,7 +63,6 @@ public class AnnualPlanLibManage { | |||||
private final IProjectApplicationService applicationService; | private final IProjectApplicationService applicationService; | ||||
private final ProjectStateMachineUtil stateMachine; | private final ProjectStateMachineUtil stateMachine; | ||||
private final UserInfoHelper userInfoHelper; | private final UserInfoHelper userInfoHelper; | ||||
private final IProjectStatusChangeService projectStatusChangeService; | |||||
public PageVo<AnnualPlanListItemVO> annulPlanLibList(ProjectListReq req) { | public PageVo<AnnualPlanListItemVO> annulPlanLibList(ProjectListReq req) { | ||||
LambdaQueryWrapper<Project> query = ProjectManageUtil.initQuery(); | LambdaQueryWrapper<Project> query = ProjectManageUtil.initQuery(); | ||||
@@ -86,13 +81,6 @@ public class AnnualPlanLibManage { | |||||
if (total == 0) { | if (total == 0) { | ||||
return PageVo.empty(); | 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 -> { | List<AnnualPlanListItemVO> records = CollUtils.convert(page.getRecords(), w -> { | ||||
AnnualPlanListItemVO item = new AnnualPlanListItemVO(); | AnnualPlanListItemVO item = new AnnualPlanListItemVO(); | ||||
item.setProjectId(w.getId()); | item.setProjectId(w.getId()); | ||||
@@ -106,7 +94,7 @@ public class AnnualPlanLibManage { | |||||
item.setBuildOrg(w.getBuildOrgName()); | item.setBuildOrg(w.getBuildOrgName()); | ||||
item.setCreateOn(w.getCreateOn()); | item.setCreateOn(w.getCreateOn()); | ||||
item.setApprovalAmount(w.getApprovalAmount()); | item.setApprovalAmount(w.getApprovalAmount()); | ||||
item.setIsStartDeclaredProject(annualPlanProjCodes.contains(w.getProjectCode())); | |||||
item.setIsStartDeclaredProject(w.getAnnualPlanOpened()); | |||||
return item; | return item; | ||||
}); | }); | ||||
return PageVo.of(records, total); | return PageVo.of(records, total); | ||||
@@ -120,7 +108,10 @@ public class AnnualPlanLibManage { | |||||
throw BizException.wrap("开启方案申报失败"); | throw BizException.wrap("开启方案申报失败"); | ||||
} | } | ||||
}); | }); | ||||
projects.forEach(stateMachine::pass); | |||||
projects.forEach(w -> { | |||||
stateMachine.pass(w); | |||||
w.setAnnualPlanOpened(Boolean.TRUE); | |||||
}); | |||||
projectService.updateBatchById(projects); | projectService.updateBatchById(projects); | ||||
} | } | ||||
@@ -146,22 +146,22 @@ public class ProjectDTO { | |||||
@ApiModelProperty("项目简介") | @ApiModelProperty("项目简介") | ||||
private String projectIntroduction; | private String projectIntroduction; | ||||
@ApiModelProperty("资金情况-下达情况-申报金额(总计)(万元)") | |||||
@ApiModelProperty("资金情况-申报-申报金额(总计)(万元)") | |||||
private BigDecimal declareAmount; | private BigDecimal declareAmount; | ||||
@ApiModelProperty("资金情况-下达情况-自有金额(万元)") | |||||
@ApiModelProperty("资金情况-申报-自有金额(万元)") | |||||
private BigDecimal declareHaveAmount; | private BigDecimal declareHaveAmount; | ||||
@ApiModelProperty("资金情况-下达情况-政府投资-本级财政资金(万元)") | |||||
@ApiModelProperty("资金情况-申报-政府投资-本级财政资金(万元)") | |||||
private BigDecimal declareGovOwnFinanceAmount; | private BigDecimal declareGovOwnFinanceAmount; | ||||
@ApiModelProperty("资金情况-下达情况-政府投资-上级补助资金(万元)") | |||||
@ApiModelProperty("资金情况-申报-政府投资-上级补助资金(万元)") | |||||
private BigDecimal declareGovSuperiorFinanceAmount; | private BigDecimal declareGovSuperiorFinanceAmount; | ||||
@ApiModelProperty("银行贷款(万元)") | |||||
@ApiModelProperty("申报-银行贷款(万元)") | |||||
private BigDecimal declareBankLendingAmount; | private BigDecimal declareBankLendingAmount; | ||||
@ApiModelProperty("其它资金(万元)") | |||||
@ApiModelProperty("申报-其它资金(万元)") | |||||
private BigDecimal declareOtherAmount; | private BigDecimal declareOtherAmount; | ||||
@ApiModelProperty("申报资金-分配情况-软件开发(万元)") | @ApiModelProperty("申报资金-分配情况-软件开发(万元)") | ||||
@@ -580,4 +580,7 @@ public class Project implements Serializable { | |||||
@ApiModelProperty("置顶") | @ApiModelProperty("置顶") | ||||
private Integer topped; | private Integer topped; | ||||
@ApiModelProperty("是否已开启年度计划") | |||||
private Boolean annualPlanOpened; | |||||
} | } |
@@ -114,4 +114,7 @@ public class ProjectListReq extends PagePo { | |||||
@ApiModelProperty("评审金额最大值") | @ApiModelProperty("评审金额最大值") | ||||
private BigDecimal reviewAmountMax; | private BigDecimal reviewAmountMax; | ||||
private Boolean isStartDeclaredProject; | |||||
} | } |
@@ -1,25 +1,29 @@ | |||||
package com.hz.pm.api.todocenter; | 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.AppTests; | ||||
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; | |||||
import com.hz.pm.api.external.MhApiClient; | import com.hz.pm.api.external.MhApiClient; | ||||
import com.hz.pm.api.external.MhFileClient; | import com.hz.pm.api.external.MhFileClient; | ||||
import com.hz.pm.api.external.model.dto.MhZwddWorkNoticeDTO; | import com.hz.pm.api.external.model.dto.MhZwddWorkNoticeDTO; | ||||
import com.hz.pm.api.external.todo.MHTodoClient; | import com.hz.pm.api.external.todo.MHTodoClient; | ||||
import com.hz.pm.api.external.todo.dto.MhTodoExtraParamDTO; | import com.hz.pm.api.external.todo.dto.MhTodoExtraParamDTO; | ||||
import com.hz.pm.api.external.todo.enumerization.MHTodoTypeEnum; | 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.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 com.ningdatech.file.service.FileService; | ||||
import org.junit.Test; | import org.junit.Test; | ||||
import org.springframework.beans.factory.annotation.Autowired; | 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.List; | ||||
import java.util.stream.Collectors; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
@@ -68,4 +72,63 @@ public class MhApiClientTest extends AppTests { | |||||
mhApiClient.sendZwddWorkNotice(notice); | 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); | |||||
} | |||||
} | |||||
} | } |