|
|
@@ -4,10 +4,12 @@ import cn.hutool.core.bean.BeanUtil; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.ningdatech.basic.function.VUtils; |
|
|
|
import com.ningdatech.pmapi.common.constant.BizConst; |
|
|
|
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.model.dto.OperationDTO; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.model.entity.Operation; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.model.vo.OperationVO; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.service.IOperationService; |
|
|
|
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; |
|
|
|
import com.ningdatech.pmapi.projectlib.model.entity.Project; |
|
|
|
import com.ningdatech.pmapi.projectlib.service.IProjectService; |
|
|
|
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; |
|
|
@@ -34,6 +36,8 @@ public class OperationManage { |
|
|
|
|
|
|
|
private final IProjectService projectService; |
|
|
|
|
|
|
|
private final StateMachineUtils stateMachineUtils; |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取实施详情 |
|
|
|
* @param projectId |
|
|
@@ -45,7 +49,7 @@ public class OperationManage { |
|
|
|
.throwMessage("项目不存在!"); |
|
|
|
|
|
|
|
Operation operation = operationService.getOne(Wrappers.lambdaQuery(Operation.class) |
|
|
|
.eq(Operation::getProjectId, project.getProjectCode()) |
|
|
|
.eq(Operation::getProjectCode, project.getProjectCode()) |
|
|
|
.last(BizConst.LIMIT_1)); |
|
|
|
|
|
|
|
return BeanUtil.copyProperties(operation,OperationVO.class); |
|
|
@@ -58,8 +62,13 @@ public class OperationManage { |
|
|
|
VUtils.isTrue(Objects.isNull(project)) |
|
|
|
.throwMessage("项目不存在!"); |
|
|
|
|
|
|
|
//首先要判断 项目当前状态 是不是 待开工状态 |
|
|
|
VUtils.isTrue(!ProjectStatusEnum.OPERATION.getCode().equals(project.getStatus()) || |
|
|
|
!ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage())) |
|
|
|
.throwMessage("提交失败 该项目不是 待开工或者已立项阶段"); |
|
|
|
|
|
|
|
Operation old = operationService.getOne(Wrappers.lambdaQuery(Operation.class) |
|
|
|
.eq(Operation::getProjectId, project.getProjectCode()) |
|
|
|
.eq(Operation::getProjectCode, project.getProjectCode()) |
|
|
|
.last(BizConst.LIMIT_1)); |
|
|
|
|
|
|
|
Operation entity = BeanUtil.copyProperties(operation, Operation.class); |
|
|
@@ -72,7 +81,11 @@ public class OperationManage { |
|
|
|
entity.setProjectCode(project.getProjectCode()); |
|
|
|
entity.setUpdateOn(LocalDateTime.now()); |
|
|
|
entity.setUpdateBy(user.getUsername()); |
|
|
|
operationService.saveOrUpdate(entity); |
|
|
|
if(operationService.saveOrUpdate(entity)){ |
|
|
|
stateMachineUtils.pass(project); |
|
|
|
project.setUpdateOn(LocalDateTime.now()); |
|
|
|
projectService.updateById(project); |
|
|
|
} |
|
|
|
|
|
|
|
return entity.getProjectCode(); |
|
|
|
} |
|
|
|