diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/event/ProjectStatusChangeEvent.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/event/ProjectStatusChangeEvent.java
index 8f2b79e..4c0f259 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/event/ProjectStatusChangeEvent.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/event/ProjectStatusChangeEvent.java
@@ -111,9 +111,14 @@ public enum ProjectStatusChangeEvent {
*/
REGISTER_APP(ProjectStatusEnum.TO_BE_APP_REGISTER.getCode(), null, null),
/**
- * 采购备案(项目状态变为:建设中)
+ * 采购备案(项目状态变为:待开工)
*/
PURCHASE_PUT_ON_RECORD(ProjectStatusEnum.TO_BE_PURCHASED.getCode(), null, null),
+
+ /**
+ * 开工 到建设中
+ */
+ START_TO_WORK(ProjectStatusEnum.OPERATION.getCode(), null,null),
/**
* 初验备案(项目状态变为:待终验)
*/
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/OperationController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/OperationController.java
new file mode 100644
index 0000000..45827e8
--- /dev/null
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/OperationController.java
@@ -0,0 +1,42 @@
+package com.ningdatech.pmapi.projectdeclared.controller;
+
+import com.ningdatech.log.annotation.WebLog;
+import com.ningdatech.pmapi.projectdeclared.manage.OperationManage;
+import com.ningdatech.pmapi.projectdeclared.model.dto.OperationDTO;
+import com.ningdatech.pmapi.projectdeclared.model.vo.OperationVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * @Classname OperationController
+ * @Description 申报项目-实施
+ * @Date 2023/7/31 09:29
+ * @Author PoffyZhang
+ */
+@Slf4j
+@Validated
+@RestController
+@RequestMapping("/api/v1/declared/operation")
+@Api(value = "OperationController", tags = "申报管理-实施")
+@RequiredArgsConstructor
+public class OperationController {
+ private final OperationManage operationManage;
+
+ @ApiOperation(value = "实施详情", notes = "实施详情")
+ @GetMapping("/detail/{projectId}")
+ public OperationVO detail(@PathVariable Long projectId) {
+ return operationManage.detail(projectId);
+ }
+
+ @GetMapping("/push-operation")
+ @ApiOperation("推送实施信息")
+ @WebLog("推送实施信息")
+ public String pushOperation(@RequestBody OperationDTO operation) {
+ return operationManage.pushOperation(operation);
+ }
+
+}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java
index 296cfb4..ce6f302 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java
@@ -175,7 +175,13 @@ public class ConstructionPlanManage {
log.info("建设方案项目申报成功 【{}】", instanceId);
// 保存建设项目相关
- Project buildProject = projectLibManage.saveConstructProjectInDeclared(projectInfo,instanceId,employeeCode,oldProject);
+ Project buildProject = new Project();
+ if(dto.getRestart()){
+ //如果是重新提交 不用生成新版本 前面已经生成过了
+ buildProject = contructionPlanModifyProject(oldProject, instanceId);
+ }else{
+ buildProject = projectLibManage.saveConstructProjectInDeclared(projectInfo,instanceId,employeeCode,oldProject);
+ }
//发送给第一个审批人消息
noticeManage.sendFirtUser(buildProject,model.getFormName(),instanceId,
@@ -184,6 +190,24 @@ public class ConstructionPlanManage {
return instanceId;
}
+ private Project contructionPlanModifyProject(Project project, String instanceId) {
+ stateMachineUtils.pass(project);
+ project.setUpdateOn(LocalDateTime.now());
+ project.setInstCode(instanceId);
+ projectService.updateById(project);
+
+ //保存项目和实例的关系
+ ProjectInst projectInst = new ProjectInst();
+ projectInst.setProjectId(project.getId());
+ projectInst.setInstCode(instanceId);
+ projectInst.setCreatOn(LocalDateTime.now());
+ projectInst.setUpdateOn(LocalDateTime.now());
+ projectInst.setInstType(ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode());
+ projectInstService.save(projectInst);
+
+ return project;
+ }
+
/**
* 驳回 重新提交建设方案
*
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/OperationManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/OperationManage.java
new file mode 100644
index 0000000..ee0f200
--- /dev/null
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/OperationManage.java
@@ -0,0 +1,79 @@
+package com.ningdatech.pmapi.projectdeclared.manage;
+
+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.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.model.entity.Project;
+import com.ningdatech.pmapi.projectlib.service.IProjectService;
+import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
+import com.ningdatech.pmapi.user.util.LoginUserUtil;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import java.time.LocalDateTime;
+import java.util.Objects;
+
+/**
+ * @Classname OperationManage
+ * @Description
+ * @Date 2023/7/31 14:48
+ * @Author PoffyZhang
+ */
+@Component
+@Slf4j
+@RequiredArgsConstructor
+public class OperationManage {
+
+ private final IOperationService operationService;
+
+ private final IProjectService projectService;
+
+ /**
+ * 获取实施详情
+ * @param projectId
+ * @return
+ */
+ public OperationVO detail(Long projectId) {
+ Project project = projectService.getNewProject(projectId);
+ VUtils.isTrue(Objects.isNull(project))
+ .throwMessage("项目不存在!");
+
+ Operation operation = operationService.getOne(Wrappers.lambdaQuery(Operation.class)
+ .eq(Operation::getProjectId, project.getProjectCode())
+ .last(BizConst.LIMIT_1));
+
+ return BeanUtil.copyProperties(operation,OperationVO.class);
+ }
+
+ public String pushOperation(OperationDTO operation) {
+ UserInfoDetails user = LoginUserUtil.loginUserDetail();
+
+ Project project = projectService.getNewProject(operation.getProjectId());
+ VUtils.isTrue(Objects.isNull(project))
+ .throwMessage("项目不存在!");
+
+ Operation old = operationService.getOne(Wrappers.lambdaQuery(Operation.class)
+ .eq(Operation::getProjectId, project.getProjectCode())
+ .last(BizConst.LIMIT_1));
+
+ Operation entity = BeanUtil.copyProperties(operation, Operation.class);
+ if(Objects.nonNull(old)){
+ entity.setId(old.getId());
+ }else{
+ entity.setCreateOn(LocalDateTime.now());
+ entity.setCreateBy(user.getUsername());
+ }
+ entity.setProjectCode(project.getProjectCode());
+ entity.setUpdateOn(LocalDateTime.now());
+ entity.setUpdateBy(user.getUsername());
+ operationService.saveOrUpdate(entity);
+
+ return entity.getProjectCode();
+ }
+}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/OperationMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/OperationMapper.java
new file mode 100644
index 0000000..5310923
--- /dev/null
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/OperationMapper.java
@@ -0,0 +1,16 @@
+package com.ningdatech.pmapi.projectdeclared.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ningdatech.pmapi.projectdeclared.model.entity.Operation;
+
+/**
+ *
+ * Mapper 接口
+ *
+ *
+ * @author zpf
+ * @since 2023-02-05
+ */
+public interface OperationMapper extends BaseMapper {
+
+}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/OperationMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/OperationMapper.xml
new file mode 100644
index 0000000..fdc4810
--- /dev/null
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/OperationMapper.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/OperationDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/OperationDTO.java
new file mode 100644
index 0000000..3fc30c3
--- /dev/null
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/OperationDTO.java
@@ -0,0 +1,49 @@
+package com.ningdatech.pmapi.projectdeclared.model.dto;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.validation.constraints.NotNull;
+import java.time.LocalDateTime;
+
+/**
+ * @Classname OperationDTO
+ * @Description
+ * @Date 2023/5/29 10:00
+ * @Author PoffyZhang
+ */
+@ApiModel(value = "实施对象DTO", description = "实施对象DTO")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class OperationDTO {
+
+ @ApiModelProperty("项目ID")
+ @NotNull(message = "项目ID不能为空")
+ private Long projectId;
+
+ @ApiModelProperty("项目Code")
+ private String projectCode;
+
+ @ApiModelProperty("项目开工时间")
+ @NotNull(message = "项目开工时间不能为空")
+ private LocalDateTime projectStartDate;
+
+ @ApiModelProperty("初验时间")
+ @NotNull(message = "初验时间不能为空")
+ private LocalDateTime initialInspectionDate;
+
+ @ApiModelProperty("终验时间")
+ @NotNull(message = "终验时间不能为空")
+ private LocalDateTime finalInspectionDate;
+
+ @ApiModelProperty("开始实施时间")
+ @NotNull(message = "开始实施时间不能为空")
+ private LocalDateTime startTrialOperationDate;
+}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/Operation.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/Operation.java
new file mode 100644
index 0000000..da99fc6
--- /dev/null
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/Operation.java
@@ -0,0 +1,59 @@
+package com.ningdatech.pmapi.projectdeclared.model.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import java.time.LocalDateTime;
+
+/**
+ * @Classname Operation
+ * @Description
+ * @Date 2023/5/29 10:00
+ * @Author PoffyZhang
+ */
+@TableName("nd_project_operation")
+@ApiModel(value = "实施对象", description = "实施对象")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class Operation {
+
+ @TableId(type = IdType.AUTO)
+ @ApiModelProperty("id")
+ private Long id;
+
+ @ApiModelProperty("项目ID")
+ private Long projectId;
+
+ @ApiModelProperty("项目Code")
+ private String projectCode;
+
+ @ApiModelProperty("创建时间")
+ private LocalDateTime createOn;
+
+ @ApiModelProperty("修改时间")
+ private LocalDateTime updateOn;
+
+ @ApiModelProperty("创建人 工号")
+ private String createBy;
+
+ @ApiModelProperty("修改人 工号")
+ private String updateBy;
+
+ @ApiModelProperty("项目开工时间")
+ private LocalDateTime projectStartDate;
+
+ @ApiModelProperty("初验时间")
+ private LocalDateTime initialInspectionDate;
+
+ @ApiModelProperty("终验时间")
+ private LocalDateTime finalInspectionDate;
+
+ @ApiModelProperty("开始实施时间")
+ private LocalDateTime startTrialOperationDate;
+}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/OperationVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/OperationVO.java
new file mode 100644
index 0000000..64de66c
--- /dev/null
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/OperationVO.java
@@ -0,0 +1,55 @@
+package com.ningdatech.pmapi.projectdeclared.model.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.time.LocalDateTime;
+
+/**
+ * @Classname Operation
+ * @Description
+ * @Date 2023/5/29 10:00
+ * @Author PoffyZhang
+ */
+@ApiModel(value = "实施对象", description = "实施对象")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class OperationVO {
+
+ @ApiModelProperty("id")
+ private Long id;
+
+ @ApiModelProperty("项目ID")
+ private Long projectId;
+
+ @ApiModelProperty("项目Code")
+ private String projectCode;
+
+ @ApiModelProperty("创建时间")
+ private LocalDateTime createOn;
+
+ @ApiModelProperty("修改时间")
+ private LocalDateTime updateOn;
+
+ @ApiModelProperty("创建人 工号")
+ private String createBy;
+
+ @ApiModelProperty("修改人 工号")
+ private String updateBy;
+
+ @ApiModelProperty("项目开工时间")
+ private LocalDateTime projectStartDate;
+
+ @ApiModelProperty("初验时间")
+ private LocalDateTime initialInspectionDate;
+
+ @ApiModelProperty("终验时间")
+ private LocalDateTime finalInspectionDate;
+
+ @ApiModelProperty("开始实施时间")
+ private LocalDateTime startTrialOperationDate;
+}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IOperationService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IOperationService.java
new file mode 100644
index 0000000..1003f76
--- /dev/null
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IOperationService.java
@@ -0,0 +1,16 @@
+package com.ningdatech.pmapi.projectdeclared.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ningdatech.pmapi.projectdeclared.model.entity.Operation;
+
+/**
+ *
+ * 服务类
+ *
+ *
+ * @author zpf
+ * @since 2023-05-29
+ */
+public interface IOperationService extends IService {
+
+}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/OperationServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/OperationServiceImpl.java
new file mode 100644
index 0000000..cb1eb1a
--- /dev/null
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/OperationServiceImpl.java
@@ -0,0 +1,21 @@
+package com.ningdatech.pmapi.projectdeclared.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ningdatech.pmapi.projectdeclared.mapper.OperationMapper;
+import com.ningdatech.pmapi.projectdeclared.model.entity.Operation;
+import com.ningdatech.pmapi.projectdeclared.service.IOperationService;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * 服务实现类
+ *
+ *
+ * @author zpf
+ * @since 2023-02-05
+ */
+@Service
+public class OperationServiceImpl extends ServiceImpl
+ implements IOperationService {
+
+}
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectStatusEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectStatusEnum.java
index 96ba13a..466aed3 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectStatusEnum.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectStatusEnum.java
@@ -53,6 +53,7 @@ public enum ProjectStatusEnum {
TO_BE_FINALLY_INSPECTED(20003, "待终验"),
FINAL_ACCEPTANCE_IS_UNDER_REVIEW(20004, "终验审核中"),
FINAL_ACCEPTANCE_REVIEW_FAILED(20005, "终验审核不通过"),
+ OPERATION(20006, "待开工"),
/**
* 项目阶段:已归档
*/
diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
index 55243d9..0455b64 100644
--- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
+++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
@@ -184,7 +184,11 @@ public class TodoCenterManage {
List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class)
.in(ProjectInst::getProjectId, projectIdList)
.orderByDesc(ProjectInst::getProjectId));
- Map projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId())));
+ Map projectInfoMap = projectInstList.stream()
+ .filter(p -> StringUtils.isNotBlank(p.getInstCode()) &&
+ !TodoCenterConstant.Declared.NULL_INST_CODE.equals(p.getInstCode()))
+ .collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId())));
+
List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList());
if (CollUtil.isEmpty(instCodes)) {
return PageVo.empty();