|
|
@@ -10,27 +10,23 @@ import com.ningdatech.basic.model.PageVo; |
|
|
|
import com.ningdatech.basic.util.CollUtils; |
|
|
|
import com.ningdatech.basic.util.NdDateUtils; |
|
|
|
import com.ningdatech.pmapi.common.constant.BizConst; |
|
|
|
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; |
|
|
|
import com.ningdatech.pmapi.common.helper.UserInfoHelper; |
|
|
|
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; |
|
|
|
import com.ningdatech.pmapi.common.util.ExcelDownUtil; |
|
|
|
import com.ningdatech.pmapi.common.util.ExcelExportStyle; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.model.dto.*; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.service.IProjectDraftService; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService; |
|
|
|
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; |
|
|
|
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; |
|
|
|
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; |
|
|
|
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; |
|
|
|
import com.ningdatech.pmapi.projectlib.model.entity.Project; |
|
|
|
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; |
|
|
|
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; |
|
|
|
import com.ningdatech.pmapi.projectlib.service.IProjectService; |
|
|
|
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; |
|
|
|
import com.ningdatech.pmapi.user.util.LoginUserUtil; |
|
|
|
import com.wflow.bean.entity.WflowModels; |
|
|
|
import com.wflow.exception.BusinessException; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
@@ -60,6 +56,8 @@ public class PurchaseManage { |
|
|
|
|
|
|
|
private final IPurchaseService purchaseService; |
|
|
|
|
|
|
|
private final StateMachineUtils stateMachineUtils; |
|
|
|
|
|
|
|
/** |
|
|
|
* 待采购的-项目列表 |
|
|
|
* @param req |
|
|
@@ -158,12 +156,12 @@ public class PurchaseManage { |
|
|
|
|
|
|
|
Long projectId = dto.getProjectId(); |
|
|
|
VUtils.isTrue(Objects.isNull(projectId)).throwMessage("提交失败 缺少项目ID!"); |
|
|
|
Project projectInfo = projectService.getById(projectId); |
|
|
|
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); |
|
|
|
Project project = projectService.getById(projectId); |
|
|
|
VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); |
|
|
|
|
|
|
|
//首先要判断 项目当前状态 是不是 采购结果备案 |
|
|
|
VUtils.isTrue(!ProjectStatusEnum.TO_BE_PURCHASED.getCode().equals(projectInfo.getStatus()) || |
|
|
|
!ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(projectInfo.getStage())) |
|
|
|
VUtils.isTrue(!ProjectStatusEnum.TO_BE_PURCHASED.getCode().equals(project.getStatus()) || |
|
|
|
!ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage())) |
|
|
|
.throwMessage("提交失败 该项目不是 待采购备案状态或者已立项阶段"); |
|
|
|
|
|
|
|
Purchase purchaseEntity = new Purchase(); |
|
|
@@ -180,6 +178,12 @@ public class PurchaseManage { |
|
|
|
} |
|
|
|
purchaseEntity.setProjectId(projectId); |
|
|
|
purchaseService.saveOrUpdate(purchaseEntity); |
|
|
|
|
|
|
|
//进入到下一状态 |
|
|
|
stateMachineUtils.pass(project); |
|
|
|
project.setUpdateOn(LocalDateTime.now()); |
|
|
|
projectService.updateById(project); |
|
|
|
|
|
|
|
return "填写成功"; |
|
|
|
} |
|
|
|
} |