Browse Source

如果没有角色则禁止登录

tags/24080901
WendyYang 10 months ago
parent
commit
9852c27846
12 changed files with 122 additions and 125 deletions
  1. +9
    -7
      hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java
  2. +24
    -26
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java
  3. +11
    -15
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java
  4. +13
    -13
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java
  5. +14
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DefaultDeclaredProjectManage.java
  6. +6
    -6
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java
  7. +8
    -10
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java
  8. +9
    -15
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java
  9. +11
    -14
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByDeptJointManage.java
  10. +10
    -17
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java
  11. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java
  12. +6
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/mh/MhLoginUserDetailService.java

+ 9
- 7
hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java View File

@@ -50,6 +50,7 @@ import com.hz.pm.api.projectlib.service.IProjectInstService;
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;
import com.hz.pm.api.todocenter.constant.WorkNoticeConst;
import com.hz.pm.api.user.helper.MhUnitCache;
import com.hz.pm.api.user.model.dto.UnitDTO;
@@ -81,6 +82,7 @@ import org.flowable.engine.TaskService;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.task.Comment;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@@ -104,7 +106,7 @@ public class ProjectFileManage {
private final IProjectService projectService;
private final ProjectLibManage projectLibManage;
private final UserInfoHelper userInfoHelper;
private final ProcessModelService processModelService;
private final ProcessModelManage processModelManage;
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage;
private final ProcessInstanceService processInstanceService;
private final NoticeManage noticeManage;
@@ -245,24 +247,24 @@ public class ProjectFileManage {
return projectFileVo;
}

public String startApplyBorrowProcess(Long projectId) {
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
@Transactional(rollbackFor = Exception.class)
public synchronized String startApplyBorrowProcess(Long projectId) {
UserInfoDetails user =LoginUserUtil.loginUserDetail();
Project project = projectService.getNewProject(projectId);
VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!");

// 首先要判断 项目当前状态 是不是 已归档
VUtils.isTrue(!ProjectStatusEnum.ACCEPTED.getCode().equals(project.getStatus())).throwMessage("提交失败 该项目不是 已归档");

WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.APPLY_BORROW.getCode())
.last(BizConst.LIMIT_1));
WflowModels model = processModelManage.getWflowModels(ProjectProcessStageEnum.APPLY_BORROW,
user.getMhUnitId());

if (Objects.isNull(model)) {
throw new BusinessException("找不到申请借阅流程配置");
}

ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(defaultDeclaredProjectManage.buildUser(user.getUserId()));
params.setUser(defaultDeclaredProjectManage.buildUser(user));
params.setProcessUsers(Collections.emptyMap());
// 放入条件判断的项目字段
// 把条件值给放入工作流


+ 24
- 26
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java View File

@@ -40,6 +40,7 @@ import com.hz.pm.api.projectlib.model.vo.TenderListInfoVO;
import com.hz.pm.api.projectlib.service.IProjectAnnualPaymentPlanService;
import com.hz.pm.api.projectlib.service.IProjectInstService;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.sys.manage.ProcessModelManage;
import com.hz.pm.api.user.security.model.UserFullInfoDTO;
import com.hz.pm.api.user.security.model.UserInfoDetails;
import com.hz.pm.api.user.util.LoginUserUtil;
@@ -52,7 +53,6 @@ import com.wflow.bean.entity.WflowModels;
import com.wflow.workflow.bean.dto.OrgInfoDTO;
import com.wflow.workflow.bean.vo.ProcessStartParamsVo;
import com.wflow.workflow.service.ProcessInstanceService;
import com.wflow.workflow.service.ProcessModelService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@@ -83,7 +83,7 @@ public class ConstructionManage {
private final IPurchaseService purchaseService;
private final IPurchaseInstService purchaseInstService;
private final IContractService contractService;
private final ProcessModelService processModelService;
private final ProcessModelManage processModelManage;
private final IProjectInstService projectInstService;
private final IPaymentPlanService paymentPlanService;
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage;
@@ -96,11 +96,11 @@ public class ConstructionManage {
/**
* 待采购的-项目列表
*
* @param req
* @return
* @param req \
* @return \
*/
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) {
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
UserInfoDetails user = LoginUserUtil.loginUserDetail();
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req);
//建设中状态
query.eq(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
@@ -115,7 +115,7 @@ public class ConstructionManage {
if ((total = page.getTotal()) == 0) {
return PageVo.empty();
}
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> {
List<ProjectLibListItemVO> retData = CollUtils.convert(page.getRecords(), w -> {
ProjectLibListItemVO item = new ProjectLibListItemVO();
item.setId(w.getId());
item.setProjectName(w.getProjectName());
@@ -136,7 +136,7 @@ public class ConstructionManage {
item.setTransactionTime(w.getTransactionTime());
return item;
});
return PageVo.of(records, total);
return PageVo.of(retData, total);
}

/**
@@ -217,27 +217,26 @@ public class ConstructionManage {
if (CollUtil.isNotEmpty(records)) {
List<Long> projectIds = records.stream().map(Project::getId).collect(Collectors.toList());

List<Purchase> purchases = purchaseService.list(Wrappers.lambdaQuery(Purchase.class)
.in(Purchase::getProjectId, projectIds));
List<Purchase> purchases = purchaseService.listByProjectIds(projectIds);
Map<Long, Purchase> purchaseMap = purchases.stream().collect(Collectors.toMap(Purchase::getProjectId, v -> v));

collect = records.stream().map(r -> {
DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO();
BeanUtils.copyProperties(r, exportDTO);
exportDTO.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType()));
exportDTO.setStatusName(ProjectStatusEnum.getDesc(r.getStatus()));
records.forEach(r -> {
DeclaredProjectExportDTO exportData = new DeclaredProjectExportDTO();
BeanUtils.copyProperties(r, exportData);
exportData.setProjectTypeName(ProjectTypeNewEnum.getDesc(r.getProjectType()));
exportData.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")));
exportData.setCreateOn(createOnStr);
exportData.setSerialNumber(serialNumber.incrementAndGet());
exportData.setApprovedAmount(r.getApprovalAmount());
exportData.setApprovalDate(r.getApprovalDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
if (purchaseMap.containsKey(r.getId())) {
Purchase purchase = purchaseMap.get(r.getId());
exportDTO.setTransactionAmount(purchase.getTransactionAmount());
exportDTO.setTransactionTime(purchase.getTransactionTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
exportData.setTransactionAmount(purchase.getTransactionAmount());
exportData.setTransactionTime(purchase.getTransactionTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
}
return exportDTO;
}).collect(Collectors.toList());
collect.add(exportData);
});
}

String fileName = "合同备案项目列表";
@@ -648,15 +647,14 @@ public class ConstructionManage {
}

UserInfoDetails user = LoginUserUtil.loginUserDetail();
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.XC_APPROVAL_PROCESS.getCode())
.last(BizConst.LIMIT_1));
WflowModels model = processModelManage.getWflowModels(ProjectProcessStageEnum.XC_APPROVAL_PROCESS,
user.getMhUnitId());

if (Objects.isNull(model)) {
throw BizException.wrap("找不到信创审批流程配置");
}
ProcessStartParamsVo processParam = new ProcessStartParamsVo();
processParam.setUser(defaultDeclaredProjectManage.buildUser(user.getUserId()));
processParam.setUser(defaultDeclaredProjectManage.buildUser(user));
processParam.setProcessUsers(Collections.emptyMap());
processParam.setFormData(Collections.emptyMap());
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息


+ 11
- 15
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java View File

@@ -33,6 +33,7 @@ import com.hz.pm.api.projectlib.service.IProjectInstService;
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;
import com.hz.pm.api.todocenter.constant.WorkNoticeConst;
import com.hz.pm.api.user.security.model.UserInfoDetails;
import com.hz.pm.api.user.util.LoginUserUtil;
@@ -73,13 +74,12 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
public class ConstructionPlanManage {

private final ProcessModelManage processModelManage;
private final IProjectService projectService;
private final ProcessInstanceService processService;
private final ProcessModelService processModelService;
private final StateMachineUtil stateMachineUtil;
private final IProjectInstService projectInstService;
private final ProjectLibManage projectLibManage;
private final UserInfoHelper userInfoHelper;
private final DefaultDeclaredProjectManage declaredProjectManage;
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage;
private final NoticeManage noticeManage;
@@ -88,11 +88,11 @@ public class ConstructionPlanManage {
/**
* 建设方案
*
* @param dto
* @return
* @param dto \
* @return \
*/
@Transactional(rollbackFor = Exception.class)
public String startTheProcess(DefaultDeclaredDTO dto) {
public synchronized String startTheProcess(DefaultDeclaredDTO dto) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
Long userId = user.getUserId();
ProjectDTO projectInfo = dto.getProjectInfo();
@@ -128,17 +128,13 @@ public class ConstructionPlanManage {
BeanUtils.copyProperties(projectInfo, constructProject);
constructProject.setStatus(oldProject.getStatus());
constructProject.setStage(oldProject.getStage());

WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode())
.last(BizConst.LIMIT_1));

if (Objects.isNull(model)) {
ProjectProcessStageEnum instType = ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS;
WflowModels wflowModels = processModelManage.getWflowModels(instType, user.getMhUnitId());
if (Objects.isNull(wflowModels)) {
throw BizException.wrap("找不到建设申报流程配置");
}

//如果被禁用了的话 直接跳过 进入到下一个状态
if (Boolean.TRUE.equals(model.getIsStop())) {
if (Boolean.TRUE.equals(wflowModels.getIsStop())) {
//被禁用了 调2次状态机
stateMachineUtil.pass(constructProject);
stateMachineUtil.pass(constructProject);
@@ -155,7 +151,7 @@ public class ConstructionPlanManage {
defaultDeclaredProjectManage.buildCondition(params, oldProject, dto);
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(userId, constructProject);
String instanceId = processService.startProcessLs(model, params, orgModelMap);
String instanceId = processService.startProcessLs(wflowModels, params, orgModelMap);
log.info("建设方案项目申报成功 【{}】", instanceId);

// 保存建设项目相关
@@ -168,7 +164,7 @@ public class ConstructionPlanManage {
}

//发送给第一个审批人消息
noticeManage.sendFirstUser(buildProject, model.getFormName(), instanceId,
noticeManage.sendFirstUser(buildProject, wflowModels.getFormName(), instanceId,
WorkNoticeConst.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW);

return instanceId;


+ 13
- 13
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java View File

@@ -43,6 +43,7 @@ import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO;
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;
import com.hz.pm.api.todocenter.constant.WorkNoticeConst;
import com.hz.pm.api.user.helper.MhUnitCache;
import com.hz.pm.api.user.model.dto.UnitDTO;
@@ -95,7 +96,7 @@ public class DeclaredProjectManage {

private final ProcessInstanceService processService;

private final ProcessModelService processModelService;
private final ProcessModelManage processModelManage;

private final DefaultDeclaredProjectManage defaultDeclaredProjectManage;

@@ -121,6 +122,13 @@ public class DeclaredProjectManage {
@Transactional(rollbackFor = Exception.class)
public synchronized String startTheProcess(DefaultDeclaredDTO dto) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();

WflowModels model = processModelManage.getWflowModels(ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS,
user.getMhUnitId());
if (Objects.isNull(model)) {
throw BizException.wrap("找不到单位流程配置");
}

ProjectDTO projectInfo = dto.getProjectInfo();

projectInfo.setBuildOrgCode(user.getMhUnitIdStr());
@@ -147,16 +155,9 @@ public class DeclaredProjectManage {
projectInfo.setId(null);
}

WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode())
.last(BizConst.LIMIT_1));

if (Objects.isNull(model)) {
throw BizException.wrap("找不到单位流程配置");
}

ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(defaultDeclaredProjectManage.buildUser(user.getUserId()));
params.setUser(defaultDeclaredProjectManage.buildUser(user));
params.setProcessUsers(Collections.emptyMap());
//放入条件判断的项目字段
ProjectConditionDTO conditionDto = new ProjectConditionDTO();
@@ -229,9 +230,8 @@ public class DeclaredProjectManage {
//判断申报金额 是否等于总的 判断年度支付金额 是否等于总金额
defaultDeclaredProjectManage.checkAmount(projectDto);

WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode())
.last(BizConst.LIMIT_1));
WflowModels model = processModelManage.getWflowModels(ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS,
user.getMhUnitId());

if (Objects.isNull(model)) {
throw new BusinessException("找不到单位流程配置");
@@ -243,7 +243,7 @@ public class DeclaredProjectManage {
.throwMessage("提交失败 该项目不是 单位内部拒绝审核状态或者未立项阶段");

ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(defaultDeclaredProjectManage.buildUser(user.getUserId()));
params.setUser(defaultDeclaredProjectManage.buildUser(user));
params.setProcessUsers(Collections.emptyMap());

//把条件值给放入工作流


+ 14
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DefaultDeclaredProjectManage.java View File

@@ -19,6 +19,7 @@ import com.hz.pm.api.projectlib.model.dto.ProjectPaymentPlanDTO;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.user.security.model.UserFullInfoDTO;
import com.hz.pm.api.user.security.model.UserInfoDetails;
import com.ningdatech.basic.function.VUtils;
import com.wflow.bean.entity.WflowModels;
import com.wflow.bean.entity.WflowOrgModels;
@@ -72,7 +73,7 @@ public class DefaultDeclaredProjectManage {
}

ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(buildUser(user.getUserId()));
params.setUser(buildUser(user));
params.setProcessUsers(Collections.emptyMap());
//放入条件判断的项目字段
ProjectConditionDTO conditionDto = new ProjectConditionDTO();
@@ -130,10 +131,22 @@ public class DefaultDeclaredProjectManage {
}
}

public ProcessInstanceUserDto buildUser(UserFullInfoDTO user) {
return ProcessInstanceUserDto.builder()
.userId(user.getUserIdStr())
.userName(user.getRealName())
.orgCode(user.getMhUnitIdStr())
.orgName(user.getMhUnitName())
.build();
}

public ProcessInstanceUserDto buildUser(Long userId) {
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(userId);
Assert.notNull(user, "【%s】获取不到用户!", userId);
return buildUser(user);
}

public ProcessInstanceUserDto buildUser(UserInfoDetails user) {
return ProcessInstanceUserDto.builder()
.userId(user.getUserIdStr())
.userName(user.getRealName())


+ 6
- 6
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java View File

@@ -31,6 +31,7 @@ import com.hz.pm.api.projectlib.service.IProjectInstService;
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;
import com.hz.pm.api.todocenter.constant.WorkNoticeConst;
import com.hz.pm.api.user.security.model.UserFullInfoDTO;
import com.hz.pm.api.user.security.model.UserInfoDetails;
@@ -79,7 +80,7 @@ public class DelayedApplyManage {

private final IProjectService projectService;
private final UserInfoHelper userInfoHelper;
private final ProcessModelService processModelService;
private final ProcessModelManage processModelManage;
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage;
private final ProcessInstanceService processInstanceService;
private final ProjectLibManage projectLibManage;
@@ -241,7 +242,7 @@ public class DelayedApplyManage {
* @return
*/
@Transactional(rollbackFor = Exception.class)
public String startDelayedApplyProcess(DelayedApplyDTO dto) {
public synchronized String startDelayedApplyProcess(DelayedApplyDTO dto) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
Long projectId = dto.getProjectId();
Project project = projectService.getNewProject(projectId);
@@ -256,16 +257,15 @@ public class DelayedApplyManage {
|| project.getPlanAcceptanceTime().isAfter(LocalDateTime.now()))
.throwMessage("当前项目还未过期验收");

WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.APPLY_DELAY.getCode())
.last(BizConst.LIMIT_1));
WflowModels model = processModelManage.getWflowModels(ProjectProcessStageEnum.APPLY_DELAY,
user.getMhUnitId());

if (Objects.isNull(model)) {
throw new BusinessException("找不到延期申请流程配置");
}

ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(defaultDeclaredProjectManage.buildUser(user.getUserId()));
params.setUser(defaultDeclaredProjectManage.buildUser(user));
params.setProcessUsers(Collections.emptyMap());
//放入条件判断的项目字段
//把条件值给放入工作流


+ 8
- 10
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java View File

@@ -38,6 +38,7 @@ import com.hz.pm.api.projectlib.model.vo.TenderListInfoVO;
import com.hz.pm.api.projectlib.service.IProjectAnnualPaymentPlanService;
import com.hz.pm.api.projectlib.service.IProjectInstService;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.sys.manage.ProcessModelManage;
import com.hz.pm.api.todocenter.manage.HandlerManage;
import com.hz.pm.api.user.security.model.UserFullInfoDTO;
import com.hz.pm.api.user.security.model.UserInfoDetails;
@@ -80,7 +81,7 @@ public class FinalAcceptanceManage {
private final UserInfoHelper userInfoHelper;
private final IPurchaseService purchaseService;
private final IPurchaseInstService purchaseInstService;
private final ProcessModelService processModelService;
private final ProcessModelManage processModelManage;
private final ProcessInstanceService processInstanceService;
private final DefaultDeclaredProjectManage declaredProjectManage;
private final IContractService contractService;
@@ -246,10 +247,9 @@ public class FinalAcceptanceManage {
*/
@Transactional(rollbackFor = Exception.class)
public synchronized String startProcess(SubmitFinallyInspectedReq req) {
Integer instTypeCode = ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode();
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
.eq(WflowModels::getProcessType, instTypeCode)
.last(BizConst.LIMIT_1));
UserInfoDetails user = LoginUserUtil.loginUserDetail();
ProjectProcessStageEnum instType = ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS;
WflowModels model = processModelManage.getWflowModels(instType, user.getMhUnitId());
if (Objects.isNull(model)) {
throw new BusinessException("找不到验收申报流程配置");
}
@@ -262,11 +262,9 @@ public class FinalAcceptanceManage {
&& !TenderStatusEnum.FINALLY_INSPECTED_FAILED.eq(purchase.getStatus())) {
throw BizException.wrap("该标段不支持终验申报");
}
UserInfoDetails user = LoginUserUtil.loginUserDetail();

Project project = projectService.getNewProject(req.getProjectId());
ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(declaredProjectManage.buildUser(user.getUserId()));
params.setUser(declaredProjectManage.buildUser(user));
params.setProcessUsers(Collections.emptyMap());
params.setFormData(Collections.emptyMap());
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息
@@ -281,10 +279,10 @@ public class FinalAcceptanceManage {
purchaseInst.setBidId(req.getBidId());
purchaseInst.setInstCode(instanceId);
purchaseInst.setProjectId(req.getProjectId());
purchaseInst.setInstType(instTypeCode);
purchaseInst.setInstType(instType);
purchaseInstService.save(purchaseInst);
ProjectInst projectInst = new ProjectInst();
projectInst.setInstType(instTypeCode);
projectInst.setInstType(instType);
projectInst.setInstCode(instanceId);
projectInst.setProjectId(req.getProjectId());
projectInstService.save(projectInst);


+ 9
- 15
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java View File

@@ -28,6 +28,7 @@ import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.staging.enums.MsgTypeEnum;
import com.hz.pm.api.staging.service.IProjectStagingService;
import com.hz.pm.api.sys.manage.NoticeManage;
import com.hz.pm.api.sys.manage.ProcessModelManage;
import com.hz.pm.api.todocenter.constant.TodoCenterConst;
import com.hz.pm.api.todocenter.constant.WorkNoticeConst;
import com.hz.pm.api.user.security.model.UserFullInfoDTO;
@@ -42,7 +43,6 @@ import com.wflow.exception.BusinessException;
import com.wflow.workflow.bean.dto.OrgInfoDTO;
import com.wflow.workflow.bean.vo.ProcessStartParamsVo;
import com.wflow.workflow.service.ProcessInstanceService;
import com.wflow.workflow.service.ProcessModelService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -80,7 +80,7 @@ public class PrequalificationDeclaredProjectManage {

private final UserInfoHelper userInfoHelper;

private final ProcessModelService processModelService;
private final ProcessModelManage processModelManage;

private final DefaultDeclaredProjectManage defaultDeclaredProjectManage;

@@ -97,7 +97,7 @@ public class PrequalificationDeclaredProjectManage {
* @return
*/
@Transactional(rollbackFor = Exception.class)
public String startTheProcess(DefaultDeclaredDTO dto) {
public synchronized String startTheProcess(DefaultDeclaredDTO dto) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
ProjectDTO projectDto = dto.getProjectInfo();
VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!");
@@ -139,7 +139,7 @@ public class PrequalificationDeclaredProjectManage {
} else if (ProjectStatusEnum.PRE_APPLYING
.getCode().equals(projectInfo.getStatus())) {
//如果是非省级联审的项目 直接提交 预审
instanceId = directStartProcess(projectInfo, user.getUserId(), dto.getRestart());
instanceId = directStartProcess(projectInfo, user, dto.getRestart());
} else {
throw new BusinessException("项目状态 错误 project :" + projectInfo.getId() + "," + projectInfo.getStatus());
}
@@ -168,21 +168,15 @@ public class PrequalificationDeclaredProjectManage {
}

//直接提交预审方法 提取 在省级联审通过的时候 也可以用
public String directStartProcess(Project projectInfo, Long userId, Boolean restart) {
VUtils.isTrue(Objects.isNull(userId))
.throwMessage("发起人 员工code 不能为空!");

public String directStartProcess(Project projectInfo, UserInfoDetails user, Boolean restart) {
ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(defaultDeclaredProjectManage.buildUser(userId));
params.setUser(defaultDeclaredProjectManage.buildUser(user));
params.setProcessUsers(Collections.emptyMap());
Long userId = user.getUserId();
//把条件值给放入工作流
defaultDeclaredProjectManage.buildCondition(params, projectInfo);

WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode())
.last(BizConst.LIMIT_1));

ProjectProcessStageEnum instType = ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS;
WflowModels model = processModelManage.getWflowModels(instType, user.getMhUnitId());
if (Objects.isNull(model)) {
throw new BusinessException("找不到预审流程配置");
}


+ 11
- 14
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByDeptJointManage.java View File

@@ -2,6 +2,7 @@ package com.hz.pm.api.projectdeclared.manage;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum;
import com.hz.pm.api.common.helper.UserInfoHelper;
import com.hz.pm.api.projectlib.manage.ProjectLibManage;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum;
@@ -9,7 +10,9 @@ import com.hz.pm.api.projectlib.service.IProjectInstService;
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;
import com.hz.pm.api.todocenter.constant.WorkNoticeConst;
import com.hz.pm.api.user.security.model.UserFullInfoDTO;
import com.ningdatech.basic.function.VUtils;
import com.wflow.bean.entity.WflowModels;
import com.wflow.exception.BusinessException;
@@ -38,17 +41,13 @@ import java.util.Objects;
public class ReviewByDeptJointManage {

private final IProjectService projectService;

private final ProcessModelService processModelService;

private final ProcessModelManage processModelManage;
private final ProcessInstanceService processService;

private final IProjectInstService projectInstService;
private final DefaultDeclaredProjectManage declaredProjectManage;
private final ProjectLibManage projectLibManage;
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage;

private final NoticeManage noticeManage;
private final UserInfoHelper userInfoHelper;

/**
* 部门联审
@@ -59,15 +58,13 @@ public class ReviewByDeptJointManage {
@Transactional(rollbackFor = Exception.class)
public Boolean startTheProcess(Project project) {
//这里是任务发起的 所以用项目发起人
Long startUserCode = Long.parseLong(project.getSponsor());

UserFullInfoDTO startUser = userInfoHelper.getUserFullInfo(project.getSponsor());
VUtils.isTrue(Objects.isNull(project.getId())).throwMessage("提交失败 缺少项目ID!");
Project projectInfo = projectService.getNewProject(project.getId());
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!");

WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode())
.last("limit 1"));
WflowModels model = processModelManage.getWflowModels(ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS,
startUser.getMhUnitId());

if (Objects.isNull(model)) {
throw new BusinessException("找不到部门联审申报流程配置");
@@ -82,15 +79,15 @@ public class ReviewByDeptJointManage {

ProcessStartParamsVo params = new ProcessStartParamsVo();
//发起人的信息
params.setUser(declaredProjectManage.buildUser(Long.valueOf(projectInfo.getSponsor())));
params.setUser(declaredProjectManage.buildUser(startUser));
params.setProcessUsers(Collections.emptyMap());
//放入条件判断的项目字段
//把条件值给放入工作流
defaultDeclaredProjectManage.buildCondition(params, projectInfo);

// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(startUserCode, project);
String instanceId = processService.startProcessLs(model, params, orgModelMap);
Map<String, OrgInfoDTO> orgMap = defaultDeclaredProjectManage.buildOrgModelMap(startUser.getUserId(), project);
String instanceId = processService.startProcessLs(model, params, orgMap);
log.info("部门联审申报成功 【{}】", instanceId);

//保存项目信息


+ 10
- 17
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java View File

@@ -14,7 +14,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hz.pm.api.common.enumeration.CommonEnum;
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.util.BizUtils;
import com.hz.pm.api.external.model.enumeration.MhUnitStripEnum;
@@ -40,6 +39,7 @@ import com.hz.pm.api.projectlib.model.vo.MhProjectBaseInfoVO;
import com.hz.pm.api.projectlib.service.*;
import com.hz.pm.api.staging.enums.MsgTypeEnum;
import com.hz.pm.api.sys.manage.NoticeManage;
import com.hz.pm.api.sys.manage.ProcessModelManage;
import com.hz.pm.api.todocenter.constant.WorkNoticeConst;
import com.hz.pm.api.user.helper.MhUnitCache;
import com.hz.pm.api.user.model.dto.UnitDTO;
@@ -55,7 +55,6 @@ import com.wflow.bean.entity.WflowModels;
import com.wflow.workflow.bean.dto.OrgInfoDTO;
import com.wflow.workflow.bean.vo.ProcessStartParamsVo;
import com.wflow.workflow.service.ProcessInstanceService;
import com.wflow.workflow.service.ProcessModelService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@@ -65,7 +64,6 @@ import org.springframework.web.multipart.MultipartFile;

import java.io.InputStream;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
@@ -92,7 +90,7 @@ public class DeclaredRecordManage {
private final IMhUnitService mhUnitService;
private final NoticeManage noticeManage;
private final IProjectDraftService projectDraftService;
private final ProcessModelService processModelService;
private final ProcessModelManage processModelManage;
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage;
private final ProcessInstanceService processInstanceService;
private final ProjectLibManage projectLibManage;
@@ -216,17 +214,14 @@ public class DeclaredRecordManage {
//新申报的项目不允许带项目id
projectInfo.setId(null);
}

WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.PROJECT_RECORD_APPROVAL_PROCESS.getCode())
.last(BizConst.LIMIT_1));

ProjectProcessStageEnum instType = ProjectProcessStageEnum.PROJECT_RECORD_APPROVAL_PROCESS;
WflowModels model = processModelManage.getWflowModels(instType, user.getMhUnitId());
if (Objects.isNull(model)) {
throw BizException.wrap("找不到立项备案审批流程配置");
}

ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(defaultDeclaredProjectManage.buildUser(user.getUserId()));
params.setUser(defaultDeclaredProjectManage.buildUser(user));
params.setProcessUsers(Collections.emptyMap());
//放入条件判断的项目字段
ProjectConditionDTO conditionDto = new ProjectConditionDTO();
@@ -299,13 +294,11 @@ public class DeclaredRecordManage {
reqProj.setSuperOrg(user.getMhUnitName());
}

ProjectProcessStageEnum processStageEnum = ProjectProcessStageEnum.PROJECT_RECORD_APPROVAL_PROCESS;
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
.eq(WflowModels::getProcessType, processStageEnum.getCode())
.last(BizConst.LIMIT_1));
ProjectProcessStageEnum instType = ProjectProcessStageEnum.PROJECT_RECORD_APPROVAL_PROCESS;
WflowModels model = processModelManage.getWflowModels(instType, user.getMhUnitId());

if (Objects.isNull(model)) {
throw BizException.wrap("%s不存在", processStageEnum.getDesc());
throw BizException.wrap("%s不存在", instType.getDesc());
}

//首先要判断 项目当前状态 是不是 单位内部拒绝
@@ -314,7 +307,7 @@ public class DeclaredRecordManage {
.throwMessage("提交失败,该项目不是立项备案审核不通过状态或者未立项阶段");

ProcessStartParamsVo params = new ProcessStartParamsVo();
params.setUser(defaultDeclaredProjectManage.buildUser(user.getUserId()));
params.setUser(defaultDeclaredProjectManage.buildUser(user));
params.setProcessUsers(Collections.emptyMap());

//把条件值给放入工作流
@@ -331,7 +324,7 @@ public class DeclaredRecordManage {
Project newProj = projectLibManage.saveProjectInDeclared(reqProj, instId, user.getUserId(),
ProjectStatusEnum.NOT_APPROVED,
ProjectStatusEnum.DECLARED_APPROVED_RECORD_AUDITING,
processStageEnum);
instType);
// 保存状态变更
saveProjectStatusChangeLog(ProjectStatusEnum.DECLARED_APPROVED_RECORD_FAILED,
newProj, ProjectStatusChangeEvent.DECLARED_RECORD_RESUBMIT);


+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java View File

@@ -1403,7 +1403,7 @@ public class ProjectLibManage {
projectInstService.save(projectInst);
}

public void saveProjectByApplyBorrow(Project project, UserFullInfoDTO user, String instanceId) {
public void saveProjectByApplyBorrow(Project project, UserInfoDetails user, String instanceId) {
// 更新项目流程实例ID
project.setInstCode(instanceId);
project.setCreateOn(LocalDateTime.now());


+ 6
- 0
hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/mh/MhLoginUserDetailService.java View File

@@ -1,6 +1,7 @@
package com.hz.pm.api.user.security.auth.mh;


import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONUtil;
import com.hz.pm.api.common.helper.UserInfoHelper;
import com.hz.pm.api.user.convert.UserInfoConvertor;
@@ -36,6 +37,11 @@ public class MhLoginUserDetailService implements UserDetailsService {
if (userInfo == null || DISABLE.equals(userInfo.getAvailable())) {
throw BizException.wrap("用户不存在或已被禁用");
}
if (userInfo.getMhUnitId() == null
|| userInfo.getMhUnitId() <= 0
|| CollUtil.isEmpty(userInfo.getUserRoleList())) {
throw BizException.wrap("用户暂无登录权限");
}
log.info("登录用户为:{}", JSONUtil.toJsonStr(userInfo));
return UserInfoConvertor.convert(userInfo);
}


Loading…
Cancel
Save