Browse Source

Merge remote-tracking branch 'origin/master'

tags/24080901
PoffyZhang 1 year ago
parent
commit
36cde66301
11 changed files with 257 additions and 221 deletions
  1. +0
    -5
      ningda-generator/pom.xml
  2. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java
  3. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileVO.java
  4. +5
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PurchaseController.java
  5. +74
    -64
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java
  6. +37
    -24
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PurchaseSaveDTO.java
  7. +1
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/Purchase.java
  8. +10
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IPurchaseService.java
  9. +124
    -119
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java
  10. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java
  11. +1
    -0
      pom.xml

+ 0
- 5
ningda-generator/pom.xml View File

@@ -26,11 +26,6 @@
<artifactId>freemarker</artifactId>
</dependency>
<!--Mysql数据库驱动-->
<!-- <dependency>-->
<!-- <groupId>mysql</groupId>-->
<!-- <artifactId>mysql-connector-java</artifactId>-->
<!-- </dependency>-->
<!--KingBase-->
<dependency>
<groupId>com.kingbase8</groupId>
<artifactId>kingbase8-8.2.0</artifactId>


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/filemanage/manage/ProjectFileManage.java View File

@@ -226,7 +226,7 @@ public class ProjectFileManage {
ProjectDetailVO projectDetailVo = projectLibManage.getProjectDetail(projectId);
List<ProcessDetailVO> processDetailVos = projectLibManage.processScheduleDetail(projectId);
ProjectReviewDetailVO projectReviewDetailVo = expertReviewManage.projectExpertReviewDetail(projectCode);
PurchaseVO purchaseVo = purchaseManage.detailByProjectId(projectId);
List<PurchaseVO> purchaseVos = purchaseManage.detailByProjectId(projectId);
ContractVO contractVo = constructionManage.detailContractByProjectId(projectId);
PreInsVO preInsVo = constructionManage.detailPreInsByProjectId(projectId);
FinalAcceptanceVO finalAcceptanceVo = finalAcceptanceManage.detailByProjectId(projectId);
@@ -234,7 +234,7 @@ public class ProjectFileManage {
projectFileVo.setProjectDetailVo(projectDetailVo);
projectFileVo.setProcessDetailVos(processDetailVos);
projectFileVo.setProjectReviewDetailVo(projectReviewDetailVo);
projectFileVo.setPurchaseVo(purchaseVo);
projectFileVo.setPurchaseVos(purchaseVos);
projectFileVo.setContractVo(contractVo);
projectFileVo.setPreInsVo(preInsVo);
projectFileVo.setFinalAcceptanceVo(finalAcceptanceVo);


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/filemanage/model/vo/ProjectFileVO.java View File

@@ -35,7 +35,7 @@ public class ProjectFileVO {
private ProjectReviewDetailVO projectReviewDetailVo;

@ApiModelProperty("招标登记详情")
private PurchaseVO purchaseVo;
private List<PurchaseVO> purchaseVos;

@ApiModelProperty("合同登记详情")
private ContractVO contractVo;


+ 5
- 3
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PurchaseController.java View File

@@ -15,7 +15,9 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
* @Classname PurchaseController
@@ -42,15 +44,15 @@ public class PurchaseController {

@ApiOperation(value = "采购结果备案详情", notes = "采购结果备案详情")
@GetMapping("/detail/{projectId}")
public PurchaseVO detailByProjectId(@PathVariable Long projectId) {
public List<PurchaseVO> detailByProjectId(@PathVariable Long projectId) {
return purchaseManage.detailByProjectId(projectId);
}

@GetMapping("/export")
@ApiOperation("待采购结果备案列表导出")
@WebLog("待采购结果备案列表导出")
public void exportList(ProjectListReq req, HttpServletResponse response){
ExcelDownUtil.downXls(response,req,purchaseManage::exportList);
public void exportList(ProjectListReq req, HttpServletResponse response) {
ExcelDownUtil.downXls(response, req, purchaseManage::exportList);
}

@ApiOperation(value = "填写采购结果", notes = "填写采购结果")


+ 74
- 64
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java View File

@@ -1,23 +1,22 @@
package com.ningdatech.pmapi.projectdeclared.manage;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Assert;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.function.VUtils;
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.constant.RegionConst;
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.dto.DeclaredProjectExportDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.PurchaseSaveDTO;
import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase;
import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO;
import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService;
@@ -35,14 +34,16 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;

/**
* @Classname PurchaseManage
@@ -64,6 +65,7 @@ public class PurchaseManage {

/**
* 待采购的-项目列表
*
* @param req
* @return
*/
@@ -72,9 +74,9 @@ public class PurchaseManage {
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!");
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req);
//待采购状态
query.eq(Project::getStatus,ProjectStatusEnum.TO_BE_PURCHASED.getCode());
query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode());
query.eq(Project::getNewest,Boolean.TRUE);
query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_PURCHASED.getCode());
query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode());
query.eq(Project::getNewest, Boolean.TRUE);
query.orderByAsc(Project::getApprovalDate);
Page<Project> page = projectService.page(req.page(), query);
long total;
@@ -108,32 +110,30 @@ public class PurchaseManage {
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!");
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param);
//待采购状态
query.eq(Project::getStatus,ProjectStatusEnum.TO_BE_PURCHASED.getCode());
query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode());
query.eq(Project::getNewest,Boolean.TRUE);
query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_PURCHASED.getCode());
query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode());
query.eq(Project::getNewest, Boolean.TRUE);
query.orderByAsc(Project::getApprovalDate);
List<Project> records = projectService.list(query);

