Bladeren bron

立项备案列表修改

tags/24080901
WendyYang 6 maanden geleden
bovenliggende
commit
f6533f7b19
2 gewijzigde bestanden met toevoegingen van 57 en 55 verwijderingen
  1. +47
    -55
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java
  2. +10
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IMhProjectService.java

+ 47
- 55
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java Bestand weergeven

@@ -14,7 +14,6 @@ import com.hz.pm.api.common.enumeration.CommonEnum;
import com.hz.pm.api.common.enumeration.ProjectProcessType;
import com.hz.pm.api.common.helper.UserInfoHelper;
import com.hz.pm.api.common.model.constant.TypeReferenceConst;
import com.hz.pm.api.common.util.BizUtils;
import com.hz.pm.api.datascope.model.DataScopeDTO;
import com.hz.pm.api.datascope.utils.DataScopeUtil;
import com.hz.pm.api.external.model.enumeration.MhUnitStripEnum;
@@ -38,7 +37,10 @@ import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus;
import com.hz.pm.api.projectlib.model.req.DeclaredProjectListReq;
import com.hz.pm.api.projectlib.model.vo.DeclaredProjectListVO;
import com.hz.pm.api.projectlib.model.vo.MhProjectBaseInfoVO;
import com.hz.pm.api.projectlib.service.*;
import com.hz.pm.api.projectlib.service.IMhProjectSchemaTargetDataService;
import com.hz.pm.api.projectlib.service.IMhProjectService;
import com.hz.pm.api.projectlib.service.IProjectGovSystemReplaceInfosService;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.staging.enums.MsgTypeEnum;
import com.hz.pm.api.sys.manage.NoticeManage;
import com.hz.pm.api.sys.manage.ProcessModelManage;
@@ -98,22 +100,21 @@ public class DeclaredRecordManage {
private final DeclaredProjectHelper declaredProjectHelper;
private final ProcessInstanceService processInstanceService;
private final ProjectLibManage projectLibManage;
private final IProjectStatusChangeService projectStatusChangeService;
private final IProjectGovSystemReplaceInfosService systemReplaceInfosService;
private final MHTodoClient mhTodoClient;

private LambdaQueryWrapper<MhProject> buildQuery(DeclaredProjectListReq req) {
LambdaQueryWrapper<MhProject> query = Wrappers.lambdaQuery(MhProject.class)
.like(StrUtil.isNotBlank(req.getProjectName()), MhProject::getProjectName, req.getProjectName())
.like(StrUtil.isNotBlank(req.getDeclaredUnit()), MhProject::getUnitName, req.getDeclaredUnit());
private LambdaQueryWrapper<Project> buildQuery(DeclaredProjectListReq req) {
LambdaQueryWrapper<Project> query = Wrappers.lambdaQuery(Project.class)
.like(StrUtil.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName())
.like(StrUtil.isNotBlank(req.getDeclaredUnit()), Project::getBuildOrgName, req.getDeclaredUnit());
if (req.getCreateDateMin() != null) {
query.ge(MhProject::getCreateTime, req.getCreateDateMin());
query.ge(Project::getCreateOn, req.getCreateDateMin());
}
if (req.getCreateDateMax() != null) {
query.lt(MhProject::getCreateTime, req.getCreateDateMax().minusDays(1));
query.lt(Project::getCreateOn, req.getCreateDateMax().minusDays(1));
}
if (req.getUnitStrip() != null) {
query.eq(MhProject::getUnitStrip, req.getUnitStrip());
query.eq(Project::getUnitStrip, req.getUnitStrip());
}
return query;
}
@@ -199,50 +200,40 @@ public class DeclaredRecordManage {
}

public PageVo<DeclaredProjectListVO> pageDeclaredProject(DeclaredProjectListReq req) {
LambdaQueryWrapper<MhProject> query = buildQuery(req);
LambdaQueryWrapper<Project> query = buildQuery(req);
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
// 查询审核中、失败、待立项备案的项目信息
LambdaQueryWrapper<Project> pQuery = Wrappers.lambdaQuery(Project.class)
.in(Project::getStatus, ProjectStatus.DECLARED_APPROVED_RECORD_FAILED.getCode(),
if (!buildProjectLibPermission(query, user)) {
return PageVo.empty();
}
query.in(Project::getStatus, ProjectStatus.DECLARED_APPROVED_RECORD_FAILED.getCode(),
ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD.getCode(),
ProjectStatus.DECLARED_APPROVED_RECORD_AUDITING.getCode())
.eq(Project::getNewest, Boolean.TRUE)
.select(Project::getId, Project::getProjectCode, Project::getStage, Project::getStatus, Project::getCreateOn);
if (!buildProjectLibPermission(pQuery, user)) {
return PageVo.empty();
}
if (!buildMhProjectLibPermission(query, user, req.getDeclaredUnitId())) {
return PageVo.empty();
}
List<Project> projects = projectService.list(pQuery);
Map<String, Project> projectMap = BizUtils.groupFirstMap(projects, Project::getProjectCode,
Comparator.comparing(Project::getCreateOn).thenComparing(Project::getNewest).reversed());
query.and(q1 -> q1.isNull(MhProject::getProjectCode)
.or(!projects.isEmpty(), q2 -> q2.in(MhProject::getProjectCode, projectMap.keySet())));
Page<MhProject> page = mhProjectService.page(req.page(), query);
.orderByDesc(Project::getUpdateOn);
Page<Project> page = projectService.page(req.page(), query);
if (page.getTotal() == 0) {
return PageVo.empty();
}
List<MhProject> records = page.getRecords();
List<DeclaredProjectListVO> data = records.stream().map(w -> {
List<String> projCodes = CollUtils.fieldList(page.getRecords(), Project::getProjectCode);
List<MhProject> mhProjList = mhProjectService.listByProjectCode(projCodes);
Map<String, MhProject> mhProjMap = CollUtils.listToMap(mhProjList, MhProject::getProjectCode);
List<DeclaredProjectListVO> data = page.getRecords().stream().map(w -> {
DeclaredProjectListVO item = new DeclaredProjectListVO();
item.setMhProjectId(w.getId());
Project project = projectMap.get(w.getProjectCode());
if (project == null) {
item.setStatus(ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD.getCode());
item.setStage(ProjectStatus.NOT_APPROVED.getCode());
} else {
item.setStatus(project.getStatus());
item.setStage(project.getStage());
item.setProjectId(project.getId());
MhProject mhProj = mhProjMap.get(w.getProjectCode());
if (mhProj != null) {
item.setMhProjectId(mhProj.getId());
}
item.setStatus(w.getStatus());
item.setStage(w.getStage());
item.setProjectId(w.getId());
item.setUnitStrip(w.getUnitStrip());
item.setUnitStripName(MhUnitStripEnum.getVal(w.getUnitStrip()));
item.setDeclaredUnit(w.getUnitName());
item.setDeclaredUnit(w.getBuildOrgName());
item.setProjectCode(w.getProjectCode());
item.setProjectName(w.getProjectName());
item.setDeclaredAmount(w.getTotalMoney());
item.setCreateTime(w.getCreateTime());
item.setDeclaredAmount(w.getDeclareAmount());
item.setCreateTime(w.getCreateOn());
return item;
}).collect(Collectors.toList());
return PageVo.of(data, page.getTotal());
@@ -279,7 +270,6 @@ public class DeclaredRecordManage {
@Transactional(rollbackFor = Exception.class)
public synchronized void startDeclaredRecord(DefaultDeclaredDTO req) {
ProjectDTO projectInfo = req.getProjectInfo();
Assert.notNull(projectInfo.getMhProjectId(), "信产项目ID不能为空");
UserInfoDetails user = LoginUserUtil.loginUserDetail();

projectInfo.setBuildOrgCode(user.getMhUnitIdStr());
@@ -326,11 +316,13 @@ public class DeclaredRecordManage {
//如果是草稿箱提交 删除对应的草稿箱
projectDraftService.removeById(projectInfo.getDraftId());
}
// 申报项目完成后 保存项目编码
Wrapper<MhProject> update = Wrappers.lambdaUpdate(MhProject.class)
.set(MhProject::getProjectCode, newProj.getProjectCode())
.eq(MhProject::getId, projectInfo.getMhProjectId());
mhProjectService.update(update);
if (projectInfo.getMhProjectId() != null) {
// 申报项目完成后 保存项目编码
Wrapper<MhProject> update = Wrappers.lambdaUpdate(MhProject.class)
.set(MhProject::getProjectCode, newProj.getProjectCode())
.eq(MhProject::getId, projectInfo.getMhProjectId());
mhProjectService.update(update);
}
//发送给第一个审批人消息
noticeManage.sendFirstUser(newProj, model.getFormName(), instanceId,
WorkNoticeConst.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW);
@@ -407,22 +399,22 @@ public class DeclaredRecordManage {
if (mhProjects.isEmpty()) {
return;
}
for (MhProject mhProject : mhProjects) {
if (StrUtil.isNotBlank(mhProject.getProjectCode())) {
for (MhProject mhProj : mhProjects) {
if (StrUtil.isNotBlank(mhProj.getProjectCode())) {
continue;
}
LocalDateTime now = LocalDateTime.now();
Project project = new Project();
project.setProjectName(mhProject.getProjectName());
project.setBuildOrgCode(String.valueOf(mhProject.getUnitId()));
project.setBuildOrgName(mhProject.getUnitName());
project.setUnitStrip(mhProject.getUnitStrip());
project.setProjectName(mhProj.getProjectName());
project.setBuildOrgCode(String.valueOf(mhProj.getUnitId()));
project.setBuildOrgName(mhProj.getUnitName());
project.setUnitStrip(mhProj.getUnitStrip());
project.setVersion(0);
project.setNewest(Boolean.TRUE);
project.setStatus(ProjectStatus.DECLARED_APPROVED_TO_BE_RECORD.getCode());
project.setStage(ProjectStatus.NOT_APPROVED.getCode());
ProjectDTO tmpProject = BeanUtil.copyProperties(project, ProjectDTO.class);
String projectCode = projectCodeGenUtil.generateProjectCode(tmpProject);
ProjectDTO tmpProj = BeanUtil.copyProperties(project, ProjectDTO.class);
String projectCode = projectCodeGenUtil.generateProjectCode(tmpProj);
project.setProjectCode(projectCode);
project.setCreateOn(now);
project.setCreateBy(0L);
@@ -431,7 +423,7 @@ public class DeclaredRecordManage {
projectService.save(project);
mhProjectService.update(Wrappers.lambdaUpdate(MhProject.class)
.set(MhProject::getProjectCode, projectCode)
.eq(MhProject::getId, mhProject.getId()));
.eq(MhProject::getId, mhProj.getId()));
}
}



+ 10
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IMhProjectService.java Bestand weergeven

@@ -1,11 +1,14 @@
package com.hz.pm.api.projectlib.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.projectlib.model.entity.MhProject;

import java.util.Collection;
import java.util.List;
import java.util.Optional;

/**
@@ -39,4 +42,11 @@ public interface IMhProjectService extends IService<MhProject> {
return count(query) > 0;
}


default List<MhProject> listByProjectCode(Collection<String> projectCodes) {
Wrapper<MhProject> query = Wrappers.lambdaQuery(MhProject.class)
.in(MhProject::getProjectCode, projectCodes);
return list(query);
}

}

Laden…
Annuleren
Opslaan