Explorar el Código

工作台整改

master
PoffyZhang hace 11 meses
padre
commit
c6eb25a0fa
Se han modificado 3 ficheros con 105 adiciones y 1 borrados
  1. +99
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java
  2. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java
  3. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java

+ 99
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java Ver fichero

@@ -22,6 +22,7 @@ import com.ningdatech.pmapi.common.constant.RegionConst;
import com.ningdatech.pmapi.common.enumeration.CommonEnum;
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum;
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.BizUtils;
@@ -72,6 +73,7 @@ import com.ningdatech.pmapi.safety.service.IPersonSafetyInfoService;
import com.ningdatech.pmapi.safety.service.ISupplierSafetyQualificationService;
import com.ningdatech.pmapi.todocenter.model.req.ProcessDetailReq;
import com.ningdatech.pmapi.todocenter.service.ITodoService;
import com.ningdatech.pmapi.user.entity.UserInfo;
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;
@@ -80,6 +82,8 @@ import com.wflow.workflow.bean.vo.ProcessDetailVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.flowable.engine.TaskService;
import org.flowable.task.api.Task;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

@@ -133,6 +137,10 @@ public class ProjectLibManage {

private final ApplicationHandler applicationHandler;

private final TaskService taskService;

private final UserInfoHelper userInfoHelper;

public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) {
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req);
query.eq(Project::getNewest, Boolean.TRUE);
@@ -272,6 +280,97 @@ public class ProjectLibManage {
}

/**
* 项目列表带当前审批人(工作流的)
* @param req
* @param user
* @return
*/
public PageVo<ProjectLibListItemVO> projectLibListApprove(ProjectListReq req, UserFullInfoDTO user) {
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req);
user = buildProjectLibPermission(query, user);
//项目查最新
query.eq(Project::getNewest, Boolean.TRUE);
Page<Project> page = projectService.page(req.page(), query);
if (CollUtil.isEmpty(page.getRecords())) {
return PageVo.empty();
}
UserFullInfoDTO finalUser = user;

Set<String> projectCodes = page.getRecords().stream()
.map(Project::getProjectCode).collect(Collectors.toSet());
Set<String> instCodes = page.getRecords().stream()
.map(Project::getInstCode).collect(Collectors.toSet());
List<Task> tasks = taskService.createTaskQuery()
.processInstanceIdIn(instCodes)
.orderByTaskCreateTime()
.asc()
.list();
Map<String, List<Task>> map = Maps.newHashMap();
Map<String,UserFullInfoDTO> userMap = Maps.newHashMap();
if(CollUtil.isNotEmpty(tasks)){
map = tasks.stream()
.collect(Collectors.groupingBy(Task::getProcessInstanceId));
userMap = searchUser(tasks,userInfoHelper);
}

List<ProjectLibListItemVO> records = Lists.newArrayList();
for(Project w : page.getRecords()){
ProjectLibListItemVO item = new ProjectLibListItemVO();
item.setId(w.getId());
item.setProjectName(w.getProjectName());
item.setProjectCode(w.getProjectCode());
item.setArea(w.getArea());
item.setAreaCode(w.getAreaCode());
item.setCreateOn(w.getCreateOn());
item.setDeclaredAmount(w.getDeclareAmount());
item.setStage(w.getStage());
item.setStatus(w.getStatus());
item.setProjectType(w.getProjectType());
item.setProjectYear(w.getProjectYear());
item.setBuildOrg(w.getBuildOrgName());
item.setBizDomain(w.getBizDomain());
item.setProcessStatus(w.getProcessStatus());
item.setInstCode(w.getInstCode());
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg());
item.setApproveUsers(buildApproveUsers(w.getInstCode(),map,userMap));
if (finalUser.getIsOrgAdmin() &&
ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus())
&& StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode())
&& w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) {
item.setCanPreDeclared(Boolean.TRUE);
}
item.setApprovedAmount(w.getApprovalAmount());
item.setAnnualPlanAmount(w.getAnnualPlanAmount());
item.setPrePlanProjectId(w.getPrePlanProjectId());
records.add(item);
}
return PageVo.of(records, page.getTotal());
}

private List<UserFullInfoDTO> buildApproveUsers(String instCode, Map<String, List<Task>> map,
Map<String, UserFullInfoDTO> userMap) {
if(map.containsKey(instCode)){
List<Task> tasks = map.get(instCode);
return tasks.stream().map(task -> userMap.get(task.getAssignee()))
.filter(Objects::nonNull).collect(Collectors.toList());
}
return Collections.emptyList();
}

private Map<String, UserFullInfoDTO> searchUser(List<Task> tasks, UserInfoHelper userInfoHelper) {
if(CollUtil.isNotEmpty(tasks)){
return Collections.emptyMap();
}
List<UserFullInfoDTO> users = userInfoHelper.getUserFullInfoByEmployeeCodes(
tasks.stream().map(Task::getAssignee).collect(Collectors.toSet()));
if(CollUtil.isNotEmpty(users)){
return users.stream().collect(Collectors
.toMap(UserFullInfoDTO::getEmployeeCode,u -> u));
}
return Collections.emptyMap();
}

/**
* 项目申报和项目归集的并集
* @param req
* @param user


+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java Ver fichero

@@ -9,6 +9,8 @@ import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeNewEnum;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration;
import com.ningdatech.pmapi.user.entity.UserInfo;
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 io.swagger.annotations.ApiModel;
@@ -163,6 +165,9 @@ public class ProjectLibListItemVO {
//预审申报时候 需不需要上传上级条线意见文件
private Boolean needUploadSuperLineFile;

@ApiModelProperty("当前审批人")
private List<UserFullInfoDTO> approveUsers;

@ApiModelProperty("年度投资金额总额")
private BigDecimal annualAccumulateAmount;
private List<AnnualAmountVO> annualAccumulateAmountList;


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java Ver fichero

@@ -130,7 +130,7 @@ public class WorkbenchManage {
projectListReq.setPageSize(5);
projectListReq.setProjectYear(year);
projectListReq.setBuildOrgCode(user.getEmpPosUnitCode());
res.setProjects(new ArrayList<>(projectLibManage.projectLibListWithPermission(projectListReq, user).getRecords()));
res.setProjects(new ArrayList<>(projectLibManage.projectLibListApprove(projectListReq, user).getRecords()));
return res;
}
}

Cargando…
Cancelar
Guardar