Browse Source

Merge remote-tracking branch 'origin/master'

tags/24080901
WendyYang 1 year ago
parent
commit
8697b8ed45
13 changed files with 379 additions and 3 deletions
  1. +6
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/event/ProjectStatusChangeEvent.java
  2. +42
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/OperationController.java
  3. +25
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java
  4. +79
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/OperationManage.java
  5. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/OperationMapper.java
  6. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/OperationMapper.xml
  7. +49
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/OperationDTO.java
  8. +59
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/Operation.java
  9. +55
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/OperationVO.java
  10. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IOperationService.java
  11. +21
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/OperationServiceImpl.java
  12. +1
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectStatusEnum.java
  13. +5
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java

+ 6
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/event/ProjectStatusChangeEvent.java View File

@@ -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),
/**
* 初验备案(项目状态变为:待终验)
*/


+ 42
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/OperationController.java View File

@@ -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);
}

}

+ 25
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java View File

@@ -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;
}

/**
* 驳回 重新提交建设方案
*


+ 79
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/OperationManage.java View File

@@ -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();
}
}

+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/OperationMapper.java View File

@@ -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;

/**
* <p>
* Mapper 接口
* </p>
*
* @author zpf
* @since 2023-02-05
*/
public interface OperationMapper extends BaseMapper<Operation> {

}

+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/OperationMapper.xml View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ningdatech.pmapi.projectdeclared.mapper.OperationMapper">

</mapper>

+ 49
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/OperationDTO.java View File

@@ -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;
}

+ 59
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/Operation.java View File

@@ -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;
}

+ 55
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/OperationVO.java View File

@@ -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;
}

+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IOperationService.java View File

@@ -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;

/**
* <p>
* 服务类
* </p>
*
* @author zpf
* @since 2023-05-29
*/
public interface IOperationService extends IService<Operation> {

}

+ 21
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/OperationServiceImpl.java View File

@@ -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;

/**
* <p>
* 服务实现类
* </p>
*
* @author zpf
* @since 2023-02-05
*/
@Service
public class OperationServiceImpl extends ServiceImpl<OperationMapper, Operation>
implements IOperationService {

}

+ 1
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ProjectStatusEnum.java View File

@@ -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, "待开工"),
/**
* 项目阶段:已归档
*/


+ 5
- 1
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java View File

@@ -184,7 +184,11 @@ public class TodoCenterManage {
List<ProjectInst> projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class)
.in(ProjectInst::getProjectId, projectIdList)
.orderByDesc(ProjectInst::getProjectId));
Map<String, Project> projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId())));
Map<String, Project> 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<String> instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList());
if (CollUtil.isEmpty(instCodes)) {
return PageVo.empty();


Loading…
Cancel
Save