Browse Source

Merge branch '20230731_ls2_operation+early_warning+safety_risk+portrait' of http://git.ningdatech.com/liushuai/project-management into dev

master
PoffyZhang 1 year ago
parent
commit
89302d8926
3 changed files with 27 additions and 36 deletions
  1. +26
    -33
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java
  2. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java
  3. +0
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java

+ 26
- 33
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java View File

@@ -7,11 +7,9 @@ import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.poi.excel.ExcelUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
@@ -21,15 +19,12 @@ import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.basic.util.StrPool;
import com.ningdatech.pmapi.common.constant.CommonConst;
import com.ningdatech.pmapi.common.enumeration.CommonEnum;
import com.ningdatech.pmapi.common.helper.RegionCacheHelper;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter;
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.datascope.model.DataScopeDTO;
import com.ningdatech.pmapi.datascope.utils.DataScopeUtil;
import com.ningdatech.pmapi.expert.constant.ExpertUserInfoSensitiveFieldEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectLibFlagEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectRenewalApprovalStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
@@ -44,11 +39,9 @@ import com.ningdatech.pmapi.projectlib.model.req.ProjectIdReq;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.req.StartProjectDeclareReq;
import com.ningdatech.pmapi.projectlib.model.vo.AnnualPlanListItemVO;
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService;
import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -58,20 +51,12 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;

import static com.ningdatech.pmapi.expert.constant.ExpertUserInfoSensitiveFieldEnum.UnitType.list;
import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*;

/**
@@ -89,10 +74,9 @@ public class AnnualPlanLibManage {

private final IProjectService projectService;
private final StateMachineUtils stateMachine;
private final INdProjectStatusChangeService statusChangeService;
private final UserInfoHelper userInfoHelper;
private final IProjectRenewalFundDeclarationService projectRenewalFundDeclarationService;
private final RegionCacheHelper regionCacheHelper;
private final ProjectLibManage projectLibManage;

/**
* 年度计划查询状态
@@ -159,25 +143,34 @@ public class AnnualPlanLibManage {

@Transactional(rollbackFor = Exception.class)
public void projectApproved(ProjectApprovedReq req) {
Project project = projectService.getById(req.getProjectId());
Project oldProject = projectService.getById(req.getProjectId());
Project project = BeanUtil.copyProperties(oldProject, Project.class);
// 被撤回重新申报的项目,项目ID要置空
project.setId(null);
project.setCreateOn(LocalDateTime.now());
project.setUpdateOn(LocalDateTime.now());
stateMachine.pass(project);
//计划出 计划验收时间
LocalDateTime planAcceptanceTime = getPlanAcceptanceTime(req);
LambdaUpdateWrapper<Project> update =
Wrappers.lambdaUpdate(Project.class)
.set(Project::getApprovalAmount, req.getApprovedAmount())
.set(Project::getApprovedFile, req.getApprovedFileId())
.set(Project::getBuildCycle, req.getBuildCycle())
.set(Project::getOriginBuildCycle,req.getBuildCycle())
.set(Project::getApprovedConstructionPlanFile, req.getBuildPlanFileId())
.set(Project::getApprovalDate, req.getApprovedDate())
.set(Project::getStatus, project.getStatus())
.set(Project::getStage, project.getStage())
.set(Objects.nonNull(planAcceptanceTime),Project::getPlanAcceptanceTime,planAcceptanceTime)
//记录原始的 计划验收时间
.set(Objects.nonNull(planAcceptanceTime),Project::getOriginPlanAcceptanceTime,planAcceptanceTime)
.eq(Project::getId, req.getProjectId());
projectService.update(update);
project.setApprovalAmount(req.getApprovedAmount());
project.setApprovedFile(String.valueOf(req.getApprovedFileId()));
project.setBuildCycle(String.valueOf(req.getBuildCycle()));
project.setOriginBuildCycle(req.getBuildCycle());
project.setApprovedConstructionPlanFile(String.valueOf(req.getBuildPlanFileId()));
project.setApprovalDate(req.getApprovedDate());
project.setPlanAcceptanceTime(planAcceptanceTime);
project.setOriginPlanAcceptanceTime(planAcceptanceTime);
// 项目编号不变,版本号加1
project.setProjectCode(oldProject.getProjectCode());
project.setVersion(oldProject.getVersion() + 1);
if(projectService.save(project)){
projectLibManage.saveApplication(project,oldProject,Boolean.TRUE);
// 将旧的项目版本置为不是最新
projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));
}
}

public LocalDateTime getPlanAcceptanceTime(ProjectApprovedReq req){


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java View File

@@ -1218,7 +1218,7 @@ public class ProjectLibManage {
return res;
}

private void saveApplication(Project project,Project oldProject,Boolean isConstruct) {
public void saveApplication(Project project,Project oldProject,Boolean isConstruct) {
List<ProjectApplication> apps = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, oldProject.getProjectCode())
.eq(ProjectApplication::getProjectVersion, oldProject.getVersion()));


+ 0
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java View File

@@ -458,11 +458,9 @@ public class Project implements Serializable {
private BigDecimal contractAmount;

@ApiModelProperty("计划验收时间(有可能是延期后的)")
@Compare("计划验收时间")
private LocalDateTime planAcceptanceTime;

@ApiModelProperty("原本计划验收时间")
@Compare("原本计划验收时间")
private LocalDateTime originPlanAcceptanceTime;

@ApiModelProperty("延期月份数")


Loading…
Cancel
Save