@@ -32,10 +32,13 @@ import com.ningdatech.pmapi.organization.model.entity.DingOrganization; | |||||
import com.ningdatech.pmapi.organization.service.IDingOrganizationService; | import com.ningdatech.pmapi.organization.service.IDingOrganizationService; | ||||
import com.ningdatech.pmapi.projectdeclared.model.dto.DelayedApplyDTO; | import com.ningdatech.pmapi.projectdeclared.model.dto.DelayedApplyDTO; | ||||
import com.ningdatech.pmapi.projectdeclared.model.entity.Contract; | import com.ningdatech.pmapi.projectdeclared.model.entity.Contract; | ||||
import com.ningdatech.pmapi.projectdeclared.model.entity.PreInsAcceptancePerson; | |||||
import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase; | import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase; | ||||
import com.ningdatech.pmapi.projectdeclared.model.vo.ContractVO; | import com.ningdatech.pmapi.projectdeclared.model.vo.ContractVO; | ||||
import com.ningdatech.pmapi.projectdeclared.model.vo.PreInsAcceptancePersonVO; | |||||
import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO; | import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO; | ||||
import com.ningdatech.pmapi.projectdeclared.service.IContractService; | import com.ningdatech.pmapi.projectdeclared.service.IContractService; | ||||
import com.ningdatech.pmapi.projectdeclared.service.IPreInsAcceptancePersonService; | |||||
import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService; | import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService; | ||||
import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; | import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; | import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; | ||||
@@ -97,6 +100,8 @@ public class ProjectLibManage { | |||||
private final IPurchaseService purchaseService; | private final IPurchaseService purchaseService; | ||||
private final IPreInsAcceptancePersonService acceptancePersonService; | |||||
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | ||||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | ||||
query.eq(Project::getNewest,Boolean.TRUE); | query.eq(Project::getNewest,Boolean.TRUE); | ||||
@@ -538,6 +543,11 @@ public class ProjectLibManage { | |||||
vo.setContract(BeanUtil.copyProperties(contract, ContractVO.class)); | vo.setContract(BeanUtil.copyProperties(contract, ContractVO.class)); | ||||
//查询初验信息 | //查询初验信息 | ||||
List<PreInsAcceptancePerson> acceptancePersons = acceptancePersonService.list(Wrappers.lambdaQuery(PreInsAcceptancePerson.class) | |||||
.eq(PreInsAcceptancePerson::getProjectId, projectId) | |||||
.orderByAsc(PreInsAcceptancePerson::getCreateOn)); | |||||
vo.setAcceptancePersons(convertPersons(acceptancePersons)); | |||||
//查询终验信息 | //查询终验信息 | ||||
//查询年度投资金额 要是已验收的项目 | //查询年度投资金额 要是已验收的项目 | ||||
@@ -771,4 +781,12 @@ public class ProjectLibManage { | |||||
return PageVo.of(res,page.getTotal()); | return PageVo.of(res,page.getTotal()); | ||||
} | } | ||||
private List<PreInsAcceptancePersonVO> convertPersons(List<PreInsAcceptancePerson> acceptancePersons) { | |||||
if(CollUtil.isEmpty(acceptancePersons)){ | |||||
return Collections.emptyList(); | |||||
} | |||||
return acceptancePersons.stream().map(u -> BeanUtil.copyProperties(u,PreInsAcceptancePersonVO.class)).collect(Collectors.toList()); | |||||
} | |||||
} | } |
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; | |||||
import com.ningdatech.pmapi.common.util.BizUtils; | import com.ningdatech.pmapi.common.util.BizUtils; | ||||
import com.ningdatech.pmapi.projectdeclared.model.entity.Contract; | import com.ningdatech.pmapi.projectdeclared.model.entity.Contract; | ||||
import com.ningdatech.pmapi.projectdeclared.model.vo.ContractVO; | import com.ningdatech.pmapi.projectdeclared.model.vo.ContractVO; | ||||
import com.ningdatech.pmapi.projectdeclared.model.vo.PreInsAcceptancePersonVO; | |||||
import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO; | import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; | ||||
import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||
@@ -363,6 +364,10 @@ public class ProjectDetailVO { | |||||
@ApiModelProperty("采购信息") | @ApiModelProperty("采购信息") | ||||
private PurchaseVO purchase; | private PurchaseVO purchase; | ||||
@ApiModelProperty("初审人员") | |||||
private List<PreInsAcceptancePersonVO> acceptancePersons; | |||||
public String getProjectTypeName() { | public String getProjectTypeName() { | ||||
if (Objects.nonNull(this.projectType)) { | if (Objects.nonNull(this.projectType)) { | ||||
Optional.ofNullable(ProjectTypeEnum.getDesc(this.projectType)) | Optional.ofNullable(ProjectTypeEnum.getDesc(this.projectType)) | ||||
@@ -0,0 +1,88 @@ | |||||
package com.ningdatech.pmapi.scheduler.listener; | |||||
import cn.hutool.core.collection.CollUtil; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.ningdatech.pmapi.common.constant.BizConst; | |||||
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||||
import com.wflow.workflow.notify.event.ProcessStartEvent; | |||||
import lombok.RequiredArgsConstructor; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.flowable.engine.HistoryService; | |||||
import org.flowable.engine.TaskService; | |||||
import org.flowable.task.api.Task; | |||||
import org.flowable.task.api.history.HistoricTaskInstance; | |||||
import org.springframework.context.event.EventListener; | |||||
import org.springframework.scheduling.annotation.Async; | |||||
import org.springframework.stereotype.Component; | |||||
import java.time.LocalDateTime; | |||||
import java.util.List; | |||||
import java.util.Objects; | |||||
/** | |||||
* 工作流开始 事件监听 | |||||
* | |||||
* @author ZPF | |||||
* @return | |||||
* @since 2023/04/14 14:19 | |||||
*/ | |||||
@Slf4j | |||||
@Component | |||||
@RequiredArgsConstructor | |||||
public class ProcessStartListener { | |||||
private final TaskService taskService; | |||||
private final HistoryService historyService; | |||||
private final IProjectInstService projectInstService; | |||||
private final IProjectService projectService; | |||||
private final StateMachineUtils stateMachineUtils; | |||||
@Async | |||||
@EventListener | |||||
public void onApplicationEvent(ProcessStartEvent event) { | |||||
log.info("进入工作流开始 事件监听!{}", event.getInstCode()); | |||||
String instCode = event.getInstCode(); | |||||
log.info("instCode:{}", instCode); | |||||
//休息3秒 | |||||
try { | |||||
Thread.sleep(3000); | |||||
} catch (InterruptedException e) { | |||||
throw new RuntimeException(e); | |||||
} | |||||
//1.去查找 项目实例关系表 | |||||
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | |||||
.eq(ProjectInst::getInstCode, instCode) | |||||
.last(BizConst.LIMIT_1)); | |||||
if (Objects.isNull(projectInst)) { | |||||
return; | |||||
} | |||||
List<Task> tasks = taskService.createTaskQuery() | |||||
.processInstanceId(instCode) | |||||
.active() | |||||
.list(); | |||||
List<HistoricTaskInstance> historyTasks = historyService.createHistoricTaskInstanceQuery() | |||||
.processInstanceId(instCode) | |||||
.finished() | |||||
.list(); | |||||
if (CollUtil.isEmpty(tasks) && CollUtil.isEmpty(historyTasks)) { | |||||
//如果真的没有实时任务和历史任务 那么说明 该项目没有人审批 需要去调用状态机 | |||||
Long projectId = projectInst.getProjectId(); | |||||
Project project = projectService.getNewProject(projectId); | |||||
stateMachineUtils.pass(project); | |||||
project.setUpdateOn(LocalDateTime.now()); | |||||
projectService.updateById(project); | |||||
} | |||||
} | |||||
} |