AtomicInteger serialNumber = new AtomicInteger(0);
Assert.notEmpty(records, "暂无数据可导出");
List<DeclaredProjectExportDTO> data = Lists.newArrayList();

if(CollUtil.isNotEmpty(records)){
data = records.stream().map(r -> {
DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO();
BeanUtils.copyProperties(r, exportDTO);
exportDTO.setProjectTypeName(ProjectTypeEnum.getDesc(r.getProjectType()));
exportDTO.setStatusName(ProjectStatusEnum.getDesc(r.getStatus()));
String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm");
exportDTO.setCreateOn(createOnStr);
exportDTO.setSerialNumber(serialNumber.incrementAndGet());
exportDTO.setApprovedAmount(r.getApprovalAmount());
exportDTO.setApprovalDate(r.getApprovalDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
return exportDTO;
}).collect(Collectors.toList());
}
AtomicInteger serialNumber = new AtomicInteger(0);
records.forEach(r -> {
DeclaredProjectExportDTO dpe = new DeclaredProjectExportDTO();
BeanUtils.copyProperties(r, dpe);
dpe.setProjectTypeName(ProjectTypeEnum.getDesc(r.getProjectType()));
dpe.setStatusName(ProjectStatusEnum.getDesc(r.getStatus()));
String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm");
dpe.setCreateOn(createOnStr);
dpe.setSerialNumber(serialNumber.incrementAndGet());
dpe.setApprovedAmount(r.getApprovalAmount());
dpe.setApprovalDate(r.getApprovalDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
data.add(dpe);
});

String fileName = "采购结果待备案项目列表";
ExcelDownUtil.setFileName(fileName,response);
ExcelDownUtil.setFileName(fileName, response);
//数据导出处理函数
try {
EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class)
@@ -142,25 +142,25 @@ public class PurchaseManage {
.sheet(fileName)
.doWrite(data);
} catch (IOException e) {
throw new RuntimeException(e);
log.error("导出异常", e);
throw BizException.wrap("导出失败,请重试");
}
}

/**
* 获取采购结果备案详情
*
* @param projectId
* @return
*/
public PurchaseVO detailByProjectId(Long projectId) {
Purchase purchase = purchaseService.getOne(Wrappers.lambdaQuery(Purchase.class)
.eq(Purchase::getProjectId, projectId)
.last(BizConst.LIMIT_1));

return BeanUtil.copyProperties(purchase,PurchaseVO.class);
public List<PurchaseVO> detailByProjectId(Long projectId) {
List<Purchase> purchases = purchaseService.listByProjectId(projectId);
return BeanUtil.copyToList(purchases, PurchaseVO.class);
}

/**
* 填写采购结果
*
* @param dto
* @return
*/
@@ -175,40 +175,50 @@ public class PurchaseManage {
VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!");

//首先要判断 项目当前状态 是不是 采购结果备案
VUtils.isTrue(!ProjectStatusEnum.TO_BE_PURCHASED.getCode().equals(project.getStatus()) ||
!ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage()))
VUtils.isTrue(!ProjectStatusEnum.TO_BE_PURCHASED.eq(project.getStatus())
|| !ProjectStatusEnum.PROJECT_APPROVED.eq(project.getStage()))
.throwMessage("提交失败 该项目不是 待采购备案状态或者已立项阶段");

Purchase purchaseEntity = new Purchase();
Purchase purchase = purchaseService.getOne(Wrappers.lambdaQuery(Purchase.class)
.eq(Purchase::getProjectId, projectId)
.last(BizConst.LIMIT_1));

BeanUtil.copyProperties(dto,purchaseEntity);
if(Objects.isNull(purchase)){
purchaseEntity.setCreateOn(LocalDateTime.now());
purchaseEntity.setCreateBy(employeeCode);
}else{
purchaseEntity.setId(purchase.getId());
}
purchaseEntity.setProjectId(projectId);
if(purchaseService.saveOrUpdate(purchaseEntity)){
//如果 需要推送项目和应用管理的话 只有遂昌县才有
// String areaCode = project.getAreaCode();
// String appCode = dto.getAppCode();
// if(RegionConst.RC_SC.equals(areaCode) && StringUtils.isNotBlank(appCode)){
// try{
//
// }catch (Exception e){
// log.info("绑定以及推送项目和应用关系 失败! {}" + e.getMessage());
// }
// }
List<Purchase> purchases = purchaseService.listByProjectId(projectId);
Map<Long, Purchase> purchaseMap = CollUtils.listToMap(purchases, Purchase::getId);
List<Purchase> purchaseEntities = CollUtils.convert(dto.getTenders(), w -> {
Purchase purchase = BeanUtil.copyProperties(w, Purchase.class);
purchase.setProjectId(projectId);
if (!purchaseMap.containsKey(w.getId())) {
purchase.setCreateBy(employeeCode);
}
return purchase;
});

if (purchaseService.saveOrUpdateBatch(purchaseEntities)) {
// 如果 需要推送项目和应用管理的话 只有遂昌县才有
// String areaCode = project.getAreaCode();
// String appCode = dto.getAppCode();
// if(RegionConst.RC_SC.equals(areaCode) && StringUtils.isNotBlank(appCode)){
// try{
//
// }catch (Exception e){
// log.info("绑定以及推送项目和应用关系 失败! {}" + e.getMessage());
// }
// }
//进入到下一状态
stateMachineUtils.pass(project);
project.setUpdateOn(LocalDateTime.now());
project.setTransactionAmount(dto.getTransactionAmount());
project.setTransactionTime(dto.getTransactionTime());

// 获取总的成交时间及金额
LocalDateTime lastTransactionTime = null;
BigDecimal transactionAmountTotal = BigDecimal.ZERO;
for (Purchase purchase : purchases) {
if (lastTransactionTime == null) {
lastTransactionTime = purchase.getTransactionTime();
} else if (purchase.getTransactionTime().isAfter(lastTransactionTime)) {
lastTransactionTime = purchase.getTransactionTime();
}
transactionAmountTotal = transactionAmountTotal.add(purchase.getTransactionAmount());
}

project.setTransactionAmount(transactionAmountTotal);
project.setTransactionTime(lastTransactionTime);
projectService.updateById(project);

return "填写成功";


+ 37
- 24
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/dto/PurchaseSaveDTO.java View File

@@ -6,9 +6,11 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
* @Classname Purchase
@@ -16,8 +18,8 @@ import java.time.LocalDateTime;
* @Date 2023/5/29 10:00
* @Author PoffyZhang
*/
@ApiModel(value = "采购对象", description = "采购对象")
@Data
@ApiModel(value = "采购对象", description = "采购对象")
@AllArgsConstructor
public class PurchaseSaveDTO {

@@ -25,37 +27,48 @@ public class PurchaseSaveDTO {
@NotNull(message = "请传项目ID")
private Long projectId;

@ApiModelProperty("供应商")
private String supplier;
@NotEmpty(message = "标段信息不能为空")
private List<TenderDTO> tenders;

@Data
public static class TenderDTO {

@ApiModelProperty("标段ID")
private Long id;

@ApiModelProperty("供应商")
private String supplier;

@ApiModelProperty("供应商联系人")
private String supplierContact;

@ApiModelProperty("供应商联系人")
private String supplierContact;
@ApiModelProperty("供应商联系方式")
private String supplierContactInfo;

@ApiModelProperty("供应商联系方式")
private String supplierContactInfo;
@ApiModelProperty("采购方式 1公开招标 2自行采购")
private Integer purchaseMethod;

@ApiModelProperty("采购方式 1公开招标 2自行采购")
private Integer purchaseMethod;
@ApiModelProperty("成交金额")
private BigDecimal transactionAmount;

@ApiModelProperty("成交金额")
private BigDecimal transactionAmount;
@ApiModelProperty("成交时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDateTime transactionTime;

@ApiModelProperty("成交时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDateTime transactionTime;
@ApiModelProperty("代理机构")
private String agency;

@ApiModelProperty("代理机构")
private String agency;
@ApiModelProperty("投标文件")
private String biddingDoc;

@ApiModelProperty("投标文件")
private String biddingDoc;
@ApiModelProperty("招标文件")
private String bidDoc;

@ApiModelProperty("招标文件")
private String bidDoc;
@ApiModelProperty("中标通知书")
private String acceptanceLetter;

@ApiModelProperty("中标通知书")
private String acceptanceLetter;
@ApiModelProperty("应用编码")
private String appCode;

@ApiModelProperty("应用编码")
private String appCode;
}
}

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

@@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;


+ 10
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IPurchaseService.java View File

@@ -1,11 +1,15 @@
package com.ningdatech.pmapi.projectdeclared.service;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase;

import java.util.List;

/**
* <p>
* 服务类
* 服务类
* </p>
*
* @author zpf
@@ -13,4 +17,9 @@ import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase;
*/
public interface IPurchaseService extends IService<Purchase> {

default List<Purchase> listByProjectId(Long projectId) {
return list(Wrappers.lambdaQuery(Purchase.class)
.eq(Purchase::getProjectId, projectId));
}

}

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

@@ -116,7 +116,7 @@ public class ProjectLibManage {

public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) {
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req);
query.eq(Project::getNewest,Boolean.TRUE);
query.eq(Project::getNewest, Boolean.TRUE);
Page<Project> page = projectService.page(req.page(), query);
long total;
if ((total = page.getTotal()) == 0) {
@@ -142,11 +142,11 @@ public class ProjectLibManage {
return PageVo.of(records, total);
}

public PageVo<ProjectLibListItemVO> projectLibListWithPermission(ProjectListReq req,UserFullInfoDTO user) {
public PageVo<ProjectLibListItemVO> projectLibListWithPermission(ProjectListReq req, UserFullInfoDTO user) {
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req);
user = buildProjectLibPermission(query,user);
user = buildProjectLibPermission(query, user);
//项目查最新
query.eq(Project::getNewest,Boolean.TRUE);
query.eq(Project::getNewest, Boolean.TRUE);
Page<Project> page = projectService.page(req.page(), query);
long total;
if ((total = page.getTotal()) == 0) {
@@ -187,14 +187,15 @@ public class ProjectLibManage {

/**
* 申报新项目时 保存项目信息和其它相关联的信息
*
* @param projectDto
* @param instanceId
* @param employeeCode
* @return
*/
public Project saveProjectInDeclared(ProjectDTO projectDto, String instanceId,
String employeeCode) {
Project project = saveProjectNewVersion(projectDto,instanceId,employeeCode);
String employeeCode) {
Project project = saveProjectNewVersion(projectDto, instanceId, employeeCode);
//保存项目和实例的关系
ProjectInst projectInst = new ProjectInst();
projectInst.setProjectId(project.getId());
@@ -219,12 +220,12 @@ public class ProjectLibManage {
public Project saveConstructProjectInDeclared(ProjectDTO projectDto, String instanceId,
String employeeCode, Project oldProject) {

Project project = saveConstructProjectNewVersion(projectDto,instanceId,employeeCode,oldProject);
Project project = saveConstructProjectNewVersion(projectDto, instanceId, employeeCode, oldProject);
// 将旧的项目状态、阶段置为null,防止项目还会出现在待申报列表
LambdaUpdateWrapper<Project> updateWrapper = Wrappers.lambdaUpdate(Project.class);
updateWrapper.set(Project::getStage,null)
.set(Project::getStatus,null)
.eq(Project::getId,oldProject.getId());
updateWrapper.set(Project::getStage, null)
.set(Project::getStatus, null)
.eq(Project::getId, oldProject.getId());
projectService.update(updateWrapper);
//保存项目和实例的关系
ProjectInst projectInst = new ProjectInst();
@@ -239,6 +240,7 @@ public class ProjectLibManage {

/**
* 申报新项目时 保存项目信息和其它相关联的信息
*
* @param projectDto
* @param instanceId
* @param employeeCode
@@ -250,7 +252,7 @@ public class ProjectLibManage {
try {
Project project = new Project();
//为空 代表是新申报的
if(Objects.isNull(projectDto.getId())){
if (Objects.isNull(projectDto.getId())) {
BeanUtils.copyProperties(projectDto, project);
project.setCreateOn(LocalDateTime.now());
project.setUpdateOn(LocalDateTime.now());
@@ -261,10 +263,10 @@ public class ProjectLibManage {
String projectCode = generateProjectCodeUtil.generateProjectCode(projectDto);
project.setProjectCode(projectCode);
projectService.save(project);
}else{
} else {
//否则是重新提交的 新生成一个新版本的项目
project = newProjectWithVersion(projectDto);
if(Objects.nonNull(project)){
if (Objects.nonNull(project)) {
project.setInstCode(instanceId);
project.setSponsor(employeeCode);
projectService.updateById(project);
@@ -277,8 +279,8 @@ public class ProjectLibManage {
//采取批量删除 批量添加的方式
Integer version = Objects.nonNull(project.getVersion()) ? project.getVersion() : 1;
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode,project.getProjectCode())
.eq(ProjectApplication::getProjectVersion,version));
.eq(ProjectApplication::getProjectCode, project.getProjectCode())
.eq(ProjectApplication::getProjectVersion, version));
if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) {
Project finalProject = project;
List<ProjectApplication> applications = projectDto.getApplicationList().stream().map(application -> {
@@ -316,7 +318,7 @@ public class ProjectLibManage {
try {
Project project = new Project();
//为空 代表是新申报的
if(Objects.isNull(projectDto.getId())){
if (Objects.isNull(projectDto.getId())) {
BeanUtils.copyProperties(projectDto, project);
// 被撤回重新申报的项目,项目ID要置空
project.setId(null);
@@ -332,23 +334,23 @@ public class ProjectLibManage {
// 标记为建设方案申报
project.setIsConstruct(Boolean.TRUE);
// 保存初步方案项目ID
if (Boolean.TRUE.equals(oldProject.getIsConstruct())){
if (Boolean.TRUE.equals(oldProject.getIsConstruct())) {
// 重新提交
project.setPrePlanProjectId(oldProject.getPrePlanProjectId());
}else {
} else {
project.setPrePlanProjectId(oldProject.getId());
}
projectService.save(project);

// 将旧的项目版本置为不是最新
projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest,Boolean.FALSE)
.ne(Project::getId,project.getId())
.eq(Project::getProjectCode,project.getProjectCode()));
}else{
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));
} else {
//否则是被驳回,重新提交的 新生成一个新版本的项目
project = newProjectWithVersion(projectDto);
if(Objects.nonNull(project)){
if (Objects.nonNull(project)) {
project.setInstCode(instanceId);
project.setSponsor(employeeCode);
projectService.updateById(project);
@@ -360,9 +362,9 @@ public class ProjectLibManage {
? Boolean.TRUE : Boolean.FALSE;
//采取批量删除 批量添加的方式 批量删除建设方案申报后的应用信息
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode,project.getProjectCode())
.eq(ProjectApplication::getProjectVersion,project.getVersion())
.eq(ProjectApplication::getIsConstruct,Boolean.TRUE));
.eq(ProjectApplication::getProjectCode, project.getProjectCode())
.eq(ProjectApplication::getProjectVersion, project.getVersion())
.eq(ProjectApplication::getIsConstruct, Boolean.TRUE));

if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) {
Project finalProject = project;
@@ -390,6 +392,7 @@ public class ProjectLibManage {

/**
* 在其它项目阶段 保存项目信息和其它相关联的信息
*
* @param projectDto
* @return
*/
@@ -403,8 +406,8 @@ public class ProjectLibManage {
? Boolean.TRUE : Boolean.FALSE;
//采取批量删除 批量添加的方式
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode,project.getProjectCode())
.eq(ProjectApplication::getProjectVersion,project.getVersion()));
.eq(ProjectApplication::getProjectCode, project.getProjectCode())
.eq(ProjectApplication::getProjectVersion, project.getVersion()));
if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) {
Project finalProject = project;
List<ProjectApplication> applications = projectDto.getApplicationList().stream().map(application -> {
@@ -429,14 +432,14 @@ public class ProjectLibManage {
* 重新提交工作流时 舍弃在原有项目修改
* 新增一个新的项目 新的版本号
*/
public Project newProjectWithVersion(ProjectDTO projecDto){
public Project newProjectWithVersion(ProjectDTO projecDto) {
Project oldProject = projectService.getById(projecDto.getId());
Project project = new Project();
VUtils.isTrue(Objects.isNull(oldProject))
.throwMessage("项目不存在!");
BeanUtil.copyProperties(oldProject,project, CopyOptions.create()
.throwMessage("项目不存在!");
BeanUtil.copyProperties(oldProject, project, CopyOptions.create()
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE));
BeanUtil.copyProperties(projecDto,project, CopyOptions.create()
BeanUtil.copyProperties(projecDto, project, CopyOptions.create()
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE));
project.setVersion(oldProject.getVersion() + 1);
project.setId(null);
@@ -446,38 +449,38 @@ public class ProjectLibManage {
projectService.save(project);

projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest,Boolean.FALSE)
.ne(Project::getId,project.getId())
.eq(Project::getProjectCode,project.getProjectCode()));
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));

return project;
}

public Project saveProjectWithVersionAndStatus(ProjectDTO projecDto,Integer stageCode,Integer statusCode,Boolean isConstruct){
public Project saveProjectWithVersionAndStatus(ProjectDTO projecDto, Integer stageCode, Integer statusCode, Boolean isConstruct) {
Project oldProject = projectService.getById(projecDto.getId());
Project project = new Project();
VUtils.isTrue(Objects.isNull(oldProject))
.throwMessage("项目不存在!");
BeanUtil.copyProperties(oldProject,project, CopyOptions.create()
BeanUtil.copyProperties(oldProject, project, CopyOptions.create()
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE));
BeanUtil.copyProperties(projecDto,project, CopyOptions.create()
BeanUtil.copyProperties(projecDto, project, CopyOptions.create()
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE));
project.setVersion(oldProject.getVersion() + 1);
project.setId(null);
project.setCreateOn(LocalDateTime.now());
project.setUpdateOn(LocalDateTime.now());
if(Objects.nonNull(stageCode)){
if (Objects.nonNull(stageCode)) {
project.setStage(stageCode);
}
if(Objects.nonNull(statusCode)){
if (Objects.nonNull(statusCode)) {
project.setStatus(statusCode);
}

if(projectService.save(project)){
if (projectService.save(project)) {
projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest,Boolean.FALSE)
.ne(Project::getId,project.getId())
.eq(Project::getProjectCode,project.getProjectCode()));
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));

//采取批量删除 批量添加的方式 批量删除建设方案申报后的应用信息
List<String> projectCodeList = projectService.list(Wrappers.lambdaQuery(Project.class)
@@ -485,17 +488,17 @@ public class ProjectLibManage {
.eq(Project::getIsConstruct, isConstruct)).stream()
.map(Project::getProjectCode).collect(Collectors.toList());
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode,project.getProjectCode())
.in(CollUtil.isNotEmpty(projectCodeList),ProjectApplication::getProjectCode,projectCodeList)
.eq(ProjectApplication::getIsConstruct,isConstruct)
.eq(ProjectApplication::getProjectVersion,project.getVersion()));
.eq(ProjectApplication::getProjectCode, project.getProjectCode())
.in(CollUtil.isNotEmpty(projectCodeList), ProjectApplication::getProjectCode, projectCodeList)
.eq(ProjectApplication::getIsConstruct, isConstruct)
.eq(ProjectApplication::getProjectVersion, project.getVersion()));

//app
List<ProjectApplicationDTO> applicationList = projecDto.getApplicationList();
if(CollUtil.isNotEmpty(applicationList)){
if (CollUtil.isNotEmpty(applicationList)) {
List<ProjectApplication> apps = applicationList.stream()
.map(a -> {
ProjectApplication app = BeanUtil.copyProperties(a,ProjectApplication.class);
ProjectApplication app = BeanUtil.copyProperties(a, ProjectApplication.class);
app.setId(null);
app.setProjectId(project.getId());
app.setBuildOrgName(project.getBuildOrgName());
@@ -512,14 +515,14 @@ public class ProjectLibManage {
return project;
}

public Project saveProjectWithVersion(ProjectDTO projecDto,String instanceId,Integer instType){
public Project saveProjectWithVersion(ProjectDTO projecDto, String instanceId, Integer instType) {
Project oldProject = projectService.getById(projecDto.getId());
Project project = new Project();
VUtils.isTrue(Objects.isNull(oldProject))
.throwMessage("项目不存在!");
BeanUtil.copyProperties(oldProject,project, CopyOptions.create()
BeanUtil.copyProperties(oldProject, project, CopyOptions.create()
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE));
BeanUtil.copyProperties(projecDto,project, CopyOptions.create()
BeanUtil.copyProperties(projecDto, project, CopyOptions.create()
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE));
project.setVersion(oldProject.getVersion() + 1);
project.setId(null);
@@ -527,7 +530,7 @@ public class ProjectLibManage {
project.setCreateOn(LocalDateTime.now());
project.setUpdateOn(LocalDateTime.now());

if(projectService.save(project)){
if (projectService.save(project)) {
//保存项目和实例的关系
ProjectInst projectInst = new ProjectInst();
projectInst.setProjectId(project.getId());
@@ -538,21 +541,21 @@ public class ProjectLibManage {
projectInstService.save(projectInst);

projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest,Boolean.FALSE)
.ne(Project::getId,project.getId())
.eq(Project::getProjectCode,project.getProjectCode()));
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));

//app
//采取批量删除 批量添加的方式
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode,project.getProjectCode())
.eq(ProjectApplication::getProjectVersion,project.getVersion()));
.eq(ProjectApplication::getProjectCode, project.getProjectCode())
.eq(ProjectApplication::getProjectVersion, project.getVersion()));

List<ProjectApplicationDTO> applicationList = projecDto.getApplicationList();
if(CollUtil.isNotEmpty(applicationList)){
if (CollUtil.isNotEmpty(applicationList)) {
List<ProjectApplication> apps = applicationList.stream()
.map(a -> {
ProjectApplication app = BeanUtil.copyProperties(a,ProjectApplication.class);
ProjectApplication app = BeanUtil.copyProperties(a, ProjectApplication.class);
app.setId(null);
app.setProjectId(project.getId());
app.setProjectCode(project.getProjectCode());
@@ -568,11 +571,12 @@ public class ProjectLibManage {

return project;
}
public Project saveProjectWithVersion(Project oldProject,String instanceId,Integer instType){

public Project saveProjectWithVersion(Project oldProject, String instanceId, Integer instType) {
Project project = new Project();
VUtils.isTrue(Objects.isNull(oldProject))
.throwMessage("项目不存在!");
BeanUtil.copyProperties(oldProject,project, CopyOptions.create()
BeanUtil.copyProperties(oldProject, project, CopyOptions.create()
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE));
project.setVersion(oldProject.getVersion() + 1);
project.setId(null);
@@ -580,7 +584,7 @@ public class ProjectLibManage {
project.setCreateOn(LocalDateTime.now());
project.setUpdateOn(LocalDateTime.now());

if(projectService.save(project)){
if (projectService.save(project)) {
//保存项目和实例的关系
ProjectInst projectInst = new ProjectInst();
projectInst.setProjectId(project.getId());
@@ -591,18 +595,19 @@ public class ProjectLibManage {
projectInstService.save(projectInst);

projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest,Boolean.FALSE)
.ne(Project::getId,project.getId())
.eq(Project::getProjectCode,project.getProjectCode()));
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));
}

return project;
}
public Project saveProjectWithVersionAndPass(Project oldProject,String instanceId,Integer instType){

public Project saveProjectWithVersionAndPass(Project oldProject, String instanceId, Integer instType) {
Project project = new Project();
VUtils.isTrue(Objects.isNull(oldProject))
.throwMessage("项目不存在!");
BeanUtil.copyProperties(oldProject,project, CopyOptions.create()
BeanUtil.copyProperties(oldProject, project, CopyOptions.create()
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE));
project.setVersion(oldProject.getVersion() + 1);
project.setId(null);
@@ -613,7 +618,7 @@ public class ProjectLibManage {
project.setIsConstruct(Boolean.TRUE);
stateMachineUtils.pass(project);

if(projectService.save(project)){
if (projectService.save(project)) {
//保存项目和实例的关系
ProjectInst projectInst = new ProjectInst();
projectInst.setProjectId(project.getId());
@@ -624,19 +629,19 @@ public class ProjectLibManage {
projectInstService.save(projectInst);

projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest,Boolean.FALSE)
.ne(Project::getId,project.getId())
.eq(Project::getProjectCode,project.getProjectCode()));
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));
}

return project;
}

public Project saveConstructProjectWithVersionAndPass(Project oldProject,String instanceId,Integer instType){
public Project saveConstructProjectWithVersionAndPass(Project oldProject, String instanceId, Integer instType) {
Project project = new Project();
VUtils.isTrue(Objects.isNull(oldProject))
.throwMessage("项目不存在!");
BeanUtil.copyProperties(oldProject,project, CopyOptions.create()
BeanUtil.copyProperties(oldProject, project, CopyOptions.create()
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE));
project.setVersion(oldProject.getVersion() + 1);
project.setId(null);
@@ -647,7 +652,7 @@ public class ProjectLibManage {
project.setIsConstruct(Boolean.TRUE);
stateMachineUtils.pass(project);

if(projectService.save(project)){
if (projectService.save(project)) {
//保存项目和实例的关系
ProjectInst projectInst = new ProjectInst();
projectInst.setProjectId(project.getId());
@@ -658,9 +663,9 @@ public class ProjectLibManage {
projectInstService.save(projectInst);

projectService.update(Wrappers.lambdaUpdate(Project.class)
.set(Project::getNewest,Boolean.FALSE)
.ne(Project::getId,project.getId())
.eq(Project::getProjectCode,project.getProjectCode()));
.set(Project::getNewest, Boolean.FALSE)
.ne(Project::getId, project.getId())
.eq(Project::getProjectCode, project.getProjectCode()));
}

return project;
@@ -684,8 +689,8 @@ public class ProjectLibManage {
// 查询应用
List<ProjectApplication> applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, vo.getProjectCode())
.eq(ProjectApplication::getIsConstruct,projectInfo.getIsConstruct())
.eq(ProjectApplication::getProjectVersion,projectInfo.getVersion()));
.eq(ProjectApplication::getIsConstruct, projectInfo.getIsConstruct())
.eq(ProjectApplication::getProjectVersion, projectInfo.getVersion()));

Optional.ofNullable(applications).ifPresent(apps ->
vo.setProjectApplications(CollUtils.convert(apps,
@@ -694,10 +699,8 @@ public class ProjectLibManage {

List<Long> allVersionProjectId = projectService.getAllVersionProjectId(projectInfo);
//查询采购备案
Purchase purchase = purchaseService.getOne(Wrappers.lambdaQuery(Purchase.class)
.in(Purchase::getProjectId, allVersionProjectId)
.last(BizConst.LIMIT_1));
vo.setPurchase(BeanUtil.copyProperties(purchase, PurchaseVO.class));
List<Purchase> purchases = purchaseService.listByProjectId(projectId);
vo.setPurchases(BeanUtil.copyToList(purchases, PurchaseVO.class));

//查询合同备案
Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class)
@@ -708,7 +711,7 @@ public class ProjectLibManage {
List<PaymentPlan> payments = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class)
.in(PaymentPlan::getProjectId, allVersionProjectId)
.orderByAsc(PaymentPlan::getPaymentTime));
if(Objects.nonNull(contractVO)){
if (Objects.nonNull(contractVO)) {
contractVO.setPayments(convertPayments(payments,
contractVO.getTotalAmount()));
}
@@ -774,8 +777,8 @@ public class ProjectLibManage {
// 查询应用
List<ProjectApplication> applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, vo.getProjectCode())
.eq(ProjectApplication::getIsConstruct,projectInfo.getIsConstruct())
.eq(ProjectApplication::getProjectVersion,projectInfo.getVersion()));
.eq(ProjectApplication::getIsConstruct, projectInfo.getIsConstruct())
.eq(ProjectApplication::getProjectVersion, projectInfo.getVersion()));

Optional.ofNullable(applications).ifPresent(apps ->
vo.setProjectApplications(CollUtils.convert(apps,
@@ -790,10 +793,8 @@ public class ProjectLibManage {

List<Long> allVersionProjectId = projectService.getAllVersionProjectId(projectInfo);
//查询采购备案
Purchase purchase = purchaseService.getOne(Wrappers.lambdaQuery(Purchase.class)
.in(Purchase::getProjectId, allVersionProjectId)
.last(BizConst.LIMIT_1));
vo.setPurchase(BeanUtil.copyProperties(purchase, PurchaseVO.class));
List<Purchase> purchases = purchaseService.listByProjectId(projectId);
vo.setPurchases(BeanUtil.copyToList(purchases, PurchaseVO.class));

//查询合同备案
Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class)
@@ -804,7 +805,7 @@ public class ProjectLibManage {
List<PaymentPlan> payments = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class)
.in(PaymentPlan::getProjectId, allVersionProjectId)
.orderByAsc(PaymentPlan::getPaymentTime));
if(Objects.nonNull(contractVO)){
if (Objects.nonNull(contractVO)) {
contractVO.setPayments(convertPayments(payments,
contractVO.getTotalAmount()));
}
@@ -854,6 +855,7 @@ public class ProjectLibManage {

/**
* 获取项目初步方案详情
*
* @param projectId
* @return com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO
* @author CMM
@@ -871,7 +873,7 @@ public class ProjectLibManage {
// 查询应用
List<ProjectApplication> applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.eq(ProjectApplication::getProjectCode, vo.getProjectCode())
.eq(ProjectApplication::getIsConstruct,Boolean.FALSE));
.eq(ProjectApplication::getIsConstruct, Boolean.FALSE));

Optional.ofNullable(applications).ifPresent(apps ->
vo.setProjectApplications(CollUtils.convert(apps,
@@ -916,7 +918,7 @@ public class ProjectLibManage {
param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER);
param.setPageSize(CommonConst.EXPORT_PAGE_SIZE);
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param);
query.eq(Project::getNewest,Boolean.TRUE);
query.eq(Project::getNewest, Boolean.TRUE);
List<Project> projects = projectService.list(query);

ExcelExportWriter excelExportWriter = new ExcelExportWriter();
@@ -944,7 +946,7 @@ public class ProjectLibManage {
*
* @param query
*/
public UserFullInfoDTO buildProjectLibPermission(LambdaQueryWrapper<Project> query,UserFullInfoDTO user) {
public UserFullInfoDTO buildProjectLibPermission(LambdaQueryWrapper<Project> query, UserFullInfoDTO user) {
Optional<DataScopeDTO> currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(user);
if (!currentUserDataScope.isPresent()) {
log.warn("没有取到权限信息 当前查询 没有权限条件");
@@ -1052,49 +1054,50 @@ public class ProjectLibManage {

/**
* 应用列表
*
* @param req
* @return
*/
public PageVo<ProjectApplicationVO> applicationList(ProjectApplicationListReq req) {
Page<ProjectApplication> page = req.page();
LambdaQueryWrapper<ProjectApplication> wrapper = Wrappers.lambdaQuery(ProjectApplication.class)
.eq(StringUtils.isNotBlank(req.getBuildOrgName()),ProjectApplication::getBuildOrgName,req.getBuildOrgName());
.eq(StringUtils.isNotBlank(req.getBuildOrgName()), ProjectApplication::getBuildOrgName, req.getBuildOrgName());

if(StringUtils.isNotBlank(req.getApplicationName())){
wrapper.and(q1 -> q1.like(ProjectApplication::getApplicationName,req.getApplicationName())
.or(q2 -> q2.like(ProjectApplication::getRelatedExistsApplication,req.getApplicationName())));
if (StringUtils.isNotBlank(req.getApplicationName())) {
wrapper.and(q1 -> q1.like(ProjectApplication::getApplicationName, req.getApplicationName())
.or(q2 -> q2.like(ProjectApplication::getRelatedExistsApplication, req.getApplicationName())));
}
wrapper.orderByDesc(ProjectApplication::getUpdateOn);
projectApplicationService.page(page,wrapper);
projectApplicationService.page(page, wrapper);

if(0L == page.getTotal()){
if (0L == page.getTotal()) {
return PageVo.empty();
}

List<ProjectApplicationVO> res = page.getRecords().stream()
.map(app -> BeanUtil.copyProperties(app,ProjectApplicationVO.class))
.map(app -> BeanUtil.copyProperties(app, ProjectApplicationVO.class))
.collect(Collectors.toList());

return PageVo.of(res,page.getTotal());
return PageVo.of(res, page.getTotal());
}

private List<PreInsAcceptancePersonVO> convertPersons(List<PreInsAcceptancePerson> acceptancePersons) {
if(CollUtil.isEmpty(acceptancePersons)){
if (CollUtil.isEmpty(acceptancePersons)) {
return Collections.emptyList();
}

return acceptancePersons.stream().map(u -> BeanUtil.copyProperties(u,PreInsAcceptancePersonVO.class)).collect(Collectors.toList());
return acceptancePersons.stream().map(u -> BeanUtil.copyProperties(u, PreInsAcceptancePersonVO.class)).collect(Collectors.toList());
}

private List<PaymentPlanVO> convertPayments(List<PaymentPlan> payments, BigDecimal totalAmount) {
if(CollUtil.isEmpty(payments)){
if (CollUtil.isEmpty(payments)) {
return Collections.emptyList();
}
return payments.stream().map(p -> {
PaymentPlanVO vo = BeanUtil.copyProperties(p, PaymentPlanVO.class);
vo.setRatio((Objects.isNull(totalAmount)||totalAmount.compareTo(BigDecimal.ZERO) == 0) ? "0%"
vo.setRatio((Objects.isNull(totalAmount) || totalAmount.compareTo(BigDecimal.ZERO) == 0) ? "0%"
: p.getPaymentAmount().multiply(BigDecimal.valueOf(100))
.divide(totalAmount,BigDecimal.ROUND_CEILING,BigDecimal.ROUND_CEILING) + "%");
.divide(totalAmount, BigDecimal.ROUND_CEILING, BigDecimal.ROUND_CEILING) + "%");
return vo;
})
.collect(Collectors.toList());
@@ -1102,6 +1105,7 @@ public class ProjectLibManage {

/**
* 历史版本 项目列表
*
* @param id
* @return
*/
@@ -1109,7 +1113,7 @@ public class ProjectLibManage {
JSONObject res = new JSONObject();
Project project = projectService.getById(id);

if(Objects.isNull(project)){
if (Objects.isNull(project)) {
return res;
}

@@ -1117,25 +1121,26 @@ public class ProjectLibManage {
.eq(Project::getProjectCode, project.getProjectCode())
.orderByDesc(Project::getCreateOn));

if(CollUtil.isEmpty(historyProjects)){
if (CollUtil.isEmpty(historyProjects)) {
return res;
}

List<ProjectDetailVO> basicProjects = historyProjects.stream()
List<ProjectDetailVO> basicProjects = historyProjects.stream()
.map(p -> this.getProjectDetailThisVersion(p.getId()))
.filter(p -> Objects.isNull(p.getIsConstruct()) || !p.getIsConstruct())
.collect(Collectors.toList());
List<ProjectDetailVO> constructProjects = historyProjects.stream()
List<ProjectDetailVO> constructProjects = historyProjects.stream()
.map(p -> this.getProjectDetailThisVersion(p.getId()))
.filter(p -> Objects.nonNull(p.getIsConstruct()) && p.getIsConstruct())
.collect(Collectors.toList());
res.put(ProjectConstant.ProjectLib.PROJECT_BASIC,basicProjects);
res.put(ProjectConstant.ProjectLib.PROJECT_CONSTRUCT,constructProjects);
res.put(ProjectConstant.ProjectLib.PROJECT_BASIC, basicProjects);
res.put(ProjectConstant.ProjectLib.PROJECT_CONSTRUCT, constructProjects);
return res;
}

/**
* 查看 项目的 变更记录(驳回 重新发起的 和上个版本的变更字段)
*
* @param projectId
* @return
*/
@@ -1150,7 +1155,7 @@ public class ProjectLibManage {
//2.要判断 项目在当前状态 有没有被驳回和退回过
//当前项目状态流程的 实例 看看是不是有2个以上 有2个说明 有退回 驳回
Boolean isChangeRecord = todoService.isChangeRecord(projectId);
if(!isChangeRecord){
if (!isChangeRecord) {
return res;
}

@@ -1160,18 +1165,18 @@ public class ProjectLibManage {
.eq(Project::getProjectCode, projectCode)
.orderByDesc(Project::getVersion)
.last("limit 2"));
if(CollUtil.isEmpty(twoVersions) || twoVersions.size() < 2){
if (CollUtil.isEmpty(twoVersions) || twoVersions.size() < 2) {
return res;
}

Project lastProject = twoVersions.get(1);
Project thisProject = twoVersions.get(0);
res.put(ProjectConstant.ProjectLib.CHANGES_KEY,
new CompareUtils<Project>().compareToJson(thisProject, lastProject,null));
new CompareUtils<Project>().compareToJson(thisProject, lastProject, null));
ProcessDetailReq req = new ProcessDetailReq();
req.setProjectId(lastProject.getId());
req.setInstanceId(lastProject.getInstCode());
res.put(ProjectConstant.ProjectLib.PROCESS_KEY,todoService.getProcessDetail(req));
res.put(ProjectConstant.ProjectLib.PROCESS_KEY, todoService.getProcessDetail(req));
return res;
}
}

+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java View File

@@ -369,7 +369,7 @@ public class ProjectDetailVO {
private ContractVO contract;

@ApiModelProperty("采购信息")
private PurchaseVO purchase;
private List<PurchaseVO> purchases;

@ApiModelProperty("初审人员")
private List<PreInsAcceptancePersonVO> acceptancePersons;
@@ -400,7 +400,7 @@ public class ProjectDetailVO {
this.versionStr = "当前版本";
return this.versionStr;
}
this.versionStr = "v" + NdDateUtils.format(this.createOn,"yyyyMMddHHmmss");
this.versionStr = "v" + NdDateUtils.format(this.createOn, "yyyyMMddHHmmss");
return this.versionStr;
}



+ 1
- 0
pom.xml View File

@@ -11,6 +11,7 @@
<description>丽水项管二期项目</description>

<properties>
<skipTests>true</skipTests>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-boot.version>2.6.11</spring-boot.version>
<maven.compiler.source>1.8</maven.compiler.source>


Loading…
Cancel
Save