diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java index 2cc12cb..f84dce7 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java @@ -234,10 +234,7 @@ public class Project implements Serializable { @ApiModelProperty("一地创新全省共享项目-是否开启 false:关闭 true:开启") private Boolean isInnovateWholeProvinceShare; - @TableField(fill = FieldFill.INSERT) private LocalDateTime createOn; - - @TableField(fill = FieldFill.INSERT_UPDATE) private LocalDateTime updateOn; @ApiModelProperty("流程实例编号") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java index e997515..4d94636 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java @@ -303,6 +303,9 @@ public class ProjectDetailVO { @ApiModelProperty("21位项目编号") private String projectCode; + private LocalDateTime createOn; + private LocalDateTime updateOn; + public String getProjectTypeName() { if (Objects.nonNull(this.projectType)) { Optional.ofNullable(ProjectTypeEnum.getDesc(this.projectType)) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/constant/TodoCenterContant.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/constant/TodoCenterContant.java index 6d555e2..bf8fb8e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/constant/TodoCenterContant.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/constant/TodoCenterContant.java @@ -12,4 +12,10 @@ public interface TodoCenterContant { public static final String OR_SIGN_FLAG = "MI_END"; } + + public class Declared { + + public static final String NULL_INST_CODE = "EMPTY"; + + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java index a1ed07e..297cf0c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java @@ -31,6 +31,7 @@ import com.ningdatech.pmapi.staging.service.IProjectStagingService; import com.ningdatech.pmapi.sys.model.entity.Notify; import com.ningdatech.pmapi.sys.service.INotifyService; import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; +import com.ningdatech.pmapi.todocenter.constant.TodoCenterContant; import com.ningdatech.pmapi.todocenter.service.StatisticsService; import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; import com.ningdatech.pmapi.todocenter.utils.PdfUtils; @@ -38,6 +39,7 @@ import com.ningdatech.pmapi.user.entity.UserInfo; import com.ningdatech.pmapi.user.service.IUserInfoService; import com.ningdatech.pmapi.user.util.LoginUserUtil; import com.wflow.contants.HisProInsEndActId; +import com.wflow.contants.WflowContant; import com.wflow.workflow.bean.process.ProgressNode; import com.wflow.workflow.bean.process.enums.NodeTypeEnum; import com.wflow.workflow.bean.vo.ProcessProgressVo; @@ -49,6 +51,7 @@ import org.flowable.engine.HistoryService; import org.flowable.engine.history.HistoricProcessInstance; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; import java.util.HashMap; @@ -325,15 +328,20 @@ public class HandlerManage { * @author CMM * @since 2023/02/08 */ - private void updateWithdrawProjectStatus(Long userId, Project declaredProject) { - try { - stateMachineUtils.withDraw(declaredProject); - declaredProject.setUpdateOn(LocalDateTime.now()); - declaredProject.setUpdateBy(userId); - projectService.updateById(declaredProject); - } catch (Exception e) { - throw new BizException("状态机执行失败!"); - } + @Transactional(rollbackFor = Exception.class) + public void updateWithdrawProjectStatus(Long userId, Project declaredProject) { + // 删除关联表信息 + projectInstService.remove(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getProjectId,declaredProject.getId()) + .eq(ProjectInst::getInstCode,declaredProject.getInstCode())); + //删除项目的实例信息 + historyService.deleteHistoricProcessInstance(declaredProject.getInstCode()); + + stateMachineUtils.withDraw(declaredProject); + declaredProject.setUpdateOn(LocalDateTime.now()); + declaredProject.setUpdateBy(userId); + declaredProject.setInstCode(TodoCenterContant.Declared.NULL_INST_CODE); + projectService.updateById(declaredProject); } /**