|
|
@@ -3,6 +3,7 @@ package com.ningdatech.pmapi.projectlib.manage; |
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.bean.copier.CopyOptions; |
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
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; |
|
|
@@ -43,6 +44,7 @@ import com.ningdatech.pmapi.projectdeclared.service.IPaymentPlanService; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.service.IPreInsAcceptancePersonService; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService; |
|
|
|
import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; |
|
|
|
import com.ningdatech.pmapi.projectlib.constant.ProjectConstant; |
|
|
|
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; |
|
|
|
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; |
|
|
|
import com.ningdatech.pmapi.projectlib.handle.ProcessExecuteChainHandle; |
|
|
@@ -481,7 +483,7 @@ public class ProjectLibManage { |
|
|
|
.map(Project::getId).collect(Collectors.toList()); |
|
|
|
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) |
|
|
|
.eq(ProjectApplication::getProjectCode,project.getProjectCode()) |
|
|
|
.in(ProjectApplication::getProjectId,projectIdList)); |
|
|
|
.in(CollUtil.isNotEmpty(projectIdList),ProjectApplication::getProjectId,projectIdList)); |
|
|
|
|
|
|
|
//app |
|
|
|
List<ProjectApplicationDTO> applicationList = projecDto.getApplicationList(); |
|
|
@@ -1000,11 +1002,12 @@ public class ProjectLibManage { |
|
|
|
* @param id |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public List<ProjectDetailVO> historyProjects(Long id) { |
|
|
|
public JSONObject historyProjects(Long id) { |
|
|
|
JSONObject res = new JSONObject(); |
|
|
|
Project project = projectService.getById(id); |
|
|
|
|
|
|
|
if(Objects.isNull(project)){ |
|
|
|
return Collections.emptyList(); |
|
|
|
return res; |
|
|
|
} |
|
|
|
|
|
|
|
List<Project> historyProjects = projectService.list(Wrappers.lambdaQuery(Project.class) |
|
|
@@ -1012,11 +1015,48 @@ public class ProjectLibManage { |
|
|
|
.orderByDesc(Project::getCreateOn)); |
|
|
|
|
|
|
|
if(CollUtil.isEmpty(historyProjects)){ |
|
|
|
return Collections.emptyList(); |
|
|
|
return res; |
|
|
|
} |
|
|
|
|
|
|
|
return historyProjects.stream() |
|
|
|
List<ProjectDetailVO> basicProjects = historyProjects.stream() |
|
|
|
.map(p -> this.getProjectDetail(p.getId())) |
|
|
|
.filter(p -> !p.getIsConstruct()) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
List<ProjectDetailVO> constructProjects = historyProjects.stream() |
|
|
|
.map(p -> this.getProjectDetail(p.getId())) |
|
|
|
.filter(p -> p.getIsConstruct()) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
res.put(ProjectConstant.ProjectLib.PROJECT_BASIC,basicProjects); |
|
|
|
res.put(ProjectConstant.ProjectLib.PROJECT_CONSTRUCT,constructProjects); |
|
|
|
return res; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 查看 项目的 变更记录(驳回 重新发起的 和上个版本的变更字段) |
|
|
|
* @param projectId |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public JSONObject changeRecord(Long projectId) { |
|
|
|
JSONObject res = new JSONObject(); |
|
|
|
|
|
|
|
//1.先判断下 项目存不存在 |
|
|
|
Project project = projectService.getById(projectId); |
|
|
|
VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在"); |
|
|
|
|
|
|
|
//2.要判断 项目在当前状态 有没有被驳回和退回过 |
|
|
|
//当前项目状态流程的 实例 看看是不是有2个以上 有2个说明 有退回 驳回 |
|
|
|
List<ProjectInst> pis = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) |
|
|
|
.eq(ProjectInst::getProjectId, projectId) |
|
|
|
.orderByDesc(ProjectInst::getInstType) |
|
|
|
.last("limit 2")); |
|
|
|
VUtils.isTrue(CollUtil.isEmpty(pis)).throwMessage("该项目没有审批流"); |
|
|
|
VUtils.isTrue( pis.size() < 2 || |
|
|
|
!pis.get(0).getInstType().equals(pis.get(1).getInstType())) |
|
|
|
.throwMessage("该项目在当前流程没有被驳回 撤回过"); |
|
|
|
|
|
|
|
//3. 去对比 当前版本和上个版本 的字段对比 |
|
|
|
String projectCode = project.getProjectCode(); |
|
|
|
|
|
|
|
return res; |
|
|
|
} |
|
|
|
} |