@@ -6,7 +6,7 @@ import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; | |||||
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.entity.ProjectStatusChange; | ||||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | ||||
import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; | |||||
import com.hz.pm.api.projectlib.service.IProjectStatusChangeService; | |||||
import com.hz.pm.api.projectlib.service.IProjectApplicationService; | import com.hz.pm.api.projectlib.service.IProjectApplicationService; | ||||
import com.ningdatech.basic.exception.BizException; | import com.ningdatech.basic.exception.BizException; | ||||
import com.wflow.exception.BusinessException; | import com.wflow.exception.BusinessException; | ||||
@@ -41,7 +41,7 @@ public class StateMachineUtil { | |||||
private final ProjectDeclareStateMachineBuilder projectDeclareStateMachineBuilder; | private final ProjectDeclareStateMachineBuilder projectDeclareStateMachineBuilder; | ||||
private final INdProjectStatusChangeService projectStatusChangeService; | |||||
private final IProjectStatusChangeService projectStatusChangeService; | |||||
private final IProjectApplicationService projectApplicationService; | private final IProjectApplicationService projectApplicationService; | ||||
@@ -13,7 +13,7 @@ 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.entity.ProjectStatusChange; | ||||
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; | import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; | ||||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | ||||
import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; | |||||
import com.hz.pm.api.projectlib.service.IProjectStatusChangeService; | |||||
import com.hz.pm.api.projectlib.service.IProjectInstService; | import com.hz.pm.api.projectlib.service.IProjectInstService; | ||||
import com.hz.pm.api.projectlib.service.IProjectService; | import com.hz.pm.api.projectlib.service.IProjectService; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
@@ -41,7 +41,7 @@ public class ProjectStatusHandler { | |||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private final IProjectInstService projectInstService; | private final IProjectInstService projectInstService; | ||||
private final INdProjectStatusChangeService statusChangeService; | |||||
private final IProjectStatusChangeService statusChangeService; | |||||
private final HistoryService historyService; | private final HistoryService historyService; | ||||
@@ -146,7 +146,7 @@ public class GovProjectCollectionManage { | |||||
private final IProjectStagingService stagingService; | private final IProjectStagingService stagingService; | ||||
private final INdProjectStatusChangeService statusChangeService; | |||||
private final IProjectStatusChangeService statusChangeService; | |||||
private final IPurchaseService purchaseService; | private final IPurchaseService purchaseService; | ||||
@@ -8,7 +8,7 @@ import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; | |||||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | ||||
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.entity.ProjectStatusChange; | ||||
import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; | |||||
import com.hz.pm.api.projectlib.service.IProjectStatusChangeService; | |||||
import com.hz.pm.api.projectlib.service.IProjectService; | import com.hz.pm.api.projectlib.service.IProjectService; | ||||
import com.ningdatech.basic.util.CollUtils; | import com.ningdatech.basic.util.CollUtils; | ||||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | import com.wflow.workflow.bean.vo.ProcessDetailVO; | ||||
@@ -31,7 +31,7 @@ import static com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum.*; | |||||
@Order(6) | @Order(6) | ||||
@Component | @Component | ||||
public class AnnualPlanHandle extends AbstractProcessBusinessHandle { | public class AnnualPlanHandle extends AbstractProcessBusinessHandle { | ||||
private final INdProjectStatusChangeService projectStatusChangeService; | |||||
private final IProjectStatusChangeService projectStatusChangeService; | |||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private Integer order = 6; | private Integer order = 6; | ||||
@@ -53,7 +53,7 @@ public class AnnualPlanHandle extends AbstractProcessBusinessHandle { | |||||
DEPARTMENT_JOINT_REVIEW_FAILED | DEPARTMENT_JOINT_REVIEW_FAILED | ||||
); | ); | ||||
public AnnualPlanHandle(INdProjectStatusChangeService projectStatusChangeService, IProjectService projectService) { | |||||
public AnnualPlanHandle(IProjectStatusChangeService projectStatusChangeService, IProjectService projectService) { | |||||
this.projectStatusChangeService = projectStatusChangeService; | this.projectStatusChangeService = projectStatusChangeService; | ||||
this.projectService = projectService; | this.projectService = projectService; | ||||
} | } | ||||
@@ -16,7 +16,7 @@ import com.hz.pm.api.common.model.constant.CommonConst; | |||||
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; | import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; | ||||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | ||||
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; | import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; | ||||
import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; | |||||
import com.hz.pm.api.projectlib.service.IProjectStatusChangeService; | |||||
/** | /** | ||||
* 归档处理 | * 归档处理 | ||||
@@ -28,11 +28,11 @@ import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; | |||||
@Component | @Component | ||||
public class ArchivedHandle extends AbstractProcessBusinessHandle { | public class ArchivedHandle extends AbstractProcessBusinessHandle { | ||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private final INdProjectStatusChangeService projectStatusChangeService; | |||||
private final IProjectStatusChangeService projectStatusChangeService; | |||||
private Integer order = 12; | private Integer order = 12; | ||||
public ArchivedHandle( IProjectService projectService, INdProjectStatusChangeService projectStatusChangeService){ | |||||
public ArchivedHandle( IProjectService projectService, IProjectStatusChangeService projectStatusChangeService){ | |||||
this.projectService = projectService; | this.projectService = projectService; | ||||
this.projectStatusChangeService = projectStatusChangeService; | this.projectStatusChangeService = projectStatusChangeService; | ||||
} | } | ||||
@@ -1,19 +1,18 @@ | |||||
package com.hz.pm.api.projectlib.handle; | package com.hz.pm.api.projectlib.handle; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.hz.pm.api.common.model.constant.BizConst; | |||||
import com.hz.pm.api.common.model.constant.CommonConst; | import com.hz.pm.api.common.model.constant.CommonConst; | ||||
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; | import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; | ||||
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.entity.ProjectStatusChange; | ||||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | ||||
import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; | |||||
import com.hz.pm.api.projectlib.service.IProjectStatusChangeService; | |||||
import com.hz.pm.api.projectlib.service.IProjectService; | import com.hz.pm.api.projectlib.service.IProjectService; | ||||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | import com.wflow.workflow.bean.vo.ProcessDetailVO; | ||||
import com.wflow.workflow.enums.StepStatusEnum; | import com.wflow.workflow.enums.StepStatusEnum; | ||||
import org.springframework.core.annotation.Order; | import org.springframework.core.annotation.Order; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import java.util.Arrays; | |||||
import java.util.List; | import java.util.List; | ||||
import java.util.Objects; | import java.util.Objects; | ||||
@@ -26,12 +25,12 @@ import java.util.Objects; | |||||
@Order(8) | @Order(8) | ||||
@Component | @Component | ||||
public class ProjectApprovalHandle extends AbstractProcessBusinessHandle { | public class ProjectApprovalHandle extends AbstractProcessBusinessHandle { | ||||
private final INdProjectStatusChangeService projectStatusChangeService; | |||||
private final IProjectStatusChangeService projectStatusChangeService; | |||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private Integer order = 8; | private Integer order = 8; | ||||
public ProjectApprovalHandle(INdProjectStatusChangeService projectStatusChangeService, | |||||
public ProjectApprovalHandle(IProjectStatusChangeService projectStatusChangeService, | |||||
IProjectService projectService) { | IProjectService projectService) { | ||||
this.projectStatusChangeService = projectStatusChangeService; | this.projectStatusChangeService = projectStatusChangeService; | ||||
this.projectService = projectService; | this.projectService = projectService; | ||||
@@ -39,52 +38,47 @@ public class ProjectApprovalHandle extends AbstractProcessBusinessHandle { | |||||
@Override | @Override | ||||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | ||||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | |||||
processDetailVO.setProcessName(CommonConst.PROJECT_APPROVAL); | |||||
ProcessDetailVO processDetail = new ProcessDetailVO(); | |||||
processDetail.setProcessName(CommonConst.PROJECT_APPROVAL); | |||||
processSchedule.add(processDetail); | |||||
Project project = projectService.getNewProject(projectId); | Project project = projectService.getNewProject(projectId); | ||||
//查出历史版本的 所有项目ID | //查出历史版本的 所有项目ID | ||||
List<Long> allVersionProjectIds = projectService.allVersionProjectIds(project.getProjectCode()); | |||||
List<Long> allProjectIds = projectService.allVersionProjectIds(project.getProjectCode()); | |||||
Integer status = project.getStatus(); | Integer status = project.getStatus(); | ||||
if (Objects.isNull(status)) { | if (Objects.isNull(status)) { | ||||
return; | return; | ||||
} | } | ||||
// 项目状态为待立项批复之前的状态 | // 项目状态为待立项批复之前的状态 | ||||
if (status < ProjectStatusEnum.TO_BE_APPROVED.getCode()) { | |||||
processDetailVO.setStepStatus(StepStatusEnum.NOT_START); | |||||
processSchedule.add(processDetailVO); | |||||
if (status < ProjectStatusEnum.TO_BE_APPROVED.getCode() | |||||
&& status < ProjectStatusEnum.DECLARED_APPROVED_TO_BE_RECORD.getCode()) { | |||||
processDetail.setStepStatus(StepStatusEnum.NOT_START); | |||||
return; | return; | ||||
} | } | ||||
// 当前项目状态为待立项批复 | // 当前项目状态为待立项批复 | ||||
if (ProjectStatusEnum.TO_BE_APPROVED.eq(status) | if (ProjectStatusEnum.TO_BE_APPROVED.eq(status) | ||||
|| ProjectStatusEnum.DECLARED_APPROVED_TO_BE_RECORD.eq(status) | |||||
|| ProjectStatusEnum.DECLARED_APPROVED_RECORD_AUDITING.eq(status)) { | || ProjectStatusEnum.DECLARED_APPROVED_RECORD_AUDITING.eq(status)) { | ||||
// 根据建设方案评审通过的时间获取 | // 根据建设方案评审通过的时间获取 | ||||
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) | |||||
.in(ProjectStatusChange::getProjectId, allVersionProjectIds) | |||||
.in(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PLAN_REVIEW_PASS, | |||||
ProjectStatusChangeEvent.DECLARED_RECORD_SUBMIT, | |||||
ProjectStatusChangeEvent.DECLARED_RECORD_RESUBMIT) | |||||
.orderByDesc(ProjectStatusChange::getCreateOn) | |||||
.last(BizConst.LIMIT_1)); | |||||
final List<ProjectStatusChangeEvent> events = Arrays.asList(ProjectStatusChangeEvent.PLAN_REVIEW_PASS, | |||||
ProjectStatusChangeEvent.DECLARED_RECORD_SUBMIT, | |||||
ProjectStatusChangeEvent.DECLARED_RECORD_RESUBMIT); | |||||
ProjectStatusChange projectStatusChange = projectStatusChangeService.getLastOne(allProjectIds, events); | |||||
if (projectStatusChange != null) { | if (projectStatusChange != null) { | ||||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | |||||
processDetail.setFinishTime(projectStatusChange.getCreateOn()); | |||||
} | |||||
processDetail.setStepStatus(StepStatusEnum.ON_GOING); | |||||
} else { | |||||
// 取 状态机 改变状态时间 | |||||
final List<ProjectStatusChangeEvent> events = Arrays.asList(ProjectStatusChangeEvent.PLAN_REVIEW_PASS, | |||||
ProjectStatusChangeEvent.DECLARED_RECORD_FAILED, | |||||
ProjectStatusChangeEvent.DECLARED_RECORD_PASS); | |||||
ProjectStatusChange projectStatusChange = projectStatusChangeService.getLastOne(allProjectIds, events); | |||||
if (Objects.nonNull(projectStatusChange)) { | |||||
processDetail.setFinishTime(projectStatusChange.getCreateOn()); | |||||
processDetail.setStepStatus(StepStatusEnum.COMPLETED); | |||||
} | } | ||||
processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); | |||||
return; | |||||
} | |||||
// 取 状态机 改变状态时间 | |||||
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) | |||||
.in(ProjectStatusChange::getProjectId, allVersionProjectIds) | |||||
.in(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PLAN_REVIEW_PASS, | |||||
ProjectStatusChangeEvent.DECLARED_RECORD_FAILED, | |||||
ProjectStatusChangeEvent.DECLARED_RECORD_PASS) | |||||
.last(BizConst.LIMIT_1)); | |||||
if (Objects.nonNull(projectStatusChange)) { | |||||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | |||||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | |||||
} | } | ||||
processSchedule.add(processDetailVO); | |||||
} | } | ||||
@Override | @Override | ||||
@@ -19,7 +19,7 @@ import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; | |||||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | ||||
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; | import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; | ||||
import com.hz.pm.api.projectlib.model.entity.Project; | import com.hz.pm.api.projectlib.model.entity.Project; | ||||
import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; | |||||
import com.hz.pm.api.projectlib.service.IProjectStatusChangeService; | |||||
import com.hz.pm.api.projectlib.service.IProjectService; | import com.hz.pm.api.projectlib.service.IProjectService; | ||||
/** | /** | ||||
@@ -31,7 +31,7 @@ import com.hz.pm.api.projectlib.service.IProjectService; | |||||
@Order(10) | @Order(10) | ||||
@Component | @Component | ||||
public class ProjectPreliminaryInspectionHandle extends AbstractProcessBusinessHandle { | public class ProjectPreliminaryInspectionHandle extends AbstractProcessBusinessHandle { | ||||
private final INdProjectStatusChangeService projectStatusChangeService; | |||||
private final IProjectStatusChangeService projectStatusChangeService; | |||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private Integer order = 10; | private Integer order = 10; | ||||
@@ -48,7 +48,7 @@ public class ProjectPreliminaryInspectionHandle extends AbstractProcessBusinessH | |||||
ACCEPTED | ACCEPTED | ||||
); | ); | ||||
public ProjectPreliminaryInspectionHandle(INdProjectStatusChangeService projectStatusChangeService, IProjectService projectService){ | |||||
public ProjectPreliminaryInspectionHandle(IProjectStatusChangeService projectStatusChangeService, IProjectService projectService){ | |||||
this.projectStatusChangeService = projectStatusChangeService; | this.projectStatusChangeService = projectStatusChangeService; | ||||
this.projectService = projectService; | this.projectService = projectService; | ||||
} | } | ||||
@@ -6,7 +6,7 @@ import com.hz.pm.api.common.model.constant.CommonConst; | |||||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | ||||
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.entity.ProjectStatusChange; | ||||
import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; | |||||
import com.hz.pm.api.projectlib.service.IProjectStatusChangeService; | |||||
import com.hz.pm.api.projectlib.service.IProjectService; | import com.hz.pm.api.projectlib.service.IProjectService; | ||||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | import com.wflow.workflow.bean.vo.ProcessDetailVO; | ||||
import com.wflow.workflow.enums.StepStatusEnum; | import com.wflow.workflow.enums.StepStatusEnum; | ||||
@@ -26,12 +26,12 @@ import java.util.Objects; | |||||
@Component | @Component | ||||
public class ProvinceUnitedReviewHandle extends AbstractProcessBusinessHandle { | public class ProvinceUnitedReviewHandle extends AbstractProcessBusinessHandle { | ||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private final INdProjectStatusChangeService projectStatusChangeService; | |||||
private final IProjectStatusChangeService projectStatusChangeService; | |||||
private Integer order = 3; | private Integer order = 3; | ||||
public ProvinceUnitedReviewHandle(IProjectService projectService, | public ProvinceUnitedReviewHandle(IProjectService projectService, | ||||
INdProjectStatusChangeService projectStatusChangeService) { | |||||
IProjectStatusChangeService projectStatusChangeService) { | |||||
this.projectService = projectService; | this.projectService = projectService; | ||||
this.projectStatusChangeService = projectStatusChangeService; | this.projectStatusChangeService = projectStatusChangeService; | ||||
} | } | ||||
@@ -7,7 +7,7 @@ import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; | |||||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | ||||
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.entity.ProjectStatusChange; | ||||
import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; | |||||
import com.hz.pm.api.projectlib.service.IProjectStatusChangeService; | |||||
import com.hz.pm.api.projectlib.service.IProjectService; | import com.hz.pm.api.projectlib.service.IProjectService; | ||||
import com.ningdatech.basic.util.CollUtils; | import com.ningdatech.basic.util.CollUtils; | ||||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | import com.wflow.workflow.bean.vo.ProcessDetailVO; | ||||
@@ -30,7 +30,7 @@ import static com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum.*; | |||||
@Order(9) | @Order(9) | ||||
@Component | @Component | ||||
public class TenderPurchaseHandle extends AbstractProcessBusinessHandle { | public class TenderPurchaseHandle extends AbstractProcessBusinessHandle { | ||||
private final INdProjectStatusChangeService projectStatusChangeService; | |||||
private final IProjectStatusChangeService projectStatusChangeService; | |||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private Integer order = 9; | private Integer order = 9; | ||||
@@ -47,7 +47,7 @@ public class TenderPurchaseHandle extends AbstractProcessBusinessHandle { | |||||
ACCEPTED | ACCEPTED | ||||
); | ); | ||||
public TenderPurchaseHandle(INdProjectStatusChangeService projectStatusChangeService, IProjectService projectService) { | |||||
public TenderPurchaseHandle(IProjectStatusChangeService projectStatusChangeService, IProjectService projectService) { | |||||
this.projectStatusChangeService = projectStatusChangeService; | this.projectStatusChangeService = projectStatusChangeService; | ||||
this.projectService = projectService; | this.projectService = projectService; | ||||
} | } | ||||
@@ -92,7 +92,7 @@ public class DeclaredRecordManage { | |||||
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | ||||
private final ProcessInstanceService processInstanceService; | private final ProcessInstanceService processInstanceService; | ||||
private final ProjectLibManage projectLibManage; | private final ProjectLibManage projectLibManage; | ||||
private final INdProjectStatusChangeService projectStatusChangeService; | |||||
private final IProjectStatusChangeService projectStatusChangeService; | |||||
private final IProjectGovSystemReplaceInfosService systemReplaceInfosService; | private final IProjectGovSystemReplaceInfosService systemReplaceInfosService; | ||||
private LambdaQueryWrapper<MhProject> buildQuery(DeclaredProjectListReq req) { | private LambdaQueryWrapper<MhProject> buildQuery(DeclaredProjectListReq req) { | ||||
@@ -11,6 +11,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
* @author CMM | * @author CMM | ||||
* @since 2023-02-27 | * @since 2023-02-27 | ||||
*/ | */ | ||||
public interface NdProjectStatusChangeMapper extends BaseMapper<ProjectStatusChange> { | |||||
public interface ProjectStatusChangeMapper extends BaseMapper<ProjectStatusChange> { | |||||
} | } |
@@ -1,5 +1,5 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
<mapper namespace="com.hz.pm.api.projectlib.mapper.NdProjectStatusChangeMapper"> | |||||
<mapper namespace="com.hz.pm.api.projectlib.mapper.ProjectStatusChangeMapper"> | |||||
</mapper> | </mapper> |
@@ -1,23 +0,0 @@ | |||||
package com.hz.pm.api.projectlib.service; | |||||
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; | |||||
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | |||||
import java.util.Collection; | |||||
/** | |||||
* <p> | |||||
* 服务类 | |||||
* </p> | |||||
* | |||||
* @author CMM | |||||
* @since 2023-02-27 | |||||
*/ | |||||
public interface INdProjectStatusChangeService extends IService<ProjectStatusChange> { | |||||
ProjectStatusChange getByProjectStatus(ProjectStatusChangeEvent event, Long projectId); | |||||
ProjectStatusChange getByProjectStatus(ProjectStatusChangeEvent event, Collection<Long> projectIds); | |||||
} |
@@ -0,0 +1,36 @@ | |||||
package com.hz.pm.api.projectlib.service; | |||||
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.statemachine.event.ProjectStatusChangeEvent; | |||||
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | |||||
import java.util.Collection; | |||||
/** | |||||
* <p> | |||||
* 服务类 | |||||
* </p> | |||||
* | |||||
* @author CMM | |||||
* @since 2023-02-27 | |||||
*/ | |||||
public interface IProjectStatusChangeService extends IService<ProjectStatusChange> { | |||||
ProjectStatusChange getByProjectStatus(ProjectStatusChangeEvent event, Long projectId); | |||||
ProjectStatusChange getByProjectStatus(ProjectStatusChangeEvent event, Collection<Long> projectIds); | |||||
default ProjectStatusChange getLastOne(Collection<Long> projectIds, Collection<ProjectStatusChangeEvent> events) { | |||||
LambdaQueryWrapper<ProjectStatusChange> pscQuery = Wrappers.lambdaQuery(ProjectStatusChange.class) | |||||
.in(ProjectStatusChange::getProjectId, projectIds) | |||||
.in(ProjectStatusChange::getEvent, events) | |||||
.orderByDesc(ProjectStatusChange::getCreateOn) | |||||
.last(BizConst.LIMIT_1); | |||||
return getOne(pscQuery); | |||||
} | |||||
} |
@@ -1,19 +1,17 @@ | |||||
package com.hz.pm.api.projectlib.service.impl; | package com.hz.pm.api.projectlib.service.impl; | ||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import com.hz.pm.api.common.model.constant.BizConst; | import com.hz.pm.api.common.model.constant.BizConst; | ||||
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; | import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; | ||||
import com.hz.pm.api.projectlib.mapper.ProjectStatusChangeMapper; | |||||
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; | import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; | ||||
import com.hz.pm.api.projectlib.mapper.NdProjectStatusChangeMapper; | |||||
import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; | |||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import com.hz.pm.api.projectlib.service.IProjectStatusChangeService; | |||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import java.util.Collection; | import java.util.Collection; | ||||
import static com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
* 服务实现类 | * 服务实现类 | ||||
@@ -23,11 +21,11 @@ import static com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent.D | |||||
* @since 2023-02-27 | * @since 2023-02-27 | ||||
*/ | */ | ||||
@Service | @Service | ||||
public class NdProjectStatusChangeServiceImpl extends ServiceImpl<NdProjectStatusChangeMapper, ProjectStatusChange> implements INdProjectStatusChangeService { | |||||
public class ProjectStatusChangeServiceImpl extends ServiceImpl<ProjectStatusChangeMapper, ProjectStatusChange> implements IProjectStatusChangeService { | |||||
@Override | @Override | ||||
public ProjectStatusChange getByProjectStatus(ProjectStatusChangeEvent event, Long projectId) { | public ProjectStatusChange getByProjectStatus(ProjectStatusChangeEvent event, Long projectId) { | ||||
LambdaQueryWrapper<ProjectStatusChange> query = Wrappers.lambdaQuery(ProjectStatusChange.class) | |||||
Wrapper<ProjectStatusChange> query = Wrappers.lambdaQuery(ProjectStatusChange.class) | |||||
.eq(ProjectStatusChange::getEvent, event) | .eq(ProjectStatusChange::getEvent, event) | ||||
.eq(ProjectStatusChange::getProjectId, projectId) | .eq(ProjectStatusChange::getProjectId, projectId) | ||||
.orderByDesc(ProjectStatusChange::getCreateOn) | .orderByDesc(ProjectStatusChange::getCreateOn) | ||||
@@ -37,9 +35,10 @@ public class NdProjectStatusChangeServiceImpl extends ServiceImpl<NdProjectStatu | |||||
@Override | @Override | ||||
public ProjectStatusChange getByProjectStatus(ProjectStatusChangeEvent event, Collection<Long> projectIds) { | public ProjectStatusChange getByProjectStatus(ProjectStatusChangeEvent event, Collection<Long> projectIds) { | ||||
LambdaQueryWrapper<ProjectStatusChange> query = Wrappers.lambdaQuery(ProjectStatusChange.class) | |||||
Wrapper<ProjectStatusChange> query = Wrappers.lambdaQuery(ProjectStatusChange.class) | |||||
.in(ProjectStatusChange::getProjectId, projectIds) | .in(ProjectStatusChange::getProjectId, projectIds) | ||||
.eq(ProjectStatusChange::getEvent, DEPARTMENT_UNITED_REVIEW_PASS) | |||||
.eq(ProjectStatusChange::getEvent, event) | |||||
.orderByDesc(ProjectStatusChange::getCreateOn) | |||||
.last(BizConst.LIMIT_1); | .last(BizConst.LIMIT_1); | ||||
return getOne(query); | return getOne(query); | ||||
} | } |