|
|
@@ -5,26 +5,22 @@ 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.function.VUtils; |
|
|
|
import com.ningdatech.basic.model.PageVo; |
|
|
|
import com.ningdatech.basic.util.CollUtils; |
|
|
|
import com.ningdatech.basic.util.NdDateUtils; |
|
|
|
import com.hz.pm.api.common.model.constant.BizConst; |
|
|
|
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; |
|
|
|
import com.hz.pm.api.common.helper.UserInfoHelper; |
|
|
|
import com.hz.pm.api.common.model.constant.BizConst; |
|
|
|
import com.hz.pm.api.common.statemachine.util.StateMachineUtils; |
|
|
|
import com.hz.pm.api.common.util.ExcelDownUtil; |
|
|
|
import com.hz.pm.api.common.util.ExcelExportStyle; |
|
|
|
import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; |
|
|
|
import com.hz.pm.api.projectdeclared.model.dto.PretrialDeclaredExportDTO; |
|
|
|
import com.hz.pm.api.projectdeclared.model.req.PrequalificationDeclaredListReq; |
|
|
|
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; |
|
|
|
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; |
|
|
|
import com.hz.pm.api.projectlib.helper.ProjectHelper; |
|
|
|
import com.hz.pm.api.projectlib.manage.ProjectLibManage; |
|
|
|
import com.hz.pm.api.projectlib.model.dto.ProjectDTO; |
|
|
|
import com.hz.pm.api.projectlib.model.entity.Project; |
|
|
|
import com.hz.pm.api.projectlib.model.entity.ProjectInst; |
|
|
|
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; |
|
|
|
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; |
|
|
|
import com.hz.pm.api.projectlib.model.req.ProjectListReq; |
|
|
|
import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; |
|
|
|
import com.hz.pm.api.projectlib.service.IProjectInstService; |
|
|
@@ -36,6 +32,10 @@ import com.hz.pm.api.todocenter.constant.TodoCenterConstant; |
|
|
|
import com.hz.pm.api.todocenter.constant.WorkNoticeConstant; |
|
|
|
import com.hz.pm.api.user.security.model.UserFullInfoDTO; |
|
|
|
import com.hz.pm.api.user.util.LoginUserUtil; |
|
|
|
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.wflow.bean.entity.WflowModels; |
|
|
|
import com.wflow.exception.BusinessException; |
|
|
|
import com.wflow.workflow.bean.dto.OrgInfoDTO; |
|
|
@@ -48,10 +48,14 @@ import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.IOException; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.*; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@@ -87,6 +91,7 @@ public class PrequalificationDeclaredProjectManage { |
|
|
|
|
|
|
|
/** |
|
|
|
* 提交预审 |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
* @return |
|
|
|
*/ |
|
|
@@ -103,9 +108,9 @@ public class PrequalificationDeclaredProjectManage { |
|
|
|
|
|
|
|
//要判断 当前操作人 是不是项目主管单位的人 |
|
|
|
VUtils.isTrue(Objects.isNull(user.getEmpPosUnitCode())) |
|
|
|
.throwMessage(String.format("当前登录人没有单位 【%s】",user.getRealName())); |
|
|
|
.throwMessage(String.format("当前登录人没有单位 【%s】", user.getRealName())); |
|
|
|
VUtils.isTrue(!user.getEmpPosUnitCode().equals(projectInfo.getSuperOrgCode())) |
|
|
|
.throwMessage(String.format("只有主管单位 【%s】的人 才能够提交",projectInfo.getSuperOrg())); |
|
|
|
.throwMessage(String.format("只有主管单位 【%s】的人 才能够提交", projectInfo.getSuperOrg())); |
|
|
|
|
|
|
|
//首先要判断 项目当前状态 是不是 待预审 |
|
|
|
VUtils.isTrue((!ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(projectInfo.getStatus()) && |
|
|
@@ -114,30 +119,30 @@ public class PrequalificationDeclaredProjectManage { |
|
|
|
.throwMessage("提交失败 该项目不是 待预审状态(省级部门联审成功)或者未立项阶段"); |
|
|
|
|
|
|
|
//使用状态机 进入下一步 看看需不需要走省级审批 放入文件 |
|
|
|
if(StringUtils.isNotBlank(projectDto.getHigherLineSuperOrgReviewComments())){ |
|
|
|
if (StringUtils.isNotBlank(projectDto.getHigherLineSuperOrgReviewComments())) { |
|
|
|
projectInfo.setHigherLineSuperOrgReviewComments(projectDto.getHigherLineSuperOrgReviewComments()); |
|
|
|
} |
|
|
|
stateMachineUtils.pass(projectInfo); |
|
|
|
String instanceId = null; |
|
|
|
//如果是省级部门 需要联审的(申报金额大于1000万 并且是市级项目) |
|
|
|
if(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS |
|
|
|
.getCode().equals(projectInfo.getStatus())){ |
|
|
|
if (ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS |
|
|
|
.getCode().equals(projectInfo.getStatus())) { |
|
|
|
//入库暂存表 后续处理 对接外部接口 |
|
|
|
projectInfo.setUpdateOn(LocalDateTime.now()); |
|
|
|
//保存一下 当前的主管单位发起人 |
|
|
|
projectInfo.setPreStartUserId(employeeCode); |
|
|
|
//当前实例置为空 |
|
|
|
projectInfo.setInstCode(TodoCenterConstant.Declared.NULL_INST_CODE); |
|
|
|
if(projectStagingService.addByProject(projectInfo,"省级部门联审") |
|
|
|
&& projectService.updateById(projectInfo)){ |
|
|
|
if (projectStagingService.addByProject(projectInfo, "省级部门联审") |
|
|
|
&& projectService.updateById(projectInfo)) { |
|
|
|
return "提交省级部门联审成功"; |
|
|
|
} |
|
|
|
return "提交省级部门联审失败"; |
|
|
|
}else if(ProjectStatusEnum.PRE_APPLYING |
|
|
|
.getCode().equals(projectInfo.getStatus())){ |
|
|
|
} else if (ProjectStatusEnum.PRE_APPLYING |
|
|
|
.getCode().equals(projectInfo.getStatus())) { |
|
|
|
//如果是非省级联审的项目 直接提交 预审 |
|
|
|
instanceId = directStartProcess(projectInfo,employeeCode,dto.getRestart()); |
|
|
|
}else{ |
|
|
|
instanceId = directStartProcess(projectInfo, employeeCode, dto.getRestart()); |
|
|
|
} else { |
|
|
|
throw new BusinessException("项目状态 错误 project :" + projectInfo.getId() + "," + projectInfo.getStatus()); |
|
|
|
} |
|
|
|
|
|
|
@@ -161,15 +166,15 @@ public class PrequalificationDeclaredProjectManage { |
|
|
|
Project projectInfo = projectService.getById(projectDto.getId()); |
|
|
|
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); |
|
|
|
//重新提交 生成新版本号 回到 待预审状态 |
|
|
|
Project project = projectLibManage.saveProjectWithVersionAndStatus(projectDto,null, |
|
|
|
ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode(),Boolean.FALSE); |
|
|
|
Project project = projectLibManage.saveProjectWithVersionAndStatus(projectDto, null, |
|
|
|
ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode(), Boolean.FALSE); |
|
|
|
dto.getProjectInfo().setId(project.getId()); |
|
|
|
dto.setRestart(Boolean.TRUE); |
|
|
|
return startTheProcess(dto); |
|
|
|
} |
|
|
|
|
|
|
|
//直接提交预审方法 提取 在省级联审通过的时候 也可以用 |
|
|
|
public String directStartProcess(Project projectInfo,String employeeCode,Boolean restart){ |
|
|
|
public String directStartProcess(Project projectInfo, String employeeCode, Boolean restart) { |
|
|
|
VUtils.isTrue(Objects.isNull(employeeCode)) |
|
|
|
.throwMessage("发起人 员工code 不能为空!"); |
|
|
|
|
|
|
@@ -178,7 +183,7 @@ public class PrequalificationDeclaredProjectManage { |
|
|
|
params.setProcessUsers(Collections.emptyMap()); |
|
|
|
|
|
|
|
//把条件值给放入工作流 |
|
|
|
defaultDeclaredProjectManage.buildCondition(params,projectInfo); |
|
|
|
defaultDeclaredProjectManage.buildCondition(params, projectInfo); |
|
|
|
|
|
|
|
String regionCode = projectInfo.getAreaCode(); |
|
|
|
|
|
|
@@ -193,22 +198,22 @@ public class PrequalificationDeclaredProjectManage { |
|
|
|
} |
|
|
|
|
|
|
|
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 |
|
|
|
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode,projectInfo); |
|
|
|
String instanceId = processInstanceService.startProcessLs(model, params,orgModelMap); |
|
|
|
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode, projectInfo); |
|
|
|
String instanceId = processInstanceService.startProcessLs(model, params, orgModelMap); |
|
|
|
log.info("提交预审项目成功 【{}】", instanceId); |
|
|
|
|
|
|
|
log.info("restart 【{}】", restart); |
|
|
|
//保存预审项目 |
|
|
|
if(restart){ |
|
|
|
if (Boolean.TRUE.equals(restart)) { |
|
|
|
//如果是重新提交 不用生成新版本 前面已经生成过了 |
|
|
|
preModifyProject(projectInfo, instanceId); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
projectInfo = projectLibManage.saveProjectWithVersion(projectInfo, instanceId, |
|
|
|
ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode()); |
|
|
|
} |
|
|
|
|
|
|
|
//发送给第一个审批人消息 |
|
|
|
noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, |
|
|
|
noticeManage.sendFirtUser(projectInfo, model.getFormName(), instanceId, |
|
|
|
WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); |
|
|
|
|
|
|
|
return instanceId; |
|
|
@@ -243,6 +248,7 @@ public class PrequalificationDeclaredProjectManage { |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询项目库 |
|
|
|
* |
|
|
|
* @param preReq |
|
|
|
* @return |
|
|
|
*/ |
|
|
@@ -251,14 +257,14 @@ public class PrequalificationDeclaredProjectManage { |
|
|
|
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); |
|
|
|
//限定参数 复制bean |
|
|
|
ProjectListReq req = new ProjectListReq(); |
|
|
|
BeanUtils.copyProperties(preReq,req); |
|
|
|
BeanUtils.copyProperties(preReq, req); |
|
|
|
//项目阶段 状态 已定 待预审和省级部门联审成功 |
|
|
|
req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); |
|
|
|
req.setStatusList(Lists.newArrayList(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode(), |
|
|
|
ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode())); |
|
|
|
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); |
|
|
|
buildPermission(query,user); |
|
|
|
query.eq(Project::getNewest,Boolean.TRUE); |
|
|
|
buildPermission(query, user); |
|
|
|
query.eq(Project::getNewest, Boolean.TRUE); |
|
|
|
Page<Project> page = projectService.page(req.page(), query); |
|
|
|
long total; |
|
|
|
if ((total = page.getTotal()) == 0) { |
|
|
@@ -279,11 +285,11 @@ public class PrequalificationDeclaredProjectManage { |
|
|
|
item.setProcessStatus(w.getProcessStatus()); |
|
|
|
item.setInstCode(w.getInstCode()); |
|
|
|
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); |
|
|
|
if(user.getIsOrgAdmin() && |
|
|
|
if (user.getIsOrgAdmin() && |
|
|
|
(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) || |
|
|
|
ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode().equals(item.getStatus())) |
|
|
|
&& StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(user.getEmpPosUnitCode()) |
|
|
|
&& w.getSuperOrgCode().equals(user.getEmpPosUnitCode())){ |
|
|
|
&& w.getSuperOrgCode().equals(user.getEmpPosUnitCode())) { |
|
|
|
item.setCanPreDeclared(Boolean.TRUE); |
|
|
|
} |
|
|
|
return item; |
|
|
@@ -293,25 +299,26 @@ public class PrequalificationDeclaredProjectManage { |
|
|
|
|
|
|
|
/** |
|
|
|
* build 项目的角色权限到req |
|
|
|
* |
|
|
|
* @param query |
|
|
|
*/ |
|
|
|
public UserFullInfoDTO buildPermission(LambdaQueryWrapper<Project> query,UserFullInfoDTO user){ |
|
|
|
if(user.getIsOrgAdmin()){ |
|
|
|
public UserFullInfoDTO buildPermission(LambdaQueryWrapper<Project> query, UserFullInfoDTO user) { |
|
|
|
if (user.getIsOrgAdmin()) { |
|
|
|
//单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 |
|
|
|
query.and(q1 -> q1.eq(Project::getBuildOrgCode ,user.getEmpPosUnitCode()) |
|
|
|
.or(q2 -> q2.eq(Project::getStage,ProjectStatusEnum.NOT_APPROVED.getCode()) |
|
|
|
.and(s1 -> s1.eq(Project::getStatus,ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) |
|
|
|
.or(s2 -> s2.eq(Project::getStatus,ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()))) |
|
|
|
.eq(Project::getSuperOrgCode,user.getEmpPosUnitCode()))); |
|
|
|
}else{ |
|
|
|
query.eq(Project::getBuildOrgCode ,user.getEmpPosUnitCode()); |
|
|
|
query.and(q1 -> q1.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()) |
|
|
|
.or(q2 -> q2.eq(Project::getStage, ProjectStatusEnum.NOT_APPROVED.getCode()) |
|
|
|
.and(s1 -> s1.eq(Project::getStatus, ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) |
|
|
|
.or(s2 -> s2.eq(Project::getStatus, ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()))) |
|
|
|
.eq(Project::getSuperOrgCode, user.getEmpPosUnitCode()))); |
|
|
|
} else { |
|
|
|
query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); |
|
|
|
} |
|
|
|
return user; |
|
|
|
} |
|
|
|
|
|
|
|
public void exportList(HttpServletResponse response, PrequalificationDeclaredListReq preReq) { |
|
|
|
ProjectListReq req = new ProjectListReq(); |
|
|
|
BeanUtils.copyProperties(preReq,req); |
|
|
|
BeanUtils.copyProperties(preReq, req); |
|
|
|
//项目阶段 状态 已定 待预审 |
|
|
|
req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); |
|
|
|
req.setStatusList(Lists.newArrayList(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode(), |
|
|
@@ -319,8 +326,8 @@ public class PrequalificationDeclaredProjectManage { |
|
|
|
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); |
|
|
|
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); |
|
|
|
//角色权限 |
|
|
|
buildPermission(query,user); |
|
|
|
query.eq(Project::getNewest,Boolean.TRUE); |
|
|
|
buildPermission(query, user); |
|
|
|
query.eq(Project::getNewest, Boolean.TRUE); |
|
|
|
List<Project> records = projectService.list(query); |
|
|
|
|
|
|
|
List<PretrialDeclaredExportDTO> collect = records.stream().map(r -> { |
|
|
@@ -335,7 +342,7 @@ public class PrequalificationDeclaredProjectManage { |
|
|
|
collect.get(i).setSerialNumber(i + 1); |
|
|
|
} |
|
|
|
String fileName = "预审申报项目列表"; |
|
|
|
ExcelDownUtil.setFileName(fileName,response); |
|
|
|
ExcelDownUtil.setFileName(fileName, response); |
|
|
|
//数据导出处理函数 |
|
|
|
try { |
|
|
|
EasyExcel.write(response.getOutputStream(), PretrialDeclaredExportDTO.class) |
|
|
|