From 7fd0d368bc19ee86fa8b4c2b2473bc84192577f4 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Wed, 3 Jan 2024 20:36:37 +0800 Subject: [PATCH 01/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B8=83=E5=B0=94?= =?UTF-8?q?=E5=80=BC=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/statemachine/contant/RegionContant.java | 2 +- .../PrequalificationDeclaredProjectManage.java | 99 ++++++++++++---------- .../mapper/ProjectRenewalFundDeclarationMapper.xml | 4 +- 3 files changed, 56 insertions(+), 49 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/contant/RegionContant.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/contant/RegionContant.java index b436de1..619445f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/contant/RegionContant.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/contant/RegionContant.java @@ -8,7 +8,7 @@ package com.hz.pm.api.common.statemachine.contant; */ public class RegionContant { //市本级 - public static final String LS_SBJ_CODE = "331100"; + public static final String LS_SBJ_CODE = "330100"; //莲都区 public static final String LS_LD_CODE = "331102"; //青田县 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java index df64f22..f09a221 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java @@ -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 orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode,projectInfo); - String instanceId = processInstanceService.startProcessLs(model, params,orgModelMap); + Map 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 query = ProjectHelper.projectQuery(req); - buildPermission(query,user); - query.eq(Project::getNewest,Boolean.TRUE); + buildPermission(query, user); + query.eq(Project::getNewest, Boolean.TRUE); Page 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 query,UserFullInfoDTO user){ - if(user.getIsOrgAdmin()){ + public UserFullInfoDTO buildPermission(LambdaQueryWrapper 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 query = ProjectHelper.projectQuery(req); //角色权限 - buildPermission(query,user); - query.eq(Project::getNewest,Boolean.TRUE); + buildPermission(query, user); + query.eq(Project::getNewest, Boolean.TRUE); List records = projectService.list(query); List 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) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectRenewalFundDeclarationMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectRenewalFundDeclarationMapper.xml index 9b2181e..c2b3309 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectRenewalFundDeclarationMapper.xml +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectRenewalFundDeclarationMapper.xml @@ -22,8 +22,8 @@ prfd.project_code from nd_project_renewal_fund_declaration prfd left join nd_project p on prfd.project_code = p.project_code and p.newest = 1 - left join gov_biz_project_baseinfo b on prfd.project_code = b.base_proj_id and b.deleted = false - left join gov_operation_project_baseinfo ob on prfd.project_code = ob.base_proj_id and ob.deleted = false + left join gov_biz_project_baseinfo b on prfd.project_code = b.base_proj_id and b.deleted = 0 + left join gov_operation_project_baseinfo ob on prfd.project_code = ob.base_proj_id and ob.deleted = 0 where prfd.deleted = 0 and (p.project_name like concat('%',#{param.projectName},'%') or From ab3afa291fe2a01de24b747baa903ceddf72b003 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 4 Jan 2024 11:04:51 +0800 Subject: [PATCH 02/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B8=82=E6=9C=AC?= =?UTF-8?q?=E7=BA=A7=E5=8C=BA=E5=88=92=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pm/api/common/model/constant/RegionConst.java | 4 ++-- .../statemachine/util/StateMachineUtils.java | 2 +- .../api/dashboard/handle/CockpitStatsHandler.java | 4 ++-- .../dashboard/manage/ExpertStatisticsManage.java | 2 +- .../dashboard/manage/MeetingStatisticsManage.java | 2 +- .../provider/impl/ExpertDataScopeProviderImpl.java | 4 ++-- .../impl/SuperAdminDataScopeProviderImpl.java | 4 ++-- .../api/gov/manage/GovProjectCollectionManage.java | 28 +++++++++++----------- .../hz/pm/api/gov/utils/ProjectConvertUtil.java | 12 +++++----- .../com/hz/pm/api/irs/manage/AppIrsManage.java | 2 +- .../com/hz/pm/api/portrait/manage/TagManage.java | 2 +- .../manage/DefaultDeclaredProjectManage.java | 4 ++-- .../manage/ReviewChecklistManage.java | 4 ++-- .../projectdeclared/model/dto/ContractSaveDTO.java | 4 +--- .../api/projectdeclared/model/entity/Contract.java | 5 ++-- .../projectdeclared/model/entity/PaymentPlan.java | 2 +- .../utils/GenerateProjectCodeUtil.java | 4 ++-- .../pm/api/projectlib/manage/ProjectLibManage.java | 4 ++-- .../manage/ProjectRenewalFundManage.java | 2 +- .../model/entity/ProjectApplication.java | 2 +- .../hz/pm/api/safety/manage/SafetyRiskManage.java | 2 +- .../task/CheckProvincialReviewResultTask.java | 2 +- .../scheduler/task/CockpitStatsStatisticsTask.java | 2 +- .../hz/pm/api/scheduler/task/InitProcessTask.java | 2 +- .../api/scheduler/task/ProjectStatusFlowTask.java | 1 - .../java/com/hz/pm/api/sys/manage/MenuManage.java | 2 +- .../hz/pm/api/user/model/vo/ResUserDetailVO.java | 2 +- .../api/user/security/model/UserInfoDetails.java | 2 +- .../test/java/com/hz/pm/api/provincial/Test.java | 2 +- .../hz/pm/api/sys/processDef/ProcessDefTest.java | 2 +- 30 files changed, 56 insertions(+), 60 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/RegionConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/RegionConst.java index 31214c1..38fb723 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/RegionConst.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/RegionConst.java @@ -27,7 +27,7 @@ public interface RegionConst { /** * 丽水行政区划编码 */ - String RC_LS = "331100"; + String RC_HZ = "330100"; //丽水开发区 String LS_KF = "331118"; String LS_KF_IRS = "331151"; @@ -65,7 +65,7 @@ public interface RegionConst { String QN = "331127"; String LQ = "331181"; - List LS_ARR = Lists.newArrayList(RC_LS, LS_KF, LD, QT, JY, SC, SY, YH, QY, QN, LQ); + List LS_ARR = Lists.newArrayList(RC_HZ, LS_KF, LD, QT, JY, SC, SY, YH, QY, QN, LQ); //----------------------------------------地区父级ID(缩写PID)--------------------------------------------------------- diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtils.java index 5e3ecee..9e3f4b4 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtils.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtils.java @@ -128,7 +128,7 @@ public class StateMachineUtils { */ public static boolean isCityProject(Project project) { String areaCode = project.getAreaCode(); - if (areaCode.equals(RegionConst.RC_LS)) { + if (areaCode.equals(RegionConst.RC_HZ)) { return true; } return false; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/handle/CockpitStatsHandler.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/handle/CockpitStatsHandler.java index b56c1d8..bdf16d5 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/handle/CockpitStatsHandler.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/handle/CockpitStatsHandler.java @@ -150,7 +150,7 @@ public class CockpitStatsHandler { private List convertMapProjectsData(CockpitStats cockpitStats,Integer year) { List mapProjectsDatas = Lists.newArrayList(); - List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY); + List regions = regionCacheHelper.listChildren(RegionConst.RC_HZ, RegionConst.RL_CITY); regions = regions.stream().filter(r -> r.getRegionLevel() != 2).sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); List cockpitStatsAll = cockpitStatsService.list(Wrappers.lambdaQuery(CockpitStats.class) @@ -185,7 +185,7 @@ public class CockpitStatsHandler { private List buidExpertRegionData(CockpitStats cockpitStats) { List regionData = Lists.newArrayList(); - List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY); + List regions = regionCacheHelper.listChildren(RegionConst.RC_HZ, RegionConst.RL_CITY); regions = regions.stream().filter(r -> r.getRegionLevel() != 2).sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); List cs = cockpitStatsService.list(); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/ExpertStatisticsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/ExpertStatisticsManage.java index 6216c39..21729bc 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/ExpertStatisticsManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/ExpertStatisticsManage.java @@ -172,7 +172,7 @@ public class ExpertStatisticsManage { Map expertMap = experts.stream().filter(e -> userSet.add(e.getUserId())) .collect(Collectors.toMap(ExpertUserFullInfo::getUserId, e -> e)); - List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY) + List regions = regionCacheHelper.listChildren(RegionConst.RC_HZ, RegionConst.RL_CITY) .stream().filter(r -> r.getRegionLevel().equals(RegionConst.RL_COUNTY)) .sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/MeetingStatisticsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/MeetingStatisticsManage.java index 7936f45..7c2f5a2 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/MeetingStatisticsManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/MeetingStatisticsManage.java @@ -94,7 +94,7 @@ public class MeetingStatisticsManage { .divide(BigDecimal.valueOf(reviewsTotal), RoundingMode.HALF_UP))); //各区域 - List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY) + List regions = regionCacheHelper.listChildren(RegionConst.RC_HZ, RegionConst.RL_CITY) .stream().filter(r -> r.getRegionLevel().equals(RegionConst.RL_COUNTY)) .sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); List regionMeetngs = Lists.newArrayList(); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/ExpertDataScopeProviderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/ExpertDataScopeProviderImpl.java index 6beb2ba..4382699 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/ExpertDataScopeProviderImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/ExpertDataScopeProviderImpl.java @@ -37,7 +37,7 @@ public class ExpertDataScopeProviderImpl implements DataScopeProvider { public Optional findDataFieldProperty() { UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); //所有 丽水市的code - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_LS, + Collection regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_HZ, RegionConst.RL_CITY); DataScopeDTO ds = new DataScopeDTO(); @@ -52,7 +52,7 @@ public class ExpertDataScopeProviderImpl implements DataScopeProvider { public Optional findDataFieldProperty(Long userId) { UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); //所有 丽水市的code - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_LS, + Collection regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_HZ, RegionConst.RL_CITY); DataScopeDTO ds = new DataScopeDTO(); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/SuperAdminDataScopeProviderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/SuperAdminDataScopeProviderImpl.java index 91ae124..8205ed4 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/SuperAdminDataScopeProviderImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/SuperAdminDataScopeProviderImpl.java @@ -37,7 +37,7 @@ public class SuperAdminDataScopeProviderImpl implements DataScopeProvider { public Optional findDataFieldProperty() { UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); //所有 丽水市的code - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_LS, + Collection regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_HZ, RegionConst.RL_CITY); DataScopeDTO ds = new DataScopeDTO(); @@ -52,7 +52,7 @@ public class SuperAdminDataScopeProviderImpl implements DataScopeProvider { public Optional findDataFieldProperty(Long userId) { UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); //所有 丽水市的code - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_LS, + Collection regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_HZ, RegionConst.RL_CITY); DataScopeDTO ds = new DataScopeDTO(); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java index b8bf51d..98ef382 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java @@ -718,7 +718,7 @@ public class GovProjectCollectionManage { saveBase.setBaseAreaCode(baseAreaCode); saveBase.setBaseAreaName(regionCacheHelper.getRegionName(user.getRegionCode(), RegionConst.RL_COUNTY)); } - saveBase.setAreaCode(RegionConst.RC_LS); + saveBase.setAreaCode(RegionConst.RC_HZ); saveBase.setBizTime(LocalDateTime.now()); saveBase.setUpdateBy(user.getUsername()); saveBase.setUpdateOn(LocalDateTime.now()); @@ -752,7 +752,7 @@ public class GovProjectCollectionManage { saveApply.setBaseProjDuration(convertMonth(saveApply.getBaseProjStartTime(), saveApply.getBaseProjEndTime())); } - saveApply.setAreaCode(RegionConst.RC_LS); + saveApply.setAreaCode(RegionConst.RC_HZ); saveApply.setBizTime(LocalDateTime.now()); saveApply.setUpdateBy(user.getUsername()); saveApply.setUpdateOn(LocalDateTime.now()); @@ -778,7 +778,7 @@ public class GovProjectCollectionManage { saveApprove.setTongTime(LocalDateTime.now()); } saveApprove.setBizTime(LocalDateTime.now()); - saveApprove.setAreaCode(RegionConst.RC_LS); + saveApprove.setAreaCode(RegionConst.RC_HZ); saveApprove.setUpdateBy(user.getUsername()); saveApprove.setUpdateOn(LocalDateTime.now()); if (approveService.saveOrUpdate(saveApprove)) { @@ -806,7 +806,7 @@ public class GovProjectCollectionManage { } else { saveCimplement.setTongTime(LocalDateTime.now()); } - saveCimplement.setAreaCode(RegionConst.RC_LS); + saveCimplement.setAreaCode(RegionConst.RC_HZ); saveCimplement.setBizTime(LocalDateTime.now()); saveCimplement.setUpdateBy(user.getUsername()); saveCimplement.setUpdateOn(LocalDateTime.now()); @@ -838,7 +838,7 @@ public class GovProjectCollectionManage { if (Objects.nonNull(saveBase.getAreaCode())) { saveMimplement.setAreaCode(saveBase.getAreaCode()); } - saveMimplement.setAreaCode(RegionConst.RC_LS); + saveMimplement.setAreaCode(RegionConst.RC_HZ); saveMimplement.setBizTime(LocalDateTime.now()); saveMimplement.setUpdateBy(user.getUsername()); saveMimplement.setUpdateOn(LocalDateTime.now()); @@ -865,7 +865,7 @@ public class GovProjectCollectionManage { GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure, GovBizProjectProcure.class); saveProcure.setBaseProjId(finalBaseProjId); saveProcure.setId(null); - saveProcure.setAreaCode(RegionConst.RC_LS); + saveProcure.setAreaCode(RegionConst.RC_HZ); saveProcure.setTongTime(LocalDateTime.now()); saveProcure.setBizTime(LocalDateTime.now()); saveProcure.setUpdateBy(finalUser.getUsername()); @@ -928,7 +928,7 @@ public class GovProjectCollectionManage { saveBase.setTongTime(LocalDateTime.now()); saveBase.setBaseAreaName(regionCacheHelper.getRegionName(user.getRegionCode(), RegionConst.RL_COUNTY)); } - saveBase.setAreaCode(RegionConst.RC_LS); + saveBase.setAreaCode(RegionConst.RC_HZ); saveBase.setBizTime(LocalDateTime.now()); saveBase.setUpdateBy(user.getUsername()); saveBase.setUpdateOn(LocalDateTime.now()); @@ -962,7 +962,7 @@ public class GovProjectCollectionManage { saveApply.setBaseProjDuration(convertMonth(saveApply.getBaseProjStartTime(), saveApply.getBaseProjEndTime())); } - saveApply.setAreaCode(RegionConst.RC_LS); + saveApply.setAreaCode(RegionConst.RC_HZ); saveApply.setBizTime(LocalDateTime.now()); saveApply.setUpdateBy(user.getUsername()); saveApply.setUpdateOn(LocalDateTime.now()); @@ -988,7 +988,7 @@ public class GovProjectCollectionManage { saveApprove.setTongTime(LocalDateTime.now()); } saveApprove.setBizTime(LocalDateTime.now()); - saveApprove.setAreaCode(RegionConst.RC_LS); + saveApprove.setAreaCode(RegionConst.RC_HZ); saveApprove.setUpdateBy(user.getUsername()); saveApprove.setUpdateOn(LocalDateTime.now()); if (approveService.saveOrUpdate(saveApprove)) { @@ -1016,7 +1016,7 @@ public class GovProjectCollectionManage { } else { saveCimplement.setTongTime(LocalDateTime.now()); } - saveCimplement.setAreaCode(RegionConst.RC_LS); + saveCimplement.setAreaCode(RegionConst.RC_HZ); saveCimplement.setBizTime(LocalDateTime.now()); saveCimplement.setUpdateBy(user.getUsername()); saveCimplement.setUpdateOn(LocalDateTime.now()); @@ -1048,7 +1048,7 @@ public class GovProjectCollectionManage { if (Objects.nonNull(saveBase.getAreaCode())) { saveMimplement.setAreaCode(saveBase.getAreaCode()); } - saveMimplement.setAreaCode(RegionConst.RC_LS); + saveMimplement.setAreaCode(RegionConst.RC_HZ); saveMimplement.setBizTime(LocalDateTime.now()); saveMimplement.setUpdateBy(user.getUsername()); saveMimplement.setUpdateOn(LocalDateTime.now()); @@ -1075,7 +1075,7 @@ public class GovProjectCollectionManage { GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure, GovBizProjectProcure.class); saveProcure.setBaseProjId(finalBaseProjId); saveProcure.setId(null); - saveProcure.setAreaCode(RegionConst.RC_LS); + saveProcure.setAreaCode(RegionConst.RC_HZ); saveProcure.setTongTime(LocalDateTime.now()); saveProcure.setBizTime(LocalDateTime.now()); saveProcure.setUpdateBy(finalUser.getUsername()); @@ -1208,7 +1208,7 @@ public class GovProjectCollectionManage { draft.setBaseProjId(baseProjId); draft.setBaseProjName(baseProjName); draft.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); - draft.setAreaCode(RegionConst.RC_LS); + draft.setAreaCode(RegionConst.RC_HZ); draft.setBizTime(LocalDateTime.now()); draft.setUpdateBy(user.getUsername()); draft.setUpdateOn(LocalDateTime.now()); @@ -1305,7 +1305,7 @@ public class GovProjectCollectionManage { draft.setBaseProjId(baseProjId); draft.setBaseProjName(baseProjName); draft.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); - draft.setAreaCode(RegionConst.RC_LS); + draft.setAreaCode(RegionConst.RC_HZ); draft.setBizTime(LocalDateTime.now()); draft.setUpdateBy(user.getUsername()); draft.setUpdateOn(LocalDateTime.now()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/utils/ProjectConvertUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/utils/ProjectConvertUtil.java index 85cdc43..2cd0ba9 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/gov/utils/ProjectConvertUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/utils/ProjectConvertUtil.java @@ -79,7 +79,7 @@ public class ProjectConvertUtil { GovBizProjectBaseinfoVO baseinfo = new GovBizProjectBaseinfoVO(); baseinfo.setBaseProjId(project.getProjectCode()); baseinfo.setBaseProjName(project.getProjectName()); - baseinfo.setAreaCode(RegionConst.RC_LS); + baseinfo.setAreaCode(RegionConst.RC_HZ); baseinfo.setBaseAreaCode(project.getAreaCode() + RegionConst.NINE_CODE_LAST); baseinfo.setBaseAreaName(project.getArea()); baseinfo.setBaseBuildDeprt(project.getBuildOrgName()); @@ -113,7 +113,7 @@ public class ProjectConvertUtil { GovBizProjectApplyVO apply = new GovBizProjectApplyVO(); // apply.setBaseProjId(project.getProjectCode()); apply.setBaseProjName(project.getProjectName()); - apply.setAreaCode(RegionConst.RC_LS); + apply.setAreaCode(RegionConst.RC_HZ); apply.setBaseHistorProjId(project.getBaseHistorProjId()); apply.setBaseBasisEstablish(project.getBaseBasisEstablish()); List projectApplications = project.getProjectApplications(); @@ -211,7 +211,7 @@ public class ProjectConvertUtil { if(Objects.nonNull(file)){ approve.setApprovalFile(JSON.toJSONString(Lists.newArrayList(file))); } - approve.setAreaCode(RegionConst.RC_LS); + approve.setAreaCode(RegionConst.RC_HZ); approve.setDeleted(Boolean.FALSE); approve.setBaseDevelopCode(project.getDevelopCode()); approve.setBaseExpertTotalMoney(project.getProposeTotalInvest()); @@ -252,7 +252,7 @@ public class ProjectConvertUtil { // cim.setBaseProjId(project.getProjectCode()); cim.setBaseProjName(project.getProjectName()); cim.setBaseEngineerPostpoFile(project.getSupportingMaterialsFile()); - cim.setAreaCode(RegionConst.RC_LS); + cim.setAreaCode(RegionConst.RC_HZ); cim.setDeleted(Boolean.FALSE); cim.setBaseDevelopCode(project.getDevelopCode()); //总结报告 @@ -282,7 +282,7 @@ public class ProjectConvertUtil { // mim.setBaseProjId(project.getProjectCode()); mim.setBaseProjName(project.getProjectName()); mim.setBaseEngineerPostpoFile(project.getSupportingMaterialsFile()); - mim.setAreaCode(RegionConst.RC_LS); + mim.setAreaCode(RegionConst.RC_HZ); mim.setDeleted(Boolean.FALSE); mim.setBaseDevelopCode(project.getDevelopCode()); //监理总结报告 @@ -319,7 +319,7 @@ public class ProjectConvertUtil { return purchases.stream().map(p -> { GovBizProjectProcureVO purchase = new GovBizProjectProcureVO(); purchase.setBaseProjName(project.getProjectName()); - purchase.setAreaCode(RegionConst.RC_LS); + purchase.setAreaCode(RegionConst.RC_HZ); purchase.setDeleted(Boolean.FALSE); purchase.setBaseBidName(p.getBidName()); purchase.setBasePurchasingAgencies(p.getAgency()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/AppIrsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/AppIrsManage.java index fca8c82..5421df8 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/AppIrsManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/AppIrsManage.java @@ -266,7 +266,7 @@ public class AppIrsManage { * @return */ private String convertAreaCode(String areaCode) { - if (RegionConst.RC_LS.equals(areaCode) || RegionConst.LS_KF.equals(areaCode)) { + if (RegionConst.RC_HZ.equals(areaCode) || RegionConst.LS_KF.equals(areaCode)) { return RegionConst.RC_LS_SBJ_IRS; } return areaCode; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/portrait/manage/TagManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/manage/TagManage.java index 1441410..164ae81 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/portrait/manage/TagManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/manage/TagManage.java @@ -93,7 +93,7 @@ public class TagManage { }else if(user.getRegionAdmin()){ //如果是区域管理员 log.info(user.getUsername() + " 是区管,可以看本区域" + user.getRegionCode() + "标签"); - if(!RegionConst.RC_LS.equals(user.getRegionCode())){ + if(!RegionConst.RC_HZ.equals(user.getRegionCode())){ //非市本级的区管 只可以看自己区域的 query.eq(Tag::getAreaCode,user.getRegionCode()); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DefaultDeclaredProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DefaultDeclaredProjectManage.java index 38ccb70..d9b43ef 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DefaultDeclaredProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DefaultDeclaredProjectManage.java @@ -201,7 +201,7 @@ public class DefaultDeclaredProjectManage { orgMap.put(OrgTypeEnum.TARGET_LABEL.name(),orgInfoDTO); //如果有上级条线主管单位 并且 不是市本级 - if(!RegionConst.RC_LS.equals(project.getAreaCode()) && + if(!RegionConst.RC_HZ.equals(project.getAreaCode()) && CommonEnum.YES.getCode().equals(project.getIsHigherSuperOrg())){ OrgInfoDTO parentLineOrgInfoDto = new OrgInfoDTO(); parentLineOrgInfoDto.setOrganizationCode(project.getHigherSuperOrgCode()); @@ -271,7 +271,7 @@ public class DefaultDeclaredProjectManage { orgMap.put(OrgTypeEnum.TARGET_LABEL.name(),orgInfoDTO); //如果有上级条线主管单位 并且 不是市本级 - if(!RegionConst.RC_LS.equals(project.getAreaCode()) && + if(!RegionConst.RC_HZ.equals(project.getAreaCode()) && CommonEnum.YES.getCode().equals(project.getIsHigherSuperOrg())){ OrgInfoDTO parentLineOrgInfoDto = new OrgInfoDTO(); parentLineOrgInfoDto.setOrganizationCode(project.getHigherSuperOrgCode()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java index b54b92b..35cdc40 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java @@ -73,7 +73,7 @@ public class ReviewChecklistManage { //建设方案提交后的状态 query.ge(Project::getStatus, ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()) .ne(Project::getStatus, ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()) - .eq(Project::getAreaCode, RegionConst.RC_LS); + .eq(Project::getAreaCode, RegionConst.RC_HZ); UserInfoDetails user = LoginUserUtil.loginUserDetail(); buildReviewCheckPermission(query, user); @@ -186,7 +186,7 @@ public class ReviewChecklistManage { return userDto; } - if (!regionCode.equals(RegionConst.RC_LS) || StringUtils.isBlank(employeeCode)) { + if (!regionCode.equals(RegionConst.RC_HZ) || StringUtils.isBlank(employeeCode)) { log.info("当前操作人 不是市本级 或者没有钉钉工号 :{},{},{}", user.getUsername(), user.getRegionCode(), user.getEmployeeCode()); query.eq(Project::getId, 0L); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ContractSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ContractSaveDTO.java index e10db74..cbd43e3 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ContractSaveDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ContractSaveDTO.java @@ -17,11 +17,9 @@ import java.util.List; * @Author PoffyZhang */ @Data -@ApiModel(value = "合同对象", description = "") +@ApiModel(value = "合同对象") public class ContractSaveDTO { - private static final long serialVersionUID = 1L; - @ApiModelProperty("项目ID") @NotNull(message = "项目ID不能为空") private Long projectId; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Contract.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Contract.java index 745aa3d..c4ceb1d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Contract.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Contract.java @@ -18,11 +18,9 @@ import java.time.LocalDateTime; */ @Data @TableName("nd_contract") -@ApiModel(value = "合同对象", description = "") +@ApiModel(value = "合同对象") public class Contract { - private static final long serialVersionUID = 1L; - @ApiModelProperty("主键") @TableId(type = IdType.AUTO) private Long id; @@ -71,4 +69,5 @@ public class Contract { @ApiModelProperty("项目编号") private String projectCode; + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PaymentPlan.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PaymentPlan.java index e4e7e1f..bfc2243 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PaymentPlan.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PaymentPlan.java @@ -17,7 +17,7 @@ import java.time.LocalDateTime; */ @Data @TableName("nd_payment_plan") -@ApiModel(value = "PaymentPlan", description = "") +@ApiModel(value = "PaymentPlan") public class PaymentPlan { private static final long serialVersionUID = 1L; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/GenerateProjectCodeUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/GenerateProjectCodeUtil.java index 01eb51d..da84473 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/GenerateProjectCodeUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/GenerateProjectCodeUtil.java @@ -78,7 +78,7 @@ public class GenerateProjectCodeUtil { VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("没有项目基本信息 无法生成项目编号!"); VUtils.isTrue(Objects.isNull(apply)).throwMessage("没有项目申报信息 无法生成项目编号!"); - String areaCode = (StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode() : RegionConst.RC_LS + BizConst.NINE_AREA_CODE_LAST); + String areaCode = (StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode() : RegionConst.RC_HZ + BizConst.NINE_AREA_CODE_LAST); // 获取建设年度 (10-13) String year = Objects.nonNull(apply.getBaseProjSetYear()) ? apply.getBaseProjSetYear() : String.valueOf(LocalDateTime.now().getYear()); @@ -101,7 +101,7 @@ public class GenerateProjectCodeUtil { VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("没有项目基本信息 无法生成项目编号!"); VUtils.isTrue(Objects.isNull(apply)).throwMessage("没有项目申报信息 无法生成项目编号!"); - String areaCode = (StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode() : RegionConst.RC_LS + BizConst.NINE_AREA_CODE_LAST); + String areaCode = (StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode() : RegionConst.RC_HZ + BizConst.NINE_AREA_CODE_LAST); // 获取建设年度 (10-13) String year = Objects.nonNull(apply.getBaseProjSetYear()) ? apply.getBaseProjSetYear() : String.valueOf(LocalDateTime.now().getYear()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java index 8d96bbc..b3e1e49 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java @@ -1358,7 +1358,7 @@ public class ProjectLibManage { break; case REGION_MANAGER: //区域管理员 看到自己区域的项目 如果是市本级 就看全市的 - if (RegionConst.RC_LS.equals(user.getRegionCode())) { + if (RegionConst.RC_HZ.equals(user.getRegionCode())) { Collection regionCodes = regionCacheHelper.listChildRegionCodeList(user.getRegionCode(), RegionConst.RL_CITY); query.in(Project::getAreaCode, regionCodes); @@ -1402,7 +1402,7 @@ public class ProjectLibManage { break; case REGION_MANAGER: //区域管理员 看到自己区域的项目 如果是市本级 就看全市的 - if (RegionConst.RC_LS.equals(user.getRegionCode())) { + if (RegionConst.RC_HZ.equals(user.getRegionCode())) { Collection regionCodes = regionCacheHelper.listChildRegionCodeList(user.getRegionCode(), RegionConst.RL_CITY); req.setRegionCodes(regionCodes); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java index 7a6b329..47b1c04 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java @@ -622,7 +622,7 @@ public class ProjectRenewalFundManage { break; case REGION_MANAGER: //区域管理员 看到自己区域的项目 如果是市本级 就看全市的 - if (RegionConst.RC_LS.equals(user.getRegionCode())) { + if (RegionConst.RC_HZ.equals(user.getRegionCode())) { Collection regionCodes = regionCacheHelper.listChildRegionCodeList(user.getRegionCode(), RegionConst.RL_CITY); req.setRegionCodes(regionCodes); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectApplication.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectApplication.java index d2f4a98..f971ce3 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectApplication.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectApplication.java @@ -18,7 +18,7 @@ import lombok.Data; * @since 2023-02-05 */ @TableName("nd_project_application") -@ApiModel(value = "NdProjectApplication对象", description = "") +@ApiModel(value = "NdProjectApplication对象") @Data public class ProjectApplication implements Serializable { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/safety/manage/SafetyRiskManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/safety/manage/SafetyRiskManage.java index 68cae70..2004695 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/safety/manage/SafetyRiskManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/safety/manage/SafetyRiskManage.java @@ -92,7 +92,7 @@ public class SafetyRiskManage { } else if (user.getRegionAdmin()) { //如果是区域管理员 log.info(user.getUsername() + " 是区管,可以看本区域" + user.getRegionCode() + "项目"); - if (!RegionConst.RC_LS.equals(user.getRegionCode())) { + if (!RegionConst.RC_HZ.equals(user.getRegionCode())) { //不是丽水市本级的话 就只看 自己区域的 query.eq(Project::getAreaCode, user.getRegionCode()); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CheckProvincialReviewResultTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CheckProvincialReviewResultTask.java index d8c3649..a4dba53 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CheckProvincialReviewResultTask.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CheckProvincialReviewResultTask.java @@ -63,7 +63,7 @@ public class CheckProvincialReviewResultTask { .eq(Project::getStage, ProjectStatusEnum.NOT_APPROVED.getCode()) .eq(Project::getStatus, ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()) .ge(Project::getDeclareAmount, ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT) - .eq(Project::getAreaCode, RegionConst.RC_LS) + .eq(Project::getAreaCode, RegionConst.RC_HZ) .eq(Project::getNewest,Boolean.TRUE) .orderByAsc(Project::getCreateOn)); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java index f3308ba..79b7e17 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java @@ -149,7 +149,7 @@ public class CockpitStatsStatisticsTask { DashboardConstant.CockpitStats.TOTAL,year)); } - List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY); + List regions = regionCacheHelper.listChildren(RegionConst.RC_HZ, RegionConst.RL_CITY); regions = regions.stream().filter(r -> r.getRegionLevel() != RegionConst.RL_CITY).collect(Collectors.toList()); for(RegionDTO regionDto : regions){ res.add(statisticsData(regionDto.getRegionCode(),regionDto.getRegionName(), diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/InitProcessTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/InitProcessTask.java index e8b4309..80d1299 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/InitProcessTask.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/InitProcessTask.java @@ -54,7 +54,7 @@ public class InitProcessTask { StopWatch stopWatch = new StopWatch(); stopWatch.start(); // 1.查出丽水市下的 区县 分别去初始化 表单和流程配置数据 - List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY); + List regions = regionCacheHelper.listChildren(RegionConst.RC_HZ, RegionConst.RL_CITY); if (CollUtil.isEmpty(regions)) { throw new BizException("丽水地区数据为空 任务结束!"); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/ProjectStatusFlowTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/ProjectStatusFlowTask.java index 580c373..a61a406 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/ProjectStatusFlowTask.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/ProjectStatusFlowTask.java @@ -46,7 +46,6 @@ public class ProjectStatusFlowTask { @Scheduled(cron = "0 */1 * * * ?") public void statusFlow() throws UnknownHostException { - // if (HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { //1. 定时取 项目暂存表的数据 去进行状态继续流转 List stagingList = projectStagingService.list(Wrappers.lambdaQuery(ProjectStaging.class) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/MenuManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/MenuManage.java index dae0a17..ed0edf3 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/MenuManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/MenuManage.java @@ -85,7 +85,7 @@ public class MenuManage { StopWatch stopWatch = new StopWatch(); stopWatch.start(); //1.查出丽水市下的 区县 分别去初始化 表单和流程配置数据 - List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY); + List regions = regionCacheHelper.listChildren(RegionConst.RC_HZ, RegionConst.RL_CITY); if(CollUtil.isEmpty(regions)){ throw new BizException("丽水地区数据为空 任务结束!"); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserDetailVO.java index fec4839..fea6e63 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserDetailVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserDetailVO.java @@ -64,7 +64,7 @@ public class ResUserDetailVO { //是否是市级单位 public Boolean getIsMunicipalOrg(){ //如果是丽水市本级的code 就是 - if(RegionConst.RC_LS.equals(this.regionCode)){ + if(RegionConst.RC_HZ.equals(this.regionCode)){ return Boolean.TRUE; } return Boolean.FALSE; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java index 4587be1..a89b4e7 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java @@ -174,7 +174,7 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails { public Boolean getIsMunicipalOrg() { //如果是丽水市本级的code 就是 - if (RegionConst.RC_LS.equals(this.regionCode)) { + if (RegionConst.RC_HZ.equals(this.regionCode)) { return Boolean.TRUE; } return Boolean.FALSE; diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/provincial/Test.java b/hz-pm-api/src/test/java/com/hz/pm/api/provincial/Test.java index a734faa..c4fcb7f 100644 --- a/hz-pm-api/src/test/java/com/hz/pm/api/provincial/Test.java +++ b/hz-pm-api/src/test/java/com/hz/pm/api/provincial/Test.java @@ -121,7 +121,7 @@ public class Test extends AppTests{// .eq(Project::getStage, ProjectStatusEnum.NOT_APPROVED.getCode()) .eq(Project::getStatus, ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()) .ge(Project::getDeclareAmount, ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT) - .eq(Project::getAreaCode, RegionConst.RC_LS) + .eq(Project::getAreaCode, RegionConst.RC_HZ) .orderByAsc(Project::getCreateOn)); log.info("需要去查询省级联审结果的项目 size:{}",projectList.size()); diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/sys/processDef/ProcessDefTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/sys/processDef/ProcessDefTest.java index ab2dcfe..2b6aff5 100644 --- a/hz-pm-api/src/test/java/com/hz/pm/api/sys/processDef/ProcessDefTest.java +++ b/hz-pm-api/src/test/java/com/hz/pm/api/sys/processDef/ProcessDefTest.java @@ -59,7 +59,7 @@ public class ProcessDefTest extends AppTests { StopWatch stopWatch = new StopWatch(); stopWatch.start(); //1.查出丽水市下的 区县 分别去初始化 表单和流程配置数据 - List regions = regionCacheHelper.listChildren(RegionConst.RC_LS, RegionConst.RL_CITY); + List regions = regionCacheHelper.listChildren(RegionConst.RC_HZ, RegionConst.RL_CITY); if(CollUtil.isEmpty(regions)){ throw new BizException("丽水地区数据为空 任务结束!"); From 4a1e657d85bf018d3b72f1f1de41788e57c6941f Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 4 Jan 2024 15:00:22 +0800 Subject: [PATCH 03/44] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BB=A3=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pm/api/common/config/AuthCodeProperties.java | 35 +++++++++++++ .../api/meeting/entity/config/WebProperties.java | 7 +++ .../pm/api/user/controller/UserAuthController.java | 53 +++++++++++++++++-- .../hz/pm/api/user/manage/AgentLoginManage.java | 32 ++++++++++++ .../com/hz/pm/api/user/manage/AuthCodeManage.java | 60 ++++++++++++++++++++++ .../com/hz/pm/api/user/model/vo/AuthCodeVO.java | 20 ++++++++ .../user/security/auth/agent/AgentAuthFilter.java | 22 ++++++-- .../auth/agent/AgentAuthSecurityConfig.java | 9 ++-- hz-pm-api/src/main/resources/application-dev.yml | 7 ++- hz-pm-api/src/main/resources/application-prod.yml | 8 ++- hz-pm-api/src/main/resources/security/auth-dev.yml | 1 + 11 files changed, 239 insertions(+), 15 deletions(-) create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/config/AuthCodeProperties.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AgentLoginManage.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AuthCodeManage.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/AuthCodeVO.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/config/AuthCodeProperties.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/config/AuthCodeProperties.java new file mode 100644 index 0000000..6560785 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/config/AuthCodeProperties.java @@ -0,0 +1,35 @@ +package com.hz.pm.api.common.config; + +import cn.hutool.core.util.RandomUtil; +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + *

+ * AuthCodeProperties + *

+ * + * @author WendyYang + * @since 00:15 2023/12/21 + */ +@Data +@ConfigurationProperties(prefix = "auth-code") +public class AuthCodeProperties { + + private String secretKey; + + /** + * authCode失效时间(单位:秒) + */ + private Integer expireTime = 30; + + /** + * authCode长度(最大:16~32) + */ + private Integer length = 16; + + public static void main(String[] args) { + System.out.println("secretKey:" + RandomUtil.randomString(32)); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/config/WebProperties.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/config/WebProperties.java index 1a19608..b320696 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/config/WebProperties.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/config/WebProperties.java @@ -20,8 +20,15 @@ public class WebProperties { public static String webUrl; + public static String apiHost; + public static String provincialUrl; + @Value("${api-host:}") + private void setApiHost(String host) { + apiHost = host; + } + @Value("${expert-registration.url:/expertEnroll}") private void setExpertRegistrationUrl(String url) { expertRegistrationUrl = url; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java index c8378b6..f9dfdd2 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java @@ -2,9 +2,17 @@ package com.hz.pm.api.user.controller; import com.fasterxml.jackson.databind.ObjectMapper; +import com.hz.pm.api.common.config.AuthCodeProperties; +import com.hz.pm.api.meeting.entity.config.WebProperties; +import com.hz.pm.api.user.manage.AgentLoginManage; +import com.hz.pm.api.user.manage.AuthCodeManage; +import com.hz.pm.api.user.model.vo.AuthCodeVO; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.util.StrPool; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.user.security.auth.constants.SessionTimeConstant; +import com.ningdatech.log.annotation.WebLog; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -35,6 +43,10 @@ import java.io.IOException; public class UserAuthController { private final ObjectMapper objectMapper; + private final AuthCodeManage authCodeManage; + private final AgentLoginManage agentLoginManage; + + private static final String AGENT_LOGIN_PATH = "/api/v1/user/auth/agent-login"; @PostMapping(value = "/login", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @ApiOperation(value = "登陆") @@ -81,12 +93,43 @@ public class UserAuthController { response.getWriter().write(objectMapper.writeValueAsString(BizConst.UNAUTHENTICATED)); } - @PostMapping(value = "/agent-login", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) + @PostMapping(value = "/proxy/agent-login", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @ApiOperation(value = "代登陆") - @ApiImplicitParams({ - @ApiImplicitParam(name = "userId", value = "账号", required = true, paramType = "form", dataType = "String")}) - public void agentLogin(@RequestParam(value = "userId") String userId) { - // 不实现任何内容,只是为了出api文档 + @WebLog("代登录(代理接口)") + public void agentLoginProxy(@RequestParam(value = "userId") Long userId, + @RequestParam(value = "username", required = false, defaultValue = "") String username, + @RequestParam(value = "timestamp") long timestamp, + @RequestParam(value = "sign") String sign, + HttpServletRequest request, + HttpServletResponse response) throws IOException { + if (System.currentTimeMillis() - timestamp > 5000) { + throw BizException.wrap("签名已过期"); + } + if (LoginUserUtil.getUserId().equals(userId)) { + throw BizException.wrap("代登录用户无效"); + } + String targetUserId = String.valueOf(userId); + if (!agentLoginManage.agentLoginProxySignCheck(targetUserId, sign)) { + throw BizException.wrap("签名错误"); + } + String authCode = authCodeManage.generateAuthCode(targetUserId); + String urlParam = "?userId=" + userId + "&username=" + username + "&authCode=" + authCode; + String path = WebProperties.apiHost + request.getContextPath() + AGENT_LOGIN_PATH; + response.sendRedirect(path + urlParam); + } + + @PostMapping(value = "/getAuthCode", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) + public AuthCodeVO getAuthCode(@RequestParam(value = "userId") String userId, + @RequestParam(value = "sign") String sign) { + String authCode = authCodeManage.generateAuthCode(userId, sign); + return new AuthCodeVO(authCode); + } + + @GetMapping(value = "/agent-login") + @ApiOperation(value = "代登陆") + public void agentLogin(@RequestParam(value = "userId") String userId, + @RequestParam(value = "username") String username, + @RequestParam(value = "authCode") String authCode) { } @PostMapping(value = "/mh-login", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AgentLoginManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AgentLoginManage.java new file mode 100644 index 0000000..b2ce4d6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AgentLoginManage.java @@ -0,0 +1,32 @@ +package com.hz.pm.api.user.manage; + +import cn.hutool.crypto.SecureUtil; +import cn.hutool.crypto.digest.HMac; +import com.hz.pm.api.user.util.LoginUserUtil; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +/** + *

+ * AgentLoginProxyManage + *

+ * + * @author WendyYang + * @since 09:35 2023/12/21 + */ +@Component +public class AgentLoginManage { + + /** + * 代登录代理接口:secretKey + */ + @Value("${agent-login.proxy.secret-key}") + private String agentLoginProxySecretKey; + + public boolean agentLoginProxySignCheck(String userId, String sign) { + HMac hmacMd5 = SecureUtil.hmacMd5(agentLoginProxySecretKey); + String digestHex = hmacMd5.digestHex(userId + "#" + LoginUserUtil.getUserId()); + return digestHex.equals(sign); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AuthCodeManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AuthCodeManage.java new file mode 100644 index 0000000..409b0df --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AuthCodeManage.java @@ -0,0 +1,60 @@ +package com.hz.pm.api.user.manage; + +import cn.hutool.core.util.RandomUtil; +import cn.hutool.crypto.SecureUtil; +import cn.hutool.crypto.digest.HMac; +import com.hz.pm.api.common.config.AuthCodeProperties; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.cache.model.cache.CacheKey; +import com.ningdatech.cache.repository.CachePlusOps; +import lombok.RequiredArgsConstructor; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.stereotype.Component; + +import java.time.Duration; + +/** + *

+ * AuthCodeManage + *

+ * + * @author WendyYang + * @since 23:59 2023/12/20 + */ +@Component +@RequiredArgsConstructor +@EnableConfigurationProperties(AuthCodeProperties.class) +public class AuthCodeManage { + + private final CachePlusOps cachePlusOps; + private final AuthCodeProperties authCodeProperties; + + private String generateAuthCode(String userId, boolean checkSign, String sign) { + if (checkSign) { + HMac hmacMd5 = SecureUtil.hmacMd5(authCodeProperties.getSecretKey()); + String digestHex = hmacMd5.digestHex(userId); + if (!digestHex.equals(sign)) { + throw BizException.wrap("获取授权码失败:签名错误"); + } + } + String authCode = RandomUtil.randomString(authCodeProperties.getLength()); + Duration duration = Duration.ofSeconds(authCodeProperties.getExpireTime()); + CacheKey key = new CacheKey(userId + "#" + authCode, duration); + cachePlusOps.set(key, userId); + return authCode; + } + + public String generateAuthCode(String userId, String sign) { + return generateAuthCode(userId, true, sign); + } + + public String generateAuthCode(String userId) { + return generateAuthCode(userId, false, null); + } + + public boolean authCodeCheck(String userId, String authCode) { + CacheKey key = new CacheKey(userId + "#" + authCode); + return cachePlusOps.del(key) > 0; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/AuthCodeVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/AuthCodeVO.java new file mode 100644 index 0000000..171adb6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/AuthCodeVO.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.user.model.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; + +/** + *

+ * AuthCodeVO + *

+ * + * @author WendyYang + * @since 00:06 2023/12/21 + */ +@Data +@AllArgsConstructor +public class AuthCodeVO { + + private String authCode; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthFilter.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthFilter.java index d7979e0..2cd40dc 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthFilter.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthFilter.java @@ -1,5 +1,7 @@ package com.hz.pm.api.user.security.auth.agent; +import com.hz.pm.api.common.util.StrUtils; +import com.hz.pm.api.user.manage.AuthCodeManage; import com.hz.pm.api.user.security.model.WebRequestDetails; import com.ningdatech.basic.exception.BizException; import org.apache.commons.lang3.StringUtils; @@ -27,10 +29,15 @@ public class AgentAuthFilter extends AbstractAuthenticationProcessingFilter { private static final String USER_ID_PARAMETER = "userId"; + private static final String AUTH_CODE = "authCode"; + + private final AuthCodeManage authCodeManage; + // =================================================================================================== - public AgentAuthFilter(String processingUrl) { + public AgentAuthFilter(String processingUrl,AuthCodeManage authCodeManage) { super(new AntPathRequestMatcher(processingUrl, HttpMethod.POST.name())); + this.authCodeManage = authCodeManage; } // ======================================================================================================== @@ -41,12 +48,17 @@ public class AgentAuthFilter extends AbstractAuthenticationProcessingFilter { if (request.getMethod().equals(HttpMethod.POST.name())) { throw new AuthenticationServiceException("请求方法错误"); } - String userId = request.getParameter(USER_ID_PARAMETER); + String userId = StrUtils.trim(request.getParameter(USER_ID_PARAMETER)); if (StringUtils.isBlank(userId)) { - throw new BadCredentialsException("用户id 不能为空"); + throw new BadCredentialsException("用户ID不能为空"); + } + String authCode = StrUtils.trim(request.getParameter(AUTH_CODE)); + if (StringUtils.isBlank(userId)) { + throw new BadCredentialsException("授权码不能为空"); + } + if (!authCodeManage.authCodeCheck(userId, authCode)) { + throw new BadCredentialsException("授权码已过期"); } - - userId = trim(userId); try { AgentAuthToken authRequest = new AgentAuthToken(userId, userId); authRequest.setDetails(new WebRequestDetails(request)); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthSecurityConfig.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthSecurityConfig.java index 84a2596..96f6e16 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthSecurityConfig.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthSecurityConfig.java @@ -1,5 +1,6 @@ package com.hz.pm.api.user.security.auth.agent; +import com.hz.pm.api.user.manage.AuthCodeManage; import com.hz.pm.api.user.security.config.AuthProperties; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.security.authentication.AuthenticationManager; @@ -28,21 +29,23 @@ public class AgentAuthSecurityConfig extends SecurityConfigurerAdapter Date: Thu, 4 Jan 2024 15:29:54 +0800 Subject: [PATCH 04/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hz/pm/api/user/controller/UserAuthController.java | 8 +++----- .../main/java/com/hz/pm/api/user/manage/AgentLoginManage.java | 7 +++++-- .../main/java/com/hz/pm/api/user/manage/AuthCodeManage.java | 10 +++++----- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java index f9dfdd2..bd2e73e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java @@ -102,14 +102,11 @@ public class UserAuthController { @RequestParam(value = "sign") String sign, HttpServletRequest request, HttpServletResponse response) throws IOException { - if (System.currentTimeMillis() - timestamp > 5000) { - throw BizException.wrap("签名已过期"); - } if (LoginUserUtil.getUserId().equals(userId)) { throw BizException.wrap("代登录用户无效"); } String targetUserId = String.valueOf(userId); - if (!agentLoginManage.agentLoginProxySignCheck(targetUserId, sign)) { + if (!agentLoginManage.agentLoginProxySignCheck(targetUserId, timestamp, sign)) { throw BizException.wrap("签名错误"); } String authCode = authCodeManage.generateAuthCode(targetUserId); @@ -120,8 +117,9 @@ public class UserAuthController { @PostMapping(value = "/getAuthCode", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) public AuthCodeVO getAuthCode(@RequestParam(value = "userId") String userId, + @RequestParam(value = "timestamp") Long timestamp, @RequestParam(value = "sign") String sign) { - String authCode = authCodeManage.generateAuthCode(userId, sign); + String authCode = authCodeManage.generateAuthCode(userId, timestamp, sign); return new AuthCodeVO(authCode); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AgentLoginManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AgentLoginManage.java index b2ce4d6..aafc454 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AgentLoginManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AgentLoginManage.java @@ -23,9 +23,12 @@ public class AgentLoginManage { @Value("${agent-login.proxy.secret-key}") private String agentLoginProxySecretKey; - public boolean agentLoginProxySignCheck(String userId, String sign) { + public boolean agentLoginProxySignCheck(String userId, Long timestamp, String sign) { + if (System.currentTimeMillis() - timestamp > 5000) { + return false; + } HMac hmacMd5 = SecureUtil.hmacMd5(agentLoginProxySecretKey); - String digestHex = hmacMd5.digestHex(userId + "#" + LoginUserUtil.getUserId()); + String digestHex = hmacMd5.digestHex(userId + "#" + timestamp); return digestHex.equals(sign); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AuthCodeManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AuthCodeManage.java index 409b0df..f3028a7 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AuthCodeManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AuthCodeManage.java @@ -29,10 +29,10 @@ public class AuthCodeManage { private final CachePlusOps cachePlusOps; private final AuthCodeProperties authCodeProperties; - private String generateAuthCode(String userId, boolean checkSign, String sign) { + private String generateAuthCode(String userId, boolean checkSign, Long timestamp, String sign) { if (checkSign) { HMac hmacMd5 = SecureUtil.hmacMd5(authCodeProperties.getSecretKey()); - String digestHex = hmacMd5.digestHex(userId); + String digestHex = hmacMd5.digestHex(userId + "#" + timestamp); if (!digestHex.equals(sign)) { throw BizException.wrap("获取授权码失败:签名错误"); } @@ -44,12 +44,12 @@ public class AuthCodeManage { return authCode; } - public String generateAuthCode(String userId, String sign) { - return generateAuthCode(userId, true, sign); + public String generateAuthCode(String userId, Long timestamp, String sign) { + return generateAuthCode(userId, true, timestamp, sign); } public String generateAuthCode(String userId) { - return generateAuthCode(userId, false, null); + return generateAuthCode(userId, false, null, null); } public boolean authCodeCheck(String userId, String authCode) { From 5148363e5f628e6f87cb4c9e5d861aaa08d5654e Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 4 Jan 2024 19:08:06 +0800 Subject: [PATCH 05/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pm/api/common/config/AuthCodeProperties.java | 35 ---------- .../com/hz/pm/api/common/config/AuthCodeProps.java | 37 ++++++++++ .../projectlib/model/req/ProjectApprovedReq.java | 1 - .../pm/api/user/controller/UserAuthController.java | 40 +++++------ .../hz/pm/api/user/manage/AgentLoginManage.java | 1 - .../hz/pm/api/user/manage/AuthCodeLoginManage.java | 70 +++++++++++++++++++ .../com/hz/pm/api/user/manage/AuthCodeManage.java | 60 ---------------- .../user/security/auth/agent/AgentAuthFilter.java | 81 ---------------------- .../security/auth/agent/AgentAuthProvider.java | 38 ---------- .../auth/agent/AgentAuthSecurityConfig.java | 61 ---------------- .../user/security/auth/agent/AgentAuthToken.java | 75 -------------------- .../auth/agent/AgentLoginUserDetailService.java | 41 ----------- .../security/auth/code/AuthCodeLoginFilter.java | 60 ++++++++++++++++ .../security/auth/code/AuthCodeLoginProvider.java | 38 ++++++++++ .../auth/code/AuthCodeLoginSecurityConfig.java | 61 ++++++++++++++++ .../auth/code/AuthCodeLoginUserDetailService.java | 44 ++++++++++++ .../api/user/security/auth/code/AuthCodeToken.java | 77 ++++++++++++++++++++ .../api/user/security/config/AuthProperties.java | 2 +- .../user/security/config/WebSecurityConfig.java | 6 +- hz-pm-api/src/main/resources/security/auth-dev.yml | 2 +- .../src/main/resources/security/auth-prod.yml | 2 +- 21 files changed, 412 insertions(+), 420 deletions(-) delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/config/AuthCodeProperties.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/config/AuthCodeProps.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AuthCodeLoginManage.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AuthCodeManage.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthFilter.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthProvider.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthSecurityConfig.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthToken.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentLoginUserDetailService.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/code/AuthCodeLoginFilter.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/code/AuthCodeLoginProvider.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/code/AuthCodeLoginSecurityConfig.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/code/AuthCodeLoginUserDetailService.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/code/AuthCodeToken.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/config/AuthCodeProperties.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/config/AuthCodeProperties.java deleted file mode 100644 index 6560785..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/config/AuthCodeProperties.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.hz.pm.api.common.config; - -import cn.hutool.core.util.RandomUtil; -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; - -/** - *

- * AuthCodeProperties - *

- * - * @author WendyYang - * @since 00:15 2023/12/21 - */ -@Data -@ConfigurationProperties(prefix = "auth-code") -public class AuthCodeProperties { - - private String secretKey; - - /** - * authCode失效时间(单位:秒) - */ - private Integer expireTime = 30; - - /** - * authCode长度(最大:16~32) - */ - private Integer length = 16; - - public static void main(String[] args) { - System.out.println("secretKey:" + RandomUtil.randomString(32)); - } - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/config/AuthCodeProps.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/config/AuthCodeProps.java new file mode 100644 index 0000000..45a63a7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/config/AuthCodeProps.java @@ -0,0 +1,37 @@ +package com.hz.pm.api.common.config; + +import cn.hutool.core.util.RandomUtil; +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; + +import java.util.UUID; + +/** + *

+ * AuthCodeProps + *

+ * + * @author WendyYang + * @since 00:15 2023/12/21 + */ +@Data +@ConfigurationProperties(prefix = "auth-code") +public class AuthCodeProps { + + private String secretKey; + + /** + * authCode失效时间(单位:秒) + */ + private Integer expireTime = 10; + + /** + * authCode长度(最大:24~32) + */ + private Integer length = 24; + + public static void main(String[] args) { + System.out.println("secretKey:" + RandomUtil.randomString(24)); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectApprovedReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectApprovedReq.java index 21b20bb..4286e2a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectApprovedReq.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectApprovedReq.java @@ -56,7 +56,6 @@ public class ProjectApprovedReq { private Long approvedFileId; @ApiModelProperty("建设方案文件ID") - @NotNull(message = "建设方案不能为空") private Long buildPlanFileId; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java index bd2e73e..8997b49 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java @@ -2,10 +2,9 @@ package com.hz.pm.api.user.controller; import com.fasterxml.jackson.databind.ObjectMapper; -import com.hz.pm.api.common.config.AuthCodeProperties; import com.hz.pm.api.meeting.entity.config.WebProperties; import com.hz.pm.api.user.manage.AgentLoginManage; -import com.hz.pm.api.user.manage.AuthCodeManage; +import com.hz.pm.api.user.manage.AuthCodeLoginManage; import com.hz.pm.api.user.model.vo.AuthCodeVO; import com.hz.pm.api.user.util.LoginUserUtil; import com.ningdatech.basic.exception.BizException; @@ -43,10 +42,10 @@ import java.io.IOException; public class UserAuthController { private final ObjectMapper objectMapper; - private final AuthCodeManage authCodeManage; + private final AuthCodeLoginManage authCodeLoginManage; private final AgentLoginManage agentLoginManage; - private static final String AGENT_LOGIN_PATH = "/api/v1/user/auth/agent-login"; + private static final String AUTH_CODE_LOGIN_PATH = "/api/v1/user/auth/authCodeLogin"; @PostMapping(value = "/login", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @ApiOperation(value = "登陆") @@ -93,25 +92,25 @@ public class UserAuthController { response.getWriter().write(objectMapper.writeValueAsString(BizConst.UNAUTHENTICATED)); } - @PostMapping(value = "/proxy/agent-login", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) + @PostMapping(value = "/proxy/authCodeLogin", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) @ApiOperation(value = "代登陆") @WebLog("代登录(代理接口)") - public void agentLoginProxy(@RequestParam(value = "userId") Long userId, - @RequestParam(value = "username", required = false, defaultValue = "") String username, - @RequestParam(value = "timestamp") long timestamp, - @RequestParam(value = "sign") String sign, - HttpServletRequest request, - HttpServletResponse response) throws IOException { + public void proxyAuthCodeLogin(@RequestParam(value = "userId") Long userId, + @RequestParam(value = "username") String username, + @RequestParam(value = "timestamp") long timestamp, + @RequestParam(value = "sign") String sign, + HttpServletRequest request, + HttpServletResponse response) throws IOException { if (LoginUserUtil.getUserId().equals(userId)) { - throw BizException.wrap("代登录用户无效"); + throw BizException.wrap("代登录用户无效:%s", username); } String targetUserId = String.valueOf(userId); if (!agentLoginManage.agentLoginProxySignCheck(targetUserId, timestamp, sign)) { throw BizException.wrap("签名错误"); } - String authCode = authCodeManage.generateAuthCode(targetUserId); - String urlParam = "?userId=" + userId + "&username=" + username + "&authCode=" + authCode; - String path = WebProperties.apiHost + request.getContextPath() + AGENT_LOGIN_PATH; + String authCode = authCodeLoginManage.generateAuthCode(targetUserId); + String urlParam = "?authCode=" + authCode; + String path = WebProperties.apiHost + request.getContextPath() + AUTH_CODE_LOGIN_PATH; response.sendRedirect(path + urlParam); } @@ -119,15 +118,14 @@ public class UserAuthController { public AuthCodeVO getAuthCode(@RequestParam(value = "userId") String userId, @RequestParam(value = "timestamp") Long timestamp, @RequestParam(value = "sign") String sign) { - String authCode = authCodeManage.generateAuthCode(userId, timestamp, sign); + String authCode = authCodeLoginManage.generateAuthCode(userId, timestamp, sign); return new AuthCodeVO(authCode); } - @GetMapping(value = "/agent-login") - @ApiOperation(value = "代登陆") - public void agentLogin(@RequestParam(value = "userId") String userId, - @RequestParam(value = "username") String username, - @RequestParam(value = "authCode") String authCode) { + @GetMapping(value = "/authCodeLogin", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) + @ApiOperation(value = "授权码登录") + public void authCodeLogin(@RequestParam(value = "authCode") String authCode) { + // 接口文档使用 } @PostMapping(value = "/mh-login", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AgentLoginManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AgentLoginManage.java index aafc454..5b1a4e2 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AgentLoginManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AgentLoginManage.java @@ -2,7 +2,6 @@ package com.hz.pm.api.user.manage; import cn.hutool.crypto.SecureUtil; import cn.hutool.crypto.digest.HMac; -import com.hz.pm.api.user.util.LoginUserUtil; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AuthCodeLoginManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AuthCodeLoginManage.java new file mode 100644 index 0000000..cfeda85 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AuthCodeLoginManage.java @@ -0,0 +1,70 @@ +package com.hz.pm.api.user.manage; + +import cn.hutool.core.util.RandomUtil; +import cn.hutool.crypto.SecureUtil; +import cn.hutool.crypto.digest.HMac; +import com.hz.pm.api.common.config.AuthCodeProps; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.cache.model.cache.CacheKey; +import com.ningdatech.cache.repository.CachePlusOps; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.stereotype.Component; + +import java.time.Duration; + +/** + *

+ * AuthCodeLoginManage + *

+ * + * @author WendyYang + * @since 23:59 2023/12/20 + */ +@Slf4j +@Component +@RequiredArgsConstructor +@EnableConfigurationProperties(AuthCodeProps.class) +public class AuthCodeLoginManage { + + private final CachePlusOps cachePlusOps; + private final AuthCodeProps authCodeProps; + + private String generateAuthCode(String userId, boolean checkSign, Long timestamp, String sign) { + if (checkSign) { + if (System.currentTimeMillis() - timestamp > 5000) { + throw BizException.wrap("签名无效"); + } + HMac hmacMd5 = SecureUtil.hmacMd5(authCodeProps.getSecretKey()); + String digestHex = hmacMd5.digestHex(userId + "#" + timestamp); + if (!digestHex.equals(sign)) { + throw BizException.wrap("获取授权码失败:签名错误"); + } + } + String authCode = RandomUtil.randomString(authCodeProps.getLength()); + Duration duration = Duration.ofSeconds(authCodeProps.getExpireTime()); + CacheKey key = new CacheKey(authCode, duration); + cachePlusOps.set(key, userId); + log.info("生成授权码:{} -> {}", userId, authCode); + return authCode; + } + + public String generateAuthCode(String userId, Long timestamp, String sign) { + return generateAuthCode(userId, true, timestamp, sign); + } + + public String generateAuthCode(String userId) { + return generateAuthCode(userId, false, null, null); + } + + public String getUserIdByAuthCode(String authCode) { + CacheKey key = new CacheKey(authCode); + try { + return cachePlusOps.get(key); + } finally { + cachePlusOps.del(key); + } + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AuthCodeManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AuthCodeManage.java deleted file mode 100644 index f3028a7..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/AuthCodeManage.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.hz.pm.api.user.manage; - -import cn.hutool.core.util.RandomUtil; -import cn.hutool.crypto.SecureUtil; -import cn.hutool.crypto.digest.HMac; -import com.hz.pm.api.common.config.AuthCodeProperties; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.cache.model.cache.CacheKey; -import com.ningdatech.cache.repository.CachePlusOps; -import lombok.RequiredArgsConstructor; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.stereotype.Component; - -import java.time.Duration; - -/** - *

- * AuthCodeManage - *

- * - * @author WendyYang - * @since 23:59 2023/12/20 - */ -@Component -@RequiredArgsConstructor -@EnableConfigurationProperties(AuthCodeProperties.class) -public class AuthCodeManage { - - private final CachePlusOps cachePlusOps; - private final AuthCodeProperties authCodeProperties; - - private String generateAuthCode(String userId, boolean checkSign, Long timestamp, String sign) { - if (checkSign) { - HMac hmacMd5 = SecureUtil.hmacMd5(authCodeProperties.getSecretKey()); - String digestHex = hmacMd5.digestHex(userId + "#" + timestamp); - if (!digestHex.equals(sign)) { - throw BizException.wrap("获取授权码失败:签名错误"); - } - } - String authCode = RandomUtil.randomString(authCodeProperties.getLength()); - Duration duration = Duration.ofSeconds(authCodeProperties.getExpireTime()); - CacheKey key = new CacheKey(userId + "#" + authCode, duration); - cachePlusOps.set(key, userId); - return authCode; - } - - public String generateAuthCode(String userId, Long timestamp, String sign) { - return generateAuthCode(userId, true, timestamp, sign); - } - - public String generateAuthCode(String userId) { - return generateAuthCode(userId, false, null, null); - } - - public boolean authCodeCheck(String userId, String authCode) { - CacheKey key = new CacheKey(userId + "#" + authCode); - return cachePlusOps.del(key) > 0; - } - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthFilter.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthFilter.java deleted file mode 100644 index 2cd40dc..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthFilter.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.hz.pm.api.user.security.auth.agent; - -import com.hz.pm.api.common.util.StrUtils; -import com.hz.pm.api.user.manage.AuthCodeManage; -import com.hz.pm.api.user.security.model.WebRequestDetails; -import com.ningdatech.basic.exception.BizException; -import org.apache.commons.lang3.StringUtils; -import org.springframework.http.HttpMethod; -import org.springframework.security.authentication.AuthenticationServiceException; -import org.springframework.security.authentication.BadCredentialsException; -import org.springframework.security.authentication.InternalAuthenticationServiceException; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.AuthenticationException; -import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter; -import org.springframework.security.web.util.matcher.AntPathRequestMatcher; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - *

- * AgentAuthFilter - *

- * - * @author WendyYang - * @since 13:25 2023/12/28 - */ -public class AgentAuthFilter extends AbstractAuthenticationProcessingFilter { - - private static final String USER_ID_PARAMETER = "userId"; - - private static final String AUTH_CODE = "authCode"; - - private final AuthCodeManage authCodeManage; - - // =================================================================================================== - - public AgentAuthFilter(String processingUrl,AuthCodeManage authCodeManage) { - super(new AntPathRequestMatcher(processingUrl, HttpMethod.POST.name())); - this.authCodeManage = authCodeManage; - } - - // ======================================================================================================== - - @Override - public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) - throws AuthenticationException { - if (request.getMethod().equals(HttpMethod.POST.name())) { - throw new AuthenticationServiceException("请求方法错误"); - } - String userId = StrUtils.trim(request.getParameter(USER_ID_PARAMETER)); - if (StringUtils.isBlank(userId)) { - throw new BadCredentialsException("用户ID不能为空"); - } - String authCode = StrUtils.trim(request.getParameter(AUTH_CODE)); - if (StringUtils.isBlank(userId)) { - throw new BadCredentialsException("授权码不能为空"); - } - if (!authCodeManage.authCodeCheck(userId, authCode)) { - throw new BadCredentialsException("授权码已过期"); - } - try { - AgentAuthToken authRequest = new AgentAuthToken(userId, userId); - authRequest.setDetails(new WebRequestDetails(request)); - return this.getAuthenticationManager().authenticate(authRequest); - } catch (AuthenticationException e) { - throw new BadCredentialsException("用户id 不能为空"); - } catch (BizException e) { - throw new BadCredentialsException(e.getMessage()); - } catch (Exception e) { - throw new InternalAuthenticationServiceException("授权失败:", e); - } - } - - private String trim(String trimStr) { - if (StringUtils.isNotBlank(trimStr)) { - return trimStr.trim(); - } - return null; - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthProvider.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthProvider.java deleted file mode 100644 index 2b2ff77..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthProvider.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.hz.pm.api.user.security.auth.agent; - -import lombok.Setter; -import org.springframework.security.authentication.AuthenticationProvider; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.AuthenticationException; -import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.security.core.userdetails.UserDetailsService; - -/** - *

- * AgentAuthProvider - *

- * - * @author WendyYang - * @since 20:41 2023/12/15 - */ -@Setter -public class AgentAuthProvider implements AuthenticationProvider { - - private UserDetailsService userDetailsService; - - @Override - public Authentication authenticate(Authentication authentication) throws AuthenticationException { - AgentAuthToken authenticationToken = (AgentAuthToken) authentication; - String principal = (String) authenticationToken.getPrincipal(); - - UserDetails user = userDetailsService.loadUserByUsername(principal); - // 将用户定义的user放入token中,这样可以在session中查询到所有自定义的用户信息 - return new AgentAuthToken(user, user.getPassword(), user.getAuthorities()); - } - - @Override - public boolean supports(Class authentication) { - return AgentAuthToken.class.isAssignableFrom(authentication); - } - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthSecurityConfig.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthSecurityConfig.java deleted file mode 100644 index 96f6e16..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthSecurityConfig.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.hz.pm.api.user.security.auth.agent; - -import com.hz.pm.api.user.manage.AuthCodeManage; -import com.hz.pm.api.user.security.config.AuthProperties; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.config.annotation.SecurityConfigurerAdapter; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.web.DefaultSecurityFilterChain; -import org.springframework.security.web.authentication.AuthenticationFailureHandler; -import org.springframework.security.web.authentication.AuthenticationSuccessHandler; -import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; -import org.springframework.stereotype.Component; - -/** - *

- * AgentAuthSecurityConfig - *

- * - * @author WendyYang - * @since 14:24 2023/12/16 - */ -@Component -public class AgentAuthSecurityConfig extends SecurityConfigurerAdapter { - - - protected final AuthenticationSuccessHandler defaultLoginSuccessHandler; - protected final AuthenticationFailureHandler defaultLoginFailureHandler; - private final UserDetailsService agentLoginUserDetailService; - private final AuthProperties authProperties; - private final AuthCodeManage authCodeManage; - - public AgentAuthSecurityConfig(@Qualifier(value = "defaultLoginSuccessHandler") AuthenticationSuccessHandler loginSuccessHandler, - @Qualifier(value = "defaultLoginFailureHandler") AuthenticationFailureHandler loginFailureHandler, - @Qualifier(value = "agentLoginUserDetailService") UserDetailsService agentLoginUserDetailService, - AuthProperties authProperties, - AuthCodeManage authCodeManage) { - this.defaultLoginSuccessHandler = loginSuccessHandler; - this.defaultLoginFailureHandler = loginFailureHandler; - this.agentLoginUserDetailService = agentLoginUserDetailService; - this.authProperties = authProperties; - this.authCodeManage = authCodeManage; - } - - @Override - public void configure(HttpSecurity http) { - AgentAuthFilter agentAuthFilter = new AgentAuthFilter(authProperties.getAgentLoginUrl(), authCodeManage); - AuthenticationManager authenticationManager = http.getSharedObject(AuthenticationManager.class); - agentAuthFilter.setAuthenticationManager(authenticationManager); - agentAuthFilter.setAuthenticationSuccessHandler(defaultLoginSuccessHandler); - agentAuthFilter.setAuthenticationFailureHandler(defaultLoginFailureHandler); - - AgentAuthProvider authenticationProvider = new AgentAuthProvider(); - authenticationProvider.setUserDetailsService(agentLoginUserDetailService); - - http.authenticationProvider(authenticationProvider) - .addFilterAfter(agentAuthFilter, UsernamePasswordAuthenticationFilter.class); - } - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthToken.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthToken.java deleted file mode 100644 index e861acf..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentAuthToken.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.hz.pm.api.user.security.auth.agent; - -import org.springframework.security.authentication.AbstractAuthenticationToken; -import org.springframework.security.core.GrantedAuthority; -import org.springframework.security.core.SpringSecurityCoreVersion; - -import java.util.Collection; - -/** - * @Author LiuXinXin - * @Date 2020/8/3 8:52 下午 - * @Version 1.0 - **/ -public class AgentAuthToken extends AbstractAuthenticationToken { - - private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID; - - private final Object principal; - - private final Object credentials; - - /** - * This constructor can be safely used by any code that wishes to create a - * UsernamePasswordAuthenticationToken, as the {@link #isAuthenticated()} will return - * false. - */ - public AgentAuthToken(String principal, String credentials) { - super(null); - this.principal = principal; - this.credentials = credentials; - setAuthenticated(false); - } - - /** - * This constructor should only be used by AuthenticationManager or AuthenticationProvider - * implementations that are satisfied with producing a trusted (i.e. {@link #isAuthenticated()} = true) - * authentication token. - * - * @param principal - * @param authorities - */ - public AgentAuthToken(Object principal, Object credentials, - Collection authorities) { - super(authorities); - this.principal = principal; - this.credentials = credentials; - // must use super, as we override - super.setAuthenticated(true); - } - - @Override - public Object getCredentials() { - return this.credentials; - } - - @Override - public Object getPrincipal() { - return this.principal; - } - - @Override - public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException { - if (isAuthenticated) { - throw new IllegalArgumentException( - "Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead"); - } - super.setAuthenticated(false); - } - - @Override - public void eraseCredentials() { - super.eraseCredentials(); - } - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentLoginUserDetailService.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentLoginUserDetailService.java deleted file mode 100644 index 3573156..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/agent/AgentLoginUserDetailService.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.hz.pm.api.user.security.auth.agent; - - -import com.hz.pm.api.common.helper.UserInfoHelper; -import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; -import com.hz.pm.api.user.convert.UserInfoConvertor; -import com.hz.pm.api.user.security.model.UserFullInfoDTO; -import com.hz.pm.api.user.security.model.UserInfoDetails; -import com.hz.pm.api.user.security.validate.CommonLoginException; -import lombok.RequiredArgsConstructor; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.core.userdetails.UsernameNotFoundException; -import org.springframework.stereotype.Service; - -import java.util.Objects; - -/** - * @author LiuXinXin - * @date 2022/9/30 上午9:49 - */ - -@Service("agentLoginUserDetailService") -@RequiredArgsConstructor -public class AgentLoginUserDetailService implements UserDetailsService { - - private final UserInfoHelper userInfoHelper; - - @Override - public UserInfoDetails loadUserByUsername(String username) throws UsernameNotFoundException { - Long userId = Long.parseLong(username); - UserFullInfoDTO ufi = userInfoHelper.getUserFullInfo(userId); - if (Objects.isNull(ufi)) { - throw new UsernameNotFoundException("用户不存在"); - } - if (UserAvailableEnum.DISABLE.equals(ufi.getAvailable())) { - throw new CommonLoginException("账号已禁用"); - } - return UserInfoConvertor.convert(ufi); - } - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/code/AuthCodeLoginFilter.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/code/AuthCodeLoginFilter.java new file mode 100644 index 0000000..e411f6f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/code/AuthCodeLoginFilter.java @@ -0,0 +1,60 @@ +package com.hz.pm.api.user.security.auth.code; + +import cn.hutool.core.util.StrUtil; +import com.hz.pm.api.common.util.StrUtils; +import com.hz.pm.api.user.manage.AuthCodeLoginManage; +import com.hz.pm.api.user.security.model.WebRequestDetails; +import org.apache.commons.lang3.StringUtils; +import org.springframework.http.HttpMethod; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.core.Authentication; +import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter; +import org.springframework.security.web.util.matcher.AntPathRequestMatcher; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + *

+ * AuthCodeFilter + *

+ * + * @author WendyYang + * @since 13:25 2023/12/28 + */ +public class AuthCodeLoginFilter extends AbstractAuthenticationProcessingFilter { + + private static final String AUTH_CODE = "authCode"; + + private final AuthCodeLoginManage authCodeLoginManage; + + // =================================================================================================== + + public AuthCodeLoginFilter(String processingUrl, AuthCodeLoginManage authCodeLoginManage) { + super(new AntPathRequestMatcher(processingUrl, HttpMethod.GET.name())); + this.authCodeLoginManage = authCodeLoginManage; + } + + // ======================================================================================================== + + @Override + public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) { + String authCode = StrUtils.trim(request.getParameter(AUTH_CODE)); + if (StringUtils.isBlank(authCode)) { + throw new BadCredentialsException("授权码不能为空"); + } + String userId = authCodeLoginManage.getUserIdByAuthCode(authCode); + if (StrUtil.isBlank(userId)) { + throw new BadCredentialsException("授权码无效"); + } + try { + AuthCodeToken authRequest = new AuthCodeToken(userId, userId); + authRequest.setDetails(new WebRequestDetails(request)); + return this.getAuthenticationManager().authenticate(authRequest); + } catch (Exception e) { + logger.error(e.getMessage(), e); + throw new BadCredentialsException("授权失败"); + } + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/code/AuthCodeLoginProvider.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/code/AuthCodeLoginProvider.java new file mode 100644 index 0000000..fc2b283 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/code/AuthCodeLoginProvider.java @@ -0,0 +1,38 @@ +package com.hz.pm.api.user.security.auth.code; + +import lombok.Setter; +import org.springframework.security.authentication.AuthenticationProvider; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; + +/** + *

+ * AgentAuthProvider + *

+ * + * @author WendyYang + * @since 20:41 2023/12/15 + */ +@Setter +public class AuthCodeLoginProvider implements AuthenticationProvider { + + private UserDetailsService userDetailsService; + + @Override + public Authentication authenticate(Authentication authentication) throws AuthenticationException { + AuthCodeToken authenticationToken = (AuthCodeToken) authentication; + String principal = (String) authenticationToken.getPrincipal(); + + UserDetails user = userDetailsService.loadUserByUsername(principal); + // 将用户定义的user放入token中,这样可以在session中查询到所有自定义的用户信息 + return new AuthCodeToken(user, user.getPassword(), user.getAuthorities()); + } + + @Override + public boolean supports(Class authentication) { + return AuthCodeToken.class.isAssignableFrom(authentication); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/code/AuthCodeLoginSecurityConfig.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/code/AuthCodeLoginSecurityConfig.java new file mode 100644 index 0000000..530fee8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/code/AuthCodeLoginSecurityConfig.java @@ -0,0 +1,61 @@ +package com.hz.pm.api.user.security.auth.code; + +import com.hz.pm.api.user.manage.AuthCodeLoginManage; +import com.hz.pm.api.user.security.config.AuthProperties; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.config.annotation.SecurityConfigurerAdapter; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.web.DefaultSecurityFilterChain; +import org.springframework.security.web.authentication.AuthenticationFailureHandler; +import org.springframework.security.web.authentication.AuthenticationSuccessHandler; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.stereotype.Component; + +/** + *

+ * AuthCodeSecurityConfig + *

+ * + * @author WendyYang + * @since 16:02 2024/1/4 + */ +@Component +public class AuthCodeLoginSecurityConfig extends SecurityConfigurerAdapter { + + + protected final AuthenticationSuccessHandler defaultLoginSuccessHandler; + protected final AuthenticationFailureHandler defaultLoginFailureHandler; + private final UserDetailsService userDetailsService; + private final AuthProperties authProps; + private final AuthCodeLoginManage authCodeLoginManage; + + public AuthCodeLoginSecurityConfig(@Qualifier(value = "defaultLoginSuccessHandler") AuthenticationSuccessHandler loginSuccessHandler, + @Qualifier(value = "defaultLoginFailureHandler") AuthenticationFailureHandler loginFailureHandler, + @Qualifier(value = "authCodeLoginUserDetailService") UserDetailsService userDetailsService, + AuthProperties authProps, + AuthCodeLoginManage authCodeLoginManage) { + this.defaultLoginSuccessHandler = loginSuccessHandler; + this.defaultLoginFailureHandler = loginFailureHandler; + this.userDetailsService = userDetailsService; + this.authProps = authProps; + this.authCodeLoginManage = authCodeLoginManage; + } + + @Override + public void configure(HttpSecurity http) { + AuthCodeLoginFilter filter = new AuthCodeLoginFilter(authProps.getAuthCodeLoginUrl(), authCodeLoginManage); + AuthenticationManager authenticationManager = http.getSharedObject(AuthenticationManager.class); + filter.setAuthenticationManager(authenticationManager); + filter.setAuthenticationSuccessHandler(defaultLoginSuccessHandler); + filter.setAuthenticationFailureHandler(defaultLoginFailureHandler); + + AuthCodeLoginProvider authenticationProvider = new AuthCodeLoginProvider(); + authenticationProvider.setUserDetailsService(userDetailsService); + + http.authenticationProvider(authenticationProvider) + .addFilterAfter(filter, UsernamePasswordAuthenticationFilter.class); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/code/AuthCodeLoginUserDetailService.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/code/AuthCodeLoginUserDetailService.java new file mode 100644 index 0000000..ea7599b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/code/AuthCodeLoginUserDetailService.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.user.security.auth.code; + + +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.user.convert.UserInfoConvertor; +import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; +import com.hz.pm.api.user.security.model.UserFullInfoDTO; +import com.hz.pm.api.user.security.model.UserInfoDetails; +import com.hz.pm.api.user.security.validate.CommonLoginException; +import lombok.RequiredArgsConstructor; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; + +import java.util.Objects; + +/** + *

+ * AuthCodeLoginUserDetailService + *

+ * + * @author WendyYang + * @since 15:57 2024/1/4 + */ +@Service("authCodeLoginUserDetailService") +@RequiredArgsConstructor +public class AuthCodeLoginUserDetailService implements UserDetailsService { + + private final UserInfoHelper userInfoHelper; + + @Override + public UserInfoDetails loadUserByUsername(String username) throws UsernameNotFoundException { + Long userId = Long.parseLong(username); + UserFullInfoDTO ufi = userInfoHelper.getUserFullInfo(userId); + if (Objects.isNull(ufi)) { + throw new UsernameNotFoundException("用户不存在"); + } + if (UserAvailableEnum.DISABLE.equals(ufi.getAvailable())) { + throw new CommonLoginException("账号已禁用"); + } + return UserInfoConvertor.convert(ufi); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/code/AuthCodeToken.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/code/AuthCodeToken.java new file mode 100644 index 0000000..63c8eb7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/code/AuthCodeToken.java @@ -0,0 +1,77 @@ +package com.hz.pm.api.user.security.auth.code; + +import org.springframework.security.authentication.AbstractAuthenticationToken; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.SpringSecurityCoreVersion; + +import java.util.Collection; + +/** + *

+ * AuthCodeToken + *

+ * + * @author WendyYang + * @since 15:45 2024/1/4 + */ +public class AuthCodeToken extends AbstractAuthenticationToken { + + private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID; + + private final Object principal; + + private final Object credentials; + + /** + * This constructor can be safely used by any code that wishes to create a + * UsernamePasswordAuthenticationToken, as the {@link #isAuthenticated()} will return + * false. + */ + public AuthCodeToken(String principal, String credentials) { + super(null); + this.principal = principal; + this.credentials = credentials; + setAuthenticated(false); + } + + /** + * This constructor should only be used by AuthenticationManager or AuthenticationProvider + * implementations that are satisfied with producing a trusted (i.e. {@link #isAuthenticated()} = true) + * authentication token. + * + * @param principal + * @param authorities + */ + public AuthCodeToken(Object principal, Object credentials, + Collection authorities) { + super(authorities); + this.principal = principal; + this.credentials = credentials; + super.setAuthenticated(true); + } + + @Override + public Object getCredentials() { + return this.credentials; + } + + @Override + public Object getPrincipal() { + return this.principal; + } + + @Override + public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException { + if (isAuthenticated) { + throw new IllegalArgumentException( + "Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead"); + } + super.setAuthenticated(false); + } + + @Override + public void eraseCredentials() { + super.eraseCredentials(); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/config/AuthProperties.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/config/AuthProperties.java index 9319260..9102745 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/config/AuthProperties.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/config/AuthProperties.java @@ -32,7 +32,7 @@ public class AuthProperties { /** * 代登陆接口 */ - private String agentLoginUrl; + private String authCodeLoginUrl; private String mhLoginUrl; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/config/WebSecurityConfig.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/config/WebSecurityConfig.java index 8bfb598..802e023 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/config/WebSecurityConfig.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/config/WebSecurityConfig.java @@ -1,7 +1,7 @@ package com.hz.pm.api.user.security.config; import com.hz.pm.api.common.model.constant.CommonConst; -import com.hz.pm.api.user.security.auth.agent.AgentAuthSecurityConfig; +import com.hz.pm.api.user.security.auth.code.AuthCodeLoginSecurityConfig; import com.hz.pm.api.user.security.auth.credential.CredentialAuthSecurityConfig; import com.hz.pm.api.user.security.handler.DefaultExpiredSessionStrategy; import com.hz.pm.api.user.security.handler.DefaultLogoutSuccessHandler; @@ -31,7 +31,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { private final CredentialAuthSecurityConfig credentialAuthSecurityConfig; private final DefaultLogoutSuccessHandler logoutSuccessHandler; private final DefaultExpiredSessionStrategy defaultExpiredSessionStrategy; - private final AgentAuthSecurityConfig agentAuthSecurityConfig; + private final AuthCodeLoginSecurityConfig authCodeLoginSecurityConfig; private final MhAuthSecurityConfig mhAuthSecurityConfig; @Override @@ -40,7 +40,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { http.formLogin() .loginPage(authProperties.getAuthRequireUrl()) .and().apply(credentialAuthSecurityConfig) - .and().apply(agentAuthSecurityConfig) + .and().apply(authCodeLoginSecurityConfig) .and().apply(mhAuthSecurityConfig) .and() .authorizeRequests() diff --git a/hz-pm-api/src/main/resources/security/auth-dev.yml b/hz-pm-api/src/main/resources/security/auth-dev.yml index 388d764..2330d8d 100644 --- a/hz-pm-api/src/main/resources/security/auth-dev.yml +++ b/hz-pm-api/src/main/resources/security/auth-dev.yml @@ -3,7 +3,7 @@ security: auth-require-url: /api/v1/user/auth/auth-require invalid-session-url: /api/v1/user/auth/invalid-session password-login-url: /api/v1/user/auth/login - agent-login-url: /api/v1/user/auth/agent-login + auth-code-login-url: /api/v1/user/auth/authCodeLogin mh-login-url: /api/v1/user/auth/mh-login logout-url: /api/v1/user/auth/logout common-login-url: /api/v1/user/auth/common-login diff --git a/hz-pm-api/src/main/resources/security/auth-prod.yml b/hz-pm-api/src/main/resources/security/auth-prod.yml index ad39a58..2a672b5 100644 --- a/hz-pm-api/src/main/resources/security/auth-prod.yml +++ b/hz-pm-api/src/main/resources/security/auth-prod.yml @@ -3,7 +3,7 @@ security: auth-require-url: /api/v1/user/auth/auth-require invalid-session-url: /api/v1/user/auth/invalid-session password-login-url: /api/v1/user/auth/login - agent-login-url: /api/v1/user/auth/agent-login + auth-code-login-url: /api/v1/user/auth/authCodeLogin mh-login-url: /api/v1/user/auth/mh-login logout-url: /api/v1/user/auth/logout common-login-url: /api/v1/user/auth/common-login From 7a1d7480a05a0786e01b9ea0287b3cf204d86f29 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 4 Jan 2024 19:22:55 +0800 Subject: [PATCH 06/44] =?UTF-8?q?=E5=BB=BA=E8=AE=BE=E6=96=B9=E6=A1=88?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java | 3 ++- .../main/java/com/hz/pm/api/user/controller/UserAuthController.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java index 71c2a49..7ccad5e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java @@ -18,6 +18,7 @@ import com.hz.pm.api.common.enumeration.CommonEnum; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.common.model.entity.ExcelExportWriter; import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.util.BizUtils; import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.datascope.model.DataScopeDTO; import com.hz.pm.api.datascope.utils.DataScopeUtil; @@ -164,7 +165,7 @@ public class AnnualPlanLibManage { project.setApprovedFile(String.valueOf(req.getApprovedFileId())); project.setBuildCycle(String.valueOf(req.getBuildCycle())); project.setOriginBuildCycle(req.getBuildCycle()); - project.setApprovedConstructionPlanFile(String.valueOf(req.getBuildPlanFileId())); + BizUtils.notNull(req.getBuildPlanFileId(),w -> project.setApprovedConstructionPlanFile(String.valueOf(w))); project.setApprovalDate(req.getApprovedDate()); project.setPlanAcceptanceTime(planAcceptanceTime); project.setOriginPlanAcceptanceTime(planAcceptanceTime); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java index 8997b49..b57aeef 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java @@ -96,7 +96,7 @@ public class UserAuthController { @ApiOperation(value = "代登陆") @WebLog("代登录(代理接口)") public void proxyAuthCodeLogin(@RequestParam(value = "userId") Long userId, - @RequestParam(value = "username") String username, + @RequestParam(value = "userName") String username, @RequestParam(value = "timestamp") long timestamp, @RequestParam(value = "sign") String sign, HttpServletRequest request, From b126b9c9877cebed8a10ae57a5ab47e1e15cfae9 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 4 Jan 2024 19:56:18 +0800 Subject: [PATCH 07/44] =?UTF-8?q?=E6=98=AF=E5=90=A6=E6=98=AF=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E9=A1=B9=E7=9B=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/projectlib/manage/AnnualPlanLibManage.java | 8 +- .../pm/api/projectlib/manage/ProjectLibManage.java | 278 ++++++++++----------- .../model/entity/ProjectStatusChange.java | 2 +- .../pm/api/projectlib/service/IProjectService.java | 13 +- .../pm/api/todocenter/manage/TodoCenterManage.java | 23 +- 5 files changed, 144 insertions(+), 180 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java index 7ccad5e..fc13877 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java @@ -10,7 +10,6 @@ import cn.hutool.poi.excel.ExcelUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; 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.hz.pm.api.common.model.constant.CommonConst; @@ -165,7 +164,7 @@ public class AnnualPlanLibManage { project.setApprovedFile(String.valueOf(req.getApprovedFileId())); project.setBuildCycle(String.valueOf(req.getBuildCycle())); project.setOriginBuildCycle(req.getBuildCycle()); - BizUtils.notNull(req.getBuildPlanFileId(),w -> project.setApprovedConstructionPlanFile(String.valueOf(w))); + BizUtils.notNull(req.getBuildPlanFileId(), w -> project.setApprovedConstructionPlanFile(String.valueOf(w))); project.setApprovalDate(req.getApprovedDate()); project.setPlanAcceptanceTime(planAcceptanceTime); project.setOriginPlanAcceptanceTime(planAcceptanceTime); @@ -177,10 +176,7 @@ public class AnnualPlanLibManage { if (projectService.save(project)) { applicationService.saveApplication(project, oldProject, Boolean.TRUE); // 将旧的项目版本置为不是最新 - projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest, Boolean.FALSE) - .ne(Project::getId, project.getId()) - .eq(Project::getProjectCode, project.getProjectCode())); + projectService.reverseNewest(project.getProjectCode(), project.getId()); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java index b3e1e49..b4e3548 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java @@ -160,12 +160,12 @@ public class ProjectLibManage { List projectCodes = page.getRecords().stream() .map(Project::getProjectCode).collect(Collectors.toList()); - Map> renewalMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(projectCodes)){ + Map> renewalMap = Maps.newHashMap(); + if (CollUtil.isNotEmpty(projectCodes)) { List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) - .eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE) + .eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId)); } @@ -189,13 +189,13 @@ public class ProjectLibManage { item.setProcessStatus(w.getProcessStatus()); item.setInstCode(w.getInstCode()); item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - if(finalRenewalMap.containsKey(item.getId())){ + if (finalRenewalMap.containsKey(item.getId())) { List prfs = finalRenewalMap.get(item.getId()); - item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(),prfs)); - item.setAnnualAccumulateAmountList(convertAccmulate(w,prfs)); - }else{ + item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), prfs)); + item.setAnnualAccumulateAmountList(convertAccmulate(w, prfs)); + } else { item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); - item.setAnnualAccumulateAmountList(convertAccmulate(w,Collections.emptyList())); + item.setAnnualAccumulateAmountList(convertAccmulate(w, Collections.emptyList())); } return item; }); @@ -218,27 +218,27 @@ public class ProjectLibManage { .map(Project::getProjectCode).collect(Collectors.toSet()); List pts = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) .in(ProjectTag::getProjectCode, projectCodes)); - Map> tagMap = Maps.newHashMap(); - Map tagNameMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(pts)){ + Map> tagMap = Maps.newHashMap(); + Map tagNameMap = Maps.newHashMap(); + if (CollUtil.isNotEmpty(pts)) { tagMap = pts.stream().collect(Collectors.groupingBy(ProjectTag::getProjectCode)); Set tagIds = pts.stream().map(ProjectTag::getTagId).collect(Collectors.toSet()); List tags = tagService.list(Wrappers.lambdaQuery(Tag.class) .in(Tag::getId, tagIds)); - if(CollUtil.isNotEmpty(tags)){ - tagNameMap = tags.stream().collect(Collectors.toMap(Tag::getId,Tag::getName)); + if (CollUtil.isNotEmpty(tags)) { + tagNameMap = tags.stream().collect(Collectors.toMap(Tag::getId, Tag::getName)); } } Map> finalTagMap = tagMap; - Map finalTagNameMap = tagNameMap; + Map finalTagNameMap = tagNameMap; - Map> renewalMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(projectCodes)){ + Map> renewalMap = Maps.newHashMap(); + if (CollUtil.isNotEmpty(projectCodes)) { List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) - .eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE) + .eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId)); } @@ -271,14 +271,14 @@ public class ProjectLibManage { item.setApprovedAmount(w.getApprovalAmount()); item.setAnnualPlanAmount(w.getAnnualPlanAmount()); item.setPrePlanProjectId(w.getPrePlanProjectId()); - setTag(item,finalTagMap,finalTagNameMap); - if(finalRenewalMap.containsKey(item.getId())){ + setTag(item, finalTagMap, finalTagNameMap); + if (finalRenewalMap.containsKey(item.getId())) { List prfs = finalRenewalMap.get(item.getId()); - item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(),prfs)); - item.setAnnualAccumulateAmountList(convertAccmulate(w,prfs)); - }else{ + item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), prfs)); + item.setAnnualAccumulateAmountList(convertAccmulate(w, prfs)); + } else { item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); - item.setAnnualAccumulateAmountList(convertAccmulate(w,Collections.emptyList())); + item.setAnnualAccumulateAmountList(convertAccmulate(w, Collections.emptyList())); } return item; }); @@ -287,6 +287,7 @@ public class ProjectLibManage { /** * 项目列表带当前审批人(工作流的) + * * @param req * @param user * @return @@ -311,15 +312,15 @@ public class ProjectLibManage { .asc() .list(); Map> map = Maps.newHashMap(); - Map userMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(tasks)){ + Map userMap = Maps.newHashMap(); + if (CollUtil.isNotEmpty(tasks)) { map = tasks.stream() .collect(Collectors.groupingBy(Task::getProcessInstanceId)); - userMap = searchUser(tasks,userInfoHelper); + userMap = searchUser(tasks, userInfoHelper); } List records = Lists.newArrayList(); - for(Project w : page.getRecords()){ + for (Project w : page.getRecords()) { ProjectLibListItemVO item = new ProjectLibListItemVO(); item.setId(w.getId()); item.setProjectName(w.getProjectName()); @@ -337,7 +338,7 @@ public class ProjectLibManage { item.setProcessStatus(w.getProcessStatus()); item.setInstCode(w.getInstCode()); item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - item.setApproveUsers(buildApproveUsers(w.getInstCode(),map,userMap)); + 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()) @@ -354,7 +355,7 @@ public class ProjectLibManage { private List buildApproveUsers(String instCode, Map> map, Map userMap) { - if(map.containsKey(instCode)){ + if (map.containsKey(instCode)) { List tasks = map.get(instCode); return tasks.stream().map(task -> userMap.get(task.getAssignee())) .filter(Objects::nonNull).collect(Collectors.toList()); @@ -363,27 +364,28 @@ public class ProjectLibManage { } private Map searchUser(List tasks, UserInfoHelper userInfoHelper) { - if(CollUtil.isEmpty(tasks)){ + if (CollUtil.isEmpty(tasks)) { return Collections.emptyMap(); } List users = userInfoHelper.getUserFullInfoByEmployeeCodes( tasks.stream().map(Task::getAssignee).collect(Collectors.toSet())); - if(CollUtil.isNotEmpty(users)){ + if (CollUtil.isNotEmpty(users)) { Set employeeSet = Sets.newHashSet(); return users.stream().filter(u -> employeeSet.add(u.getEmployeeCode())).collect(Collectors - .toMap(UserFullInfoDTO::getEmployeeCode,u -> u)); + .toMap(UserFullInfoDTO::getEmployeeCode, u -> u)); } return Collections.emptyMap(); } /** * 项目申报和项目归集的并集 + * * @param req * @param user * @return */ public PageVo projectAllListWithPermission(ProjectListReq req, UserFullInfoDTO user) { - req = buildProjectLibPermission(req,user); + req = buildProjectLibPermission(req, user); Page page = projectService.pageAllWithPermission(req.page(), req); long total; if (CollUtil.isEmpty(page.getRecords())) { @@ -397,26 +399,26 @@ public class ProjectLibManage { List pts = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) .in(ProjectTag::getProjectCode, projectCodes)); - Map> tagMap = Maps.newHashMap(); - Map tagNameMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(pts)){ + Map> tagMap = Maps.newHashMap(); + Map tagNameMap = Maps.newHashMap(); + if (CollUtil.isNotEmpty(pts)) { tagMap = pts.stream().collect(Collectors.groupingBy(ProjectTag::getProjectCode)); Set tagIds = pts.stream().map(ProjectTag::getTagId).collect(Collectors.toSet()); List tags = tagService.list(Wrappers.lambdaQuery(Tag.class) .in(Tag::getId, tagIds)); - if(CollUtil.isNotEmpty(tags)){ - tagNameMap = tags.stream().collect(Collectors.toMap(Tag::getId,Tag::getName)); + if (CollUtil.isNotEmpty(tags)) { + tagNameMap = tags.stream().collect(Collectors.toMap(Tag::getId, Tag::getName)); } } Map> finalTagMap = tagMap; - Map finalTagNameMap = tagNameMap; + Map finalTagNameMap = tagNameMap; - Map> renewalMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(projectCodes)){ + Map> renewalMap = Maps.newHashMap(); + if (CollUtil.isNotEmpty(projectCodes)) { List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) - .eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE) + .eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId)); } @@ -450,14 +452,14 @@ public class ProjectLibManage { item.setApprovedAmount(w.getApprovalAmount()); item.setAnnualPlanAmount(w.getAnnualPlanAmount()); item.setPrePlanProjectId(w.getPrePlanProjectId()); - setTag(item,finalTagMap,finalTagNameMap); - if(finalRenewalMap.containsKey(item.getId())){ + setTag(item, finalTagMap, finalTagNameMap); + if (finalRenewalMap.containsKey(item.getId())) { List prfs = finalRenewalMap.get(item.getId()); - item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(),prfs)); - item.setAnnualAccumulateAmountList(convertAccmulate(w,prfs)); - }else{ + item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), prfs)); + item.setAnnualAccumulateAmountList(convertAccmulate(w, prfs)); + } else { item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); - item.setAnnualAccumulateAmountList(convertAccmulate(w,Collections.emptyList())); + item.setAnnualAccumulateAmountList(convertAccmulate(w, Collections.emptyList())); } return item; }); @@ -465,7 +467,7 @@ public class ProjectLibManage { } public PageVo libListWithPermission(ProjectListReq req, UserFullInfoDTO user) { - req = buildProjectLibPermission(req,user); + req = buildProjectLibPermission(req, user); Page page = projectService.pagelibWithPermission(req.page(), req); long total; if (CollUtil.isEmpty(page.getRecords())) { @@ -479,26 +481,26 @@ public class ProjectLibManage { List pts = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) .in(ProjectTag::getProjectCode, projectCodes)); - Map> tagMap = Maps.newHashMap(); - Map tagNameMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(pts)){ + Map> tagMap = Maps.newHashMap(); + Map tagNameMap = Maps.newHashMap(); + if (CollUtil.isNotEmpty(pts)) { tagMap = pts.stream().collect(Collectors.groupingBy(ProjectTag::getProjectCode)); Set tagIds = pts.stream().map(ProjectTag::getTagId).collect(Collectors.toSet()); List tags = tagService.list(Wrappers.lambdaQuery(Tag.class) .in(Tag::getId, tagIds)); - if(CollUtil.isNotEmpty(tags)){ - tagNameMap = tags.stream().collect(Collectors.toMap(Tag::getId,Tag::getName)); + if (CollUtil.isNotEmpty(tags)) { + tagNameMap = tags.stream().collect(Collectors.toMap(Tag::getId, Tag::getName)); } } Map> finalTagMap = tagMap; - Map finalTagNameMap = tagNameMap; + Map finalTagNameMap = tagNameMap; - Map> renewalMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(projectCodes)){ + Map> renewalMap = Maps.newHashMap(); + if (CollUtil.isNotEmpty(projectCodes)) { List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) - .eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE) + .eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId)); } @@ -532,14 +534,14 @@ public class ProjectLibManage { item.setApprovedAmount(w.getApprovalAmount()); item.setAnnualPlanAmount(w.getAnnualPlanAmount()); item.setPrePlanProjectId(w.getPrePlanProjectId()); - setTag(item,finalTagMap,finalTagNameMap); - if(finalRenewalMap.containsKey(item.getId())){ + setTag(item, finalTagMap, finalTagNameMap); + if (finalRenewalMap.containsKey(item.getId())) { List prfs = finalRenewalMap.get(item.getId()); - item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(),prfs)); - item.setAnnualAccumulateAmountList(convertAccmulate(w,prfs)); - }else{ + item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), prfs)); + item.setAnnualAccumulateAmountList(convertAccmulate(w, prfs)); + } else { item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); - item.setAnnualAccumulateAmountList(convertAccmulate(w,Collections.emptyList())); + item.setAnnualAccumulateAmountList(convertAccmulate(w, Collections.emptyList())); } return item; }); @@ -548,7 +550,7 @@ public class ProjectLibManage { public PageVo listWithPermissionWorkbentch(ProjectListReq req, UserFullInfoDTO user) { - req = buildProjectLibPermission(req,user); + req = buildProjectLibPermission(req, user); Page page = projectService.pagelibWithPermission(req.page(), req); long total; if (CollUtil.isEmpty(page.getRecords())) { @@ -565,15 +567,15 @@ public class ProjectLibManage { .asc() .list(); Map> map = Maps.newHashMap(); - Map userMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(tasks)){ + Map userMap = Maps.newHashMap(); + if (CollUtil.isNotEmpty(tasks)) { map = tasks.stream() .collect(Collectors.groupingBy(Task::getProcessInstanceId)); - userMap = searchUser(tasks,userInfoHelper); + userMap = searchUser(tasks, userInfoHelper); } List records = Lists.newArrayList(); - for(ProjectPO w : page.getRecords()){ + for (ProjectPO w : page.getRecords()) { ProjectLibListItemVO item = new ProjectLibListItemVO(); item.setId(w.getId()); item.setProjectName(w.getProjectName()); @@ -591,7 +593,7 @@ public class ProjectLibManage { item.setProcessStatus(w.getProcessStatus()); item.setInstCode(w.getInstCode()); item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - item.setApproveUsers(buildApproveUsers(w.getInstCode(),map,userMap)); + 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()) @@ -606,22 +608,22 @@ public class ProjectLibManage { return PageVo.of(records, page.getTotal()); } - public static BigDecimal computeAmount(BigDecimal cuurentAmount,List prfs) { + public static BigDecimal computeAmount(BigDecimal cuurentAmount, List prfs) { BigDecimal res = Objects.isNull(cuurentAmount) ? BigDecimal.ZERO : cuurentAmount; - for(ProjectRenewalFundDeclaration prf : prfs){ + for (ProjectRenewalFundDeclaration prf : prfs) { res = res.add(prf.getAnnualPaymentAmount()); } return res; } - public static List convertAccmulate(ProjectPO project,List prfs) { + public static List convertAccmulate(ProjectPO project, List prfs) { List annualAmounts = Lists.newArrayList(); annualAmounts.add(AnnualAmountVO.builder() .projectId(project.getId()) .projectYear(project.getProjectYear()) .annualAmount(project.getAnnualPlanAmount()) .build()); - for(ProjectRenewalFundDeclaration prf : prfs){ + for (ProjectRenewalFundDeclaration prf : prfs) { annualAmounts.add(AnnualAmountVO.builder() .projectId(prf.getProjectId()) .projectYear(prf.getProjectYear()) @@ -631,14 +633,14 @@ public class ProjectLibManage { return annualAmounts; } - public static List convertAccmulate(Project project,List prfs) { + public static List convertAccmulate(Project project, List prfs) { List annualAmounts = Lists.newArrayList(); annualAmounts.add(AnnualAmountVO.builder() .projectId(project.getId()) .projectYear(project.getProjectYear()) .annualAmount(project.getAnnualPlanAmount()) .build()); - for(ProjectRenewalFundDeclaration prf : prfs){ + for (ProjectRenewalFundDeclaration prf : prfs) { annualAmounts.add(AnnualAmountVO.builder() .projectId(prf.getProjectId()) .projectYear(prf.getProjectYear()) @@ -649,11 +651,11 @@ public class ProjectLibManage { } private void setTag(ProjectLibListItemVO item, Map> finalTagMap, Map finalTagNameMap) { - if(finalTagMap.containsKey(item.getProjectCode())){ + if (finalTagMap.containsKey(item.getProjectCode())) { List tags = Lists.newArrayList(); List projectTags = finalTagMap.get(item.getProjectCode()); - for(ProjectTag pt :projectTags){ - if(finalTagNameMap.containsKey(pt.getTagId())){ + for (ProjectTag pt : projectTags) { + if (finalTagNameMap.containsKey(pt.getTagId())) { TagVO vo = new TagVO(); vo.setId(pt.getTagId()); vo.setName(finalTagNameMap.get(pt.getTagId())); @@ -721,14 +723,14 @@ public class ProjectLibManage { List applicationIds = applications.stream().map(ProjectApplication::getId).collect(Collectors.toList()); //核心业务 - if(CollUtil.isNotEmpty(applicationIds)){ + if (CollUtil.isNotEmpty(applicationIds)) { List coreBizs = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) .in(ProjectCoreBusinessIndicators::getApplicationId, applicationIds)); - Map> coreBizMap = coreBizs.stream().collect(Collectors.groupingBy(ProjectCoreBusinessIndicators::getApplicationId)); + Map> coreBizMap = coreBizs.stream().collect(Collectors.groupingBy(ProjectCoreBusinessIndicators::getApplicationId)); Optional.ofNullable(applications).ifPresent(apps -> vo.setProjectApplications(CollUtils.convert(apps, - app -> ProjectHelper.convertVOWithMap(app,coreBizMap)) + app -> ProjectHelper.convertVOWithMap(app, coreBizMap)) )); } @@ -769,7 +771,7 @@ public class ProjectLibManage { //查询风险监测 List ssq = supplierSafetyQualificationService.list(Wrappers.lambdaQuery(SupplierSafetyQualification.class) .eq(SupplierSafetyQualification::getProjectCode, projectInfo.getProjectCode())); - if(CollUtil.isNotEmpty(ssq)){ + if (CollUtil.isNotEmpty(ssq)) { safetyVo.setSupplierSafetyQualification(ssq.stream() .map(s -> BeanUtil.copyProperties(s, SupplierSafetyQualificationVO.class)) .collect(Collectors.toList())); @@ -777,8 +779,8 @@ public class ProjectLibManage { vo.setSafetyInfo(safetyVo); List psi = personSafetyInfoService.list(Wrappers.lambdaQuery(PersonSafetyInfo.class) - .eq(PersonSafetyInfo::getProjectCode, projectInfo.getProjectCode())); - if(CollUtil.isNotEmpty(psi)){ + .eq(PersonSafetyInfo::getProjectCode, projectInfo.getProjectCode())); + if (CollUtil.isNotEmpty(psi)) { safetyVo.setPersonSafetyInfo(psi.stream() .map(p -> BeanUtil.copyProperties(p, PersonSafetyInfoVO.class)) .collect(Collectors.toList())); @@ -804,7 +806,7 @@ public class ProjectLibManage { List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) .eq(ProjectRenewalFundDeclaration::getProjectId, vo.getId()) .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) - .eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE) + .eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); Optional.ofNullable(renewalDeclarations).ifPresent(declarations -> declarations.forEach(declaration -> { @@ -831,7 +833,7 @@ public class ProjectLibManage { ExpertReview finalReview = expertReviewService.getFinalReview(projectInfo.getProjectCode(), ReviewTemplateTypeEnum.CONSTRUCTION_SCHEME_REVIEW.getCode()); - if(Objects.nonNull(finalReview)){ + if (Objects.nonNull(finalReview)) { vo.setProposeAttach(finalReview.getOtherAdvice()); vo.setBaseReviewResults(finalReview.getReviewResult()); } @@ -849,7 +851,7 @@ public class ProjectLibManage { */ public Project saveProjectInDeclared(ProjectDTO projectDto, String instanceId, String employeeCode) { - Project project = saveProjectNewVersion(projectDto, instanceId, employeeCode,Boolean.FALSE); + Project project = saveProjectNewVersion(projectDto, instanceId, employeeCode, Boolean.FALSE); //保存项目和实例的关系 ProjectInst projectInst = new ProjectInst(); projectInst.setProjectId(project.getId()); @@ -901,7 +903,7 @@ public class ProjectLibManage { * @return */ public Project saveProjectNewVersion(ProjectDTO projectDto, String instanceId, - String employeeCode,Boolean isContruct) { + String employeeCode, Boolean isContruct) { //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 try { Project project = new Project(); @@ -916,12 +918,12 @@ public class ProjectLibManage { project.setSponsor(employeeCode); String projectCode = generateProjectCodeUtil.generateProjectCode(projectDto); project.setProjectCode(projectCode); - if(projectService.save(project)){ - saveApplication(projectDto,project,null); + if (projectService.save(project)) { + saveApplication(projectDto, project, null); } } else { //否则是重新提交的 新生成一个新版本的项目 - project = newProjectWithVersion(projectDto,isContruct); + project = newProjectWithVersion(projectDto, isContruct); if (Objects.nonNull(project)) { project.setInstCode(instanceId); project.setSponsor(employeeCode); @@ -973,19 +975,15 @@ public class ProjectLibManage { } else { project.setPrePlanProjectId(oldProject.getId()); } - if(projectService.save(project)){ - saveApplication(projectDto,project,Boolean.TRUE); - + if (projectService.save(project)) { + saveApplication(projectDto, project, Boolean.TRUE); // 将旧的项目版本置为不是最新 - projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest, Boolean.FALSE) - .ne(Project::getId, project.getId()) - .eq(Project::getProjectCode, project.getProjectCode())); + projectService.reverseNewest(project.getProjectCode(), project.getId()); } } else { //否则是被驳回,重新提交的 新生成一个新版本的项目 - project = newProjectWithVersion(projectDto,Boolean.TRUE); + project = newProjectWithVersion(projectDto, Boolean.TRUE); if (Objects.nonNull(project)) { project.setInstCode(instanceId); project.setSponsor(employeeCode); @@ -1006,10 +1004,10 @@ public class ProjectLibManage { * @param projectDto * @return */ - public Project reSaveProjectNewVersion(ProjectDTO projectDto,Boolean isContruct) { + public Project reSaveProjectNewVersion(ProjectDTO projectDto, Boolean isContruct) { //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 try { - return newProjectWithVersion(projectDto,isContruct); + return newProjectWithVersion(projectDto, isContruct); } catch (Exception e) { log.error("项目信息入库错误 " + e); throw new BusinessException("项目信息入库错误 :" + e); @@ -1020,7 +1018,7 @@ public class ProjectLibManage { * 重新提交工作流时 舍弃在原有项目修改 * 新增一个新的项目 新的版本号 */ - public Project newProjectWithVersion(ProjectDTO projecDto,Boolean isContruct) { + public Project newProjectWithVersion(ProjectDTO projecDto, Boolean isContruct) { Project oldProject = projectService.getById(projecDto.getId()); Project project = new Project(); VUtils.isTrue(Objects.isNull(oldProject)) @@ -1039,13 +1037,8 @@ public class ProjectLibManage { oldProject.setIsBackReject(Boolean.TRUE); projectService.updateById(oldProject); - - projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest, Boolean.FALSE) - .ne(Project::getId, project.getId()) - .eq(Project::getProjectCode, project.getProjectCode())); - - saveApplication(projecDto,project,isContruct); + projectService.reverseNewest(project.getProjectCode(), project.getId()); + saveApplication(projecDto, project, isContruct); return project; } @@ -1076,19 +1069,14 @@ public class ProjectLibManage { projectService.updateById(oldProject); if (projectService.save(project)) { - projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest, Boolean.FALSE) - .ne(Project::getId, project.getId()) - .eq(Project::getProjectCode, project.getProjectCode())); - - //app - saveApplication(projecDto,project,isConstruct); + projectService.reverseNewest(project.getProjectCode(), project.getId()); + saveApplication(projecDto, project, isConstruct); } return project; } - public Project saveProjectWithVersion(ProjectDTO projecDto, String instanceId, Integer instType,Boolean isConstruct) { + public Project saveProjectWithVersion(ProjectDTO projecDto, String instanceId, Integer instType, Boolean isConstruct) { Project oldProject = projectService.getById(projecDto.getId()); Project project = new Project(); VUtils.isTrue(Objects.isNull(oldProject)) @@ -1113,13 +1101,10 @@ public class ProjectLibManage { projectInst.setInstType(instType); projectInstService.save(projectInst); - projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest, Boolean.FALSE) - .ne(Project::getId, project.getId()) - .eq(Project::getProjectCode, project.getProjectCode())); + projectService.reverseNewest(project.getProjectCode(), project.getId()); //app - saveApplication(projecDto,project,isConstruct); + saveApplication(projecDto, project, isConstruct); } return project; @@ -1147,18 +1132,15 @@ public class ProjectLibManage { projectInst.setInstType(instType); projectInstService.save(projectInst); - projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest, Boolean.FALSE) - .ne(Project::getId, project.getId()) - .eq(Project::getProjectCode, project.getProjectCode())); + projectService.reverseNewest(project.getProjectCode(), project.getId()); - saveApplication(project,oldProject,null); + saveApplication(project, oldProject, null); } return project; } - public Project saveProjectWithVersionAndPass(Project oldProject, String instanceId,ProjectDTO dto, Integer instType,Boolean isBackReject) { + public Project saveProjectWithVersionAndPass(Project oldProject, String instanceId, ProjectDTO dto, Integer instType, Boolean isBackReject) { Project project = new Project(); VUtils.isTrue(Objects.isNull(oldProject)) .throwMessage("项目不存在!"); @@ -1189,13 +1171,10 @@ public class ProjectLibManage { projectInst.setInstType(instType); projectInstService.save(projectInst); - projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest, Boolean.FALSE) - .ne(Project::getId, project.getId()) - .eq(Project::getProjectCode, project.getProjectCode())); + projectService.reverseNewest(project.getProjectCode(), project.getId()); //APP - saveApplication(project,oldProject,Boolean.TRUE); + saveApplication(project, oldProject, Boolean.TRUE); } return project; @@ -1229,14 +1208,10 @@ public class ProjectLibManage { projectInst.setInstType(instType); projectInstService.save(projectInst); - projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest, Boolean.FALSE) - .ne(Project::getId, project.getId()) - .eq(Project::getProjectCode, project.getProjectCode())); + projectService.reverseNewest(project.getProjectCode(), project.getId()); - saveApplication(project,oldProject,Boolean.TRUE); + saveApplication(project, oldProject, Boolean.TRUE); } - return project; } @@ -1379,7 +1354,7 @@ public class ProjectLibManage { return user; } - public ProjectListReq buildProjectLibPermission(ProjectListReq req,UserFullInfoDTO user) { + public ProjectListReq buildProjectLibPermission(ProjectListReq req, UserFullInfoDTO user) { Optional currentUserDataScope = DataScopeUtil.getCurrentUserDataScopeHasUserId(user); if (!currentUserDataScope.isPresent()) { log.warn("没有取到权限信息 当前查询 没有权限条件"); @@ -1553,8 +1528,8 @@ public class ProjectLibManage { //只查 当前版本 和历史被驳回|退回的版本 List historyProjects = projectService.list(Wrappers.lambdaQuery(Project.class) .eq(Project::getProjectCode, project.getProjectCode()) - .and(q1->q1.eq(Project::getNewest, Boolean.TRUE) - .or(q2->q2.eq(Project::getIsBackReject,Boolean.TRUE))) + .and(q1 -> q1.eq(Project::getNewest, Boolean.TRUE) + .or(q2 -> q2.eq(Project::getIsBackReject, Boolean.TRUE))) .orderByDesc(Project::getCreateOn)); if (CollUtil.isEmpty(historyProjects)) { @@ -1616,17 +1591,17 @@ public class ProjectLibManage { return res; } - public void saveApplication(Project project,Project oldProject,Boolean isConstruct) { + public void saveApplication(Project project, Project oldProject, Boolean isConstruct) { List apps = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) .eq(ProjectApplication::getProjectCode, oldProject.getProjectCode()) .eq(ProjectApplication::getProjectVersion, oldProject.getVersion())); - if(CollUtil.isNotEmpty(apps)){ + if (CollUtil.isNotEmpty(apps)) { apps.forEach(app -> { Long oldAppId = app.getId(); app.setProjectVersion(project.getVersion()); app.setProjectId(project.getId()); app.setId(null); - if(Objects.nonNull(isConstruct)){ + if (Objects.nonNull(isConstruct)) { app.setIsConstruct(isConstruct); } projectApplicationService.save(app); @@ -1634,7 +1609,7 @@ public class ProjectLibManage { //核心业务 List cores = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) .eq(ProjectCoreBusinessIndicators::getApplicationId, oldAppId)); - if(CollUtil.isNotEmpty(cores)){ + if (CollUtil.isNotEmpty(cores)) { cores.forEach(c -> { c.setId(null); c.setApplicationId(app.getId()); @@ -1645,7 +1620,7 @@ public class ProjectLibManage { } } - private void saveApplication(ProjectDTO projectDto,Project project,Boolean isConstruct) { + private void saveApplication(ProjectDTO projectDto, Project project, Boolean isConstruct) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); //保存项目应用 Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication()) @@ -1672,7 +1647,7 @@ public class ProjectLibManage { projectApplication.setBuildOrgName(finalProject.getBuildOrgName()); projectApplication.setProjectVersion(version); projectApplication.setIsConstruct(isConstruct); - if(StringUtils.isNotBlank(application.getRelatedExistsApplication())){ + if (StringUtils.isNotBlank(application.getRelatedExistsApplication())) { projectApplication.setApplicationName(null); } @@ -1680,7 +1655,7 @@ public class ProjectLibManage { // 保存应用关联的核心业务 List coreBusinessList = application.getCoreBusinessList(); Boolean hasCoreBusiness = CollUtil.isNotEmpty(coreBusinessList) ? Boolean.TRUE : Boolean.FALSE; - if (Boolean.TRUE.equals(result) && Boolean.TRUE.equals(hasCoreBusiness)){ + if (Boolean.TRUE.equals(result) && Boolean.TRUE.equals(hasCoreBusiness)) { for (ProjectCoreBusinessDTO coreBusiness : coreBusinessList) { ProjectCoreBusinessIndicators projectCoreBusinessIndicators = new ProjectCoreBusinessIndicators(); BeanUtils.copyProperties(coreBusiness, projectCoreBusinessIndicators); @@ -1697,11 +1672,12 @@ public class ProjectLibManage { /** * 申报项目转化为 项目归集 + * * @param projectCode * @return */ public GovBizProjectDetailVO convertToCollection(String projectCode) { ProjectDetailVO projectDetailVO = this.detailProjectCode(projectCode); - return ProjectConvertUtil.declaredToCollection(projectDetailVO,fileService); + return ProjectConvertUtil.declaredToCollection(projectDetailVO, fileService); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectStatusChange.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectStatusChange.java index b9154ba..517f6bb 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectStatusChange.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectStatusChange.java @@ -25,7 +25,7 @@ import lombok.NoArgsConstructor; @AllArgsConstructor @NoArgsConstructor @TableName("nd_project_status_change") -@ApiModel(value = "NdProjectStatusChange对象", description = "") +@ApiModel(value = "NdProjectStatusChange对象") public class ProjectStatusChange implements Serializable { private static final long serialVersionUID = 1L; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectService.java index 02f0bf3..a780642 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectService.java @@ -1,5 +1,7 @@ package com.hz.pm.api.projectlib.service; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.hz.pm.api.projectlib.model.entity.Project; import com.baomidou.mybatisplus.extension.service.IService; @@ -10,7 +12,7 @@ import java.util.List; /** *

- * 服务类 + * 服务类 *

* * @author WendyYang @@ -32,4 +34,13 @@ public interface IProjectService extends IService { Page pagelibWithPermission(Page page, ProjectListReq req); + default void reverseNewest(String projectCode, Long projectId) { + LambdaUpdateWrapper wrapper = Wrappers.lambdaUpdate(Project.class) + .set(Project::getNewest, Boolean.FALSE) + .eq(Project::getNewest, Boolean.TRUE) + .eq(Project::getProjectCode, projectCode) + .ne(Project::getId, projectId); + update(wrapper); + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java index 0d575a5..d9e9e35 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java @@ -726,7 +726,6 @@ public class TodoCenterManage { * * @param response 返回数据流 * @param param 请求参数 - * @return void * @author CMM * @since 2023/02/06 */ @@ -1174,13 +1173,10 @@ public class TodoCenterManage { newPi.setUpdateOn(LocalDateTime.now()); projectInstService.save(newPi); - projectService.update(Wrappers.lambdaUpdate(Project.class) - .set(Project::getNewest, Boolean.FALSE) - .ne(Project::getId, project.getId()) - .eq(Project::getProjectCode, project.getProjectCode())); + projectService.reverseNewest(project.getProjectCode(), project.getId()); //再修改应用信息 - Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && 1 == projectDto.getIncludeApplication() + boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && 1 == projectDto.getIncludeApplication() ? Boolean.TRUE : Boolean.FALSE; ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getInstCode, instCode)); Integer instType = projectInst.getInstType(); @@ -1192,9 +1188,6 @@ public class TodoCenterManage { .eq(ProjectApplication::getIsConstruct, Boolean.TRUE)); if (CollUtil.isNotEmpty(applicationList)) { projectApplicationService.removeBatchByIds(applicationList); - List applicationIds = applicationList.stream().map(ProjectApplication::getId).collect(Collectors.toList()); -// projectCoreBusinessIndicatorsService.remove(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) -// .in(ProjectCoreBusinessIndicators::getApplicationId, applicationIds)); } List applications = projectDto.getApplicationList(); @@ -1213,18 +1206,6 @@ public class TodoCenterManage { projectApplication.setIsConstruct(Boolean.TRUE); } projectApplication.setProjectVersion(project.getVersion()); - boolean result = projectApplicationService.save(projectApplication); -// // 保存应用关联的核心业务 -// List coreBusinessList = application.getCoreBusinessList(); -// Boolean hasCoreBusiness = CollUtil.isNotEmpty(coreBusinessList) ? Boolean.TRUE : Boolean.FALSE; -// if (Boolean.TRUE.equals(result) && Boolean.TRUE.equals(hasCoreBusiness)){ -// for (ProjectCoreBusinessDTO coreBusiness : coreBusinessList) { -// ProjectCoreBusinessIndicators projectCoreBusinessIndicators = new ProjectCoreBusinessIndicators(); -// BeanUtils.copyProperties(coreBusiness, projectCoreBusinessIndicators); -// projectCoreBusinessIndicators.setApplicationId(application.getId()); -// projectCoreBusinessIndicatorsService.save(projectCoreBusinessIndicators); -// } -// } } } return Boolean.TRUE; From 30eb95a407c371391b9b1d72c9ebf3de14a306e9 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Fri, 5 Jan 2024 10:51:58 +0800 Subject: [PATCH 08/44] =?UTF-8?q?=E6=B5=99=E6=94=BF=E9=92=89=E5=91=98?= =?UTF-8?q?=E5=B7=A5=E4=BF=A1=E6=81=AF=E6=9B=B4=E6=96=B0=E5=81=9C=E6=AD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/hz/pm/api/scheduler/task/BatchUpdateEmployeeTask.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/BatchUpdateEmployeeTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/BatchUpdateEmployeeTask.java index ae6e3d0..c8a227c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/BatchUpdateEmployeeTask.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/BatchUpdateEmployeeTask.java @@ -32,7 +32,7 @@ public class BatchUpdateEmployeeTask { private final EmployeeBatchGetTask employeeBatchGetTask; private final IDingOrganizationService organizationService; - @Scheduled(cron = "0 45 1 * * ?") + //@Scheduled(cron = "0 45 1 * * ?") public void doTask() throws UnknownHostException { if (!HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { return; From 232ae9a888d8738d72cbca12acd1d087e949af5d Mon Sep 17 00:00:00 2001 From: WendyYang Date: Fri, 5 Jan 2024 17:59:42 +0800 Subject: [PATCH 09/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=BC=94=E7=A4=BA?= =?UTF-8?q?=E5=BA=93=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hz-pm-api/src/main/resources/application-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hz-pm-api/src/main/resources/application-dev.yml b/hz-pm-api/src/main/resources/application-dev.yml index 3cb5ec2..59d0b5e 100644 --- a/hz-pm-api/src/main/resources/application-dev.yml +++ b/hz-pm-api/src/main/resources/application-dev.yml @@ -43,7 +43,7 @@ spring: datasource: type: com.zaxxer.hikari.HikariDataSource driverClassName: dm.jdbc.driver.DmDriver - url: jdbc:dm://47.98.125.47:5236/HZ_PROJECT_MANAGEMENT?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8 + url: jdbc:dm://47.98.125.47:5236/HZ_PROJECT_MANAGEMENT1?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8 username: SYSDBA password: SYSDBA # 数据源 From 8f48941ca0f4d64517f14f12fc7a7378fbc89cdc Mon Sep 17 00:00:00 2001 From: WendyYang Date: Mon, 8 Jan 2024 17:54:55 +0800 Subject: [PATCH 10/44] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pm/api/common/model/entity/MenuTreeEntity.java | 2 +- .../action/ProjectDeclareChoiceAction.java | 6 +- .../factory/ProjectDeclareGuardFactory.java | 4 +- .../statemachine/util/MachineBuilderFounder.java | 80 +++++------ .../common/statemachine/util/StateMachineUtil.java | 153 ++++++++++++++++++++ .../statemachine/util/StateMachineUtils.java | 160 --------------------- .../com/hz/pm/api/common/util/JwtTokenUtil.java | 91 ------------ .../java/com/hz/pm/api/common/util/MDCUtil.java | 3 + .../java/com/hz/pm/api/common/util/TreeUtil.java | 6 +- .../dashboard/manage/MeetingStatisticsManage.java | 5 +- .../model/vo/PerformanceStatisticsVO.java | 3 +- .../ExpertAdminExpertManageAssembler.java | 8 +- .../hz/pm/api/expert/assembler/TagAssembler.java | 29 ---- .../pm/api/expert/controller/ExpertController.java | 3 - .../api/expert/manage/ExpertMetaApplyManage.java | 1 - .../service/impl/ExpertAdminManageServiceImpl.java | 8 +- .../api/external/controller/MhSyncController.java | 1 - .../pm/api/external/model/dto/MhTechExpertDTO.java | 4 - .../api/filemanage/manage/ProjectFileManage.java | 3 +- .../model/entity/ProjectApplyBorrow.java | 2 +- .../pm/api/filemanage/model/vo/ProjectFileVO.java | 2 - .../hz/pm/api/gov/utils/ProjectConvertUtil.java | 2 +- .../hz/pm/api/irs/controller/IrsController.java | 5 +- .../api/irs/controller/IrsProjectController.java | 9 +- .../com/hz/pm/api/irs/manage/AppIrsManage.java | 6 +- .../com/hz/pm/api/irs/manage/IrsProjectManage.java | 5 +- .../com/hz/pm/api/leave/manage/LeaveManage.java | 3 - .../api/meeting/builder/YxtSmsContextBuilder.java | 129 ----------------- .../controller/MeetingExpertJudgeController.java | 2 - .../meeting/entity/domain/MeetingExpertJudge.java | 1 - .../api/meeting/entity/dto/ExpertIdFilterDTO.java | 1 - .../api/meeting/entity/vo/MeetingByManagerVO.java | 2 - .../pm/api/meeting/helper/MeetingManageHelper.java | 1 - .../pm/api/meeting/helper/YxtCallOrSmsHelper.java | 8 +- .../hz/pm/api/meta/assembler/MetaTagAssembler.java | 37 +++-- .../api/meta/helper/basic/AbstractTagsCache.java | 4 +- .../java/com/hz/pm/api/meta/manage/MetaManage.java | 16 +-- .../service/impl/MetaDictionaryServiceImpl.java | 7 +- .../api/meta/service/impl/MetaTagServiceImpl.java | 7 +- .../organization/manage/OrganizationManage.java | 4 +- .../model/vo/OrganizationSynthesizeTreeVO.java | 3 - .../organization/model/vo/OrganizationTreeVO.java | 2 +- .../convert/PerformanceAppraisalConveter.java | 7 +- .../performance/manage/OrgSelfAppraisalManage.java | 2 +- .../mapper/PerformanceAppraisalMapper.java | 1 - .../mapper/PerformanceAppraisalProjectMapper.java | 1 - .../model/dto/PerformanceAppraisalEditDTO.java | 3 - .../PerformanceAppraisalProjectGroupSaveDTO.java | 4 - .../dto/PerformanceIndicatorAppIndexSaveDTO.java | 13 +- .../PerformanceIndicatorProjectIndexSaveDTO.java | 8 +- .../model/entity/PerformanceAppraisalProject.java | 1 - .../PerformanceIndicatorProjectTemplate.java | 2 - .../model/vo/ProjectIndexTemplateVO.java | 1 - .../api/performance/model/vo/ProjectIndexVO.java | 11 +- .../pm/api/performance/util/ContentTypeUtils.java | 1 - .../projectdeclared/manage/ConstructionManage.java | 8 +- .../manage/ConstructionPlanManage.java | 12 +- .../projectdeclared/manage/DelayedApplyManage.java | 49 ++++--- .../projectdeclared/manage/OperationManage.java | 6 +- .../PrequalificationDeclaredProjectManage.java | 6 +- .../manage/ProjectAdjustmentManage.java | 63 ++++---- .../api/projectdeclared/manage/PurchaseManage.java | 6 +- .../projectdeclared/model/dto/OperationDTO.java | 3 - .../model/dto/PaymentPlanSupplementDTO.java | 2 - .../model/dto/PreInsAcceptancePersonSaveDTO.java | 3 - .../projectdeclared/model/dto/PreInsSaveDTO.java | 3 - .../model/dto/ProjectDraftSaveDTO.java | 2 +- .../projectdeclared/model/entity/PaymentPlan.java | 5 +- .../model/entity/PreInsAcceptancePerson.java | 1 - .../model/vo/PreInsAcceptancePersonVO.java | 3 - .../pm/api/projectdeclared/model/vo/PreInsVO.java | 5 - .../utils/ReStartProcessMapUtil.java | 58 -------- .../utils/RestartProcessMapUtil.java | 51 +++++++ .../pm/api/projectlib/handle/AnnualPlanHandle.java | 34 +++-- .../handle/ProcessExecuteChainHandle.java | 4 +- .../api/projectlib/manage/AnnualPlanLibManage.java | 4 +- .../pm/api/projectlib/manage/ProjectLibManage.java | 80 +++++------ .../manage/ProjectRenewalFundManage.java | 39 +++-- .../model/po/ProjectRenewalFundDeclarationPO.java | 3 - .../model/req/ProjectRenewalAuditReq.java | 2 - .../service/INdProjectStatusChangeService.java | 4 + .../impl/NdProjectStatusChangeServiceImpl.java | 12 ++ .../hz/pm/api/provincial/model/res/OssApiData.java | 2 - .../api/provincial/model/res/OssApiResponse.java | 2 +- .../api/scheduler/listener/ProcessEndListener.java | 6 +- .../scheduler/listener/ProcessStartListener.java | 6 +- .../task/CheckProvincialReviewResultTask.java | 6 +- .../api/scheduler/task/ProjectStatusFlowTask.java | 50 +++---- .../staging/utils/ProjectStatusFlowMapUtil.java | 29 ++-- .../api/staging/utils/WorkNoticeFlowMapUtil.java | 8 +- .../com/hz/pm/api/sys/mapper/NotifyMapper.java | 1 - .../sys/model/dto/MeetingReviewMsgExtraDTO.java | 5 + .../com/hz/pm/api/sys/model/dto/MenuSaveDTO.java | 1 - .../java/com/hz/pm/api/sys/model/entity/Menu.java | 2 +- .../com/hz/pm/api/sys/model/vo/MenuRoleVO.java | 2 +- .../pm/api/todocenter/enumeration/IsOrNotEnum.java | 13 +- .../hz/pm/api/todocenter/manage/HandlerManage.java | 142 +++++++++--------- .../hz/pm/api/todocenter/service/ITodoService.java | 2 +- .../todocenter/service/impl/TodoServiceImpl.java | 6 +- .../com/hz/pm/api/todocenter/utils/PdfUtils.java | 22 ++- .../java/com/hz/pm/api/user/entity/MhUnit.java | 6 +- .../workbench/converter/WorkbenchConverter.java | 5 - .../hz/pm/api/workbench/model/vo/WorkbenchVO.java | 3 +- .../hz/pm/api/sys/project/ProjectStateTest.java | 6 +- .../main/java/com/hz/pm/sync/SynDataTaskApp.java | 1 - .../pm/sync/open/manage/ProjectReceiveManage.java | 113 ++++++++------- 106 files changed, 700 insertions(+), 1090 deletions(-) create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtil.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtils.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/util/JwtTokenUtil.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/TagAssembler.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/meeting/builder/YxtSmsContextBuilder.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/ReStartProcessMapUtil.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/RestartProcessMapUtil.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/MenuTreeEntity.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/MenuTreeEntity.java index 2209dab..aceb4cd 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/MenuTreeEntity.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/entity/MenuTreeEntity.java @@ -29,7 +29,7 @@ import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; @Setter @Accessors(chain = true) @ToString(callSuper = true) -public class MenuTreeEntity { +public class MenuTreeEntity { @TableId(value = "id", type = IdType.AUTO) protected Long id; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java index 254a69f..b5eff58 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java @@ -4,7 +4,7 @@ import cn.hutool.core.collection.CollUtil; import com.hz.pm.api.common.model.constant.ProjectDeclareConst; import com.hz.pm.api.common.model.constant.StateMachineConst; import com.hz.pm.api.common.enumeration.CommonEnum; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.model.entity.Project; @@ -75,7 +75,7 @@ public class ProjectDeclareChoiceAction implements Action stateContext) { Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); log.info("预审申报事件之前,项目的状态为:{}"+project.getStatus()); - if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project, + if (StateMachineUtil.isCityProject(project) && StateMachineUtil.judgeDeclareAmount(project, ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)){ project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()); }else { @@ -86,7 +86,7 @@ public class ProjectDeclareChoiceAction implements Action stateContext) { Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); log.info("预审中撤回事件之前,项目的状态为:{}"+project.getStatus()); - if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project, + if (StateMachineUtil.isCityProject(project) && StateMachineUtil.judgeDeclareAmount(project, ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)){ project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); }else { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java index 0de73d1..6e879df 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java @@ -4,7 +4,7 @@ import cn.hutool.core.collection.CollUtil; import com.hz.pm.api.common.model.constant.ProjectDeclareConst; import com.hz.pm.api.common.model.constant.StateMachineConst; import com.hz.pm.api.common.enumeration.CommonEnum; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.model.entity.Project; @@ -31,7 +31,7 @@ public class ProjectDeclareGuardFactory { public boolean evaluate(StateContext context) { Project project = context.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); // 判断申报项目是否是市级项目,且申报金额是否大于等于1000万元 - if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project, + if (StateMachineUtil.isCityProject(project) && StateMachineUtil.judgeDeclareAmount(project, ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)){ return true; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/MachineBuilderFounder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/MachineBuilderFounder.java index 42aef82..433b0f8 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/MachineBuilderFounder.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/MachineBuilderFounder.java @@ -1,13 +1,13 @@ package com.hz.pm.api.common.statemachine.util; -import com.google.common.collect.Maps; import com.hz.pm.api.common.statemachine.builder.*; import com.hz.pm.api.common.statemachine.contant.RegionContant; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; +import java.util.HashMap; import java.util.Map; /** @@ -16,58 +16,42 @@ import java.util.Map; * @author CMM * @since 2023/02/07 15:56 */ -@Component @Slf4j +@Component +@RequiredArgsConstructor public class MachineBuilderFounder { - public final static Map machineBuilderMap = - Maps.newConcurrentMap(); - - @Autowired - private ProjectDeclareStateMachineSBJBuilder projectDeclareStateMachineSBJBuilder; - - @Autowired - private ProjectDeclareStateMachineLDBuilder projectDeclareStateMachineLDBuilder; - - @Autowired - private ProjectDeclareStateMachineQTBuilder projectDeclareStateMachineQTBuilder; - - @Autowired - private ProjectDeclareStateMachineJYBuilder projectDeclareStateMachineJYBuilder; - - @Autowired - private ProjectDeclareStateMachineSCBuilder projectDeclareStateMachineSCBuilder; + private static final Map MACHINE_BUILDER_MAP = new HashMap<>(16); - @Autowired - private ProjectDeclareStateMachineSYBuilder projectDeclareStateMachineSYBuilder; - - @Autowired - private ProjectDeclareStateMachineYHBuilder projectDeclareStateMachineYHBuilder; - - @Autowired - private ProjectDeclareStateMachineQYBuilder projectDeclareStateMachineQYBuilder; - - @Autowired - private ProjectDeclareStateMachineJNBuilder projectDeclareStateMachineJNBuilder; - - @Autowired - private ProjectDeclareStateMachineLQBuilder projectDeclareStateMachineLQBuilder; + public static ProjectDeclareStateMachineBuilder getByRegion(String regionCode) { + return MACHINE_BUILDER_MAP.get(regionCode); + } - @Autowired - private ProjectDeclareStateMachineKFQBuilder projectDeclareStateMachineKFQBuilder; + private final ProjectDeclareStateMachineSBJBuilder projectDeclareStateMachineSBJBuilder; + private final ProjectDeclareStateMachineLDBuilder projectDeclareStateMachineLDBuilder; + private final ProjectDeclareStateMachineQTBuilder projectDeclareStateMachineQTBuilder; + private final ProjectDeclareStateMachineJYBuilder projectDeclareStateMachineJYBuilder; + private final ProjectDeclareStateMachineSCBuilder projectDeclareStateMachineSCBuilder; + private final ProjectDeclareStateMachineSYBuilder projectDeclareStateMachineSYBuilder; + private final ProjectDeclareStateMachineYHBuilder projectDeclareStateMachineYHBuilder; + private final ProjectDeclareStateMachineQYBuilder projectDeclareStateMachineQYBuilder; + private final ProjectDeclareStateMachineJNBuilder projectDeclareStateMachineJNBuilder; + private final ProjectDeclareStateMachineLQBuilder projectDeclareStateMachineLQBuilder; + private final ProjectDeclareStateMachineKFQBuilder projectDeclareStateMachineKFQBuilder; @PostConstruct - public void MachineBuilderFounder(){ - machineBuilderMap.put(RegionContant.LS_SBJ_CODE, projectDeclareStateMachineSBJBuilder); - machineBuilderMap.put(RegionContant.LS_LD_CODE, projectDeclareStateMachineLDBuilder); - machineBuilderMap.put(RegionContant.LS_QT_CODE, projectDeclareStateMachineQTBuilder); - machineBuilderMap.put(RegionContant.LS_JY_CODE, projectDeclareStateMachineJYBuilder); - machineBuilderMap.put(RegionContant.LS_SC_CODE, projectDeclareStateMachineSCBuilder); - machineBuilderMap.put(RegionContant.LS_SY_CODE, projectDeclareStateMachineSYBuilder); - machineBuilderMap.put(RegionContant.LS_YH_CODE, projectDeclareStateMachineYHBuilder); - machineBuilderMap.put(RegionContant.LS_QY_CODE, projectDeclareStateMachineQYBuilder); - machineBuilderMap.put(RegionContant.LS_JN_CODE, projectDeclareStateMachineJNBuilder); - machineBuilderMap.put(RegionContant.LS_LQ_CODE, projectDeclareStateMachineLQBuilder); - machineBuilderMap.put(RegionContant.LS_KFQ_CODE, projectDeclareStateMachineKFQBuilder); + public void machineBuilderFounder(){ + MACHINE_BUILDER_MAP.put(RegionContant.LS_SBJ_CODE, projectDeclareStateMachineSBJBuilder); + MACHINE_BUILDER_MAP.put(RegionContant.LS_LD_CODE, projectDeclareStateMachineLDBuilder); + MACHINE_BUILDER_MAP.put(RegionContant.LS_QT_CODE, projectDeclareStateMachineQTBuilder); + MACHINE_BUILDER_MAP.put(RegionContant.LS_JY_CODE, projectDeclareStateMachineJYBuilder); + MACHINE_BUILDER_MAP.put(RegionContant.LS_SC_CODE, projectDeclareStateMachineSCBuilder); + MACHINE_BUILDER_MAP.put(RegionContant.LS_SY_CODE, projectDeclareStateMachineSYBuilder); + MACHINE_BUILDER_MAP.put(RegionContant.LS_YH_CODE, projectDeclareStateMachineYHBuilder); + MACHINE_BUILDER_MAP.put(RegionContant.LS_QY_CODE, projectDeclareStateMachineQYBuilder); + MACHINE_BUILDER_MAP.put(RegionContant.LS_JN_CODE, projectDeclareStateMachineJNBuilder); + MACHINE_BUILDER_MAP.put(RegionContant.LS_LQ_CODE, projectDeclareStateMachineLQBuilder); + MACHINE_BUILDER_MAP.put(RegionContant.LS_KFQ_CODE, projectDeclareStateMachineKFQBuilder); } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtil.java new file mode 100644 index 0000000..4965c52 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtil.java @@ -0,0 +1,153 @@ +package com.hz.pm.api.common.statemachine.util; + +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.function.VUtils; +import com.hz.pm.api.common.model.constant.RegionConst; +import com.hz.pm.api.common.model.constant.StateMachineConst; +import com.hz.pm.api.common.statemachine.builder.ProjectDeclareStateMachineBuilder; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; +import com.hz.pm.api.projectlib.service.IProjectApplicationService; +import com.wflow.exception.BusinessException; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.messaging.Message; +import org.springframework.messaging.support.MessageBuilder; +import org.springframework.statemachine.StateMachine; +import org.springframework.statemachine.persist.StateMachinePersister; +import org.springframework.stereotype.Component; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * 状态机工具类 + * + * @author CMM + * @since 2023/02/07 22:49 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class StateMachineUtil { + + private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; + + private static final String APPLICATION_DECLARE = StateMachineConst.APPLICATION_DECLARE; + + private final INdProjectStatusChangeService projectStatusChangeService; + + private final IProjectApplicationService projectApplicationService; + + //通过审核 + public void pass(Project project) { + try { + execute(project, getProjectStatusPassEvent(project.getStatus())); + } catch (Exception e) { + log.info("状态机 通过失败 :{}", e.getMessage()); + throw new BusinessException("状态机 通过失败: " + e); + } + } + + //拒绝 + public void reject(Project project) { + try { + execute(project, getProjectStatusRejectEvent(project.getStatus())); + } catch (Exception e) { + log.info("状态机 拒绝失败 :{}", e.getMessage()); + throw new BusinessException("状态机 拒绝失败: " + e); + } + } + + //撤回 + public void withDraw(Project project) { + try { + execute(project, getProjectStatusWithdrawEvent(project.getStatus())); + } catch (Exception e) { + log.info("状态机 撤回失败 :{}", e.getMessage()); + throw new BusinessException("状态机 撤回失败: " + e); + } + } + + public void execute(Project project, ProjectStatusChangeEvent event) throws Exception { + log.info("调用状态机前的项目状态为:{}", project.getStatus()); + // 将状态变更记录保存到项目状态变更表中 + ProjectStatusChange projectStatusChange = new ProjectStatusChange(); + projectStatusChange.setBeforeStatus(project.getStatus()); + + ProjectDeclareStateMachineBuilder builder = MachineBuilderFounder.getByRegion(project.getAreaCode()); + + VUtils.isTrue(Objects.isNull(builder)).throwMessage("状态机初始化失败!"); + //获取TO状态机 + StateMachine stateMachine = builder.build(); + Message message = MessageBuilder.withPayload(event) + .setHeader(PROJECT_DECLARE, project) + .setHeader(APPLICATION_DECLARE, projectApplicationService.getApplicationsByProject(project)) + .build(); + //初始化状态机 + StateMachinePersister projectDeclareStateMachinePersister = builder.getProjectPersister(); + projectDeclareStateMachinePersister.restore(stateMachine, project); + stateMachine.sendEvent(message); + projectStatusChange.setProjectId(project.getId()); + projectStatusChange.setAfterStatus(project.getStatus()); + projectStatusChange.setEvent(event.name()); + projectStatusChange.setCreateOn(LocalDateTime.now()); + projectStatusChange.setProjectCode(project.getProjectCode()); + // 插入项目状态变更表中 + projectStatusChangeService.save(projectStatusChange); + log.info("调用状态机后的项目状态为:{}", project.getStatus()); + } + + /** + * 判断项目申报金额是否大于1000万元 + * + * @param project \ + * @return boolean + * @since 2023/02/07 17:13 + */ + public static boolean judgeDeclareAmount(Project project, BigDecimal targetAmount) { + int flag = project.getDeclareAmount().compareTo(targetAmount); + return flag > 0 || flag == 0; + } + + /** + * 判断申报项目是否为市级项目 + * + * @param project \ + * @return boolean + * @since 2023/02/07 17:05 + */ + public static boolean isCityProject(Project project) { + String areaCode = project.getAreaCode(); + return areaCode.equals(RegionConst.RC_HZ); + } + + public ProjectStatusChangeEvent getProjectStatusPassEvent(Integer status) { + ProjectStatusChangeEvent event = ProjectStatusChangeEvent.getPassValueByCode(status); + if (Objects.isNull(event)) { + throw new BizException("该状态下没有对应的通过操作!"); + } + return event; + } + + public ProjectStatusChangeEvent getProjectStatusRejectEvent(Integer status) { + ProjectStatusChangeEvent event = ProjectStatusChangeEvent.getRejectValueByCode(status); + if (Objects.isNull(event)) { + throw new BizException("该状态下没有对应的驳回操作!"); + } + return event; + } + + public ProjectStatusChangeEvent getProjectStatusWithdrawEvent(Integer status) { + ProjectStatusChangeEvent event = ProjectStatusChangeEvent.getWithdrawValueByCode(status); + if (Objects.isNull(event)) { + throw new BizException("该状态下没有对应的撤回操作!"); + } + return event; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtils.java deleted file mode 100644 index 9e3f4b4..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtils.java +++ /dev/null @@ -1,160 +0,0 @@ -package com.hz.pm.api.common.statemachine.util; - -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.function.VUtils; -import com.hz.pm.api.common.model.constant.RegionConst; -import com.hz.pm.api.common.model.constant.StateMachineConst; -import com.hz.pm.api.common.statemachine.builder.ProjectDeclareStateMachineBuilder; -import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; -import com.hz.pm.api.projectlib.model.entity.Project; -import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; -import com.hz.pm.api.projectlib.service.IProjectApplicationService; -import com.wflow.exception.BusinessException; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.messaging.support.MessageBuilder; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.stereotype.Component; - -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.Objects; - -/** - * 状态机工具类 - * - * @author CMM - * @since 2023/02/07 22:49 - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class StateMachineUtils { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - private static final String APPLICATION_DECLARE = StateMachineConst.APPLICATION_DECLARE; - - private final INdProjectStatusChangeService projectStatusChangeService; - - private final IProjectApplicationService projectApplicationService; - - //通过审核 - public void pass(Project project) { - try{ - execute(project,getProjectStatusPassEvent(project.getStatus())); - }catch (Exception e){ - log.info("状态机 通过失败 :{}",e.getMessage()); - throw new BusinessException("状态机 通过失败: " + e); - } - } - - //拒绝 - public void reject(Project project) { - try{ - execute(project,getProjectStatusRejectEvent(project.getStatus())); - }catch (Exception e){ - log.info("状态机 拒绝失败 :{}",e.getMessage()); - throw new BusinessException("状态机 拒绝失败: " + e); - } - } - - //撤回 - public void withDraw(Project project) { - try{ - execute(project,getProjectStatusWithdrawEvent(project.getStatus())); - }catch (Exception e){ - log.info("状态机 撤回失败 :{}",e.getMessage()); - throw new BusinessException("状态机 撤回失败: " + e); - } - } - - public void execute(Project project, ProjectStatusChangeEvent event) throws Exception { - log.info("调用状态机前的项目状态为>>>>>>>>>>{}" + project.getStatus()); - // 将状态变更记录保存到项目状态变更表中 - ProjectStatusChange projectStatusChange = new ProjectStatusChange(); - projectStatusChange.setBeforeStatus(project.getStatus()); - - ProjectDeclareStateMachineBuilder builder = MachineBuilderFounder.machineBuilderMap.get(project.getAreaCode()); - - VUtils.isTrue(Objects.isNull(builder)).throwMessage("状态机初始化失败!"); - //获取TO状态机 - StateMachine stateMachine = builder.build(); - Message message = MessageBuilder.withPayload(event) - .setHeader(PROJECT_DECLARE, project) - .setHeader(APPLICATION_DECLARE,projectApplicationService.getApplicationsByProject(project)) - .build(); - //初始化状态机 - StateMachinePersister projectDeclareStateMachinePersister = builder.getProjectPersister(); - projectDeclareStateMachinePersister.restore(stateMachine, project); - stateMachine.sendEvent(message); - projectStatusChange.setProjectId(project.getId()); - projectStatusChange.setAfterStatus(project.getStatus()); - projectStatusChange.setEvent(event.name()); - projectStatusChange.setCreateOn(LocalDateTime.now()); - projectStatusChange.setProjectCode(project.getProjectCode()); - // 插入项目状态变更表中 - projectStatusChangeService.save(projectStatusChange); - log.info("调用状态机后的项目状态为>>>>>>>>>>{}" + project.getStatus()); - } - - /** - * 判断项目申报金额是否大于1000万元 - * - * @param project - * @return boolean - * @author CMM - * @since 2023/02/07 17:13 - */ - public static boolean judgeDeclareAmount(Project project, BigDecimal targetAmount) { - int flag = project.getDeclareAmount().compareTo(targetAmount); - if (flag > 0 || flag == 0) { - return true; - } - return false; - } - - /** - * 判断申报项目是否为市级项目 - * - * @param project - * @return boolean - * @author CMM - * @since 2023/02/07 17:05 - */ - public static boolean isCityProject(Project project) { - String areaCode = project.getAreaCode(); - if (areaCode.equals(RegionConst.RC_HZ)) { - return true; - } - return false; - } - - public ProjectStatusChangeEvent getProjectStatusPassEvent(Integer status) { - ProjectStatusChangeEvent event = ProjectStatusChangeEvent.getPassValueByCode(status); - if (Objects.isNull(event)) { - throw new BizException("该状态下没有对应的通过操作!"); - } - return event; - } - - public ProjectStatusChangeEvent getProjectStatusRejectEvent(Integer status) { - ProjectStatusChangeEvent event = ProjectStatusChangeEvent.getRejectValueByCode(status); - if (Objects.isNull(event)) { - throw new BizException("该状态下没有对应的驳回操作!"); - } - return event; - } - - public ProjectStatusChangeEvent getProjectStatusWithdrawEvent(Integer status) { - ProjectStatusChangeEvent event = ProjectStatusChangeEvent.getWithdrawValueByCode(status); - if (Objects.isNull(event)) { - throw new BizException("该状态下没有对应的撤回操作!"); - } - return event; - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/JwtTokenUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/JwtTokenUtil.java deleted file mode 100644 index 8aca60d..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/JwtTokenUtil.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.hz.pm.api.common.util; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.auth0.jwt.JWT; -import com.auth0.jwt.JWTVerifier; -import com.auth0.jwt.algorithms.Algorithm; -import com.hz.pm.api.common.model.ZwddTokenUser; -import org.apache.commons.lang3.StringUtils; - -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -/** - * @author liuxinxin - * @date 2023/5/4 下午2:34 - */ - -public class JwtTokenUtil { - - private static final String SECRET_KEY = "dbe1cc89019c4c7abd5085bf47a25fb0"; - - private static final String CLAIM_KEY = "content"; - - private static final Integer DEFAULT_EXPIRE_TIME = Integer.valueOf(86400); - - public static String createToken(ZwddTokenUser dingTokenUser) { - return createToken(dingTokenUser, DEFAULT_EXPIRE_TIME); - } - - public static String createToken(ZwddTokenUser dingTokenUser, Integer expireTime) { - if (dingTokenUser == null) { - throw new IllegalArgumentException(""); - } - if (dingTokenUser.getTenantId() == null) { - throw new IllegalArgumentException(""); - } - if (StringUtils.isEmpty(dingTokenUser.getEmployeeCode())) { - throw new IllegalArgumentException(""); - } - if (dingTokenUser.getTenantId() == null) { - throw new IllegalArgumentException(""); - } - return createToken(JSON.toJSONString(dingTokenUser), expireTime); - } - - private static String createToken(String content, Integer expireTime) { - if (StringUtils.isEmpty(content)) { - throw new IllegalArgumentException(""); - } - Map header = new HashMap<>(4); - header.put("alg", "HS256"); - header.put("typ", "JWT"); - Algorithm algorithm = Algorithm.HMAC256(SECRET_KEY); - return JWT.create() - .withHeader(header) - .withClaim("content", content) - .withIssuedAt(new Date()) - .withExpiresAt(new Date(System.currentTimeMillis() + (expireTime.intValue() * 1000))) - .sign(algorithm); - } - - public static boolean verifyToken(String token) { - if (StringUtils.isEmpty(token)) { - throw new IllegalArgumentException("token"); - } - Algorithm algorithm = Algorithm.HMAC256(SECRET_KEY); - JWTVerifier verifier = JWT.require(algorithm).build(); - verifier.verify(token); - return true; - } - - private static String parseJwtString(String token) { - if (StringUtils.isEmpty(token)) { - throw new IllegalArgumentException("token"); - } - Algorithm algorithm = Algorithm.HMAC256(SECRET_KEY); - JWTVerifier verifier = JWT.require(algorithm).build(); - return verifier.verify(token).getClaim("content").asString(); - } - - public static ZwddTokenUser parseJwt(String token) { - String dingUserJson = parseJwtString(token); - if (StringUtils.isEmpty(dingUserJson)) { - return null; - } - ZwddTokenUser dingTokenUser = (ZwddTokenUser) JSONObject.parseObject(dingUserJson, ZwddTokenUser.class); - return dingTokenUser; - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/MDCUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/MDCUtil.java index fa5eef7..c9368fe 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/MDCUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/MDCUtil.java @@ -12,6 +12,9 @@ import org.slf4j.MDC; **/ public class MDCUtil { + private MDCUtil() { + } + public static final String TRACE_ID = "traceId"; public static final String TRACE_ID_HEADER = "Trace-Id"; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/TreeUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/TreeUtil.java index 19b51dd..3fad758 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/TreeUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/TreeUtil.java @@ -46,7 +46,7 @@ public final class TreeUtil { * @param treeList 待转换的集合 * @return 树结构 */ - public static > List buildTree(List treeList) { + public static > List buildTree(List treeList) { if (CollUtil.isEmpty(treeList)) { return treeList; } @@ -71,7 +71,7 @@ public final class TreeUtil { return trees; } - private static > + private static > void foreachNodes(List treeList, List selfIdEqSelfParent) { nodeMap = Maps.newConcurrentMap(); for (E parent : treeList) { @@ -98,7 +98,7 @@ public final class TreeUtil { } } - private static > void foreachNodesWithTopMenu(List treeList) { + private static > void foreachNodesWithTopMenu(List treeList) { for (E parent : treeList) { Serializable id = parent.getId(); for (E children : treeList) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/MeetingStatisticsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/MeetingStatisticsManage.java index 7c2f5a2..17893a6 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/MeetingStatisticsManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/MeetingStatisticsManage.java @@ -136,10 +136,7 @@ public class MeetingStatisticsManage { data.setCode(region.getRegionCode()); data.setName(region.getRegionName()); //先求出 此区域会议 - List regionMeetingIds = meetings.stream().filter(m -> { - - return Boolean.FALSE; - }).map(Meeting::getId).collect(Collectors.toList()); + List regionMeetingIds = meetings.stream().filter(m -> Boolean.FALSE).map(Meeting::getId).collect(Collectors.toList()); List regionReviews = expertReviews.stream().filter(r -> { if (Objects.nonNull(r.getMeetingId()) && diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/PerformanceStatisticsVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/PerformanceStatisticsVO.java index 20207c3..0c6f0fa 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/PerformanceStatisticsVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/PerformanceStatisticsVO.java @@ -6,11 +6,10 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; -import java.math.BigDecimal; import java.util.List; @Data -@ApiModel(value = "绩效统计", description = "") +@ApiModel(value = "绩效统计") public class PerformanceStatisticsVO implements Serializable { private static final long serialVersionUID = 1L; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertAdminExpertManageAssembler.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertAdminExpertManageAssembler.java index bac253a..2afc411 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertAdminExpertManageAssembler.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertAdminExpertManageAssembler.java @@ -2,19 +2,17 @@ package com.hz.pm.api.expert.assembler; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; -import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.expert.model.DictFieldInfoDTO; -import com.hz.pm.api.expert.model.TagFieldInfo; import com.hz.pm.api.expert.model.dto.ExpertAdminExpertListDTO; import com.hz.pm.api.expert.model.vo.ExpertLibraryListItemVO; import com.hz.pm.api.meta.helper.DictionaryCache; -import com.hz.pm.api.meta.helper.impl.TagsCacheImpl; import com.hz.pm.api.meta.model.dto.DictionaryDTO; -import com.hz.pm.api.meta.model.dto.TagDTO; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; -import java.util.*; +import java.util.Collections; +import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/TagAssembler.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/TagAssembler.java deleted file mode 100644 index 590532e..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/TagAssembler.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.hz.pm.api.expert.assembler; - -import cn.hutool.core.collection.CollectionUtil; -import com.hz.pm.api.expert.model.TagFieldInfo; -import com.hz.pm.api.meta.model.entity.ExpertTag; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -/** - * @author liuxinxin - * @date 2022/7/25 下午4:30 - */ - -public class TagAssembler { - - public static List toTagFieldInfoList(List expertTagList) { - if (CollectionUtil.isEmpty(expertTagList)) { - return new ArrayList<>(); - } - return expertTagList.stream().map(r -> { - TagFieldInfo dictionaryFieldInfo = new TagFieldInfo(); - dictionaryFieldInfo.setTagFieldName(r.getExpertInfoField()); - dictionaryFieldInfo.setTagCode(r.getTagCode()); - return dictionaryFieldInfo; - }).collect(Collectors.toList()); - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ExpertController.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ExpertController.java index 453f877..7b12ace 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ExpertController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/controller/ExpertController.java @@ -16,12 +16,9 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; -import springfox.documentation.annotations.ApiIgnore; -import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import javax.validation.constraints.NotNull; -import java.io.IOException; /** *

diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertMetaApplyManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertMetaApplyManage.java index 678d0e4..9700554 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertMetaApplyManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertMetaApplyManage.java @@ -37,7 +37,6 @@ import com.hz.pm.api.meta.model.bo.RegionContainsBO; import com.hz.pm.api.meta.model.dto.DictionaryDTO; import com.hz.pm.api.meta.model.entity.ExpertDictionary; import com.hz.pm.api.meta.service.IExpertDictionaryService; -import com.hz.pm.api.sys.model.dto.RegionDTO; import com.hz.pm.api.user.util.LoginUserUtil; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.model.PageVo; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertAdminManageServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertAdminManageServiceImpl.java index 4b1fe56..1a324f5 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertAdminManageServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertAdminManageServiceImpl.java @@ -1,14 +1,11 @@ package com.hz.pm.api.expert.service.impl; import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.hz.pm.api.expert.entity.ExpertUserFullInfo; -import com.ningdatech.basic.util.CollUtils; import com.hz.pm.api.common.model.CommonPage; import com.hz.pm.api.expert.assembler.ExpertUserInfoAssembler; import com.hz.pm.api.expert.constant.ExpertAccountStatusEnum; +import com.hz.pm.api.expert.entity.ExpertUserFullInfo; import com.hz.pm.api.expert.mapper.ExpertAdminManageMapper; import com.hz.pm.api.expert.model.cmd.ExpertAdminExpertManageQueryCmd; import com.hz.pm.api.expert.model.dto.ExpertAdminExpertListDTO; @@ -18,16 +15,15 @@ import com.hz.pm.api.expert.model.query.ListExpertQuery; import com.hz.pm.api.expert.service.ExpertAdminManageService; import com.hz.pm.api.expert.service.IExpertUserFullInfoService; import com.hz.pm.api.meta.model.entity.ExpertDictionary; -import com.hz.pm.api.meta.model.entity.ExpertTag; import com.hz.pm.api.meta.service.IExpertDictionaryService; import com.hz.pm.api.meta.service.IExpertTagService; +import com.ningdatech.basic.util.CollUtils; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; /** * @author liuxinxin diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/controller/MhSyncController.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/controller/MhSyncController.java index 3a69bcf..d586dec 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/external/controller/MhSyncController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/controller/MhSyncController.java @@ -1,6 +1,5 @@ package com.hz.pm.api.external.controller; -import com.hz.pm.api.external.MhApiClient; import com.hz.pm.api.user.manage.SyncMhUserOrgManage; import io.swagger.annotations.Api; import lombok.RequiredArgsConstructor; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhTechExpertDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhTechExpertDTO.java index 326cd3b..aa55572 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhTechExpertDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhTechExpertDTO.java @@ -1,12 +1,8 @@ package com.hz.pm.api.external.model.dto; -import cn.hutool.core.collection.CollUtil; import lombok.Data; -import java.util.Arrays; import java.util.Date; -import java.util.List; -import java.util.stream.Collectors; /** *

diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java index 3615039..8ee17e6 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java @@ -525,8 +525,7 @@ public class ProjectFileManage { private List getFileIdList(String buildBasis) { List prePlanFileArray = JSON.parseArray(buildBasis, JSONObject.class); - List prePlanFileIdList = CollUtils.fieldList(prePlanFileArray, w -> w.getLong(CommonConst.ID_STR)); - return prePlanFileIdList; + return CollUtils.fieldList(prePlanFileArray, w -> w.getLong(CommonConst.ID_STR)); } /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/entity/ProjectApplyBorrow.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/entity/ProjectApplyBorrow.java index 04b03fe..592112b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/entity/ProjectApplyBorrow.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/entity/ProjectApplyBorrow.java @@ -19,7 +19,7 @@ import lombok.Data; */ @Data @TableName("nd_project_apply_borrow") -@ApiModel(value = "NdProjectApplyBorrow对象", description = "") +@ApiModel(value = "NdProjectApplyBorrow对象") public class ProjectApplyBorrow implements Serializable { private static final long serialVersionUID = 1L; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/ProjectFileVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/ProjectFileVO.java index f0374cf..d8249eb 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/ProjectFileVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/ProjectFileVO.java @@ -1,6 +1,5 @@ package com.hz.pm.api.filemanage.model.vo; -import com.hz.pm.api.expert.model.vo.ExpertReviewDetailVO; import com.hz.pm.api.expert.model.vo.ProjectReviewDetailVO; import com.hz.pm.api.projectdeclared.model.vo.ContractVO; import com.hz.pm.api.projectdeclared.model.vo.FinalAcceptanceVO; @@ -12,7 +11,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.time.LocalDateTime; import java.util.List; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/utils/ProjectConvertUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/utils/ProjectConvertUtil.java index 2cd0ba9..6c058ed 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/gov/utils/ProjectConvertUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/utils/ProjectConvertUtil.java @@ -240,7 +240,7 @@ public class ProjectConvertUtil { if(CollUtil.isNotEmpty(purchases)){ purchases.stream().map(PurchaseVO::getTransactionAmount) .filter(Objects::nonNull).reduce(BigDecimal::add) - .ifPresent(j -> approve.setReleaseYearMoney(j)); + .ifPresent(approve::setReleaseYearMoney); } return approve; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsController.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsController.java index fa0d767..93b55ad 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsController.java @@ -1,11 +1,10 @@ package com.hz.pm.api.irs.controller; -import com.ningdatech.log.annotation.WebLog; -import com.hz.pm.api.irs.model.dto.ForwardDTO; import com.hz.pm.api.projectdeclared.manage.IrsManage; import com.hz.pm.api.projectdeclared.model.vo.IrsApplicationVO; import com.hz.pm.api.projectdeclared.model.vo.PiotTasksVO; import com.hz.pm.api.scheduler.task.SynProjectCoreBizTask; +import com.ningdatech.log.annotation.WebLog; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -56,7 +55,7 @@ public class IrsController { @ApiOperation(value = "获取企业社会信用编码", notes = "获取企业社会信用编码") @GetMapping("/get-credit-code") - public String getCreditCode() throws NoSuchAlgorithmException, UnsupportedEncodingException { + public String getCreditCode() throws NoSuchAlgorithmException { return irsManage.getCreditCode(); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsProjectController.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsProjectController.java index c6e6939..cab9d72 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsProjectController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsProjectController.java @@ -1,18 +1,17 @@ package com.hz.pm.api.irs.controller; -import com.ningdatech.basic.model.PageVo; -import com.hz.pm.api.dashboard.model.vo.ProtraitProjectOutputVO; import com.hz.pm.api.irs.manage.IrsProjectManage; import com.hz.pm.api.projectlib.model.req.ProjectListReq; import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +import com.ningdatech.basic.model.PageVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import java.util.List; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; /** * @Classname IrsController diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/AppIrsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/AppIrsManage.java index 5421df8..d37efcd 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/AppIrsManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/AppIrsManage.java @@ -8,7 +8,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hz.pm.api.common.model.constant.RegionConst; import com.hz.pm.api.common.enumeration.CommonEnum; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.common.util.CryptUtils; import com.hz.pm.api.common.util.HttpUtil; import com.hz.pm.api.irs.model.dto.ApiApplyDTO; @@ -54,7 +54,7 @@ public class AppIrsManage { private final IProjectApplicationService applicationService; - private final StateMachineUtils stateMachineUtils; + private final StateMachineUtil stateMachineUtil; @Value("${irs.push-app.appKey}") private String pushAppKey; @@ -172,7 +172,7 @@ public class AppIrsManage { //如果筛选出来的 为空的话 就调用状态机 if (CollUtil.isEmpty(apps)) { - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); project.setUpdateOn(LocalDateTime.now()); projectService.updateById(project); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java index d281229..f2d2f2f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java @@ -66,10 +66,7 @@ public class IrsProjectManage { if(CollUtil.isEmpty(page.getRecords())){ return PageVo.empty(); } - List res = page.getRecords().stream().map(p -> { - ProjectLibListItemVO vo = BeanUtil.copyProperties(p,ProjectLibListItemVO.class); - return vo; - }).collect(Collectors.toList()); + List res = page.getRecords().stream().map(p -> BeanUtil.copyProperties(p,ProjectLibListItemVO.class)).collect(Collectors.toList()); return PageVo.of(res,page.getTotal()); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/leave/manage/LeaveManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/leave/manage/LeaveManage.java index f2ac767..e993f43 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/leave/manage/LeaveManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/leave/manage/LeaveManage.java @@ -15,10 +15,8 @@ import com.hz.pm.api.common.util.StrUtils; import com.hz.pm.api.expert.constant.ExpertApplyStatusEnum; import com.hz.pm.api.expert.constant.ExpertApplyTypeEnum; import com.hz.pm.api.expert.entity.ExpertMetaApply; -import com.hz.pm.api.expert.entity.ExpertUserFullInfo; import com.hz.pm.api.expert.model.dto.ModifyApplyExtraInfoDTO; import com.hz.pm.api.expert.service.IExpertMetaApplyService; -import com.hz.pm.api.expert.service.IExpertUserFullInfoService; import com.hz.pm.api.leave.entity.domain.ExpertLeave; import com.hz.pm.api.leave.entity.domain.ExpertLeaveDetail; import com.hz.pm.api.leave.entity.enumeration.LeaveStatusEnum; @@ -77,7 +75,6 @@ public class LeaveManage { private final IExpertLeaveDetailService leaveDetailService; private final IExpertMetaApplyService metaApplyService; private final FileService fileService; - private final IExpertUserFullInfoService userFullInfoService; private final MeetingCallOrMsgHelper meetingCallOrMsgHelper; private static final int HOURS_BEFORE_MEETING = 2; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/builder/YxtSmsContextBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/builder/YxtSmsContextBuilder.java deleted file mode 100644 index bf384e8..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/builder/YxtSmsContextBuilder.java +++ /dev/null @@ -1,129 +0,0 @@ -//package com.hz.pm.api.meeting.builder; -// -// -//import com.hz.pm.api.meeting.entity.domain.Meeting; -//import com.hz.pm.api.meeting.entity.domain.MeetingExpert; -//import com.hz.pm.api.sms.utils.DateUtil; -// -//import java.time.format.DateTimeFormatter; -//import java.util.ArrayList; -//import java.util.List; -// -///** -// *

-// * YxtSmsContextBuilder -// *

-// * -// * @author WendyYang -// * @since 14:19 2022/11/17 -// */ -//public class YxtSmsContextBuilder { -// -// private YxtSmsContextBuilder() { -// } -// -// public static List smsToExpertByCancelMeeting(Meeting meeting, List experts, String meetingType) { -// String holdCompany = meeting.getHoldCompanyBracket(); -// String meetingTime = meeting.getStartTime().format(DateUtil.DTF_YMD_HM); -// List contexts = new ArrayList<>(); -// for (MeetingExpert me : experts) { -// SendSmsContext context = new SendSmsContext(); -// context.setContent(holdCompany + String.format(YxtSmsTemplateConst.MEETING_CANCEL, -// me.getExpertName(), meeting.getCancelRemark(), meetingTime, meetingType, meeting.getContact())); -// context.setReceiveNumber(me.getMobile()); -// contexts.add(context); -// } -// return contexts; -// } -// -// public static List smsToExpertBySendNotice(Meeting meeting, List experts, String meetingType) { -// String holdCompany = meeting.getHoldCompanyBracket(); -// String meetingTime = meeting.getStartTime().format(DateUtil.DTF_YMD_HM); -// List contexts = new ArrayList<>(); -// for (MeetingExpert me : experts) { -// SendSmsContext context = new SendSmsContext(); -// context.setContent(holdCompany + String.format(YxtSmsTemplateConst.SEND_MEETING_NOTICE, -// me.getExpertName(), me.getUpdateOn().format(DateUtil.DTF_YMD_HM), -// meetingType, meetingTime, meeting.getRegionDetail(), meeting.getContact())); -// context.setReceiveNumber(me.getMobile()); -// contexts.add(context); -// } -// return contexts; -// } -// -// public static SendSmsContext smsToExpertByReplace(Meeting meeting, MeetingExpert expert, String meetingType) { -// SendSmsContext context = new SendSmsContext(); -// String holdCompany = meeting.getHoldCompanyBracket(); -// context.setContent(holdCompany + String.format(YxtSmsTemplateConst.EXPERT_REPLACED, -// expert.getExpertName(), -// meeting.getStartTime().format(DateUtil.DTF_YMD_HM), -// meetingType, -// meeting.getContact() -// )); -// context.setReceiveNumber(expert.getMobile()); -// return context; -// } -// -// public static List smsToExpertByMeetingChange(Meeting old, Meeting curr, List experts, String meetingType) { -// List contexts = new ArrayList<>(); -// String holdCompany = curr.getHoldCompanyBracket(); -// String sTimeOld = old.getStartTime().format(DateUtil.DTF_YMD_HM); -// String sTimeNew = curr.getStartTime().format(DateUtil.DTF_YMD_HM); -// for (MeetingExpert me : experts) { -// SendSmsContext context = new SendSmsContext(); -// String content = String.format(YxtSmsTemplateConst.MEETING_INGO_CHANGE, me.getExpertName(), -// sTimeOld, meetingType, sTimeNew, curr.getRegionDetail(), curr.getContact()); -// context.setContent(holdCompany + content); -// context.setReceiveNumber(me.getMobile()); -// contexts.add(context); -// } -// return contexts; -// } -// -// public static SendSmsContext smsToInvitorByExpertLeave(UserBasicInfo invitor, String meetingName, String expertName) { -// SendSmsContext context = new SendSmsContext(); -// context.setReceiveNumber(invitor.getPhoneNo()); -// context.setContent(String.format(YxtSmsTemplateConst.TEMP_LEAVE_APPLY, invitor.getNickName(), -// meetingName, expertName, WebProperties.webUrl)); -// return context; -// } -// -// public static SendSmsContext smsToExpertByLeavePassed(ExpertLeave leave, String leaveUser, String mobile) { -// String smsContent = String.format(YxtSmsTemplateConst.LEAVE_APPLY_PASSED, leaveUser, -// leave.getStartTime().format(DateTimeFormatter.ofPattern(DatePattern.YMD_HMS)), -// leave.getEndTime().format(DateTimeFormatter.ofPattern(DatePattern.YMD_HMS))); -// SendSmsContext context = new SendSmsContext(); -// context.setContent(smsContent); -// context.setReceiveNumber(mobile); -// return context; -// } -// -// public static SendSmsContext smsToExpertBtLeaveReject(String leaveUser, String mobile, String opinion) { -// String smsContent = String.format(YxtSmsTemplateConst.LEAVE_APPLY_REFUSED, leaveUser, opinion); -// SendSmsContext context = new SendSmsContext(); -// context.setContent(smsContent); -// context.setReceiveNumber(mobile); -// return context; -// } -// -// public static SendSmsContext smsByRandomInviteStop(String inviterName, String meetingName, String mobile) { -// String smsContent = String.format(YxtSmsTemplateConst.RANDOM_INVITE_STOP, -// inviterName, meetingName, WebProperties.webUrl -// ); -// SendSmsContext context = new SendSmsContext(); -// context.setContent(smsContent); -// context.setReceiveNumber(mobile); -// return context; -// } -// -// -// public static SendSmsContext meetingInviteCompleteNotice(Meeting meeting) { -// String smsContent = String.format(YxtSmsTemplateConst.RANDOM_EXTRACTION_COMPLETED, -// meeting.getConnecter(), meeting.getName(), WebProperties.webUrl -// ); -// SendSmsContext context = new SendSmsContext(); -// context.setContent(smsContent); -// context.setReceiveNumber(meeting.getContact()); -// return context; -// } -//} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/controller/MeetingExpertJudgeController.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/controller/MeetingExpertJudgeController.java index e5fc724..b6dce22 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/controller/MeetingExpertJudgeController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/controller/MeetingExpertJudgeController.java @@ -10,8 +10,6 @@ import lombok.AllArgsConstructor; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import javax.validation.Valid; - /** *

* 前端控制器 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingExpertJudge.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingExpertJudge.java index 19285c3..9246e81 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingExpertJudge.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/domain/MeetingExpertJudge.java @@ -1,7 +1,6 @@ package com.hz.pm.api.meeting.entity.domain; import com.baomidou.mybatisplus.annotation.*; -import io.swagger.annotations.Api; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertIdFilterDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertIdFilterDTO.java index 9ea369a..1cccbd0 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertIdFilterDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/ExpertIdFilterDTO.java @@ -2,7 +2,6 @@ package com.hz.pm.api.meeting.entity.dto; import lombok.AllArgsConstructor; import lombok.Data; -import lombok.RequiredArgsConstructor; import java.util.List; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingByManagerVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingByManagerVO.java index fda5e0a..5b70ac0 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingByManagerVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/vo/MeetingByManagerVO.java @@ -3,9 +3,7 @@ package com.hz.pm.api.meeting.entity.vo; import com.alibaba.fastjson.annotation.JSONField; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import lombok.Builder; import lombok.Data; -import lombok.experimental.Tolerate; import java.time.LocalDateTime; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingManageHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingManageHelper.java index f3d83c1..9e088f8 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingManageHelper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingManageHelper.java @@ -31,7 +31,6 @@ import com.hz.pm.api.meeting.service.IMeetingExpertService; import com.hz.pm.api.meta.constant.ExpertDictTypeEnum; import com.hz.pm.api.meta.helper.DictionaryCache; import com.hz.pm.api.meta.model.dto.DictionaryDTO; -import com.hz.pm.api.sys.model.dto.RegionDTO; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.util.CollUtils; import lombok.AllArgsConstructor; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/YxtCallOrSmsHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/YxtCallOrSmsHelper.java index 8d84122..f8df961 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/YxtCallOrSmsHelper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/YxtCallOrSmsHelper.java @@ -34,10 +34,10 @@ public class YxtCallOrSmsHelper { } public void sendSms(List smsList) { - yxtClient.submitSmsTask(new SendSmsCmd() {{ - setContextList(smsList); - setSmsSignEnum(YxtSmsSignEnum.LS_BIG_DATA_BUREAU); - }}); + SendSmsCmd cmd = new SendSmsCmd(); + cmd.setContextList(smsList); + cmd.setSmsSignEnum(YxtSmsSignEnum.LS_BIG_DATA_BUREAU); + yxtClient.submitSmsTask(cmd); } public void sendSms(SendSmsContext sms) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/assembler/MetaTagAssembler.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/assembler/MetaTagAssembler.java index 8bd3b0e..65d2dfe 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/assembler/MetaTagAssembler.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/assembler/MetaTagAssembler.java @@ -7,34 +7,41 @@ import com.hz.pm.api.meta.model.vo.ResTagTreeVO; import org.apache.commons.collections4.CollectionUtils; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.stream.Collectors; /** - * @author liuxinxin - * @date 2022/7/22 上午9:57 + *

+ * MetaTagAssembler + *

+ * + * @author WendyYang + * @since 17:06 2024/1/8 */ - public class MetaTagAssembler { - public static TagDTO toTagDTO(MetaTag metaTagManage) { + private MetaTagAssembler() { + } + + public static TagDTO convert(MetaTag metaTag) { TagDTO tagDTO = new TagDTO(); - tagDTO.setParentCode(metaTagManage.getParentCode()); - tagDTO.setTagCode(metaTagManage.getTagCode()); - tagDTO.setTagLevel(metaTagManage.getTagLevel()); - tagDTO.setTagName(metaTagManage.getTagName()); + tagDTO.setParentCode(metaTag.getParentCode()); + tagDTO.setTagCode(metaTag.getTagCode()); + tagDTO.setTagLevel(metaTag.getTagLevel()); + tagDTO.setTagName(metaTag.getTagName()); return tagDTO; } - public static List toTagTreeDTOList(List tagDTOList) { - if (CollectionUtils.isEmpty(tagDTOList)) { - return new ArrayList<>(); + public static List convert(List tagList) { + if (CollectionUtils.isEmpty(tagList)) { + return Collections.emptyList(); } - return tagDTOList.stream().map(MetaTagAssembler::toTagTreeDTO).collect(Collectors.toList()); + return tagList.stream().map(MetaTagAssembler::convert).collect(Collectors.toList()); } - public static TagTreeDTO toTagTreeDTO(TagDTO tagDTO) { + public static TagTreeDTO convert(TagDTO tagDTO) { TagTreeDTO tagTreeDTO = new TagTreeDTO(); tagTreeDTO.setParentCode(tagDTO.getParentCode()); tagTreeDTO.setTagCode(tagDTO.getTagCode()); @@ -43,7 +50,7 @@ public class MetaTagAssembler { return tagTreeDTO; } - public static List toTagTreeVOList(List tagTreeDTOList) { + public static List to(List tagTreeDTOList) { List resTagTreeVOList = new ArrayList<>(); for (TagTreeDTO tagTreeDTO : tagTreeDTOList) { ResTagTreeVO resTagTreeVO = new ResTagTreeVO(); @@ -53,7 +60,7 @@ public class MetaTagAssembler { resTagTreeVO.setTagCode(tagTreeDTO.getTagCode()); resTagTreeVO.setUnionCode(tagTreeDTO.getTagName() + "##" + tagTreeDTO.getTagCode()); if (CollectionUtils.isNotEmpty(tagTreeDTO.getChildren())) { - resTagTreeVO.setChildren(toTagTreeVOList(tagTreeDTO.getChildren())); + resTagTreeVO.setChildren(to(tagTreeDTO.getChildren())); } resTagTreeVOList.add(resTagTreeVO); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractTagsCache.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractTagsCache.java index a594939..c137d4c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractTagsCache.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/basic/AbstractTagsCache.java @@ -51,7 +51,7 @@ public abstract class AbstractTagsCache implements InitializingBean, TagCache { // 查询全部 List tags = metaTagService.queryLeLevel(Integer.parseInt(key)); putToTagMap(tags); - return toTree(MetaTagAssembler.toTagTreeDTOList(tags)); + return toTree(MetaTagAssembler.convert(tags)); } @Override @@ -75,7 +75,7 @@ public abstract class AbstractTagsCache implements InitializingBean, TagCache { List tagsByLevel = allTags.stream() .filter(w -> w.getTagLevel() <= currLevel) .collect(Collectors.toList()); - mapByKeys.put(String.valueOf(currLevel), toTree(MetaTagAssembler.toTagTreeDTOList(tagsByLevel))); + mapByKeys.put(String.valueOf(currLevel), toTree(MetaTagAssembler.convert(tagsByLevel))); }); return mapByKeys; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/manage/MetaManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/manage/MetaManage.java index 950e6b6..33bf73c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/manage/MetaManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/manage/MetaManage.java @@ -119,24 +119,24 @@ public class MetaManage { tagTreeDTOList.add(tagTreeDTO); } } - return MetaTagAssembler.toTagTreeVOList(tagTreeDTOList); + return MetaTagAssembler.to(tagTreeDTOList); } /** * 专家管理员才能调用 * - * @param reqAddDictionaryPO + * @param req \ */ @Transactional(rollbackFor = Exception.class) - public void addDictionary(ReqAddDictionaryPO reqAddDictionaryPO) { - String dictionaryType = reqAddDictionaryPO.getDictionaryType(); + public void addDictionary(ReqAddDictionaryPO req) { + String dictionaryType = req.getDictionaryType(); boolean contains = ExpertDictTypeEnum.contains(dictionaryType); if (!contains) { throw BizException.wrap("无效的专家字典类型:%s", dictionaryType); } - String name = reqAddDictionaryPO.getName(); - Integer sortValue = reqAddDictionaryPO.getSortValue(); + String name = req.getName(); + Integer sortValue = req.getSortValue(); LambdaQueryWrapper eq = Wrappers.lambdaQuery(MetaDictionary.class).eq(MetaDictionary::getDictionaryType, dictionaryType); List dictionaryManageList = metaDictionaryManageService.list(eq); @@ -232,8 +232,8 @@ public class MetaManage { }).collect(Collectors.toList()); } - public List tagQuery(ReqTagQueryPO reqTagQueryPO) { - String parentCode = reqTagQueryPO.getParentCode(); + public List tagQuery(ReqTagQueryPO req) { + String parentCode = req.getParentCode(); if (StringUtils.isBlank(parentCode)) { parentCode = TagConst.TAG_ROOT_PARENT_CODE; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaDictionaryServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaDictionaryServiceImpl.java index 2f2ec85..e35a476 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaDictionaryServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaDictionaryServiceImpl.java @@ -1,17 +1,16 @@ package com.hz.pm.api.meta.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.hz.pm.api.meta.model.entity.MetaDictionary; -import com.hz.pm.api.meta.mapper.MetaDictionaryMapper; -import com.hz.pm.api.meta.service.IMetaDictionaryService; import com.hz.pm.api.meta.assembler.MetaDictionaryAssembler; +import com.hz.pm.api.meta.mapper.MetaDictionaryMapper; import com.hz.pm.api.meta.model.dto.DictionaryDTO; +import com.hz.pm.api.meta.model.entity.MetaDictionary; +import com.hz.pm.api.meta.service.IMetaDictionaryService; import com.ningdatech.basic.util.CollUtils; import org.springframework.stereotype.Service; import java.util.Collection; import java.util.List; -import java.util.stream.Collectors; /** *

diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaTagServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaTagServiceImpl.java index dfeb6a2..a718b19 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaTagServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/service/impl/MetaTagServiceImpl.java @@ -2,15 +2,14 @@ package com.hz.pm.api.meta.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hz.pm.api.meta.assembler.MetaTagAssembler; -import com.hz.pm.api.meta.model.entity.MetaTag; import com.hz.pm.api.meta.mapper.MetaTagMapper; import com.hz.pm.api.meta.model.dto.TagDTO; +import com.hz.pm.api.meta.model.entity.MetaTag; import com.hz.pm.api.meta.service.IMetaTagService; import com.ningdatech.basic.util.CollUtils; import org.springframework.stereotype.Service; import java.util.List; -import java.util.stream.Collectors; /** *

@@ -27,7 +26,7 @@ public class MetaTagServiceImpl extends ServiceImpl impl @Override public List queryAll() { List allTags = this.lambdaQuery().ne(MetaTag::getId, -1).list(); - return CollUtils.convert(allTags, MetaTagAssembler::toTagDTO); + return CollUtils.convert(allTags, MetaTagAssembler::convert); } @Override @@ -36,7 +35,7 @@ public class MetaTagServiceImpl extends ServiceImpl impl .ne(MetaTag::getId, -1) .le(MetaTag::getTagLevel, level) .list(); - return CollUtils.convert(allTags, MetaTagAssembler::toTagDTO); + return CollUtils.convert(allTags, MetaTagAssembler::convert); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/OrganizationManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/OrganizationManage.java index 5ce0447..388a7dc 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/OrganizationManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/OrganizationManage.java @@ -95,8 +95,8 @@ public class OrganizationManage { } public List getChildOrganizationList(String parentCode, String orgName, Boolean onlyUnit) { - List parentCodeList = new ArrayList<>(); - List dingOrganizationList = new ArrayList<>(); + List parentCodeList; + List dingOrganizationList; if (StrUtils.isBlank(parentCode)) { parentCodeList = dingOrganizationProperties.getDeptVisibleScopes(); dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/OrganizationSynthesizeTreeVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/OrganizationSynthesizeTreeVO.java index a1d92eb..8b27095 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/OrganizationSynthesizeTreeVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/OrganizationSynthesizeTreeVO.java @@ -24,9 +24,6 @@ public class OrganizationSynthesizeTreeVO { @ApiModelProperty("名称") private String name; -// @ApiModelProperty("自己组织列表") -// private List childOrganizationList; - @ApiModelProperty("组织下成员列表") private List memberList; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/OrganizationTreeVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/OrganizationTreeVO.java index 43730fc..dc2fe12 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/OrganizationTreeVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/model/vo/OrganizationTreeVO.java @@ -37,5 +37,5 @@ public class OrganizationTreeVO { // private Boolean isLeaf; // @ApiModelProperty(value = "社会同一信用代码") - private String unifiedSocialCreditCode;; + private String unifiedSocialCreditCode; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/convert/PerformanceAppraisalConveter.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/convert/PerformanceAppraisalConveter.java index c251be9..00b2255 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/convert/PerformanceAppraisalConveter.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/convert/PerformanceAppraisalConveter.java @@ -86,11 +86,10 @@ public class PerformanceAppraisalConveter { */ public static Boolean checkCanSelfAppraisal(PerformanceAppraisalProject appraisalProject) { if (Objects.nonNull(appraisalProject.getSelfAppraisalStart()) - && Objects.nonNull(appraisalProject.getSelfAppraisalEnd())) { - if (LocalDateTime.now().compareTo(appraisalProject.getSelfAppraisalStart()) > 0 && - LocalDateTime.now().compareTo(appraisalProject.getSelfAppraisalEnd()) < 0) { + && Objects.nonNull(appraisalProject.getSelfAppraisalEnd()) && (LocalDateTime.now().isAfter(appraisalProject.getSelfAppraisalStart()) && + LocalDateTime.now().isBefore(appraisalProject.getSelfAppraisalEnd()))) { return Boolean.TRUE; - } + } return Boolean.FALSE; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/OrgSelfAppraisalManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/OrgSelfAppraisalManage.java index 512fcd0..173b3ce 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/OrgSelfAppraisalManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/OrgSelfAppraisalManage.java @@ -502,7 +502,7 @@ public class OrgSelfAppraisalManage { .sheet(fileName) .doWrite(exportDataList); } catch (IOException e) { - throw new RuntimeException(e); + throw new BizException(e); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalMapper.java index 9dbdca1..17c46dd 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalMapper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalMapper.java @@ -2,7 +2,6 @@ package com.hz.pm.api.performance.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hz.pm.api.performance.model.entity.PerformanceAppraisal; -import com.hz.pm.api.projectlib.model.entity.Project; /** *

diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectMapper.java index a4b7690..c71497d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectMapper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/mapper/PerformanceAppraisalProjectMapper.java @@ -1,7 +1,6 @@ package com.hz.pm.api.performance.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hz.pm.api.performance.model.entity.PerformanceAppraisal; import com.hz.pm.api.performance.model.entity.PerformanceAppraisalProject; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalEditDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalEditDTO.java index 82cdff5..5719de0 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalEditDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalEditDTO.java @@ -1,15 +1,12 @@ package com.hz.pm.api.performance.model.dto; -import com.alibaba.fastjson.annotation.JSONField; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.hibernate.validator.constraints.Range; -import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import java.io.Serializable; -import java.time.LocalDateTime; import java.util.List; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java index 4588aa4..f34b1d4 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java @@ -1,14 +1,10 @@ package com.hz.pm.api.performance.model.dto; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; -import java.time.LocalDateTime; import java.util.List; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorAppIndexSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorAppIndexSaveDTO.java index 3d83884..51479ae 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorAppIndexSaveDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorAppIndexSaveDTO.java @@ -1,19 +1,12 @@ package com.hz.pm.api.performance.model.dto; -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; - -import javax.validation.constraints.Size; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import org.hibernate.validator.constraints.Range; - import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.io.Serializable; +import java.math.BigDecimal; + /** * 绩效评级-应用指标库 新增指标保存 * @return diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorProjectIndexSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorProjectIndexSaveDTO.java index 3771991..3b8c839 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorProjectIndexSaveDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorProjectIndexSaveDTO.java @@ -1,17 +1,13 @@ package com.hz.pm.api.performance.model.dto; -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.hibernate.validator.constraints.Range; import javax.validation.constraints.Size; +import java.io.Serializable; +import java.math.BigDecimal; /** * 绩效评级-项目指标库 新增指标保存 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalProject.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalProject.java index 8b69692..c75c383 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalProject.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalProject.java @@ -1,6 +1,5 @@ package com.hz.pm.api.performance.model.entity; -import com.alibaba.fastjson.annotation.JSONField; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceIndicatorProjectTemplate.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceIndicatorProjectTemplate.java index 49daa64..4990417 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceIndicatorProjectTemplate.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceIndicatorProjectTemplate.java @@ -5,12 +5,10 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import liquibase.pro.packaged.I; import lombok.Data; import java.io.Serializable; import java.time.LocalDateTime; -import java.util.List; /** * @Classname PerformanceIndicatorTemplate diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectIndexTemplateVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectIndexTemplateVO.java index 690a3b4..9efa7bb 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectIndexTemplateVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectIndexTemplateVO.java @@ -1,6 +1,5 @@ package com.hz.pm.api.performance.model.vo; -import com.hz.pm.api.performance.model.dto.ProjectTemplateDetailDTO; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectIndexVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectIndexVO.java index 04d6d11..b3d8215 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectIndexVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/ProjectIndexVO.java @@ -1,16 +1,13 @@ package com.hz.pm.api.performance.model.vo; -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.List; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + /** * 绩效评价-项目指标库 * @return diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/ContentTypeUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/ContentTypeUtils.java index 5caf5d1..40be9cb 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/ContentTypeUtils.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/ContentTypeUtils.java @@ -7,7 +7,6 @@ package com.hz.pm.api.performance.util; import cn.hutool.core.util.CharsetUtil; import com.ningdatech.basic.exception.BizException; -import com.wflow.config.ResponseCode; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java index 89aada9..381ca93 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java @@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.helper.UserInfoHelper; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.common.util.ExcelExportStyle; import com.hz.pm.api.projectdeclared.model.dto.ContractSaveDTO; @@ -79,7 +79,7 @@ public class ConstructionManage { private final IPreInsAcceptancePersonService acceptancePersonService; - private final StateMachineUtils stateMachineUtils; + private final StateMachineUtil stateMachineUtil; /** * 待采购的-项目列表 @@ -349,7 +349,7 @@ public class ConstructionManage { //判断下 如果和初验都完成了 才进入下一阶段 if (StringUtils.isNotBlank(project.getPreliminaryInspectionMaterials())) { //进入到下一状态 - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); } project.setUpdateOn(LocalDateTime.now()); if (Objects.nonNull(dto.getDeliveryTime())) { @@ -540,7 +540,7 @@ public class ConstructionManage { //判断下 如果和初验都完成了 才进入下一阶段 if (Objects.nonNull(project.getDeliveryTime())) { //进入到下一状态 - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); } project.setUpdateOn(LocalDateTime.now()); project.setPreliminaryInspectionMaterials(dto.getPreliminaryInspectionMaterials()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java index 48d0cc2..501006f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java @@ -12,7 +12,7 @@ import com.hz.pm.api.common.enumeration.CommonEnum; import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.common.helper.UserInfoHelper; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.common.util.ExcelExportStyle; import com.hz.pm.api.projectdeclared.model.dto.ConstructionPlanExportDTO; @@ -79,7 +79,7 @@ public class ConstructionPlanManage { private final IProjectService projectService; private final ProcessInstanceService processService; private final ProcessModelService processModelService; - private final StateMachineUtils stateMachineUtils; + private final StateMachineUtil stateMachineUtil; private final IProjectInstService projectInstService; private final ProjectLibManage projectLibManage; private final UserInfoHelper userInfoHelper; @@ -159,8 +159,8 @@ public class ConstructionPlanManage { //如果被禁用了的话 直接跳过 进入到下一个状态 if (Boolean.TRUE.equals(model.getIsStop())) { //被禁用了 调2次状态机 - stateMachineUtils.pass(constructProject); - stateMachineUtils.pass(constructProject); + stateMachineUtil.pass(constructProject); + stateMachineUtil.pass(constructProject); constructProject.setUpdateOn(LocalDateTime.now()); projectService.updateById(constructProject); return "因为建设方案流程被禁用了 直接跳过!"; @@ -194,7 +194,7 @@ public class ConstructionPlanManage { } private Project contructionPlanModifyProject(Project project, String instanceId) { - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); project.setUpdateOn(LocalDateTime.now()); project.setInstCode(instanceId); projectService.updateById(project); @@ -249,7 +249,7 @@ public class ConstructionPlanManage { project.setInstCode(instanceId); project.setConstructionPlanFile(constructionPlanFile); //调用状态机 进入下一个通过状态 - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); projectService.updateById(project); //保存项目和实例的关系 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java index e11ec92..1a7e573 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java @@ -7,6 +7,7 @@ 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.exception.BizException; import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; @@ -88,6 +89,7 @@ public class DelayedApplyManage { /** * 延期的-项目列表 + * * @param req * @return */ @@ -97,11 +99,11 @@ public class DelayedApplyManage { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); //待终验 并且已经过期 //只能看自己单位的 - query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); - query.eq(Project::getStatus,ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode()); + query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); + query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); query.lt(Project::getPlanAcceptanceTime, LocalDateTime.now()); - query.eq(Project::getNewest,Boolean.TRUE); + query.eq(Project::getNewest, Boolean.TRUE); query.isNotNull(Project::getApprovalDate); query.isNotNull(Project::getBuildCycle); query.orderByAsc(Project::getApprovalDate); @@ -167,18 +169,18 @@ public class DelayedApplyManage { LambdaQueryWrapper query = ProjectHelper.projectQuery(param); //待终验 //只能看自己单位的 - query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); - query.eq(Project::getStatus,ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - query.eq(Project::getStage,ProjectStatusEnum.PROJECT_APPROVED.getCode()); - query.eq(Project::getNewest,Boolean.TRUE); + query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); + query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); + query.eq(Project::getNewest, Boolean.TRUE); query.isNotNull(Project::getApprovalDate); query.isNotNull(Project::getBuildCycle); query.orderByAsc(Project::getApprovalDate); List records = projectService.list(query); - AtomicInteger serialNumber = new AtomicInteger(0); List collect = Lists.newArrayList(); - if(CollUtil.isNotEmpty(records)){ + if (CollUtil.isNotEmpty(records)) { + AtomicInteger rowNo = new AtomicInteger(0); collect = records.stream().map(r -> { DeclaredProjectExportDTO exportDTO = new DeclaredProjectExportDTO(); BeanUtils.copyProperties(r, exportDTO); @@ -186,7 +188,7 @@ public class DelayedApplyManage { exportDTO.setStatusName(ProjectStatusEnum.getDesc(r.getStatus())); String createOnStr = NdDateUtils.format(r.getCreateOn(), "yyyy-MM-dd HH:mm"); exportDTO.setCreateOn(createOnStr); - exportDTO.setSerialNumber(serialNumber.incrementAndGet()); + exportDTO.setSerialNumber(rowNo.incrementAndGet()); exportDTO.setPlanAcceptanceTime(Objects.nonNull(r.getPlanAcceptanceTime()) ? NdDateUtils.format(r.getPlanAcceptanceTime(), "yyyy-MM-dd") : StringUtils.EMPTY); return exportDTO; @@ -194,7 +196,7 @@ public class DelayedApplyManage { } String fileName = "待终验申请项目列表"; - ExcelDownUtil.setFileName(fileName,response); + ExcelDownUtil.setFileName(fileName, response); //数据导出处理函数 try { EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class) @@ -203,14 +205,14 @@ public class DelayedApplyManage { .sheet(fileName) .doWrite(collect); } catch (IOException e) { - throw new RuntimeException(e); - } catch (Exception e) { - throw new RuntimeException(e); + log.error("待终验申请项目列表导出失败:{}", e.getMessage(), e); + throw BizException.wrap("导出失败"); } } /** * 延期申请 + * * @param dto * @return */ @@ -229,7 +231,7 @@ public class DelayedApplyManage { .throwMessage("提交失败 该项目不是 已立项|待终验"); VUtils.isTrue(Objects.isNull(project.getPlanAcceptanceTime()) - || project.getPlanAcceptanceTime().compareTo(LocalDateTime.now()) <= 0) + || !project.getPlanAcceptanceTime().isAfter(LocalDateTime.now())) .throwMessage("当前项目还未过期验收"); return "申请发起成功"; @@ -237,6 +239,7 @@ public class DelayedApplyManage { /** * 开启延期申请审批流程 + * * @param dto * @return */ @@ -256,7 +259,7 @@ public class DelayedApplyManage { .throwMessage("提交失败 该项目不是 已立项|待终验"); VUtils.isTrue(Objects.isNull(project.getPlanAcceptanceTime()) - || project.getPlanAcceptanceTime().compareTo(LocalDateTime.now()) > 0) + || project.getPlanAcceptanceTime().isAfter(LocalDateTime.now())) .throwMessage("当前项目还未过期验收"); String regionCode = project.getAreaCode(); @@ -286,7 +289,7 @@ public class DelayedApplyManage { projectLibManage.saveProjectByApplyDelay(dto, project, instanceId); //发送给第一个审批人消息 - noticeManage.sendFirtUser(project,model.getFormName(),instanceId, + noticeManage.sendFirtUser(project, model.getFormName(), instanceId, WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); return instanceId; @@ -294,6 +297,7 @@ public class DelayedApplyManage { /** * 查询延期 详情 + * * @param projectId * @return */ @@ -302,14 +306,15 @@ public class DelayedApplyManage { .eq(ProjectDelayApply::getProjectId, projectId) .orderByDesc(ProjectDelayApply::getCreateOn) .last(BizConst.LIMIT_1)); - if(Objects.isNull(delayApply)){ + if (Objects.isNull(delayApply)) { return null; } - return BeanUtil.copyProperties(delayApply,DelayedApplyVO.class); + return BeanUtil.copyProperties(delayApply, DelayedApplyVO.class); } /** * 查看某个项目的 延期列表 + * * @param projectId * @return */ @@ -319,11 +324,11 @@ public class DelayedApplyManage { .in(ProjectDelayApply::getProjectId, allVersionProjectId) .eq(ProjectDelayApply::getSuccess, Boolean.TRUE)); - if(CollUtil.isEmpty(delays)){ + if (CollUtil.isEmpty(delays)) { return Collections.emptyList(); } - return delays.stream().map(d -> BeanUtil.copyProperties(d,DelayedApplyVO.class)) + return delays.stream().map(d -> BeanUtil.copyProperties(d, DelayedApplyVO.class)) .collect(Collectors.toList()); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/OperationManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/OperationManage.java index 9f4003b..7139d1e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/OperationManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/OperationManage.java @@ -4,7 +4,7 @@ import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.basic.function.VUtils; import com.hz.pm.api.common.model.constant.BizConst; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.projectdeclared.model.dto.OperationDTO; import com.hz.pm.api.projectdeclared.model.entity.Operation; import com.hz.pm.api.projectdeclared.model.vo.OperationVO; @@ -36,7 +36,7 @@ public class OperationManage { private final IProjectService projectService; - private final StateMachineUtils stateMachineUtils; + private final StateMachineUtil stateMachineUtil; /** * 获取实施详情 @@ -84,7 +84,7 @@ public class OperationManage { //强制放入 计划终验时间 entity.setFinalInspectionDate(project.getPlanAcceptanceTime()); if(operationService.saveOrUpdate(entity)){ - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); project.setUpdateOn(LocalDateTime.now()); projectService.updateById(project); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java index f09a221..a3849f6 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java @@ -8,7 +8,7 @@ import com.google.common.collect.Lists; 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.statemachine.util.StateMachineUtil; 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; @@ -73,7 +73,7 @@ public class PrequalificationDeclaredProjectManage { private final ProjectLibManage projectLibManage; - private final StateMachineUtils stateMachineUtils; + private final StateMachineUtil stateMachineUtil; private final IProjectStagingService projectStagingService; @@ -122,7 +122,7 @@ public class PrequalificationDeclaredProjectManage { if (StringUtils.isNotBlank(projectDto.getHigherLineSuperOrgReviewComments())) { projectInfo.setHigherLineSuperOrgReviewComments(projectDto.getHigherLineSuperOrgReviewComments()); } - stateMachineUtils.pass(projectInfo); + stateMachineUtil.pass(projectInfo); String instanceId = null; //如果是省级部门 需要联审的(申报金额大于1000万 并且是市级项目) if (ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectAdjustmentManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectAdjustmentManage.java index cc2b10f..2753b95 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectAdjustmentManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectAdjustmentManage.java @@ -10,21 +10,21 @@ 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.ProjectAdjustmentExportDTO; import com.hz.pm.api.projectdeclared.model.req.AdjustmentListReq; -import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil; -import com.hz.pm.api.projectdeclared.utils.ReStartProcessMapUtil; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; +import com.hz.pm.api.projectdeclared.utils.RestartProcessMapUtil; 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.ProjectApplication; +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.IProjectApplicationService; import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.user.security.model.UserFullInfoDTO; import com.hz.pm.api.user.util.LoginUserUtil; +import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.NdDateUtils; @@ -40,6 +40,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.time.LocalDateTime; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; @@ -61,17 +62,17 @@ public class ProjectAdjustmentManage { private final IProjectApplicationService projectApplicationService; - private final ReStartProcessMapUtil reStartProcessMapUtil; + private final RestartProcessMapUtil reStartProcessMapUtil; private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; private final ProjectLibManage projectLibManage; private final UserInfoHelper userInfoHelper; - private final GenerateProjectCodeUtil generateProjectCodeUtil; /** * 项目内容调整 + * * @param dto * @return */ @@ -83,25 +84,20 @@ public class ProjectAdjustmentManage { VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("调整失败 此项目不存在!"); //项目名称去重 - if(StringUtils.isNotBlank(projectDto.getProjectName()) && - !projectDto.getProjectName().equals(projectInfo.getProjectName())){ + if (StringUtils.isNotBlank(projectDto.getProjectName()) && + !projectDto.getProjectName().equals(projectInfo.getProjectName())) { projectDto.setProjectCode(projectInfo.getProjectCode()); defaultDeclaredProjectManage.checkDuplication(projectDto); } //金额check - if(Objects.nonNull(projectDto.getDeclareAmount())){ + if (Objects.nonNull(projectDto.getDeclareAmount())) { defaultDeclaredProjectManage.checkAmount(projectDto); } - //修改项目内容 -// if(!modifyProject(projectDto)){ -// throw new BusinessException("调整项目失败!"); -// } - //最后去重新 提交项目流程 不同的状态 提交到不同的工作流去 Function declaredFunction = - reStartProcessMapUtil.reStartProcessMap.get(projectInfo.getStatus()); + RestartProcessMapUtil.getRestartFunction(projectInfo.getStatus()); VUtils.isTrue(Objects.isNull(declaredFunction)).throwMessage("状态不正常 没有找到对应申报函数!"); return declaredFunction.apply(dto); } @@ -109,16 +105,16 @@ public class ProjectAdjustmentManage { private Boolean modifyProject(ProjectDTO projectDto) { //先修改项目信息 Project project = new Project(); - BeanUtils.copyProperties(projectDto,project); + BeanUtils.copyProperties(projectDto, project); project.setUpdateOn(LocalDateTime.now()); - if(!projectService.updateById(project)){ + if (!projectService.updateById(project)) { throw new BusinessException("项目调整失败"); } //再修改应用信息 - if(CollUtil.isNotEmpty(projectDto.getApplicationList())){ + if (CollUtil.isNotEmpty(projectDto.getApplicationList())) { //采取批量删除 批量添加的方式 projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectId,project.getId())); + .eq(ProjectApplication::getProjectId, project.getId())); //批量添加 List applications = projectDto.getApplicationList().stream().map(application -> { ProjectApplication projectApplication = new ProjectApplication(); @@ -133,22 +129,26 @@ public class ProjectAdjustmentManage { return Boolean.TRUE; } + private static final List PROJECT_STATUS = Arrays.asList( + ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), + ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(), + ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(), + ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); + /** * 项目库 + * * @param preReq * @return */ public PageVo projectLibList(AdjustmentListReq preReq) { //限定参数 复制bean ProjectListReq req = new ProjectListReq(); - BeanUtils.copyProperties(preReq,req); + BeanUtils.copyProperties(preReq, req); //项目阶段 状态 已定 方案待申报 - req.setStageList(Arrays.asList(ProjectStatusEnum.NOT_APPROVED.getCode())); + req.setStageList(Collections.singletonList(ProjectStatusEnum.NOT_APPROVED.getCode())); //只有 单位内部审核不通过 省级联审不通过 预审不通过 建设方案不通过 4种状态 - req.setStatusList(Arrays.asList(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), - ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(), - ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(), - ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode())); + req.setStatusList(PROJECT_STATUS); UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); //放入用户的单位 @@ -159,14 +159,11 @@ public class ProjectAdjustmentManage { public void exportList(HttpServletResponse response, AdjustmentListReq preReq) { //限定参数 复制bean ProjectListReq req = new ProjectListReq(); - BeanUtils.copyProperties(preReq,req); + BeanUtils.copyProperties(preReq, req); //项目阶段 状态 已定 方案待申报 - req.setStageList(Arrays.asList(ProjectStatusEnum.NOT_APPROVED.getCode())); + req.setStageList(Collections.singletonList(ProjectStatusEnum.NOT_APPROVED.getCode())); //只有 单位内部审核不通过 省级联审不通过 预审不通过 建设方案不通过 4种状态 - req.setStatusList(Arrays.asList(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), - ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(), - ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(), - ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode())); + req.setStatusList(PROJECT_STATUS); UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); //放入用户的单位 @@ -187,7 +184,7 @@ public class ProjectAdjustmentManage { return exportDTO; }).collect(Collectors.toList()); String fileName = "项目内容调整列表"; - ExcelDownUtil.setFileName(fileName,response); + ExcelDownUtil.setFileName(fileName, response); //数据导出处理函数 try { EasyExcel.write(response.getOutputStream(), ProjectAdjustmentExportDTO.class) @@ -196,7 +193,7 @@ public class ProjectAdjustmentManage { .sheet(fileName) .doWrite(collect); } catch (IOException e) { - throw new RuntimeException(e); + throw new BizException(e); } } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java index 4a3435e..26bdf16 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java @@ -12,7 +12,7 @@ import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; import com.ningdatech.basic.util.NdDateUtils; import com.hz.pm.api.common.helper.UserInfoHelper; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.common.util.ExcelExportStyle; import com.hz.pm.api.projectdeclared.model.dto.DeclaredProjectExportDTO; @@ -61,7 +61,7 @@ public class PurchaseManage { private final IPurchaseService purchaseService; - private final StateMachineUtils stateMachineUtils; + private final StateMachineUtil stateMachineUtil; /** * 待采购的-项目列表 @@ -207,7 +207,7 @@ public class PurchaseManage { // } // } //进入到下一状态 - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); project.setUpdateOn(LocalDateTime.now()); // 获取总的成交时间及金额 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/OperationDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/OperationDTO.java index a6798f7..3dd4c0c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/OperationDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/OperationDTO.java @@ -1,8 +1,5 @@ package com.hz.pm.api.projectdeclared.model.dto; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PaymentPlanSupplementDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PaymentPlanSupplementDTO.java index 0f15309..d0158e2 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PaymentPlanSupplementDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PaymentPlanSupplementDTO.java @@ -1,13 +1,11 @@ package com.hz.pm.api.projectdeclared.model.dto; -import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotNull; import java.math.BigDecimal; -import java.time.LocalDateTime; /** * @Classname PaymentPlan diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsAcceptancePersonSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsAcceptancePersonSaveDTO.java index 0dcab7b..78ff9ae 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsAcceptancePersonSaveDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsAcceptancePersonSaveDTO.java @@ -4,9 +4,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import javax.validation.constraints.NotNull; -import java.time.LocalDateTime; - /** * @Classname PreInsAcceptancePerson * @Description 初验人员 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsSaveDTO.java index 6edacbc..0e0dd37 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsSaveDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/PreInsSaveDTO.java @@ -1,14 +1,11 @@ package com.hz.pm.api.projectdeclared.model.dto; -import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; -import java.math.BigDecimal; -import java.time.LocalDateTime; import java.util.List; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ProjectDraftSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ProjectDraftSaveDTO.java index d9217ec..38c93be 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ProjectDraftSaveDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/ProjectDraftSaveDTO.java @@ -1,10 +1,10 @@ package com.hz.pm.api.projectdeclared.model.dto; import com.hz.pm.api.projectlib.model.dto.ProjectDTO; -import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.*; + import javax.validation.constraints.NotNull; import java.io.Serializable; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PaymentPlan.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PaymentPlan.java index bfc2243..6d69a00 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PaymentPlan.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PaymentPlan.java @@ -1,12 +1,13 @@ package com.hz.pm.api.projectdeclared.model.entity; -import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; -import java.time.LocalDate; import java.time.LocalDateTime; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PreInsAcceptancePerson.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PreInsAcceptancePerson.java index c541ace..68394a9 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PreInsAcceptancePerson.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/PreInsAcceptancePerson.java @@ -7,7 +7,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.math.BigDecimal; import java.time.LocalDateTime; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsAcceptancePersonVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsAcceptancePersonVO.java index a487285..6b98428 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsAcceptancePersonVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsAcceptancePersonVO.java @@ -1,8 +1,5 @@ package com.hz.pm.api.projectdeclared.model.vo; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsVO.java index 7c4e602..316dd59 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/PreInsVO.java @@ -1,14 +1,9 @@ package com.hz.pm.api.projectdeclared.model.vo; -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.math.BigDecimal; -import java.time.LocalDateTime; import java.util.List; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/ReStartProcessMapUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/ReStartProcessMapUtil.java deleted file mode 100644 index 7b4dd7c..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/ReStartProcessMapUtil.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.hz.pm.api.projectdeclared.utils; - -import com.google.common.collect.Maps; -import com.hz.pm.api.projectdeclared.manage.*; -import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import java.util.Map; -import java.util.function.Function; - -/** - * @Classname ReSubmitProcessMap - * @Description 项目调整 重新提交时的 事件函数MAP - * @Date 2023/2/15 11:19 - * @Author PoffyZhang - */ -@Component -public class ReStartProcessMapUtil { - @Autowired - private DeclaredProjectManage declaredProjectManage; - - @Autowired - private ConstructionPlanManage constructionPlanManage; - - @Autowired - private PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage; - - @Autowired - private ReviewByProvincialDeptManage provincialDeptManage; - - @Autowired - private FinalAcceptanceManage finalAcceptanceManage; - - public Map> reStartProcessMap = Maps.newHashMap(); - /** - * 初始化业务分派逻辑,代替了if-else部分 - * key: 枚举 状态值 - * value: lambda表达式,最终会获取发起实例的函数 - */ - public ReStartProcessMapUtil(){ - //重新项目申报 - reStartProcessMap.put(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), - dto->declaredProjectManage.reStartTheProcess(dto)); - //建设方案 - reStartProcessMap.put(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode(), - dto->constructionPlanManage.restartTheProcess(dto)); - //预审方案 - reStartProcessMap.put(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(), - dto->prequalificationDeclaredProjectManage.restartTheProcess(dto)); - //省级联审 - reStartProcessMap.put(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(), - dto->provincialDeptManage.restartTheProcess(dto)); - //终审 - reStartProcessMap.put(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode(), - dto->finalAcceptanceManage.restartProcess(dto)); - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/RestartProcessMapUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/RestartProcessMapUtil.java new file mode 100644 index 0000000..aa05673 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/RestartProcessMapUtil.java @@ -0,0 +1,51 @@ +package com.hz.pm.api.projectdeclared.utils; + +import com.google.common.collect.Maps; +import com.hz.pm.api.projectdeclared.manage.*; +import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; +import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; +import org.springframework.stereotype.Component; + +import java.util.Map; +import java.util.function.Function; + +/** + *

+ * RestartProcessMapUtil - 项目调整 重新提交时的 事件函数MAP + *

+ * + * @author PoffyZhang + * @since 2023/2/15 11:19 + */ +@Component +public class RestartProcessMapUtil { + + private static final Map> RESTART_PROCESS_MAP = Maps.newHashMap(); + + public RestartProcessMapUtil(DeclaredProjectManage declaredProjectManage, + ConstructionPlanManage constructionPlanManage, + PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage, + ReviewByProvincialDeptManage provincialDeptManage, + FinalAcceptanceManage finalAcceptanceManage) { + //重新项目申报 + RESTART_PROCESS_MAP.put(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode(), + declaredProjectManage::reStartTheProcess); + //建设方案 + RESTART_PROCESS_MAP.put(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode(), + constructionPlanManage::restartTheProcess); + //预审方案 + RESTART_PROCESS_MAP.put(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode(), + prequalificationDeclaredProjectManage::restartTheProcess); + //省级联审 + RESTART_PROCESS_MAP.put(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode(), + provincialDeptManage::restartTheProcess); + //终审 + RESTART_PROCESS_MAP.put(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode(), + finalAcceptanceManage::restartProcess); + } + + public static Function getRestartFunction(Integer status) { + return RESTART_PROCESS_MAP.get(status); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AnnualPlanHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AnnualPlanHandle.java index 50dd02a..6282d8a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AnnualPlanHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AnnualPlanHandle.java @@ -1,5 +1,6 @@ package com.hz.pm.api.projectlib.handle; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.model.constant.CommonConst; @@ -52,7 +53,7 @@ public class AnnualPlanHandle extends AbstractProcessBusinessHandle { DEPARTMENT_JOINT_REVIEW_FAILED ); - public AnnualPlanHandle(INdProjectStatusChangeService projectStatusChangeService, IProjectService projectService){ + public AnnualPlanHandle(INdProjectStatusChangeService projectStatusChangeService, IProjectService projectService) { this.projectStatusChangeService = projectStatusChangeService; this.projectService = projectService; } @@ -69,7 +70,7 @@ public class AnnualPlanHandle extends AbstractProcessBusinessHandle { List allVersionProjectIds = projectService.getAllVersionProjectId(project); // 项目状态为年度计划中之前的状态 - if (fieldList.contains(status)){ + if (fieldList.contains(status)) { processDetailVO.setStepStatus(StepStatusEnum.NOT_START); processDetailVO.setProcessName(CommonConst.ANNUAL_PLAN); processSchedule.add(processDetailVO); @@ -77,33 +78,30 @@ public class AnnualPlanHandle extends AbstractProcessBusinessHandle { } // 项目状态为年度计划中 - if (ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode().equals(status)){ + LambdaQueryWrapper pscQuery = Wrappers.lambdaQuery(ProjectStatusChange.class) + .in(ProjectStatusChange::getProjectId, allVersionProjectIds) + .last(BizConst.LIMIT_1); + if (ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode().equals(status)) { // 根据部门联审通过的时间获取 - ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) - .in(ProjectStatusChange::getProjectId, allVersionProjectIds) - .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS.name()) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(projectStatusChange)){ + pscQuery.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS); + ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(pscQuery); + if (Objects.nonNull(projectStatusChange)) { processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); } } else if (ProjectStatusEnum.BE_SUSPENDED.getCode().equals(status)) { // 根据年度计划暂缓的时间获取 - ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) - .in(ProjectStatusChange::getProjectId, allVersionProjectIds) - .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND.name()) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(projectStatusChange)){ + pscQuery.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND); + ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(pscQuery); + if (Objects.nonNull(projectStatusChange)) { processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); processDetailVO.setStepStatus(StepStatusEnum.REJECTED); } } else { // 根据开启方案申报的时间获取 - ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) - .in(ProjectStatusChange::getProjectId, allVersionProjectIds) - .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE.name()) - .last(BizConst.LIMIT_1)); - if(Objects.nonNull(projectStatusChange)){ + pscQuery.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE); + ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(pscQuery); + if (Objects.nonNull(projectStatusChange)) { processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java index bb9ee78..c9ef5a1 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java @@ -6,7 +6,7 @@ import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.model.constant.ProjectDeclareConst; import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; import com.hz.pm.api.common.statemachine.contant.RegionContant; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.service.IProjectService; import com.wflow.bean.entity.WflowModels; @@ -84,7 +84,7 @@ public class ProcessExecuteChainHandle { } } else if (processBusinessHandle instanceof ProvinceUnitedReviewHandle) { //省级联审 - if (StateMachineUtils.isCityProject(project) && StateMachineUtils.judgeDeclareAmount(project, + if (StateMachineUtil.isCityProject(project) && StateMachineUtil.judgeDeclareAmount(project, ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)) { handles.add(processBusinessHandle); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java index fc13877..1dbba65 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java @@ -16,7 +16,7 @@ import com.hz.pm.api.common.model.constant.CommonConst; import com.hz.pm.api.common.enumeration.CommonEnum; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.common.model.entity.ExcelExportWriter; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.common.util.BizUtils; import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.datascope.model.DataScopeDTO; @@ -80,7 +80,7 @@ public class AnnualPlanLibManage { private final IProjectService projectService; private final IProjectApplicationService applicationService; - private final StateMachineUtils stateMachine; + private final StateMachineUtil stateMachine; private final UserInfoHelper userInfoHelper; private final IProjectRenewalFundDeclarationService projectRenewalFundDeclarationService; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java index b4e3548..a0a1be6 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java @@ -25,7 +25,7 @@ import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.common.model.entity.ExcelExportWriter; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.common.util.BizUtils; import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.dashboard.handle.ApplicationHandler; @@ -93,6 +93,7 @@ import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletResponse; import java.math.BigDecimal; +import java.math.RoundingMode; import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; @@ -119,7 +120,7 @@ public class ProjectLibManage { private final IProjectApplicationService projectApplicationService; private final GenerateProjectCodeUtil generateProjectCodeUtil; private final IProjectInstService projectInstService; - private final StateMachineUtils stateMachineUtils; + private final StateMachineUtil stateMachineUtil; private final INdProjectDelayApplyService projectDelayApplyService; private final INdProjectApplyBorrowService projectApplyBorrowService; private final IDingOrganizationService dingOrganizationService; @@ -151,12 +152,11 @@ public class ProjectLibManage { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); query.eq(Project::getNewest, Boolean.TRUE); Page page = projectService.page(req.page(), query); - long total; + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } - // List projectCodes = page.getRecords().stream() .map(Project::getProjectCode).collect(Collectors.toList()); @@ -208,7 +208,7 @@ public class ProjectLibManage { //项目查最新 query.eq(Project::getNewest, Boolean.TRUE); Page page = projectService.page(req.page(), query); - long total; + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } @@ -387,11 +387,10 @@ public class ProjectLibManage { public PageVo projectAllListWithPermission(ProjectListReq req, UserFullInfoDTO user) { req = buildProjectLibPermission(req, user); Page page = projectService.pageAllWithPermission(req.page(), req); - long total; + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } - UserFullInfoDTO finalUser = user; Set projectCodes = page.getRecords().stream() .map(ProjectPO::getProjectCode).collect(Collectors.toSet()); @@ -443,10 +442,10 @@ public class ProjectLibManage { item.setProcessStatus(w.getProcessStatus()); item.setInstCode(w.getInstCode()); item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - if (finalUser.getIsOrgAdmin() && + if (user.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) - && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) - && w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) { + && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(user.getEmpPosUnitCode()) + && w.getSuperOrgCode().equals(user.getEmpPosUnitCode())) { item.setCanPreDeclared(Boolean.TRUE); } item.setApprovedAmount(w.getApprovalAmount()); @@ -469,11 +468,10 @@ public class ProjectLibManage { public PageVo libListWithPermission(ProjectListReq req, UserFullInfoDTO user) { req = buildProjectLibPermission(req, user); Page page = projectService.pagelibWithPermission(req.page(), req); - long total; + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } - UserFullInfoDTO finalUser = user; Set projectCodes = page.getRecords().stream() .map(ProjectPO::getProjectCode).collect(Collectors.toSet()); @@ -525,10 +523,10 @@ public class ProjectLibManage { item.setProcessStatus(w.getProcessStatus()); item.setInstCode(w.getInstCode()); item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - if (finalUser.getIsOrgAdmin() && + if (user.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) - && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) - && w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) { + && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(user.getEmpPosUnitCode()) + && w.getSuperOrgCode().equals(user.getEmpPosUnitCode())) { item.setCanPreDeclared(Boolean.TRUE); } item.setApprovedAmount(w.getApprovalAmount()); @@ -552,15 +550,14 @@ public class ProjectLibManage { UserFullInfoDTO user) { req = buildProjectLibPermission(req, user); Page page = projectService.pagelibWithPermission(req.page(), req); - long total; + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } - UserFullInfoDTO finalUser = user; Set instCodes = page.getRecords().stream() - .filter(p -> StringUtils.isNotBlank(p.getInstCode())) - .map(ProjectPO::getInstCode).collect(Collectors.toSet()); + .map(ProjectPO::getInstCode) + .filter(StringUtils::isNotBlank).collect(Collectors.toSet()); List tasks = taskService.createTaskQuery() .processInstanceIdIn(instCodes) .orderByTaskCreateTime() @@ -594,10 +591,10 @@ public class ProjectLibManage { item.setInstCode(w.getInstCode()); item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); item.setApproveUsers(buildApproveUsers(w.getInstCode(), map, userMap)); - if (finalUser.getIsOrgAdmin() && + if (user.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) - && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) - && w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) { + && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(user.getEmpPosUnitCode()) + && w.getSuperOrgCode().equals(user.getEmpPosUnitCode())) { item.setCanPreDeclared(Boolean.TRUE); } item.setApprovedAmount(w.getApprovalAmount()); @@ -809,13 +806,11 @@ public class ProjectLibManage { .eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); Optional.ofNullable(renewalDeclarations).ifPresent(declarations -> - declarations.forEach(declaration -> { - annualAmounts.add(AnnualAmountVO.builder() - .projectId(projectInfo.getId()) - .projectYear(declaration.getProjectYear()) - .annualAmount(declaration.getAnnualPaymentAmount()) - .build()); - }) + declarations.forEach(declaration -> annualAmounts.add(AnnualAmountVO.builder() + .projectId(projectInfo.getId()) + .projectYear(declaration.getProjectYear()) + .annualAmount(declaration.getAnnualPaymentAmount()) + .build())) ); vo.setAnnualAccumulateAmountList(annualAmounts); } @@ -1032,7 +1027,7 @@ public class ProjectLibManage { project.setCreateOn(LocalDateTime.now()); project.setUpdateOn(LocalDateTime.now()); project.setIsBackReject(Boolean.FALSE); - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); projectService.save(project); oldProject.setIsBackReject(Boolean.TRUE); @@ -1156,7 +1151,7 @@ public class ProjectLibManage { project.setIsBackReject(isBackReject); //终验材料 project.setFinalAcceptanceMaterials(dto.getFinalAcceptanceMaterials()); - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); oldProject.setIsBackReject(isBackReject); projectService.updateById(oldProject); @@ -1193,7 +1188,7 @@ public class ProjectLibManage { project.setUpdateOn(LocalDateTime.now()); // 标识保存的项目信息是否为建设方案申报项目 project.setIsConstruct(Boolean.FALSE); - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); oldProject.setIsBackReject(Boolean.TRUE); projectService.updateById(oldProject); @@ -1218,7 +1213,7 @@ public class ProjectLibManage { /** * 获取项目初步方案详情 * - * @param projectId + * @param projectId \ * @return com.hz.pm.api.projectlib.model.vo.ProjectDetailVO * @author CMM * @since 2023/07/12 11:43 @@ -1253,17 +1248,16 @@ public class ProjectLibManage { private boolean checkCanRead(Set subOrgSet, Project project) { // 从申请借阅信息表中查出本单位及下属单位审批通过的项目 - HashSet borrowProjectIdSet = new HashSet<>(); - List applyBorrowProjectIdList = projectApplyBorrowService - .list(Wrappers.lambdaQuery(ProjectApplyBorrow.class) - .in(ProjectApplyBorrow::getApplyBorrowEmpPosUnitCode, subOrgSet) - .eq(ProjectApplyBorrow::getIsSuccess, Boolean.TRUE)) - .stream().map(ProjectApplyBorrow::getProjectId).filter(borrowProjectIdSet::add).collect(Collectors.toList()); + LambdaQueryWrapper query = Wrappers.lambdaQuery(ProjectApplyBorrow.class) + .select(ProjectApplyBorrow::getProjectId) + .in(ProjectApplyBorrow::getApplyBorrowEmpPosUnitCode, subOrgSet) + .eq(ProjectApplyBorrow::getIsSuccess, Boolean.TRUE); + List applyBorrowProjectIdList = CollUtils.fieldList(projectApplyBorrowService.list(query), ProjectApplyBorrow::getProjectId); return applyBorrowProjectIdList.contains(project.getId()); } private Set getSubOrgList(String empPosUnitCode) { - HashSet orgSet = new HashSet<>(); + Set orgSet = new HashSet<>(); // 先将自己加入子集 orgSet.add(empPosUnitCode); Set subOrgList = dingOrganizationService @@ -1505,7 +1499,7 @@ public class ProjectLibManage { PaymentPlanVO vo = BeanUtil.copyProperties(p, PaymentPlanVO.class); vo.setRatio((Objects.isNull(totalAmount) || totalAmount.compareTo(BigDecimal.ZERO) == 0) ? "0%" : p.getPaymentAmount().multiply(BigDecimal.valueOf(100)) - .divide(totalAmount, BigDecimal.ROUND_CEILING, BigDecimal.ROUND_CEILING) + "%"); + .divide(totalAmount, BigDecimal.ROUND_CEILING, RoundingMode.CEILING) + "%"); return vo; }) .collect(Collectors.toList()); @@ -1565,7 +1559,7 @@ public class ProjectLibManage { //2.要判断 项目在当前状态 有没有被驳回和退回过 //当前项目状态流程的 实例 看看是不是有2个以上 有2个说明 有退回 驳回 - Boolean isChangeRecord = todoService.isChangeRecord(projectId); + boolean isChangeRecord = todoService.isChangeRecord(projectId); if (!isChangeRecord) { return res; } @@ -1623,7 +1617,7 @@ public class ProjectLibManage { private void saveApplication(ProjectDTO projectDto, Project project, Boolean isConstruct) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); //保存项目应用 - Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication()) + boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication()) ? Boolean.TRUE : Boolean.FALSE; //采取批量删除 批量添加的方式 Integer version = Objects.nonNull(project.getVersion()) ? project.getVersion() : 1; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java index 47b1c04..2ac2ae1 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java @@ -289,7 +289,6 @@ public class ProjectRenewalFundManage { } vo.setProjectName(operationBaseinfo.getBaseProjName()); vo.setProjectType(operationBaseinfo.getBaseProjType()); -// vo.setStage(project.getStage()); vo.setStatus(StringUtils.isNotBlank(operationBaseinfo.getBaseProjSetProg()) ? Integer.parseInt(operationBaseinfo.getBaseProjSetProg()) : null); vo.setBuildOrgName(operationBaseinfo.getBaseBuildDeprt()); @@ -307,19 +306,17 @@ public class ProjectRenewalFundManage { .eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE) .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); Optional.ofNullable(renewalDeclarations).ifPresent(declarations -> - declarations.forEach(declaration -> { - annualAmounts.add(AnnualAmountVO.builder() - .projectId(operationBaseinfo.getId()) - .projectCode(operationBaseinfo.getBaseProjId()) - .projectYear(declaration.getProjectYear()) - .annualAmount(declaration.getAnnualPaymentAmount()) - .haveAmount(declaration.getHaveAmount()) - .govOwnFinanceAmount(declaration.getGovOwnFinanceAmount()) - .bankLendingAmount(declaration.getBankLendingAmount()) - .govSuperiorFinanceAmount(declaration.getGovSuperiorFinanceAmount()) - .otherAmount(declaration.getOtherAmount()) - .build()); - }) + declarations.forEach(declaration -> annualAmounts.add(AnnualAmountVO.builder() + .projectId(operationBaseinfo.getId()) + .projectCode(operationBaseinfo.getBaseProjId()) + .projectYear(declaration.getProjectYear()) + .annualAmount(declaration.getAnnualPaymentAmount()) + .haveAmount(declaration.getHaveAmount()) + .govOwnFinanceAmount(declaration.getGovOwnFinanceAmount()) + .bankLendingAmount(declaration.getBankLendingAmount()) + .govSuperiorFinanceAmount(declaration.getGovSuperiorFinanceAmount()) + .otherAmount(declaration.getOtherAmount()) + .build())) ); vo.setAnnualAccumulateAmountList(annualAmounts); } @@ -332,7 +329,6 @@ public class ProjectRenewalFundManage { * @return */ public Long declared(ProjectRenewalFundDeclarationDTO dto) { - Integer projectYear = dto.getProjectYear(); //要判断 项目id 是否 以及状态是 已验收 String projectCode = dto.getProjectCode(); Project project = projectService.getProjectByCode(projectCode); @@ -388,9 +384,6 @@ public class ProjectRenewalFundManage { .throwMessage("续建资金年度错误!"); } - //判断金额 -// checkPaymentAmount(projectCode,projectYear,dto.getAnnualPaymentAmount()); - declaration.setApprovalStatus(ProjectRenewalApprovalStatusEnum.PENDING.name()); if(Objects.nonNull(project)){ declaration.setRegionCode(project.getAreaCode()); @@ -417,16 +410,16 @@ public class ProjectRenewalFundManage { .eq(PaymentPlan::getProjectCode, projectCode) .orderByAsc(PaymentPlan::getPaymentTime)); VUtils.isTrue(CollUtil.isEmpty(paymentPlans)).throwMessage("未有所选年度的支付计划,无法提交"); - Boolean hasYearPlan = Boolean.FALSE; + boolean hasYearPlan = Boolean.FALSE; for(PaymentPlan plan : paymentPlans){ if(Objects.isNull(plan.getPaymentTime())){ continue; } int year = plan.getPaymentTime().getYear(); - if(Objects.nonNull(year) && projectYear.equals(year)){ + if(projectYear.equals(year)){ hasYearPlan = Boolean.TRUE; - }else if(Objects.nonNull(year) && projectYear.compareTo(year) > 0){ + }else if(projectYear.compareTo(year) > 0){ //2 如果有 这一年前的实际支付金额有没有填 VUtils.isTrue(Objects.isNull(plan.getActualPaymentAmount())) .throwMessage("有漏填写此年度之前年度的实际支付金额,请去合同备案补充"); @@ -552,7 +545,7 @@ public class ProjectRenewalFundManage { .sheet(fileName) .doWrite(collect); } catch (IOException e) { - throw new RuntimeException(e); + throw new BizException(e); } } @@ -593,7 +586,7 @@ public class ProjectRenewalFundManage { .sheet(fileName) .doWrite(collect); } catch (IOException e) { - throw new RuntimeException(e); + throw new BizException(e); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/po/ProjectRenewalFundDeclarationPO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/po/ProjectRenewalFundDeclarationPO.java index 383dcc6..8bdc79a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/po/ProjectRenewalFundDeclarationPO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/po/ProjectRenewalFundDeclarationPO.java @@ -1,8 +1,5 @@ package com.hz.pm.api.projectlib.model.po; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectRenewalAuditReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectRenewalAuditReq.java index 55f6e17..dad252a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectRenewalAuditReq.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectRenewalAuditReq.java @@ -5,9 +5,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.hibernate.validator.constraints.Length; -import javax.validation.constraints.Max; import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; /** * 续建项目审核请求实体 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/INdProjectStatusChangeService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/INdProjectStatusChangeService.java index 420f094..02eb411 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/INdProjectStatusChangeService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/INdProjectStatusChangeService.java @@ -4,6 +4,8 @@ import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; import com.baomidou.mybatisplus.extension.service.IService; +import java.util.Collection; + /** *

* 服务类 @@ -16,4 +18,6 @@ public interface INdProjectStatusChangeService extends IService projectIds); + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/NdProjectStatusChangeServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/NdProjectStatusChangeServiceImpl.java index 75ae37f..94a7b20 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/NdProjectStatusChangeServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/NdProjectStatusChangeServiceImpl.java @@ -10,6 +10,10 @@ import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; +import java.util.Collection; + +import static com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS; + /** *

* 服务实现类 @@ -31,4 +35,12 @@ public class NdProjectStatusChangeServiceImpl extends ServiceImpl projectIds) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(ProjectStatusChange.class) + .in(ProjectStatusChange::getProjectId, projectIds) + .eq(ProjectStatusChange::getEvent, DEPARTMENT_UNITED_REVIEW_PASS) + .last(BizConst.LIMIT_1); + return getOne(query); + } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/OssApiData.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/OssApiData.java index 383e5b7..dd94e92 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/OssApiData.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/OssApiData.java @@ -1,7 +1,5 @@ package com.hz.pm.api.provincial.model.res; -import com.ningdatech.basic.enumeration.Status; -import com.ningdatech.basic.model.ApiStatus; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/OssApiResponse.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/OssApiResponse.java index c1fde78..33f9ca9 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/OssApiResponse.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/OssApiResponse.java @@ -65,7 +65,7 @@ public class OssApiResponse implements Serializable { * @return ApiResponse */ public static OssApiResponse of(Integer respCode, String respMsg, T data) { - return new OssApiResponse(respCode, respMsg, data); + return new OssApiResponse<>(respCode, respMsg, data); } /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java index 44cf746..757b9a2 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java @@ -7,7 +7,7 @@ import com.ningdatech.basic.exception.BizException; import com.ningdatech.file.service.FileService; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.model.constant.ProjectDeclareConst; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.projectdeclared.converter.ApplicationConverter; import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; @@ -211,8 +211,8 @@ public class ProcessEndListener { // 当前项目状态是部门联审中 case DEPARTMENT_JOINT_REVIEW: //如果是 区县 并且 500万及以上要推送省局重大项目 - if (!StateMachineUtils.isCityProject(declaredProject) && - StateMachineUtils.judgeDeclareAmount(declaredProject, + if (!StateMachineUtil.isCityProject(declaredProject) && + StateMachineUtil.judgeDeclareAmount(declaredProject, ProjectDeclareConst.Number.DECLARE_COUNTY_AMOUNT_JUDGEMENT)) { try { List applications = projectApplicationService diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessStartListener.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessStartListener.java index f68964f..e146618 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessStartListener.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessStartListener.java @@ -3,7 +3,7 @@ package com.hz.pm.api.scheduler.listener; import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hz.pm.api.common.model.constant.BizConst; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.entity.ProjectInst; import com.hz.pm.api.projectlib.service.IProjectInstService; @@ -40,7 +40,7 @@ public class ProcessStartListener { private final IProjectService projectService; - private final StateMachineUtils stateMachineUtils; + private final StateMachineUtil stateMachineUtil; @Async @EventListener @@ -82,7 +82,7 @@ public class ProcessStartListener { //如果真的没有实时任务和历史任务 那么说明 该项目没有人审批 需要去调用状态机 Long projectId = projectInst.getProjectId(); Project project = projectService.getNewProject(projectId); - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); project.setUpdateOn(LocalDateTime.now()); projectService.updateById(project); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CheckProvincialReviewResultTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CheckProvincialReviewResultTask.java index a4dba53..516616b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CheckProvincialReviewResultTask.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CheckProvincialReviewResultTask.java @@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.model.constant.ProjectDeclareConst; import com.hz.pm.api.common.model.constant.RegionConst; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.service.IProjectService; @@ -42,7 +42,7 @@ public class CheckProvincialReviewResultTask { private final IJoinReviewProvincialBureauService reviewProvincialBureauService; private final IProjectService projectService; - private final StateMachineUtils stateMachineUtils; + private final StateMachineUtil stateMachineUtil; @Value("${hostname}") private String HOST_NAME; @@ -96,7 +96,7 @@ public class CheckProvincialReviewResultTask { //在省级联审 才调状态机 否则 只改变 联审结果 if(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode().equals( project.getStatus())){ - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); } log.info("已经审批完成 进入下一状态"); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/ProjectStatusFlowTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/ProjectStatusFlowTask.java index a61a406..89f9d44 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/ProjectStatusFlowTask.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/ProjectStatusFlowTask.java @@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.service.IProjectService; -import com.hz.pm.api.scheduler.contants.TaskContant; import com.hz.pm.api.staging.contants.StagingContant; import com.hz.pm.api.staging.model.entity.ProjectStaging; import com.hz.pm.api.staging.service.IProjectStagingService; @@ -20,7 +19,6 @@ import java.net.InetAddress; import java.net.UnknownHostException; import java.time.LocalDateTime; import java.util.List; -import java.util.Map; import java.util.Objects; import java.util.function.Function; @@ -38,9 +36,7 @@ public class ProjectStatusFlowTask { private final IProjectStagingService projectStagingService; private final IProjectService projectService; - - private final ProjectStatusFlowMapUtil projectStatusFlowMapUtil; - + @Value("${hostname}") private String HOST_NAME; @@ -49,44 +45,39 @@ public class ProjectStatusFlowTask { if (HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { //1. 定时取 项目暂存表的数据 去进行状态继续流转 List stagingList = projectStagingService.list(Wrappers.lambdaQuery(ProjectStaging.class) - .eq(ProjectStaging::getDead,Boolean.FALSE) - .le(ProjectStaging::getNextTime, LocalDateTime.now()) - .le(ProjectStaging::getRetryTimes, StagingContant.Retry.MAX_RETRY_TIMES) - .orderByAsc(ProjectStaging::getProjectId)); + .eq(ProjectStaging::getDead, Boolean.FALSE) + .le(ProjectStaging::getNextTime, LocalDateTime.now()) + .le(ProjectStaging::getRetryTimes, StagingContant.Retry.MAX_RETRY_TIMES) + .orderByAsc(ProjectStaging::getProjectId)); - log.info("需要状态流转的项目 size:{} :{}",stagingList.size(), JSON.toJSONString(stagingList)); - if(CollUtil.isEmpty(stagingList)){ + log.info("需要状态流转的项目 size:{} :{}", stagingList.size(), JSON.toJSONString(stagingList)); + if (CollUtil.isEmpty(stagingList)) { log.info("没有需要状态流转的项目!"); return; } //遍历 - for(ProjectStaging projectStaging : stagingList){ - try{ + for (ProjectStaging projectStaging : stagingList) { + try { Project project = projectService.getById(projectStaging.getProjectId()); - if(Objects.isNull(project)){ - log.info("此项目 【{}】 不存在",projectStaging.getProjectId()); + if (Objects.isNull(project)) { + log.info("此项目 【{}】 不存在", projectStaging.getProjectId()); continue; } - //2. 用函数map 定位到 状态流转的函数 - Map> reStartProcessMap = - projectStatusFlowMapUtil.statusFlowFunctionMap; - - if(!reStartProcessMap.containsKey(project.getStatus())){ - log.info("此项目 【{}】 当前状态 【{}】,没有对应流转函数",projectStaging.getProjectId(),project.getStatus()); + Function flowFunction = ProjectStatusFlowMapUtil.getFlowFunction(project.getStatus()); + if (flowFunction == null) { + log.info("此项目 【{}】 当前状态 【{}】,没有对应流转函数", projectStaging.getProjectId(), project.getStatus()); continue; } - - Function functionMap = reStartProcessMap.get(project.getStatus()); //执行对应的函数 - if(functionMap.apply(project)){ + if (flowFunction.apply(project)) { //执行成功了 删除暂存的数据 projectStagingService.removeById(projectStaging); } - }catch (Exception e){ + } catch (Exception e) { log.error("项目流转 异常 projectId:【" + projectStaging.getProjectId() + "】 异常内容:" + e.getMessage()); - }finally { + } finally { //增加重试的次数 和下次扫描时间 projectStagingService.addRetryTimes(projectStaging); } @@ -94,11 +85,4 @@ public class ProjectStatusFlowTask { } } -// @Scheduled(cron = "0 */1 * * * ?") - public void nonUserFinishFlowToNext() throws UnknownHostException { - //测试暂时用自己HOST - if (TaskContant.Host.HOST_ZPF.equals(InetAddress.getLocalHost().getHostName())) { - - } - } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/ProjectStatusFlowMapUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/ProjectStatusFlowMapUtil.java index 284eec5..fe811b3 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/ProjectStatusFlowMapUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/ProjectStatusFlowMapUtil.java @@ -1,5 +1,6 @@ package com.hz.pm.api.staging.utils; +import cn.hutool.core.lang.func.Func; import com.google.common.collect.Maps; import com.hz.pm.api.projectdeclared.manage.ReviewByDeptJointManage; import com.hz.pm.api.projectdeclared.manage.ReviewByProvincialDeptManage; @@ -19,25 +20,27 @@ import java.util.function.Function; */ @Component public class ProjectStatusFlowMapUtil { - @Autowired - private ReviewByProvincialDeptManage provincialDeptManage; - @Autowired - private ReviewByDeptJointManage reviewByDeptJointManage; + private static final Map> STATUS_FLOW_FUNCTION_MAP = Maps.newHashMap(); - public Map> statusFlowFunctionMap = Maps.newHashMap(); + + public static Function getFlowFunction(Integer status){ + return STATUS_FLOW_FUNCTION_MAP.get(status); + } /** - * 初始化业务分派逻辑,代替了if-else部分 - * key: 枚举 状态值 - * value: lambda表达式,最终会获取发起实例的函数 + * 初始化业务分派逻辑,代替了if-else部分 + * key: 枚举 状态值 + * value: lambda表达式,最终会获取发起实例的函数 */ - public ProjectStatusFlowMapUtil(){ + public ProjectStatusFlowMapUtil(ReviewByProvincialDeptManage provincialDeptManage, + ReviewByDeptJointManage reviewByDeptJointManage) { //省级部门联审 - statusFlowFunctionMap.put(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode(), - project->provincialDeptManage.startTheProcess(project)); + STATUS_FLOW_FUNCTION_MAP.put(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode(), + provincialDeptManage::startTheProcess); //部门联审 - statusFlowFunctionMap.put(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode(), - project->reviewByDeptJointManage.startTheProcess(project)); + STATUS_FLOW_FUNCTION_MAP.put(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode(), + reviewByDeptJointManage::startTheProcess); } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/WorkNoticeFlowMapUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/WorkNoticeFlowMapUtil.java index e26cec3..2ff90b9 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/WorkNoticeFlowMapUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/WorkNoticeFlowMapUtil.java @@ -1,12 +1,10 @@ package com.hz.pm.api.staging.utils; -import java.util.Map; -import javax.annotation.PostConstruct; - +import com.google.common.collect.Maps; import lombok.AllArgsConstructor; import org.springframework.stereotype.Component; -import com.google.common.collect.Maps; -import lombok.RequiredArgsConstructor; + +import java.util.Map; /** * 工作通知流转 事件函数MAP diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/NotifyMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/NotifyMapper.java index 96baca1..d52b503 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/NotifyMapper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/mapper/NotifyMapper.java @@ -1,7 +1,6 @@ package com.hz.pm.api.sys.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hz.pm.api.sys.model.entity.Notice; import com.hz.pm.api.sys.model.entity.Notify; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MeetingReviewMsgExtraDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MeetingReviewMsgExtraDTO.java index 84b5bdc..2520e5a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MeetingReviewMsgExtraDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MeetingReviewMsgExtraDTO.java @@ -1,5 +1,8 @@ package com.hz.pm.api.sys.model.dto; +import lombok.Data; +import lombok.EqualsAndHashCode; + /** *

* MeetingReviewMsgExtraDTO @@ -8,6 +11,8 @@ package com.hz.pm.api.sys.model.dto; * @author WendyYang * @since 2023/4/12 **/ +@Data +@EqualsAndHashCode(callSuper = true) public class MeetingReviewMsgExtraDTO extends AbstractMsgExtraDTO { private Long meetingId; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MenuSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MenuSaveDTO.java index 008e59e..4fa853e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MenuSaveDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/MenuSaveDTO.java @@ -6,7 +6,6 @@ import io.swagger.annotations.ApiModelProperty; import lombok.*; import lombok.experimental.Accessors; -import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.io.Serializable; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Menu.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Menu.java index a9b55b8..50e15e9 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Menu.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/Menu.java @@ -33,7 +33,7 @@ import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; @TableName("nd_menu") @ApiModel(value = "Menu", description = "菜单") @AllArgsConstructor -public class Menu extends MenuTreeEntity { +public class Menu extends MenuTreeEntity

{ private static final long serialVersionUID = 1L; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/MenuRoleVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/MenuRoleVO.java index c1c6014..604528e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/MenuRoleVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/MenuRoleVO.java @@ -24,7 +24,7 @@ import lombok.experimental.Accessors; @Accessors(chain = true) @ApiModel(value = "RoleMenuVO", description = "菜单") @AllArgsConstructor -public class MenuRoleVO extends MenuTreeEntity { +public class MenuRoleVO extends MenuTreeEntity { private static final long serialVersionUID = 1L; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/enumeration/IsOrNotEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/enumeration/IsOrNotEnum.java index 7e605b7..2f147e6 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/enumeration/IsOrNotEnum.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/enumeration/IsOrNotEnum.java @@ -16,7 +16,6 @@ import lombok.NoArgsConstructor; */ @Getter @AllArgsConstructor -@NoArgsConstructor @ApiModel(value = "IsOrNotEnum", description = "是否-枚举") public enum IsOrNotEnum { /** @@ -30,16 +29,8 @@ public enum IsOrNotEnum { IS(1, "是"); - private Integer code; - private String desc; - - public String getDesc() { - return desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } + private final Integer code; + private final String desc; public static String getDescByCode(Integer code) { if (Objects.isNull(code)) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java index 6bfe1fd..2eadbac 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java @@ -38,7 +38,7 @@ import org.springframework.transaction.annotation.Transactional; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.basic.exception.BizException; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.projectdeclared.manage.DeclaredProjectManage; import com.hz.pm.api.projectdeclared.model.dto.ProjectDraftSaveDTO; import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; @@ -82,7 +82,7 @@ public class HandlerManage { private final TaskService taskService; private final HistoryService historyService; private final IProjectService projectService; - private final StateMachineUtils stateMachineUtils; + private final StateMachineUtil stateMachineUtil; private final ProcessInstanceService processInstanceService; private final IProjectApplicationService projectApplicationService; private final IProjectStagingService projectStagingService; @@ -102,10 +102,11 @@ public class HandlerManage { /** * 审核通过后 所处理的逻辑 + * * @param declaredProject * @param instance */ - public void afterPassTodo(Project declaredProject, HistoricProcessInstance instance){ + public void afterPassTodo(Project declaredProject, HistoricProcessInstance instance) { Long userId = LoginUserUtil.getUserId(); // 获取流程通过后的流程实例 HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() @@ -118,7 +119,7 @@ public class HandlerManage { .last(BizConst.LIMIT_1)); Integer instType = projectInst.getInstType(); InstTypeEnum instTypeEnum = InstTypeEnum.getByCode(instType); - if (Objects.isNull(instTypeEnum)){ + if (Objects.isNull(instTypeEnum)) { throw new BizException("当前审批流类型不存在,流程类型code:" + instType); } @@ -154,20 +155,20 @@ public class HandlerManage { // 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 if (HisProInsEndActId.END.equals(newInstance.getEndActivityId())) { // 如果是申请延期和申请借阅审批流程,不走状态机 - if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) || InstTypeEnum.APPLY_BORROW.getCode().equals(instType)){ + if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) || InstTypeEnum.APPLY_BORROW.getCode().equals(instType)) { switch (instTypeEnum) { case APPLY_DELAY: // 保存延期申请记录,更新项目建设周期和计划验收时间 - updateProjectDelayApplyInfo(declaredProject,instanceId); + updateProjectDelayApplyInfo(declaredProject, instanceId); break; case APPLY_BORROW: // 更新申请借阅状态为成功 - updateProjectApplyBorrowInfo(declaredProject,instanceId); + updateProjectApplyBorrowInfo(declaredProject, instanceId); break; default: throw new BizException("传入实例类型错误: " + instTypeEnum); } - }else { + } else { switch (Objects.requireNonNull(ProjectStatusEnum.match(declaredProject.getStatus()))) { // 当前项目状态是预审中 case PRE_APPLYING: @@ -180,10 +181,10 @@ public class HandlerManage { case DEPARTMENT_JOINT_REVIEW: log.info("部门联审成功后 要判断是否是 区县重大项目"); - Boolean isImport = !StateMachineUtils.isCityProject(declaredProject) && - StateMachineUtils.judgeDeclareAmount(declaredProject, + Boolean isImport = !StateMachineUtil.isCityProject(declaredProject) && + StateMachineUtil.judgeDeclareAmount(declaredProject, ProjectDeclareConst.Number.DECLARE_COUNTY_AMOUNT_JUDGEMENT); - log.info("isImport :{}",isImport); + log.info("isImport :{}", isImport); //如果是 区县 并且 500万及以上要推送省局重大项目 if (isImport) { try { @@ -191,7 +192,7 @@ public class HandlerManage { .list(Wrappers.lambdaQuery(ProjectApplication.class) .eq(ProjectApplication::getProjectCode, declaredProject.getProjectCode())); joinReviewProvincialBureauService.pushImportProject( - ApplicationConverter.convertProject(declaredProject, applications, fileService,active)); + ApplicationConverter.convertProject(declaredProject, applications, fileService, active)); updatePassProjectStatus(userId, declaredProject); break; } catch (Exception e) { @@ -210,15 +211,15 @@ public class HandlerManage { // 当前项目状态是终验审核中 updatePassProjectStatus(userId, declaredProject); // 判断是否 保存建设建议信息 - saveContructionSuggestionInfo(instance.getId(),declaredProject); + saveContructionSuggestionInfo(instance.getId(), declaredProject); break; default: throw new BizException("传入项目状态错误: " + declaredProject.getStatus()); } } //发送消息 - noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), - PASS_MSG_TEMPLATE2,MsgTypeEnum.PROJECT_REVIEW_PASS); + noticeManage.sendNotice(instance.getStartUserId(), userId, declaredProject, instance.getProcessDefinitionName(), + PASS_MSG_TEMPLATE2, MsgTypeEnum.PROJECT_REVIEW_PASS); } else { // 若有下一个审核人(当前节点的用户),会签/或签会有多个 // 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 @@ -228,14 +229,15 @@ public class HandlerManage { throw new BizException("审核人信息不存在!"); } //发送消息 - noticeManage.sendNotice(currentEmployeeCode,userId,declaredProject,instance.getProcessDefinitionName(), - PASS_MSG_TEMPLATE,MsgTypeEnum.PROJECT_REVIEW); + noticeManage.sendNotice(currentEmployeeCode, userId, declaredProject, instance.getProcessDefinitionName(), + PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); } } } /** * 去保存 建设建议信息 + * * @param instanceId * @param project */ @@ -244,7 +246,7 @@ public class HandlerManage { .eq(ProjectConstructionSuggestions::getProjectCode, project.getProjectCode()) .eq(ProjectConstructionSuggestions::getInstanceId, instanceId) .last(BizConst.LIMIT_1)); - if(Objects.isNull(pcs)){ + if (Objects.isNull(pcs)) { log.info("没有该流程的 建设 建议信息"); return; } @@ -257,7 +259,7 @@ public class HandlerManage { public void updateProjectApplyBorrowInfo(Project declaredProject, String instanceId) { // 获取申请借阅信息 - ProjectApplyBorrow projectApplyBorrow = projectApplyBorrowService.getOne(Wrappers.lambdaQuery(ProjectApplyBorrow.class) + ProjectApplyBorrow projectApplyBorrow = projectApplyBorrowService.getOne(Wrappers.lambdaQuery(ProjectApplyBorrow.class) .eq(ProjectApplyBorrow::getProjectId, declaredProject.getId()) .eq(ProjectApplyBorrow::getInstanceId, instanceId)); // 更新项目借阅信息为成功 @@ -297,6 +299,7 @@ public class HandlerManage { /** * 驳回后 所处理的逻辑 + * * @param declaredProject * @param instance */ @@ -313,8 +316,8 @@ public class HandlerManage { updateRejectProjectStatus(userId, declaredProject, instType); } //发送消息 - noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), - REJECT_MSG_TEMPLATE,MsgTypeEnum.PROJECT_REVIEW_REJECT); + noticeManage.sendNotice(instance.getStartUserId(), userId, declaredProject, instance.getProcessDefinitionName(), + REJECT_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW_REJECT); } /** @@ -352,7 +355,7 @@ public class HandlerManage { private void saveToDraft(Project declaredProject) { ProjectDraftSaveDTO draftSaveDto = new ProjectDraftSaveDTO(); ProjectDTO projectInfo = new ProjectDTO(); - BeanUtils.copyProperties(declaredProject,projectInfo); + BeanUtils.copyProperties(declaredProject, projectInfo); // 查询出项目关联的应用信息 List applicationList = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) .eq(ProjectApplication::getProjectId, declaredProject.getId())); @@ -362,7 +365,7 @@ public class HandlerManage { return applicationDTO; }).collect(Collectors.toList()); projectInfo.setApplicationList(applicationDTOList); - HashMap dynamicMap = JSON.parseObject(declaredProject.getDynamicForm(), HashMap.class); + HashMap dynamicMap = JSON.parseObject(declaredProject.getDynamicForm(), HashMap.class); projectInfo.setDynamicForm(dynamicMap); draftSaveDto.setProjectInfo(projectInfo); declaredProjectManage.saveToDraft(draftSaveDto); @@ -370,6 +373,7 @@ public class HandlerManage { /** * 删除项目的所有信息 + * * @param declaredProject */ public void deleteProjectRelated(Project declaredProject) { @@ -377,11 +381,12 @@ public class HandlerManage { projectService.removeById(declaredProject); //删除app信息 projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectId,declaredProject.getId())); + .eq(ProjectApplication::getProjectId, declaredProject.getId())); } /** * 退回审核后 所处理的逻辑 + * * @param declaredProject * @param instance */ @@ -394,21 +399,21 @@ public class HandlerManage { Integer instType = projectInst.getInstType(); LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(); // 如果是预审审批或建设方案退回,需要重新盖章,原来盖过章的文件要清空 - if (InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType)){ - updateWrapper.set(Project::getPretrialFileId,null) - .set(Project::getPretrialFileName,null) - .eq(Project::getId,declaredProject.getId()); + if (InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType)) { + updateWrapper.set(Project::getPretrialFileId, null) + .set(Project::getPretrialFileName, null) + .eq(Project::getId, declaredProject.getId()); projectService.update(updateWrapper); } else if (InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(instType)) { - updateWrapper.set(Project::getConstructFileId,null) - .set(Project::getConstructFileName,null) - .eq(Project::getId,declaredProject.getId()); + updateWrapper.set(Project::getConstructFileId, null) + .set(Project::getConstructFileName, null) + .eq(Project::getId, declaredProject.getId()); projectService.update(updateWrapper); } // 给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被退回,请及时处理。 //发送消息 - noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), - BACK_MSG_TEMPLATE,MsgTypeEnum.PROJECT_REVIEW_BACK); + noticeManage.sendNotice(instance.getStartUserId(), userId, declaredProject, instance.getProcessDefinitionName(), + BACK_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW_BACK); } @@ -423,12 +428,12 @@ public class HandlerManage { */ public void updatePassProjectStatus(Long userId, Project declaredProject) { try { - stateMachineUtils.pass(declaredProject); + stateMachineUtil.pass(declaredProject); declaredProject.setUpdateOn(LocalDateTime.now()); declaredProject.setUpdateBy(userId); projectService.updateById(declaredProject); } catch (Exception e) { - log.error("状态机执行失败",e); + log.error("状态机执行失败", e); throw new BizException("状态机执行失败!"); } } @@ -444,21 +449,21 @@ public class HandlerManage { * @since 2023/02/08 */ private void updateRejectProjectStatus(Long userId, Project declaredProject, Integer instType) { - stateMachineUtils.reject(declaredProject); + stateMachineUtil.reject(declaredProject); LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(); declaredProject.setUpdateOn(LocalDateTime.now()); declaredProject.setUpdateBy(userId); projectService.updateById(declaredProject); // 如果是预审审批驳回,需要重新盖章,原来盖过章的文件要清空 - if (InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType)){ - updateWrapper.set(Project::getPretrialFileId,null) - .set(Project::getPretrialFileName,null) - .eq(Project::getId,declaredProject.getId()); + if (InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType)) { + updateWrapper.set(Project::getPretrialFileId, null) + .set(Project::getPretrialFileName, null) + .eq(Project::getId, declaredProject.getId()); projectService.update(updateWrapper); - }else if (InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(instType)) { - updateWrapper.set(Project::getConstructFileId,null) - .set(Project::getConstructFileName,null) - .eq(Project::getId,declaredProject.getId()); + } else if (InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(instType)) { + updateWrapper.set(Project::getConstructFileId, null) + .set(Project::getConstructFileName, null) + .eq(Project::getId, declaredProject.getId()); projectService.update(updateWrapper); } } @@ -476,12 +481,12 @@ public class HandlerManage { public void updateWithdrawProjectStatus(Long userId, Project declaredProject) { // 删除关联表信息 projectInstService.remove(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getProjectId,declaredProject.getId()) - .eq(ProjectInst::getInstCode,declaredProject.getInstCode())); + .eq(ProjectInst::getProjectId, declaredProject.getId()) + .eq(ProjectInst::getInstCode, declaredProject.getInstCode())); //删除项目的实例信息 historyService.deleteHistoricProcessInstance(declaredProject.getInstCode()); - stateMachineUtils.withDraw(declaredProject); + stateMachineUtil.withDraw(declaredProject); declaredProject.setUpdateOn(LocalDateTime.now()); declaredProject.setUpdateBy(userId); declaredProject.setInstCode(TodoCenterConstant.Declared.NULL_INST_CODE); @@ -489,22 +494,21 @@ public class HandlerManage { } public void deleteBackComments(List approves) { - if(CollUtil.isNotEmpty(approves)){ - for(HistoricVariableInstance approve : approves){ - if(approve.getValue() instanceof ProcessHandlerEnum){ - if(ProcessHandlerEnum.BACK.equals(ProcessHandlerEnum.getEnumByName(String.valueOf(approve.getValue())))){ - runtimeService.removeVariable(approve.getProcessInstanceId(),approve.getVariableName()); + if (CollUtil.isNotEmpty(approves)) { + for (HistoricVariableInstance approve : approves) { + if (approve.getValue() instanceof ProcessHandlerEnum) { + if (ProcessHandlerEnum.BACK.equals(ProcessHandlerEnum.getEnumByName(String.valueOf(approve.getValue())))) { + runtimeService.removeVariable(approve.getProcessInstanceId(), approve.getVariableName()); Comment comment; Optional first = taskService.getProcessInstanceComments(approve.getProcessInstanceId()) .stream() .filter(c -> c.getTaskId().equals(approve.getVariableName().replace("approve_", StringUtils.EMPTY))) .findFirst(); - if (first.isPresent()){ + if (first.isPresent()) { comment = first.get(); taskService.deleteComment(comment.getId()); } - break; } } @@ -514,27 +518,25 @@ public class HandlerManage { /** * 判断是否包含 此任务 - * @param progressNodes - * @param taskId - * @return + * + * @param progressNodes \ + * @param taskId \ + * @return \ */ - public static Boolean checkIsContainsTask(List progressNodes, String taskId) { - if(CollUtil.isEmpty(progressNodes)){ + public static boolean checkIsContainsTask(List progressNodes, String taskId) { + if (CollUtil.isEmpty(progressNodes)) { return Boolean.FALSE; } - final Boolean[] res = {Boolean.FALSE}; - progressNodes.forEach(p -> { - if(p.getTaskId().equals(taskId)){ - res[0] = Boolean.TRUE; - return; + for (ProgressNode node : progressNodes) { + if (node.getTaskId().equals(taskId)) { + return Boolean.TRUE; } - if(CollUtil.isNotEmpty(p.getChildren()) && - (checkIsContainsTask(p.getChildren(),taskId))){ - res[0] = Boolean.TRUE; - return; + if (CollUtil.isNotEmpty(node.getChildren()) && + (checkIsContainsTask(node.getChildren(), taskId))) { + return Boolean.TRUE; } - }); - return res[0]; + } + return Boolean.FALSE; } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/ITodoService.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/ITodoService.java index 1acd79b..62b0eaa 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/ITodoService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/ITodoService.java @@ -17,5 +17,5 @@ public interface ITodoService { */ ProcessProgressDetailVO getProcessDetail(ProcessDetailReq request) ; - Boolean isChangeRecord(Long projectId) ; + boolean isChangeRecord(Long projectId) ; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/TodoServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/TodoServiceImpl.java index 3c80d14..768111f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/TodoServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/TodoServiceImpl.java @@ -98,7 +98,7 @@ public class TodoServiceImpl implements ITodoService { * @param user * @return */ - private Boolean checkHighLine(List progressInfo, String taskId, UserInfoDetails user) { + private boolean checkHighLine(List progressInfo, String taskId, UserInfoDetails user) { if(CollUtil.isEmpty(progressInfo)){ return Boolean.FALSE; } @@ -122,7 +122,7 @@ public class TodoServiceImpl implements ITodoService { .equals(userFullInfoDTO.getEmpPosUnitCode())){ //说明是此单位的人 //那么要去看 taskId 是不是 在这个单位内的任务 - Boolean isContainsTask = HandlerManage.checkIsContainsTask(children,taskId); + boolean isContainsTask = HandlerManage.checkIsContainsTask(children,taskId); if(isContainsTask){ res[0] = Boolean.TRUE; return; @@ -139,7 +139,7 @@ public class TodoServiceImpl implements ITodoService { * @return */ @Override - public Boolean isChangeRecord(Long projectId) { + public boolean isChangeRecord(Long projectId) { //1.先判断下 项目存不存在 Project project = projectService.getById(projectId); if(Objects.isNull(project)){ diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/PdfUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/PdfUtils.java index bedfc17..2b31778 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/PdfUtils.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/PdfUtils.java @@ -1,25 +1,22 @@ package com.hz.pm.api.todocenter.utils; +import cn.hutool.core.io.IoUtil; +import com.itextpdf.text.DocumentException; +import com.itextpdf.text.pdf.BaseFont; +import com.ningdatech.basic.exception.BizException; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import org.xhtmlrenderer.pdf.ITextFontResolver; +import org.xhtmlrenderer.pdf.ITextRenderer; + import java.io.*; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; -import java.util.Iterator; import java.util.Map; import java.util.UUID; -import cn.hutool.core.io.IoUtil; -import org.springframework.stereotype.Component; -import org.xhtmlrenderer.pdf.ITextFontResolver; -import org.xhtmlrenderer.pdf.ITextRenderer; - -import com.itextpdf.text.DocumentException; -import com.itextpdf.text.pdf.BaseFont; -import com.ningdatech.basic.exception.BizException; - -import lombok.extern.slf4j.Slf4j; - /** * pdf生成工具类 * @@ -50,7 +47,6 @@ public class PdfUtils { new File(filePath).mkdir(); } StringBuilder stringBuilder = new StringBuilder(); - ; String line; while ((line = bufferedReader.readLine()) != null) { stringBuilder.append(line); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhUnit.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhUnit.java index 6314e92..ef09dad 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhUnit.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhUnit.java @@ -3,14 +3,12 @@ package com.hz.pm.api.user.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import lombok.Data; import java.io.Serializable; import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - /** *

* 组织表 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/converter/WorkbenchConverter.java b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/converter/WorkbenchConverter.java index 0f01312..cdc76db 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/converter/WorkbenchConverter.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/converter/WorkbenchConverter.java @@ -1,16 +1,11 @@ package com.hz.pm.api.workbench.converter; import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import com.ningdatech.basic.model.PageVo; import com.hz.pm.api.projectdeclared.model.po.DeclaredProjectStatisticsPO; -import com.hz.pm.api.sys.model.vo.NoticeListItemVO; import com.hz.pm.api.todocenter.model.vo.ResToBeProcessedVO; import com.hz.pm.api.todocenter.model.vo.TodoVO; import com.hz.pm.api.workbench.model.vo.WorkbenchVO; -import java.util.Collections; -import java.util.List; import java.util.Objects; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/model/vo/WorkbenchVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/model/vo/WorkbenchVO.java index 6572068..03d069d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/model/vo/WorkbenchVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/model/vo/WorkbenchVO.java @@ -1,12 +1,11 @@ package com.hz.pm.api.workbench.model.vo; -import com.ningdatech.basic.model.PageVo; import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; -import com.hz.pm.api.sys.model.entity.ProjectEarlyWarning; import com.hz.pm.api.sys.model.vo.NoticeListItemVO; import com.hz.pm.api.sys.model.vo.ProjectEarlyWarningVO; import com.hz.pm.api.sys.model.vo.WflowEarlyWarningRecordsVO; import com.hz.pm.api.todocenter.model.vo.TodoCenterStatisticsVO; +import com.ningdatech.basic.model.PageVo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/sys/project/ProjectStateTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/sys/project/ProjectStateTest.java index 628b1db..f3605fc 100644 --- a/hz-pm-api/src/test/java/com/hz/pm/api/sys/project/ProjectStateTest.java +++ b/hz-pm-api/src/test/java/com/hz/pm/api/sys/project/ProjectStateTest.java @@ -3,7 +3,7 @@ package com.hz.pm.api.sys.project; import cn.hutool.core.date.StopWatch; import com.alibaba.fastjson.JSON; import com.hz.pm.api.AppTests; -import com.hz.pm.api.common.statemachine.util.StateMachineUtils; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.service.IProjectService; @@ -20,7 +20,7 @@ import javax.annotation.Resource; public class ProjectStateTest extends AppTests { @Resource - private StateMachineUtils stateMachineUtils; + private StateMachineUtil stateMachineUtil; @Resource private IProjectService projectService; @@ -37,7 +37,7 @@ public class ProjectStateTest extends AppTests { project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); //调用状态机 进入下一个通过状态 - stateMachineUtils.pass(project); + stateMachineUtil.pass(project); stopWatch.stop(); System.out.println("调用状态机结束 :" + stopWatch.getTotalTimeSeconds()); diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/SynDataTaskApp.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/SynDataTaskApp.java index 65344c7..b8ca6f0 100644 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/SynDataTaskApp.java +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/SynDataTaskApp.java @@ -4,7 +4,6 @@ package com.hz.pm.sync; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/open/manage/ProjectReceiveManage.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/open/manage/ProjectReceiveManage.java index 37e85be..ee9f70e 100644 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/open/manage/ProjectReceiveManage.java +++ b/hz-pm-sync/src/main/java/com/hz/pm/sync/open/manage/ProjectReceiveManage.java @@ -44,6 +44,7 @@ public class ProjectReceiveManage { /** * 接收保存 项目 + * * @param dto * @return */ @@ -58,34 +59,34 @@ public class ProjectReceiveManage { ProjectBaseInfo oldBaseInfo = baseInfoService.getOne(Wrappers.lambdaQuery(ProjectBaseInfo.class) .eq(ProjectBaseInfo::getBaseProjId, baseProjId) .last(BizConst.LIMIT_1)); - ProjectBaseInfo saveBase = BeanUtil.copyProperties(baseInfo,ProjectBaseInfo.class); + ProjectBaseInfo saveBase = BeanUtil.copyProperties(baseInfo, ProjectBaseInfo.class); //项目状态 String baseProjSetProg = saveBase.getBaseProjSetProg(); - if(StringUtils.isBlank(baseProjSetProg)){ + if (StringUtils.isBlank(baseProjSetProg)) { return "无状态不保存"; } //评审中 基本信息和申报信息 GovProjectStatusEnum match = GovProjectStatusEnum.match(baseProjSetProg); - if(Objects.isNull(match)){ + if (Objects.isNull(match)) { return "状态不对 不保存"; } - switch (match){ + switch (match) { case APPROVAL: - log.info("评审中状态 保存基本信息和申报信息 :{}",baseProjId); - saveBase(oldBaseInfo,saveBase,baseInfo); + log.info("评审中状态 保存基本信息和申报信息 :{}", baseProjId); + saveBase(oldBaseInfo, saveBase, baseInfo); saveApply(dto, baseProjId); break; case PENDING: case APPROVED: - log.info("待立项和已立项状态 保存基本信息,申报信息,评审信息 :{}",baseProjId); - saveBase(oldBaseInfo,saveBase,baseInfo); + log.info("待立项和已立项状态 保存基本信息,申报信息,评审信息 :{}", baseProjId); + saveBase(oldBaseInfo, saveBase, baseInfo); saveApply(dto, baseProjId); saveApprove(dto, baseProjId); break; case PURCHASED: - log.info("已采购状态 保存基本信息,申报信息,评审信息,采购信息 :{}",baseProjId); - saveBase(oldBaseInfo,saveBase,baseInfo); + log.info("已采购状态 保存基本信息,申报信息,评审信息,采购信息 :{}", baseProjId); + saveBase(oldBaseInfo, saveBase, baseInfo); saveApply(dto, baseProjId); saveApprove(dto, baseProjId); saveProcure(dto, baseProjId); @@ -93,18 +94,18 @@ public class ProjectReceiveManage { case HAS_PRE_INS: case HAS_FINAL_INS: case TERMINATED: - log.info("初验 终验状态 终止 保存所有信息 :{}",baseProjId); - saveBase(oldBaseInfo,saveBase,baseInfo); + log.info("初验 终验状态 终止 保存所有信息 :{}", baseProjId); + saveBase(oldBaseInfo, saveBase, baseInfo); saveApply(dto, baseProjId); saveApprove(dto, baseProjId); saveProcure(dto, baseProjId); saveCimplementOrMimplement(dto, baseProjId); break; case REJECTED: - log.info("驳回终止状态 啥都不保存 :{}",baseProjId); + log.info("驳回终止状态 啥都不保存 :{}", baseProjId); break; default: - log.info("没有匹配任何状态 保存失败 :{}",baseProjId); + log.info("没有匹配任何状态 保存失败 :{}", baseProjId); } return BizConst.SAVE_SUCCESS; @@ -113,22 +114,22 @@ public class ProjectReceiveManage { private void saveCimplementOrMimplement(ProjectSaveDTO dto, String baseProjId) { // 4.保存 建设项目 实施信息 ProjectCimplement cimplement = dto.getCimplement(); - if(Objects.nonNull(cimplement)){ + if (Objects.nonNull(cimplement)) { ProjectCimplement oldCimplement = cimplementService.getOne(Wrappers.lambdaQuery(ProjectCimplement.class) .eq(ProjectCimplement::getBaseProjId, baseProjId) .last(BizConst.LIMIT_1)); - ProjectCimplement saveCimplement = BeanUtil.copyProperties(cimplement,ProjectCimplement.class); + ProjectCimplement saveCimplement = BeanUtil.copyProperties(cimplement, ProjectCimplement.class); saveCimplement.setBaseProjId(baseProjId); - if(Objects.isNull(oldCimplement)){ + if (Objects.isNull(oldCimplement)) { //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update - if(StringUtils.isNotBlank(cimplement.getOp()) && BizConst.OP_UPDATE.equals(cimplement.getOp())){ + if (StringUtils.isNotBlank(cimplement.getOp()) && BizConst.OP_UPDATE.equals(cimplement.getOp())) { saveCimplement.setOp(BizConst.OP_UPDATE); - }else{ + } else { saveCimplement.setOp(BizConst.OP_INSERT); } saveCimplement.setTongTime(LocalDateTime.now()); - }else{ + } else { saveCimplement.setOp(BizConst.OP_INSERT); saveCimplement.setTongID(oldCimplement.getTongID()); saveCimplement.setTongTime(LocalDateTime.now()); @@ -139,22 +140,22 @@ public class ProjectReceiveManage { // 5.保存 运维项目 实施信息 ProjectMimplement mimplement = dto.getMimplement(); - if(Objects.nonNull(mimplement)){ + if (Objects.nonNull(mimplement)) { ProjectMimplement oldMimplement = mimplementService.getOne(Wrappers.lambdaQuery(ProjectMimplement.class) .eq(ProjectMimplement::getBaseProjId, baseProjId) .last(BizConst.LIMIT_1)); - ProjectMimplement saveMimplement = BeanUtil.copyProperties(mimplement,ProjectMimplement.class); + ProjectMimplement saveMimplement = BeanUtil.copyProperties(mimplement, ProjectMimplement.class); saveMimplement.setBaseProjId(baseProjId); - if(Objects.isNull(oldMimplement)){ + if (Objects.isNull(oldMimplement)) { //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update - if(StringUtils.isNotBlank(mimplement.getOp()) && BizConst.OP_UPDATE.equals(mimplement.getOp())){ + if (StringUtils.isNotBlank(mimplement.getOp()) && BizConst.OP_UPDATE.equals(mimplement.getOp())) { saveMimplement.setOp(BizConst.OP_UPDATE); - }else{ + } else { saveMimplement.setOp(BizConst.OP_INSERT); } saveMimplement.setTongTime(LocalDateTime.now()); - }else{ + } else { saveMimplement.setOp(BizConst.OP_INSERT); saveMimplement.setTongID(oldMimplement.getTongID()); saveMimplement.setTongTime(LocalDateTime.now()); @@ -167,34 +168,36 @@ public class ProjectReceiveManage { private void saveProcure(ProjectSaveDTO dto, String baseProjId) { // 6.保存 采购信息 List procures = dto.getProcures(); - if(Objects.nonNull(procures)){ + if (Objects.nonNull(procures)) { List olds = procureService.list(Wrappers.lambdaQuery(ProjectProcure.class) .eq(ProjectProcure::getBaseProjId, baseProjId) .orderByAsc(ProjectProcure::getBaseBidCode)); - Integer index = 0; - for(ProjectProcure old : olds){ - if(StringUtils.isNotBlank(old.getBaseBidCode())){ - try{ + int index = 0; + for (ProjectProcure old : olds) { + if (StringUtils.isNotBlank(old.getBaseBidCode())) { + try { String bidCode = old.getBaseBidCode().split(StrPool.DASH)[1]; index = Integer.parseInt(bidCode); - }catch (Exception e){} + } catch (Exception e) { + log.error(e.getMessage(),e); + } } //删除标记 old.setOp(BizConst.OP_DELETE); procureService.updateById(old); } - index ++; - for(ProjectProcure procure : procures){ + index++; + for (ProjectProcure procure : procures) { //添加标记 - ProjectProcure saveProcure = BeanUtil.copyProperties(procure,ProjectProcure.class); + ProjectProcure saveProcure = BeanUtil.copyProperties(procure, ProjectProcure.class); saveProcure.setBaseProjId(baseProjId); - saveProcure.setBaseBidCode(baseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS,index)); + saveProcure.setBaseBidCode(baseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS, index)); saveProcure.setTongID(null); saveProcure.setTongTime(LocalDateTime.now()); saveProcure.setBizTime(LocalDateTime.now()); saveProcure.setOp(BizConst.OP_INSERT); procureService.save(saveProcure); - index ++; + index++; } } } @@ -207,17 +210,17 @@ public class ProjectReceiveManage { .eq(ProjectApprove::getBaseProjId, baseProjId) .last(BizConst.LIMIT_1)); - ProjectApprove saveApprove = BeanUtil.copyProperties(approve,ProjectApprove.class); + ProjectApprove saveApprove = BeanUtil.copyProperties(approve, ProjectApprove.class); saveApprove.setBaseProjId(baseProjId); - if(Objects.isNull(oldApprove)){ + if (Objects.isNull(oldApprove)) { //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update - if(StringUtils.isNotBlank(approve.getOp()) && BizConst.OP_UPDATE.equals(approve.getOp())){ + if (StringUtils.isNotBlank(approve.getOp()) && BizConst.OP_UPDATE.equals(approve.getOp())) { saveApprove.setOp(BizConst.OP_UPDATE); - }else{ + } else { saveApprove.setOp(BizConst.OP_INSERT); } saveApprove.setTongTime(LocalDateTime.now()); - }else{ + } else { saveApprove.setOp(BizConst.OP_INSERT); saveApprove.setTongID(oldApprove.getTongID()); saveApprove.setTongTime(LocalDateTime.now()); @@ -234,17 +237,17 @@ public class ProjectReceiveManage { .eq(ProjectApply::getBaseProjId, baseProjId) .last(BizConst.LIMIT_1)); - ProjectApply saveApply = BeanUtil.copyProperties(apply,ProjectApply.class); + ProjectApply saveApply = BeanUtil.copyProperties(apply, ProjectApply.class); saveApply.setBaseProjId(baseProjId); - if(Objects.isNull(oldApply)){ + if (Objects.isNull(oldApply)) { //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update - if(StringUtils.isNotBlank(apply.getOp()) && BizConst.OP_UPDATE.equals(apply.getOp())){ + if (StringUtils.isNotBlank(apply.getOp()) && BizConst.OP_UPDATE.equals(apply.getOp())) { saveApply.setOp(BizConst.OP_UPDATE); - }else{ + } else { saveApply.setOp(BizConst.OP_INSERT); } saveApply.setTongTime(LocalDateTime.now()); - }else{ + } else { saveApply.setOp(BizConst.OP_INSERT); saveApply.setTongID(oldApply.getTongID()); saveApply.setTongTime(LocalDateTime.now()); @@ -255,16 +258,16 @@ public class ProjectReceiveManage { } //保存基本信息 - private void saveBase(ProjectBaseInfo oldBaseInfo, ProjectBaseInfo saveBase,ProjectBaseInfo baseInfo) { - if(Objects.isNull(oldBaseInfo)){ + private void saveBase(ProjectBaseInfo oldBaseInfo, ProjectBaseInfo saveBase, ProjectBaseInfo baseInfo) { + if (Objects.isNull(oldBaseInfo)) { //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update - if(StringUtils.isNotBlank(baseInfo.getOp()) && BizConst.OP_UPDATE.equals(baseInfo.getOp())){ + if (StringUtils.isNotBlank(baseInfo.getOp()) && BizConst.OP_UPDATE.equals(baseInfo.getOp())) { saveBase.setOp(BizConst.OP_UPDATE); - }else{ + } else { saveBase.setOp(BizConst.OP_INSERT); } saveBase.setTongTime(LocalDateTime.now()); - }else { + } else { saveBase.setOp(BizConst.OP_INSERT); saveBase.setTongID(oldBaseInfo.getTongID()); saveBase.setTongTime(LocalDateTime.now()); @@ -275,6 +278,7 @@ public class ProjectReceiveManage { /** * 置为无效 + * * @param dto * @return */ @@ -283,9 +287,9 @@ public class ProjectReceiveManage { .eq(ProjectBaseInfo::getBaseProjId, dto.getBaseProjId()) .last(BizConst.LIMIT_1)); - ProjectBaseInfo saveBaseinfo = BeanUtil.copyProperties(dto,ProjectBaseInfo.class); + ProjectBaseInfo saveBaseinfo = BeanUtil.copyProperties(dto, ProjectBaseInfo.class); saveBaseinfo.setIsEffective(BizConst.NOT_EFFECTIVE); - if(Objects.isNull(oldBaseInfo)){ + if (Objects.isNull(oldBaseInfo)) { saveBaseinfo.setTongTime(LocalDateTime.now()); } saveBaseinfo.setBizTime(LocalDateTime.now()); @@ -297,6 +301,7 @@ public class ProjectReceiveManage { /** * 删除表里的所有数据 + * * @return */ public String deleteAll() { From 72f0ede1ee375a0fdccdbac544082767c428e10c Mon Sep 17 00:00:00 2001 From: WendyYang Date: Mon, 8 Jan 2024 21:11:03 +0800 Subject: [PATCH 11/44] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hz/pm/api/common/config/AuthCodeProps.java | 2 - .../com/hz/pm/api/common/util/HmacAuthUtil.java | 4 +- .../dashboard/helper/DashboardChartAssembler.java | 11 +- .../pm/api/dashboard/helper/DashboardHelper.java | 3 +- .../dashboard/manage/DashboardProjectManage.java | 96 ++++++------ .../ding/controller/DingInfoPullController.java | 6 +- .../expert/assembler/ExpertInfoCmdAssembler.java | 6 +- .../ExpertInfoSensitiveFieldModifyCheckHelper.java | 2 +- .../hz/pm/api/expert/manage/ExpertAdminManage.java | 2 +- .../expert/model/cmd/AdminModifyExpertInfoCmd.java | 37 ----- .../api/expert/model/cmd/SaveExpertAdminCmd.java | 60 -------- .../pm/api/expert/model/vo/MetaApplyResultVo.java | 6 - .../service/impl/CompanyFiscalCodeServiceImpl.java | 6 +- .../com/hz/pm/api/gov/convert/ProjectConvert.java | 3 +- .../api/gov/manage/GovProjectCollectionManage.java | 8 +- .../hz/pm/api/irs/controller/IrsController.java | 1 - .../entity/dto/CountConfirmByMeetingIdDTO.java | 7 +- .../pm/api/meeting/manage/ExpertExportManage.java | 11 -- .../service/impl/MeetingExpertServiceImpl.java | 10 +- .../hz/pm/api/meta/helper/impl/TagsCacheImpl.java | 4 +- .../organization/manage/OrganizationManage.java | 2 +- .../model/req/PerformanceAppraisalListReq.java | 1 - .../manage/DeclaredProjectManage.java | 5 +- .../mapper/DeclaredStatisticsMapper.java | 1 - .../model/dto/DefaultDeclaredDTO.java | 1 - .../manage/ProjectRenewalFundManage.java | 167 ++++++++++----------- .../scheduler/task/CockpitStatsStatisticsTask.java | 82 ++++------ .../hz/pm/api/sys/manage/EarlyWarningManage.java | 2 +- .../pm/api/sys/model/dto/AbstractMsgExtraDTO.java | 6 + .../model/dto/ProjectAuditMsgExtraDTO.java | 6 +- .../com/hz/pm/api/user/manage/UserInfoManage.java | 26 ++-- .../hz/pm/api/user/service/IMhCompanyService.java | 1 - 32 files changed, 213 insertions(+), 372 deletions(-) delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/AdminModifyExpertInfoCmd.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/SaveExpertAdminCmd.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/config/AuthCodeProps.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/config/AuthCodeProps.java index 45a63a7..2c3ddd1 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/config/AuthCodeProps.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/config/AuthCodeProps.java @@ -4,8 +4,6 @@ import cn.hutool.core.util.RandomUtil; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; -import java.util.UUID; - /** *

* AuthCodeProps diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/HmacAuthUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/HmacAuthUtil.java index 4ee84e0..f2568ad 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/HmacAuthUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/HmacAuthUtil.java @@ -58,12 +58,12 @@ public class HmacAuthUtil { String[] params = query.split("&"); for (String param : params) { String[] keyValue = param.split("="); - Pair pair = new Pair(keyValue[0], keyValue.length > 1 ? keyValue[1] : ""); + Pair pair = new Pair<>(keyValue[0], keyValue.length > 1 ? keyValue[1] : ""); queryParamList.add(pair); } List> sortedParamList = queryParamList.stream().sorted(Comparator.comparing(param -> param.getKey() + "=" + Optional.ofNullable(param.getValue()).orElse(""))).collect(Collectors.toList()); List> encodeParamList = new ArrayList<>(); - sortedParamList.stream().forEach(param -> { + sortedParamList.forEach(param -> { try { String key = URLEncoder.encode(param.getKey(), "utf-8"); String value = URLEncoder.encode(Optional.ofNullable(param.getValue()).orElse(""), "utf-8"); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardChartAssembler.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardChartAssembler.java index 47b23b3..4695d66 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardChartAssembler.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardChartAssembler.java @@ -5,8 +5,8 @@ import com.hz.pm.api.dashboard.constant.ChartTypeEnum; import com.hz.pm.api.dashboard.model.basic.AnalysisChart; import com.hz.pm.api.dashboard.model.basic.AnalysisData; import com.hz.pm.api.meta.helper.DictionaryCache; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; @@ -33,12 +33,11 @@ public class DashboardChartAssembler { List dataList = new ArrayList<>(); analysisChart.setChartType(chartTypeEnum); analysisChart.setDataList(dataList); - for (Integer key : projectGroupMap.keySet()) { + for (Map.Entry> entry : projectGroupMap.entrySet()) { AnalysisData analysisData = new AnalysisData(); - String chartKey = ProjectStatusEnum.getDesc(key); - List projectList = projectGroupMap.get(key); + String chartKey = ProjectStatusEnum.getDesc(entry.getKey()); analysisData.setKey(chartKey); - analysisData.setValue(CollUtil.isEmpty(projectList) ? 0 : projectList.size()); + analysisData.setValue(CollUtil.size(entry.getValue())); dataList.add(analysisData); } return analysisChart; @@ -105,7 +104,7 @@ public class DashboardChartAssembler { return analysisChart; } - public AnalysisChart assemblerAnalysisChart(Map> dictionaryCodeIdMap + public AnalysisChart assemblerAnalysisChart(Map> dictionaryCodeIdMap , ChartTypeEnum chartTypeEnum) { AnalysisChart analysisChart = new AnalysisChart(); List dataList = new ArrayList<>(); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardHelper.java index 1fb3396..113c0fa 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardHelper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardHelper.java @@ -33,8 +33,7 @@ public class DashboardHelper { public Map getLiShuiRegionCodeNameMap() { List regionList = iRegionService.list(Wrappers.lambdaQuery(Region.class) .eq(Region::getParentCode, AnalysisBasicConstant.LS_REGION_CODE)); - Map regionCodeNameMap = regionList.stream().collect(Collectors.toMap(Region::getRegionCode, Region::getRegionName)); - return regionCodeNameMap; + return regionList.stream().collect(Collectors.toMap(Region::getRegionCode, Region::getRegionName)); } /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/DashboardProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/DashboardProjectManage.java index 14ab55a..de8b250 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/DashboardProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/DashboardProjectManage.java @@ -97,20 +97,20 @@ public class DashboardProjectManage { Integer approvedProjectCnt = projectCnt - toBeApprovedProjectCnt; // 项目立项率 - Double projectApprovalRate = new BigDecimal((float) approvedProjectCnt / projectCnt).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + Double projectApprovalRate = BigDecimal.valueOf((float) approvedProjectCnt / projectCnt).setScale(2, RoundingMode.HALF_UP).doubleValue(); // 项目申报总金额 - List declareAmountList = allProjectList.stream().filter(r -> Objects.nonNull(r.getDeclareAmount())) - .map(Project::getDeclareAmount). - collect(Collectors.toList()); + List declareAmountList = allProjectList.stream().map(Project::getDeclareAmount) + .filter(Objects::nonNull). + collect(Collectors.toList()); BigDecimal declareAmountSum = new BigDecimal("0"); for (BigDecimal declareAmount : declareAmountList) { declareAmountSum.add(declareAmount); } // 项目批复总金额 - List approvedTotalInvestmentIncreaseList = allProjectList.stream().filter(r -> Objects.nonNull(r.getApprovedTotalInvestmentIncrease())) - .map(Project::getApprovedTotalInvestmentIncrease) + List approvedTotalInvestmentIncreaseList = allProjectList.stream().map(Project::getApprovedTotalInvestmentIncrease) + .filter(Objects::nonNull) .collect(Collectors.toList()); BigDecimal approvedTotalInvestmentIncreaseSum = new BigDecimal("0"); for (BigDecimal approvedTotalInvestmentIncrease : approvedTotalInvestmentIncreaseList) { @@ -120,7 +120,7 @@ public class DashboardProjectManage { // 资金核定率 BigDecimal fundApprovalRate = new BigDecimal("0"); if (new BigDecimal("0").compareTo(approvedTotalInvestmentIncreaseSum) != 0) { - fundApprovalRate = declareAmountSum.divide(approvedTotalInvestmentIncreaseSum, 2, BigDecimal.ROUND_HALF_UP); + fundApprovalRate = declareAmountSum.divide(approvedTotalInvestmentIncreaseSum, 2, RoundingMode.HALF_UP); } @@ -143,7 +143,7 @@ public class DashboardProjectManage { .in(ProjectDelayApply::getProjectId, allProjectIdWithRepeatList)); Map> projectDelayApplyListMap = projectDelayApplyList.stream().collect(Collectors.groupingBy(ProjectDelayApply::getProjectId)); Integer delayProjectCnt = projectDelayApplyListMap.keySet().size(); - Double delayProportion = new BigDecimal((float) delayProjectCnt / projectCnt).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + Double delayProportion = BigDecimal.valueOf((float) delayProjectCnt / projectCnt).setScale(2, RoundingMode.HALF_UP).doubleValue(); // 项目变更数量 项目变更金额 List changedProjectList = new ArrayList<>(); @@ -151,12 +151,12 @@ public class DashboardProjectManage { for (String projectCode : allProjectMap.keySet()) { List projectList = allProjectMap.get(projectCode); Project newestProject = projectList.stream() - .filter(r -> r.getNewest()) + .filter(Project::getNewest) .collect(Collectors.toList()).get(0); - Boolean isChanged = false; + boolean isChanged = false; for (Project project : projectList) { Boolean newest = project.getNewest(); - Boolean isBackReject = project.getIsBackReject(); + boolean isBackReject = project.getIsBackReject(); if (!newest && isBackReject) { isChanged = true; break; @@ -347,6 +347,7 @@ public class DashboardProjectManage { /** * 驾驶舱-项目画像 + * * @param projectCode * @return */ @@ -367,27 +368,27 @@ public class DashboardProjectManage { .eq(GovBizProjectApply::getBaseProjId, projectCode) .last(BizConst.LIMIT_1)); - if(Objects.isNull(project) && Objects.isNull(baseInfo) && Objects.isNull(operationBase)){ + if (Objects.isNull(project) && Objects.isNull(baseInfo) && Objects.isNull(operationBase)) { return res; } //2.转换项目信息 - if(Objects.nonNull(project)){ - ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(project,ProtraitProjectInfoVO.class); + if (Objects.nonNull(project)) { + ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(project, ProtraitProjectInfoVO.class); projectInfo.setOverdueSituation("即将超期"); projectInfo.setSafetyInputRate(convertSafetyInputRate(project)); projectInfo.setStatus(Objects.nonNull(project.getStatus()) ? project.getStatus().toString() : null); //3.项目状态情况 projectInfo.setStatusSituation(generateProjectStatus(project)); res.setProjectInfo(projectInfo); - }else if(Objects.nonNull(baseInfo)){ - ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(baseInfo,ProtraitProjectInfoVO.class); + } else if (Objects.nonNull(baseInfo)) { + ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(baseInfo, ProtraitProjectInfoVO.class); projectInfo.setOverdueSituation("即将超期"); projectInfo.setSafetyInputRate("0"); - if(Objects.nonNull(apply)){ - try{ + if (Objects.nonNull(apply)) { + try { projectInfo.setProjectYear(Integer.valueOf(apply.getBaseProjSetYear())); - }catch (Exception e){ + } catch (Exception e) { } projectInfo.setProjectIntroduction(apply.getBaseProjIntro()); projectInfo.setBuildCycle(apply.getBaseProjDuration()); @@ -401,14 +402,14 @@ public class DashboardProjectManage { projectInfo.setStatusSituation(generateProjectStatus(baseInfo)); projectInfo.setStatus(baseInfo.getBaseProjSetProg()); res.setProjectInfo(projectInfo); - }else if(Objects.nonNull(operationBase)){ - ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(operationBase,ProtraitProjectInfoVO.class); + } else if (Objects.nonNull(operationBase)) { + ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(operationBase, ProtraitProjectInfoVO.class); projectInfo.setOverdueSituation("即将超期"); projectInfo.setSafetyInputRate("0"); - if(Objects.nonNull(apply)){ - try{ + if (Objects.nonNull(apply)) { + try { projectInfo.setProjectYear(Integer.valueOf(apply.getBaseProjSetYear())); - }catch (Exception e){ + } catch (Exception e) { } projectInfo.setProjectIntroduction(apply.getBaseProjIntro()); projectInfo.setBuildCycle(apply.getBaseProjDuration()); @@ -436,39 +437,42 @@ public class DashboardProjectManage { /** * 计算安全投入 + * * @param project * @return */ public static String convertSafetyInputRate(Project project) { String safetyInputDescribe = project.getSafetyInputDescribe(); - if(org.apache.commons.lang3.StringUtils.isNotBlank(safetyInputDescribe)){ - try{ + if (org.apache.commons.lang3.StringUtils.isNotBlank(safetyInputDescribe)) { + try { JSONArray array = JSON.parseArray(safetyInputDescribe); final Double[] total = {0.0}; array.forEach(j -> { JSONObject json = JSON.parseObject(JSON.toJSONString(j)); Double safetyInputAmount = json.getDouble(DashboardConstant.Protrait.FEILD_SAFETYMONEY); - if(Objects.nonNull(safetyInputAmount)){ + if (Objects.nonNull(safetyInputAmount)) { total[0] += safetyInputAmount; } }); Double totalAmount = total[0]; //申报金额 BigDecimal declareAmount = project.getDeclareAmount(); - if(Objects.isNull(declareAmount) || declareAmount.compareTo(BigDecimal.ZERO) == 0){ + if (Objects.isNull(declareAmount) || declareAmount.compareTo(BigDecimal.ZERO) == 0) { return DashboardConstant.Protrait.ZREO_PERCEN; } BigDecimal rate = BigDecimal.valueOf(totalAmount).multiply(BigDecimal.valueOf(100)) - .divide(declareAmount,BigDecimal.ROUND_CEILING, RoundingMode.HALF_UP) + .divide(declareAmount, BigDecimal.ROUND_CEILING, RoundingMode.HALF_UP) .stripTrailingZeros(); return rate.toPlainString(); - }catch (Exception e){} + } catch (Exception e) { + } } return DashboardConstant.Protrait.ZREO_PERCEN; } /** * 生成项目 状态流转信息 + * * @param project * @return */ @@ -493,20 +497,20 @@ public class DashboardProjectManage { CompletableFuture.allOf( CompletableFuture.runAsync(() -> { - res.set(0,statusHandler.generateApproveStatus(project,DashboardConstant.Protrait.PLAN,InstTypeEnum.UNIT_INNER_AUDIT.getCode())); + res.set(0, statusHandler.generateApproveStatus(project, DashboardConstant.Protrait.PLAN, InstTypeEnum.UNIT_INNER_AUDIT.getCode())); }, ForkJoinPool.commonPool()), CompletableFuture.runAsync(() -> { - res.set(1,statusHandler.generateApproveStatus(project,DashboardConstant.Protrait.DECLARED,InstTypeEnum.PRELIMINARY_PREVIEW.getCode())); + res.set(1, statusHandler.generateApproveStatus(project, DashboardConstant.Protrait.DECLARED, InstTypeEnum.PRELIMINARY_PREVIEW.getCode())); }, ForkJoinPool.commonPool()), CompletableFuture.runAsync(() -> { - res.set(2,statusHandler.generateApproveStatus(project,DashboardConstant.Protrait.APPROVE,InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode())); + res.set(2, statusHandler.generateApproveStatus(project, DashboardConstant.Protrait.APPROVE, InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode())); }, ForkJoinPool.commonPool()), CompletableFuture.runAsync(() -> { - res.set(3,statusHandler.generateStatus(project,DashboardConstant.Protrait.CONSTRUCTION, - ProjectStatusEnum.UNDER_CONSTRUCTION.getCode(),ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode())); + res.set(3, statusHandler.generateStatus(project, DashboardConstant.Protrait.CONSTRUCTION, + ProjectStatusEnum.UNDER_CONSTRUCTION.getCode(), ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode())); }, ForkJoinPool.commonPool()), CompletableFuture.runAsync(() -> { - res.set(4,statusHandler.generateApproveStatus(project,DashboardConstant.Protrait.ACCEPT,InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode())); + res.set(4, statusHandler.generateApproveStatus(project, DashboardConstant.Protrait.ACCEPT, InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode())); }, ForkJoinPool.commonPool()), CompletableFuture.runAsync(() -> { res.set(6, statusHandler.generatePerformanceStatus(project)); @@ -518,20 +522,20 @@ public class DashboardProjectManage { private List generateProjectStatus(GovBizProjectBaseinfo baseinfo) { final List res = Lists.newArrayList(); //1.计划(单位内部审核) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.PLAN,null)); + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.PLAN, null)); //2.申报(项目预审) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.DECLARED,null)); + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.DECLARED, null)); //3.审批(建设方案审批) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.APPROVE,null)); + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.APPROVE, null)); //4.建设(立项后的建设中) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.CONSTRUCTION,null)); + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.CONSTRUCTION, null)); //5.验收(终验) res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.ACCEPT, Objects.nonNull(baseinfo.getBaseProjSetProg()) && "07".equals(baseinfo.getBaseProjSetProg()) ? baseinfo.getTongTime() : null)); //6.运维(todo: 运维时间还没有) res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.OPERATION).build()); //7.绩效 - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.ACCEPT,null)); + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.ACCEPT, null)); //8.注销(todo: 还没有注销功能) res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.LOG_OFF).build()); return res; @@ -540,20 +544,20 @@ public class DashboardProjectManage { private List generateProjectStatus(GovOperationProjectBaseinfo baseinfo) { final List res = Lists.newArrayList(); //1.计划(单位内部审核) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.PLAN,null)); + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.PLAN, null)); //2.申报(项目预审) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.DECLARED,null)); + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.DECLARED, null)); //3.审批(建设方案审批) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.APPROVE,null)); + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.APPROVE, null)); //4.建设(立项后的建设中) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.CONSTRUCTION,null)); + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.CONSTRUCTION, null)); //5.验收(终验) res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.ACCEPT, Objects.nonNull(baseinfo.getBaseProjSetProg()) && "07".equals(baseinfo.getBaseProjSetProg()) ? baseinfo.getTongTime() : null)); //6.运维(todo: 运维时间还没有) res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.OPERATION).build()); //7.绩效 - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.ACCEPT,null)); + res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.ACCEPT, null)); //8.注销(todo: 还没有注销功能) res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.LOG_OFF).build()); return res; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/ding/controller/DingInfoPullController.java b/hz-pm-api/src/main/java/com/hz/pm/api/ding/controller/DingInfoPullController.java index c0b9272..b0ea5ac 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/ding/controller/DingInfoPullController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/ding/controller/DingInfoPullController.java @@ -292,11 +292,11 @@ public class DingInfoPullController { extString = extString.substring(extString.lastIndexOf(".")); try { if (".xls".equals(extString)) { - return wb = new HSSFWorkbook(is); + return new HSSFWorkbook(is); } else if (".xlsx".equals(extString)) { - return wb = new XSSFWorkbook(is); + return new XSSFWorkbook(is); } else { - return wb = null; + return null; } } catch (IOException e) { e.printStackTrace(); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertInfoCmdAssembler.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertInfoCmdAssembler.java index 1546504..4779e5e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertInfoCmdAssembler.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/assembler/ExpertInfoCmdAssembler.java @@ -33,7 +33,7 @@ public class ExpertInfoCmdAssembler { ExpertFullInfoSaveCmd expertFullInfoSaveCmd = new ExpertFullInfoSaveCmd(); ExpertUserFullInfoDTO expertUserInfoDTO = buildExpertUserFullInfoDTO( - expertBasicInfo, expertEduInfo, expertJobInfo, expertProfessionalInfo, null, null); + expertBasicInfo, expertEduInfo, expertJobInfo, expertProfessionalInfo, null); List expertDictionaryList = buildExpertDictionaryList(expertBasicInfo, expertEduInfo, expertJobInfo, expertProfessionalInfo, null); List expertTagList = buildExpertTagList(expertProfessionalInfo, expertBasicInfo, null); @@ -164,7 +164,7 @@ public class ExpertInfoCmdAssembler { } private static ExpertUserFullInfoDTO buildExpertUserFullInfoDTO(ExpertBasicInfo basicInfo, ExpertEduInfo eduInfo - , ExpertJobInfo jobInfo, ExpertProfessionalInfo professionalInfo, ExpertRecommendInfo recommendInfo, ExpertOtherInfo otherInfo) { + , ExpertJobInfo jobInfo, ExpertProfessionalInfo professionalInfo, ExpertOtherInfo otherInfo) { ExpertUserFullInfoDTO expertFullInfo = new ExpertUserFullInfoDTO(); expertFullInfo.setIsDingUser(basicInfo.getIsDingUser()); @@ -214,7 +214,7 @@ public class ExpertInfoCmdAssembler { , ExpertInfoSensitiveFieldCheckBO expertInfoSensitiveFieldCheckBO , ModifyApplyExtraInfo modifyApplyExtraInfo) { ExpertInfoModifyCmd expertInfoModifyCmd = new ExpertInfoModifyCmd(); - ExpertUserFullInfoDTO expertUserInfoDTO = buildExpertUserFullInfoDTO(expertBasicInfo, expertEduInfo, expertJobInfo, expertProfessionalInfo, recommendInfo, otherInfo); + ExpertUserFullInfoDTO expertUserInfoDTO = buildExpertUserFullInfoDTO(expertBasicInfo, expertEduInfo, expertJobInfo, expertProfessionalInfo, otherInfo); List expertDictionaryList = buildExpertDictionaryList(expertBasicInfo, expertEduInfo, expertJobInfo, expertProfessionalInfo, recommendInfo); List expertTagList = buildExpertTagList(expertProfessionalInfo, expertBasicInfo, otherInfo); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/ExpertInfoSensitiveFieldModifyCheckHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/ExpertInfoSensitiveFieldModifyCheckHelper.java index b09c194..7e9f0fb 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/ExpertInfoSensitiveFieldModifyCheckHelper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/helper/ExpertInfoSensitiveFieldModifyCheckHelper.java @@ -42,7 +42,7 @@ public class ExpertInfoSensitiveFieldModifyCheckHelper { public ExpertInfoSensitiveFieldCheckBO expertInfoSensitiveFieldModifyCheck(ExpertBasicInfo applyBasicInfo - , ExpertEduInfo applyEduInfo, ExpertJobInfo applyJobInfo, ExpertProfessionalInfo applyProfessionalInfo, Long expertUserId) { + , ExpertJobInfo applyJobInfo, ExpertProfessionalInfo applyProfessionalInfo, Long expertUserId) { ExpertFullInfoAllDTO expertUserFullInfoAll = expertInfoService.getExpertUserFullInfoAll(expertUserId); if (Objects.isNull(expertUserFullInfoAll)) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertAdminManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertAdminManage.java index a056c1e..3c2cce1 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertAdminManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertAdminManage.java @@ -181,7 +181,7 @@ public class ExpertAdminManage { ExpertOtherInfo otherInfo = request.getExpertOtherInfo(); ExpertInfoSensitiveFieldCheckBO expertInfoSensitiveFieldCheckBO = - expertInfoSensitiveFieldModifyCheckHelper.expertInfoSensitiveFieldModifyCheck(basicInfo, eduInfo, jobInfo, professionalInfo, expertUserId); + expertInfoSensitiveFieldModifyCheckHelper.expertInfoSensitiveFieldModifyCheck(basicInfo, jobInfo, professionalInfo, expertUserId); ExpertInfoModifyCmd expertInfoModifyCmd = ExpertInfoCmdAssembler .buildExpertInfoModifyCmd(expertUserId, basicInfo, eduInfo, jobInfo, professionalInfo, recommendInfo, otherInfo, expertInfoSensitiveFieldCheckBO, null); List applyIdList = expertInfoService.adminModifyExpertInfo(expertInfoModifyCmd, adminUserId); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/AdminModifyExpertInfoCmd.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/AdminModifyExpertInfoCmd.java deleted file mode 100644 index 25a44e2..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/AdminModifyExpertInfoCmd.java +++ /dev/null @@ -1,37 +0,0 @@ -//package com.hz.pm.api.expert.model.cmd; -// -//import com.ningdatech.emapi.expert.entity.bo.ExpertInfoSensitiveFieldCheckBO; -//import com.ningdatech.emapi.expert.entity.dto.*; -//import lombok.Data; -// -//import java.util.List; -// -///** -// * @author liuxinxin -// * @date 2022/7/28 下午2:43 -// */ -//@Data -//public class AdminModifyExpertInfoCmd { -// -// private Long userId; -// -// private ExpertUserFullInfoDTO expertUserInfoDTO; -// -// private List expertDictionaryList; -// -// private List expertTagList; -// -// /** -// * 专家履职意向(区域编码) -// */ -// private List expertIntentionWorkRegionInfo; -// -// /** -// * 回避单位列表 -// */ -// private List expertAvoidCompanyList; -// -// private ExpertInfoSensitiveFieldCheckBO expertInfoSensitiveFieldCheckBO; -// -// private ModifyApplyExtraInfoDTO modifyApplyExtraInfo; -//} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/SaveExpertAdminCmd.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/SaveExpertAdminCmd.java deleted file mode 100644 index 6e5d31b..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/cmd/SaveExpertAdminCmd.java +++ /dev/null @@ -1,60 +0,0 @@ -//package com.hz.pm.api.expert.model.cmd; -// -//import com.ningdatech.emapi.expert.entity.dto.ExpertAdminRegionDTO; -//import lombok.Data; -// -//import java.util.List; -// -///** -// * @author liuxinxin -// * @date 2022/8/1 上午10:54 -// */ -//@Data -//public class SaveExpertAdminCmd { -// -// /** -// * 用户id -// */ -// private Long userId; -// -// /** -// * 是否浙政钉用户Y/N -// */ -// private Boolean isDingUser; -// -// /** -// * 手机号 -// */ -// private String phoneNo; -// -// /** -// * 用户名称 -// */ -// private String name; -// -// /** -// * 工作单位 -// */ -// private String company; -// -// /** -// * 公司唯一标识 -// */ -// private String companyUniqCode; -// -// /** -// * 层级 -// */ -// private List regionInfoList; -// -// /** -// * 用户状态(启用/关闭) -// */ -// private Boolean isEnable; -// -// /** -// * 操作者id -// */ -// private Long operatorId; -// -//} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/MetaApplyResultVo.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/MetaApplyResultVo.java index 07e3648..7ea48f8 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/MetaApplyResultVo.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/vo/MetaApplyResultVo.java @@ -42,12 +42,6 @@ public class MetaApplyResultVo { @ApiModelProperty("专家用户userId") private Long expertUserId; -// @ApiModelProperty("额外的材料") -// private ModifyApplyExtraInfo modifyApplyExtraInfo; -// -// @ApiModelProperty("信息修改申请展示列表-只有审核类型为信息变更审核时才有值") -// private InfoModifyApplyDisplayVO infoModifyApplyDisplayVo; - @ApiModelProperty("履职意向修改申请展示列表-只有审核类型为履职意向变更时才会有值") private IntentionApplyDisplayVO intentionApplyDisplayVo; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/service/impl/CompanyFiscalCodeServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/service/impl/CompanyFiscalCodeServiceImpl.java index 6035dc4..a323ecf 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/service/impl/CompanyFiscalCodeServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/service/impl/CompanyFiscalCodeServiceImpl.java @@ -9,6 +9,7 @@ import com.hz.pm.api.fiscal.mapper.NdCompanyFiscalCodeMapper; import com.hz.pm.api.fiscal.service.ICompanyFiscalCodeService; import org.springframework.stereotype.Service; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -40,13 +41,12 @@ public class CompanyFiscalCodeServiceImpl extends ServiceImpl getByOrgFiscalCodeMap(List orgCodeList) { if (CollUtil.isNotEmpty(orgCodeList)) { - return new HashMap(); + return Collections.emptyMap(); } List companyFiscalCodeList = this.list(Wrappers.lambdaQuery(CompanyFiscalCode.class) .in(CompanyFiscalCode::getOrganizationCode, orgCodeList)); - Map orgCodeAndFiscalCodeMap = companyFiscalCodeList.stream() + return companyFiscalCodeList.stream() .collect(Collectors.toMap(CompanyFiscalCode::getOrganizationCode, CompanyFiscalCode::getFiscalCode)); - return orgCodeAndFiscalCodeMap; } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/convert/ProjectConvert.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/convert/ProjectConvert.java index b75ba10..bd37f35 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/gov/convert/ProjectConvert.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/convert/ProjectConvert.java @@ -179,8 +179,7 @@ public class ProjectConvert { } public static ProjectCimplementReq convertCimplementVo(GovBizProjectCimplementVO cimplement) { - ProjectCimplementReq req = BeanUtil.copyProperties(cimplement, ProjectCimplementReq.class); - return req; + return BeanUtil.copyProperties(cimplement, ProjectCimplementReq.class); } public static ProjectCimplementReq convertCimplementVoWithConvertPdf(GovBizProjectCimplementVO cimplement) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java index 98ef382..d5726df 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java @@ -1476,7 +1476,7 @@ public class GovProjectCollectionManage { MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); headers.setContentType(type); headers.add("Accept", MediaType.APPLICATION_JSON.toString()); - HttpEntity formEntity = new HttpEntity(req, headers); + HttpEntity formEntity = new HttpEntity<>(req, headers); ResponseEntity response = restTemplate.postForEntity(url, formEntity, String.class); log.info("推送结果 {} :{}", vo.getBaseProjId(), response); } catch (Exception e) { @@ -1493,7 +1493,7 @@ public class GovProjectCollectionManage { MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); headers.setContentType(type); headers.add("Accept", MediaType.APPLICATION_JSON.toString()); - HttpEntity formEntity = new HttpEntity(req, headers); + HttpEntity formEntity = new HttpEntity<>(req, headers); ResponseEntity response = restTemplate.postForEntity(url, formEntity, String.class); log.info("推送结果 {} :{}", vo.getBaseProjId(), response); } catch (Exception e) { @@ -1515,7 +1515,7 @@ public class GovProjectCollectionManage { MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); headers.setContentType(type); headers.add("Accept", MediaType.APPLICATION_JSON.toString()); - HttpEntity formEntity = new HttpEntity(req, headers); + HttpEntity formEntity = new HttpEntity<>(req, headers); ResponseEntity response = restTemplate.postForEntity(url, formEntity, String.class); log.info("推送结果 {} :{}", baseinfo.getBaseProjId(), response); } catch (Exception e) { @@ -1531,7 +1531,7 @@ public class GovProjectCollectionManage { MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); headers.setContentType(type); headers.add("Accept", MediaType.APPLICATION_JSON.toString()); - HttpEntity formEntity = new HttpEntity(null, headers); + HttpEntity formEntity = new HttpEntity<>(null, headers); ResponseEntity response = restTemplate.postForEntity(url, formEntity, String.class); log.info("推送删除结果 :{}", response); } catch (Exception e) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsController.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsController.java index 93b55ad..07467c4 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/controller/IrsController.java @@ -16,7 +16,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import java.io.UnsupportedEncodingException; import java.net.UnknownHostException; import java.security.NoSuchAlgorithmException; import java.util.List; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/CountConfirmByMeetingIdDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/CountConfirmByMeetingIdDTO.java index 9f300de..679b1a4 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/CountConfirmByMeetingIdDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/dto/CountConfirmByMeetingIdDTO.java @@ -3,6 +3,7 @@ package com.hz.pm.api.meeting.entity.dto; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; +import lombok.NoArgsConstructor; import lombok.experimental.Tolerate; /** @@ -14,14 +15,10 @@ import lombok.experimental.Tolerate; * @since 14:21 2022/8/8 */ @Data -@Builder +@NoArgsConstructor @AllArgsConstructor public class CountConfirmByMeetingIdDTO { - @Tolerate - public CountConfirmByMeetingIdDTO() { - } - private Long meetingId; private Integer total; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/ExpertExportManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/ExpertExportManage.java index 2bc10df..1999b8c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/ExpertExportManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/ExpertExportManage.java @@ -72,17 +72,6 @@ public class ExpertExportManage { private static final String EXPERT_INVITE = "meeting/专家抽取表.ftl"; - //================================================================================================================== - static Function meetingUsageTime = (type) -> { - if (1 == type) { - return "半天"; - } - if (2 == type) { - return "一天"; - } - return StrUtil.EMPTY; - }; - static Supplier wordName = () -> UUID.randomUUID().toString(true) + ".doc"; private List listExpertsByAgreeOrLeave(Long meetingId) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/MeetingExpertServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/MeetingExpertServiceImpl.java index a6521e0..ca8b6a3 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/MeetingExpertServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/service/impl/MeetingExpertServiceImpl.java @@ -61,11 +61,11 @@ public class MeetingExpertServiceImpl extends ServiceImpl { Long meetingId = w.get(0).getMeetingId(); - CountConfirmByMeetingIdDTO confirm = CountConfirmByMeetingIdDTO.builder() - .confirmed(0) - .total(countByRandom.getOrDefault(meetingId, 0)) - .meetingId(meetingId) - .build(); + CountConfirmByMeetingIdDTO confirm = new CountConfirmByMeetingIdDTO(); + confirm.setConfirmed(0); + confirm.setTotal(countByRandom.getOrDefault(meetingId, 0)); + confirm.setMeetingId(meetingId); + w.forEach(item -> { ExpertAttendStatusEnum attendStatus = ExpertAttendStatusEnum.getByCode(item.getStatus()); if (ExpertInviteTypeEnum.APPOINT.eq(item.getInviteType())) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/TagsCacheImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/TagsCacheImpl.java index 943968e..5a70d9c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/TagsCacheImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meta/helper/impl/TagsCacheImpl.java @@ -56,8 +56,8 @@ public class TagsCacheImpl extends AbstractTagsCache { @Override public Map getNameTagMap() { Map nameTagMap = new HashMap<>(1024); - for (String key : tagCacheMap.keySet()) { - nameTagMap.put(tagCacheMap.get(key).getTagName(), tagCacheMap.get(key)); + for (Map.Entry entry : tagCacheMap.entrySet()) { + nameTagMap.put(entry.getValue().getTagName(), entry.getValue()); } return nameTagMap; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/OrganizationManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/OrganizationManage.java index 388a7dc..4cc698f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/OrganizationManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/organization/manage/OrganizationManage.java @@ -156,7 +156,7 @@ public class OrganizationManage { .like(DingOrganization::getOrganizationName, organizationName) .in(onlyUnit, DingOrganization::getTypeCode, Lists.newArrayList(DingOrganizationContant.UNIT_TYPE, DingOrganizationContant.HOLLOW))); - if (dingOrganizationList.size() == 0) { + if (dingOrganizationList.isEmpty()) { return new ArrayList<>(); } } else if (StrUtils.isBlank(organizationCode)) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/req/PerformanceAppraisalListReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/req/PerformanceAppraisalListReq.java index df0b298..d047c07 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/req/PerformanceAppraisalListReq.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/req/PerformanceAppraisalListReq.java @@ -3,7 +3,6 @@ package com.hz.pm.api.performance.model.req; import com.ningdatech.basic.model.PagePo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.time.LocalDateTime; /** *

diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java index cce06dc..851f9b5 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java @@ -376,10 +376,7 @@ public class DeclaredProjectManage { if ((total = page.getTotal()) == 0) { return PageVo.empty(); } - List records = CollUtils.convert(page.getRecords(), w -> { - ProjectLibListItemVO item = BeanUtil.copyProperties(w,ProjectLibListItemVO.class); - return item; - }); + List records = CollUtils.convert(page.getRecords(), w -> BeanUtil.copyProperties(w,ProjectLibListItemVO.class)); return PageVo.of(records, total); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/DeclaredStatisticsMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/DeclaredStatisticsMapper.java index a40b20a..597892f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/DeclaredStatisticsMapper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/DeclaredStatisticsMapper.java @@ -1,7 +1,6 @@ package com.hz.pm.api.projectdeclared.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hz.pm.api.projectdeclared.model.entity.ProjectDraft; import com.hz.pm.api.projectdeclared.model.po.DeclaredProjectStatisticsPO; import org.apache.ibatis.annotations.Param; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DefaultDeclaredDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DefaultDeclaredDTO.java index 0aa5926..893b931 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DefaultDeclaredDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/dto/DefaultDeclaredDTO.java @@ -3,7 +3,6 @@ package com.hz.pm.api.projectdeclared.model.dto; import cn.hutool.core.collection.CollUtil; import com.google.common.collect.Maps; import com.hz.pm.api.projectlib.model.dto.ProjectDTO; -import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java index 2ac2ae1..51e4f6d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java @@ -94,12 +94,13 @@ public class ProjectRenewalFundManage { /** * 项目续建资金库列表 分页 + * * @param req * @return */ public PageVo list(ProjectRenewalListReq req, UserFullInfoDTO user) { Page page = req.page(); - req = buildProjectLibPermission(req,user); + req = buildProjectLibPermission(req, user); projectRenewalFundDeclarationService.pageSql(page, req); long total; if ((total = page.getTotal()) == 0) { @@ -107,7 +108,7 @@ public class ProjectRenewalFundManage { } List records = CollUtils.convert(page.getRecords(), w -> { ProjectRenewalFundDeclarationVO item = new ProjectRenewalFundDeclarationVO(); - BeanUtils.copyProperties(w,item); + BeanUtils.copyProperties(w, item); return item; }); return PageVo.of(records, total); @@ -118,9 +119,9 @@ public class ProjectRenewalFundManage { //项目查最新 query.eq(Project::getNewest, Boolean.TRUE); //自己单位 - query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); + query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); //立项批复后 都可以 - query.gt(Project::getStatus,ProjectStatusEnum.APPROVED_AFTER_CHOICE.getCode()); + query.gt(Project::getStatus, ProjectStatusEnum.APPROVED_AFTER_CHOICE.getCode()); Page page = projectService.page(req.page(), query); if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); @@ -130,12 +131,12 @@ public class ProjectRenewalFundManage { Set projectCodes = page.getRecords().stream() .map(Project::getProjectCode).collect(Collectors.toSet()); - Map> renewalMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(projectCodes)){ + Map> renewalMap = Maps.newHashMap(); + if (CollUtil.isNotEmpty(projectCodes)) { List renewalDeclarations = projectRenewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) - .eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE) + .eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId)); } @@ -168,13 +169,13 @@ public class ProjectRenewalFundManage { item.setApprovedAmount(w.getApprovalAmount()); item.setAnnualPlanAmount(w.getAnnualPlanAmount()); item.setPrePlanProjectId(w.getPrePlanProjectId()); - if(finalRenewalMap.containsKey(item.getId())){ + if (finalRenewalMap.containsKey(item.getId())) { List prfs = finalRenewalMap.get(item.getId()); - item.setAnnualAccumulateAmount(ProjectLibManage.computeAmount(w.getAnnualPlanAmount(),prfs)); - item.setAnnualAccumulateAmountList(ProjectLibManage.convertAccmulate(w,prfs)); - }else{ + item.setAnnualAccumulateAmount(ProjectLibManage.computeAmount(w.getAnnualPlanAmount(), prfs)); + item.setAnnualAccumulateAmountList(ProjectLibManage.convertAccmulate(w, prfs)); + } else { item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); - item.setAnnualAccumulateAmountList(ProjectLibManage.convertAccmulate(w,Collections.emptyList())); + item.setAnnualAccumulateAmountList(ProjectLibManage.convertAccmulate(w, Collections.emptyList())); } return item; }); @@ -189,7 +190,7 @@ public class ProjectRenewalFundManage { public ProjectRenewalFundDeclarationVO detail(Long id) { // 查询项目申报信息 ProjectRenewalFundDeclaration renewal = projectRenewalFundDeclarationService.getById(id); - if(Objects.isNull(renewal)){ + if (Objects.isNull(renewal)) { return null; } ProjectRenewalFundDeclarationVO vo = new ProjectRenewalFundDeclarationVO(); @@ -208,7 +209,7 @@ public class ProjectRenewalFundManage { GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class) .eq(GovBizProjectApprove::getBaseProjId, renewal.getProjectCode()) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(project)){ + if (Objects.nonNull(project)) { vo.setApprovalAmount(project.getApprovalAmount()); vo.setProjectName(project.getProjectName()); vo.setProjectType(project.getProjectType()); @@ -226,26 +227,24 @@ public class ProjectRenewalFundManage { List renewalDeclarations = projectRenewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) .eq(ProjectRenewalFundDeclaration::getProjectId, vo.getProjectId()) .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) - .eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE) + .eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); Optional.ofNullable(renewalDeclarations).ifPresent(declarations -> - declarations.forEach(declaration -> { - annualAmounts.add(AnnualAmountVO.builder() - .projectId(project.getId()) - .projectCode(project.getProjectCode()) - .projectYear(declaration.getProjectYear()) - .annualAmount(declaration.getAnnualPaymentAmount()) - .haveAmount(declaration.getHaveAmount()) - .govOwnFinanceAmount(declaration.getGovOwnFinanceAmount()) - .bankLendingAmount(declaration.getBankLendingAmount()) - .govSuperiorFinanceAmount(declaration.getGovSuperiorFinanceAmount()) - .otherAmount(declaration.getOtherAmount()) - .build()); - }) + declarations.forEach(declaration -> annualAmounts.add(AnnualAmountVO.builder() + .projectId(project.getId()) + .projectCode(project.getProjectCode()) + .projectYear(declaration.getProjectYear()) + .annualAmount(declaration.getAnnualPaymentAmount()) + .haveAmount(declaration.getHaveAmount()) + .govOwnFinanceAmount(declaration.getGovOwnFinanceAmount()) + .bankLendingAmount(declaration.getBankLendingAmount()) + .govSuperiorFinanceAmount(declaration.getGovSuperiorFinanceAmount()) + .otherAmount(declaration.getOtherAmount()) + .build())) ); vo.setAnnualAccumulateAmountList(annualAmounts); - }else if(Objects.nonNull(baseinfo)){ - if(Objects.nonNull(approve)){ + } else if (Objects.nonNull(baseinfo)) { + if (Objects.nonNull(approve)) { vo.setApprovalAmount(approve.getBaseInitialReviewTotalMoney()); } vo.setProjectName(baseinfo.getBaseProjName()); @@ -265,26 +264,24 @@ public class ProjectRenewalFundManage { List renewalDeclarations = projectRenewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) .eq(ProjectRenewalFundDeclaration::getProjectCode, vo.getProjectCode()) .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) - .eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE) + .eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); Optional.ofNullable(renewalDeclarations).ifPresent(declarations -> - declarations.forEach(declaration -> { - annualAmounts.add(AnnualAmountVO.builder() - .projectId(baseinfo.getId()) - .projectCode(baseinfo.getBaseProjId()) - .projectYear(declaration.getProjectYear()) - .annualAmount(declaration.getAnnualPaymentAmount()) - .haveAmount(declaration.getHaveAmount()) - .govOwnFinanceAmount(declaration.getGovOwnFinanceAmount()) - .bankLendingAmount(declaration.getBankLendingAmount()) - .govSuperiorFinanceAmount(declaration.getGovSuperiorFinanceAmount()) - .otherAmount(declaration.getOtherAmount()) - .build()); - }) + declarations.forEach(declaration -> annualAmounts.add(AnnualAmountVO.builder() + .projectId(baseinfo.getId()) + .projectCode(baseinfo.getBaseProjId()) + .projectYear(declaration.getProjectYear()) + .annualAmount(declaration.getAnnualPaymentAmount()) + .haveAmount(declaration.getHaveAmount()) + .govOwnFinanceAmount(declaration.getGovOwnFinanceAmount()) + .bankLendingAmount(declaration.getBankLendingAmount()) + .govSuperiorFinanceAmount(declaration.getGovSuperiorFinanceAmount()) + .otherAmount(declaration.getOtherAmount()) + .build())) ); vo.setAnnualAccumulateAmountList(annualAmounts); - }else if(Objects.nonNull(operationBaseinfo)){ - if(Objects.nonNull(approve)){ + } else if (Objects.nonNull(operationBaseinfo)) { + if (Objects.nonNull(approve)) { vo.setApprovalAmount(approve.getBaseInitialReviewTotalMoney()); } vo.setProjectName(operationBaseinfo.getBaseProjName()); @@ -303,7 +300,7 @@ public class ProjectRenewalFundManage { List renewalDeclarations = projectRenewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) .eq(ProjectRenewalFundDeclaration::getProjectCode, vo.getProjectCode()) .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) - .eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE) + .eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); Optional.ofNullable(renewalDeclarations).ifPresent(declarations -> declarations.forEach(declaration -> annualAmounts.add(AnnualAmountVO.builder() @@ -325,6 +322,7 @@ public class ProjectRenewalFundManage { /** * 申报 + * * @param dto * @return */ @@ -342,18 +340,18 @@ public class ProjectRenewalFundManage { .eq(GovBizProjectApply::getBaseProjId, projectCode) .last(BizConst.LIMIT_1)); - VUtils.isTrue(Objects.isNull(project) && Objects.isNull(baseinfo) && Objects.isNull(operationBaseinfo)).throwMessage(String.format("关联的项目【%s】不存在 提交失败!",projectCode)); + VUtils.isTrue(Objects.isNull(project) && Objects.isNull(baseinfo) && Objects.isNull(operationBaseinfo)).throwMessage(String.format("关联的项目【%s】不存在 提交失败!", projectCode)); ProjectRenewalFundDeclaration declaration = new ProjectRenewalFundDeclaration(); //如果是重新申报 - if(Objects.nonNull(dto.getId())){ + if (Objects.nonNull(dto.getId())) { ProjectRenewalFundDeclaration oldDeclaration = projectRenewalFundDeclarationService.getById(dto.getId()); - VUtils.isTrue(Objects.isNull(oldDeclaration)).throwMessage(String.format("重新申报失败 【%s】 该申报不存在!",dto.getId())); - BeanUtils.copyProperties(oldDeclaration,declaration); - }else{ + VUtils.isTrue(Objects.isNull(oldDeclaration)).throwMessage(String.format("重新申报失败 【%s】 该申报不存在!", dto.getId())); + BeanUtils.copyProperties(oldDeclaration, declaration); + } else { declaration.setCreateOn(LocalDateTime.now()); declaration.setUpdateOn(LocalDateTime.now()); } - BeanUtils.copyProperties(dto,declaration); + BeanUtils.copyProperties(dto, declaration); //有2个条件要判断 续建资金 //1. 如果有审核中的 是不能继续申请的 @@ -366,38 +364,38 @@ public class ProjectRenewalFundManage { VUtils.isTrue(Objects.isNull(dto.getProjectYear())).throwMessage("新建的续建项目信息 年度不能为空"); ProjectRenewalFundDeclaration lastRenewalFund = projectRenewalFundDeclarationService.getOne(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) .eq(ProjectRenewalFundDeclaration::getProjectCode, projectCode) - .eq(ProjectRenewalFundDeclaration::getApprovalStatus,ProjectRenewalApprovalStatusEnum.PASS.name()) + .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) .orderByDesc(ProjectRenewalFundDeclaration::getProjectYear) .last(BizConst.LIMIT_1)); //如果没有续建资金信息 就要比 当前项目的年度要大 - if(Objects.isNull(lastRenewalFund)){ - if(Objects.nonNull(project)){ + if (Objects.isNull(lastRenewalFund)) { + if (Objects.nonNull(project)) { VUtils.isTrue(project.getProjectYear() >= dto.getProjectYear()) .throwMessage("续建资金年度错误!"); - }else if(Objects.nonNull(apply)){ + } else if (Objects.nonNull(apply)) { VUtils.isTrue(StringUtils.isBlank(apply.getBaseProjSetYear()) || Integer.parseInt(apply.getBaseProjSetYear()) >= dto.getProjectYear()) .throwMessage("续建资金年度错误!"); } - }else{ + } else { VUtils.isTrue(lastRenewalFund.getProjectYear() >= dto.getProjectYear()) .throwMessage("续建资金年度错误!"); } declaration.setApprovalStatus(ProjectRenewalApprovalStatusEnum.PENDING.name()); - if(Objects.nonNull(project)){ + if (Objects.nonNull(project)) { declaration.setRegionCode(project.getAreaCode()); declaration.setOrgCode(project.getBuildOrgCode()); - }else if(Objects.nonNull(baseinfo)){ - declaration.setRegionCode(StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode().substring(0,6) : StringUtils.EMPTY); + } else if (Objects.nonNull(baseinfo)) { + declaration.setRegionCode(StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode().substring(0, 6) : StringUtils.EMPTY); declaration.setOrgCode(baseinfo.getBaseBuildDeprtDing()); - }else if(Objects.nonNull(operationBaseinfo)){ - declaration.setRegionCode(StringUtils.isNotBlank(operationBaseinfo.getBaseAreaCode()) ? operationBaseinfo.getBaseAreaCode().substring(0,6) : StringUtils.EMPTY); + } else if (Objects.nonNull(operationBaseinfo)) { + declaration.setRegionCode(StringUtils.isNotBlank(operationBaseinfo.getBaseAreaCode()) ? operationBaseinfo.getBaseAreaCode().substring(0, 6) : StringUtils.EMPTY); declaration.setOrgCode(operationBaseinfo.getBaseBuildDeprtDing()); } - if(!projectRenewalFundDeclarationService.saveOrUpdate(declaration)){ - throw new BusinessException(String.format("申报失败 【%s】",dto.getId())); + if (!projectRenewalFundDeclarationService.saveOrUpdate(declaration)) { + throw new BusinessException(String.format("申报失败 【%s】", dto.getId())); } return declaration.getId(); } @@ -412,14 +410,14 @@ public class ProjectRenewalFundManage { VUtils.isTrue(CollUtil.isEmpty(paymentPlans)).throwMessage("未有所选年度的支付计划,无法提交"); boolean hasYearPlan = Boolean.FALSE; - for(PaymentPlan plan : paymentPlans){ - if(Objects.isNull(plan.getPaymentTime())){ + for (PaymentPlan plan : paymentPlans) { + if (Objects.isNull(plan.getPaymentTime())) { continue; } int year = plan.getPaymentTime().getYear(); - if(projectYear.equals(year)){ + if (projectYear.equals(year)) { hasYearPlan = Boolean.TRUE; - }else if(projectYear.compareTo(year) > 0){ + } else if (projectYear.compareTo(year) > 0) { //2 如果有 这一年前的实际支付金额有没有填 VUtils.isTrue(Objects.isNull(plan.getActualPaymentAmount())) .throwMessage("有漏填写此年度之前年度的实际支付金额,请去合同备案补充"); @@ -434,7 +432,7 @@ public class ProjectRenewalFundManage { (c.getPaymentTime().getYear() - projectYear) <= 0) .map(c -> Objects.nonNull(c.getPaymentAmount()) ? c.getPaymentAmount() : BigDecimal.ZERO) .reduce(BigDecimal::add); - if(planSumOp.isPresent()){ + if (planSumOp.isPresent()) { planSum = planSumOp.get(); } BigDecimal actualPlanSum = BigDecimal.ZERO; @@ -442,7 +440,7 @@ public class ProjectRenewalFundManage { (c.getPaymentTime().getYear() - projectYear) < 0) .map(c -> Objects.nonNull(c.getActualPaymentAmount()) ? c.getActualPaymentAmount() : BigDecimal.ZERO) .reduce(BigDecimal::add); - if(actualPlanSumOp.isPresent()){ + if (actualPlanSumOp.isPresent()) { actualPlanSum = actualPlanSumOp.get(); } BigDecimal maxAmount = planSum.subtract(actualPlanSum); @@ -452,6 +450,7 @@ public class ProjectRenewalFundManage { /** * 续建项目审核 + * * @param param * @return */ @@ -467,24 +466,24 @@ public class ProjectRenewalFundManage { .eq(GovOperationProjectBaseinfo::getBaseProjId, projectRenewal.getProjectCode()) .last(BizConst.LIMIT_1)); VUtils.isTrue(Objects.isNull(project) && Objects.isNull(baseinfo) && Objects.isNull(operationBaseinfo)).throwMessage("关联的项目已经被删除!"); - if (Boolean.TRUE.equals(param.getResult())){ + if (Boolean.TRUE.equals(param.getResult())) { projectRenewal.setApprovalStatus(ProjectRenewalApprovalStatusEnum.PASS.name()); - }else { + } else { String auditOpinion = param.getAuditOpinion(); - if (StrUtil.isBlank(auditOpinion)){ + if (StrUtil.isBlank(auditOpinion)) { throw new BizException("审核意见不能为空"); } projectRenewal.setAuditOpinion(auditOpinion); projectRenewal.setApprovalStatus(ProjectRenewalApprovalStatusEnum.NOT_PASS.name()); } - if(Objects.nonNull(project)){ + if (Objects.nonNull(project)) { projectRenewal.setRegionCode(project.getAreaCode()); projectRenewal.setOrgCode(project.getBuildOrgCode()); - }else if(Objects.nonNull(baseinfo)){ - projectRenewal.setRegionCode(StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode().substring(0,6) : StringUtils.EMPTY); + } else if (Objects.nonNull(baseinfo)) { + projectRenewal.setRegionCode(StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode().substring(0, 6) : StringUtils.EMPTY); projectRenewal.setOrgCode(baseinfo.getBaseBuildDeprtDing()); - }else if(Objects.nonNull(operationBaseinfo)){ - projectRenewal.setRegionCode(StringUtils.isNotBlank(operationBaseinfo.getBaseAreaCode()) ? operationBaseinfo.getBaseAreaCode().substring(0,6) : StringUtils.EMPTY); + } else if (Objects.nonNull(operationBaseinfo)) { + projectRenewal.setRegionCode(StringUtils.isNotBlank(operationBaseinfo.getBaseAreaCode()) ? operationBaseinfo.getBaseAreaCode().substring(0, 6) : StringUtils.EMPTY); projectRenewal.setOrgCode(operationBaseinfo.getBaseBuildDeprtDing()); } projectRenewal.setAuditOpinion(param.getAuditOpinion()); @@ -495,6 +494,7 @@ public class ProjectRenewalFundManage { /** * 续建项目删除 + * * @param projectRenewalId * @return */ @@ -536,7 +536,7 @@ public class ProjectRenewalFundManage { String fileName = "续建项目资金库列表"; - ExcelDownUtil.setFileName(fileName,response); + ExcelDownUtil.setFileName(fileName, response); //数据导出处理函数 try { EasyExcel.write(response.getOutputStream(), ProjectRenewalExportDTO.class) @@ -577,7 +577,7 @@ public class ProjectRenewalFundManage { } String fileName = "续建项目资金申报列表"; - ExcelDownUtil.setFileName(fileName,response); + ExcelDownUtil.setFileName(fileName, response); //数据导出处理函数 try { EasyExcel.write(response.getOutputStream(), ProjectRenewalDeclareExportDTO.class) @@ -604,11 +604,8 @@ public class ProjectRenewalFundManage { req.setUserValue(user.getEmpPosUnitCode()); break; case COMPANY_MANAGER: - //单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 - req.setUserType("org"); - req.setUserValue(user.getEmpPosUnitCode()); - break; case SUPER_ADMIN: + //单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 //超级管理员 也只能看本单位的 req.setUserType("org"); req.setUserValue(user.getEmpPosUnitCode()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java index 79b7e17..573fb32 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java @@ -25,7 +25,6 @@ import com.hz.pm.api.gov.model.entity.*; import com.hz.pm.api.gov.service.*; import com.hz.pm.api.meta.model.entity.ExpertTag; import com.hz.pm.api.meta.service.IExpertTagService; -import com.hz.pm.api.meta.service.IMetaTagService; import com.hz.pm.api.performance.model.entity.PerformanceAppraisalProject; import com.hz.pm.api.performance.service.IPerformanceAppraisalProjectService; import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; @@ -42,7 +41,6 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.flowable.engine.HistoryService; import org.flowable.engine.history.HistoricActivityInstance; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -71,52 +69,25 @@ public class CockpitStatsStatisticsTask { @Value("${spring.profiles.active}") public String active; - @Autowired - private ICockpitStatsService cockpitStatsService; - - @Autowired - private RegionCacheHelper regionCacheHelper; - - @Autowired - private IProjectService projectService; - - @Autowired - private IProjectInstService projectInstService; - - @Autowired - private IExpertUserFullInfoService expertUserFullInfoService; - - @Autowired - private IPerformanceAppraisalProjectService performanceAppraisalProjectService; - @Autowired - private IGovBizProjectBaseinfoService baseinfoService; - - @Autowired - private IGovBizProjectApplyService applyService; - - @Autowired - private HistoryService historyService; - - @Autowired - private IGovBizProjectApproveService approveService; - - @Autowired - private IGovBizProjectProcureService procureService; - - @Autowired - private IGovBizProjectCimplementService cimplementService; - - @Autowired - private IEarlyWarningRecordsService earlyWarningRecordsService; - - @Autowired - private IExpertIntentionWorkRegionService expertIntentionWorkRegionService; + private final ICockpitStatsService cockpitStatsService; + private final RegionCacheHelper regionCacheHelper; + private final IProjectService projectService; + private final IProjectInstService projectInstService; + private final IExpertUserFullInfoService expertUserFullInfoService; + private final IPerformanceAppraisalProjectService performanceAppraisalProjectService; + private final IGovBizProjectBaseinfoService baseinfoService; + private final IGovBizProjectApplyService applyService; + private final HistoryService historyService; + private final IGovBizProjectApproveService approveService; + private final IGovBizProjectProcureService procureService; + private final IGovBizProjectCimplementService cimplementService; + private final IEarlyWarningRecordsService earlyWarningRecordsService; + private final IExpertIntentionWorkRegionService expertIntentionWorkRegionService; + private final IExpertTagService expertTagService; private List years = Lists.newArrayList(2021,2022,2023,2024,2025); - private final IMetaTagService metaTagService; - private final IExpertTagService expertTagService; /** * 定义统计 驾驶舱数据 每天3点开始执行一次 @@ -185,10 +156,10 @@ public class CockpitStatsStatisticsTask { Integer thisYear = LocalDateTime.now().getYear(); CockpitStats thisYearData = map.get(cockpitStats.getRegionCode() + thisYear); CockpitStats lastYearData = map.get(cockpitStats.getRegionCode() + (thisYear - 1)); - buidMonitorRise(cockpitStats,thisYearData,lastYearData); + buildMonitorRise(cockpitStats,thisYearData,lastYearData); }else{ CockpitStats lastYearData = map.get(cockpitStats.getRegionCode() + (cockpitStats.getYear() - 1)); - buidMonitorRise(cockpitStats,cockpitStats,lastYearData); + buildMonitorRise(cockpitStats,cockpitStats,lastYearData); } } @@ -290,10 +261,10 @@ public class CockpitStatsStatisticsTask { cockpitStats.setMonitorAcceptConditionsNotStandardsNum(0); //1.6 总申报金额 - Double totalDeclaredAmount = projects.stream().mapToDouble(p -> Objects.nonNull(p.getDeclareAmount()) ? p.getDeclareAmount().doubleValue() : 0.0).sum(); + double totalDeclaredAmount = projects.stream().mapToDouble(p -> Objects.nonNull(p.getDeclareAmount()) ? p.getDeclareAmount().doubleValue() : 0.0).sum(); cockpitStats.setMonitorDeclaredAmount(BigDecimal.valueOf(totalDeclaredAmount)); //1.7 总安全投入 - Double totalSafytyAmount = projects.stream().mapToDouble(p -> { + double totalSafetyAmount = projects.stream().mapToDouble(p -> { if(Objects.nonNull(p.getSafetyInputDescribe())){ final Double[] total = {0.0}; try{ @@ -310,7 +281,7 @@ public class CockpitStatsStatisticsTask { } return 0.0; }).sum(); - cockpitStats.setMonitorSafetyInputAmount(BigDecimal.valueOf(totalSafytyAmount)); + cockpitStats.setMonitorSafetyInputAmount(BigDecimal.valueOf(totalSafetyAmount)); //1.8等保密评 SecrecyPasswordGradePO secrecyPasswordGradePo = cockpitStatsService.getSecrecyPasswordGrade(regionCode, year); @@ -570,7 +541,7 @@ public class CockpitStatsStatisticsTask { if(Objects.nonNull(p.getStatus()) && (ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode().equals(p.getStatus()) || (ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode().equals(p.getStatus()) && - searchSechmeReviewFlow(p.getProjectCode())))){ + searchSchemaReviewFlow(p.getProjectCode())))){ return Boolean.TRUE; } return Boolean.FALSE; @@ -590,7 +561,7 @@ public class CockpitStatsStatisticsTask { (ProjectStatusEnum.TO_BE_APPROVED.getCode().equals(p.getStatus()) || p.getStatus().compareTo(ProjectStatusEnum.APPROVED_AFTER_CHOICE.getCode()) > 0 || (ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode().equals(p.getStatus()) && - searchSechmeReviewedFlow(p.getProjectCode())))){ + searchSchemaReviewedFlow(p.getProjectCode())))){ return Boolean.TRUE; } return Boolean.FALSE; @@ -794,7 +765,6 @@ public class CockpitStatsStatisticsTask { //9.绩效 List projectCodes = projects.stream().map(Project::getProjectCode).collect(Collectors.toList()); - Map projectMap = projects.stream().filter(p -> Objects.nonNull(p.getProjectCode())).collect(Collectors.toMap(Project::getProjectCode, Project::getProjectName)); if(CollUtil.isNotEmpty(projectCodes)){ List performanceAll = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) .in(PerformanceAppraisalProject::getProjectCode, projectCodes)); @@ -869,7 +839,7 @@ public class CockpitStatsStatisticsTask { * @param projectCode * @return */ - private boolean searchSechmeReviewFlow(String projectCode) { + private boolean searchSchemaReviewFlow(String projectCode) { Project project = projectService.getProjectByCode(projectCode); if(Objects.isNull(project)){ return Boolean.FALSE; @@ -902,7 +872,7 @@ public class CockpitStatsStatisticsTask { return Boolean.FALSE; } //已经开始审批 - private boolean searchSechmeReviewedFlow(String projectCode) { + private boolean searchSchemaReviewedFlow(String projectCode) { Project project = projectService.getProjectByCode(projectCode); if(Objects.isNull(project)){ return Boolean.FALSE; @@ -936,7 +906,7 @@ public class CockpitStatsStatisticsTask { */ private Integer computeLagging(List projects) { List projectCodes = projects.stream().map(Project::getProjectCode).collect(Collectors.toList()); - Map map = projects.stream().collect(Collectors.toMap(p -> p.getProjectCode(), p -> p)); + Map map = projects.stream().collect(Collectors.toMap(Project::getProjectCode, p -> p)); List records = Lists.newArrayList(); if(CollUtil.isNotEmpty(projectCodes)){ records = earlyWarningRecordsService.list(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) @@ -956,7 +926,7 @@ public class CockpitStatsStatisticsTask { }).sum(); } - private void buidMonitorRise(CockpitStats cockpitStats, CockpitStats thisYearData, CockpitStats lastYearData) { + private void buildMonitorRise(CockpitStats cockpitStats, CockpitStats thisYearData, CockpitStats lastYearData) { if(Objects.isNull(thisYearData) || Objects.isNull(lastYearData)){ return; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java index b72e5e8..bfda643 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java @@ -65,7 +65,7 @@ public class EarlyWarningManage { //1.存入 预警记录 UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); WflowEarlyWarningRecords records = new WflowEarlyWarningRecords(); - String content = StringUtils.EMPTY; + String content; switch (WarningRuleTypeEnum.checkByCode(ruleType)) { case PROCESS_WARNING: diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/AbstractMsgExtraDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/AbstractMsgExtraDTO.java index 234a13a..d4c68e5 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/AbstractMsgExtraDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/AbstractMsgExtraDTO.java @@ -1,5 +1,8 @@ package com.hz.pm.api.sys.model.dto; +import com.hz.pm.api.staging.enums.MsgTypeEnum; +import lombok.Data; + /** *

* AbstractExtraDTO @@ -8,6 +11,9 @@ package com.hz.pm.api.sys.model.dto; * @author WendyYang * @since 2023/4/12 **/ +@Data public abstract class AbstractMsgExtraDTO { + private MsgTypeEnum msgType; + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/ProjectAuditMsgExtraDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/ProjectAuditMsgExtraDTO.java index f50c314..2cdbec5 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/ProjectAuditMsgExtraDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/ProjectAuditMsgExtraDTO.java @@ -2,8 +2,8 @@ package com.hz.pm.api.todocenter.model.dto; import com.hz.pm.api.sys.model.dto.AbstractMsgExtraDTO; import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; /** @@ -13,12 +13,14 @@ import lombok.NoArgsConstructor; * @since 2023/04/12 16:13 */ @Data -@AllArgsConstructor @NoArgsConstructor +@EqualsAndHashCode(callSuper = true) public class ProjectAuditMsgExtraDTO extends AbstractMsgExtraDTO { + @ApiModelProperty("项目ID") private Long projectId; @ApiModelProperty("流程实例ID") private String instanceId; + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java index 8c54d17..f8cc04c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java @@ -5,12 +5,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.model.GenericResult; -import com.ningdatech.basic.model.PageVo; -import com.hz.pm.api.common.model.constant.RegionConst; import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.model.constant.RegionConst; import com.hz.pm.api.common.util.BizUtils; import com.hz.pm.api.common.util.StrUtils; import com.hz.pm.api.ding.constants.DingOrganizationContant; @@ -22,8 +19,8 @@ import com.hz.pm.api.sys.model.entity.Role; import com.hz.pm.api.sys.model.entity.UserRole; import com.hz.pm.api.sys.service.IRoleService; import com.hz.pm.api.sys.service.IUserRoleService; -import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; import com.hz.pm.api.user.model.po.ReqUserDetailEditPO; import com.hz.pm.api.user.model.po.ReqUserDetailPO; import com.hz.pm.api.user.model.po.ReqUserDisableOrEnablePO; @@ -34,6 +31,9 @@ import com.hz.pm.api.user.model.vo.UserRoleVO; import com.hz.pm.api.user.security.model.UserFullInfoDTO; import com.hz.pm.api.user.service.IUserInfoService; import com.hz.pm.api.user.util.LoginUserUtil; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.model.GenericResult; +import com.ningdatech.basic.model.PageVo; import com.ningdatech.zwdd.ZwddIntegrationProperties; import com.ningdatech.zwdd.client.ZwddClient; import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; @@ -96,7 +96,7 @@ public class UserInfoManage { List records = page.getRecords(); long total = page.getTotal(); List result = new ArrayList<>(); - if (records != null && records.size() > 0) { + if (records != null && !records.isEmpty()) { List employeeCodeList = records.stream().map(UserInfo::getEmployeeCode) .distinct().collect(Collectors.toList()); @@ -134,7 +134,7 @@ public class UserInfoManage { private List getCompliantOrgEmpCodeList(String orgName, String orgCode) { if (StringUtils.isBlank(orgName) && StringUtils.isBlank(orgCode)) { - return null; + return Collections.emptyList(); } List compliantOrgCodeList = new ArrayList<>(); @@ -176,12 +176,8 @@ public class UserInfoManage { List dingEmployeeInfoList = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) .in(DingEmployeeInfo::getEmpPosUnitCode, compliantOrgCodeList)); - List compliantOrgEmpCodeList = dingEmployeeInfoList.stream() + return dingEmployeeInfoList.stream() .map(DingEmployeeInfo::getEmployeeCode).distinct().collect(Collectors.toList()); -// if (compliantOrgEmpCodeList.size() > 500) { -// throw new BizException("搜索结果过多请缩小搜索范围"); -// } - return compliantOrgEmpCodeList; } /** @@ -194,7 +190,7 @@ public class UserInfoManage { userRoleList = userRoleList.stream().filter(r -> Objects.nonNull(r.getId())).collect(Collectors.toList()); } if (CollUtil.isEmpty(userRoleList)) { - return null; + return Collections.emptyList(); } List roleIdList = userRoleList.stream().map(UserRoleVO::getId).collect(Collectors.toList()); @@ -361,9 +357,7 @@ public class UserInfoManage { @Transactional(rollbackFor = Exception.class) public void bandUserMobile(UserInfo userInfo, ReqUserDetailEditPO reqUserDetailEditPO) { String employeeCode = reqUserDetailEditPO.getEmployeeCode(); - String mobile = userInfo.getMobile(); Long userId = userInfo.getId(); -// if (StringUtils.isBlank(mobile)) { // 校验手机号是否重复 UserInfo repeatMobileUserInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) .eq(UserInfo::getMobile, reqUserDetailEditPO.getPhoneNo()).ne(UserInfo::getId, userId)); @@ -382,8 +376,6 @@ public class UserInfoManage { .set(DingEmployeeInfo::getBindUserMobile, phoneNo)); iUserInfoService.updateById(userInfo); } -// } - } @Transactional(rollbackFor = Exception.class) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IMhCompanyService.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IMhCompanyService.java index b62bc54..6bc2dc1 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IMhCompanyService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IMhCompanyService.java @@ -4,7 +4,6 @@ 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.user.entity.MhCompany; -import com.hz.pm.api.user.entity.MhUnit; import com.ningdatech.basic.util.CollUtils; import java.util.Collection; From 458677959f980661cbe66cce1767176c6c4b6cd3 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Tue, 9 Jan 2024 10:16:12 +0800 Subject: [PATCH 12/44] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hz-pm-api/src/main/resources/application-test.yml | 267 +++++++++++++++++++++ hz-pm-api/src/main/resources/security/auth-dev.yml | 1 + .../src/main/resources/security/auth-test.yml | 86 +++++++ 3 files changed, 354 insertions(+) create mode 100644 hz-pm-api/src/main/resources/application-test.yml create mode 100644 hz-pm-api/src/main/resources/security/auth-test.yml diff --git a/hz-pm-api/src/main/resources/application-test.yml b/hz-pm-api/src/main/resources/application-test.yml new file mode 100644 index 0000000..bbca290 --- /dev/null +++ b/hz-pm-api/src/main/resources/application-test.yml @@ -0,0 +1,267 @@ +server: + port: 8004 + servlet: + context-path: /hzpm + #最大并发数,默认200 + tomcat: + threads: + max: 600 +spring: + mvc: + pathmatch: + matching-strategy: ant_path_matcher + session: + store-type: redis + redis: + namespace: "spring:session" + redis: + timeout: 5000 + host: localhost + port: 6379 + database: 1 + password: + jedis: + pool: + max-active: 200 + max-idle: 500 + min-idle: 8 + max-wait: 10000 + application: + name: hzpm + jackson: + default-property-inclusion: non_null + time-zone: GMT+8 + date-format: yyyy-MM-dd HH:mm:ss + jpa: + properties: + hibernate: + default_schema: PUBLIC + hbm2ddl: + auto: update + show_sql: true + show-sql: true + hibernate: + ddl-auto: update + datasource: + type: com.zaxxer.hikari.HikariDataSource + driverClassName: dm.jdbc.driver.DmDriver + url: jdbc:dm://10.54.38.191:5236/HZ_PROJECT_MANAGEMENT_TEST?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8 + username: XMXTGL + password: XMXTGL@2023 + # 数据源 + hikari: + # 是客户端等待连接池连接的最大毫秒数 + connection-timeout: 30000 + # 是允许连接在连接池中空闲的最长时间 + minimum-idle: 20 + # 配置最大池大小 + maximum-pool-size: 200 + # 是允许连接在连接池中空闲的最长时间(以毫秒为单位) + idle-timeout: 60000 + # 池中连接关闭后的最长生命周期(以毫秒为单位) + max-lifetime: 600000 + # 配置从池返回的连接的默认自动提交行为。默认值为true。 + auto-commit: true + # 开启连接监测泄露 + leak-detection-threshold: 5000 + # 测试连接数据库 + connection-test-query: SELECT 1 + #设置上传 单个文件的大小 + servlet: + multipart: + max-file-size: 100MB + max-request-size: 150MB +mybatis-plus: + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + global-config: + db-config: + logic-delete-value: true + logic-not-delete-value: false +logging: + config: classpath:logback-spring.xml + #日志配置 + level: + root: info + file: + path: logs +nd: + cache: + type: REDIS + serializerType: ProtoStuff + cacheNullVal: true + def: + keyPrefix: pm + log: + enabled: true + type: DB + # 文件存储 + file: + storage-type: ALI_OSS + ali: + protocol: http:// + bucket: szxcxtoss + urlPrefix: oss-cn-hangzhou-hzltzwy-d01-a.ops.hzegcxc.cn + endpoint: oss-cn-hangzhou-hzltzwy-d01-a.ops.hzegcxc.cn + accessKeyId: LNoIzKV82OvTJrKI + accessKeySecret: QI9y9jGqAbPXGn3oz1JHlbvsJQEnUo + rootPath: hzpm-test +# 日志文件配置 +log: + path: ./logs + info: + file-size: 50MB + max-size: 30 + total-size: 2048MB + error: + file-size: 10MB + max-size: 30 + total-size: 300MB + +swagger: + enabled: true + +flowable: + async-executor-activate: true + #关闭一些不需要的功能服务 + rest-api-enabled: false + # database-schema-update: false + idm: + enabled: false + common: + enabled: false + dmn: + enabled: false + form: + enabled: false + app: + enabled: false + database-schema: HZ_PROJECT_MANAGEMENT_TEST +wflow: + file: + max-size: 20 #最大文件上传大小,MB + +sa-token: + # token 名称 (同时也是cookie名称) + token-name: wflowToken + # token 有效期,单位s 默认30天, -1代表永不过期 + timeout: 172800 + # token 临时有效期 (指定时间内无操作就视为token过期) 单位: 秒 + activity-timeout: -1 + # 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录) + is-concurrent: true + # 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token) + is-share: false + # token风格 + token-style: uuid + # 是否输出操作日志 + is-log: false + +#浙政钉公司顶级organizationCode +organization: + dept-visible-scopes: + - GO_c1a6f8d5338e4a468337b08da76e2e31 + +yxt: + wsdl-url: classpath:wsdl-prod.xml + #账号 + user-code: Lswqwqsdsjj121 + #密码 + password: Lssdsjj@20wqwqwqw21 + #音信通开关 + sms-enable: false + tel-enable: false + +#省局联审 请求信息 +provincial: + host: https://pms.zj.gov.cn/prometheus-zhejiang_foreign + pushUrl: /api/v1/foreign/importantPro + detailUrl: /api/v1/foreign/importantProView + domainUrl: /api/v1/foreign/dominantUnit + key: b5b2096953534a53991be4ea95f8cffa + secret: 1bec9b77134d4962ac466fbe9696b897 + +#天印服务器接口信息 +irs: + is-search-app: true + digital-resource-indicators: + url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/99E2bic31KdXzaa7.htm + interfaceName: 99E2bic31KdXzaa7 + app-key: A331101453557202109017383 + app-secret: 496f0f2a19994f76b4fd9dae087366c7 + seal-platform: + project-id: 330001110 + project-secret: 70e512d40c8f440484db4acab181570a + access-key: 42bcb49bea174986a3bfdfba7d005566 + secret-key: bebff29877d4443abd67fc4f8fb335d8 + api-url: https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020220309000004/seal-platform/seal/v1/rest/sign/signPdf + app-report: + url: https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230427000001/irs-res-bill/report/pdfUrl + appScret: BCDSGS_4ab4235d26a9a357170a39f3a13fd68c + appKey: BCDSGA_d874c8e46b541eb4e8aac6510fd3351b + push-app: + url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/94wbaL1I1Pbz0648.htm + appScret: 496f0f2a19994f76b4fd9dae087366c7 + appKey: A331101453557202109017383 + search-app: + url: https://interface.zjzwfw.gov.cn/gateway/api/001003001029/dataSharing/XS8daav3bcemZ3Ra.htm + appScret: 496f0f2a19994f76b4fd9dae087366c7 + appKey: A331101453557202109017383 + province-gov: + can-search: true + interfaceName: 62vd5jAdM0b7Gr00 + url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/62vd5jAdM0b7Gr00.htm + appSecret: 496f0f2a19994f76b4fd9dae087366c7 + appKey: A331101453557202109017383 + push-project-detail: + url: https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/3XN9R93Pva6db7sf.htm + interfaceName: 3XN9R93Pva6db7sf + appSecret: 496f0f2a19994f76b4fd9dae087366c7 + appKey: A331101453557202109017383 + core-biz: + url: https://interface.zjzwfw.gov.cn/gateway/api/001008012012001/dataSharing/Fc3re2cq7r64Qfa7.htm + interfaceName: Fc3re2cq7r64Qfa7 + appSecret: 496f0f2a19994f76b4fd9dae087366c7 + appKey: A331101453557202109017383 + interface-refresh: + method: POST + request-token-url: http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm + refresh-token-url: http://interface.zjzwfw.gov.cn/gateway/app/refreshTokenBySec.htm + interface-local-refresh: + method: GET + request-token-url: https://interface.ls.local/a/api/requestTokenKey?appKey={appKey}&requestTime={requestTime}&sign={sign} + refresh-token-url: https://interface.ls.local/a/api/refreshTokenKey?appKey={appKey}&requestTime={requestTime}&sign={sign} +hostname: iZ6mx01gyeodd80imxd2gbZ +project: + push-url: http://10.53.168.41:38088/open/api/v1/project-receive/save + no-effective-url: http://10.53.168.41:38088/open/api/v1/project-receive/not-effective + delete-all-url: http://10.53.168.41:38088/open/api/v1/project-receive/delete-all +login: + phone-verify-code: + skip: false + url: http://60.188.225.145/login +web: + url: http://60.188.225.145 +mh: + sso: + client-id: ningda-74a5e5da-3bc3-414a-b9e6-004b7d87e310 + client-secret: ningda-df746ce4-0c79-4242-b3c7-90ff8630c9742c6727cd-3ae7-48ae-87ad-2b39188ebabd + api-host: http://10.54.38.13:8081/mh-gateway/auth-single + expert-qr-code-url: http://10.54.38.13:8081/mh-gateway/problem/expert/getExpertQrCode + file: + detail-url: http://10.54.38.13:8081/mh-gateway/oss/ossfile/getFileInfoList + down-url: http://10.54.38.13:8081/mh-gateway/oss/oss/downloadFileNotLogin +sync-mh-company: + open: false +sync-mh-user: + open: false +sync-mh-expert: + open: false +sync-mh-unit: + open: false + +auth-code: + secret-key: uqrvd2bani4fercnisua1cqxjwk1neym +agent-login: + proxy: + secret-key: tqkwiqojg5j4eiypr3rb8w7nb4noa8b2 \ No newline at end of file diff --git a/hz-pm-api/src/main/resources/security/auth-dev.yml b/hz-pm-api/src/main/resources/security/auth-dev.yml index 2330d8d..d84a5d7 100644 --- a/hz-pm-api/src/main/resources/security/auth-dev.yml +++ b/hz-pm-api/src/main/resources/security/auth-dev.yml @@ -41,6 +41,7 @@ security: - /api/v1/wps-convert/** - /api/v1/belong-org/business-strip/list - /expert/ephemeral/*/registration + - /api/v1/mh/sync/** ignore-csrf-urls: - /api/v1/user/auth/** - /v2/api-docs diff --git a/hz-pm-api/src/main/resources/security/auth-test.yml b/hz-pm-api/src/main/resources/security/auth-test.yml new file mode 100644 index 0000000..2a672b5 --- /dev/null +++ b/hz-pm-api/src/main/resources/security/auth-test.yml @@ -0,0 +1,86 @@ +security: + auth: + auth-require-url: /api/v1/user/auth/auth-require + invalid-session-url: /api/v1/user/auth/invalid-session + password-login-url: /api/v1/user/auth/login + auth-code-login-url: /api/v1/user/auth/authCodeLogin + mh-login-url: /api/v1/user/auth/mh-login + logout-url: /api/v1/user/auth/logout + common-login-url: /api/v1/user/auth/common-login + ignore-auth-urls: + - /v2/api-docs + - /swagger-ui.html + - /webjars/** + - /swagger-resources/** + - /webjars/ + - /api/v1/user/auth/register + - /api/v1/user/auth/auth-require + - /api/v1/user/auth/invalid-session + - /api/v1/user/auth/login/password + - /api/v1/user/auth/forget-password + - /api/v1/user/auth/common-login + - /doc.html + - /ok.html + - /open/api/** + - /oa/** + - /wflow/** + - /sys/** + - /api/v1/verification/** + - /api/v1/expert/registration + - /api/v1/meta/dictionary/list + - /api/v1/meta/tag + - /api/v1/organization/tree-list + - /api/v1/organization/get-child-list + - /api/v1/region/tree + - /api/v1/expert/get-zzd-info + - /file/upload + - /file/download + - /api/v1/zwdd/pull/** + - /api/v1/irs/** + - /api/v1/wps-convert/** + - /api/v1/belong-org/business-strip/list + - /expert/ephemeral/*/registration + - /api/v1/mh/sync/** + ignore-csrf-urls: + - /api/v1/user/auth/** + - /v2/api-docs + - /swagger-ui.html + - /webjars/** + - /swagger-resources/** + - /webjars/ + - /doc.html + - /ok.html + - /api/v1/** + - /file/** + - /optLog/** + - /dict/** + - /oa/** + - /wflow/** + - /sys/** + - /api/v1/verification/** + - /api/v1/expert/registration + - /api/v1/meta/dictionary/list + - /api/v1/meta/tag + - /api/v1/organization/tree-list + - /api/v1/organization/get-child-list + - /api/v1/region/tree + - /api/v1/expert/get-zzd-info + - /file/upload + - /file/download + - /api/v1/zwdd/pull/** + - /api/v1/irs/** + - /api/v1/wps-convert/** + - /api/v1/belong-org/business-strip/list + - /expert/ephemeral/*/registration + role-map: + "engineer": + "project_manager": + - /api/v1/user-info/kick-off/** + "enterprise_admin": + "regional_general_manager": + "driver": + "super_admin": + - /api/v1/user-info/save + - /api/v1/user-info/del + - /api/v1/user-info/kick-off/** + - /api/v1/user-info/password/mod \ No newline at end of file From 27c86cbabed61579a20f7627ee0352c962968230 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Tue, 9 Jan 2024 10:23:07 +0800 Subject: [PATCH 13/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hz-pm-api/src/main/resources/application-test.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hz-pm-api/src/main/resources/application-test.yml b/hz-pm-api/src/main/resources/application-test.yml index bbca290..4810ba5 100644 --- a/hz-pm-api/src/main/resources/application-test.yml +++ b/hz-pm-api/src/main/resources/application-test.yml @@ -1,7 +1,7 @@ server: port: 8004 servlet: - context-path: /hzpm + context-path: /hzpm-test #最大并发数,默认200 tomcat: threads: @@ -246,11 +246,11 @@ mh: sso: client-id: ningda-74a5e5da-3bc3-414a-b9e6-004b7d87e310 client-secret: ningda-df746ce4-0c79-4242-b3c7-90ff8630c9742c6727cd-3ae7-48ae-87ad-2b39188ebabd - api-host: http://10.54.38.13:8081/mh-gateway/auth-single - expert-qr-code-url: http://10.54.38.13:8081/mh-gateway/problem/expert/getExpertQrCode + api-host: https://hzszxc.hzswb.cn:8443/test/mh-gateway/auth-single + expert-qr-code-url: https://hzszxc.hzswb.cn:8443/test/mh-gateway/problem/expert/getExpertQrCode file: - detail-url: http://10.54.38.13:8081/mh-gateway/oss/ossfile/getFileInfoList - down-url: http://10.54.38.13:8081/mh-gateway/oss/oss/downloadFileNotLogin + detail-url: https://hzszxc.hzswb.cn:8443/test/mh-gateway/oss/ossfile/getFileInfoList + down-url: https://hzszxc.hzswb.cn:8443/test/mh-gateway/oss/oss/downloadFileNotLogin sync-mh-company: open: false sync-mh-user: From 51693a4e6537ec27c64d07b7030d31e9894c785f Mon Sep 17 00:00:00 2001 From: WendyYang Date: Tue, 9 Jan 2024 10:29:49 +0800 Subject: [PATCH 14/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hz-pm-api/src/main/resources/application-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hz-pm-api/src/main/resources/application-test.yml b/hz-pm-api/src/main/resources/application-test.yml index 4810ba5..fea15cc 100644 --- a/hz-pm-api/src/main/resources/application-test.yml +++ b/hz-pm-api/src/main/resources/application-test.yml @@ -1,7 +1,7 @@ server: port: 8004 servlet: - context-path: /hzpm-test + context-path: /hzpm #最大并发数,默认200 tomcat: threads: From 828bf93332b9a70c005bb31afdfda5f6dd07cc0c Mon Sep 17 00:00:00 2001 From: WendyYang Date: Tue, 9 Jan 2024 15:33:57 +0800 Subject: [PATCH 15/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hz-pm-api/pom.xml | 7 +++++++ hz-pm-api/src/main/resources/application-test.yml | 4 ++-- hz-pm-api/src/main/resources/integration/zwdd-test.yml | 12 ++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 hz-pm-api/src/main/resources/integration/zwdd-test.yml diff --git a/hz-pm-api/pom.xml b/hz-pm-api/pom.xml index 0a30453..c050354 100644 --- a/hz-pm-api/pom.xml +++ b/hz-pm-api/pom.xml @@ -274,6 +274,13 @@ + test + + + test + + + prod prod diff --git a/hz-pm-api/src/main/resources/application-test.yml b/hz-pm-api/src/main/resources/application-test.yml index fea15cc..c9ec28c 100644 --- a/hz-pm-api/src/main/resources/application-test.yml +++ b/hz-pm-api/src/main/resources/application-test.yml @@ -1,7 +1,7 @@ server: port: 8004 servlet: - context-path: /hzpm + context-path: /test/hzpm #最大并发数,默认200 tomcat: threads: @@ -91,7 +91,7 @@ nd: serializerType: ProtoStuff cacheNullVal: true def: - keyPrefix: pm + keyPrefix: hzpm log: enabled: true type: DB diff --git a/hz-pm-api/src/main/resources/integration/zwdd-test.yml b/hz-pm-api/src/main/resources/integration/zwdd-test.yml new file mode 100644 index 0000000..6b30e1b --- /dev/null +++ b/hz-pm-api/src/main/resources/integration/zwdd-test.yml @@ -0,0 +1,12 @@ +#浙政钉 +integration: + zwdd: + #扫码 + app-auth-key: ls_project_managment_din-b1Y3I1g7Rr94yX76KfFkpp18Uy4WHtU0b6rINJ3 + app-auth-secret: 75e8PMHv984KYF0Mcy6v4pxt480y73dbD7kB65dD + #免登/获取信息 + app-key: ls_project-c32LNu87v60UiANZVja + app-secret: R14QgbBr21751LTGml3Vt8oX9doPl4Lk1ROzZNfG + #专有钉钉在开发管理工作台,右键查看网页源码realmId: '31141',浙政钉固定196729 + tenantId: 196729 + domain: openplatform-pro.ding.zj.gov.cn \ No newline at end of file From 8f4fec6b94e1fb3acf6b4e79eed2938a397dd846 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Wed, 10 Jan 2024 15:26:02 +0800 Subject: [PATCH 16/44] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hz/pm/api/sys/service/IUserRoleService.java | 3 +++ .../api/sys/service/impl/UserRoleServiceImpl.java | 17 +++++++++++++-- .../hz/pm/api/user/manage/SyncMhUserOrgManage.java | 17 +++++++++++---- .../com/hz/pm/api/user/manage/UserInfoManage.java | 25 ++++++++-------------- .../hz/pm/api/user/model/vo/ResUserInfoListVO.java | 8 +++++-- .../hz/pm/api/user/task/SyncMhUnitProperties.java | 2 +- hz-pm-api/src/main/resources/application-prod.yml | 4 ++-- hz-pm-api/src/main/resources/application-test.yml | 6 +++--- .../src/main/resources/integration/zwdd-test.yml | 14 ++++++------ 9 files changed, 59 insertions(+), 37 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IUserRoleService.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IUserRoleService.java index 027ad95..6af1af9 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IUserRoleService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IUserRoleService.java @@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.sys.model.entity.UserRole; +import java.util.Collection; +import java.util.Collections; import java.util.List; /** @@ -34,6 +36,7 @@ public interface IUserRoleService extends IService { * @author WendyYang **/ List listUserIdByRoleId(Long roleId); + List listUserIdByRoleIds(Collection roleId); default UserRole getOne(Long userId, Long roleId) { LambdaQueryWrapper eq = Wrappers.lambdaQuery(UserRole.class) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/UserRoleServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/UserRoleServiceImpl.java index 85857d4..d2244af 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/UserRoleServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/UserRoleServiceImpl.java @@ -1,6 +1,7 @@ package com.hz.pm.api.sys.service.impl; import cn.hutool.http.HttpStatus; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ningdatech.basic.exception.BaseUncheckedException; @@ -15,6 +16,8 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.Collection; +import java.util.Collections; import java.util.List; /** @@ -35,6 +38,10 @@ public class UserRoleServiceImpl extends ServiceImpl i private final RoleMapper roleMapper; + private LambdaQueryWrapper roleIdsQuery(Collection roleIds) { + return Wrappers.lambdaQuery(UserRole.class).in(UserRole::getRoleId,roleIds); + } + @Override @Transactional(rollbackFor = Exception.class) public boolean initAdmin(Long userId) { @@ -52,8 +59,14 @@ public class UserRoleServiceImpl extends ServiceImpl i @Override public List listUserIdByRoleId(Long roleId) { - List userRoles = this.list(Wrappers.lambdaQuery() - .eq(UserRole::getRoleId, roleId)); + return listUserIdByRoleIds(Collections.singletonList(roleId)); + } + + @Override + public List listUserIdByRoleIds(Collection roleIds) { + LambdaQueryWrapper wrapper = roleIdsQuery(roleIds) + .select(UserRole::getUserId); + List userRoles = this.list(wrapper); return CollUtils.fieldList(userRoles, UserRole::getUserId); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java index b565e8e..6e61189 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java @@ -5,6 +5,7 @@ import cn.hutool.core.collection.ListUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.PhoneUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -68,6 +69,8 @@ public class SyncMhUserOrgManage { if (CollUtil.isEmpty(mhUsers)) { return; } + List units = mhUnitService.list(); + Map unitMap = CollUtils.listToMap(units, MhUnit::getId); Integer batchSize = syncMhUserProperties.getBatchSize(); List> mhUserParts = ListUtil.partition(mhUsers, batchSize); for (List part : mhUserParts) { @@ -80,10 +83,9 @@ public class SyncMhUserOrgManage { } UserInfo userInfo = new UserInfo(); userInfo.setMhUserId(mhUser.getUserId()); - if (Boolean.TRUE.equals(mhUser.getIsZzdAccount())) { - if (NumberUtil.isNumber(mhUser.getAccountId())) { - userInfo.setAccountId(Long.parseLong(mhUser.getAccountId())); - } + if (Boolean.TRUE.equals(mhUser.getIsZzdAccount()) + && (NumberUtil.isNumber(mhUser.getAccountId()))) { + userInfo.setAccountId(Long.parseLong(mhUser.getAccountId())); } UserAvailableEnum userStatus = getUserAvailable(mhUser.getStatus()); userInfo.setAvailable(userStatus.name()); @@ -91,6 +93,13 @@ public class SyncMhUserOrgManage { userInfo.setUsername(mhUser.getAccount()); userInfo.setId(userIdMap.get(mhUser.getUserId())); userInfo.setRegionCode("330100"); + MhUnit unit = unitMap.get(mhUser.getMhUnitId()); + if (unit != null) { + userInfo.setEmpPosUnitName(unit.getName()); + } + if (PhoneUtil.isMobile(mhUser.getAccount())) { + userInfo.setMobile(mhUser.getAccount()); + } userInfo.setMhUnitId(mhUser.getMhUnitId()); savedList.add(userInfo); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java index f8cc04c..f925bd8 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java @@ -34,6 +34,7 @@ import com.hz.pm.api.user.util.LoginUserUtil; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.model.GenericResult; import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; import com.ningdatech.zwdd.ZwddIntegrationProperties; import com.ningdatech.zwdd.client.ZwddClient; import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; @@ -68,8 +69,6 @@ public class UserInfoManage { private final ZwddClient zwddClient; public PageVo list(ReqUserInfoListPO req) { - PageVo pageVo = new PageVo<>(); - String phoneNo = req.getPhoneNo(); String orgCode = req.getOrgCode(); String name = req.getName(); @@ -77,10 +76,8 @@ public class UserInfoManage { Long regionId = req.getRegionId(); List userIdList = getRoleCompliantUserIdList(req.getUserRoleList()); - if (userIdList != null && userIdList.size() == 0) { - pageVo.setRecords(new ArrayList<>()); - pageVo.setTotal(0L); - return pageVo; + if (userIdList != null && userIdList.isEmpty()) { + return PageVo.empty(); } LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(UserInfo.class) @@ -92,7 +89,7 @@ public class UserInfoManage { .eq(StringUtils.isNotBlank(orgCode), UserInfo::getEmpPosUnitCode, orgCode) .orderByDesc(UserInfo::getUpdateOn); - Page page = iUserInfoService.page(new Page<>(req.getPageNumber(), req.getPageSize()), wrapper); + Page page = iUserInfoService.page(req.page(), wrapper); List records = page.getRecords(); long total = page.getTotal(); List result = new ArrayList<>(); @@ -127,9 +124,7 @@ public class UserInfoManage { result.add(item); }); } - pageVo.setTotal(total); - pageVo.setRecords(result); - return pageVo; + return PageVo.of(result, total); } private List getCompliantOrgEmpCodeList(String orgName, String orgCode) { @@ -187,15 +182,13 @@ public class UserInfoManage { */ private List getRoleCompliantUserIdList(List userRoleList) { if (CollUtil.isNotEmpty(userRoleList)) { - userRoleList = userRoleList.stream().filter(r -> Objects.nonNull(r.getId())).collect(Collectors.toList()); + userRoleList.removeIf(r -> Objects.isNull(r.getId())); } if (CollUtil.isEmpty(userRoleList)) { - return Collections.emptyList(); + return null; } - List roleIdList = userRoleList.stream().map(UserRoleVO::getId).collect(Collectors.toList()); - - List compliantUserIdList = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) - .in(UserRole::getRoleId, roleIdList)).stream().map(UserRole::getUserId).distinct().collect(Collectors.toList()); + List roleIdList = CollUtils.fieldList(userRoleList, UserRoleVO::getId); + List compliantUserIdList = iUserRoleService.listUserIdByRoleIds(roleIdList); if (CollUtil.isEmpty(compliantUserIdList)) { return new ArrayList<>(); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserInfoListVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserInfoListVO.java index abdb677..bf066df 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserInfoListVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserInfoListVO.java @@ -8,8 +8,12 @@ import java.time.LocalDateTime; import java.util.List; /** - * @author liuxinxin - * @date 2023/2/13 上午9:10 + *

+ * ResUserInfoListVO + *

+ * + * @author WendyYang + * @since 15:24 2024/1/10 */ @Data @ApiModel("用户管理查询 请求response") diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/task/SyncMhUnitProperties.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/task/SyncMhUnitProperties.java index 9ce1397..76418d1 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/task/SyncMhUnitProperties.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/task/SyncMhUnitProperties.java @@ -23,6 +23,6 @@ public class SyncMhUnitProperties { private Boolean open = true; - private Integer batchSize = 2000; + private Integer batchSize = 5000; } diff --git a/hz-pm-api/src/main/resources/application-prod.yml b/hz-pm-api/src/main/resources/application-prod.yml index 4af7bb2..d654c9b 100644 --- a/hz-pm-api/src/main/resources/application-prod.yml +++ b/hz-pm-api/src/main/resources/application-prod.yml @@ -76,8 +76,8 @@ mybatis-plus: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl global-config: db-config: - logic-delete-value: true - logic-not-delete-value: false + logic-delete-value: 1 + logic-not-delete-value: 0 logging: config: classpath:logback-spring.xml #日志配置 diff --git a/hz-pm-api/src/main/resources/application-test.yml b/hz-pm-api/src/main/resources/application-test.yml index c9ec28c..22e1d56 100644 --- a/hz-pm-api/src/main/resources/application-test.yml +++ b/hz-pm-api/src/main/resources/application-test.yml @@ -76,8 +76,8 @@ mybatis-plus: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl global-config: db-config: - logic-delete-value: true - logic-not-delete-value: false + logic-delete-value: 1 + logic-not-delete-value: 0 logging: config: classpath:logback-spring.xml #日志配置 @@ -238,7 +238,7 @@ project: delete-all-url: http://10.53.168.41:38088/open/api/v1/project-receive/delete-all login: phone-verify-code: - skip: false + skip: true url: http://60.188.225.145/login web: url: http://60.188.225.145 diff --git a/hz-pm-api/src/main/resources/integration/zwdd-test.yml b/hz-pm-api/src/main/resources/integration/zwdd-test.yml index 6b30e1b..cc28814 100644 --- a/hz-pm-api/src/main/resources/integration/zwdd-test.yml +++ b/hz-pm-api/src/main/resources/integration/zwdd-test.yml @@ -1,12 +1,12 @@ -#浙政钉 +#专有钉钉 integration: zwdd: #扫码 - app-auth-key: ls_project_managment_din-b1Y3I1g7Rr94yX76KfFkpp18Uy4WHtU0b6rINJ3 - app-auth-secret: 75e8PMHv984KYF0Mcy6v4pxt480y73dbD7kB65dD + app-auth-key: ls-rebuild_dingoa-rgeWs3YVr26z + app-auth-secret: 37qCe6ylNMW0N8K2741z0c2b9vJP2gtuMRQQtZ9P #免登/获取信息 - app-key: ls_project-c32LNu87v60UiANZVja - app-secret: R14QgbBr21751LTGml3Vt8oX9doPl4Lk1ROzZNfG + app-key: ls_rebuild-10c8n5X0707yFV7jURr + app-secret: gN8J3WazyXLMWKDuFmx6C4yaH5lFUY41x8rYLLo6 #专有钉钉在开发管理工作台,右键查看网页源码realmId: '31141',浙政钉固定196729 - tenantId: 196729 - domain: openplatform-pro.ding.zj.gov.cn \ No newline at end of file + tenantId: 31141 + domain: openplatform.dg-work.cn \ No newline at end of file From 978286560c28e4f094f6be9263cc40cf94132fc6 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Wed, 10 Jan 2024 16:12:03 +0800 Subject: [PATCH 17/44] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=A0=91=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hz/pm/api/common/helper/UserInfoHelper.java | 2 +- .../common/helper/impl/RegionLimitHelperImpl.java | 2 +- .../api/common/helper/impl/UserInfoHelperImpl.java | 2 +- .../hz/pm/api/ding/task/EmployeeBatchGetTask.java | 2 +- .../com/hz/pm/api/expert/manage/ExpertManage.java | 2 +- .../expert/service/impl/ExpertInfoServiceImpl.java | 2 +- .../api/meeting/helper/MeetingCallOrMsgHelper.java | 2 +- .../hz/pm/api/scheduler/task/CommonLogTask.java | 2 +- .../task/EarlyWarningInstanceNotStartTask.java | 2 +- .../com/hz/pm/api/sys/manage/NoticeManage.java | 2 +- .../java/com/hz/pm/api/sys/manage/RoleManage.java | 2 +- .../hz/pm/api/sys/manage/UserGuidanceManage.java | 4 +- .../java/com/hz/pm/api/user/entity/MhCompany.java | 38 ---------- .../java/com/hz/pm/api/user/entity/MhUnit.java | 40 ----------- .../java/com/hz/pm/api/user/entity/UserAuth.java | 38 ---------- .../java/com/hz/pm/api/user/entity/UserInfo.java | 82 ---------------------- .../hz/pm/api/user/manage/SyncMhUserOrgManage.java | 6 +- .../com/hz/pm/api/user/manage/UserInfoManage.java | 2 +- .../com/hz/pm/api/user/mapper/MhCompanyMapper.java | 2 +- .../com/hz/pm/api/user/mapper/MhUnitMapper.java | 2 +- .../hz/pm/api/user/mapper/NdUserInfoMapper.java | 2 +- .../com/hz/pm/api/user/mapper/UserAuthMapper.java | 2 +- .../com/hz/pm/api/user/model/entity/MhCompany.java | 38 ++++++++++ .../com/hz/pm/api/user/model/entity/MhUnit.java | 40 +++++++++++ .../com/hz/pm/api/user/model/entity/UserAuth.java | 38 ++++++++++ .../com/hz/pm/api/user/model/entity/UserInfo.java | 82 ++++++++++++++++++++++ .../hz/pm/api/user/service/IMhCompanyService.java | 2 +- .../com/hz/pm/api/user/service/IMhUnitService.java | 2 +- .../hz/pm/api/user/service/IUserAuthService.java | 4 +- .../hz/pm/api/user/service/IUserInfoService.java | 2 +- .../user/service/impl/MhCompanyServiceImpl.java | 2 +- .../api/user/service/impl/MhUnitServiceImpl.java | 2 +- .../api/user/service/impl/UserAuthServiceImpl.java | 4 +- .../api/user/service/impl/UserInfoServiceImpl.java | 2 +- .../test/java/com/hz/pm/api/irs/EmployeeTest.java | 2 +- 35 files changed, 230 insertions(+), 230 deletions(-) delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhCompany.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhUnit.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/entity/UserAuth.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/entity/UserInfo.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/MhCompany.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/MhUnit.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/UserAuth.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/UserInfo.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/UserInfoHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/UserInfoHelper.java index 96acd77..8670bec 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/UserInfoHelper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/UserInfoHelper.java @@ -1,6 +1,6 @@ package com.hz.pm.api.common.helper; -import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.security.model.UserFullInfoDTO; import java.util.Collection; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/RegionLimitHelperImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/RegionLimitHelperImpl.java index 1d20bba..23dc863 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/RegionLimitHelperImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/RegionLimitHelperImpl.java @@ -9,7 +9,7 @@ import com.hz.pm.api.expert.service.IExpertUserFullInfoService; import com.hz.pm.api.meta.model.bo.RegionContainsBO; import com.hz.pm.api.sys.model.entity.Region; import com.hz.pm.api.sys.service.IRegionService; -import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.service.IUserInfoService; import org.apache.commons.collections4.CollectionUtils; import org.slf4j.Logger; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java index edd8963..a2c067b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java @@ -16,7 +16,7 @@ import com.hz.pm.api.sys.model.entity.Role; import com.hz.pm.api.sys.model.entity.UserRole; import com.hz.pm.api.sys.service.IUserRoleService; import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; -import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.model.enumeration.RoleEnum; import com.hz.pm.api.user.security.model.UserFullInfoDTO; import com.hz.pm.api.user.service.IUserInfoService; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/ding/task/EmployeeBatchGetTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/ding/task/EmployeeBatchGetTask.java index bfcfbbc..2f6409f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/ding/task/EmployeeBatchGetTask.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/ding/task/EmployeeBatchGetTask.java @@ -14,7 +14,7 @@ import com.hz.pm.api.organization.model.entity.DingOrganization; import com.hz.pm.api.organization.service.IDingEmployeeInfoService; import com.hz.pm.api.organization.service.IDingOrganizationService; import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; -import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.service.IUserInfoService; import com.ningdatech.zwdd.ZwddIntegrationProperties; import com.ningdatech.zwdd.client.ZwddAuthClient; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertManage.java index 4926715..cbf7bad 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/manage/ExpertManage.java @@ -44,7 +44,7 @@ import com.hz.pm.api.sys.model.entity.Role; import com.hz.pm.api.sys.model.entity.UserRole; import com.hz.pm.api.sys.service.IRoleService; import com.hz.pm.api.sys.service.IUserRoleService; -import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.model.enumeration.RoleEnum; import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; import com.hz.pm.api.user.service.IUserInfoService; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertInfoServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertInfoServiceImpl.java index 5699861..2267e24 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertInfoServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertInfoServiceImpl.java @@ -36,7 +36,7 @@ import com.hz.pm.api.sys.model.entity.UserRole; import com.hz.pm.api.sys.service.IRoleService; import com.hz.pm.api.sys.service.IUserRoleService; import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; -import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.model.enumeration.RoleEnum; import com.hz.pm.api.user.security.model.UserInfoDetails; import com.hz.pm.api.user.service.IUserInfoService; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingCallOrMsgHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingCallOrMsgHelper.java index d0b374d..380c950 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingCallOrMsgHelper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingCallOrMsgHelper.java @@ -20,7 +20,7 @@ import com.hz.pm.api.staging.service.INdWorkNoticeStagingService; import com.hz.pm.api.sys.model.entity.Notify; import com.hz.pm.api.sys.service.INotifyService; import com.hz.pm.api.todocenter.bean.entity.WorkNoticeInfo; -import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.service.IUserInfoService; import com.ningdatech.yxt.model.cmd.SendSmsCmd.SendSmsContext; import com.ningdatech.yxt.model.cmd.SubmitTaskCallCmd.SubmitTaskCallContext; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CommonLogTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CommonLogTask.java index f7c41f5..dec7f64 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CommonLogTask.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CommonLogTask.java @@ -16,7 +16,7 @@ import com.hz.pm.api.common.model.constant.RegionConst; import com.hz.pm.api.organization.mapper.DingEmployeeInfoMapper; import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; import com.hz.pm.api.scheduler.task.model.CommonLog; -import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.service.IUserInfoService; import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningInstanceNotStartTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningInstanceNotStartTask.java index 9fae2e1..27e2d41 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningInstanceNotStartTask.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningInstanceNotStartTask.java @@ -23,7 +23,7 @@ import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.sys.manage.EarlyWarningManage; import com.hz.pm.api.sys.manage.RoleManage; import com.hz.pm.api.sys.service.IProjectEarlyWarningService; -import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.model.enumeration.RoleEnum; import com.hz.pm.api.user.service.IUserInfoService; import com.wflow.bean.entity.WflowEarlyWarning; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java index 352d8d3..e147c0c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java @@ -36,7 +36,7 @@ import com.hz.pm.api.sys.service.INoticeService; import com.hz.pm.api.sys.service.INotifyService; import com.hz.pm.api.todocenter.bean.entity.WorkNoticeInfo; import com.hz.pm.api.todocenter.model.dto.ProjectAuditMsgExtraDTO; -import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.security.model.UserFullInfoDTO; import com.hz.pm.api.user.security.model.UserInfoDetails; import com.hz.pm.api.user.service.IUserInfoService; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/RoleManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/RoleManage.java index c1f8648..686f59e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/RoleManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/RoleManage.java @@ -14,7 +14,7 @@ import com.hz.pm.api.sys.model.req.RolePageReq; import com.hz.pm.api.sys.model.vo.MenuRoleVO; import com.hz.pm.api.sys.model.vo.RoleVO; import com.hz.pm.api.sys.service.*; -import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.service.IUserInfoService; import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/UserGuidanceManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/UserGuidanceManage.java index 2d375fc..15c1198 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/UserGuidanceManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/UserGuidanceManage.java @@ -14,8 +14,8 @@ import com.hz.pm.api.sys.model.entity.UserRole; import com.hz.pm.api.sys.model.vo.UserGuidanceDetailVO; import com.hz.pm.api.sys.model.vo.UserGuidanceVO; import com.hz.pm.api.sys.service.IUserRoleService; -import com.hz.pm.api.user.entity.UserAuth; -import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.model.entity.UserAuth; +import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.security.model.UserInfoDetails; import com.hz.pm.api.user.service.IUserAuthService; import com.hz.pm.api.user.service.IUserInfoService; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhCompany.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhCompany.java deleted file mode 100644 index dd706cf..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhCompany.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.hz.pm.api.user.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import lombok.Data; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * 企业表 - *

- * - * @author CMM - * @since 2023-12-25 - */ -@Data -@TableName("MH_COMPANY") -@ApiModel(value = "MhUnit对象", description = "企业表") -public class MhCompany implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId(type = IdType.INPUT) - private String id; - - private String companyName; - - private String companyCode; - - private LocalDateTime createOn; - - private LocalDateTime updateOn; - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhUnit.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhUnit.java deleted file mode 100644 index ef09dad..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhUnit.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.hz.pm.api.user.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import lombok.Data; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * 组织表 - *

- * - * @author CMM - * @since 2023-12-25 - */ -@Data -@TableName("MH_UNIT") -@ApiModel(value = "MhUnit对象", description = "组织表") -public class MhUnit implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId(type = IdType.INPUT) - private Long id; - - private String name; - - private Long parentId; - - private Short sort; - - private LocalDateTime createOn; - - private LocalDateTime updateOn; - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/UserAuth.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/UserAuth.java deleted file mode 100644 index e1238ab..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/UserAuth.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.hz.pm.api.user.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import lombok.Data; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * - *

- * - * @author Lierbao - * @since 2023-02-01 - */ -@TableName("nd_user_auth") -@Data -@ApiModel(value = "NdUserAuth对象") -public class UserAuth implements Serializable { - - private static final long serialVersionUID = 1L; - - private Long id; - - private LocalDateTime createOn; - - private LocalDateTime updateOn; - - private Long userId; - - private String authType; - - private String identifier; - - private String credential; -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/UserInfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/UserInfo.java deleted file mode 100644 index d972b54..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/UserInfo.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.hz.pm.api.user.entity; - -import com.baomidou.mybatisplus.annotation.*; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.time.LocalDateTime; - - - - -/** - *

- * - *

- * - * @author Lierbao - * @since 2023-02-01 - */ -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -@TableName("nd_user_info") -@ApiModel(value = "UserInfo对象") -public class UserInfo implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId(type = IdType.AUTO) - private Long id; - - /** - * 信创系统用户ID - */ - private String mhUserId; - - private String username; - - private String mobile; - - private String realName; - - private Long accountId; - - private String wechatOpenId; - - /** - * 账号状态 - */ - private String available; - - private String employeeCode; - - private String regionCode; - - private Long mhUnitId; - - private String empPosUnitCode; - private String empPosUnitName; - - @ApiModelProperty("头像") - private String avatar; - - @TableField(fill = FieldFill.INSERT) - private LocalDateTime createOn; - - @TableField(fill = FieldFill.INSERT_UPDATE) - private LocalDateTime updateOn; - - @TableField(fill = FieldFill.INSERT) - private Long createBy; - - @TableField(fill = FieldFill.INSERT_UPDATE) - private Long updateBy; - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java index 6e61189..adb95ff 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java @@ -19,9 +19,9 @@ import com.hz.pm.api.meta.helper.DictionaryCache; import com.hz.pm.api.meta.model.dto.DictionaryDTO; import com.hz.pm.api.meta.model.entity.ExpertDictionary; import com.hz.pm.api.meta.service.IExpertDictionaryService; -import com.hz.pm.api.user.entity.MhCompany; -import com.hz.pm.api.user.entity.MhUnit; -import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.model.entity.MhCompany; +import com.hz.pm.api.user.model.entity.MhUnit; +import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; import com.hz.pm.api.user.service.IMhCompanyService; import com.hz.pm.api.user.service.IMhUnitService; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java index f925bd8..d6d6e10 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java @@ -19,7 +19,7 @@ import com.hz.pm.api.sys.model.entity.Role; import com.hz.pm.api.sys.model.entity.UserRole; import com.hz.pm.api.sys.service.IRoleService; import com.hz.pm.api.sys.service.IUserRoleService; -import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; import com.hz.pm.api.user.model.po.ReqUserDetailEditPO; import com.hz.pm.api.user.model.po.ReqUserDetailPO; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/MhCompanyMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/MhCompanyMapper.java index d5fdb11..5633455 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/MhCompanyMapper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/MhCompanyMapper.java @@ -1,7 +1,7 @@ package com.hz.pm.api.user.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hz.pm.api.user.entity.MhCompany; +import com.hz.pm.api.user.model.entity.MhCompany; /** *

diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/MhUnitMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/MhUnitMapper.java index 002fd0e..d0aa1f0 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/MhUnitMapper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/MhUnitMapper.java @@ -1,6 +1,6 @@ package com.hz.pm.api.user.mapper; -import com.hz.pm.api.user.entity.MhUnit; +import com.hz.pm.api.user.model.entity.MhUnit; import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/NdUserInfoMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/NdUserInfoMapper.java index 1e467d6..1a8c878 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/NdUserInfoMapper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/NdUserInfoMapper.java @@ -1,6 +1,6 @@ package com.hz.pm.api.user.mapper; -import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.model.entity.UserInfo; import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/UserAuthMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/UserAuthMapper.java index fc4a4a2..b697a41 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/UserAuthMapper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/mapper/UserAuthMapper.java @@ -1,6 +1,6 @@ package com.hz.pm.api.user.mapper; -import com.hz.pm.api.user.entity.UserAuth; +import com.hz.pm.api.user.model.entity.UserAuth; import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/MhCompany.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/MhCompany.java new file mode 100644 index 0000000..d4d9947 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/MhCompany.java @@ -0,0 +1,38 @@ +package com.hz.pm.api.user.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 企业表 + *

+ * + * @author CMM + * @since 2023-12-25 + */ +@Data +@TableName("MH_COMPANY") +@ApiModel(value = "MhUnit对象", description = "企业表") +public class MhCompany implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.INPUT) + private String id; + + private String companyName; + + private String companyCode; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/MhUnit.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/MhUnit.java new file mode 100644 index 0000000..13e0216 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/MhUnit.java @@ -0,0 +1,40 @@ +package com.hz.pm.api.user.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 组织表 + *

+ * + * @author CMM + * @since 2023-12-25 + */ +@Data +@TableName("MH_UNIT") +@ApiModel(value = "MhUnit对象", description = "组织表") +public class MhUnit implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.INPUT) + private Long id; + + private String name; + + private Long parentId; + + private Short sort; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/UserAuth.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/UserAuth.java new file mode 100644 index 0000000..b82df26 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/UserAuth.java @@ -0,0 +1,38 @@ +package com.hz.pm.api.user.model.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author Lierbao + * @since 2023-02-01 + */ +@TableName("nd_user_auth") +@Data +@ApiModel(value = "NdUserAuth对象") +public class UserAuth implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + private LocalDateTime createOn; + + private LocalDateTime updateOn; + + private Long userId; + + private String authType; + + private String identifier; + + private String credential; +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/UserInfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/UserInfo.java new file mode 100644 index 0000000..7080ba1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/UserInfo.java @@ -0,0 +1,82 @@ +package com.hz.pm.api.user.model.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.time.LocalDateTime; + + + + +/** + *

+ * + *

+ * + * @author Lierbao + * @since 2023-02-01 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("nd_user_info") +@ApiModel(value = "UserInfo对象") +public class UserInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + /** + * 信创系统用户ID + */ + private String mhUserId; + + private String username; + + private String mobile; + + private String realName; + + private Long accountId; + + private String wechatOpenId; + + /** + * 账号状态 + */ + private String available; + + private String employeeCode; + + private String regionCode; + + private Long mhUnitId; + + private String empPosUnitCode; + private String empPosUnitName; + + @ApiModelProperty("头像") + private String avatar; + + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createOn; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateOn; + + @TableField(fill = FieldFill.INSERT) + private Long createBy; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Long updateBy; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IMhCompanyService.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IMhCompanyService.java index 6bc2dc1..43f2acb 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IMhCompanyService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IMhCompanyService.java @@ -3,7 +3,7 @@ package com.hz.pm.api.user.service; 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.user.entity.MhCompany; +import com.hz.pm.api.user.model.entity.MhCompany; import com.ningdatech.basic.util.CollUtils; import java.util.Collection; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IMhUnitService.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IMhUnitService.java index dae6f09..191a13c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IMhUnitService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IMhUnitService.java @@ -2,7 +2,7 @@ package com.hz.pm.api.user.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.hz.pm.api.user.entity.MhUnit; +import com.hz.pm.api.user.model.entity.MhUnit; import com.baomidou.mybatisplus.extension.service.IService; import com.ningdatech.basic.util.CollUtils; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IUserAuthService.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IUserAuthService.java index b9ed11c..2dc32d0 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IUserAuthService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IUserAuthService.java @@ -1,8 +1,8 @@ package com.hz.pm.api.user.service; import com.baomidou.mybatisplus.extension.service.IService; -import com.hz.pm.api.user.entity.UserAuth; -import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.model.entity.UserAuth; +import com.hz.pm.api.user.model.entity.UserInfo; import java.util.Map; import java.util.Set; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IUserInfoService.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IUserInfoService.java index e21c730..a89597f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IUserInfoService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/IUserInfoService.java @@ -3,7 +3,7 @@ package com.hz.pm.api.user.service; 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.user.entity.UserInfo; +import com.hz.pm.api.user.model.entity.UserInfo; import com.ningdatech.basic.util.CollUtils; import java.util.Collection; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/service/impl/MhCompanyServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/impl/MhCompanyServiceImpl.java index 6f06304..3562f8a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/service/impl/MhCompanyServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/impl/MhCompanyServiceImpl.java @@ -1,7 +1,7 @@ package com.hz.pm.api.user.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.hz.pm.api.user.entity.MhCompany; +import com.hz.pm.api.user.model.entity.MhCompany; import com.hz.pm.api.user.mapper.MhCompanyMapper; import com.hz.pm.api.user.service.IMhCompanyService; import org.springframework.stereotype.Service; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/service/impl/MhUnitServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/impl/MhUnitServiceImpl.java index e10c814..7dbaf34 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/service/impl/MhUnitServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/impl/MhUnitServiceImpl.java @@ -1,6 +1,6 @@ package com.hz.pm.api.user.service.impl; -import com.hz.pm.api.user.entity.MhUnit; +import com.hz.pm.api.user.model.entity.MhUnit; import com.hz.pm.api.user.mapper.MhUnitMapper; import com.hz.pm.api.user.service.IMhUnitService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/service/impl/UserAuthServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/impl/UserAuthServiceImpl.java index 05493d0..26a12f3 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/service/impl/UserAuthServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/impl/UserAuthServiceImpl.java @@ -1,8 +1,8 @@ package com.hz.pm.api.user.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.hz.pm.api.user.entity.UserAuth; -import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.model.entity.UserAuth; +import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.mapper.NdUserInfoMapper; import com.hz.pm.api.user.mapper.UserAuthMapper; import com.hz.pm.api.user.service.IUserAuthService; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/service/impl/UserInfoServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/impl/UserInfoServiceImpl.java index f2a277b..c885c6c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/service/impl/UserInfoServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/service/impl/UserInfoServiceImpl.java @@ -3,7 +3,7 @@ package com.hz.pm.api.user.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.mapper.NdUserInfoMapper; import com.hz.pm.api.user.service.IUserInfoService; import lombok.RequiredArgsConstructor; diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/irs/EmployeeTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/irs/EmployeeTest.java index e2d74cc..2058bff 100644 --- a/hz-pm-api/src/test/java/com/hz/pm/api/irs/EmployeeTest.java +++ b/hz-pm-api/src/test/java/com/hz/pm/api/irs/EmployeeTest.java @@ -13,7 +13,7 @@ import com.hz.pm.api.organization.model.entity.DingOrganization; import com.hz.pm.api.organization.service.IDingEmployeeInfoService; import com.hz.pm.api.organization.service.IDingOrganizationService; import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; -import com.hz.pm.api.user.entity.UserInfo; +import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.service.IUserInfoService; import com.ningdatech.zwdd.ZwddIntegrationProperties; import com.ningdatech.zwdd.client.ZwddClient; From d65be23c7b826cecdb77d0ea35d30994c54e2136 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Wed, 10 Jan 2024 16:12:24 +0800 Subject: [PATCH 18/44] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=A0=91=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pm/api/user/controller/MhUnitController.java | 32 ++++++++++++++++++ .../com/hz/pm/api/user/manage/MhUnitManage.java | 38 ++++++++++++++++++++++ .../hz/pm/api/user/model/dto/MhUnitTreeDTO.java | 35 ++++++++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitTreeDTO.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java new file mode 100644 index 0000000..212776c --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java @@ -0,0 +1,32 @@ +package com.hz.pm.api.user.controller; + +import com.hz.pm.api.user.manage.MhUnitManage; +import com.hz.pm.api.user.model.dto.MhUnitTreeDTO; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + *

+ * MhUnitController + *

+ * + * @author WendyYang + * @since 15:28 2024/1/10 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/mh/unit") +public class MhUnitController { + + private final MhUnitManage mhUnitManage; + + @GetMapping("/tree") + public List getMhUnitTree() { + return mhUnitManage.getMhUnitTree(); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java new file mode 100644 index 0000000..92982e4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java @@ -0,0 +1,38 @@ +package com.hz.pm.api.user.manage; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.common.model.constant.BizConst; +import com.hz.pm.api.user.model.dto.MhUnitTreeDTO; +import com.hz.pm.api.user.model.entity.MhUnit; +import com.hz.pm.api.user.service.IMhUnitService; +import com.ningdatech.basic.util.TreeUtil; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + *

+ * MhUnitManage + *

+ * + * @author WendyYang + * @since 15:33 2024/1/10 + */ +@Component +@RequiredArgsConstructor +public class MhUnitManage { + + private final IMhUnitService mhUnitService; + + public List getMhUnitTree() { + LambdaQueryWrapper query = Wrappers.lambdaQuery(MhUnit.class) + .select(MhUnit::getSort, MhUnit::getId, MhUnit::getParentId, MhUnit::getName); + List units = mhUnitService.list(query); + List nodes = BeanUtil.copyToList(units, MhUnitTreeDTO.class); + return TreeUtil.convertToTree(nodes, 0L); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitTreeDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitTreeDTO.java new file mode 100644 index 0000000..e838bc6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitTreeDTO.java @@ -0,0 +1,35 @@ +package com.hz.pm.api.user.model.dto; + +import com.ningdatech.basic.model.ITree; +import lombok.Data; + +import java.util.Comparator; +import java.util.List; + +/** + *

+ * MhUnitTreeDTO + *

+ * + * @author WendyYang + * @since 15:29 2024/1/10 + */ +@Data +public class MhUnitTreeDTO implements ITree { + + private Long id; + + private String name; + + private Long parentId; + + private Short sort; + + private List children; + + @Override + public Comparator comparator() { + return Comparator.comparing(MhUnitTreeDTO::getSort); + } + +} From db14fe70664ec38f190e6a9a64e7ba3809e45b50 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Wed, 10 Jan 2024 19:26:11 +0800 Subject: [PATCH 19/44] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=A0=91=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java index 92982e4..0678e6a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java @@ -3,7 +3,6 @@ package com.hz.pm.api.user.manage; import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.user.model.dto.MhUnitTreeDTO; import com.hz.pm.api.user.model.entity.MhUnit; import com.hz.pm.api.user.service.IMhUnitService; @@ -29,7 +28,7 @@ public class MhUnitManage { public List getMhUnitTree() { LambdaQueryWrapper query = Wrappers.lambdaQuery(MhUnit.class) - .select(MhUnit::getSort, MhUnit::getId, MhUnit::getParentId, MhUnit::getName); + .select(MhUnit::getId, MhUnit::getName, MhUnit::getParentId, MhUnit::getSort); List units = mhUnitService.list(query); List nodes = BeanUtil.copyToList(units, MhUnitTreeDTO.class); return TreeUtil.convertToTree(nodes, 0L); From cf81e3ae7d4ee20d95bed8880cfd94e03532414e Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 11 Jan 2024 17:39:08 +0800 Subject: [PATCH 20/44] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hz/pm/api/user/helper/MhUnitCache.java | 29 +++++ .../pm/api/user/helper/impl/MhUnitCacheImpl.java | 136 +++++++++++++++++++++ .../com/hz/pm/api/user/model/dto/MhUnitDTO.java | 24 ++++ 3 files changed, 189 insertions(+) create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/helper/MhUnitCache.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitDTO.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/MhUnitCache.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/MhUnitCache.java new file mode 100644 index 0000000..4a42e10 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/MhUnitCache.java @@ -0,0 +1,29 @@ +package com.hz.pm.api.user.helper; + +import com.hz.pm.api.user.model.dto.MhUnitDTO; + +import java.util.List; + +/** + *

+ * MhUnitCache + *

+ * + * @author WendyYang + * @since 11:19 2024/1/11 + */ +public interface MhUnitCache { + + List all(); + + MhUnitDTO getById(Long id); + + List getChildren(Long id); + + List getChildrenIds(Long id); + + List getChildrenRecursion(Long id); + + List getChildrenIdsRecursion(Long id); + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java new file mode 100644 index 0000000..eef0aa1 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java @@ -0,0 +1,136 @@ +package com.hz.pm.api.user.helper.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.IterUtil; +import com.github.benmanes.caffeine.cache.CacheLoader; +import com.github.benmanes.caffeine.cache.Caffeine; +import com.github.benmanes.caffeine.cache.LoadingCache; +import com.google.common.collect.Lists; +import com.hz.pm.api.meta.assembler.MetaTagAssembler; +import com.hz.pm.api.meta.model.dto.TagDTO; +import com.hz.pm.api.meta.model.dto.TagTreeDTO; +import com.hz.pm.api.user.helper.MhUnitCache; +import com.hz.pm.api.user.model.dto.MhUnitDTO; +import com.hz.pm.api.user.model.entity.MhUnit; +import com.hz.pm.api.user.service.IMhUnitService; +import com.ningdatech.basic.util.CollUtils; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.stereotype.Component; + +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +/** + *

+ * MhUnitCacheImpl + *

+ * + * @author WendyYang + * @since 11:20 2024/1/11 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class MhUnitCacheImpl implements MhUnitCache, InitializingBean { + + private static final Long ALL = -1L; + + private final IMhUnitService mhUnitService; + private LoadingCache cache; + + private final Map> childIdMap = new ConcurrentHashMap<>(); + + private void putToChildIdMap(Long childId, Long parentId) { + List childIds = Lists.newArrayList(childId); + childIdMap.merge(parentId, childIds, (v1, v2) -> { + v1.addAll(v2); + return v1; + }); + } + + @Override + public void afterPropertiesSet() { + cache = Caffeine.newBuilder() + .refreshAfterWrite(7, TimeUnit.DAYS) + .build(new CacheLoader() { + + @Override + public MhUnitDTO load(@NonNull Long key) { + log.info("刷新当前标签树:{}", key); + // 查询全部 + MhUnit unit = mhUnitService.getById(key); + putToChildIdMap(unit.getId(), unit.getParentId()); + return BeanUtil.copyProperties(unit, MhUnitDTO.class); + } + + @Override + public @NonNull Map loadAll(@NonNull Iterable keys) { + List allUnits; + if (CollUtil.isEmpty(keys)) { + allUnits = mhUnitService.list(); + } else { + List keysList = IterUtil.toList(keys); + if (keysList.size() == 1 && keysList.get(0).equals(ALL)) { + allUnits = mhUnitService.list(); + } else { + allUnits = mhUnitService.listByIds(keysList); + } + } + return CollUtils.listToMap(allUnits, MhUnit::getId, w -> { + putToChildIdMap(w.getId(), w.getParentId()); + return BeanUtil.copyProperties(w, MhUnitDTO.class); + }); + } + }); + // 初始化所有单位 + cache.getAll(Collections.singletonList(ALL)); + } + + @Override + public List all() { + return new ArrayList<>(cache.asMap().values()); + } + + @Override + public MhUnitDTO getById(Long id) { + return cache.get(id); + } + + @Override + public List getChildren(Long id) { + return CollUtils.convert(childIdMap.get(id), cache::get); + } + + @Override + public List getChildrenIds(Long id) { + return childIdMap.get(id); + } + + @Override + public List getChildrenRecursion(Long id) { + return CollUtils.convert(getChildrenIdsRecursion(id), cache::get); + } + + @Override + public List getChildrenIdsRecursion(Long id) { + List childIds = new ArrayList<>(); + collectChildId(childIds, id); + return childIds; + } + + private void collectChildId(List collect, Long parentId) { + List childIds = childIdMap.get(parentId); + if (childIds != null) { + collect.addAll(childIds); + childIds.forEach(child -> collectChildId(collect, child)); + } + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitDTO.java new file mode 100644 index 0000000..322c9ba --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitDTO.java @@ -0,0 +1,24 @@ +package com.hz.pm.api.user.model.dto; + +import lombok.Data; + +/** + *

+ * MhUnitDTO + *

+ * + * @author WendyYang + * @since 15:29 2024/1/10 + */ +@Data +public class MhUnitDTO { + + private Long id; + + private String name; + + private Long parentId; + + private Short sort; + +} From 168a685b6d412bbf8d354bbe8c745ec802549a1b Mon Sep 17 00:00:00 2001 From: WendyYang Date: Fri, 12 Jan 2024 16:50:30 +0800 Subject: [PATCH 21/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hz/pm/api/common/helper/RegionLimitHelper.java | 10 - .../hz/pm/api/common/helper/UserInfoHelper.java | 32 +- .../common/helper/impl/RegionLimitHelperImpl.java | 32 -- .../api/common/helper/impl/UserInfoHelperImpl.java | 168 ++------ .../common/model/constant/StateMachineConst.java | 4 +- .../ProjectDeclareStateMachineLQBuilder.java | 6 +- .../common/statemachine/contant/RegionContant.java | 4 + .../hz/pm/api/common/util/SendWorkNoticeUtil.java | 53 +-- .../dashboard/constant/AnalysisBasicConstant.java | 2 + .../api/dashboard/handle/CockpitStatsHandler.java | 140 +++---- .../manage/EarlyWarningStatisticsManage.java | 2 +- .../dashboard/model/vo/ProjectStatisticsVO.java | 4 +- .../hz/pm/api/datascope/model/DataScopeDTO.java | 8 +- .../impl/DashboardUserDataScopeProviderImpl.java | 17 +- .../impl/ExpertAdminDataScopeProviderImpl.java | 29 +- .../provider/impl/ExpertDataScopeProviderImpl.java | 19 +- .../impl/HigherUserDataScopeProviderImpl.java | 27 -- .../impl/OrdinaryUserDataScopeProviderImpl.java | 11 +- .../impl/OrgAdminDataScopeProviderImpl.java | 7 +- .../impl/RegionAdminDataScopeProviderImpl.java | 27 -- .../impl/SuperAdminDataScopeProviderImpl.java | 14 - .../impl/VisitorDataScopeProviderImpl.java | 38 ++ .../impl/VisitoyDataScopeProviderImpl.java | 45 -- .../hz/pm/api/ding/task/EmployeeBatchGetTask.java | 129 ++---- .../api/expert/model/SensitiveModifySegment.java | 2 +- .../hz/pm/api/external/sms/SmsServiceClient.java | 2 +- .../hz/pm/api/external/todo/TodoServiceClient.java | 8 +- .../external/todo/dto/AddSingleWkHandleDTO.java | 4 +- .../api/filemanage/manage/ProjectFileManage.java | 117 +++--- .../model/entity/ProjectApplyBorrow.java | 4 +- .../filemanage/model/vo/ProjectApplyBorrowVO.java | 8 +- .../controller/CompanyFiscalCodeController.java | 10 +- .../api/fiscal/manage/CompanyFiscalCodeManage.java | 72 ++-- .../model/po/CompanyFiscalCodeAndSealSnReq.java | 27 ++ .../model/po/ReqCompanyFiscalCodeAndSealSnPO.java | 28 -- .../model/vo/CompanyFiscalCodeAndSealSnVO.java | 33 ++ .../model/vo/ResCompanyFiscalCodeAndSealSnVO.java | 33 -- .../api/gov/manage/GovProjectCollectionManage.java | 82 +--- .../com/hz/pm/api/irs/manage/IrsProjectManage.java | 48 +-- .../api/meeting/helper/MeetingDataScopeHelper.java | 66 --- .../hz/pm/api/meeting/manage/MeetingManage.java | 8 +- .../helper/impl/TemplateDetailBuildHelperImpl.java | 9 +- .../api/performance/manage/AppAppraisalManage.java | 152 ++++--- .../performance/manage/OrgSelfAppraisalManage.java | 173 ++++---- .../manage/PerformanceAppraisalPlanManage.java | 458 ++++++++++----------- .../api/performance/manage/ReAppraisalManage.java | 80 ++-- .../api/performance/manage/RectifyAuditManage.java | 121 +++--- .../pm/api/performance/manage/RectifyManage.java | 61 +-- .../hz/pm/api/performance/manage/VerifyManage.java | 131 +++--- .../model/entity/PerformanceAppraisalProject.java | 4 +- .../entity/PerformanceAppraisalScoreInfo.java | 4 +- .../api/performance/model/vo/RectifyDetailVO.java | 9 +- .../com/hz/pm/api/performance/util/ExcelUtils.java | 4 +- .../com/hz/pm/api/portrait/manage/TagManage.java | 56 ++- .../controller/DeclaredProjectController.java | 2 +- .../projectdeclared/manage/ConstructionManage.java | 39 +- .../manage/ConstructionPlanManage.java | 54 +-- .../manage/DeclaredProjectManage.java | 196 ++++----- .../manage/DefaultDeclaredProjectManage.java | 116 +++--- .../projectdeclared/manage/DelayedApplyManage.java | 22 +- .../manage/FinalAcceptanceManage.java | 22 +- .../PrequalificationDeclaredProjectManage.java | 39 +- .../manage/ProjectAdjustmentManage.java | 4 +- .../api/projectdeclared/manage/PurchaseManage.java | 39 +- .../manage/ReviewByDeptJointManage.java | 39 +- .../manage/ReviewByProvincialDeptManage.java | 4 +- .../manage/ReviewChecklistManage.java | 50 +-- .../mapper/DeclaredStatisticsMapper.java | 6 +- .../mapper/DeclaredStatisticsMapper.xml | 2 +- .../impl/DeclaredStatisticsServiceImpl.java | 12 +- .../ProjectRenewalFundDeclarationController.java | 2 +- .../handle/AbstractProcessBusinessHandle.java | 4 +- .../handle/ConstructionPlanReviewHandle.java | 4 +- .../projectlib/handle/DeptUnitedReviewHandle.java | 4 +- .../handle/PreliminaryPreviewHandle.java | 4 +- .../handle/ProjectFinalInspectionHandle.java | 4 +- .../handle/ProvinceUnitedReviewHandle.java | 1 - .../projectlib/handle/UnitInnerAuditHandle.java | 4 +- .../api/projectlib/manage/AnnualPlanLibManage.java | 25 +- .../api/projectlib/manage/ApplicationManage.java | 42 +- .../pm/api/projectlib/manage/ProjectLibManage.java | 184 ++++----- .../manage/ProjectRenewalFundManage.java | 24 +- .../model/entity/AnalysisEventMonitor.java | 87 ---- .../api/projectlib/model/entity/ProjectInst.java | 2 +- .../hz/pm/api/projectlib/model/po/ProjectPO.java | 2 +- .../projectlib/model/vo/ProjectLibListItemVO.java | 18 +- .../model/vo/ProjectRenewalFundDeclarationVO.java | 7 +- .../api/provincial/controller/TestController.java | 12 +- .../provincial/model/res/ProvincialProjectRes.java | 5 +- .../pm/api/provincial/model/res/SjApiResponse.java | 2 +- .../hz/pm/api/safety/manage/SafetyRiskManage.java | 17 +- .../pm/api/scheduler/listener/CcTaskListener.java | 2 +- .../scheduler/listener/EarlyWarningListener.java | 17 +- .../api/scheduler/listener/ProcessEndListener.java | 35 +- .../scheduler/task/CockpitStatsStatisticsTask.java | 413 +++++++++---------- .../hz/pm/api/scheduler/task/CommonLogTask.java | 133 ------ .../task/EarlyWarningInstanceNotStartTask.java | 247 +++++------ .../scheduler/task/SynProjectCollectionTask.java | 38 +- .../hz/pm/api/staging/contants/StagingContant.java | 4 + .../impl/NdWorkNoticeStagingServiceImpl.java | 20 +- .../staging/utils/ProjectStatusFlowMapUtil.java | 4 +- .../api/staging/utils/ProjectStatusFlowUtil.java | 4 + .../api/staging/utils/WorkNoticeFlowMapUtil.java | 47 ++- .../pm/api/sys/contants/UserGuidanceContant.java | 12 + .../com/hz/pm/api/sys/convert/RegionConverter.java | 3 + .../hz/pm/api/sys/manage/EarlyWarningManage.java | 39 +- .../com/hz/pm/api/sys/manage/NoticeManage.java | 105 +++-- .../java/com/hz/pm/api/sys/manage/RoleManage.java | 28 +- .../hz/pm/api/sys/manage/UserGuidanceManage.java | 46 +-- .../com/hz/pm/api/sys/model/dto/RoleUpdateDTO.java | 4 +- .../sys/model/entity/WflowEarlyWarningRecords.java | 4 +- .../pm/api/sys/model/vo/ProjectEarlyWarningVO.java | 4 +- .../com/hz/pm/api/sys/model/vo/UserGuidanceVO.java | 2 +- .../com/hz/pm/api/sys/service/IRoleService.java | 2 +- .../hz/pm/api/sys/service/IUserRoleService.java | 8 +- .../pm/api/sys/service/impl/RoleServiceImpl.java | 5 +- .../com/hz/pm/api/sys/utils/EarlyWarningUtil.java | 61 ++- .../api/todocenter/constant/TodoCenterConst.java | 44 ++ .../todocenter/constant/TodoCenterConstant.java | 34 -- .../todocenter/constant/WorkNoticeConstant.java | 30 +- .../pm/api/todocenter/handle/WithDrawHandle.java | 171 ++++---- .../hz/pm/api/todocenter/manage/HandlerManage.java | 4 +- .../pm/api/todocenter/manage/TodoCenterManage.java | 399 +++++------------- .../api/todocenter/model/dto/AdjustHandleDTO.java | 22 +- .../api/todocenter/model/req/ToBeProcessedReq.java | 7 +- .../api/todocenter/service/StatisticsService.java | 2 +- .../service/impl/StatisticsServiceImpl.java | 10 +- .../todocenter/service/impl/TodoServiceImpl.java | 7 +- .../hz/pm/api/todocenter/utils/BuildUserUtils.java | 7 +- .../pm/api/user/controller/UserAuthController.java | 4 +- .../pm/api/user/controller/UserInfoController.java | 14 +- .../hz/pm/api/user/convert/UserInfoConvertor.java | 12 +- .../com/hz/pm/api/user/manage/MhUnitManage.java | 9 +- .../hz/pm/api/user/manage/SyncMhUserOrgManage.java | 3 +- .../com/hz/pm/api/user/manage/UserInfoManage.java | 373 +++++------------ .../com/hz/pm/api/user/model/entity/UserInfo.java | 7 +- .../hz/pm/api/user/model/po/ReqUserDetailPO.java | 21 - .../hz/pm/api/user/model/po/ReqUserInfoListPO.java | 43 -- .../com/hz/pm/api/user/model/po/UserDetailReq.java | 21 + .../hz/pm/api/user/model/po/UserInfoListReq.java | 39 ++ .../hz/pm/api/user/model/vo/ResUserDetailVO.java | 31 +- .../hz/pm/api/user/model/vo/ResUserInfoListVO.java | 55 --- .../hz/pm/api/user/model/vo/UserInfoListVO.java | 49 +++ .../security/auth/constants/SessionTimeConst.java | 18 + .../auth/constants/SessionTimeConstant.java | 14 - .../auth/credential/CredentialAuthProvider.java | 4 +- .../user/security/config/RedisSessionConfig.java | 4 +- .../api/user/security/model/UserFullInfoDTO.java | 94 ++--- .../api/user/security/model/UserInfoDetails.java | 88 ++-- .../com/hz/pm/api/user/util/LoginUserUtil.java | 11 +- .../pm/api/workbench/manage/WorkbenchManage.java | 45 +- .../test/java/com/hz/pm/api/irs/EmployeeTest.java | 224 ---------- .../test/java/com/hz/pm/api/provincial/Test.java | 34 +- 153 files changed, 2687 insertions(+), 4296 deletions(-) create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/VisitorDataScopeProviderImpl.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/VisitoyDataScopeProviderImpl.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/po/CompanyFiscalCodeAndSealSnReq.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/po/ReqCompanyFiscalCodeAndSealSnPO.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/vo/CompanyFiscalCodeAndSealSnVO.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/vo/ResCompanyFiscalCodeAndSealSnVO.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingDataScopeHelper.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/AnalysisEventMonitor.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CommonLogTask.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/todocenter/constant/TodoCenterConst.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/todocenter/constant/TodoCenterConstant.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqUserDetailPO.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqUserInfoListPO.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/UserDetailReq.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/UserInfoListReq.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserInfoListVO.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/UserInfoListVO.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/constants/SessionTimeConst.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/constants/SessionTimeConstant.java delete mode 100644 hz-pm-api/src/test/java/com/hz/pm/api/irs/EmployeeTest.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/RegionLimitHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/RegionLimitHelper.java index bb5a8c0..f4883ff 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/RegionLimitHelper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/RegionLimitHelper.java @@ -39,14 +39,4 @@ public interface RegionLimitHelper { */ RegionContainsBO getContainsRegionBo(Integer regionLevel, String regionCode); - - - /** - * 根据专家管理员用户id 获取专家管理员管辖区域列表 - * - * @param expertAdminUserId 专家管理员用户id - * @return - */ - List getExpertAdminContainsRegion(Long expertAdminUserId); - } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/UserInfoHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/UserInfoHelper.java index 8670bec..72cbdb2 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/UserInfoHelper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/UserInfoHelper.java @@ -1,7 +1,9 @@ package com.hz.pm.api.common.helper; +import cn.hutool.core.util.NumberUtil; import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.security.model.UserFullInfoDTO; +import com.ningdatech.basic.util.CollUtils; import java.util.Collection; import java.util.List; @@ -14,18 +16,17 @@ import java.util.List; public interface UserInfoHelper { - /** - * 根据用户id 获取 用户所属组织code organizationCode - * - * @param userId \ - * @return \ - */ - String getOrganizationCode(Long userId); - UserFullInfoDTO getUserFullInfoByMhUserIdOrOpenId(String mhUserId); UserFullInfoDTO getUserFullInfo(Long userId); + default UserFullInfoDTO getUserFullInfo(String userId) { + if (NumberUtil.isLong(userId)) { + return getUserFullInfo(Long.parseLong(userId)); + } + return null; + } + UserFullInfoDTO getUserFullInfo(UserInfo userInfo); List getUserFullInfos(List userInfos); @@ -39,16 +40,11 @@ public interface UserInfoHelper { */ boolean isSuperOrRegionAdmin(Long userId); - UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode); + List listUserFullInfoByUserIds(Collection userIds); - List getUserFullInfoByEmployeeCodes(Collection employeeCodes); - - /** - * 获取用户任职所在单位code \ - * - * @return \ - */ - String getUserEmpPosUnitCode(Long userId); + default List listUserFullInfoByUserIds(List userIds){ + List userIdsLong = CollUtils.convert(userIds, Long::parseLong); + return listUserFullInfoByUserIds(userIdsLong); + } - String getMainOrgCode(String empPosUnitCode); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/RegionLimitHelperImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/RegionLimitHelperImpl.java index 23dc863..215967f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/RegionLimitHelperImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/RegionLimitHelperImpl.java @@ -1,15 +1,10 @@ package com.hz.pm.api.common.helper.impl; -import cn.hutool.core.collection.CollectionUtil; -import com.baomidou.mybatisplus.core.toolkit.StringUtils; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.common.helper.basic.AbstractRegionLimitHelper; import com.hz.pm.api.expert.service.IExpertUserFullInfoService; import com.hz.pm.api.meta.model.bo.RegionContainsBO; -import com.hz.pm.api.sys.model.entity.Region; import com.hz.pm.api.sys.service.IRegionService; -import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.service.IUserInfoService; import org.apache.commons.collections4.CollectionUtils; import org.slf4j.Logger; @@ -28,8 +23,6 @@ import java.util.Objects; @Component public class RegionLimitHelperImpl extends AbstractRegionLimitHelper { - private static final Logger logger = LoggerFactory.getLogger(RegionLimitHelperImpl.class); - public RegionLimitHelperImpl(RegionCacheHelper regionCache, IExpertUserFullInfoService expertUserFullInfoService , IUserInfoService iUserInfoService, IRegionService regionService) { super(regionCache, expertUserFullInfoService, iUserInfoService, regionService); @@ -91,29 +84,4 @@ public class RegionLimitHelperImpl extends AbstractRegionLimitHelper { return regionContains; } - - @Override - public List getExpertAdminContainsRegion(Long expertAdminUserId) { - if (Objects.isNull(expertAdminUserId)) { - logger.error("getExpertAdminContainsRegion expertAdminUserId is null"); - return new ArrayList<>(); - } - UserInfo userInfo = iUserInfoService.getById(expertAdminUserId); - if (Objects.isNull(userInfo) || StringUtils.isBlank(userInfo.getRegionCode())) { - logger.error("getExpertAdminContainsRegion userInfo is null Or regionCode is null"); - return new ArrayList<>(); - } - String regionCode = userInfo.getRegionCode(); - List regionList = regionService.list(Wrappers.lambdaQuery(Region.class) - .eq(Region::getRegionCode, regionCode) - .orderByDesc(Region::getRegionLevel)); - Region region = regionList.get(0); - Collection regionCodes = regionCache - .listChildRegionCodeList(region.getRegionCode(), region.getRegionLevel()); - RegionContainsBO regionContainsBO = new RegionContainsBO(); - regionContainsBO.setContainsRegionCodeList(new ArrayList<>(regionCodes)); - regionContainsBO.setParentRegionTreeLevel(region.getRegionLevel()); - return CollectionUtil.toList(regionContainsBO); - } - } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java index a2c067b..f7464f1 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java @@ -1,31 +1,28 @@ package com.hz.pm.api.common.helper.impl; import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.collection.CollectionUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.helper.UserInfoHelper; -import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; -import com.hz.pm.api.organization.model.entity.DingOrganization; -import com.hz.pm.api.organization.service.IDingEmployeeInfoService; -import com.hz.pm.api.organization.service.IDingOrganizationService; +import com.hz.pm.api.common.util.StrUtils; import com.hz.pm.api.sys.mapper.RoleMapper; import com.hz.pm.api.sys.model.entity.Role; import com.hz.pm.api.sys.model.entity.UserRole; import com.hz.pm.api.sys.service.IUserRoleService; -import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.model.enumeration.RoleEnum; +import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; import com.hz.pm.api.user.security.model.UserFullInfoDTO; import com.hz.pm.api.user.service.IUserInfoService; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; -import java.util.*; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; -import java.util.stream.Stream; /** * @author liuxinxin @@ -37,22 +34,14 @@ public class UserInfoHelperImpl implements UserInfoHelper { private final IUserInfoService userInfoService; - private final IDingEmployeeInfoService iDingEmployeeInfoService; - private final IDingOrganizationService iDingOrganizationService; private final IUserRoleService iUserRoleService; private final RoleMapper roleMapper; @Override - public String getOrganizationCode(Long userId) { - UserFullInfoDTO userFullInfo = getUserFullInfo(userId); - return userFullInfo.getOrganizationCode(); - } - - @Override public UserFullInfoDTO getUserFullInfoByMhUserIdOrOpenId(String mhUserId) { LambdaQueryWrapper query = Wrappers.lambdaQuery(UserInfo.class) .eq(UserInfo::getMhUserId, mhUserId) - .or(q1 -> q1.eq(UserInfo::getWechatOpenId,mhUserId)); + .or(q1 -> q1.eq(UserInfo::getWechatOpenId, mhUserId)); UserInfo userInfo = userInfoService.getOne(query); if (Objects.isNull(userInfo)) { return null; @@ -74,61 +63,22 @@ public class UserInfoHelperImpl implements UserInfoHelper { @Override public UserFullInfoDTO getUserFullInfo(UserInfo userInfo) { UserFullInfoDTO userFullInfo = new UserFullInfoDTO(); - // 获取浙政钉雇员信息 组织信息 - String employeeCode = userInfo.getEmployeeCode(); - if (StringUtils.isNotBlank(employeeCode)) { - List dingEmployeeInfoList = iDingEmployeeInfoService - .list(Wrappers.lambdaQuery(DingEmployeeInfo.class) - .eq(DingEmployeeInfo::getEmployeeCode, employeeCode) - .eq(DingEmployeeInfo::getMainJob, "true")); - DingEmployeeInfo dingEmployeeInfo = dingEmployeeInfoList.get(0); - - - // 装配用户任职所在单位 - String empPosUnitCode = dingEmployeeInfo.getEmpPosUnitCode(); - if (StringUtils.isNotBlank(empPosUnitCode)) { - DingOrganization dingOrganization = iDingOrganizationService.getByOrgCode(empPosUnitCode); - if (Objects.nonNull(dingOrganization)) { - userFullInfo.setEmpPosUnitCode(empPosUnitCode); - userFullInfo.setEmpPosUnitName(dingOrganization.getOrganizationName()); - userFullInfo.setRegionCode(dingOrganization.getDivisionCode()); - } - } - - // 装配用户所在orgCode - String organizationCode = dingEmployeeInfo.getOrganizationCode(); - List dingOrganizationList = iDingOrganizationService.list(Wrappers - .lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getOrganizationCode, organizationCode)); - if (CollectionUtil.isNotEmpty(dingOrganizationList)) { - DingOrganization dingOrganization = dingOrganizationList.get(0); - userFullInfo.setOrganizationCode(dingOrganization.getOrganizationCode()); - userFullInfo.setOrganizationName(dingOrganization.getOrganizationName()); - // 测试使用 - userFullInfo.setRegionLevel(3); - } - } - - List roleList = new ArrayList<>(); // 获取用户角色列表信息 - List userRoleList = iUserRoleService - .list(Wrappers.lambdaQuery(UserRole.class) - .eq(UserRole::getUserId, userInfo.getId())); - if (CollectionUtil.isNotEmpty(userRoleList)) { + List userRoleList = iUserRoleService.listByUserId(userInfo.getId()); + if (CollUtil.isNotEmpty(userRoleList)) { List roleIdList = userRoleList.stream() .map(UserRole::getRoleId).distinct() .collect(Collectors.toList()); - roleList = roleMapper.selectBatchIds(roleIdList); + userFullInfo.setUserRoleList(roleMapper.selectBatchIds(roleIdList)); } - userFullInfo.setUserRoleList(roleList); - - // 装配用户任职所在单位 // 装配返回 userFullInfo.setUserId(userInfo.getId()); + userFullInfo.setMhUserId(userInfo.getMhUserId()); userFullInfo.setIdentifier(userInfo.getRealName()); userFullInfo.setRealName(userInfo.getRealName()); - userFullInfo.setEmployeeCode(employeeCode); + userFullInfo.setMhUnitId(userFullInfo.getMhUnitId()); + userFullInfo.setMhUnitName(userFullInfo.getMhUnitName()); userFullInfo.setUsername(userInfo.getRealName()); userFullInfo.setMobile(userInfo.getMobile()); userFullInfo.setAccountId(userInfo.getAccountId()); @@ -151,60 +101,20 @@ public class UserInfoHelperImpl implements UserInfoHelper { if (CollUtil.isEmpty(userInfos)) { return Collections.emptyList(); } - Map userMap = userInfos.stream().collect(Collectors.toMap(UserInfo::getEmployeeCode, e -> e)); - // 获取浙政钉雇员信息 组织信息 - List employeeCodes = userInfos.stream().map(UserInfo::getEmployeeCode).collect(Collectors.toList()); - List dingEmployeeInfoList = iDingEmployeeInfoService - .list(Wrappers.lambdaQuery(DingEmployeeInfo.class) - .in(DingEmployeeInfo::getEmployeeCode, employeeCodes) - .eq(DingEmployeeInfo::getMainJob, "true")); - - if (CollUtil.isEmpty(dingEmployeeInfoList)) { - return Collections.emptyList(); - } - - // 装配用户任职所在单位 - List empPosUnitCodes = dingEmployeeInfoList.stream().map(DingEmployeeInfo::getEmpPosUnitCode).collect(Collectors.toList()); - List orgCodes = dingEmployeeInfoList.stream().map(DingEmployeeInfo::getOrganizationCode).collect(Collectors.toList()); - List allOrgCodes = Stream.concat(empPosUnitCodes.stream(), orgCodes.stream()).collect(Collectors.toList()); - if (CollUtil.isEmpty(allOrgCodes)) { - return Collections.emptyList(); - } - List dingOrganizations = iDingOrganizationService.listByCodes(allOrgCodes); - if (CollUtil.isEmpty(dingOrganizations)) { - return Collections.emptyList(); - } - Map orgMap = dingOrganizations.stream().collect(Collectors.toMap(DingOrganization::getOrganizationCode, d -> d)); - - return dingEmployeeInfoList.stream().map(e -> { + return userInfos.stream().map(userInfo -> { UserFullInfoDTO userFullInfo = new UserFullInfoDTO(); - if (orgMap.containsKey(e.getEmpPosUnitCode())) { - DingOrganization organization = orgMap.get(e.getEmpPosUnitCode()); - userFullInfo.setEmpPosUnitCode(e.getEmpPosUnitCode()); - userFullInfo.setEmpPosUnitName(organization.getOrganizationName()); - userFullInfo.setRegionCode(organization.getDivisionCode()); - } - if (orgMap.containsKey(e.getOrganizationCode())) { - DingOrganization organization = orgMap.get(e.getOrganizationCode()); - userFullInfo.setOrganizationCode(organization.getOrganizationCode()); - userFullInfo.setOrganizationName(organization.getOrganizationName()); - // 测试使用 - userFullInfo.setRegionLevel(3); - } - if (userMap.containsKey(e.getEmployeeCode())) { - UserInfo userInfo = userMap.get(e.getEmployeeCode()); - // 装配返回 - userFullInfo.setUserId(userInfo.getId()); - userFullInfo.setIdentifier(userInfo.getRealName()); - userFullInfo.setRealName(userInfo.getRealName()); - userFullInfo.setEmployeeCode(e.getEmployeeCode()); - userFullInfo.setUsername(userInfo.getRealName()); - userFullInfo.setMobile(userInfo.getMobile()); - userFullInfo.setAccountId(userInfo.getAccountId()); - String available = userInfo.getAvailable(); - if (StringUtils.isNotBlank(available)) { - userFullInfo.setAvailable(UserAvailableEnum.valueOf(available)); - } + // 装配返回 + userFullInfo.setMhUnitName(userInfo.getMhUnitName()); + userFullInfo.setMhUnitId(userInfo.getMhUnitId()); + userFullInfo.setUserId(userInfo.getId()); + userFullInfo.setIdentifier(userInfo.getRealName()); + userFullInfo.setRealName(userInfo.getRealName()); + userFullInfo.setUsername(userInfo.getRealName()); + userFullInfo.setMobile(userInfo.getMobile()); + userFullInfo.setAccountId(userInfo.getAccountId()); + String available = userInfo.getAvailable(); + if (StrUtils.isNotBlank(available)) { + userFullInfo.setAvailable(UserAvailableEnum.valueOf(available)); } return userFullInfo; }).collect(Collectors.toList()); @@ -231,31 +141,9 @@ public class UserInfoHelperImpl implements UserInfoHelper { } @Override - public UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode) { - UserInfo userInfo = userInfoService.getUserInfoByEmployeeCode(employeeCode); - return getUserFullInfo(userInfo); - } - - @Override - public List getUserFullInfoByEmployeeCodes(Collection employeeCodes) { - List userInfos = userInfoService.getUserInfoByEmployeeCodes(employeeCodes); + public List listUserFullInfoByUserIds(Collection userIds) { + List userInfos = userInfoService.listByIds(userIds); return getUserFullInfos(userInfos); } - @Override - public String getUserEmpPosUnitCode(Long userId) { - UserFullInfoDTO userFullInfo = getUserFullInfo(userId); - return userFullInfo.getEmpPosUnitCode(); - } - - @Override - public String getMainOrgCode(String empPosUnitCode) { - DingOrganization org = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getOrganizationCode, empPosUnitCode) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(org)){ - return null; - } - return org.getParentCode(); - } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/StateMachineConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/StateMachineConst.java index c9ce670..a1d0ff9 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/StateMachineConst.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/StateMachineConst.java @@ -7,8 +7,10 @@ package com.hz.pm.api.common.model.constant; public class StateMachineConst { + private StateMachineConst() { + } + public static final String PROJECT_DECLARE = "projectDeclare"; public static final String APPLICATION_DECLARE = "applicationDeclare"; - public static final String LI_SHUI_CITY_AREA_CODE = "331100"; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineLQBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineLQBuilder.java index 5e871ff..d539c3c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineLQBuilder.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineLQBuilder.java @@ -264,16 +264,16 @@ public class ProjectDeclareStateMachineLQBuilder implements ProjectDeclareStateM @Bean(name = "projectDeclareStateMachineLQPersister") @Override public StateMachinePersister getProjectPersister() { - StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { + StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { @Override public void write(StateMachineContext context, Project contextObj) { + logger.info(contextObj.toString()); } @Override public StateMachineContext read(Project contextObj) { - StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), + return new DefaultStateMachineContext<>(ProjectStatusEnum.match(contextObj.getStatus()), null, null, null, null, RegionContant.LS_LQ_CODE); - return result; } }); stateMachinePersister = sp; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/contant/RegionContant.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/contant/RegionContant.java index 619445f..b3684ec 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/contant/RegionContant.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/contant/RegionContant.java @@ -7,6 +7,10 @@ package com.hz.pm.api.common.statemachine.contant; * @Author PoffyZhang */ public class RegionContant { + + private RegionContant() { + } + //市本级 public static final String LS_SBJ_CODE = "330100"; //莲都区 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/SendWorkNoticeUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/SendWorkNoticeUtil.java index 00c71a5..6d6e2ef 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/SendWorkNoticeUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/SendWorkNoticeUtil.java @@ -1,15 +1,16 @@ package com.hz.pm.api.common.util; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.model.GenericResult; import com.hz.pm.api.todocenter.bean.entity.WorkNoticeInfo; +import com.ningdatech.basic.model.GenericResult; import com.ningdatech.zwdd.client.ZwddClient; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.stereotype.Component; -import java.util.List; -import java.util.concurrent.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ThreadPoolExecutor; /** * 异步发送工作通知工具类 @@ -18,8 +19,8 @@ import java.util.concurrent.*; * @since 2023/02/23 13:50 */ @Slf4j -@RequiredArgsConstructor @Component +@RequiredArgsConstructor public class SendWorkNoticeUtil { private final ZwddClient zwddClient; @@ -27,10 +28,21 @@ public class SendWorkNoticeUtil { /** * 初始化线程池 */ - public static ThreadPoolExecutor threadPool = new ThreadPoolExecutor(2, 10, - 60, TimeUnit.SECONDS, new ArrayBlockingQueue(10), new ThreadPoolExecutor.AbortPolicy()); + public static final ThreadPoolTaskExecutor EXECUTOR; - public Boolean sendWorkNotice(WorkNoticeInfo workNoticeInfo){ + static { + EXECUTOR = new ThreadPoolTaskExecutor(); + EXECUTOR.setCorePoolSize(2); + EXECUTOR.setMaxPoolSize(4); + EXECUTOR.setQueueCapacity(200); + EXECUTOR.setKeepAliveSeconds(120); + EXECUTOR.setThreadNamePrefix("sendWorkNotice-"); + EXECUTOR.setWaitForTasksToCompleteOnShutdown(true); + EXECUTOR.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy()); + EXECUTOR.initialize(); + } + + public Boolean sendWorkNotice(WorkNoticeInfo workNoticeInfo) { // 将发送工作通知交给异步任务Future String msg = workNoticeInfo.getMsg(); @@ -44,23 +56,18 @@ public class SendWorkNoticeUtil { log.info("异步任务执行完成, " + workNoticeInfo.getBizMsgId() + " 当前线程:" + Thread.currentThread().getName()); long endTime = System.currentTimeMillis(); log.info("方法执行完成返回,耗时:" + (endTime - startTime)); - }else { + } else { return "发送工作通知失败!"; } return "发送工作通知成功!"; - }, threadPool); - String s; - try { - s = future.get(); - } catch (Exception e) { - throw new BizException("获取异步线程处理结果失败!"); - } - threadPool.shutdown(); - while (!threadPool.isTerminated()) { - log.info(s); - return Boolean.FALSE; - } - log.info(s); - return Boolean.TRUE; + }, EXECUTOR); + try { + future.get(); + } catch (InterruptedException | ExecutionException e) { + log.error("获取异步线程处理结果失败!", e); + Thread.currentThread().interrupt(); + } + return Boolean.TRUE; } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/constant/AnalysisBasicConstant.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/constant/AnalysisBasicConstant.java index ec980d2..f34b260 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/constant/AnalysisBasicConstant.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/constant/AnalysisBasicConstant.java @@ -7,6 +7,8 @@ package com.hz.pm.api.dashboard.constant; public class AnalysisBasicConstant { + private AnalysisBasicConstant() { + } /** * 丽水市区域编码 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/handle/CockpitStatsHandler.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/handle/CockpitStatsHandler.java index bdf16d5..eff102f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/handle/CockpitStatsHandler.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/handle/CockpitStatsHandler.java @@ -5,13 +5,13 @@ import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import com.hz.pm.api.common.model.constant.RegionConst; import com.hz.pm.api.common.helper.RegionCacheHelper; -import com.hz.pm.api.dashboard.constant.DashboardConstant; +import com.hz.pm.api.common.model.constant.RegionConst; import com.hz.pm.api.dashboard.enums.CockpitAppcationTypeEnum; import com.hz.pm.api.dashboard.model.entity.CockpitApplication; import com.hz.pm.api.dashboard.model.entity.CockpitStats; import com.hz.pm.api.dashboard.model.vo.CockpitStatsVO; +import com.hz.pm.api.dashboard.model.vo.CockpitStatsVO.*; import com.hz.pm.api.dashboard.service.ICockpitStatsService; import com.hz.pm.api.sys.model.dto.RegionDTO; import lombok.RequiredArgsConstructor; @@ -24,6 +24,8 @@ import java.math.RoundingMode; import java.util.*; import java.util.stream.Collectors; +import static com.hz.pm.api.dashboard.constant.DashboardConstant.CockpitStats.*; + /** * @Classname CockpitStatsHandler * @Description @@ -39,23 +41,23 @@ public class CockpitStatsHandler { private final ICockpitStatsService cockpitStatsService; - private static final List years = Lists.newArrayList(2021,2022,2023,2024,2025); + private static final List years = Lists.newArrayList(2021, 2022, 2023, 2024, 2025); public CockpitStatsVO convertCockpitStats(CockpitStats cockpitStats, String regionCode, Integer year , List appDatas) { - CockpitStatsVO res = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.class); + CockpitStatsVO res = BeanUtil.copyProperties(cockpitStats, CockpitStatsVO.class); - if(Objects.isNull(cockpitStats)){ + if (Objects.isNull(cockpitStats)) { return res; } //监测数据 - res.setMonitorData(convertMonitor(cockpitStats,regionCode)); + res.setMonitorData(convertMonitor(cockpitStats, regionCode)); //专家数据 res.setExpertData(convertExpertData(cockpitStats)); //顶部数据 res.setTopData(convertTopData(cockpitStats)); //地图数据 - res.setMapProjectData(convertMapProjectsData(cockpitStats,year)); + res.setMapProjectData(convertMapProjectsData(cockpitStats, year)); //项目项目数据 res.setStatusProjectsData(convertStatusProjectsData(cockpitStats)); //项目效益 优秀项目 @@ -69,23 +71,23 @@ public class CockpitStatsHandler { //最佳/重大应用 res.setAppDatas(convertCockpitApps(appDatas)); //数据质量分数 - res.setQualityDatas(convertQualityDatas(year)); + res.setQualityDatas(convertQualityData(year)); return res; } - private List convertQualityDatas(Integer year) { - List datas = cockpitStatsService.list(Wrappers.lambdaQuery(CockpitStats.class) + private List convertQualityData(Integer year) { + List dataList = cockpitStatsService.list(Wrappers.lambdaQuery(CockpitStats.class) .eq(Objects.nonNull(year), CockpitStats::getYear, year) - .eq(Objects.isNull(year), CockpitStats::getYear, DashboardConstant.CockpitStats.NONE_YEAR) - .ne(CockpitStats::getRegionCode,DashboardConstant.CockpitStats.TOTAL) + .eq(Objects.isNull(year), CockpitStats::getYear, NONE_YEAR) + .ne(CockpitStats::getRegionCode, TOTAL) .orderByAsc(CockpitStats::getRegionCode)); - if(CollUtil.isEmpty(datas)){ + if (CollUtil.isEmpty(dataList)) { return Collections.emptyList(); } - return datas.stream().map(d -> { - CockpitStatsVO.QualityData data = new CockpitStatsVO.QualityData(); + return dataList.stream().map(d -> { + QualityData data = new QualityData(); data.setRegionCode(d.getRegionCode()); data.setRegionName(d.getRegionName()); data.setQuality(d.getDataQuality()); @@ -105,150 +107,144 @@ public class CockpitStatsHandler { } private CockpitStatsVO.PerformanceData convertPerformanceData(CockpitStats cockpitStats) { - CockpitStatsVO.PerformanceData data = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.PerformanceData.class); + CockpitStatsVO.PerformanceData data = BeanUtil.copyProperties(cockpitStats, CockpitStatsVO.PerformanceData.class); data.setPerformanceTops(convertTops(cockpitStats)); return data; } - private List convertTops(CockpitStats cockpitStats) { - List tops = Lists.newArrayList(); - tops.add(new CockpitStatsVO.PerformanceTop("一星",cockpitStats.getPerformanceTop1Score(),cockpitStats.getPerformanceTop1Name())); - tops.add(new CockpitStatsVO.PerformanceTop("二星",cockpitStats.getPerformanceTop2Score(),cockpitStats.getPerformanceTop2Name())); - tops.add(new CockpitStatsVO.PerformanceTop("三星",cockpitStats.getPerformanceTop3Score(),cockpitStats.getPerformanceTop3Name())); - tops.add(new CockpitStatsVO.PerformanceTop("四星",cockpitStats.getPerformanceTop4Score(),cockpitStats.getPerformanceTop4Name())); - tops.add(new CockpitStatsVO.PerformanceTop("五星",cockpitStats.getPerformanceTop5Score(),cockpitStats.getPerformanceTop5Name())); + private List convertTops(CockpitStats cockpitStats) { + List tops = Lists.newArrayList(); + tops.add(new PerformanceTop("一星", cockpitStats.getPerformanceTop1Score(), cockpitStats.getPerformanceTop1Name())); + tops.add(new PerformanceTop("二星", cockpitStats.getPerformanceTop2Score(), cockpitStats.getPerformanceTop2Name())); + tops.add(new PerformanceTop("三星", cockpitStats.getPerformanceTop3Score(), cockpitStats.getPerformanceTop3Name())); + tops.add(new PerformanceTop("四星", cockpitStats.getPerformanceTop4Score(), cockpitStats.getPerformanceTop4Name())); + tops.add(new PerformanceTop("五星", cockpitStats.getPerformanceTop5Score(), cockpitStats.getPerformanceTop5Name())); return tops; } private CockpitStatsVO.ProduceData convertProduceData(CockpitStats cockpitStats) { - return BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.ProduceData.class); + return BeanUtil.copyProperties(cockpitStats, CockpitStatsVO.ProduceData.class); } private CockpitStatsVO.ReduceData convertReduceData(CockpitStats cockpitStats) { - CockpitStatsVO.ReduceData data = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.ReduceData.class); + CockpitStatsVO.ReduceData data = BeanUtil.copyProperties(cockpitStats, CockpitStatsVO.ReduceData.class); data.setAmountComparisonCharts(convertAmountComparisonChart(cockpitStats)); return data; } - private List convertAmountComparisonChart(CockpitStats cockpitStats) { - List res = Lists.newArrayList(); - res.add(new CockpitStatsVO.AmountComparisonChart("申报", cockpitStats.getDeclaredAmountApprove(),cockpitStats.getApprovalAmountApprove(),cockpitStats.getDifferenceApprove())); - res.add(new CockpitStatsVO.AmountComparisonChart("批复", cockpitStats.getDeclaredAmountApproval(),cockpitStats.getApprovalAmountApproval(),cockpitStats.getDifferenceApproval())); - res.add(new CockpitStatsVO.AmountComparisonChart("合同", cockpitStats.getDeclaredAmountContract(),cockpitStats.getApprovalAmountContract(),cockpitStats.getDifferenceContract())); + private List convertAmountComparisonChart(CockpitStats cockpitStats) { + List res = Lists.newArrayList(); + res.add(new AmountComparisonChart("申报", cockpitStats.getDeclaredAmountApprove(), cockpitStats.getApprovalAmountApprove(), cockpitStats.getDifferenceApprove())); + res.add(new AmountComparisonChart("批复", cockpitStats.getDeclaredAmountApproval(), cockpitStats.getApprovalAmountApproval(), cockpitStats.getDifferenceApproval())); + res.add(new AmountComparisonChart("合同", cockpitStats.getDeclaredAmountContract(), cockpitStats.getApprovalAmountContract(), cockpitStats.getDifferenceContract())); return res; } private CockpitStatsVO.ExcellentData convertExcellentData(CockpitStats cockpitStats) { - CockpitStatsVO.ExcellentData data = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.ExcellentData.class); + CockpitStatsVO.ExcellentData data = BeanUtil.copyProperties(cockpitStats, CockpitStatsVO.ExcellentData.class); data.setExcellentProjects(Lists.newArrayList()); return data; } private CockpitStatsVO.StatusProjectsData convertStatusProjectsData(CockpitStats cockpitStats) { - return BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.StatusProjectsData.class); + return BeanUtil.copyProperties(cockpitStats, CockpitStatsVO.StatusProjectsData.class); } - private List convertMapProjectsData(CockpitStats cockpitStats,Integer year) { + private List convertMapProjectsData(CockpitStats cockpitStats, Integer year) { List mapProjectsDatas = Lists.newArrayList(); List regions = regionCacheHelper.listChildren(RegionConst.RC_HZ, RegionConst.RL_CITY); regions = regions.stream().filter(r -> r.getRegionLevel() != 2).sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); List cockpitStatsAll = cockpitStatsService.list(Wrappers.lambdaQuery(CockpitStats.class) .eq(Objects.nonNull(year), CockpitStats::getYear, year) - .eq(Objects.isNull(year), CockpitStats::getYear, DashboardConstant.CockpitStats.NONE_YEAR)); - Map totalMap = cockpitStatsAll.stream().filter(c -> Objects.nonNull(c.getRegionCode()) && Objects.nonNull(c.getProjectsTotal())) - .collect(Collectors.toMap(c -> c.getRegionCode(), c -> c.getProjectsTotal())); + .eq(Objects.isNull(year), CockpitStats::getYear, NONE_YEAR)); + Map totalMap = cockpitStatsAll.stream() + .filter(c -> Objects.nonNull(c.getRegionCode()) && Objects.nonNull(c.getProjectsTotal())) + .collect(Collectors.toMap(CockpitStats::getRegionCode, CockpitStats::getProjectsTotal)); - for(RegionDTO region : regions){ + for (RegionDTO region : regions) { CockpitStatsVO.MapProjectsData mapProjectsData = new CockpitStatsVO.MapProjectsData(); mapProjectsData.setRegionCode(region.getRegionCode()); mapProjectsData.setRegionName(region.getRegionName()); - if(totalMap.containsKey(mapProjectsData.getRegionCode())){ - mapProjectsData.setProjectsNum(totalMap.get(mapProjectsData.getRegionCode())); - }else{ - mapProjectsData.setProjectsNum(0); - } + mapProjectsData.setProjectsNum(totalMap.getOrDefault(mapProjectsData.getRegionCode(), 0)); mapProjectsDatas.add(mapProjectsData); } return mapProjectsDatas; } private CockpitStatsVO.TopData convertTopData(CockpitStats cockpitStats) { - return BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.TopData.class); + return BeanUtil.copyProperties(cockpitStats, CockpitStatsVO.TopData.class); } private CockpitStatsVO.Expert convertExpertData(CockpitStats cockpitStats) { - CockpitStatsVO.Expert expert = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.Expert.class); - expert.setExpertRegionData(buidExpertRegionData(cockpitStats)); + CockpitStatsVO.Expert expert = BeanUtil.copyProperties(cockpitStats, CockpitStatsVO.Expert.class); + expert.setExpertRegionData(buildExpertRegionData(cockpitStats)); return expert; } - private List buidExpertRegionData(CockpitStats cockpitStats) { + private List buildExpertRegionData(CockpitStats cockpitStats) { List regionData = Lists.newArrayList(); List regions = regionCacheHelper.listChildren(RegionConst.RC_HZ, RegionConst.RL_CITY); regions = regions.stream().filter(r -> r.getRegionLevel() != 2).sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); List cs = cockpitStatsService.list(); Map csMap = cs.stream().collect(Collectors.toMap(c -> c.getRegionCode() + c.getYear(), CockpitStats::getExpertTotalNum)); - for(RegionDTO region : regions){ + for (RegionDTO region : regions) { CockpitStatsVO.ExpertRegion expertRegion = new CockpitStatsVO.ExpertRegion(); expertRegion.setRegionCode(region.getRegionCode()); expertRegion.setRegionName(region.getRegionName()); - if(csMap.containsKey(region.getRegionCode() + 0)){ - expertRegion.setExpertNum(csMap.get(region.getRegionCode() + 0)); - }else{ - expertRegion.setExpertNum(0); - } + expertRegion.setExpertNum(csMap.getOrDefault(region.getRegionCode() + 0, 0)); regionData.add(expertRegion); } return regionData; } - private CockpitStatsVO.Monitor convertMonitor(CockpitStats cockpitStats,String regionCode) { - CockpitStatsVO.Monitor monitor = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.Monitor.class); - monitor.setPasswordGradeCharts(buidPasswordGradeCharts(cockpitStats)); - monitor.setSecrecyGradeCharts(buidSecrecyGradeCharts(cockpitStats)); + private CockpitStatsVO.Monitor convertMonitor(CockpitStats cockpitStats, String regionCode) { + CockpitStatsVO.Monitor monitor = BeanUtil.copyProperties(cockpitStats, CockpitStatsVO.Monitor.class); + monitor.setPasswordGradeCharts(buildPasswordGradeCharts(cockpitStats)); + monitor.setSecrecyGradeCharts(buildSecrecyGradeCharts(cockpitStats)); monitor.setMonitorSafetyInputRate(computeSafetyRate(regionCode)); return monitor; } /** * 安全投入 比 图 + * * @param regionCode * @return */ private List computeSafetyRate(String regionCode) { List cocks = cockpitStatsService.list(Wrappers.lambdaQuery(CockpitStats.class) .eq(StringUtils.isNotBlank(regionCode), CockpitStats::getRegionCode, regionCode) - .eq(StringUtils.isBlank(regionCode), CockpitStats::getRegionCode, DashboardConstant.CockpitStats.TOTAL) + .eq(StringUtils.isBlank(regionCode), CockpitStats::getRegionCode, TOTAL) .in(CockpitStats::getYear, years) .orderByAsc(CockpitStats::getYear)); return cocks.stream().map(c -> { CockpitStatsVO.SafetyInput safetyInput = new CockpitStatsVO.SafetyInput(); safetyInput.setYear(c.getYear()); safetyInput.setRate(Objects.nonNull(c.getMonitorDeclaredAmount()) && c.getMonitorDeclaredAmount().compareTo(BigDecimal.ZERO) > 0 ? - c.getMonitorSafetyInputAmount().multiply(BigDecimal.valueOf(100)).divide(c.getMonitorDeclaredAmount(),2, RoundingMode.CEILING): BigDecimal.ZERO); + c.getMonitorSafetyInputAmount().multiply(BigDecimal.valueOf(100)).divide(c.getMonitorDeclaredAmount(), 2, RoundingMode.CEILING) : BigDecimal.ZERO); return safetyInput; }).collect(Collectors.toList()); } - private List buidSecrecyGradeCharts(CockpitStats cockpitStats) { - List chars = Lists.newArrayList(); - chars.add(new CockpitStatsVO.SecrecyGradeChart(1,cockpitStats.getMonitorSecrecyGrade1Num())); - chars.add(new CockpitStatsVO.SecrecyGradeChart(2,cockpitStats.getMonitorSecrecyGrade2Num())); - chars.add(new CockpitStatsVO.SecrecyGradeChart(3,cockpitStats.getMonitorSecrecyGrade3Num())); - chars.add(new CockpitStatsVO.SecrecyGradeChart(4,cockpitStats.getMonitorSecrecyGrade4Num())); - chars.add(new CockpitStatsVO.SecrecyGradeChart(5,cockpitStats.getMonitorSecrecyGrade5Num())); + private List buildSecrecyGradeCharts(CockpitStats cockpitStats) { + List chars = Lists.newArrayList(); + chars.add(new SecrecyGradeChart(1, cockpitStats.getMonitorSecrecyGrade1Num())); + chars.add(new SecrecyGradeChart(2, cockpitStats.getMonitorSecrecyGrade2Num())); + chars.add(new SecrecyGradeChart(3, cockpitStats.getMonitorSecrecyGrade3Num())); + chars.add(new SecrecyGradeChart(4, cockpitStats.getMonitorSecrecyGrade4Num())); + chars.add(new SecrecyGradeChart(5, cockpitStats.getMonitorSecrecyGrade5Num())); return chars; } - private List buidPasswordGradeCharts(CockpitStats cockpitStats) { - List chars = Lists.newArrayList(); - chars.add(new CockpitStatsVO.PasswordGradeChart(1,cockpitStats.getMonitorPasswordGrade1Num())); - chars.add(new CockpitStatsVO.PasswordGradeChart(2,cockpitStats.getMonitorPasswordGrade2Num())); - chars.add(new CockpitStatsVO.PasswordGradeChart(3,cockpitStats.getMonitorPasswordGrade3Num())); - chars.add(new CockpitStatsVO.PasswordGradeChart(4,cockpitStats.getMonitorPasswordGrade4Num())); - chars.add(new CockpitStatsVO.PasswordGradeChart(5,cockpitStats.getMonitorPasswordGrade5Num())); + private List buildPasswordGradeCharts(CockpitStats cockpitStats) { + List chars = Lists.newArrayList(); + chars.add(new PasswordGradeChart(1, cockpitStats.getMonitorPasswordGrade1Num())); + chars.add(new PasswordGradeChart(2, cockpitStats.getMonitorPasswordGrade2Num())); + chars.add(new PasswordGradeChart(3, cockpitStats.getMonitorPasswordGrade3Num())); + chars.add(new PasswordGradeChart(4, cockpitStats.getMonitorPasswordGrade4Num())); + chars.add(new PasswordGradeChart(5, cockpitStats.getMonitorPasswordGrade5Num())); return chars; } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/EarlyWarningStatisticsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/EarlyWarningStatisticsManage.java index 09e5009..122eac8 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/EarlyWarningStatisticsManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/EarlyWarningStatisticsManage.java @@ -71,7 +71,7 @@ public class EarlyWarningStatisticsManage { EarlyWarningStatisticsVO res = new EarlyWarningStatisticsVO(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(WflowEarlyWarningRecords.class); - EarlyWarningUtil.buildPermissonWrapper(wrapper,user); + EarlyWarningUtil.buildPermissionWrapper(wrapper,user); List records = earlyWarningRecordsService.list(wrapper); //累积总告警数 res.setAccumulatedAlarmsTotal(records.size()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/ProjectStatisticsVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/ProjectStatisticsVO.java index 336507e..3a10d89 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/ProjectStatisticsVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/model/vo/ProjectStatisticsVO.java @@ -5,13 +5,11 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.io.Serializable; import java.util.List; @Data @ApiModel(value = "项目统计") -public class ProjectStatisticsVO implements Serializable { - private static final long serialVersionUID = 1L; +public class ProjectStatisticsVO { @ApiModelProperty("项目计划数") private Integer planTotal = 0; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/model/DataScopeDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/model/DataScopeDTO.java index fe34a59..697fa50 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/model/DataScopeDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/model/DataScopeDTO.java @@ -7,7 +7,7 @@ import java.util.List; /** *

- * DataScopeDto + * DataScopeDTO *

* * @author WendyYang @@ -18,14 +18,8 @@ public class DataScopeDTO { private RoleEnum role; - private List regionIds; - - private List regionCodes; - private String orgCode; - private String employeeCode; - private Long userId; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/DashboardUserDataScopeProviderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/DashboardUserDataScopeProviderImpl.java index 3c05d8a..731b334 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/DashboardUserDataScopeProviderImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/DashboardUserDataScopeProviderImpl.java @@ -1,6 +1,5 @@ package com.hz.pm.api.datascope.provider.impl; -import com.google.common.collect.Lists; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.datascope.model.DataScopeDTO; import com.hz.pm.api.datascope.provider.DataScopeProvider; @@ -30,23 +29,19 @@ public class DashboardUserDataScopeProviderImpl implements DataScopeProvider { @Override public Optional findDataFieldProperty() { - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); DataScopeDTO ds = new DataScopeDTO(); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); - ds.setRegionCodes(Lists.newArrayList(userFullInfo.getRegionCode())); - ds.setUserId(userFullInfo.getUserId()); + ds.setUserId(user.getUserId()); ds.setRole(RoleEnum.DASHBOARD); - return Optional.ofNullable(ds); + return Optional.of(ds); } @Override public Optional findDataFieldProperty(Long userId) { - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(userId); DataScopeDTO ds = new DataScopeDTO(); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); - ds.setRegionCodes(Lists.newArrayList(userFullInfo.getRegionCode())); - ds.setUserId(userFullInfo.getUserId()); + ds.setUserId(user.getUserId()); ds.setRole(RoleEnum.DASHBOARD); - return Optional.ofNullable(ds); + return Optional.of(ds); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/ExpertAdminDataScopeProviderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/ExpertAdminDataScopeProviderImpl.java index a8682a4..4c82ce2 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/ExpertAdminDataScopeProviderImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/ExpertAdminDataScopeProviderImpl.java @@ -1,11 +1,8 @@ package com.hz.pm.api.datascope.provider.impl; -import com.ningdatech.basic.util.CollUtils; -import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.datascope.model.DataScopeDTO; import com.hz.pm.api.datascope.provider.DataScopeProvider; -import com.hz.pm.api.sys.model.dto.RegionDTO; import com.hz.pm.api.user.model.enumeration.RoleEnum; import com.hz.pm.api.user.security.model.UserFullInfoDTO; import com.hz.pm.api.user.security.model.UserInfoDetails; @@ -13,9 +10,6 @@ import com.hz.pm.api.user.util.LoginUserUtil; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; -import java.util.Collections; -import java.util.List; -import java.util.Objects; import java.util.Optional; /** @@ -30,25 +24,15 @@ import java.util.Optional; @RequiredArgsConstructor public class ExpertAdminDataScopeProviderImpl implements DataScopeProvider { - private final RegionCacheHelper regionCacheHelper; private final UserInfoHelper userInfoHelper; @Override public Optional findDataFieldProperty() { UserInfoDetails user = LoginUserUtil.loginUserDetail(); DataScopeDTO ds = new DataScopeDTO(); - if (Objects.isNull(user.getRegionLevel())) { - ds.setRegionIds(Collections.emptyList()); - ds.setRegionCodes(Collections.emptyList()); - } else { - List regions = regionCacheHelper.listChildren(user.getRegionCode(), user.getRegionLevel()); - ds.setRegionCodes(CollUtils.fieldList(regions, RegionDTO::getRegionCode)); - ds.setRegionIds(CollUtils.fieldList(regions, RegionDTO::getId)); - } ds.setRole(RoleEnum.EXPERT_ADMIN); ds.setUserId(user.getUserId()); - ds.setEmployeeCode(user.getEmployeeCode()); - ds.setOrgCode(user.getOrganizationCode()); + ds.setOrgCode(user.getMhUnitIdStr()); return Optional.of(ds); } @@ -56,18 +40,9 @@ public class ExpertAdminDataScopeProviderImpl implements DataScopeProvider { public Optional findDataFieldProperty(Long userId) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(userId); DataScopeDTO ds = new DataScopeDTO(); - if (Objects.isNull(user.getRegionLevel())) { - ds.setRegionIds(Collections.emptyList()); - ds.setRegionCodes(Collections.emptyList()); - } else { - List regions = regionCacheHelper.listChildren(user.getRegionCode(), user.getRegionLevel()); - ds.setRegionCodes(CollUtils.fieldList(regions, RegionDTO::getRegionCode)); - ds.setRegionIds(CollUtils.fieldList(regions, RegionDTO::getId)); - } ds.setRole(RoleEnum.EXPERT_ADMIN); ds.setUserId(user.getUserId()); - ds.setEmployeeCode(user.getEmployeeCode()); - ds.setOrgCode(user.getOrganizationCode()); + ds.setOrgCode(user.getMhUnitIdStr()); return Optional.of(ds); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/ExpertDataScopeProviderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/ExpertDataScopeProviderImpl.java index 4382699..cb0528b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/ExpertDataScopeProviderImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/ExpertDataScopeProviderImpl.java @@ -1,6 +1,5 @@ package com.hz.pm.api.datascope.provider.impl; -import com.hz.pm.api.common.model.constant.RegionConst; import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.datascope.model.DataScopeDTO; @@ -12,9 +11,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; -import java.util.Collection; import java.util.Optional; -import java.util.stream.Collectors; /** *

@@ -36,30 +33,18 @@ public class ExpertDataScopeProviderImpl implements DataScopeProvider { @Override public Optional findDataFieldProperty() { UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - //所有 丽水市的code - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_HZ, - RegionConst.RL_CITY); - DataScopeDTO ds = new DataScopeDTO(); - ds.setRegionCodes(regionCodes.stream().collect(Collectors.toList())); ds.setUserId(userFullInfo.getUserId()); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); ds.setRole(RoleEnum.EXPERT); - return Optional.ofNullable(ds); + return Optional.of(ds); } @Override public Optional findDataFieldProperty(Long userId) { UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - //所有 丽水市的code - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_HZ, - RegionConst.RL_CITY); - DataScopeDTO ds = new DataScopeDTO(); - ds.setRegionCodes(regionCodes.stream().collect(Collectors.toList())); ds.setUserId(userFullInfo.getUserId()); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); ds.setRole(RoleEnum.EXPERT); - return Optional.ofNullable(ds); + return Optional.of(ds); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/HigherUserDataScopeProviderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/HigherUserDataScopeProviderImpl.java index e2eb72b..76ff250 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/HigherUserDataScopeProviderImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/HigherUserDataScopeProviderImpl.java @@ -1,9 +1,5 @@ package com.hz.pm.api.datascope.provider.impl; -import cn.hutool.core.collection.CollUtil; -import com.google.common.collect.Lists; -import com.hz.pm.api.common.model.constant.RegionConst; -import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.datascope.model.DataScopeDTO; import com.hz.pm.api.datascope.provider.DataScopeProvider; @@ -14,8 +10,6 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; -import java.util.ArrayList; -import java.util.Collection; import java.util.Optional; /** @@ -31,26 +25,14 @@ import java.util.Optional; @Component("HIGH_MEMBER") public class HigherUserDataScopeProviderImpl implements DataScopeProvider { - private final RegionCacheHelper regionCacheHelper; private final UserInfoHelper userInfoHelper; //和区域管理员一样 @Override public Optional findDataFieldProperty() { UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - //借由 丽水市的code 来映射市本级的regionCode - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(userFullInfo.getRegionCode(), - RegionConst.RL_CITY); - //如果不是市本级的话 就直接放入本区域的县就好了 - if(CollUtil.isEmpty(regionCodes)){ - regionCodes = Lists.newArrayList(); - regionCodes.add(userFullInfo.getRegionCode()); - } - DataScopeDTO ds = new DataScopeDTO(); - ds.setRegionCodes(new ArrayList<>(regionCodes)); ds.setUserId(userFullInfo.getUserId()); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); ds.setRole(RoleEnum.REGION_MANAGER); return Optional.of(ds); } @@ -59,18 +41,9 @@ public class HigherUserDataScopeProviderImpl implements DataScopeProvider { public Optional findDataFieldProperty(Long userId) { UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); //借由 丽水市的code 来映射市本级的regionCode - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(userFullInfo.getRegionCode(), - RegionConst.RL_CITY); - //如果不是市本级的话 就直接放入本区域的县就好了 - if(CollUtil.isEmpty(regionCodes)){ - regionCodes = Lists.newArrayList(); - regionCodes.add(userFullInfo.getRegionCode()); - } DataScopeDTO ds = new DataScopeDTO(); - ds.setRegionCodes(new ArrayList<>(regionCodes)); ds.setUserId(userFullInfo.getUserId()); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); ds.setRole(RoleEnum.REGION_MANAGER); return Optional.of(ds); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/OrdinaryUserDataScopeProviderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/OrdinaryUserDataScopeProviderImpl.java index 7023b7f..bb45be9 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/OrdinaryUserDataScopeProviderImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/OrdinaryUserDataScopeProviderImpl.java @@ -1,6 +1,5 @@ package com.hz.pm.api.datascope.provider.impl; -import com.google.common.collect.Lists; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.datascope.model.DataScopeDTO; import com.hz.pm.api.datascope.provider.DataScopeProvider; @@ -10,6 +9,7 @@ import com.hz.pm.api.user.util.LoginUserUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; + import java.util.Optional; /** @@ -31,21 +31,18 @@ public class OrdinaryUserDataScopeProviderImpl implements DataScopeProvider { public Optional findDataFieldProperty() { UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); DataScopeDTO ds = new DataScopeDTO(); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); - ds.setRegionCodes(Lists.newArrayList(userFullInfo.getRegionCode())); ds.setUserId(userFullInfo.getUserId()); ds.setRole(RoleEnum.NORMAL_MEMBER); - return Optional.ofNullable(ds); + return Optional.of(ds); } @Override public Optional findDataFieldProperty(Long userId) { UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); DataScopeDTO ds = new DataScopeDTO(); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); - ds.setRegionCodes(Lists.newArrayList(userFullInfo.getRegionCode())); ds.setUserId(userFullInfo.getUserId()); ds.setRole(RoleEnum.NORMAL_MEMBER); - return Optional.ofNullable(ds); + return Optional.of(ds); } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/OrgAdminDataScopeProviderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/OrgAdminDataScopeProviderImpl.java index f148a16..ea6ffab 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/OrgAdminDataScopeProviderImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/OrgAdminDataScopeProviderImpl.java @@ -9,6 +9,7 @@ import com.hz.pm.api.user.util.LoginUserUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; + import java.util.Optional; /** @@ -30,9 +31,8 @@ public class OrgAdminDataScopeProviderImpl implements DataScopeProvider { public Optional findDataFieldProperty() { UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); DataScopeDTO ds = new DataScopeDTO(); - ds.setOrgCode(userFullInfo.getEmpPosUnitCode()); + ds.setOrgCode(String.valueOf(userFullInfo.getMhUnitId())); ds.setUserId(userFullInfo.getUserId()); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); ds.setRole(RoleEnum.COMPANY_MANAGER); return Optional.of(ds); } @@ -41,9 +41,8 @@ public class OrgAdminDataScopeProviderImpl implements DataScopeProvider { public Optional findDataFieldProperty(Long userId) { UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); DataScopeDTO ds = new DataScopeDTO(); - ds.setOrgCode(userFullInfo.getEmpPosUnitCode()); + ds.setOrgCode(String.valueOf(userFullInfo.getMhUnitId())); ds.setUserId(userFullInfo.getUserId()); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); ds.setRole(RoleEnum.COMPANY_MANAGER); return Optional.of(ds); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/RegionAdminDataScopeProviderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/RegionAdminDataScopeProviderImpl.java index 4e68d35..e8a87b7 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/RegionAdminDataScopeProviderImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/RegionAdminDataScopeProviderImpl.java @@ -1,8 +1,5 @@ package com.hz.pm.api.datascope.provider.impl; -import cn.hutool.core.collection.CollUtil; -import com.google.common.collect.Lists; -import com.hz.pm.api.common.model.constant.RegionConst; import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.datascope.model.DataScopeDTO; @@ -14,8 +11,6 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; -import java.util.ArrayList; -import java.util.Collection; import java.util.Optional; /** @@ -37,19 +32,8 @@ public class RegionAdminDataScopeProviderImpl implements DataScopeProvider { @Override public Optional findDataFieldProperty() { UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - //借由 丽水市的code 来映射市本级的regionCode - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(userFullInfo.getRegionCode(), - RegionConst.RL_CITY); - //如果不是市本级的话 就直接放入本区域的县就好了 - if(CollUtil.isEmpty(regionCodes)){ - regionCodes = Lists.newArrayList(); - regionCodes.add(userFullInfo.getRegionCode()); - } - DataScopeDTO ds = new DataScopeDTO(); - ds.setRegionCodes(new ArrayList<>(regionCodes)); ds.setUserId(userFullInfo.getUserId()); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); ds.setRole(RoleEnum.REGION_MANAGER); return Optional.of(ds); } @@ -57,19 +41,8 @@ public class RegionAdminDataScopeProviderImpl implements DataScopeProvider { @Override public Optional findDataFieldProperty(Long userId) { UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - //借由 丽水市的code 来映射市本级的regionCode - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(userFullInfo.getRegionCode(), - RegionConst.RL_CITY); - //如果不是市本级的话 就直接放入本区域的县就好了 - if(CollUtil.isEmpty(regionCodes)){ - regionCodes = Lists.newArrayList(); - regionCodes.add(userFullInfo.getRegionCode()); - } - DataScopeDTO ds = new DataScopeDTO(); - ds.setRegionCodes(new ArrayList<>(regionCodes)); ds.setUserId(userFullInfo.getUserId()); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); ds.setRole(RoleEnum.REGION_MANAGER); return Optional.of(ds); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/SuperAdminDataScopeProviderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/SuperAdminDataScopeProviderImpl.java index 8205ed4..0b131c7 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/SuperAdminDataScopeProviderImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/SuperAdminDataScopeProviderImpl.java @@ -1,6 +1,5 @@ package com.hz.pm.api.datascope.provider.impl; -import com.hz.pm.api.common.model.constant.RegionConst; import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.datascope.model.DataScopeDTO; @@ -12,8 +11,6 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; -import java.util.ArrayList; -import java.util.Collection; import java.util.Optional; /** @@ -37,13 +34,8 @@ public class SuperAdminDataScopeProviderImpl implements DataScopeProvider { public Optional findDataFieldProperty() { UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); //所有 丽水市的code - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_HZ, - RegionConst.RL_CITY); - DataScopeDTO ds = new DataScopeDTO(); - ds.setRegionCodes(new ArrayList<>(regionCodes)); ds.setUserId(userFullInfo.getUserId()); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); ds.setRole(RoleEnum.SUPER_ADMIN); return Optional.of(ds); } @@ -51,14 +43,8 @@ public class SuperAdminDataScopeProviderImpl implements DataScopeProvider { @Override public Optional findDataFieldProperty(Long userId) { UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - //所有 丽水市的code - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_HZ, - RegionConst.RL_CITY); - DataScopeDTO ds = new DataScopeDTO(); - ds.setRegionCodes(new ArrayList<>(regionCodes)); ds.setUserId(userFullInfo.getUserId()); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); ds.setRole(RoleEnum.SUPER_ADMIN); return Optional.of(ds); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/VisitorDataScopeProviderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/VisitorDataScopeProviderImpl.java new file mode 100644 index 0000000..173136d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/VisitorDataScopeProviderImpl.java @@ -0,0 +1,38 @@ +package com.hz.pm.api.datascope.provider.impl; + +import com.hz.pm.api.datascope.model.DataScopeDTO; +import com.hz.pm.api.datascope.provider.DataScopeProvider; +import com.hz.pm.api.user.model.enumeration.RoleEnum; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.Optional; + +/** + *

+ * 数据权限 访客 + *

+ * + * @author ZPF + * @since 2023/3/27 23:29 + */ +@Slf4j +@RequiredArgsConstructor +@Component("VISITOR") +public class VisitorDataScopeProviderImpl implements DataScopeProvider { + + @Override + public Optional findDataFieldProperty() { + DataScopeDTO ds = new DataScopeDTO(); + ds.setRole(RoleEnum.SUPER_ADMIN); + return Optional.of(ds); + } + + @Override + public Optional findDataFieldProperty(Long userId) { + DataScopeDTO ds = new DataScopeDTO(); + ds.setRole(RoleEnum.SUPER_ADMIN); + return Optional.of(ds); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/VisitoyDataScopeProviderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/VisitoyDataScopeProviderImpl.java deleted file mode 100644 index 5ae6341..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/impl/VisitoyDataScopeProviderImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.hz.pm.api.datascope.provider.impl; - -import com.hz.pm.api.common.helper.UserInfoHelper; -import com.hz.pm.api.datascope.model.DataScopeDTO; -import com.hz.pm.api.datascope.provider.DataScopeProvider; -import com.hz.pm.api.user.model.enumeration.RoleEnum; -import com.hz.pm.api.user.security.model.UserFullInfoDTO; -import com.hz.pm.api.user.util.LoginUserUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; -import java.util.Optional; - -/** - *

- * 数据权限 访客 - *

- * - * @author ZPF - * @since 2023/3/27 23:29 - */ -@Slf4j -@RequiredArgsConstructor -@Component("VISITOR") -public class VisitoyDataScopeProviderImpl implements DataScopeProvider { - private final UserInfoHelper userInfoHelper; - - @Override - public Optional findDataFieldProperty() { - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - DataScopeDTO ds = new DataScopeDTO(); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); - ds.setRole(RoleEnum.SUPER_ADMIN); - return Optional.ofNullable(ds); - } - - @Override - public Optional findDataFieldProperty(Long userId) { - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - DataScopeDTO ds = new DataScopeDTO(); - ds.setEmployeeCode(userFullInfo.getEmployeeCode()); - ds.setRole(RoleEnum.SUPER_ADMIN); - return Optional.ofNullable(ds); - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/ding/task/EmployeeBatchGetTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/ding/task/EmployeeBatchGetTask.java index 2f6409f..e63d828 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/ding/task/EmployeeBatchGetTask.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/ding/task/EmployeeBatchGetTask.java @@ -5,17 +5,16 @@ import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.basic.model.GenericResult; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.ding.constants.DingOrganizationContant; import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; import com.hz.pm.api.organization.model.entity.DingOrganization; import com.hz.pm.api.organization.service.IDingEmployeeInfoService; import com.hz.pm.api.organization.service.IDingOrganizationService; -import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.service.IUserInfoService; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.GenericResult; import com.ningdatech.zwdd.ZwddIntegrationProperties; import com.ningdatech.zwdd.client.ZwddAuthClient; import com.ningdatech.zwdd.client.ZwddClient; @@ -25,9 +24,9 @@ import com.ningdatech.zwdd.model.dto.EmployeeInfoDTO; import com.ningdatech.zwdd.model.query.PageOrganizationEmployeePositionsQuery; import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition; import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition.GovEmployeePosition; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -40,49 +39,42 @@ import java.util.stream.Collectors; * @date 2023/2/10 上午9:52 */ -@Component @Slf4j +@Component +@RequiredArgsConstructor public class EmployeeBatchGetTask { - private final static Integer PAGE_SIZE = 20; + private static final int PAGE_SIZE = 20; + private static final int GROUP_SIZE = 100; + private static final long MAX_SIZE = 10000; - private final static Integer GROUP_SIZE = 100; + //================================================================================================================== - private final static Integer MAX_SIZE = 10000; + private final ZwddClient zwddClient; + private final ZwddAuthClient zwddAuthClient; + private final IDingOrganizationService dingOrganizationService; + private final IDingEmployeeInfoService dingEmployeeInfoService; + private final ZwddIntegrationProperties zwddIntegrationProperties; + private final IUserInfoService userInfoService; - @Autowired - private ZwddClient zwddClient; - - @Autowired - private ZwddAuthClient zwddAuthClient; - - @Autowired - private IDingOrganizationService iDingOrganizationService; - - @Autowired - private IDingEmployeeInfoService iDingEmployeeInfoService; - - @Autowired - private ZwddIntegrationProperties zwddIntegrationProperties; - - @Autowired - private IUserInfoService iUserInfoService; + //================================================================================================================== @Transactional(rollbackFor = Exception.class) // @Scheduled(cron = "0 0 1 * * ?") public void batchGetEmployeeTask() { - // 获取所有的组织列表用户获取组织下的 用户信息(暂时 只查 单位的类型) - List dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getTypeCode, DingOrganizationContant.UNIT_TYPE)); + // 获取所有的组织列表用户获取组织下的 用户信息(暂时只查单位的类型) + List dingOrganizationList = dingOrganizationService.list( + Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getTypeCode, DingOrganizationContant.UNIT_TYPE)); log.info("所有待更新员工的单位数:{}", dingOrganizationList.size()); if (CollUtil.isNotEmpty(dingOrganizationList)) { //记录任务 单位数 Integer index = 0; - for (DingOrganization dingOrganization : dingOrganizationList) { - log.info("当前单位:{},下标数,{}", dingOrganization.getOrganizationName(), index); + for (DingOrganization dingOrg : dingOrganizationList) { + log.info("当前单位:{},下标数,{}", dingOrg.getOrganizationName(), index); index++; List allOrganizationEmployeePositionList = new ArrayList<>(); - String organizationCode = dingOrganization.getOrganizationCode(); + String organizationCode = dingOrg.getOrganizationCode(); PageOrganizationEmployeePositionsQuery query = new PageOrganizationEmployeePositionsQuery(); query.setEmployeeStatus("A"); query.setOrganizationCode(organizationCode); @@ -104,13 +96,13 @@ public class EmployeeBatchGetTask { } Long totalSize = data.getTotalSize(); - log.info("dingOrganization :{}", JSON.toJSONString(dingOrganization)); + log.info("dingOrg :{}", JSON.toJSONString(dingOrg)); - log.info("totalSize :{},{}", totalSize, dingOrganization.getOrganizationName()); + log.info("totalSize :{},{}", totalSize, dingOrg.getOrganizationName()); if (totalSize > PAGE_SIZE) { if (totalSize > MAX_SIZE) { //超过1万 按1万的处理 - totalSize = MAX_SIZE.longValue(); + totalSize = MAX_SIZE; } int restPageNo = totalSize % PAGE_SIZE > 0 ? 1 : 0; @@ -118,7 +110,6 @@ public class EmployeeBatchGetTask { for (pageNo = 2; pageNo <= maxPageNo; pageNo++) { query.setPageNo(pageNo); GenericResult> pageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); -// log.info("pageGenericResult :{}", JSON.toJSONString(pageGenericResult)); if (pageGenericResult.isSuccess()) { allOrganizationEmployeePositionList.addAll(pageGenericResult.getData().getData()); } else { @@ -216,57 +207,21 @@ public class EmployeeBatchGetTask { } } - List organizations = iDingOrganizationService.list(); + List organizations = dingOrganizationService.list(); Map organizationMap = organizations.stream().collect(Collectors.toMap(DingOrganization::getOrganizationCode, o -> o)); for (DingEmployeeInfo dingEmployeeInfo : saveList) { String employeeCode = dingEmployeeInfo.getEmployeeCode(); - DingEmployeeInfo employeeInfo = iDingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) + DingEmployeeInfo employeeInfo = dingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) .eq(DingEmployeeInfo::getEmployeeCode, employeeCode) .last(BizConst.LIMIT_1)); if (Objects.isNull(employeeInfo)) { - iDingEmployeeInfoService.save(dingEmployeeInfo); + dingEmployeeInfoService.save(dingEmployeeInfo); } else { dingEmployeeInfo.setId(employeeInfo.getId()); - iDingEmployeeInfoService.saveOrUpdate(dingEmployeeInfo); + dingEmployeeInfoService.saveOrUpdate(dingEmployeeInfo); } - generateOrUpdateUserInfo(dingEmployeeInfo, organizationMap); - } - } - - public void generateOrUpdateUserInfo(DingEmployeeInfo dingEmployeeInfo, Map organizationMap) { - String employeeCode = dingEmployeeInfo.getEmployeeCode(); - UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) - .eq(UserInfo::getEmployeeCode, employeeCode)); - if (Objects.isNull(userInfo)) { - userInfo = new UserInfo(); - userInfo.setAccountId(dingEmployeeInfo.getAccountId()); - userInfo.setUsername(dingEmployeeInfo.getEmployeeName()); - userInfo.setRealName(dingEmployeeInfo.getEmployeeName()); - userInfo.setEmployeeCode(dingEmployeeInfo.getEmployeeCode()); - userInfo.setAvailable(UserAvailableEnum.DISABLE.name()); - userInfo.setCreateBy(-1L); - userInfo.setUpdateBy(-1L); - userInfo.setCreateOn(LocalDateTime.now()); - userInfo.setUpdateOn(LocalDateTime.now()); - userInfo.setEmpPosUnitCode(dingEmployeeInfo.getEmpPosUnitCode()); - userInfo.setAvatar(dingEmployeeInfo.getAvatar()); - if (StringUtils.isNotBlank(userInfo.getEmpPosUnitCode()) && organizationMap.containsKey(userInfo.getEmpPosUnitCode())) { - DingOrganization dingOrganization = organizationMap.get(userInfo.getEmpPosUnitCode()); - userInfo.setEmpPosUnitName(dingOrganization.getOrganizationName()); - userInfo.setRegionCode(dingOrganization.getDivisionCode()); - } - iUserInfoService.save(userInfo); - } else { - userInfo.setAvatar(dingEmployeeInfo.getAvatar()); - userInfo.setEmpPosUnitCode(dingEmployeeInfo.getEmpPosUnitCode()); - if (StringUtils.isNotBlank(userInfo.getEmpPosUnitCode()) && organizationMap.containsKey(userInfo.getEmpPosUnitCode())) { - DingOrganization dingOrganization = organizationMap.get(userInfo.getEmpPosUnitCode()); - userInfo.setEmpPosUnitName(dingOrganization.getOrganizationName()); - userInfo.setRegionCode(dingOrganization.getDivisionCode()); - } - iUserInfoService.updateById(userInfo); } } @@ -276,7 +231,7 @@ public class EmployeeBatchGetTask { * @param regionCode */ public void batchGetEmployeeTaskByRegionCode(String regionCode) { - List units = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + List units = dingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) .eq(DingOrganization::getTypeCode, DingOrganizationContant.UNIT_TYPE) .eq(DingOrganization::getDivisionCode, regionCode)); @@ -317,7 +272,7 @@ public class EmployeeBatchGetTask { if (totalSize > PAGE_SIZE) { if (totalSize > MAX_SIZE) { //超过1万 按1万的处理 - totalSize = MAX_SIZE.longValue(); + totalSize = MAX_SIZE; } int restPageNo = totalSize % PAGE_SIZE > 0 ? 1 : 0; @@ -325,7 +280,6 @@ public class EmployeeBatchGetTask { for (pageNo = 2; pageNo <= maxPageNo; pageNo++) { query.setPageNo(pageNo); GenericResult> pageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); -// log.info("pageGenericResult :{}", JSON.toJSONString(pageGenericResult)); if (pageGenericResult.isSuccess()) { allOrganizationEmployeePositionList.addAll(pageGenericResult.getData().getData()); } else { @@ -354,17 +308,16 @@ public class EmployeeBatchGetTask { } public void batchGetEmployeeTaskByOrdCode(String orgCode) { - DingOrganization org = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) + DingOrganization org = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) .eq(DingOrganization::getOrganizationCode, orgCode) .last(BizConst.LIMIT_1)); VUtils.isTrue(Objects.isNull(org)).throwMessage("单位不存在"); log.info("所属单位 {} 要更新员工信息了", org.getOrganizationName()); List allOrganizationEmployeePositionList = new ArrayList<>(); - String organizationCode = orgCode; PageOrganizationEmployeePositionsQuery query = new PageOrganizationEmployeePositionsQuery(); query.setEmployeeStatus("A"); - query.setOrganizationCode(organizationCode); + query.setOrganizationCode(orgCode); query.setReturnTotalSize(true); query.setTenantId(zwddIntegrationProperties.getTenantId()); int pageNo = 1; @@ -375,7 +328,7 @@ public class EmployeeBatchGetTask { GenericResult> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); Page data = firstPageGenericResult.getData(); if (Objects.isNull(data)) { - log.info("响应为空:{}", organizationCode); + log.info("响应为空:{}", orgCode); return; } if (CollUtil.isNotEmpty(data.getData())) { @@ -389,7 +342,7 @@ public class EmployeeBatchGetTask { if (totalSize > PAGE_SIZE) { if (totalSize > MAX_SIZE) { //超过1万 按1万的处理 - totalSize = MAX_SIZE.longValue(); + totalSize = MAX_SIZE; } int restPageNo = totalSize % PAGE_SIZE > 0 ? 1 : 0; @@ -444,22 +397,22 @@ public class EmployeeBatchGetTask { return; } - DingEmployeeInfo emp = iDingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) + DingEmployeeInfo emp = dingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) .eq(DingEmployeeInfo::getEmployeeCode, empCode) .last(BizConst.LIMIT_1)); if (Objects.nonNull(emp)) { emp.setAvatar(data.getGovEmpAvatar()); - iDingEmployeeInfoService.updateById(emp); + dingEmployeeInfoService.updateById(emp); } - UserInfo user = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) + UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) .eq(UserInfo::getEmployeeCode, empCode) .last(BizConst.LIMIT_1)); if (Objects.nonNull(user)) { user.setAvatar(data.getGovEmpAvatar()); - iUserInfoService.updateById(user); + userInfoService.updateById(user); } } @@ -470,7 +423,7 @@ public class EmployeeBatchGetTask { */ public void getBatchEmployeeByCode(String orgCode) { - List employees = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) + List employees = dingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) .eq(DingEmployeeInfo::getEmpPosUnitCode, orgCode)); for (DingEmployeeInfo employee : employees) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/SensitiveModifySegment.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/SensitiveModifySegment.java index 7748dcf..6727739 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/SensitiveModifySegment.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/model/SensitiveModifySegment.java @@ -78,7 +78,7 @@ public class SensitiveModifySegment { return false; } for (SensitiveModifySegment segment : segmentList) { - if (!segment.isValueEquals()) { + if (Boolean.FALSE.equals(segment.isValueEquals())) { return true; } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/sms/SmsServiceClient.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/sms/SmsServiceClient.java index cbb8a04..d8135d5 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/external/sms/SmsServiceClient.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/sms/SmsServiceClient.java @@ -56,7 +56,7 @@ public class SmsServiceClient { * @return */ public SmsDto smsSend(String content, List phones) { - String phonesSplit = String.join(",", phones);; + String phonesSplit = String.join(",", phones); String refreshUrl = smsUrl + SMS_SEND; Map map = new HashMap<>(); map.put("content",content); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/todo/TodoServiceClient.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/todo/TodoServiceClient.java index 416e5fd..ddb2ff9 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/external/todo/TodoServiceClient.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/todo/TodoServiceClient.java @@ -54,11 +54,8 @@ public class TodoServiceClient { map.put("wkType",addSingleWkHandleDTO.getWkType()); map.put("wkUser",addSingleWkHandleDTO.getWkUser()); String responseResult = HttpUtil.post(url, JSON.toJSONString(map)); - TodoDto todoDto = JSON.parseObject(responseResult, new TypeReference() { + return JSON.parseObject(responseResult, new TypeReference() { }); -// return JSON.parseObject(responseResult, new TypeReference>() { -// }).get("data"); - return todoDto; } /** @@ -74,9 +71,8 @@ public class TodoServiceClient { .form("wkhandleId",wkhandleId); HttpResponse response = request.execute(); String responseBody = response.body(); - TodoDto todoDto = JSON.parseObject(responseBody, new TypeReference() { + return JSON.parseObject(responseBody, new TypeReference() { }); - return todoDto; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/todo/dto/AddSingleWkHandleDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/todo/dto/AddSingleWkHandleDTO.java index 5ed6fb2..ebc4dca 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/external/todo/dto/AddSingleWkHandleDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/todo/dto/AddSingleWkHandleDTO.java @@ -13,9 +13,7 @@ import java.io.Serializable; @Data @AllArgsConstructor @NoArgsConstructor -public class AddSingleWkHandleDTO implements Serializable { - - private static final long serialVersionUID = -2067546352159912820L; +public class AddSingleWkHandleDTO { // 待办参数,ObjectJson字符串 private Object params; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java index 8ee17e6..a2e0980 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java @@ -5,9 +5,13 @@ import cn.hutool.core.collection.CollUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +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.hz.pm.api.common.util.StrUtils; +import com.hz.pm.api.user.helper.MhUnitCache; +import com.hz.pm.api.user.model.dto.MhUnitDTO; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; @@ -106,7 +110,6 @@ public class ProjectFileManage { private final IProjectInstService projectInstService; private final HistoryService historyService; private final INdProjectApplyBorrowService projectApplyBorrowService; - private final IDingOrganizationService dingOrganizationService; private final IProjectApplicationService projectApplicationService; private final TaskService taskService; private final IPurchaseService purchaseService; @@ -116,69 +119,70 @@ public class ProjectFileManage { private final PurchaseManage purchaseManage; private final ConstructionManage constructionManage; private final FinalAcceptanceManage finalAcceptanceManage; + private final MhUnitCache mhUnitCache; - public PageVo list(ProjectFileListParam param) { - - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = userFullInfo.getEmployeeCode(); - String empPosUnitCode = userFullInfo.getEmpPosUnitCode(); + public PageVo list(ProjectFileListParam req) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - Page page = param.page(); - projectService.page(page, Wrappers.lambdaQuery(Project.class) - .like(StringUtils.isNotBlank(param.getProjectName()), Project::getProjectName, param.getProjectName()) - .like(StringUtils.isNotBlank(param.getBuildOrgName()), Project::getBuildOrgName, param.getBuildOrgName()) + LambdaQueryWrapper query = Wrappers.lambdaQuery(Project.class) + .like(StrUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()) + .like(StrUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) .eq(Project::getStatus, ProjectStatusEnum.ACCEPTED.getCode()) - .orderByDesc(Project::getUpdateOn)); - + .orderByDesc(Project::getUpdateOn); + Page page = projectService.page(req.page(), query); if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } - // 获取本单位及下属单位的单位code - Set subOrgSet = getSubOrgList(empPosUnitCode); + List subOrgSet = getSubOrgList(user.getMhUnitId()); List vos = page.getRecords().stream().map(p -> { ProjectFileListVO vo = new ProjectFileListVO(); vo.setId(p.getId()); // 用户只可查阅自己及下属单位的项目档案和已经申请借阅通过的项目档案 - if (subOrgSet.contains(p.getBuildOrgCode()) || checkCanRead(subOrgSet, p)) { + if (StrUtils.isBlank(p.getBuildOrgCode()) + || subOrgSet.contains(Long.parseLong(p.getBuildOrgCode())) + || checkCanRead(subOrgSet, p)) { vo.setCanRead(Boolean.TRUE); } vo.setBuildOrgName(p.getBuildOrgName()); vo.setPojectCode(p.getProjectCode()); vo.setProjectName(p.getProjectName()); // 判断当前项目,当前登录用户是否已经开启了申请借阅并且没有审批完成 - ProjectApplyBorrow projectApplyBorrow = projectApplyBorrowService.getOne(Wrappers.lambdaQuery(ProjectApplyBorrow.class) - .eq(ProjectApplyBorrow::getApplyBorrowEmployeeCode, employeeCode) + ProjectApplyBorrow projectApplyBorrow = projectApplyBorrowService.getOne(Wrappers + .lambdaQuery(ProjectApplyBorrow.class) + .eq(ProjectApplyBorrow::getApplyBorrowUserId, user.getUserId()) .eq(ProjectApplyBorrow::getProjectId, p.getId()) .orderByDesc(ProjectApplyBorrow::getCreateOn) .last("limit 1")); if (Objects.nonNull(projectApplyBorrow)) { String instCode = projectApplyBorrow.getInstanceId(); // 获取流程实例 - HistoricProcessInstance newInstance = - historyService.createHistoricProcessInstanceQuery().processInstanceId(instCode).singleResult(); + HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() + .processInstanceId(instCode) + .singleResult(); if (newInstance == null) { vo.setCanApplyBorrow(Boolean.FALSE); return vo; } - ProjectInst projectInst = projectInstService - .getOne(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getInstCode, instCode)); + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getInstCode, instCode)); // 推送省局联审的项目流程实例为EMPTY if (Objects.nonNull(projectInst)) { Integer instType = projectInst.getInstType(); // 从申请借阅信息表中查询当前项目是否有当前登录用户发起的申请借阅审批流程 ProjectApplyBorrow applyBorrow = projectApplyBorrowService.getOne(Wrappers - .lambdaQuery(ProjectApplyBorrow.class).eq(ProjectApplyBorrow::getApplyBorrowEmployeeCode, employeeCode) - .eq(ProjectApplyBorrow::getProjectId, p.getId()).eq(ProjectApplyBorrow::getInstanceId, instCode)); + .lambdaQuery(ProjectApplyBorrow.class) + .eq(ProjectApplyBorrow::getApplyBorrowUserId, user.getUserId()) + .eq(ProjectApplyBorrow::getProjectId, p.getId()) + .eq(ProjectApplyBorrow::getInstanceId, instCode)); // 延期申请流程还未审核结束 if (Objects.nonNull(applyBorrow) && InstTypeEnum.APPLY_BORROW.getCode().equals(instType) && Objects.isNull(newInstance.getEndActivityId())) { vo.setCanApplyBorrow(Boolean.FALSE); - } - // 如果是延期申请审核被驳回,设置项目可以申请延期申报 - else if (InstTypeEnum.APPLY_BORROW.getCode().equals(instType) && + } else if (InstTypeEnum.APPLY_BORROW.getCode().equals(instType) && HisProInsEndActId.REJECT.equals(newInstance.getEndActivityId())) { + // 如果是延期申请审核被驳回,设置项目可以申请延期申报 vo.setCanApplyBorrow(Boolean.TRUE); } } @@ -189,39 +193,30 @@ public class ProjectFileManage { return PageVo.of(vos, page.getTotal()); } - private boolean checkCanRead(Set subOrgSet, Project project) { + private boolean checkCanRead(List subOrgSet, Project project) { // 从申请借阅信息表中查出本单位及下属单位审批通过的项目 HashSet borrowProjectIdSet = new HashSet<>(); List applyBorrowProjectIdList = projectApplyBorrowService .list(Wrappers.lambdaQuery(ProjectApplyBorrow.class) - .in(ProjectApplyBorrow::getApplyBorrowEmpPosUnitCode, subOrgSet) + .in(ProjectApplyBorrow::getApplyBorrowOrgCode, subOrgSet) .eq(ProjectApplyBorrow::getIsSuccess, Boolean.TRUE)) - .stream().map(ProjectApplyBorrow::getProjectId).filter(borrowProjectIdSet::add).collect(Collectors.toList()); + .stream().map(ProjectApplyBorrow::getProjectId) + .filter(borrowProjectIdSet::add) + .collect(Collectors.toList()); return applyBorrowProjectIdList.contains(project.getId()); } - private Set getSubOrgList(String empPosUnitCode) { - HashSet orgSet = new HashSet<>(); - // 先将自己加入子集 - orgSet.add(empPosUnitCode); - Set subOrgList = dingOrganizationService - .list(Wrappers.lambdaQuery(DingOrganization.class).eq(DingOrganization::getParentCode, empPosUnitCode)) - .stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toSet()); - // 遍历子集 - for (String orgCode : subOrgList) { - orgSet.addAll(getSubOrgList(orgCode)); - } - return orgSet; + private List getSubOrgList(Long mhUnitId) { + List childIds = mhUnitCache.getChildrenIdsRecursion(mhUnitId); + childIds.add(mhUnitId); + return childIds; } public ProjectFileVO file(Long projectId) { - - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String empPosUnitCode = userFullInfo.getEmpPosUnitCode(); - + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); // 判断该项目是否为本单位或下属单位的项目或者已经申请借阅成功的项目 Project project = projectService.getById(projectId); - Set subOrgList = getSubOrgList(empPosUnitCode); + List subOrgList = getSubOrgList(user.getMhUnitId()); if (!checkCanRead(subOrgList, project)) { throw new BizException("您没有权限查看此项目档案!"); @@ -253,28 +248,22 @@ public class ProjectFileManage { public String startApplyBorrowProcess(Long projectId) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); - Project project = projectService.getNewProject(projectId); VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); // 首先要判断 项目当前状态 是不是 已归档 VUtils.isTrue(!ProjectStatusEnum.ACCEPTED.getCode().equals(project.getStatus())).throwMessage("提交失败 该项目不是 已归档"); - String regionCode = user.getRegionCode(); - WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) - .eq(WflowModels::getRegionCode, regionCode) - .eq(WflowModels::getProcessType, ProjectProcessStageEnum.APPLY_BORROW.getCode()).last(BizConst.LIMIT_1)); + .eq(WflowModels::getProcessType, ProjectProcessStageEnum.APPLY_BORROW.getCode()) + .last(BizConst.LIMIT_1)); if (Objects.isNull(model)) { - log.error("此 【{}】区域找不到申请借阅流程配置", regionCode); - throw new BusinessException(String.format("此 【%s】区域找不到申请借阅流程配置", regionCode)); + throw new BusinessException("找不到申请借阅流程配置"); } ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode)); + params.setUser(defaultDeclaredProjectManage.buildUser(user.getUserId())); params.setProcessUsers(Collections.emptyMap()); // 放入条件判断的项目字段 // 把条件值给放入工作流 @@ -544,19 +533,15 @@ public class ProjectFileManage { } ProjectApplyBorrowVO vo = BeanUtil.copyProperties(apply, ProjectApplyBorrowVO.class); - if (StringUtils.isNotBlank(vo.getApplyBorrowEmployeeCode())) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(vo.getApplyBorrowEmployeeCode()); + if (StrUtils.isNotBlank(vo.getApplyBorrowUserId())) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(Long.valueOf(vo.getApplyBorrowUserId())); if (Objects.nonNull(user)) { - vo.setApplyBorrowEmployeeName(user.getUsername()); + vo.setApplyBorrowUserName(user.getUsername()); } } - if (StringUtils.isNotBlank(vo.getApplyBorrowEmpPosUnitCode())) { - DingOrganization organization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getOrganizationCode, vo.getApplyBorrowEmpPosUnitCode()) - .last(BizConst.LIMIT_1)); - if (Objects.nonNull(organization)) { - vo.setApplyBorrowEmpPosUnitName(organization.getOrganizationName()); - } + if (StrUtils.isNotBlank(vo.getApplyBorrowOrgCode())) { + MhUnitDTO mhUnit = mhUnitCache.getById(Long.parseLong(vo.getApplyBorrowOrgCode())); + vo.setApplyBorrowOrgName(mhUnit.getName()); } if (Objects.nonNull(vo.getProjectId())) { Project project = projectService.getById(vo.getProjectId()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/entity/ProjectApplyBorrow.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/entity/ProjectApplyBorrow.java index 592112b..a531103 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/entity/ProjectApplyBorrow.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/entity/ProjectApplyBorrow.java @@ -32,10 +32,10 @@ public class ProjectApplyBorrow implements Serializable { private Long projectId; @ApiModelProperty("申请借阅员工code") - private String applyBorrowEmployeeCode; + private String applyBorrowUserId; @ApiModelProperty("申请借阅用户任职单位code") - private String applyBorrowEmpPosUnitCode; + private String applyBorrowOrgCode; @ApiModelProperty("申请借阅审批流程ID") private String instanceId; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/ProjectApplyBorrowVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/ProjectApplyBorrowVO.java index f11ac43..a12d80e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/ProjectApplyBorrowVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/model/vo/ProjectApplyBorrowVO.java @@ -31,16 +31,16 @@ public class ProjectApplyBorrowVO implements Serializable { private String projectName; @ApiModelProperty("申请借阅员工code") - private String applyBorrowEmployeeCode; + private String applyBorrowUserId; @ApiModelProperty("申请借阅员工名字") - private String applyBorrowEmployeeName; + private String applyBorrowUserName; @ApiModelProperty("申请借阅用户任职单位code") - private String applyBorrowEmpPosUnitCode; + private String applyBorrowOrgCode; @ApiModelProperty("申请借阅用户任职单位") - private String applyBorrowEmpPosUnitName; + private String applyBorrowOrgName; @ApiModelProperty("申请借阅审批流程ID") private String instanceId; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/controller/CompanyFiscalCodeController.java b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/controller/CompanyFiscalCodeController.java index dab39b4..1d54af5 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/controller/CompanyFiscalCodeController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/controller/CompanyFiscalCodeController.java @@ -3,9 +3,9 @@ package com.hz.pm.api.fiscal.controller; import com.ningdatech.log.annotation.WebLog; import com.hz.pm.api.fiscal.manage.CompanyFiscalCodeManage; -import com.hz.pm.api.fiscal.model.po.ReqCompanyFiscalCodeAndSealSnPO; +import com.hz.pm.api.fiscal.model.po.CompanyFiscalCodeAndSealSnReq; import com.hz.pm.api.fiscal.model.po.ReqGetCompanyFiscalCodeAndSealSnPO; -import com.hz.pm.api.fiscal.model.vo.ResCompanyFiscalCodeAndSealSnVO; +import com.hz.pm.api.fiscal.model.vo.CompanyFiscalCodeAndSealSnVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -35,13 +35,13 @@ public class CompanyFiscalCodeController { @ApiOperation(value = "财政编码-配置", notes = "财政编码配置") @PostMapping("/fiscal-and-seal/configure") @WebLog("财政编码-配置") - public void fiscalAndSealCodeConfigure(@Valid @RequestBody ReqCompanyFiscalCodeAndSealSnPO reqCompanyFiscalCodeAndSealSnPO) { - companyFiscalCodeManage.fiscalCodeConfigure(reqCompanyFiscalCodeAndSealSnPO); + public void fiscalAndSealCodeConfigure(@Valid @RequestBody CompanyFiscalCodeAndSealSnReq companyFiscalCodeAndSealSnReq) { + companyFiscalCodeManage.fiscalCodeConfigure(companyFiscalCodeAndSealSnReq); } @ApiOperation(value = "获取财政编码-配置", notes = "获取财政编码配置") @PostMapping("/fiscal-and-seal/get-configure") - public ResCompanyFiscalCodeAndSealSnVO getFiscalAndSealCodeConfigure(@Valid @RequestBody ReqGetCompanyFiscalCodeAndSealSnPO request) { + public CompanyFiscalCodeAndSealSnVO getFiscalAndSealCodeConfigure(@Valid @RequestBody ReqGetCompanyFiscalCodeAndSealSnPO request) { return companyFiscalCodeManage.getFiscalCodeConfigure(request); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/manage/CompanyFiscalCodeManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/manage/CompanyFiscalCodeManage.java index 935d18c..c6eb529 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/manage/CompanyFiscalCodeManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/manage/CompanyFiscalCodeManage.java @@ -1,16 +1,17 @@ package com.hz.pm.api.fiscal.manage; import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.util.StrUtils; import com.hz.pm.api.fiscal.entity.CompanyFiscalCode; -import com.hz.pm.api.fiscal.model.po.ReqCompanyFiscalCodeAndSealSnPO; +import com.hz.pm.api.fiscal.model.po.CompanyFiscalCodeAndSealSnReq; import com.hz.pm.api.fiscal.model.po.ReqGetCompanyFiscalCodeAndSealSnPO; -import com.hz.pm.api.fiscal.model.vo.ResCompanyFiscalCodeAndSealSnVO; +import com.hz.pm.api.fiscal.model.vo.CompanyFiscalCodeAndSealSnVO; import com.hz.pm.api.fiscal.service.ICompanyFiscalCodeService; import com.hz.pm.api.signature.entity.CompanySignature; import com.hz.pm.api.signature.service.ICompanySignatureService; +import com.hz.pm.api.user.security.model.UserInfoDetails; import com.hz.pm.api.user.util.LoginUserUtil; import lombok.RequiredArgsConstructor; -import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; import java.time.LocalDateTime; @@ -30,58 +31,59 @@ public class CompanyFiscalCodeManage { private final ICompanySignatureService iCompanySignatureService; - public void fiscalCodeConfigure(ReqCompanyFiscalCodeAndSealSnPO reqCompanyFiscalCodeAndSealSnPO) { - Long userId = LoginUserUtil.getUserId(); - - String organizationCode = reqCompanyFiscalCodeAndSealSnPO.getOrganizationCode(); - if (StringUtils.isBlank(organizationCode)) { - organizationCode = userInfoHelper.getUserEmpPosUnitCode(userId); + public void fiscalCodeConfigure(CompanyFiscalCodeAndSealSnReq req) { + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + String temOrgCode; + if (StrUtils.isBlank(req.getOrganizationCode())) { + temOrgCode = String.valueOf(userDetail.getMhUnitId()); + } else { + temOrgCode = req.getOrganizationCode(); } // TODO 校验用户权限 - // 保存财政编码配置 - CompanyFiscalCode companyFiscalCode = iCompanyFiscalCodeService.getByOrganizationCode(organizationCode); + CompanyFiscalCode companyFiscalCode = iCompanyFiscalCodeService.getByOrganizationCode(temOrgCode); if (Objects.isNull(companyFiscalCode)) { companyFiscalCode = new CompanyFiscalCode(); - companyFiscalCode.setOrganizationCode(organizationCode); + companyFiscalCode.setOrganizationCode(temOrgCode); companyFiscalCode.setCreateOn(LocalDateTime.now()); - companyFiscalCode.setCreateBy(userId); + companyFiscalCode.setCreateBy(userDetail.getUserId()); } - String fiscalCode = reqCompanyFiscalCodeAndSealSnPO.getFiscalCode(); + String fiscalCode = req.getFiscalCode(); companyFiscalCode.setFiscalCode(fiscalCode); companyFiscalCode.setUpdateOn(LocalDateTime.now()); - companyFiscalCode.setUpdateBy(userId); + companyFiscalCode.setUpdateBy(userDetail.getUserId()); iCompanyFiscalCodeService.saveOrUpdate(companyFiscalCode); // 保存印章配置 - CompanySignature companySignature = iCompanySignatureService.getByOrganizationCode(organizationCode); - if (Objects.isNull(companySignature)) { - companySignature = new CompanySignature(); - companySignature.setOrganizationCode(organizationCode); - companySignature.setCreateOn(LocalDateTime.now()); + CompanySignature signature = iCompanySignatureService.getByOrganizationCode(temOrgCode); + if (Objects.isNull(signature)) { + signature = new CompanySignature(); + signature.setOrganizationCode(temOrgCode); + signature.setCreateOn(LocalDateTime.now()); } - String sealSn = reqCompanyFiscalCodeAndSealSnPO.getSealSn(); - companySignature.setSealSn(sealSn); - companySignature.setUpdateOn(LocalDateTime.now()); - companySignature.setCreateBy(userId); - companySignature.setUpdateBy(userId); - iCompanySignatureService.saveOrUpdate(companySignature); + String sealSn = req.getSealSn(); + signature.setSealSn(sealSn); + signature.setUpdateOn(LocalDateTime.now()); + signature.setCreateBy(userDetail.getUserId()); + signature.setUpdateBy(userDetail.getUserId()); + iCompanySignatureService.saveOrUpdate(signature); } - public ResCompanyFiscalCodeAndSealSnVO getFiscalCodeConfigure(ReqGetCompanyFiscalCodeAndSealSnPO request) { - Long userId = LoginUserUtil.getUserId(); - String organizationCode = request.getOrganizationCode(); - if (StringUtils.isBlank(organizationCode)) { - organizationCode = userInfoHelper.getUserEmpPosUnitCode(userId); + public CompanyFiscalCodeAndSealSnVO getFiscalCodeConfigure(ReqGetCompanyFiscalCodeAndSealSnPO request) { + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + String temOrgCode; + if (StrUtils.isBlank(request.getOrganizationCode())) { + temOrgCode = String.valueOf(userDetail.getMhUnitId()); + } else { + temOrgCode = request.getOrganizationCode(); } - CompanySignature companySignature = iCompanySignatureService.getByOrganizationCode(organizationCode); - CompanyFiscalCode companyFiscalCode = iCompanyFiscalCodeService.getByOrganizationCode(organizationCode); - - ResCompanyFiscalCodeAndSealSnVO returnVO = new ResCompanyFiscalCodeAndSealSnVO(); + CompanySignature companySignature = iCompanySignatureService.getByOrganizationCode(temOrgCode); if (Objects.isNull(companySignature)) { return null; } + CompanyFiscalCode companyFiscalCode = iCompanyFiscalCodeService.getByOrganizationCode(temOrgCode); + CompanyFiscalCodeAndSealSnVO returnVO = new CompanyFiscalCodeAndSealSnVO(); returnVO.setCreateTime(companySignature.getCreateOn()); returnVO.setUpdateTime(companySignature.getUpdateOn()); returnVO.setFiscalCode(companyFiscalCode.getFiscalCode()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/po/CompanyFiscalCodeAndSealSnReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/po/CompanyFiscalCodeAndSealSnReq.java new file mode 100644 index 0000000..009e47b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/po/CompanyFiscalCodeAndSealSnReq.java @@ -0,0 +1,27 @@ +package com.hz.pm.api.fiscal.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @author liuxinxin + * @date 2023/2/10 下午4:24 + */ +@Data +@ApiModel("财政编码配置") +public class CompanyFiscalCodeAndSealSnReq { + + @ApiModelProperty("组织编码(需传入用户任职单位code)") + private String organizationCode; + + @ApiModelProperty("财政编码") + private String fiscalCode; + + @NotBlank(message = "印章编号 不能为空") + @ApiModelProperty("印章编号") + private String sealSn; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/po/ReqCompanyFiscalCodeAndSealSnPO.java b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/po/ReqCompanyFiscalCodeAndSealSnPO.java deleted file mode 100644 index 04fe139..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/po/ReqCompanyFiscalCodeAndSealSnPO.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.hz.pm.api.fiscal.model.po; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; - -/** - * @author liuxinxin - * @date 2023/2/10 下午4:24 - */ -@Data -@ApiModel("财政编码配置") -public class ReqCompanyFiscalCodeAndSealSnPO { - -// @NotBlank(message = "组织编码 不能为空") - @ApiModelProperty("组织编码(需传入用户任职单位code)") - private String organizationCode; - - @ApiModelProperty("财政编码") - private String fiscalCode; - - @NotBlank(message = "印章编号 不能为空") - @ApiModelProperty("印章编号") - private String sealSn; - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/vo/CompanyFiscalCodeAndSealSnVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/vo/CompanyFiscalCodeAndSealSnVO.java new file mode 100644 index 0000000..facc051 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/vo/CompanyFiscalCodeAndSealSnVO.java @@ -0,0 +1,33 @@ +package com.hz.pm.api.fiscal.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author liuxinxin + * @date 2023/3/23 上午10:58 + */ + +@Data +@ApiModel("财政编码配置VO") +public class CompanyFiscalCodeAndSealSnVO { + + @ApiModelProperty("组织编码") + private String organizationCode; + + @ApiModelProperty("财政编码") + private String fiscalCode; + + @ApiModelProperty("印章编号") + private String sealSn; + + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + @ApiModelProperty("更新时间") + private LocalDateTime updateTime; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/vo/ResCompanyFiscalCodeAndSealSnVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/vo/ResCompanyFiscalCodeAndSealSnVO.java deleted file mode 100644 index b07d00d..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/model/vo/ResCompanyFiscalCodeAndSealSnVO.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.hz.pm.api.fiscal.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.time.LocalDateTime; - -/** - * @author liuxinxin - * @date 2023/3/23 上午10:58 - */ - -@Data -@ApiModel("财政编码配置VO") -public class ResCompanyFiscalCodeAndSealSnVO { - - @ApiModelProperty("组织编码") - private String organizationCode; - - @ApiModelProperty("财政编码") - private String fiscalCode; - - @ApiModelProperty("印章编号") - private String sealSn; - - @ApiModelProperty("创建时间") - private LocalDateTime createTime; - - @ApiModelProperty("更新时间") - private LocalDateTime updateTime; - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java index d5726df..05c429a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java @@ -3,15 +3,16 @@ package com.hz.pm.api.gov.manage; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; 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.google.common.collect.Maps; +import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.model.constant.RegionConst; -import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.gov.contants.BizProjectContant; import com.hz.pm.api.gov.convert.ProjectConvert; import com.hz.pm.api.gov.model.dto.*; @@ -29,9 +30,9 @@ import com.hz.pm.api.projectdeclared.service.IOperationService; import com.hz.pm.api.projectdeclared.service.IPreInsAcceptancePersonService; import com.hz.pm.api.projectdeclared.service.IPurchaseService; import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil; +import com.hz.pm.api.projectlib.model.entity.*; import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeEnum; import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; -import com.hz.pm.api.projectlib.model.entity.*; import com.hz.pm.api.projectlib.model.req.ProjectListReq; import com.hz.pm.api.projectlib.service.*; import com.hz.pm.api.safety.model.entity.PersonSafetyInfo; @@ -79,7 +80,7 @@ import java.util.stream.Collectors; /** * @author zpf - * @date 2023/8/21 下午2:27 + * @since 2023/8/21 下午2:27 */ @Component @@ -173,8 +174,8 @@ public class GovProjectCollectionManage { /** * 分页查 项目归集 * - * @param req - * @return + * @param req \ + * @return \ */ public PageVo list(ProjectListReq req) { Page page = req.page(); @@ -195,7 +196,6 @@ public class GovProjectCollectionManage { ProjectTypeNewEnum.XU_OPERA.getCode())) .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) .orderByDesc(GovBizProjectBaseinfo::getBizTime); -// permissions(wrapper); baseinfoService.page(page, wrapper); if (CollUtil.isEmpty(page.getRecords())) { @@ -381,22 +381,6 @@ public class GovProjectCollectionManage { return PageVo.of(res, page.getTotal()); } - /** - * 数据权限 - * - * @param wrapper - */ - private void permissions(LambdaQueryWrapper wrapper) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - //超管和区域管理员 - if (user.getSuperAdmin() || user.getRegionAdmin()) { - log.info("超管和区管 可以看所有"); - return; - } - - wrapper.eq(GovBizProjectBaseinfo::getBaseBuildDeprtDing, user.getEmpPosUnitCode()); - } - public Long count(ProjectListReq req) { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) .like(StringUtils.isNotBlank(req.getProjectName()), GovBizProjectBaseinfo::getBaseProjName, req.getProjectName()) @@ -692,14 +676,12 @@ public class GovProjectCollectionManage { GovBizProjectBaseinfoDTO base = saveDTO.getBaseinfo(); String baseProjId = saveDTO.getBaseProjId(); - String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST; String baseProjName = base.getBaseProjName(); //1.保存基本信息 GovBizProjectBaseinfoDTO baseinfo = saveDTO.getBaseinfo(); baseinfo.setBaseProjId(baseProjId); baseinfo.setBaseProjName(baseProjName); - baseinfo.setBaseAreaCode(baseAreaCode); baseinfo.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); GovBizProjectBaseinfo oldBaseInfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) .eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId) @@ -715,8 +697,6 @@ public class GovProjectCollectionManage { saveBase.setBaseAreaCode(null); } else { saveBase.setTongTime(LocalDateTime.now()); - saveBase.setBaseAreaCode(baseAreaCode); - saveBase.setBaseAreaName(regionCacheHelper.getRegionName(user.getRegionCode(), RegionConst.RL_COUNTY)); } saveBase.setAreaCode(RegionConst.RC_HZ); saveBase.setBizTime(LocalDateTime.now()); @@ -854,21 +834,18 @@ public class GovProjectCollectionManage { procureService.remove(Wrappers.lambdaQuery(GovBizProjectProcure.class) .eq(GovBizProjectProcure::getBaseProjId, baseProjId)); - String finalBaseProjId = baseProjId; - UserInfoDetails finalUser = user; - Integer index = 1; for (GovBizProjectProcureDTO procure : procures) { - procure.setBaseProjId(finalBaseProjId); + procure.setBaseProjId(baseProjId); procure.setBaseProjName(baseProjName); - procure.setBaseBidCode(finalBaseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS, index)); + procure.setBaseBidCode(baseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS, index)); GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure, GovBizProjectProcure.class); - saveProcure.setBaseProjId(finalBaseProjId); + saveProcure.setBaseProjId(baseProjId); saveProcure.setId(null); saveProcure.setAreaCode(RegionConst.RC_HZ); saveProcure.setTongTime(LocalDateTime.now()); saveProcure.setBizTime(LocalDateTime.now()); - saveProcure.setUpdateBy(finalUser.getUsername()); + saveProcure.setUpdateBy(user.getUsername()); saveProcure.setUpdateOn(LocalDateTime.now()); if (procureService.save(saveProcure)) { threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssProcure(procure, null, saveProcure)); @@ -878,9 +855,6 @@ public class GovProjectCollectionManage { } - //7. 推送数据(改为定时推送了) -// pushProject(saveDTO); - //如果是草稿箱来的 就要删除 if (Objects.nonNull(saveDTO.getDraftId())) { draftService.removeById(saveDTO.getDraftId()); } @@ -895,6 +869,7 @@ public class GovProjectCollectionManage { * @param user * @return */ + @Transactional(rollbackFor = Exception.class) public String operationSave(GovOperationProjectSaveDTO saveDTO, UserInfoDetails user) { if (Objects.isNull(user)) { user = LoginUserUtil.loginUserDetail(); @@ -902,14 +877,12 @@ public class GovProjectCollectionManage { GovOperationProjectBaseinfoDTO base = saveDTO.getBaseinfo(); String baseProjId = saveDTO.getBaseProjId(); - String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST; String baseProjName = base.getBaseProjName(); //1.保存基本信息 GovOperationProjectBaseinfoDTO baseinfo = saveDTO.getBaseinfo(); baseinfo.setBaseProjId(baseProjId); baseinfo.setBaseProjName(baseProjName); - baseinfo.setBaseAreaCode(baseAreaCode); baseinfo.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); GovOperationProjectBaseinfo oldBaseInfo = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) .eq(GovOperationProjectBaseinfo::getBaseProjId, baseProjId) @@ -924,11 +897,8 @@ public class GovProjectCollectionManage { saveBase.setId(oldBaseInfo.getId()); saveBase.setBaseAreaCode(null); } else { - saveBase.setBaseAreaCode(baseAreaCode); saveBase.setTongTime(LocalDateTime.now()); - saveBase.setBaseAreaName(regionCacheHelper.getRegionName(user.getRegionCode(), RegionConst.RL_COUNTY)); } - saveBase.setAreaCode(RegionConst.RC_HZ); saveBase.setBizTime(LocalDateTime.now()); saveBase.setUpdateBy(user.getUsername()); saveBase.setUpdateOn(LocalDateTime.now()); @@ -1064,21 +1034,18 @@ public class GovProjectCollectionManage { procureService.remove(Wrappers.lambdaQuery(GovBizProjectProcure.class) .eq(GovBizProjectProcure::getBaseProjId, baseProjId)); - String finalBaseProjId = baseProjId; - UserInfoDetails finalUser = user; - Integer index = 1; for (GovBizProjectProcureDTO procure : procures) { - procure.setBaseProjId(finalBaseProjId); + procure.setBaseProjId(baseProjId); procure.setBaseProjName(baseProjName); - procure.setBaseBidCode(finalBaseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS, index)); + procure.setBaseBidCode(baseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS, index)); GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure, GovBizProjectProcure.class); - saveProcure.setBaseProjId(finalBaseProjId); + saveProcure.setBaseProjId(baseProjId); saveProcure.setId(null); saveProcure.setAreaCode(RegionConst.RC_HZ); saveProcure.setTongTime(LocalDateTime.now()); saveProcure.setBizTime(LocalDateTime.now()); - saveProcure.setUpdateBy(finalUser.getUsername()); + saveProcure.setUpdateBy(user.getUsername()); saveProcure.setUpdateOn(LocalDateTime.now()); if (procureService.save(saveProcure)) { threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssProcure(procure, null, saveProcure)); @@ -1088,8 +1055,6 @@ public class GovProjectCollectionManage { } - //7. 推送数据(改为定时推送了) -// pushProject(saveDTO); //如果是草稿箱来的 就要删除 if (Objects.nonNull(saveDTO.getDraftId())) { operationProjectDraftService.removeById(saveDTO.getDraftId()); @@ -1130,14 +1095,12 @@ public class GovProjectCollectionManage { GovBizProjectDraft draft = new GovBizProjectDraft(); //草稿id Long draftId = saveDTO.getDraftId(); - String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST; if (Objects.nonNull(draftId)) { GovBizProjectDraft oldDraft = draftService.getById(draftId); VUtils.isTrue(Objects.isNull(oldDraft)).throwMessage("该草稿不存在!"); draft.setId(draftId); } else { draft.setTongTime(LocalDateTime.now()); - draft.setBaseAreaCode(baseAreaCode); draft.setCreateId(user.getUserId()); draft.setTongTime(LocalDateTime.now()); } @@ -1227,14 +1190,12 @@ public class GovProjectCollectionManage { GovOperationProjectDraft draft = new GovOperationProjectDraft(); //草稿id Long draftId = saveDTO.getDraftId(); - String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST; if (Objects.nonNull(draftId)) { GovOperationProjectDraft oldDraft = operationProjectDraftService.getById(draftId); VUtils.isTrue(Objects.isNull(oldDraft)).throwMessage("该草稿不存在!"); draft.setId(draftId); } else { draft.setTongTime(LocalDateTime.now()); - draft.setBaseAreaCode(baseAreaCode); draft.setCreateId(user.getUserId()); draft.setTongTime(LocalDateTime.now()); } @@ -1722,26 +1683,23 @@ public class GovProjectCollectionManage { throw BizException.wrap("pdf转换无效"); } - private Boolean checkFieldNotPdf(String field, Object record, String fieldName) { - if (StringUtils.isBlank(field)) { + private boolean checkFieldNotPdf(String field, Object record, String fieldName) { + if (StrUtil.isBlank(field)) { return Boolean.FALSE; } - - //如果没有老值 + // 如果没有老值 if (Objects.isNull(record)) { return Boolean.TRUE; } - //和老值做个对比 不一样则true + // 和老值做个对比 不一样则true Class clazz = record.getClass(); String oldFiled = StringUtils.EMPTY; try { Field fieldDeclared = clazz.getDeclaredField(fieldName); fieldDeclared.setAccessible(Boolean.TRUE); oldFiled = Objects.nonNull(fieldDeclared.get(record)) ? String.valueOf(fieldDeclared.get(record)) : null; - } catch (NoSuchFieldException e) { - log.error("转换PDF文件出错" + e); - } catch (IllegalAccessException e) { + } catch (NoSuchFieldException | IllegalAccessException e) { log.error("转换PDF文件出错" + e); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java index f2d2f2f..0005d94 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java @@ -18,6 +18,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; + import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -37,6 +38,7 @@ public class IrsProjectManage { /** * IRS档案 项目列表 + * * @param req * @return */ @@ -44,39 +46,39 @@ public class IrsProjectManage { Page page = req.page(); UserInfoDetails user = LoginUserUtil.loginUserDetail(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class) - .eq(StringUtils.isNotBlank(req.getAreaCode()),Project::getAreaCode,req.getAreaCode()) - .eq(StringUtils.isNotBlank(req.getRegionCode()),Project::getAreaCode,req.getRegionCode()) - .eq(StringUtils.isNotBlank(req.getProjectType()),Project::getProjectType,req.getProjectType()) - .eq(Objects.nonNull(req.getStatus()),Project::getStatus,req.getStatus()) - .eq(Objects.nonNull(req.getStage()),Project::getStage,req.getStage()) - .ge(Objects.nonNull(req.getApproveAmountMin()),Project::getApprovalAmount,req.getApproveAmountMin()) - .le(Objects.nonNull(req.getApproveAmountMax()),Project::getApprovalAmount,req.getApproveAmountMax()) - .eq(Objects.nonNull(req.getProjectYear()),Project::getProjectYear,req.getProjectYear()) - .ge(Objects.nonNull(req.getCreateOnMin()),Project::getCreateOn,req.getCreateOnMin()) - .le(Objects.nonNull(req.getCreateOnMax()),Project::getCreateOn,req.getCreateOnMax()) - .like(StringUtils.isNotBlank(req.getProjectName()),Project::getProjectName,req.getProjectName()) - .like(StringUtils.isNotBlank(req.getBuildOrgName()),Project::getBuildOrgName,req.getBuildOrgName()) + .eq(StringUtils.isNotBlank(req.getAreaCode()), Project::getAreaCode, req.getAreaCode()) + .eq(StringUtils.isNotBlank(req.getRegionCode()), Project::getAreaCode, req.getRegionCode()) + .eq(StringUtils.isNotBlank(req.getProjectType()), Project::getProjectType, req.getProjectType()) + .eq(Objects.nonNull(req.getStatus()), Project::getStatus, req.getStatus()) + .eq(Objects.nonNull(req.getStage()), Project::getStage, req.getStage()) + .ge(Objects.nonNull(req.getApproveAmountMin()), Project::getApprovalAmount, req.getApproveAmountMin()) + .le(Objects.nonNull(req.getApproveAmountMax()), Project::getApprovalAmount, req.getApproveAmountMax()) + .eq(Objects.nonNull(req.getProjectYear()), Project::getProjectYear, req.getProjectYear()) + .ge(Objects.nonNull(req.getCreateOnMin()), Project::getCreateOn, req.getCreateOnMin()) + .le(Objects.nonNull(req.getCreateOnMax()), Project::getCreateOn, req.getCreateOnMax()) + .like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()) + .like(StringUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) .gt(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) - .eq(Project::getNewest,Boolean.TRUE) + .eq(Project::getNewest, Boolean.TRUE) .eq(Project::getIncludeApplication, CommonEnum.YES.getCode()) .orderByDesc(Project::getUpdateOn); - buildPermission(wrapper,user); - projectService.page(page,wrapper); + buildPermission(wrapper, user); + projectService.page(page, wrapper); - if(CollUtil.isEmpty(page.getRecords())){ + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } - List res = page.getRecords().stream().map(p -> BeanUtil.copyProperties(p,ProjectLibListItemVO.class)).collect(Collectors.toList()); - return PageVo.of(res,page.getTotal()); + List res = page.getRecords().stream() + .map(p -> BeanUtil.copyProperties(p, ProjectLibListItemVO.class)) + .collect(Collectors.toList()); + return PageVo.of(res, page.getTotal()); } private void buildPermission(LambdaQueryWrapper wrapper, UserInfoDetails user) { - if(user.getSuperAdmin()){ + if (user.getSuperAdmin() || user.getRegionAdmin()) { log.info("超管 都可看 项目档案列表"); - }else if(user.getRegionAdmin()){ - wrapper.eq(Project::getAreaCode,user.getRegionCode()); - }else{ - wrapper.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); + } else { + wrapper.eq(Project::getBuildOrgCode, user.getMhUnitId()); } } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingDataScopeHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingDataScopeHelper.java deleted file mode 100644 index b5eeac3..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingDataScopeHelper.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.hz.pm.api.meeting.helper; - -import com.ningdatech.basic.util.CollUtils; -import com.hz.pm.api.common.helper.RegionCacheHelper; -import com.hz.pm.api.common.model.entity.ViewRegionDTO; -import com.hz.pm.api.sys.model.entity.Role; -import com.hz.pm.api.user.model.enumeration.RoleEnum; -import com.hz.pm.api.user.security.model.UserInfoDetails; -import com.hz.pm.api.user.util.LoginUserUtil; -import lombok.AllArgsConstructor; -import org.springframework.stereotype.Component; - -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -/** - *

- * MeetingDataScopeHelper - *

- * - * @author WendyYang - * @since 2023/4/27 - **/ -@Component -@AllArgsConstructor -public class MeetingDataScopeHelper { - - private final RegionCacheHelper regionCacheHelper; - - private static RoleEnum getRolePriorityMax() { - List roleList = LoginUserUtil.loginUserDetail().getUserRoleList(); - List roleCodeList = CollUtils.fieldList(roleList, Role::getCode); - if (roleCodeList.contains(RoleEnum.SUPER_ADMIN.name())) { - return RoleEnum.SUPER_ADMIN; - } - if (roleCodeList.contains(RoleEnum.REGION_MANAGER.name())) { - return RoleEnum.REGION_MANAGER; - } - return RoleEnum.EXPERT_ADMIN; - } - - public ViewRegionDTO meetingListViewRegions() { - RoleEnum role = getRolePriorityMax(); - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - String regionCode = user.getRegionCode(); - Integer regionLevel = user.getRegionLevel(); - Collection regions; - switch (role) { - case SUPER_ADMIN: - regions = null; - break; - case REGION_MANAGER: - regions = regionCacheHelper.listChildRegionCodeList(regionCode, regionLevel); - break; - case EXPERT_ADMIN: - regions = Collections.singletonList(regionCode); - break; - default: - regions = Collections.emptyList(); - break; - } - return new ViewRegionDTO(regions, regionLevel); - } - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java index 8ab55e6..a98c3cb 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java @@ -30,7 +30,6 @@ import com.hz.pm.api.meeting.entity.req.*; import com.hz.pm.api.meeting.entity.vo.*; import com.hz.pm.api.meeting.helper.ExpertInviteHelper; import com.hz.pm.api.meeting.helper.MeetingCallOrMsgHelper; -import com.hz.pm.api.meeting.helper.MeetingDataScopeHelper; import com.hz.pm.api.meeting.helper.MeetingManageHelper; import com.hz.pm.api.meeting.service.*; import com.hz.pm.api.meeting.task.ExpertRandomInviteTask; @@ -89,13 +88,10 @@ public class MeetingManage { private final DistributedLock distributedLock; private final IProjectService projectService; private final IMeetingInnerProjectService meetingInnerProjectService; - private final IMeetingOuterProjectService meetingOuterProjectService; private final IBelongOrgService belongOrgService; private final IDingOrganizationService dingOrganizationService; - private final IExpertReviewService expertReviewService; private final ExpertInviteHelper expertInviteHelper; private final MeetingCallOrMsgHelper meetingCallOrMsgHelper; - private final MeetingDataScopeHelper meetingDataScopeHelper; private final IMeetingExpertJudgeService expertJudgeService; private final IMeetingExpertJudgeService meetingExpertJudgeService; @@ -130,8 +126,8 @@ public class MeetingManage { // 保存会议基本信息 Meeting meeting = BeanUtil.copyProperties(meetingBasic, Meeting.class); meeting.setStatus(MeetingStatusEnum.NORMAL.getCode()); - meeting.setHoldOrg(userDetail.getOrganizationName()); - meeting.setHoldOrgCode(userDetail.getOrganizationCode()); + meeting.setHoldOrg(String.valueOf(userDetail.getMhUnitId())); + meeting.setHoldOrgCode(userDetail.getMhUnitName()); meeting.setCreator(userDetail.getUsername()); meeting.setInviteStatus(Boolean.FALSE); meeting.setConfirmedRoster(Boolean.FALSE); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/helper/impl/TemplateDetailBuildHelperImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/helper/impl/TemplateDetailBuildHelperImpl.java index 85cdecc..a315633 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/helper/impl/TemplateDetailBuildHelperImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/helper/impl/TemplateDetailBuildHelperImpl.java @@ -73,7 +73,8 @@ public class TemplateDetailBuildHelperImpl implements TemplateDetailBuildHelper .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode,projectCode) .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.RE_APPRAISAL.getCode())); if (CollUtil.isNotEmpty(reAppraisalScoreInfo)) { - Map> reAppScoreInfoMap = reAppraisalScoreInfo.stream().collect(Collectors.groupingBy(PerformanceAppraisalScoreInfo::getAppraisalEmployeeName)); + Map> reAppScoreInfoMap = reAppraisalScoreInfo.stream() + .collect(Collectors.groupingBy(PerformanceAppraisalScoreInfo::getAppraisalUserName)); HashMap scoreMap = MapUtil.newHashMap(); for (String name : reAppScoreInfoMap.keySet()) { List scoreInfos = reAppScoreInfoMap.get(name); @@ -97,13 +98,13 @@ public class TemplateDetailBuildHelperImpl implements TemplateDetailBuildHelper .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode,projectCode) .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_VERIFY.getCode())); if (CollUtil.isNotEmpty(verifyScoreInfo)) { - Map> verifyScoreInfoMap = verifyScoreInfo.stream().collect(Collectors.groupingBy(PerformanceAppraisalScoreInfo::getAppraisalEmployeeName)); + Map> verifyScoreInfoMap = verifyScoreInfo.stream() + .collect(Collectors.groupingBy(PerformanceAppraisalScoreInfo::getAppraisalUserName)); HashMap scoreMap = MapUtil.newHashMap(); for (String name : verifyScoreInfoMap.keySet()) { List scoreInfos = verifyScoreInfoMap.get(name); BigDecimal totalScore = scoreInfos.stream().map(PerformanceAppraisalScoreInfo::getAppraisalScore) - .filter(Objects::nonNull) - .reduce(BigDecimal.ZERO, BigDecimal::add); + .filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); scoreMap.put(name, totalScore); } detailThirdVo.setVerifyTotalScoreInfo(scoreMap); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/AppAppraisalManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/AppAppraisalManage.java index 492c638..8212c95 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/AppAppraisalManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/AppAppraisalManage.java @@ -1,47 +1,49 @@ package com.hz.pm.api.performance.manage; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.lang.Assert; import cn.hutool.core.map.MapUtil; -import com.hz.pm.api.performance.enumration.AppIndexTypeEnum; -import com.hz.pm.api.performance.model.dto.AppAppraisalInfoDTO; -import com.hz.pm.api.performance.model.vo.*; -import com.hz.pm.api.projectlib.model.entity.ProjectApplication; -import com.hz.pm.api.projectlib.service.IProjectApplicationService; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; -import org.springframework.stereotype.Component; - 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.exception.BizException; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.basic.util.StrPool; import com.hz.pm.api.performance.constant.ProjectBizConst; +import com.hz.pm.api.performance.enumration.AppIndexTypeEnum; +import com.hz.pm.api.performance.model.dto.AppAppraisalInfoDTO; import com.hz.pm.api.performance.model.dto.ProjectAppraisalDTO; import com.hz.pm.api.performance.model.entity.*; import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq; +import com.hz.pm.api.performance.model.vo.*; import com.hz.pm.api.performance.service.*; +import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.projectlib.service.IProjectApplicationService; import com.hz.pm.api.sys.model.entity.Role; import com.hz.pm.api.sys.service.IRoleService; import com.hz.pm.api.user.security.model.UserInfoDetails; import com.hz.pm.api.user.util.LoginUserUtil; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Component; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; /** * AppAppraisalManage - * @return + * * @author CMM + * @return * @since 2023/08/10 8:55 */ @Component @@ -56,8 +58,10 @@ public class AppAppraisalManage { private final IPerformanceAppraisalApplicationService performanceAppraisalApplicationService; private final IPerformanceAppraisalAppIndicatorService performanceAppraisalAppIndicatorService; private final IProjectCoreBusinessIndicatorsService projectCoreBusinessIndicatorsService; + /** * 应用评价-评价计划列表 + * * @param req * @return */ @@ -68,31 +72,31 @@ public class AppAppraisalManage { List roleIdList = userRoleList.stream().map(Role::getId).collect(Collectors.toList()); Role role = roleService.getOne(Wrappers.lambdaQuery(Role.class) .eq(Role::getName, ProjectBizConst.REAPPRAISAL_ROLE)); - if (Objects.isNull(role)){ + if (Objects.isNull(role)) { throw new BizException("登录用户没有复评员角色!"); } // 登录用户不是复评员,不能查看复评计划列表 - if (!roleIdList.contains(role.getId())){ + if (!roleIdList.contains(role.getId())) { return PageVo.empty(); } // 获取所有已添加到评价计划中的应用信息 List paas = performanceAppraisalApplicationService.list(); // 没有包含应用的评价计划 - if (CollUtil.isEmpty(paas)){ + if (CollUtil.isEmpty(paas)) { return PageVo.empty(); } Set paIds = paas.stream().map(PerformanceAppraisalApplication::getAppraisalId).collect(Collectors.toSet()); Page page = req.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) - .in(PerformanceAppraisal::getId,paIds) + .in(PerformanceAppraisal::getId, paIds) .orderByDesc(PerformanceAppraisal::getUpdateOn); - performanceAppraisalService.page(page,wrapper); + performanceAppraisalService.page(page, wrapper); List res = page.getRecords().stream() .map(p -> BeanUtil.copyProperties(p, PerformanceAppraisalVO.class)) .collect(Collectors.toList()); - return PageVo.of(res,page.getTotal()); + return PageVo.of(res, page.getTotal()); } @@ -108,7 +112,7 @@ public class AppAppraisalManage { .eq(PerformanceAppraisalApplication::getAppraisalId, planId) .eq(PerformanceAppraisalApplication::getIsCompleteAppraisal, Boolean.FALSE)); // 没有当前用户待评价的应用信息 - if (CollUtil.isEmpty(paas)){ + if (CollUtil.isEmpty(paas)) { return PageVo.empty(); } List ids = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); @@ -126,36 +130,36 @@ public class AppAppraisalManage { } appIds = ids; // 没有当前用户待评价的应用信息 - if(CollUtil.isEmpty(appIds)){ + if (CollUtil.isEmpty(appIds)) { return PageVo.empty(); } Page page = req.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectApplication.class) .in(ProjectApplication::getId, appIds) - .like(StringUtils.isNotBlank(req.getApplicationName()),ProjectApplication::getApplicationName,req.getApplicationName()); - projectApplicationService.page(page,wrapper); + .like(StringUtils.isNotBlank(req.getApplicationName()), ProjectApplication::getApplicationName, req.getApplicationName()); + projectApplicationService.page(page, wrapper); - if(CollUtil.isEmpty(page.getRecords())){ + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } List res = page.getRecords().stream() .map(p -> { PerformanceAppraisalAppVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalAppVO.class); - vo.setCanAppraisal(checkCanAppraisal(employeeCode,p.getId(),planId)); + vo.setCanAppraisal(checkCanAppraisal(employeeCode, p.getId(), planId)); vo.setApplicationName(StringUtils.isNotBlank(p.getApplicationName()) ? p.getApplicationName() : p.getRelatedExistsApplication()); vo.setAppraisalId(planId); return vo; }) .collect(Collectors.toList()); - return PageVo.of(res,page.getTotal()); + return PageVo.of(res, page.getTotal()); } public PageVo evaluatedList(Long planId, PerformanceAppraisalListReq req) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); - String employeeCode = user.getEmployeeCode(); + String employeeCode = user.getUserIdStr(); PerformanceAppraisal plan = performanceAppraisalService.getById(planId); VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!"); @@ -164,7 +168,7 @@ public class AppAppraisalManage { List paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) .eq(PerformanceAppraisalApplication::getAppraisalId, planId) .eq(PerformanceAppraisalApplication::getIsCompleteAppraisal, Boolean.TRUE)); - if (CollUtil.isEmpty(paas)){ + if (CollUtil.isEmpty(paas)) { return PageVo.empty(); } // 从绩效评价打分信息表中获取上述绩效评价计划应用的打分信息 @@ -173,39 +177,38 @@ public class AppAppraisalManage { List appIds = Lists.newArrayList(); if (CollUtil.isNotEmpty(appraisalScoreInfos)) { // 筛选出当前登录用户已进行打分的应用信息 - List scoredAppIds = appraisalScoreInfos.stream() + appIds = appraisalScoreInfos.stream() .filter(a -> employeeCode.equals(a.getAppraisalEmployeeCode())) .map(PerformanceAppraisalAppScoreInfo::getApplicationId) .collect(Collectors.toList()); - appIds = scoredAppIds; } // 没有当前用户已评价的应用信息 - if(CollUtil.isEmpty(appIds)){ + if (CollUtil.isEmpty(appIds)) { return PageVo.empty(); } Page page = req.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectApplication.class) .in(ProjectApplication::getId, appIds) - .like(StringUtils.isNotBlank(req.getApplicationName()),ProjectApplication::getApplicationName,req.getApplicationName()); - projectApplicationService.page(page,wrapper); + .like(StringUtils.isNotBlank(req.getApplicationName()), ProjectApplication::getApplicationName, req.getApplicationName()); + projectApplicationService.page(page, wrapper); - if(CollUtil.isEmpty(page.getRecords())){ + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } List res = page.getRecords().stream() .map(p -> { PerformanceAppraisalAppVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalAppVO.class); - vo.setCanAppraisal(checkCanAppraisal(employeeCode,p.getId(),planId)); + vo.setCanAppraisal(checkCanAppraisal(employeeCode, p.getId(), planId)); vo.setApplicationName(StringUtils.isNotBlank(p.getApplicationName()) ? p.getApplicationName() : p.getRelatedExistsApplication()); vo.setAppraisalId(planId); return vo; }) .collect(Collectors.toList()); - return PageVo.of(res,page.getTotal()); + return PageVo.of(res, page.getTotal()); } /** @@ -216,14 +219,14 @@ public class AppAppraisalManage { * @param appraisalId * @return */ - private Boolean checkCanAppraisal(String employeeCode, Long appId, Long appraisalId) { + private Boolean checkCanAppraisal(String employeeCode, Long appId, Long appraisalId) { // 从绩效评价应用打分信息表中查询打分人员为当前登录复评用户的打分信息 // 如果没有相关的打分信息,说明是当前登录复评用户是首次评价 List scoreInfos = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) - .eq(PerformanceAppraisalAppScoreInfo::getApplicationId,appId) - .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId,appraisalId) + .eq(PerformanceAppraisalAppScoreInfo::getApplicationId, appId) + .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, appraisalId) .eq(PerformanceAppraisalAppScoreInfo::getAppraisalEmployeeCode, employeeCode)); - if (CollUtil.isEmpty(scoreInfos)){ + if (CollUtil.isEmpty(scoreInfos)) { return true; } return Boolean.FALSE; @@ -233,28 +236,26 @@ public class AppAppraisalManage { public AppAppraisalIndexDetailVO detail(Long planId, Long appId) { ProjectApplication projectApplication = projectApplicationService.getById(appId); - VUtils.isTrue(Objects.isNull(projectApplication)).throwMessage("应用不存在!"); + Assert.notNull(projectApplication, "应用不存在!"); AppAppraisalIndexDetailVO resVo = new AppAppraisalIndexDetailVO(); if (StringUtils.isNotBlank(projectApplication.getApplicationName())) { resVo.setApplicationName(projectApplication.getApplicationName()); - }else { + } else { resVo.setApplicationName(projectApplication.getRelatedExistsApplication()); } - if (Objects.nonNull(projectApplication)){ - resVo.setBuildOrgName(projectApplication.getBuildOrgName()); - // todo 应用状态 需通过appCode通过IRS接口获取,这里暂时写死 已验收 - resVo.setApplicationStatus("已验收"); - } + resVo.setBuildOrgName(projectApplication.getBuildOrgName()); + // todo 应用状态 需通过appCode通过IRS接口获取,这里暂时写死 已验收 + resVo.setApplicationStatus("已验收"); // 获取指标配置的应用指标信息 // 通用指标 List commonIndexList = performanceAppraisalAppIndicatorService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppIndicator.class) .eq(PerformanceAppraisalAppIndicator::getIndexType, AppIndexTypeEnum.COMMON.getCode()) - .eq(PerformanceAppraisalAppIndicator::getIsDisplay,Boolean.TRUE) - .orderBy(Boolean.TRUE,Boolean.TRUE,PerformanceAppraisalAppIndicator::getSort)); + .eq(PerformanceAppraisalAppIndicator::getIsDisplay, Boolean.TRUE) + .orderBy(Boolean.TRUE, Boolean.TRUE, PerformanceAppraisalAppIndicator::getSort)); // 获取当前应用通用指标的的打分信息 Map commonScoreInfoMap = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) - .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId,planId) + .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, planId) .eq(PerformanceAppraisalAppScoreInfo::getApplicationId, appId) .eq(PerformanceAppraisalAppScoreInfo::getIndexType, AppIndexTypeEnum.COMMON.getCode())) .stream().collect(Collectors.toMap(PerformanceAppraisalAppScoreInfo::getIndexId, p -> p)); @@ -274,11 +275,11 @@ public class AppAppraisalManage { // 辅助指标 List auxIndexList = performanceAppraisalAppIndicatorService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppIndicator.class) .eq(PerformanceAppraisalAppIndicator::getIndexType, AppIndexTypeEnum.AUX.getCode()) - .eq(PerformanceAppraisalAppIndicator::getIsDisplay,Boolean.TRUE) - .orderBy(Boolean.TRUE,Boolean.TRUE,PerformanceAppraisalAppIndicator::getSort)); + .eq(PerformanceAppraisalAppIndicator::getIsDisplay, Boolean.TRUE) + .orderBy(Boolean.TRUE, Boolean.TRUE, PerformanceAppraisalAppIndicator::getSort)); // 获取当前应用辅助指标的的打分信息 Map auxScoreInfoMap = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) - .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId,planId) + .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, planId) .eq(PerformanceAppraisalAppScoreInfo::getApplicationId, appId) .eq(PerformanceAppraisalAppScoreInfo::getIndexType, AppIndexTypeEnum.AUX.getCode())) .stream().collect(Collectors.toMap(PerformanceAppraisalAppScoreInfo::getIndexId, p -> p)); @@ -299,7 +300,7 @@ public class AppAppraisalManage { .eq(ProjectCoreBusinessIndicators::getApplicationId, appId)); // 获取当前应用业务指标的的打分信息 Map businessScoreInfoMap = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) - .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId,planId) + .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, planId) .eq(PerformanceAppraisalAppScoreInfo::getApplicationId, appId) .eq(PerformanceAppraisalAppScoreInfo::getIndexType, AppIndexTypeEnum.BUSINESS.getCode())) .stream().collect(Collectors.toMap(PerformanceAppraisalAppScoreInfo::getIndexId, p -> p)); @@ -333,7 +334,7 @@ public class AppAppraisalManage { .eq(PerformanceAppraisalApplication::getApplicationId, applicationId)); List indexIds = appAppraisalInfoList.stream().filter(a -> AppIndexTypeEnum.COMMON.getCode().equals(a.getIndexType()) || - AppIndexTypeEnum.AUX.getCode().equals(a.getIndexType())) + AppIndexTypeEnum.AUX.getCode().equals(a.getIndexType())) .map(AppAppraisalInfoDTO::getIndexId) .collect(Collectors.toList()); List businessIndexIds = appAppraisalInfoList.stream() @@ -366,18 +367,18 @@ public class AppAppraisalManage { Map finalBusinessIndexMap = businessIndexMap; List scoreInfos = appAppraisalInfoList.stream().map(a -> { if (AppIndexTypeEnum.COMMON.getCode().equals(a.getIndexType()) || - AppIndexTypeEnum.AUX.getCode().equals(a.getIndexType())){ + AppIndexTypeEnum.AUX.getCode().equals(a.getIndexType())) { PerformanceAppraisalAppIndicator appIndicator = finalIndexMap.get(a.getIndexId()); BigDecimal score = a.getScore(); BigDecimal indexScore = appIndicator.getIndexScore(); - if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0){ + if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0) { throw new BizException("评价得分必须大于等于0且小于等于指标分值!"); } } else if (AppIndexTypeEnum.BUSINESS.getCode().equals(a.getIndexType())) { ProjectCoreBusinessIndicators coreBusinessIndicators = finalBusinessIndexMap.get(a.getIndexId()); BigDecimal score = a.getScore(); BigDecimal indexScore = coreBusinessIndicators.getScore(); - if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0){ + if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0) { throw new BizException("评价得分必须大于等于0且小于等于指标分值!"); } } @@ -396,7 +397,7 @@ public class AppAppraisalManage { scoreInfo.setUpdateBy(username); return scoreInfo; }).collect(Collectors.toList()); - if (performanceAppraisalAppScoreInfoService.saveBatch(scoreInfos)){ + if (performanceAppraisalAppScoreInfoService.saveBatch(scoreInfos)) { // 计算评价总分并保存 BigDecimal appraisalTotalScore = appAppraisalInfoList.stream() .map(AppAppraisalInfoDTO::getScore) @@ -412,18 +413,5 @@ public class AppAppraisalManage { } return "提交失败"; } - private void judgeCompleteAppraisal(PerformanceAppraisalProjectGroup group, PerformanceAppraisalApplication appraisalApplication) { - // 获取该评价应用的复评打分信息 - List scoreInfos = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) - .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, group.getAppraisalId()) - .eq(PerformanceAppraisalAppScoreInfo::getApplicationId, appraisalApplication.getApplicationId())); - String reAppraisalUsers = group.getReAppraisalUsers(); - List users = scoreInfos.stream().map(PerformanceAppraisalAppScoreInfo::getAppraisalEmployeeCode).collect(Collectors.toList()); - if (CollUtil.isNotEmpty(users)){ - String join = String.join(StrPool.COMMA, users); - if (join.equals(reAppraisalUsers)) { - appraisalApplication.setIsCompleteAppraisal(Boolean.TRUE); - } - } - } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/OrgSelfAppraisalManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/OrgSelfAppraisalManage.java index 173b3ce..3342b60 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/OrgSelfAppraisalManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/OrgSelfAppraisalManage.java @@ -4,40 +4,44 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import com.alibaba.excel.EasyExcel; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Assert; 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.exception.BizException; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.basic.util.StrPool; import com.hz.pm.api.common.enumeration.CommonEnum; import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.common.util.ExcelExportStyle; import com.hz.pm.api.performance.constant.ProjectBizConst; import com.hz.pm.api.performance.enumration.AppraisalTypeEnum; import com.hz.pm.api.performance.helper.TemplateDetailBuildHelper; -import com.hz.pm.api.performance.model.dto.SelfAppraisalScoreExportDTO; import com.hz.pm.api.performance.model.dto.ProjectAppraisalDTO; import com.hz.pm.api.performance.model.dto.ProjectAppraisalInfoDTO; +import com.hz.pm.api.performance.model.dto.SelfAppraisalScoreExportDTO; import com.hz.pm.api.performance.model.entity.*; import com.hz.pm.api.performance.model.req.PerformanceAppraisalExportReq; import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq; -import com.hz.pm.api.performance.model.vo.*; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalProjectVO; +import com.hz.pm.api.performance.model.vo.PerformanceAppraisalVO; +import com.hz.pm.api.performance.model.vo.ProjectAppraisalIndexDetailVO; +import com.hz.pm.api.performance.model.vo.ProjectTemplateDetailVO; import com.hz.pm.api.performance.service.*; import com.hz.pm.api.performance.util.ExcelFillCellMergeStrategy; import com.hz.pm.api.performance.util.MultiColumnMergeStrategy; import com.hz.pm.api.portrait.model.entity.ProjectTag; import com.hz.pm.api.portrait.service.IProjectTagService; +import com.hz.pm.api.projectlib.model.entity.Project; 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.entity.Project; import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.sys.model.entity.Role; import com.hz.pm.api.sys.service.IRoleService; import com.hz.pm.api.user.model.enumeration.RoleEnum; import com.hz.pm.api.user.security.model.UserInfoDetails; import com.hz.pm.api.user.util.LoginUserUtil; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.StrPool; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -48,7 +52,10 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.math.BigDecimal; import java.time.LocalDateTime; -import java.util.*; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; import java.util.stream.Collectors; /** @@ -71,8 +78,10 @@ public class OrgSelfAppraisalManage { private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; private final IProjectTagService projectTagService; private final IPerformanceAppraisalScoreInfoService performanceAppraisalScoreInfoService; + /** * 绩效列表 + * * @param req * @return */ @@ -80,51 +89,51 @@ public class OrgSelfAppraisalManage { UserInfoDetails user = LoginUserUtil.loginUserDetail(); //当前登录用户 单位code - String empPosUnitCode = user.getEmpPosUnitCode(); + String mhUnitId = user.getMhUnitIdStr(); // 获取当前登录用户的角色列表,只有单位管理员才能查看该列表 List userRoleList = user.getUserRoleList(); List roleIdList = userRoleList.stream().map(Role::getId).collect(Collectors.toList()); Role role = roleService.getOne(Wrappers.lambdaQuery(Role.class) .eq(Role::getName, RoleEnum.COMPANY_MANAGER.getDesc())); - if (Objects.isNull(role)){ + if (Objects.isNull(role)) { throw new BizException("登录用户没有单位管理员角色!"); } // 登录用户不是单位管理员,不能查看本单位的自评计划列表 - if (!roleIdList.contains(role.getId())){ + if (!roleIdList.contains(role.getId())) { return PageVo.empty(); } // 获取登录用户所在单位的所有已终验项目信息 List projectLists = projectService.list(Wrappers.lambdaQuery(Project.class) .eq(Project::getStatus, ProjectStatusEnum.ACCEPTED.getCode()) - .eq(Project::getBuildOrgCode, empPosUnitCode)); + .eq(Project::getBuildOrgCode, mhUnitId)); - if(CollUtil.isEmpty(projectLists)){ + if (CollUtil.isEmpty(projectLists)) { return PageVo.empty(); } List projectIds = projectLists.stream().map(Project::getId).collect(Collectors.toList()); // 获取添加过该单位项目的所有评价计划信息 List paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) .in(PerformanceAppraisalProject::getProjectId, projectIds)); - if(CollUtil.isEmpty(paps)){ + if (CollUtil.isEmpty(paps)) { return PageVo.empty(); } Set paIds = paps.stream().map(PerformanceAppraisalProject::getAppraisalId).collect(Collectors.toSet()); // 获取评价计划列表 Page page = req.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) - .in(PerformanceAppraisal::getId,paIds) + .in(PerformanceAppraisal::getId, paIds) .orderByDesc(PerformanceAppraisal::getUpdateOn); - performanceAppraisalService.page(page,wrapper); - if(CollUtil.isEmpty(page.getRecords())){ + performanceAppraisalService.page(page, wrapper); + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } List res = page.getRecords().stream() .map(p -> BeanUtil.copyProperties(p, PerformanceAppraisalVO.class)) .collect(Collectors.toList()); - return PageVo.of(res,page.getTotal()); + return PageVo.of(res, page.getTotal()); } public PageVo pendingList(Long planId, PerformanceAppraisalListReq req) { @@ -135,11 +144,11 @@ public class OrgSelfAppraisalManage { // 获取评价计划内已添加的待评价项目信息 List paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .eq(PerformanceAppraisalProject::getAppraisalId, plan.getId())).stream() + .eq(PerformanceAppraisalProject::getAppraisalId, plan.getId())).stream() .filter(p -> Objects.isNull(p.getSelfAppraisalScoreTime())).collect(Collectors.toList()); Map papsMap = paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); - if(CollUtil.isEmpty(paps)){ + if (CollUtil.isEmpty(paps)) { return PageVo.empty(); } @@ -149,19 +158,19 @@ public class OrgSelfAppraisalManage { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class) .in(Project::getProjectCode, projectCodes) .eq(Project::getNewest, Boolean.TRUE) - .eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()) - .like(StringUtils.isNotBlank(req.getProjectName()),Project::getProjectName,req.getProjectName()); - projectService.page(page,wrapper); + .eq(Project::getBuildOrgCode, user.getMhUnitId()) + .like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); + projectService.page(page, wrapper); - if(CollUtil.isEmpty(page.getRecords())){ + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } - List res = page.getRecords().stream() - .map(p -> { - PerformanceAppraisalProjectVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalProjectVO.class); + List res = page.getRecords().stream().map(p -> { + PerformanceAppraisalProjectVO vo = new PerformanceAppraisalProjectVO(); + BeanUtil.copyProperties(p, vo); PerformanceAppraisalProject appraisalProject = papsMap.get(p.getId()); - BeanUtil.copyProperties(appraisalProject,vo); + BeanUtil.copyProperties(appraisalProject, vo); vo.setProjectId(appraisalProject.getProjectId()); vo.setProjectTypeName(ProjectTypeNewEnum.getDesc(p.getProjectType())); vo.setCanSelfAppraisal(checkCanSelfAppraisal(appraisalProject)); @@ -170,7 +179,7 @@ public class OrgSelfAppraisalManage { }) .collect(Collectors.toList()); - return PageVo.of(res,page.getTotal()); + return PageVo.of(res, page.getTotal()); } /** @@ -188,11 +197,11 @@ public class OrgSelfAppraisalManage { // 获取评价计划内已添加的已评价项目信息 List paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .eq(PerformanceAppraisalProject::getAppraisalId, plan.getId())).stream() + .eq(PerformanceAppraisalProject::getAppraisalId, plan.getId())).stream() .filter(p -> Objects.nonNull(p.getSelfAppraisalScoreTime())).collect(Collectors.toList()); Map papsMap = paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); - if(CollUtil.isEmpty(paps)){ + if (CollUtil.isEmpty(paps)) { return PageVo.empty(); } @@ -202,18 +211,18 @@ public class OrgSelfAppraisalManage { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class) .in(Project::getProjectCode, projectCodes) .eq(Project::getNewest, Boolean.TRUE) - .eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()) - .like(StringUtils.isNotBlank(req.getProjectName()),Project::getProjectName,req.getProjectName()); - projectService.page(page,wrapper); + .eq(Project::getBuildOrgCode, user.getMhUnitId()) + .like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); + projectService.page(page, wrapper); - if(CollUtil.isEmpty(page.getRecords())){ + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } List res = page.getRecords().stream() .map(p -> { PerformanceAppraisalProjectVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalProjectVO.class); PerformanceAppraisalProject appraisalProject = papsMap.get(p.getId()); - BeanUtil.copyProperties(appraisalProject,vo); + BeanUtil.copyProperties(appraisalProject, vo); vo.setProjectId(appraisalProject.getProjectId()); vo.setProjectTypeName(ProjectTypeNewEnum.getDesc(p.getProjectType())); vo.setCanSelfAppraisal(checkCanSelfAppraisal(appraisalProject)); @@ -222,30 +231,27 @@ public class OrgSelfAppraisalManage { }) .collect(Collectors.toList()); - return PageVo.of(res,page.getTotal()); + return PageVo.of(res, page.getTotal()); } /** * 是否可以自评 + * * @param appraisalProject * @return */ private Boolean checkCanSelfAppraisal(PerformanceAppraisalProject appraisalProject) { // 在自评时间段内,且是首次自评(打分时间为空) - if(LocalDateTime.now().compareTo(appraisalProject.getSelfAppraisalStart()) > 0 && + if (LocalDateTime.now().compareTo(appraisalProject.getSelfAppraisalStart()) > 0 && LocalDateTime.now().compareTo(appraisalProject.getSelfAppraisalEnd()) < 0 && - Objects.isNull(appraisalProject.getSelfAppraisalScoreTime())){ + Objects.isNull(appraisalProject.getSelfAppraisalScoreTime())) { return Boolean.TRUE; } return Boolean.FALSE; } public ProjectAppraisalIndexDetailVO getAppraisalTemplateDetail(String projectCode) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - String regionCode = user.getRegionCode(); - ProjectAppraisalIndexDetailVO vo = new ProjectAppraisalIndexDetailVO(); - // 根据项目编码获取最新版本的项目信息 Project project = projectService.getProjectByCode(projectCode); VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!"); @@ -256,7 +262,7 @@ public class OrgSelfAppraisalManage { VUtils.isTrue(Objects.isNull(approvalAmount)).throwMessage("未获取到该项目的立项批复金额"); // 根据项目code获取项目标签ID列表 List tagIdList = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) - .eq(ProjectTag::getProjectCode, projectCode)).stream() + .eq(ProjectTag::getProjectCode, projectCode)).stream() .map(ProjectTag::getTagId).collect(Collectors.toList()); VUtils.isTrue(CollUtil.isEmpty(tagIdList)).throwMessage("当前项目未设置标签,匹配不到指标模板,请至项目库或评价计划编辑页面设置标签!"); @@ -264,25 +270,24 @@ public class OrgSelfAppraisalManage { String projectTagIds = String.join(StrPool.COMMA, strIdList); Integer amountRange = null; - if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.FIVE_MILLION)) < 0){ + if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.FIVE_MILLION)) < 0) { amountRange = ProjectBizConst.AMOUNT_RANGE_ONE; } else if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.FIVE_MILLION)) >= 0 && approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.TWENTY_MILLION)) < 0) { amountRange = ProjectBizConst.AMOUNT_RANGE_TWO; - }else if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.TWENTY_MILLION)) >= 0){ + } else if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.TWENTY_MILLION)) >= 0) { amountRange = ProjectBizConst.AMOUNT_RANGE_THREE; } LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class) - .eq(PerformanceIndicatorProjectTemplate::getRegionCode, regionCode) .eq(PerformanceIndicatorProjectTemplate::getProjectType, projectType) .eq(PerformanceIndicatorProjectTemplate::getProjectYear, projectYear) .eq(PerformanceIndicatorProjectTemplate::getAmountRange, amountRange) - .eq(PerformanceIndicatorProjectTemplate::getProjectTagIds,projectTagIds) - .eq(PerformanceIndicatorProjectTemplate::getStatus,CommonEnum.YES.getCode()) + .eq(PerformanceIndicatorProjectTemplate::getProjectTagIds, projectTagIds) + .eq(PerformanceIndicatorProjectTemplate::getStatus, CommonEnum.YES.getCode()) .orderByDesc(PerformanceIndicatorProjectTemplate::getUpdateOn); List templates = indicatorProjectTemplateService.list(wrapper); VUtils.isTrue(CollUtil.isEmpty(templates)).throwMessage("该项目匹配不到指标模板,请返回上一页或者刷新重试。"); - if (templates.size() > 1){ + if (templates.size() > 1) { throw new BizException("当前项目匹配到多个模板,请返回模板库检查模板配置!"); } PerformanceIndicatorProjectTemplate projectTemplate = templates.get(0); @@ -290,13 +295,13 @@ public class OrgSelfAppraisalManage { // 获取模版绩效指标详情 List templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId()) - .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.FALSE)); + .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional, Boolean.FALSE)); // 获取模版附加绩效指标详情 List additionalTemplateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId()) - .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE)); - List templateDetailVos = templateDetailBuildHelper.buildTemplateDetail(templateDetails,projectCode,vo); - List additionalTemplateDetailVos = templateDetailBuildHelper.buildTemplateDetail(additionalTemplateDetails,projectCode,vo); + .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional, Boolean.TRUE)); + List templateDetailVos = templateDetailBuildHelper.buildTemplateDetail(templateDetails, projectCode, vo); + List additionalTemplateDetailVos = templateDetailBuildHelper.buildTemplateDetail(additionalTemplateDetails, projectCode, vo); vo.setProjectName(project.getProjectName()); vo.setBuildOrgName(project.getBuildOrgName()); vo.setProjectStatus(project.getStatus()); @@ -310,8 +315,6 @@ public class OrgSelfAppraisalManage { @Transactional(rollbackFor = Exception.class) public String submitSelfAppraisal(ProjectAppraisalDTO param) { UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); - String employeeCode = userDetail.getEmployeeCode(); - String username = userDetail.getUsername(); Long appraisalId = param.getAppraisalId(); Long appraisalProjectId = param.getAppraisalProjectId(); String appraisalProjectCode = param.getAppraisalProjectCode(); @@ -320,12 +323,12 @@ public class OrgSelfAppraisalManage { PerformanceAppraisalProject appraisalProject = performanceAppraisalProjectService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) .eq(PerformanceAppraisalProject::getAppraisalId, appraisalId) .eq(PerformanceAppraisalProject::getProjectId, appraisalProjectId) - .eq(PerformanceAppraisalProject::getProjectCode,appraisalProjectCode)); - if (Objects.isNull(appraisalProject)){ + .eq(PerformanceAppraisalProject::getProjectCode, appraisalProjectCode)); + if (Objects.isNull(appraisalProject)) { throw new BizException("该项目已被移除评价计划,请返回上一页或者刷新重试!"); } // 根据项目模板详情ID保存自评得分、打分时间 - if (CollUtil.isEmpty(appraisalInfoList)){ + if (CollUtil.isEmpty(appraisalInfoList)) { throw new BizException("填写所有自评得分后才能提交!"); } List ids = appraisalInfoList.stream() @@ -334,7 +337,7 @@ public class OrgSelfAppraisalManage { // 查出项目模版详情信息 List detailList = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) .in(PerformanceIndicatorProjectTemplateDetail::getId, ids)); - if (CollUtil.isEmpty(detailList)){ + if (CollUtil.isEmpty(detailList)) { throw new BizException("评价指标不存在!"); } Map detailMap = detailList.stream().collect(Collectors.toMap(PerformanceIndicatorProjectTemplateDetail::getId, d -> d)); @@ -342,7 +345,7 @@ public class OrgSelfAppraisalManage { PerformanceIndicatorProjectTemplateDetail templateDetail = detailMap.get(a.getProjectTemplateDetailId()); BigDecimal score = a.getScore(); BigDecimal indexScore = templateDetail.getIndexScore(); - if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0){ + if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0) { throw new BizException("自评得分必须大于等于0且小于等于指标分值!"); } // 保存自评分数信息 @@ -353,17 +356,17 @@ public class OrgSelfAppraisalManage { scoreInfo.setAppraisalType(AppraisalTypeEnum.SELF_APPRAISAL.getCode()); scoreInfo.setTemplateDetailId(templateDetail.getId()); scoreInfo.setTemplateId(templateDetail.getTemplateId()); - scoreInfo.setAppraisalEmployeeCode(employeeCode); - scoreInfo.setAppraisalEmployeeName(username); + scoreInfo.setAppraisalUserId(String.valueOf(userDetail.getUserId())); + scoreInfo.setAppraisalUserName(userDetail.getRealName()); scoreInfo.setAppraisalId(appraisalId); scoreInfo.setAppraisalProjectId(appraisalProjectId); scoreInfo.setAppraisalProjectCode(appraisalProjectCode); scoreInfo.setCreateOn(LocalDateTime.now()); - scoreInfo.setCreateBy(username); + scoreInfo.setCreateBy(userDetail.getRealName()); return scoreInfo; }).collect(Collectors.toList()); - if (performanceAppraisalScoreInfoService.saveBatch(scoreInfos)){ + if (performanceAppraisalScoreInfoService.saveBatch(scoreInfos)) { // 计算自评总分并保存 BigDecimal selfAppraisalTotalScore = appraisalInfoList.stream() .map(ProjectAppraisalInfoDTO::getScore) @@ -373,7 +376,7 @@ public class OrgSelfAppraisalManage { appraisalProject.setSelfAppraisalScoreTime(LocalDateTime.now()); appraisalProject.setIsCompleteSelfAppraisal(Boolean.TRUE); appraisalProject.setUpdateOn(LocalDateTime.now()); - appraisalProject.setUpdateBy(username); + appraisalProject.setUpdateBy(userDetail.getRealName()); performanceAppraisalProjectService.updateById(appraisalProject); return "提交成功"; } @@ -381,48 +384,41 @@ public class OrgSelfAppraisalManage { } public void exportScore(HttpServletResponse response, PerformanceAppraisalExportReq param) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - String regionCode = user.getRegionCode(); String projectCode = param.getProjectCode(); Long appraisalId = param.getAppraisalId(); // 根据项目编码获取最新版本的项目信息 Project project = projectService.getProjectByCode(projectCode); - VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!"); + Assert.notNull(project, "项目不存在!"); // 根据项目类型、预算年度、批复金额、项目标签匹配本区域指标模版 String projectType = project.getProjectType(); Integer projectYear = project.getProjectYear(); BigDecimal approvalAmount = project.getApprovalAmount(); - VUtils.isTrue(Objects.isNull(approvalAmount)).throwMessage("未获取到该项目的立项批复金额"); + Assert.notNull(approvalAmount, "未获取到该项目的立项批复金额"); // 根据项目code获取项目标签ID列表 - List tagIdList = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) + String tagIdStr = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) .eq(ProjectTag::getProjectCode, projectCode)).stream() - .map(ProjectTag::getTagId).collect(Collectors.toList()); - VUtils.isTrue(CollUtil.isEmpty(tagIdList)).throwMessage("当前项目未设置标签,匹配不到指标模板,请至项目库或评价计划编辑页面设置标签!"); - - List strIdList = tagIdList.stream().map(String::valueOf).collect(Collectors.toList()); - String projectTagIds = String.join(StrPool.COMMA, strIdList); - + .map(w -> w.getTagId().toString()).collect(Collectors.joining(",")); + Assert.notEmpty(tagIdStr, "当前项目未设置标签,匹配不到指标模板,请至项目库或评价计划编辑页面设置标签!"); Integer amountRange = null; - if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.FIVE_MILLION)) < 0){ + if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.FIVE_MILLION)) < 0) { amountRange = ProjectBizConst.AMOUNT_RANGE_ONE; } else if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.FIVE_MILLION)) >= 0 && approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.TWENTY_MILLION)) < 0) { amountRange = ProjectBizConst.AMOUNT_RANGE_TWO; - }else if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.TWENTY_MILLION)) >= 0){ + } else if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.TWENTY_MILLION)) >= 0) { amountRange = ProjectBizConst.AMOUNT_RANGE_THREE; } LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class) - .eq(PerformanceIndicatorProjectTemplate::getRegionCode, regionCode) .eq(PerformanceIndicatorProjectTemplate::getProjectType, projectType) .eq(PerformanceIndicatorProjectTemplate::getProjectYear, projectYear) .eq(PerformanceIndicatorProjectTemplate::getAmountRange, amountRange) - .eq(PerformanceIndicatorProjectTemplate::getProjectTagIds,projectTagIds) - .eq(PerformanceIndicatorProjectTemplate::getStatus,CommonEnum.YES.getCode()) + .eq(PerformanceIndicatorProjectTemplate::getProjectTagIds, tagIdStr) + .eq(PerformanceIndicatorProjectTemplate::getStatus, CommonEnum.YES.getCode()) .orderByDesc(PerformanceIndicatorProjectTemplate::getUpdateOn); List templates = indicatorProjectTemplateService.list(wrapper); VUtils.isTrue(CollUtil.isEmpty(templates)).throwMessage("该项目匹配不到指标模板,请返回上一页或者刷新重试。"); - if (templates.size() > 1){ + if (templates.size() > 1) { throw new BizException("当前项目匹配到多个模板,请返回模板库检查模板配置!"); } PerformanceIndicatorProjectTemplate projectTemplate = templates.get(0); @@ -442,7 +438,7 @@ public class OrgSelfAppraisalManage { .orderBy(Boolean.TRUE, Boolean.TRUE, PerformanceAppraisalScoreInfo::getTemplateDetailId)); Map scoreInfoMap = scoreInfoList.stream() .collect(Collectors.toMap(PerformanceAppraisalScoreInfo::getTemplateDetailId, p -> p)); - + // 筛选出所有打分的三级指标模板详情ID for (PerformanceAppraisalScoreInfo scoreInfo : scoreInfoList) { SelfAppraisalScoreExportDTO thirdDto = new SelfAppraisalScoreExportDTO(); @@ -471,7 +467,7 @@ public class OrgSelfAppraisalManage { thirdDto.setSecondIndexName(secondTemplateDetail.getName()); // 一级指标名称 Long firstId = secondTemplateDetail.getParentId(); - if (Objects.nonNull(firstId)){ + if (Objects.nonNull(firstId)) { PerformanceIndicatorProjectTemplateDetail firstTemplateDetail = templateDetailMap.get(firstId); if (Objects.nonNull(firstTemplateDetail)) { thirdDto.setFirstIndexName(firstTemplateDetail.getName()); @@ -481,7 +477,7 @@ public class OrgSelfAppraisalManage { } if (Boolean.FALSE.equals(thirdTemplateDetail.getIsAdditional())) { exportDataList.add(thirdDto); - }else { + } else { exportAdditionalDataList.add(thirdDto); } } @@ -496,14 +492,13 @@ public class OrgSelfAppraisalManage { try { EasyExcel.write(response.getOutputStream(), SelfAppraisalScoreExportDTO.class) .autoCloseStream(false) - .registerWriteHandler(new MultiColumnMergeStrategy(exportDataList.size(),0,1)) - .registerWriteHandler(new ExcelFillCellMergeStrategy(mergeRowIndex,mergeColumnIndex)) + .registerWriteHandler(new MultiColumnMergeStrategy(exportDataList.size(), 0, 1)) + .registerWriteHandler(new ExcelFillCellMergeStrategy(mergeRowIndex, mergeColumnIndex)) .registerWriteHandler(ExcelExportStyle.formalStyle()) .sheet(fileName) .doWrite(exportDataList); } catch (IOException e) { throw new BizException(e); } - } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/PerformanceAppraisalPlanManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/PerformanceAppraisalPlanManage.java index f8e58ba..e8b8e45 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/PerformanceAppraisalPlanManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/PerformanceAppraisalPlanManage.java @@ -1,19 +1,9 @@ package com.hz.pm.api.performance.manage; -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - -import com.hz.pm.api.performance.model.entity.*; -import com.hz.pm.api.performance.service.*; -import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; -import com.hz.pm.api.projectlib.manage.ProjectLibManage; -import com.hz.pm.api.projectlib.model.req.ProjectListReq; -import com.hz.pm.api.projectlib.model.vo.ProjectApplicationVO; -import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.NumberUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -21,29 +11,31 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.basic.util.NdDateUtils; -import com.ningdatech.basic.util.StrPool; +import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.model.constant.CommonConst; -import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.common.util.BizUtils; import com.hz.pm.api.common.util.CodeUtil; import com.hz.pm.api.performance.convert.PerformanceAppraisalConveter; import com.hz.pm.api.performance.enumration.EvalObjectEnum; import com.hz.pm.api.performance.model.dto.*; +import com.hz.pm.api.performance.model.entity.*; import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq; import com.hz.pm.api.performance.model.vo.PerformanceAppraisalApplicationVO; import com.hz.pm.api.performance.model.vo.PerformanceAppraisalProjectGroupVO; import com.hz.pm.api.performance.model.vo.PerformanceAppraisalProjectVO; import com.hz.pm.api.performance.model.vo.PerformanceAppraisalVO; -import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; +import com.hz.pm.api.performance.service.*; +import com.hz.pm.api.projectlib.manage.ProjectLibManage; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.entity.ProjectApplication; import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; +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.ProjectApplicationVO; +import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; import com.hz.pm.api.projectlib.service.IProjectApplicationService; import com.hz.pm.api.projectlib.service.IProjectInstService; import com.hz.pm.api.projectlib.service.IProjectService; @@ -51,15 +43,22 @@ import com.hz.pm.api.todocenter.utils.BuildUserUtils; 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; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.basic.util.StrPool; import com.wflow.workflow.bean.process.ProgressNode; import com.wflow.workflow.bean.vo.ProcessProgressVo; import com.wflow.workflow.service.ProcessInstanceService; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.collection.CollectionUtil; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; /** * @Classname PerformanceAppraisalManage @@ -89,6 +88,7 @@ public class PerformanceAppraisalPlanManage { /** * 绩效列表 + * * @param req * @return */ @@ -96,64 +96,64 @@ public class PerformanceAppraisalPlanManage { Page page = req.page(); String regionCode = req.getRegionCode(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) - .like(StringUtils.isNotBlank(req.getPlanName()),PerformanceAppraisal::getName,req.getPlanName()) - .ge(Objects.nonNull(req.getStart()),PerformanceAppraisal::getCreateOn,req.getStart()) - .le(Objects.nonNull(req.getEnd()),PerformanceAppraisal::getCreateOn,req.getEnd()) - .eq(StringUtils.isNotBlank(regionCode), PerformanceAppraisal::getRegionCode,regionCode) + .like(StringUtils.isNotBlank(req.getPlanName()), PerformanceAppraisal::getName, req.getPlanName()) + .ge(Objects.nonNull(req.getStart()), PerformanceAppraisal::getCreateOn, req.getStart()) + .le(Objects.nonNull(req.getEnd()), PerformanceAppraisal::getCreateOn, req.getEnd()) + .eq(StringUtils.isNotBlank(regionCode), PerformanceAppraisal::getRegionCode, regionCode) .orderByDesc(PerformanceAppraisal::getUpdateOn); // 如果登录用户是区域管理员,能看到本区域的评价计划 - performanceAppraisalService.page(page,wrapper); - if(CollUtil.isEmpty(page.getRecords())){ + performanceAppraisalService.page(page, wrapper); + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } - List paIds = page.getRecords().stream().map(PerformanceAppraisal::getId).collect(Collectors.toList()); + List paIds = page.getRecords().stream().map(PerformanceAppraisal::getId).collect(Collectors.toList()); List paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) .in(PerformanceAppraisalProject::getAppraisalId, paIds)); - Map projectMap = Maps.newHashMap(); - Map> papsGroupMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(paps)){ + Map projectMap = Maps.newHashMap(); + Map> papsGroupMap = Maps.newHashMap(); + if (CollUtil.isNotEmpty(paps)) { papsGroupMap = paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); List projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); List projects = projectService.list(Wrappers.lambdaQuery(Project.class) .in(Project::getProjectCode, projectCodes) .eq(Project::getNewest, Boolean.TRUE)); - if(CollUtil.isNotEmpty(projects)){ - projectMap = projects.stream().collect(Collectors.toMap(Project::getProjectCode,p -> p)); + if (CollUtil.isNotEmpty(projects)) { + projectMap = projects.stream().collect(Collectors.toMap(Project::getProjectCode, p -> p)); } } List paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) .in(PerformanceAppraisalApplication::getAppraisalId, paIds)); - Map applicationMap = Maps.newHashMap(); - Map> paasGroupMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(paas)){ + Map applicationMap = Maps.newHashMap(); + Map> paasGroupMap = Maps.newHashMap(); + if (CollUtil.isNotEmpty(paas)) { paasGroupMap = paas.stream().collect(Collectors.groupingBy(PerformanceAppraisalApplication::getAppraisalId)); List applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); List apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) .in(ProjectApplication::getId, applicationIds)); - if(CollUtil.isNotEmpty(apps)){ - applicationMap = apps.stream().collect(Collectors.toMap(ProjectApplication::getId,a -> a)); + if (CollUtil.isNotEmpty(apps)) { + applicationMap = apps.stream().collect(Collectors.toMap(ProjectApplication::getId, a -> a)); } } Map> finalPapsGroupMap = papsGroupMap; - Map> finalPaasGroupMap = paasGroupMap; - Map finalProjectMap = projectMap; - Map finalApplicationMap = applicationMap; + Map> finalPaasGroupMap = paasGroupMap; + Map finalProjectMap = projectMap; + Map finalApplicationMap = applicationMap; List res = page.getRecords().stream().map(p -> { - PerformanceAppraisalVO vo = BeanUtil.copyProperties(p,PerformanceAppraisalVO.class); - if(finalPapsGroupMap.containsKey(p.getId())){ - vo.setProjects(PerformanceAppraisalConveter.convertProjects(finalPapsGroupMap.get(p.getId()),finalProjectMap)); + PerformanceAppraisalVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalVO.class); + if (finalPapsGroupMap.containsKey(p.getId())) { + vo.setProjects(PerformanceAppraisalConveter.convertProjects(finalPapsGroupMap.get(p.getId()), finalProjectMap)); } - if(finalPaasGroupMap.containsKey(p.getId())){ - vo.setApplications(PerformanceAppraisalConveter.convertApplications(finalPaasGroupMap.get(p.getId()),finalApplicationMap)); + if (finalPaasGroupMap.containsKey(p.getId())) { + vo.setApplications(PerformanceAppraisalConveter.convertApplications(finalPaasGroupMap.get(p.getId()), finalApplicationMap)); } return vo; }).collect(Collectors.toList()); - return PageVo.of(res,page.getTotal()); + return PageVo.of(res, page.getTotal()); } public PerformanceAppraisalVO detail(Long id) { @@ -161,56 +161,56 @@ public class PerformanceAppraisalPlanManage { PerformanceAppraisal pa = performanceAppraisalService.getById(id); VUtils.isTrue(Objects.isNull(pa)).throwMessage("该计划不存在"); - PerformanceAppraisalVO vo = BeanUtil.copyProperties(pa,PerformanceAppraisalVO.class); + PerformanceAppraisalVO vo = BeanUtil.copyProperties(pa, PerformanceAppraisalVO.class); //绩效关联的项目 List paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) .eq(PerformanceAppraisalProject::getAppraisalId, id)); - Map projectMap = Maps.newHashMap(); - Map> papsGroupMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(paps)){ + Map projectMap = Maps.newHashMap(); + Map> papsGroupMap = Maps.newHashMap(); + if (CollUtil.isNotEmpty(paps)) { papsGroupMap = paps.stream().collect(Collectors.groupingBy(PerformanceAppraisalProject::getAppraisalId)); List projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); List projects = projectService.list(Wrappers.lambdaQuery(Project.class) .in(Project::getProjectCode, projectCodes) .eq(Project::getNewest, Boolean.TRUE)); - if(CollUtil.isNotEmpty(projects)){ - projectMap = projects.stream().collect(Collectors.toMap(Project::getProjectCode,p -> p)); + if (CollUtil.isNotEmpty(projects)) { + projectMap = projects.stream().collect(Collectors.toMap(Project::getProjectCode, p -> p)); } } //绩效关联的应用 List paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) .eq(PerformanceAppraisalApplication::getAppraisalId, id)); - Map applicationMap = Maps.newHashMap(); - Map> paasGroupMap = Maps.newHashMap(); - if(CollUtil.isNotEmpty(paas)){ + Map applicationMap = Maps.newHashMap(); + Map> paasGroupMap = Maps.newHashMap(); + if (CollUtil.isNotEmpty(paas)) { paasGroupMap = paas.stream().collect(Collectors.groupingBy(PerformanceAppraisalApplication::getAppraisalId)); List applicationIds = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); List apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) .in(ProjectApplication::getId, applicationIds)); - if(CollUtil.isNotEmpty(apps)){ - applicationMap = apps.stream().collect(Collectors.toMap(ProjectApplication::getId,a -> a)); + if (CollUtil.isNotEmpty(apps)) { + applicationMap = apps.stream().collect(Collectors.toMap(ProjectApplication::getId, a -> a)); } } Map> finalPapsGroupMap = papsGroupMap; - Map> finalPaasGroupMap = paasGroupMap; - Map finalProjectMap = projectMap; - Map finalApplicationMap = applicationMap; - if(finalPapsGroupMap.containsKey(vo.getId())){ - vo.setProjects(PerformanceAppraisalConveter.convertProjects(finalPapsGroupMap.get(vo.getId()),finalProjectMap)); + Map> finalPaasGroupMap = paasGroupMap; + Map finalProjectMap = projectMap; + Map finalApplicationMap = applicationMap; + if (finalPapsGroupMap.containsKey(vo.getId())) { + vo.setProjects(PerformanceAppraisalConveter.convertProjects(finalPapsGroupMap.get(vo.getId()), finalProjectMap)); } - if(finalPaasGroupMap.containsKey(vo.getId())){ - vo.setApplications(PerformanceAppraisalConveter.convertApplications(finalPaasGroupMap.get(vo.getId()),finalApplicationMap)); + if (finalPaasGroupMap.containsKey(vo.getId())) { + vo.setApplications(PerformanceAppraisalConveter.convertApplications(finalPaasGroupMap.get(vo.getId()), finalApplicationMap)); } // 评价计划关联的分组信息 List groupList = groupService.list(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) .eq(PerformanceAppraisalProjectGroup::getAppraisalId, id)); // 对计划内待评价项目进行了分组 - if (CollUtil.isNotEmpty(groupList)){ + if (CollUtil.isNotEmpty(groupList)) { // 获取分组信息 List groups = groupList.stream().map(g -> { PerformanceAppraisalProjectGroupVO groupVo = new PerformanceAppraisalProjectGroupVO(); @@ -219,14 +219,14 @@ public class PerformanceAppraisalPlanManage { groupVo.setName(g.getName()); String reAppraisalUsersStr = g.getReAppraisalUsers(); List reAppraisalUsers = Arrays.stream(reAppraisalUsersStr.split(StrPool.COMMA)) - .map(userInfoHelper::getUserFullInfoByEmployeeCode).collect(Collectors.toList()); + .map(w -> userInfoHelper.getUserFullInfo(Long.parseLong(w))).collect(Collectors.toList()); groupVo.setReAppraisalUsers(reAppraisalUsers); String verificationUsersStr = g.getVerificationUsers(); List verificationUsers = Arrays.stream(verificationUsersStr.split(StrPool.COMMA)) - .map(userInfoHelper::getUserFullInfoByEmployeeCode).collect(Collectors.toList()); + .map(w -> userInfoHelper.getUserFullInfo(Long.parseLong(w))).collect(Collectors.toList()); groupVo.setVerificationUsers(verificationUsers); - if (StringUtils.isNotBlank(g.getVerifyLeader())){ - UserFullInfoDTO dto = userInfoHelper.getUserFullInfoByEmployeeCode(g.getVerifyLeader()); + if (StringUtils.isNotBlank(g.getVerifyLeader())) { + UserFullInfoDTO dto = userInfoHelper.getUserFullInfo(Long.valueOf(g.getVerifyLeader())); groupVo.setVerifyLeader(dto); } groupVo.setCreateOn(g.getCreateOn()); @@ -239,6 +239,7 @@ public class PerformanceAppraisalPlanManage { /** * 新建计划 + * * @param createDTO * @return */ @@ -247,26 +248,25 @@ public class PerformanceAppraisalPlanManage { UserInfoDetails user = LoginUserUtil.loginUserDetail(); // 计划名称重复校验 deduplicationName(createDTO); - PerformanceAppraisal pa = BeanUtil.copyProperties(createDTO,PerformanceAppraisal.class); + PerformanceAppraisal pa = BeanUtil.copyProperties(createDTO, PerformanceAppraisal.class); pa.setCreateOn(LocalDateTime.now()); pa.setCreateBy(user.getUsername()); pa.setUpdateOn(LocalDateTime.now()); pa.setUpdateBy(user.getUsername()); - pa.setRegionCode(user.getRegionCode()); performanceAppraisalService.save(pa); - if(CollUtil.isNotEmpty(createDTO.getProjects()) + if (CollUtil.isNotEmpty(createDTO.getProjects()) && StringUtils.isNotBlank(createDTO.getTarget()) - && createDTO.getTarget().contains(EvalObjectEnum.PROJECT.getCode())){ - saveProjects(createDTO,pa.getId(),user); + && createDTO.getTarget().contains(EvalObjectEnum.PROJECT.getCode())) { + saveProjects(createDTO, pa.getId(), user); } - if(CollUtil.isNotEmpty(createDTO.getApplicationIds()) + if (CollUtil.isNotEmpty(createDTO.getApplicationIds()) && StringUtils.isNotBlank(createDTO.getTarget()) - && createDTO.getTarget().contains(EvalObjectEnum.APP.getCode())){ - saveApplications(createDTO,pa.getId(),user); + && createDTO.getTarget().contains(EvalObjectEnum.APP.getCode())) { + saveApplications(createDTO, pa.getId(), user); } return "新建成功"; @@ -275,6 +275,7 @@ public class PerformanceAppraisalPlanManage { /** * 编辑计划 + * * @param editDTO * @return */ @@ -284,34 +285,34 @@ public class PerformanceAppraisalPlanManage { deduplicationName(editDTO); - PerformanceAppraisal pa = BeanUtil.copyProperties(editDTO,PerformanceAppraisal.class); + PerformanceAppraisal pa = BeanUtil.copyProperties(editDTO, PerformanceAppraisal.class); pa.setUpdateOn(LocalDateTime.now()); pa.setUpdateBy(user.getUsername()); performanceAppraisalService.updateById(pa); String target = editDTO.getTarget(); // 如果新编辑的评价计划不包含项目,删除原计划添加的评价项目信息 - if (StringUtils.isNotBlank(target) && !target.contains(EvalObjectEnum.PROJECT.getCode())){ + if (StringUtils.isNotBlank(target) && !target.contains(EvalObjectEnum.PROJECT.getCode())) { performanceAppraisalProjectService.remove(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .eq(PerformanceAppraisalProject::getAppraisalId,editDTO.getId())); + .eq(PerformanceAppraisalProject::getAppraisalId, editDTO.getId())); } // 如果新编辑的评价计划不包含应用,删除原计划添加的评价应用信息 - if (StringUtils.isNotBlank(target) && !target.contains(EvalObjectEnum.APP.getCode())){ + if (StringUtils.isNotBlank(target) && !target.contains(EvalObjectEnum.APP.getCode())) { performanceAppraisalApplicationService.remove(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) - .eq(PerformanceAppraisalApplication::getAppraisalId,editDTO.getId())); + .eq(PerformanceAppraisalApplication::getAppraisalId, editDTO.getId())); } - if(StringUtils.isNotBlank(target) && + if (StringUtils.isNotBlank(target) && target.contains(EvalObjectEnum.PROJECT.getCode()) && - CollUtil.isNotEmpty(editDTO.getProjects())){ - saveProjects(editDTO,user); + CollUtil.isNotEmpty(editDTO.getProjects())) { + saveProjects(editDTO, user); } - if(StringUtils.isNotBlank(target) && + if (StringUtils.isNotBlank(target) && target.contains(EvalObjectEnum.APP.getCode()) && - CollUtil.isNotEmpty(editDTO.getApplicationIds())){ - saveApplications(editDTO,user); + CollUtil.isNotEmpty(editDTO.getApplicationIds())) { + saveApplications(editDTO, user); } return "编辑成功"; @@ -319,6 +320,7 @@ public class PerformanceAppraisalPlanManage { /** * 名称去重 + * * @param dto */ private void deduplicationName(PerformanceAppraisalCreateDTO dto) { @@ -328,17 +330,17 @@ public class PerformanceAppraisalPlanManage { } private void deduplicationName(PerformanceAppraisalEditDTO dto) { - if(StringUtils.isNotBlank(dto.getName())){ - long count =performanceAppraisalService.count(Wrappers.lambdaQuery(PerformanceAppraisal.class) - .eq(PerformanceAppraisal::getName,dto.getName()) - .ne(Objects.nonNull(dto.getId()),PerformanceAppraisal::getId,dto.getId())); + if (StringUtils.isNotBlank(dto.getName())) { + long count = performanceAppraisalService.count(Wrappers.lambdaQuery(PerformanceAppraisal.class) + .eq(PerformanceAppraisal::getName, dto.getName()) + .ne(Objects.nonNull(dto.getId()), PerformanceAppraisal::getId, dto.getId())); VUtils.isTrue(count > 0).throwMessage("名称已经存在"); } } @Transactional - public void saveProjects(PerformanceAppraisalCreateDTO createDTO,Long id,UserInfoDetails user) { - if(CollUtil.isEmpty(createDTO.getProjects())){ + public void saveProjects(PerformanceAppraisalCreateDTO createDTO, Long id, UserInfoDetails user) { + if (CollUtil.isEmpty(createDTO.getProjects())) { return; } Integer startSelfDays = createDTO.getStartSelfDays(); @@ -350,7 +352,7 @@ public class PerformanceAppraisalPlanManage { List projectIdList = projects.stream().map(AppraisalProjectDTO::getId).collect(Collectors.toList()); // 判断提交时,项目是否已经被添加到其他评价计划中 - if (Boolean.TRUE.equals(haveIntersection(projectIdList, proIdList))){ + if (Boolean.TRUE.equals(haveIntersection(projectIdList, proIdList))) { // 得到交集 List intersection = Lists.newArrayList(projectIdList); intersection.retainAll(proIdList); @@ -365,7 +367,7 @@ public class PerformanceAppraisalPlanManage { throw new BizException(names + CommonConst.PROJECT_REPEAT); } - for(AppraisalProjectDTO appraisalProject : projects){ + for (AppraisalProjectDTO appraisalProject : projects) { Project newProject = projectService.getNewProject(appraisalProject.getId()); VUtils.isTrue(Objects.isNull(newProject)).throwMessage("项目不存在 " + appraisalProject.getId()); // 获取项目终验完成的时间 @@ -399,7 +401,7 @@ public class PerformanceAppraisalPlanManage { .orderByDesc(ProjectInst::getCreatOn) .last(BizConst.LIMIT_1)); - if (Objects.isNull(projectInst)){ + if (Objects.isNull(projectInst)) { throw new BizException("未获取到项目终验审批流程信息!"); } @@ -412,15 +414,15 @@ public class PerformanceAppraisalPlanManage { buildUserUtils.buildUserByProcessInfo(progressInfo); ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); - }else { + } else { finishTime = NdDateUtils.date2LocalDateTime(instanceDetail.getStartTime()); } return finishTime; } @Transactional - public void saveApplications(PerformanceAppraisalCreateDTO createDTO,Long id,UserInfoDetails user) { - if(CollUtil.isEmpty(createDTO.getApplicationIds())){ + public void saveApplications(PerformanceAppraisalCreateDTO createDTO, Long id, UserInfoDetails user) { + if (CollUtil.isEmpty(createDTO.getApplicationIds())) { return; } @@ -430,7 +432,7 @@ public class PerformanceAppraisalPlanManage { .map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); // 如果有交集,说明选择的应用中,有已经在其他评价计划中的应用 - if (Boolean.TRUE.equals(haveIntersection(applicationIdList, applicationIds))){ + if (Boolean.TRUE.equals(haveIntersection(applicationIdList, applicationIds))) { // 得到交集 List intersection = Lists.newArrayList(applicationIdList); intersection.retainAll(applicationIds); @@ -449,12 +451,12 @@ public class PerformanceAppraisalPlanManage { Map applicationMap = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) .in(ProjectApplication::getId, applicationIdList)).stream() .collect(Collectors.toMap(ProjectApplication::getId, a -> a)); - for(Long applicationId : applicationIdList){ + for (Long applicationId : applicationIdList) { PerformanceAppraisalApplication paa = new PerformanceAppraisalApplication(); paa.setAppraisalId(id); paa.setApplicationId(applicationId); ProjectApplication projectApplication = applicationMap.get(applicationId); - if (Objects.nonNull(projectApplication)){ + if (Objects.nonNull(projectApplication)) { paa.setAppraisalProjectId(projectApplication.getProjectId()); paa.setAppraisalProjectCode(projectApplication.getProjectCode()); } @@ -467,29 +469,29 @@ public class PerformanceAppraisalPlanManage { } @Transactional - public void saveProjects(PerformanceAppraisalEditDTO editDTO,UserInfoDetails user) { - if(Objects.isNull(editDTO.getProjects())){ + public void saveProjects(PerformanceAppraisalEditDTO editDTO, UserInfoDetails user) { + if (Objects.isNull(editDTO.getProjects())) { return; } // 删除计划内的项目 performanceAppraisalProjectService.remove(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .eq(PerformanceAppraisalProject::getAppraisalId,editDTO.getId())); + .eq(PerformanceAppraisalProject::getAppraisalId, editDTO.getId())); // 删除项目的打分信息 List projectIds = editDTO.getProjects().stream().map(AppraisalProjectDTO::getId).collect(Collectors.toList()); - if (CollUtil.isEmpty(projectIds)){ + if (CollUtil.isEmpty(projectIds)) { throw new BizException("请选择至少一个评价项目!"); } List projectCodes = projectService.listByIds(projectIds).stream().map(Project::getProjectCode).collect(Collectors.toList()); // 删除项目的打分信息 performanceAppraisalScoreInfoService.remove(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) - .eq(PerformanceAppraisalScoreInfo::getAppraisalId,editDTO.getId()) - .in(PerformanceAppraisalScoreInfo::getAppraisalProjectCode,projectCodes)); + .eq(PerformanceAppraisalScoreInfo::getAppraisalId, editDTO.getId()) + .in(PerformanceAppraisalScoreInfo::getAppraisalProjectCode, projectCodes)); Integer startSelfDays = editDTO.getStartSelfDays(); Integer completeSelfDays = editDTO.getCompleteSelfDays(); List projects = editDTO.getProjects(); - for(AppraisalProjectDTO appraisalProject : projects){ + for (AppraisalProjectDTO appraisalProject : projects) { Project newProject = projectService.getNewProject(appraisalProject.getId()); VUtils.isTrue(Objects.isNull(newProject)).throwMessage("项目不存在 " + appraisalProject.getId()); // 获取项目终验完成的时间 @@ -513,32 +515,32 @@ public class PerformanceAppraisalPlanManage { } @Transactional - public void saveApplications(PerformanceAppraisalEditDTO editDTO,UserInfoDetails user) { - if(Objects.isNull(editDTO.getApplicationIds())){ + public void saveApplications(PerformanceAppraisalEditDTO editDTO, UserInfoDetails user) { + if (Objects.isNull(editDTO.getApplicationIds())) { return; } // 删除计划内的应用 performanceAppraisalApplicationService.remove(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) - .eq(PerformanceAppraisalApplication::getAppraisalId,editDTO.getId())); + .eq(PerformanceAppraisalApplication::getAppraisalId, editDTO.getId())); // 删除计划内应用的打分信息 List applicationIdList = editDTO.getApplicationIds(); - if (CollUtil.isEmpty(applicationIdList)){ + if (CollUtil.isEmpty(applicationIdList)) { throw new BizException("请选择至少一个应用!"); } // 删除应用的打分信息 performanceAppraisalAppScoreInfoService.remove(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) - .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId,editDTO.getId()) - .in(PerformanceAppraisalAppScoreInfo::getApplicationId,applicationIdList)); + .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, editDTO.getId()) + .in(PerformanceAppraisalAppScoreInfo::getApplicationId, applicationIdList)); Map applicationMap = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) .in(ProjectApplication::getId, applicationIdList)).stream() .collect(Collectors.toMap(ProjectApplication::getId, a -> a)); - for(Long applicationId : applicationIdList){ + for (Long applicationId : applicationIdList) { PerformanceAppraisalApplication paa = new PerformanceAppraisalApplication(); paa.setAppraisalId(editDTO.getId()); paa.setApplicationId(applicationId); ProjectApplication projectApplication = applicationMap.get(applicationId); - if (Objects.nonNull(projectApplication)){ + if (Objects.nonNull(projectApplication)) { paa.setAppraisalProjectId(projectApplication.getProjectId()); paa.setAppraisalProjectCode(projectApplication.getProjectCode()); } @@ -553,6 +555,7 @@ public class PerformanceAppraisalPlanManage { /** * 删除绩效评价计划 * 连带删除 其下所有 + * * @param id * @return */ @@ -563,17 +566,17 @@ public class PerformanceAppraisalPlanManage { // 获取评价计划内的待评价项目信息,并按自评开始时间排序 List paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) .eq(PerformanceAppraisalProject::getAppraisalId, id) - .orderBy(Boolean.TRUE,Boolean.TRUE,PerformanceAppraisalProject::getSelfAppraisalStart)); + .orderBy(Boolean.TRUE, Boolean.TRUE, PerformanceAppraisalProject::getSelfAppraisalStart)); // 获取计划内项目的自评开始时间 Optional min = paps.stream().map(PerformanceAppraisalProject::getSelfAppraisalStart).min(LocalDateTime::compareTo); - if (min.isPresent()){ + if (min.isPresent()) { // 比较当前时间与自评开始时间最小值 - if (LocalDateTime.now().isAfter(min.get())){ + if (LocalDateTime.now().isAfter(min.get())) { throw new BizException("评价计划内已有项目到达自评时间,无法删除!"); } } - if(performanceAppraisalService.removeById(id)){ + if (performanceAppraisalService.removeById(id)) { // 删除评价计划关联的项目 //绩效关联的项目 if (CollUtil.isNotEmpty(paps)) { @@ -586,7 +589,6 @@ public class PerformanceAppraisalPlanManage { if (CollUtil.isNotEmpty(scoreInfos)) { performanceAppraisalScoreInfoService.removeBatchByIds(scoreInfos); } - } // 删除评价计划关联的应用 //绩效关联的应用 @@ -606,56 +608,52 @@ public class PerformanceAppraisalPlanManage { } // 删除评级计划关联的分组信息 groupService.remove(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) - .eq(PerformanceAppraisalProjectGroup::getAppraisalId,id)); + .eq(PerformanceAppraisalProjectGroup::getAppraisalId, id)); return "删除成功"; } return "删除失败"; } - public List groupList(Long appraisalId,String name) { + public List groupList(Long appraisalId, String name) { List groups = groupService.list( Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) .eq(PerformanceAppraisalProjectGroup::getAppraisalId, appraisalId) - .like(StringUtils.isNotBlank(name),PerformanceAppraisalProjectGroup::getName,name) + .like(StringUtils.isNotBlank(name), PerformanceAppraisalProjectGroup::getName, name) .orderByDesc(PerformanceAppraisalProjectGroup::getCreateOn)); - if(CollUtil.isEmpty(groups)){ + if (CollUtil.isEmpty(groups)) { return Collections.emptyList(); } Set allEmployeeCodes = Sets.newHashSet(); Set projectCodes = Sets.newHashSet(); - Map userMap = Maps.newHashMap(); + Map userMap = Maps.newHashMap(); Map projectMap = Maps.newHashMap(); - groups.stream().forEach(g -> { + groups.forEach(g -> { allEmployeeCodes.addAll(CodeUtil.convertStrToList(g.getReAppraisalUsers())); allEmployeeCodes.addAll(CodeUtil.convertStrToList(g.getVerificationUsers())); projectCodes.addAll(CodeUtil.convertStrToList(g.getProjectCodes())); }); - if(CollUtil.isNotEmpty(allEmployeeCodes)){ + if (CollUtil.isNotEmpty(allEmployeeCodes)) { List users = Lists.newArrayList(); for (String employeeCode : allEmployeeCodes) { - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(Long.parseLong(employeeCode)); users.add(userFullInfo); } - if(CollUtil.isNotEmpty(users)){ - userMap = users.stream().collect(Collectors.toMap(UserFullInfoDTO::getEmployeeCode,u -> u)); - } + users.forEach(w -> userMap.put(w.getUserId(), w)); } - if(CollUtil.isNotEmpty(projectCodes)){ + if (CollUtil.isNotEmpty(projectCodes)) { List projects = projectService.list(Wrappers.lambdaQuery(Project.class) - .in(Project::getProjectCode,projectCodes) - .eq(Project::getNewest,Boolean.TRUE)); - if(CollUtil.isNotEmpty(projects)){ - projectMap = projects.stream().collect(Collectors.toMap(Project::getProjectCode,p -> p)); + .in(Project::getProjectCode, projectCodes) + .eq(Project::getNewest, Boolean.TRUE)); + if (CollUtil.isNotEmpty(projects)) { + projects.forEach(w -> projectMap.put(w.getProjectCode(), w)); } } - Map finalProjectMap = projectMap; - Map finalUserMap = userMap; return groups.stream().map(g -> { - PerformanceAppraisalProjectGroupVO vo = new PerformanceAppraisalProjectGroupVO(); + PerformanceAppraisalProjectGroupVO vo = new PerformanceAppraisalProjectGroupVO(); vo.setAppraisalId(g.getAppraisalId()); vo.setName(g.getName()); vo.setCreateOn(g.getCreateOn()); @@ -663,11 +661,11 @@ public class PerformanceAppraisalPlanManage { vo.setUpdateBy(g.getUpdateBy()); vo.setUpdateOn(g.getUpdateOn()); vo.setId(g.getId()); - vo.setProjects(checkProject(g.getProjectCodes(), finalProjectMap)); - vo.setReAppraisalUsers(checkUser(g.getReAppraisalUsers(), finalUserMap)); - vo.setVerificationUsers(checkUser(g.getVerificationUsers(), finalUserMap)); - if (StringUtils.isNotBlank(g.getVerifyLeader())){ - UserFullInfoDTO userFullInfoDto = finalUserMap.get(g.getVerifyLeader()); + vo.setProjects(checkProject(g.getProjectCodes(), projectMap)); + vo.setReAppraisalUsers(checkUser(g.getReAppraisalUsers(), userMap)); + vo.setVerificationUsers(checkUser(g.getVerificationUsers(), userMap)); + if (StringUtils.isNotBlank(g.getVerifyLeader())) { + UserFullInfoDTO userFullInfoDto = userMap.get(Long.parseLong(g.getVerifyLeader())); vo.setVerifyLeader(userFullInfoDto); } return vo; @@ -676,38 +674,36 @@ public class PerformanceAppraisalPlanManage { /** * 分组详情 + * * @param id * @return */ public PerformanceAppraisalProjectGroupVO groupDetail(Long id) { PerformanceAppraisalProjectGroup group = groupService.getById(id); - - if(Objects.isNull(group)){ + if (Objects.isNull(group)) { return null; } Map projectMap = Maps.newHashMap(); List projects = projectService.list(Wrappers.lambdaQuery(Project.class) - .in(StringUtils.isNotBlank(group.getProjectCodes()),Project::getProjectCode, - Arrays.stream(group.getProjectCodes().split(StrPool.COMMA)).collect(Collectors.toList())) - .eq(Project::getNewest,Boolean.TRUE)); - if(CollUtil.isNotEmpty(projects)){ - projectMap = projects.stream().collect(Collectors.toMap(Project::getProjectCode,p -> p)); + .in(StringUtils.isNotBlank(group.getProjectCodes()), + Project::getProjectCode, Arrays.stream(group.getProjectCodes() + .split(StrPool.COMMA)).collect(Collectors.toList())) + .eq(Project::getNewest, Boolean.TRUE)); + if (CollUtil.isNotEmpty(projects)) { + projects.forEach(w -> projectMap.put(w.getProjectCode(), w)); } - Map userMap = Maps.newHashMap(); + Map userMap = Maps.newHashMap(); Set allEmployeeCodes = Sets.newHashSet(); allEmployeeCodes.addAll(CodeUtil.convertStrToList(group.getReAppraisalUsers())); allEmployeeCodes.addAll(CodeUtil.convertStrToList(group.getVerificationUsers())); - if(CollUtil.isNotEmpty(allEmployeeCodes)){ + if (CollUtil.isNotEmpty(allEmployeeCodes)) { List users = Lists.newArrayList(); for (String employeeCode : allEmployeeCodes) { - UserFullInfoDTO userFullInfoDto = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); - users.add(userFullInfoDto); - } - if(CollUtil.isNotEmpty(users)){ - userMap = users.stream().collect(Collectors.toMap(UserFullInfoDTO::getEmployeeCode,u -> u)); + users.add(userInfoHelper.getUserFullInfo(Long.valueOf(employeeCode))); } + users.forEach(w -> userMap.put(w.getUserId(), w)); } PerformanceAppraisalProjectGroupVO vo = new PerformanceAppraisalProjectGroupVO(); @@ -721,8 +717,8 @@ public class PerformanceAppraisalPlanManage { vo.setProjects(checkProject(group.getProjectCodes(), projectMap)); vo.setReAppraisalUsers(checkUser(group.getReAppraisalUsers(), userMap)); vo.setVerificationUsers(checkUser(group.getVerificationUsers(), userMap)); - if (StringUtils.isNotBlank(group.getVerifyLeader())){ - UserFullInfoDTO dto = userMap.get(group.getVerifyLeader()); + if (StringUtils.isNotBlank(group.getVerifyLeader())) { + UserFullInfoDTO dto = userMap.get(Long.parseLong(group.getVerifyLeader())); vo.setVerifyLeader(dto); } return vo; @@ -730,6 +726,7 @@ public class PerformanceAppraisalPlanManage { /** * 分组 保存 + * * @param dto * @return */ @@ -740,11 +737,11 @@ public class PerformanceAppraisalPlanManage { // 获取当前评价计划内的分组信息 List groupList = groupService.list(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) .eq(PerformanceAppraisalProjectGroup::getAppraisalId, dto.getAppraisalId())); - if(Objects.isNull(dto.getId())){ + if (Objects.isNull(dto.getId())) { group.setId(null); group.setCreateOn(LocalDateTime.now()); group.setCreateBy(user.getUsername()); - }else{ + } else { // 编辑分组 PerformanceAppraisalProjectGroup old = groupService.getById(dto.getId()); VUtils.isTrue(Objects.isNull(old)).throwMessage("该分组不存在 编辑失败!"); @@ -752,7 +749,7 @@ public class PerformanceAppraisalPlanManage { // 先删除旧的分组 groupList.remove(old); } - if(CollUtil.isNotEmpty(dto.getProjectCodes())){ + if (CollUtil.isNotEmpty(dto.getProjectCodes())) { // 判断选择的项目是否已经在当前评价计划的其他分组内 // 获取当前评价计划的其他分组的项目信息 List projectCodeList = groupList.stream() @@ -760,17 +757,17 @@ public class PerformanceAppraisalPlanManage { .collect(Collectors.toList()); List compareCodes = Lists.newArrayList(); for (String projectCode : projectCodeList) { - if (projectCode.contains(StrPool.COMMA)){ + if (projectCode.contains(StrPool.COMMA)) { List codes = Arrays.asList(projectCode.split(StrPool.COMMA)); compareCodes.addAll(codes); - }else { + } else { compareCodes.add(projectCode); } } - checkProjectCodes(dto.getProjectCodes(),compareCodes); + checkProjectCodes(dto.getProjectCodes(), compareCodes); group.setProjectCodes(String.join(StrPool.COMMA, dto.getProjectCodes())); } - if(CollUtil.isNotEmpty(dto.getReAppraisalUsers())){ + if (CollUtil.isNotEmpty(dto.getReAppraisalUsers())) { // 判断选择的复评人员是否已经在当前评价计划的其他分组内 // 获取当前评价计划的其他分组的复评人员信息 List reUserList = groupList.stream() @@ -778,17 +775,17 @@ public class PerformanceAppraisalPlanManage { .collect(Collectors.toList()); List compareUsers = Lists.newArrayList(); for (String reUser : reUserList) { - if (reUser.contains(StrPool.COMMA)){ + if (reUser.contains(StrPool.COMMA)) { List users = Arrays.asList(reUser.split(StrPool.COMMA)); compareUsers.addAll(users); - }else { + } else { compareUsers.add(reUser); } } - checkReAppraisalAndVerifyUsers(dto.getReAppraisalUsers(),compareUsers,CommonConst.REAPPRAISAL_TYPE); + checkReAppraisalAndVerifyUsers(dto.getReAppraisalUsers(), compareUsers, CommonConst.REAPPRAISAL_TYPE); group.setReAppraisalUsers(String.join(StrPool.COMMA, dto.getReAppraisalUsers())); } - if(CollUtil.isNotEmpty(dto.getVerificationUsers())){ + if (CollUtil.isNotEmpty(dto.getVerificationUsers())) { // 判断选择的核查人员是否已经在当前评价计划的其他分组内 // 获取当前评价计划的其他分组的核查人员信息 List verifyList = groupList.stream() @@ -796,14 +793,14 @@ public class PerformanceAppraisalPlanManage { .collect(Collectors.toList()); List compareUsers = Lists.newArrayList(); for (String verifyUser : verifyList) { - if (verifyUser.contains(StrPool.COMMA)){ + if (verifyUser.contains(StrPool.COMMA)) { List users = Arrays.asList(verifyUser.split(StrPool.COMMA)); compareUsers.addAll(users); - }else { + } else { compareUsers.add(verifyUser); } } - checkReAppraisalAndVerifyUsers(dto.getVerificationUsers(),compareUsers,CommonConst.VERIFY_TYPE); + checkReAppraisalAndVerifyUsers(dto.getVerificationUsers(), compareUsers, CommonConst.VERIFY_TYPE); group.setVerificationUsers(String.join(StrPool.COMMA, dto.getVerificationUsers())); } group.setUpdateOn(LocalDateTime.now()); @@ -815,13 +812,13 @@ public class PerformanceAppraisalPlanManage { private void checkProjectCodes(List projectCodes, List projectCodeList) { // 判断选择的项目是否已经在当前评价计划的其他分组内 // 如果提交的项目在该评价计划其他分组中 - if (!CollectionUtil.intersection(projectCodes,projectCodeList).isEmpty()){ + if (!CollectionUtil.intersection(projectCodes, projectCodeList).isEmpty()) { ArrayList proCodes = Lists.newArrayList(projectCodes); proCodes.retainAll(projectCodeList); // 获取重复添加的项目Code String names = proCodes.stream().map(i -> { Project project = projectService.getProjectByCode(i); - if (Objects.nonNull(project)){ + if (Objects.nonNull(project)) { return project.getProjectName(); } return StrPool.EMPTY; @@ -832,20 +829,20 @@ public class PerformanceAppraisalPlanManage { private void checkReAppraisalAndVerifyUsers(List checkUsers, List compareUsers, Integer type) { // 如果提交的复评/核查人员在该评价计划其他分组中 - if (!CollectionUtil.intersection(checkUsers,compareUsers).isEmpty()){ + if (!CollectionUtil.intersection(checkUsers, compareUsers).isEmpty()) { ArrayList reUsers = Lists.newArrayList(checkUsers); reUsers.retainAll(compareUsers); // 获取重复添加的复评/核查人员名字 String names = reUsers.stream().map(i -> { - UserFullInfoDTO info = userInfoHelper.getUserFullInfoByEmployeeCode(i); - if (Objects.nonNull(info)){ + UserFullInfoDTO info = userInfoHelper.getUserFullInfo(Long.valueOf(i)); + if (Objects.nonNull(info)) { return info.getUsername(); } return StrPool.EMPTY; }).collect(Collectors.joining(StrPool.COMMA)); if (CommonConst.REAPPRAISAL_TYPE.equals(type)) { throw new BizException("复评人员:" + names + CommonConst.REPEAT); - }else if (CommonConst.VERIFY_TYPE.equals(type)){ + } else if (CommonConst.VERIFY_TYPE.equals(type)) { throw new BizException("核查人员:" + names + CommonConst.REPEAT); } } @@ -853,6 +850,7 @@ public class PerformanceAppraisalPlanManage { /** * 删除分组 + * * @param id * @return */ @@ -866,19 +864,19 @@ public class PerformanceAppraisalPlanManage { PerformanceAppraisal pa = performanceAppraisalService.getById(appraisalId); VUtils.isTrue(Objects.isNull(pa)).throwMessage("评价不存在"); - if(groupService.removeById(id)){ + if (groupService.removeById(id)) { return "删除成功"; } return "删除失败"; } private List checkProject(String projectIds, Map projectMap) { - if(StringUtils.isBlank(projectIds)){ + if (StringUtils.isBlank(projectIds)) { return Collections.emptyList(); } return Arrays.stream(projectIds.split(StrPool.COMMA)).map(projectCode -> { PerformanceAppraisalProjectVO vo = new PerformanceAppraisalProjectVO(); - if(projectMap.containsKey(projectCode)){ + if (projectMap.containsKey(projectCode)) { Project project = projectMap.get(projectCode); vo.setProjectName(project.getProjectName()); vo.setProjectTypeName(BizUtils.getProjectTypeName(project.getProjectType())); @@ -892,33 +890,33 @@ public class PerformanceAppraisalPlanManage { }).collect(Collectors.toList()); } - private List checkUser(String users, Map userMap) { - if(StringUtils.isBlank(users)){ + private List checkUser(String users, Map userMap) { + if (StringUtils.isBlank(users)) { return Collections.emptyList(); } - return Arrays.stream(users.split(StrPool.COMMA)).map(userMap::get).collect(Collectors.toList()); + return Arrays.stream(users.split(StrPool.COMMA)) + .filter(NumberUtil::isLong) + .map(w -> userMap.get(Long.parseLong(w))) + .collect(Collectors.toList()); } public PageVo applicationList(PerformanceAppraisalListReq req) { Page page = req.page(); // 获取登录用户所在区域已验收项目 - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - String regionCode = user.getRegionCode(); List projects = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getAreaCode,regionCode) .eq(Project::getStatus, ProjectStatusEnum.ACCEPTED.getCode()) .eq(Project::getNewest, Boolean.TRUE)); // 获取已验收项目关联的应用信息 List projectVersions = projects.stream().map(Project::getVersion).collect(Collectors.toList()); List projectCodes = projects.stream().map(Project::getProjectCode).collect(Collectors.toList()); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectApplication.class) - .like(StringUtils.isNotBlank(req.getApplicationName()),ProjectApplication::getApplicationName,req.getApplicationName()) - .like(StringUtils.isNotBlank(req.getBuildOrgName()),ProjectApplication::getBuildOrgName,req.getBuildOrgName()) - .in(ProjectApplication::getProjectCode,projectCodes) - .in(ProjectApplication::getProjectVersion,projectVersions) + .like(StringUtils.isNotBlank(req.getApplicationName()), ProjectApplication::getApplicationName, req.getApplicationName()) + .like(StringUtils.isNotBlank(req.getBuildOrgName()), ProjectApplication::getBuildOrgName, req.getBuildOrgName()) + .in(ProjectApplication::getProjectCode, projectCodes) + .in(ProjectApplication::getProjectVersion, projectVersions) .orderByDesc(ProjectApplication::getCreateOn); - applicationService.page(page,wrapper); - if(CollUtil.isEmpty(page.getRecords())){ + applicationService.page(page, wrapper); + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } List res = page.getRecords().stream().map(r -> { @@ -933,12 +931,12 @@ public class PerformanceAppraisalPlanManage { vo.setPublishSide(r.getPublishSide()); return vo; }).collect(Collectors.toList()); - return PageVo.of(res,page.getTotal()); + return PageVo.of(res, page.getTotal()); } public String addProject(AddAppraisalObjectDTO addDTO) { List projectIdList = addDTO.getProjectIds(); - if (CollUtil.isEmpty(projectIdList)){ + if (CollUtil.isEmpty(projectIdList)) { throw new BizException("请选择至少一个评价项目!"); } // 获取已经创建的评价计划中添加的评价项目ID @@ -947,7 +945,7 @@ public class PerformanceAppraisalPlanManage { Long appraisalId = addDTO.getAppraisalId(); // 如果评价计划不为空,说明是编辑评价计划, // 评价计划中原来已经勾选的待评价项目,不作为判断重复添加的内容 - if (Objects.nonNull(appraisalId)){ + if (Objects.nonNull(appraisalId)) { // 获取当前编辑的评价计划中选择的项目 List proIds = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) .eq(PerformanceAppraisalProject::getAppraisalId, appraisalId)).stream() @@ -956,7 +954,7 @@ public class PerformanceAppraisalPlanManage { projectIds.removeAll(proIds); } // 如果有交集,说明选择的项目中,有已经在其他评价计划中的项目 - if (Boolean.TRUE.equals(haveIntersection(projectIdList, projectIds))){ + if (Boolean.TRUE.equals(haveIntersection(projectIdList, projectIds))) { // 得到交集 List intersection = Lists.newArrayList(projectIdList); intersection.retainAll(projectIds); @@ -976,7 +974,7 @@ public class PerformanceAppraisalPlanManage { public String addApplication(AddAppraisalObjectDTO addDTO) { List applicationIdList = addDTO.getApplicationIds(); - if (CollUtil.isEmpty(applicationIdList)){ + if (CollUtil.isEmpty(applicationIdList)) { throw new BizException("请选择至少一个评应用!"); } // 获取已经创建的评价计划中添加的评价应用ID @@ -985,7 +983,7 @@ public class PerformanceAppraisalPlanManage { Long appraisalId = addDTO.getAppraisalId(); // 如果评价计划不为空,说明是编辑评价计划, // 评价计划中原来已经勾选的待评价应用,不作为判断重复添加的内容 - if (Objects.nonNull(appraisalId)){ + if (Objects.nonNull(appraisalId)) { // 获取当前编辑的评价计划中选择的应用 List appIds = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) .eq(PerformanceAppraisalApplication::getAppraisalId, appraisalId)).stream() @@ -994,7 +992,7 @@ public class PerformanceAppraisalPlanManage { applicationIds.removeAll(appIds); } // 如果有交集,说明选择的应用中,有已经在其他评价计划中的应用 - if (Boolean.TRUE.equals(haveIntersection(applicationIdList, applicationIds))){ + if (Boolean.TRUE.equals(haveIntersection(applicationIdList, applicationIds))) { // 得到交集 List intersection = Lists.newArrayList(applicationIdList); intersection.retainAll(applicationIds); @@ -1025,7 +1023,7 @@ public class PerformanceAppraisalPlanManage { List appraisalProjectList = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) .eq(PerformanceAppraisalProject::getAppraisalId, appraisalId)); List projectCodes = appraisalProjectList.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); - if (CollUtil.isEmpty(projectCodes)){ + if (CollUtil.isEmpty(projectCodes)) { return PageVo.empty(); } LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class) @@ -1033,12 +1031,12 @@ public class PerformanceAppraisalPlanManage { .eq(Project::getNewest, Boolean.TRUE); // 如果对项目名称进行模糊查询 - if (StringUtils.isNotBlank(projectName) && StringUtils.isBlank(buildOrgName)){ - wrapper.like(Project::getProjectName,projectName); + if (StringUtils.isNotBlank(projectName) && StringUtils.isBlank(buildOrgName)) { + wrapper.like(Project::getProjectName, projectName); } // 如果对申报单位进行模糊查询 else if (StringUtils.isNotBlank(buildOrgName) && StringUtils.isBlank(projectName)) { - wrapper.like(Project::getBuildOrgName,buildOrgName); + wrapper.like(Project::getBuildOrgName, buildOrgName); } // 同时对项目名称和申报单位进行模糊查询 else if (StringUtils.isNotBlank(projectName) && StringUtils.isNotBlank(buildOrgName)) { @@ -1046,7 +1044,7 @@ public class PerformanceAppraisalPlanManage { .like(Project::getBuildOrgName, buildOrgName); } List projects = projectService.list(wrapper); - if (CollUtil.isEmpty(projects)){ + if (CollUtil.isEmpty(projects)) { return PageVo.empty(); } List voList = projects.stream().map(p -> { @@ -1055,7 +1053,7 @@ public class PerformanceAppraisalPlanManage { appraisalProjectVo.setProjectTypeName(ProjectTypeNewEnum.getDesc(p.getProjectType())); return appraisalProjectVo; }).collect(Collectors.toList()); - return PageVo.of(voList,voList.size()); + return PageVo.of(voList, voList.size()); } public PageVo finalProjectList(PerformanceAppraisalListReq req) { @@ -1073,7 +1071,6 @@ public class PerformanceAppraisalPlanManage { param.setBuildOrgName(buildOrgName); param.setProjectType(projectType); param.setProjectYear(projectYear); - param.setRegionCode(user.getRegionCode()); param.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); // 获取已添加到评价计划中的项目 List projectCodes = performanceAppraisalProjectService.list().stream() @@ -1082,19 +1079,17 @@ public class PerformanceAppraisalPlanManage { if (Objects.nonNull(appraisalId)) { List projects = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) .eq(PerformanceAppraisalProject::getAppraisalId, appraisalId)); - if (CollUtil.isNotEmpty(projects)){ + if (CollUtil.isNotEmpty(projects)) { List projectCodeList = projects.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); projectCodes.removeAll(projectCodeList); } } // 过滤掉已经添加到评价计划中的项目(如果是编辑评价计划,保留当前计划已添加的项目) param.setProjectCodes(projectCodes); - return projectLibManage.projectLibListWithPermission(param, user); + return projectLibManage.projectLibListWithPermission(param, user); } public PageVo finalApplicationList(PerformanceAppraisalListReq req) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String regionCode = user.getRegionCode(); Long appraisalId = req.getAppraisalId(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectApplication.class) @@ -1106,19 +1101,18 @@ public class PerformanceAppraisalPlanManage { } // 获取本区域已验收的项目关联的应用 List projectList = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getAreaCode, regionCode) - .eq(Project::getNewest,Boolean.TRUE) + .eq(Project::getNewest, Boolean.TRUE) .eq(Project::getStatus, ProjectStatusEnum.ACCEPTED.getCode())); - if (CollUtil.isEmpty(projectList)){ + if (CollUtil.isEmpty(projectList)) { return PageVo.empty(); } List projectCodeList = projectList.stream().map(Project::getProjectCode).collect(Collectors.toList()); List projectVersionList = projectList.stream().map(Project::getVersion).collect(Collectors.toList()); - wrapper.in(ProjectApplication::getProjectCode,projectCodeList); - wrapper.in(ProjectApplication::getProjectVersion,projectVersionList); + wrapper.in(ProjectApplication::getProjectCode, projectCodeList); + wrapper.in(ProjectApplication::getProjectVersion, projectVersionList); wrapper.orderByDesc(ProjectApplication::getUpdateOn); List appList = projectApplicationService.list(wrapper); - if (CollUtil.isEmpty(appList)){ + if (CollUtil.isEmpty(appList)) { return PageVo.empty(); } @@ -1129,12 +1123,12 @@ public class PerformanceAppraisalPlanManage { for (Map.Entry> entry : appMap.entrySet()) { List applications = entry.getValue(); Optional max = applications.stream().max(Comparator.comparingInt(ProjectApplication::getProjectVersion)); - if (max.isPresent()){ + if (max.isPresent()) { ProjectApplication application = max.get(); applicationList.add(application); } } - if (CollUtil.isEmpty(applicationList)){ + if (CollUtil.isEmpty(applicationList)) { return PageVo.empty(); } // 获取已添加到评价计划中的应用 @@ -1144,13 +1138,13 @@ public class PerformanceAppraisalPlanManage { if (Objects.nonNull(appraisalId)) { List projectApplications = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) .eq(PerformanceAppraisalApplication::getAppraisalId, appraisalId)); - if (CollUtil.isNotEmpty(projectApplications)){ + if (CollUtil.isNotEmpty(projectApplications)) { List appIdList = projectApplications.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); applicationIdList.removeAll(appIdList); } } List resList = applicationList.stream().filter(a -> !applicationIdList.contains(a.getId())).collect(Collectors.toList()); - if (CollUtil.isEmpty(resList)){ + if (CollUtil.isEmpty(resList)) { return PageVo.empty(); } //List relatedAppList = Lists.newArrayList(); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/ReAppraisalManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/ReAppraisalManage.java index 3632145..217090e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/ReAppraisalManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/ReAppraisalManage.java @@ -7,6 +7,7 @@ import cn.hutool.core.util.CharsetUtil; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.write.builder.ExcelWriterBuilder; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Assert; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; @@ -25,8 +26,8 @@ import com.hz.pm.api.performance.service.*; import com.hz.pm.api.performance.util.*; import com.hz.pm.api.portrait.model.entity.ProjectTag; import com.hz.pm.api.portrait.service.IProjectTagService; -import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.sys.model.entity.Role; import com.hz.pm.api.sys.service.IRoleService; @@ -115,10 +116,7 @@ public class ReAppraisalManage { } else { empCodeList.add(reAppraisalUsers); } - if (empCodeList.contains(employeeCode)) { - return true; - } - return false; + return empCodeList.contains(employeeCode); }).collect(Collectors.toList()); // 当前登录复评员用户,没有参加评价计划 if (CollUtil.isEmpty(groupList)) { @@ -150,12 +148,12 @@ public class ReAppraisalManage { /** * 是否可以复评 * - * @param employeeCode - * @param projectCode - * @param appraisalId - * @return + * @param userId \ + * @param projectCode \ + * @param appraisalId \ + * @return \ */ - private Boolean checkCanReAppraisal(String employeeCode, String projectCode, Long appraisalId) { + private Boolean checkCanReAppraisal(String userId, String projectCode, Long appraisalId) { // 首次复评(复评打分时间为空) // 从绩效评价打分信息表中查询打分类型为复评、打分人员为当前登录复评用户的打分信息 // 如果没有相关的打分信息,说明是当前登录复评用户是首次复评 @@ -163,7 +161,7 @@ public class ReAppraisalManage { .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.RE_APPRAISAL.getCode()) .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode, projectCode) .eq(PerformanceAppraisalScoreInfo::getAppraisalId, appraisalId) - .eq(PerformanceAppraisalScoreInfo::getAppraisalEmployeeCode, employeeCode)); + .eq(PerformanceAppraisalScoreInfo::getAppraisalUserId, userId)); if (CollUtil.isEmpty(scoreInfos)) { return true; } @@ -230,7 +228,7 @@ public class ReAppraisalManage { @Transactional(rollbackFor = Exception.class) public String submitReAppraisal(ProjectAppraisalDTO param) { UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); - String employeeCode = userDetail.getEmployeeCode(); + String userIdStr = String.valueOf(userDetail.getMhUserId()); String username = userDetail.getUsername(); Long appraisalId = param.getAppraisalId(); Long appraisalProjectId = param.getAppraisalProjectId(); @@ -270,8 +268,8 @@ public class ReAppraisalManage { scoreInfo.setAppraisalType(AppraisalTypeEnum.RE_APPRAISAL.getCode()); scoreInfo.setTemplateDetailId(templateDetail.getId()); scoreInfo.setTemplateId(templateDetail.getTemplateId()); - scoreInfo.setAppraisalEmployeeCode(employeeCode); - scoreInfo.setAppraisalEmployeeName(username); + scoreInfo.setAppraisalUserId(userIdStr); + scoreInfo.setAppraisalUserName(username); scoreInfo.setAppraisalId(appraisalId); scoreInfo.setAppraisalProjectId(appraisalProjectId); scoreInfo.setAppraisalProjectCode(appraisalProjectCode); @@ -317,7 +315,7 @@ public class ReAppraisalManage { .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.RE_APPRAISAL.getCode())); // 判断打分人员是否为分组内的复评人员 if (CollUtil.isNotEmpty(scoreInfoList)) { - Set users = scoreInfoList.stream().map(PerformanceAppraisalScoreInfo::getAppraisalEmployeeCode).collect(Collectors.toSet()); + Set users = scoreInfoList.stream().map(PerformanceAppraisalScoreInfo::getAppraisalUserId).collect(Collectors.toSet()); if (CollUtil.isNotEmpty(users)) { String reAppraisalUsers = group.getReAppraisalUsers(); String join = String.join(StrPool.COMMA, users); @@ -330,27 +328,22 @@ public class ReAppraisalManage { } public void exportScore(HttpServletResponse response, PerformanceAppraisalExportReq param) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - String regionCode = user.getRegionCode(); String projectCode = param.getProjectCode(); Long appraisalId = param.getAppraisalId(); // 根据项目编码获取最新版本的项目信息 Project project = projectService.getProjectByCode(projectCode); - VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!"); + Assert.notNull(project, "项目不存在!"); // 根据项目类型、预算年度、批复金额、项目标签匹配本区域指标模版 String projectType = project.getProjectType(); Integer projectYear = project.getProjectYear(); BigDecimal approvalAmount = project.getApprovalAmount(); - VUtils.isTrue(Objects.isNull(approvalAmount)).throwMessage("未获取到该项目的立项批复金额"); + Assert.notNull(approvalAmount, "未获取到该项目的立项批复金额"); // 根据项目code获取项目标签ID列表 - List tagIdList = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) + String tagIdStr = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) .eq(ProjectTag::getProjectCode, projectCode)).stream() - .map(ProjectTag::getTagId).collect(Collectors.toList()); - VUtils.isTrue(CollUtil.isEmpty(tagIdList)).throwMessage("当前项目未设置标签,匹配不到指标模板,请至项目库或评价计划编辑页面设置标签!"); - - List strIdList = tagIdList.stream().map(String::valueOf).collect(Collectors.toList()); - String projectTagIds = String.join(StrPool.COMMA, strIdList); + .map(w -> w.getTagId().toString()).collect(Collectors.joining(",")); + Assert.notEmpty(tagIdStr, "当前项目未设置标签,匹配不到指标模板,请至项目库或评价计划编辑页面设置标签!"); Integer amountRange = null; if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.FIVE_MILLION)) < 0) { @@ -362,15 +355,14 @@ public class ReAppraisalManage { amountRange = ProjectBizConst.AMOUNT_RANGE_THREE; } LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class) - .eq(PerformanceIndicatorProjectTemplate::getRegionCode, regionCode) .eq(PerformanceIndicatorProjectTemplate::getProjectType, projectType) .eq(PerformanceIndicatorProjectTemplate::getProjectYear, projectYear) .eq(PerformanceIndicatorProjectTemplate::getAmountRange, amountRange) - .eq(PerformanceIndicatorProjectTemplate::getProjectTagIds, projectTagIds) + .eq(PerformanceIndicatorProjectTemplate::getProjectTagIds, tagIdStr) .eq(PerformanceIndicatorProjectTemplate::getStatus, CommonEnum.YES.getCode()) .orderByDesc(PerformanceIndicatorProjectTemplate::getUpdateOn); List templates = indicatorProjectTemplateService.list(wrapper); - VUtils.isTrue(CollUtil.isEmpty(templates)).throwMessage("该项目匹配不到指标模板,请返回上一页或者刷新重试。"); + Assert.notEmpty(templates, "该项目匹配不到指标模板,请返回上一页或者刷新重试。"); if (templates.size() > 1) { throw new BizException("当前项目匹配到多个模板,请返回模板库检查模板配置!"); } @@ -398,7 +390,7 @@ public class ReAppraisalManage { .filter(s -> AppraisalTypeEnum.RE_APPRAISAL.getCode().equals(s.getAppraisalType())) .collect(Collectors.toList()); List reUserList = reScoreInfoList.stream() - .map(PerformanceAppraisalScoreInfo::getAppraisalEmployeeName) + .map(PerformanceAppraisalScoreInfo::getAppraisalUserName) .collect(Collectors.toList()); // 筛选出所有打分的三级指标模板详情ID @@ -434,8 +426,8 @@ public class ReAppraisalManage { scoreMap.put(ProjectBizConst.SELF_APPRAISAL_BASIS, appraisalScoreInfo.getAppraisalBasis()); scoreMap.put(ProjectBizConst.SELF_APPRAISAL_SCORE, appraisalScoreInfo.getAppraisalScore()); } else if (AppraisalTypeEnum.RE_APPRAISAL.getCode().equals(appraisalScoreInfo.getAppraisalType())) { - scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + ProjectBizConst.RE_APPRAISAL_BASIS, appraisalScoreInfo.getAppraisalBasis()); - scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + ProjectBizConst.RE_APPRAISAL_SCORE, appraisalScoreInfo.getAppraisalScore()); + scoreMap.put(appraisalScoreInfo.getAppraisalUserName() + ProjectBizConst.RE_APPRAISAL_BASIS, appraisalScoreInfo.getAppraisalBasis()); + scoreMap.put(appraisalScoreInfo.getAppraisalUserName() + ProjectBizConst.RE_APPRAISAL_SCORE, appraisalScoreInfo.getAppraisalScore()); } if (Boolean.TRUE.equals(thirdTemplateDetail.getIsAdditional())) { @@ -456,21 +448,21 @@ public class ReAppraisalManage { // 需要从第几行开始合并 int mergeRowIndex = 2; - List headList = Lists.newArrayList(); - headList.add(new ExcelHead(ProjectBizConst.FIRST_INDEX_NAME, ProjectBizConst.FIRST_INDEX_TITLE, StrPool.EMPTY)); - headList.add(new ExcelHead(ProjectBizConst.SECOND_INDEX_NAME, ProjectBizConst.SECOND_INDEX_TITLE, StrPool.EMPTY)); - headList.add(new ExcelHead(ProjectBizConst.THIRD_INDEX_NAME, ProjectBizConst.THIRD_INDEX_TITLE, StrPool.EMPTY)); - headList.add(new ExcelHead(ProjectBizConst.INDEX_SCORE, ProjectBizConst.INDEX_SCORE_TITLE, StrPool.EMPTY)); - headList.add(new ExcelHead(ProjectBizConst.INDEX_DETAIL, ProjectBizConst.INDEX_DETAIL_TITLE, StrPool.EMPTY)); - headList.add(new ExcelHead(ProjectBizConst.GRADE_DETAIL, ProjectBizConst.GRADE_DETAIL_TITLE, StrPool.EMPTY)); - headList.add(new ExcelHead(ProjectBizConst.SUPPORT_MATERIAL, ProjectBizConst.SUPPORT_MATERIAL_TITLE, StrPool.EMPTY)); - headList.add(new ExcelHead(ProjectBizConst.SELF_APPRAISAL_BASIS, ProjectBizConst.SELF_APPRAISAL_BASIS_TITLE, StrPool.EMPTY)); - headList.add(new ExcelHead(ProjectBizConst.SELF_APPRAISAL_SCORE, ProjectBizConst.SELF_APPRAISAL_SCORE_TITLE, StrPool.EMPTY)); + List> headList = Lists.newArrayList(); + headList.add(new ExcelHead<>(ProjectBizConst.FIRST_INDEX_NAME, ProjectBizConst.FIRST_INDEX_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead<>(ProjectBizConst.SECOND_INDEX_NAME, ProjectBizConst.SECOND_INDEX_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead<>(ProjectBizConst.THIRD_INDEX_NAME, ProjectBizConst.THIRD_INDEX_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead<>(ProjectBizConst.INDEX_SCORE, ProjectBizConst.INDEX_SCORE_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead<>(ProjectBizConst.INDEX_DETAIL, ProjectBizConst.INDEX_DETAIL_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead<>(ProjectBizConst.GRADE_DETAIL, ProjectBizConst.GRADE_DETAIL_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead<>(ProjectBizConst.SUPPORT_MATERIAL, ProjectBizConst.SUPPORT_MATERIAL_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead<>(ProjectBizConst.SELF_APPRAISAL_BASIS, ProjectBizConst.SELF_APPRAISAL_BASIS_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead<>(ProjectBizConst.SELF_APPRAISAL_SCORE, ProjectBizConst.SELF_APPRAISAL_SCORE_TITLE, StrPool.EMPTY)); for (String reUser : reUserList) { - headList.add(new ExcelHead(reUser + ProjectBizConst.RE_APPRAISAL_BASIS, ProjectBizConst.RE_APPRAISAL_BASIS_TITLE, StrPool.EMPTY)); - headList.add(new ExcelHead(reUser + ProjectBizConst.RE_APPRAISAL_SCORE, ProjectBizConst.RE_APPRAISAL_SCORE_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead<>(reUser + ProjectBizConst.RE_APPRAISAL_BASIS, ProjectBizConst.RE_APPRAISAL_BASIS_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead<>(reUser + ProjectBizConst.RE_APPRAISAL_SCORE, ProjectBizConst.RE_APPRAISAL_SCORE_TITLE, StrPool.EMPTY)); } - headList.add(new ExcelHead(ProjectBizConst.IS_ADDITIONAL, ProjectBizConst.IS_ADDITIONAL_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead<>(ProjectBizConst.IS_ADDITIONAL, ProjectBizConst.IS_ADDITIONAL_TITLE, StrPool.EMPTY)); // 数据导出处理函数 try { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/RectifyAuditManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/RectifyAuditManage.java index 4b6fe00..a323c30 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/RectifyAuditManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/RectifyAuditManage.java @@ -1,52 +1,50 @@ package com.hz.pm.api.performance.manage; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.text.StrPool; -import com.google.common.collect.Lists; -import com.hz.pm.api.performance.enumration.AppraisalTypeEnum; -import com.hz.pm.api.performance.enumration.RectifyAuditEnum; -import com.hz.pm.api.performance.model.dto.ProjectAppraisalInfoDTO; -import com.hz.pm.api.performance.model.entity.*; -import com.hz.pm.api.performance.service.*; -import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - 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.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.basic.model.PageVo; +import com.google.common.collect.Lists; import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.performance.enumration.AppraisalTypeEnum; +import com.hz.pm.api.performance.enumration.RectifyAuditEnum; import com.hz.pm.api.performance.enumration.RectifyStatusEnum; import com.hz.pm.api.performance.model.dto.ProjectAppraisalDTO; +import com.hz.pm.api.performance.model.dto.ProjectAppraisalInfoDTO; +import com.hz.pm.api.performance.model.entity.*; import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq; import com.hz.pm.api.performance.model.vo.PerformanceAppraisalProjectVO; import com.hz.pm.api.performance.model.vo.PerformanceAppraisalVO; +import com.hz.pm.api.performance.service.*; import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.sys.model.entity.Role; import com.hz.pm.api.sys.service.IRoleService; import com.hz.pm.api.user.model.enumeration.RoleEnum; import com.hz.pm.api.user.security.model.UserInfoDetails; import com.hz.pm.api.user.util.LoginUserUtil; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; /** * RectifyAuditManage - * - * @return + * * @author CMM + * @return * @since 2023/08/12 17:36 */ @Component @@ -62,9 +60,10 @@ public class RectifyAuditManage { private final IPerformanceAppraisalProjectGroupService groupService; private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; private final IPerformanceAppraisalScoreInfoService performanceAppraisalScoreInfoService; + /** * 绩效列表 - * + * * @param req * @return */ @@ -163,9 +162,9 @@ public class RectifyAuditManage { // 因为一个核查用户只能出现在一个评价计划中的一个分组中,所以根据评价计划ID和核查组长信息可以确定分组内项目信息 PerformanceAppraisalProjectGroup projectGroup = - groupService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) - .eq(PerformanceAppraisalProjectGroup::getAppraisalId, planId) - .eq(PerformanceAppraisalProjectGroup::getVerifyLeader, employeeCode)); + groupService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) + .eq(PerformanceAppraisalProjectGroup::getAppraisalId, planId) + .eq(PerformanceAppraisalProjectGroup::getVerifyLeader, employeeCode)); // 当前登录专家没有为核查组长的绩效分组信息 if (Objects.isNull(projectGroup)) { return PageVo.empty(); @@ -180,25 +179,25 @@ public class RectifyAuditManage { } // 获取评价计划内已添加的核查组长为当前登录专家用户的待整改审核项目信息 List paps = - performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .eq(PerformanceAppraisalProject::getAppraisalId, plan.getId()) - .in(PerformanceAppraisalProject::getProjectCode, codes) - .eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE) - .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.TO_BE_REVIEWED.getCode())); + performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId, plan.getId()) + .in(PerformanceAppraisalProject::getProjectCode, codes) + .eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE) + .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.TO_BE_REVIEWED.getCode())); if (CollUtil.isEmpty(paps)) { return PageVo.empty(); } Map papsMap = - paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); + paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); // 获取本单位在当前评价计划内的项目 Set projectCodes = - paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet()); + paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet()); Page page = req.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class) - .in(Project::getProjectCode, projectCodes).eq(Project::getNewest, Boolean.TRUE) - .like(StringUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) - .like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); + .in(Project::getProjectCode, projectCodes).eq(Project::getNewest, Boolean.TRUE) + .like(StringUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) + .like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); projectService.page(page, wrapper); if (CollUtil.isEmpty(page.getRecords())) { @@ -231,9 +230,9 @@ public class RectifyAuditManage { // 因为一个核查用户只能出现在一个评价计划中的一个分组中,所以根据评价计划ID和核查组长信息可以确定分组内项目信息 PerformanceAppraisalProjectGroup projectGroup = - groupService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) - .eq(PerformanceAppraisalProjectGroup::getAppraisalId, planId) - .eq(PerformanceAppraisalProjectGroup::getVerifyLeader, employeeCode)); + groupService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) + .eq(PerformanceAppraisalProjectGroup::getAppraisalId, planId) + .eq(PerformanceAppraisalProjectGroup::getVerifyLeader, employeeCode)); // 当前登录专家没有为核查组长的绩效分组信息 if (Objects.isNull(projectGroup)) { return PageVo.empty(); @@ -248,28 +247,28 @@ public class RectifyAuditManage { } // 获取评价计划内已添加的核查组长为当前登录专家用户的已整改审核项目信息 List< - PerformanceAppraisalProject> paps = + PerformanceAppraisalProject> paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .eq(PerformanceAppraisalProject::getAppraisalId, plan.getId()) - .in(PerformanceAppraisalProject::getProjectCode, codes) - .eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE) - .and(wp -> wp - .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.NOT_APPROVED.getCode()) - .or().eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.APPROVED.getCode()))); + .eq(PerformanceAppraisalProject::getAppraisalId, plan.getId()) + .in(PerformanceAppraisalProject::getProjectCode, codes) + .eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE) + .and(wp -> wp + .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.NOT_APPROVED.getCode()) + .or().eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.APPROVED.getCode()))); if (CollUtil.isEmpty(paps)) { return PageVo.empty(); } Map papsMap = - paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); + paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); // 获取评价计划内的项目 Set projectCodes = - paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet()); + paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet()); Page page = req.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class) - .in(Project::getProjectCode, projectCodes).eq(Project::getNewest, Boolean.TRUE) - .like(StringUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) - .like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); + .in(Project::getProjectCode, projectCodes).eq(Project::getNewest, Boolean.TRUE) + .like(StringUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) + .like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); projectService.page(page, wrapper); if (CollUtil.isEmpty(page.getRecords())) { @@ -296,7 +295,7 @@ public class RectifyAuditManage { @Transactional(rollbackFor = Exception.class) public String submit(ProjectAppraisalDTO param) { UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); - String employeeCode = userDetail.getEmployeeCode(); + String userIdStr = String.valueOf(userDetail.getUserId()); String username = userDetail.getUsername(); Long appraisalId = param.getAppraisalId(); Long appraisalProjectId = param.getAppraisalProjectId(); @@ -305,13 +304,11 @@ public class RectifyAuditManage { String rectifyAuditOpinion = param.getRectifyAuditOpinion(); String rectifyAuditAppendix = param.getRectifyAuditAppendix(); List appraisalInfoList = param.getAppraisalInfoList(); - Long groupId = param.getGroupId(); - PerformanceAppraisalProjectGroup group = groupService.getById(groupId); // 获取评价项目 PerformanceAppraisalProject appraisalProject = performanceAppraisalProjectService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) .eq(PerformanceAppraisalProject::getAppraisalId, appraisalId) - .eq(PerformanceAppraisalProject::getProjectCode,appraisalProjectCode) + .eq(PerformanceAppraisalProject::getProjectCode, appraisalProjectCode) .eq(PerformanceAppraisalProject::getProjectId, appraisalProjectId)); List ids = appraisalInfoList.stream() @@ -320,7 +317,7 @@ public class RectifyAuditManage { // 查出项目模版详情信息 List detailList = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) .in(PerformanceIndicatorProjectTemplateDetail::getId, ids)); - if (CollUtil.isEmpty(detailList)){ + if (CollUtil.isEmpty(detailList)) { throw new BizException("评价指标不存在!"); } Map detailMap = detailList.stream().collect(Collectors.toMap(PerformanceIndicatorProjectTemplateDetail::getId, d -> d)); @@ -328,7 +325,7 @@ public class RectifyAuditManage { PerformanceIndicatorProjectTemplateDetail templateDetail = detailMap.get(a.getProjectTemplateDetailId()); BigDecimal score = a.getScore(); BigDecimal indexScore = templateDetail.getIndexScore(); - if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0){ + if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0) { throw new BizException("核查审核得分必须大于等于0且小于等于指标分值!"); } // 保存核查分数信息 @@ -339,8 +336,8 @@ public class RectifyAuditManage { scoreInfo.setAppraisalType(AppraisalTypeEnum.EXPERT_RECTIFY_AUDIT.getCode()); scoreInfo.setTemplateDetailId(templateDetail.getId()); scoreInfo.setTemplateId(templateDetail.getTemplateId()); - scoreInfo.setAppraisalEmployeeCode(employeeCode); - scoreInfo.setAppraisalEmployeeName(username); + scoreInfo.setAppraisalUserId(userIdStr); + scoreInfo.setAppraisalUserName(username); scoreInfo.setAppraisalId(appraisalId); scoreInfo.setAppraisalProjectId(appraisalProjectId); scoreInfo.setAppraisalProjectCode(appraisalProjectCode); @@ -349,7 +346,7 @@ public class RectifyAuditManage { return scoreInfo; }).collect(Collectors.toList()); - if (performanceAppraisalScoreInfoService.saveBatch(scoreInfos)){ + if (performanceAppraisalScoreInfoService.saveBatch(scoreInfos)) { // 计算核查总分并保存 BigDecimal rectifyTotalScore = appraisalInfoList.stream() .map(ProjectAppraisalInfoDTO::getScore) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/RectifyManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/RectifyManage.java index ed1486a..bade195 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/RectifyManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/RectifyManage.java @@ -2,10 +2,13 @@ package com.hz.pm.api.performance.manage; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Assert; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.util.StrUtils; import com.hz.pm.api.performance.enumration.RectifyStatusEnum; import com.hz.pm.api.performance.model.dto.ProjectAppraisalDTO; import com.hz.pm.api.performance.model.entity.PerformanceAppraisal; @@ -70,12 +73,12 @@ public class RectifyManage { UserInfoDetails user = LoginUserUtil.loginUserDetail(); // 当前登录用户 单位code - String empPosUnitCode = user.getEmpPosUnitCode(); + String mhUnitId = user.getMhUnitIdStr(); // 获取当前登录用户的角色列表,只有单位管理员才能查看该列表 List userRoleList = user.getUserRoleList(); List roleIdList = userRoleList.stream().map(Role::getId).collect(Collectors.toList()); - Role role = - roleService.getOne(Wrappers.lambdaQuery(Role.class).eq(Role::getName, RoleEnum.COMPANY_MANAGER.getDesc())); + Role role = roleService.getOne(Wrappers.lambdaQuery(Role.class) + .eq(Role::getName, RoleEnum.COMPANY_MANAGER.getDesc())); if (Objects.isNull(role)) { throw new BizException("登录用户没有单位管理员角色!"); } @@ -87,7 +90,7 @@ public class RectifyManage { // 获取登录用户所在单位的所有已终验项目信息 List projectLists = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getStatus, ProjectStatusEnum.ACCEPTED.getCode()).eq(Project::getBuildOrgCode, empPosUnitCode)); + .eq(Project::getStatus, ProjectStatusEnum.ACCEPTED.getCode()).eq(Project::getBuildOrgCode, mhUnitId)); if (CollUtil.isEmpty(projectLists)) { return PageVo.empty(); @@ -161,7 +164,7 @@ public class RectifyManage { Page page = req.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class).in(Project::getProjectCode, projectCodes) - .eq(Project::getNewest, Boolean.TRUE).eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()) + .eq(Project::getNewest, Boolean.TRUE).eq(Project::getBuildOrgCode, user.getMhUnitId()) .like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); projectService.page(page, wrapper); @@ -189,7 +192,7 @@ public class RectifyManage { UserInfoDetails user = LoginUserUtil.loginUserDetail(); PerformanceAppraisal plan = performanceAppraisalService.getById(planId); - VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!"); + Assert.notNull(plan, "该评价计划不存在!"); // 获取评价计划内已添加的已整改项目信息 List paps = @@ -199,8 +202,6 @@ public class RectifyManage { .and(wp -> wp .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.TO_BE_REVIEWED.getCode()).or() .eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.APPROVED.getCode()))); - Map papsMap = - paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); if (CollUtil.isEmpty(paps)) { return PageVo.empty(); @@ -210,15 +211,19 @@ public class RectifyManage { Set projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet()); Page page = req.page(); - LambdaQueryWrapper wrapper = - Wrappers.lambdaQuery(Project.class).in(Project::getProjectCode, projectCodes) - .eq(Project::getNewest, Boolean.TRUE).eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()) - .like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class) + .in(Project::getProjectCode, projectCodes) + .eq(Project::getNewest, Boolean.TRUE) + .eq(Project::getBuildOrgCode, user.getMhUnitId()) + .like(StrUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); projectService.page(page, wrapper); if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } + Map papsMap = paps.stream() + .collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); + List res = page.getRecords().stream().map(p -> { PerformanceAppraisalProjectVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalProjectVO.class); PerformanceAppraisalProject appraisalProject = papsMap.get(p.getId()); @@ -239,19 +244,20 @@ public class RectifyManage { RectifyDetailVO vo = new RectifyDetailVO(); // 根据评价计划ID和项目编号获取评价项目信息 PerformanceAppraisalProject appraisalProject = performanceAppraisalProjectService.getOne(Wrappers - .lambdaQuery(PerformanceAppraisalProject.class).eq(PerformanceAppraisalProject::getAppraisalId, planId) + .lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId, planId) .eq(PerformanceAppraisalProject::getProjectCode, projectCode)); - VUtils.isTrue(Objects.isNull(appraisalProject)).throwMessage("该项目已被移除评价计划,请返回上一页或者刷新重试!!"); + Assert.notNull(appraisalProject, "该项目已被移除评价计划,请返回上一页或者刷新重试!"); BeanUtils.copyProperties(appraisalProject, vo); - String rectifySubmitEmployeeCode = appraisalProject.getRectifySubmitEmployeeCode(); - if (StringUtils.isNotBlank(rectifySubmitEmployeeCode)) { - UserFullInfoDTO userFullInfoDto = userInfoHelper.getUserFullInfoByEmployeeCode(rectifySubmitEmployeeCode); - vo.setRectifySubmitEmployee(userFullInfoDto); + String rectifySubmitUserId = appraisalProject.getRectifySubmitUserId(); + if (StrUtils.isNotBlank(rectifySubmitUserId)) { + UserFullInfoDTO userFullInfoDto = userInfoHelper.getUserFullInfo(rectifySubmitUserId); + vo.setRectifySubmitUser(userFullInfoDto); } - String rectifyResSubEmpCode = appraisalProject.getRectifyResSubEmpCode(); - if (StringUtils.isNotBlank(rectifyResSubEmpCode)) { - UserFullInfoDTO userFullInfoDto = userInfoHelper.getUserFullInfoByEmployeeCode(rectifyResSubEmpCode); - vo.setRectifyResSubEmployee(userFullInfoDto); + String rectifyResSubUserId = appraisalProject.getRectifyResSubUserId(); + if (StrUtils.isNotBlank(rectifyResSubUserId)) { + UserFullInfoDTO userFullInfoDto = userInfoHelper.getUserFullInfo(rectifyResSubUserId); + vo.setRectifyResSubUser(userFullInfoDto); } vo.setRectifyStatusName(RectifyStatusEnum.getDesc(appraisalProject.getRectifyStatus())); return vo; @@ -260,7 +266,7 @@ public class RectifyManage { @Transactional(rollbackFor = Exception.class) public String fillOutResult(ProjectAppraisalDTO param) { UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); - String employeeCode = userDetail.getEmployeeCode(); + String userIdStr = String.valueOf(userDetail.getUserId()); String username = userDetail.getUsername(); Long appraisalId = param.getAppraisalId(); @@ -270,16 +276,17 @@ public class RectifyManage { String rectifyResultAppendix = param.getRectifyResultAppendix(); // 判断该项目是否还存在于计划或分组中 - PerformanceAppraisalProject appraisalProject = performanceAppraisalProjectService.getOne(Wrappers - .lambdaQuery(PerformanceAppraisalProject.class).eq(PerformanceAppraisalProject::getAppraisalId, appraisalId) + Wrapper query = Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId, appraisalId) .eq(PerformanceAppraisalProject::getProjectId, appraisalProjectId) - .eq(PerformanceAppraisalProject::getProjectCode, appraisalProjectCode)); + .eq(PerformanceAppraisalProject::getProjectCode, appraisalProjectCode); + PerformanceAppraisalProject appraisalProject = performanceAppraisalProjectService.getOne(query); if (Objects.isNull(appraisalProject)) { throw new BizException("该项目已被移除评价计划,请返回上一页或者刷新重试!"); } appraisalProject.setRectifyResult(rectifyResult); appraisalProject.setRectifyResultAppendix(rectifyResultAppendix); - appraisalProject.setRectifyResSubEmpCode(employeeCode); + appraisalProject.setRectifyResSubUserId(userIdStr); appraisalProject.setRectifyResSubTime(LocalDateTime.now()); // 更新整改状态为整改待审核 appraisalProject.setRectifyStatus(RectifyStatusEnum.TO_BE_REVIEWED.getCode()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/VerifyManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/VerifyManage.java index c103136..85a14b4 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/VerifyManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/VerifyManage.java @@ -2,15 +2,19 @@ package com.hz.pm.api.performance.manage; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.lang.Assert; import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.CharsetUtil; +import cn.hutool.core.util.NumberUtil; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.write.builder.ExcelWriterBuilder; +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.plugins.pagination.Page; import com.google.common.collect.Lists; import com.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.performance.constant.ProjectBizConst; import com.hz.pm.api.performance.enumration.AppraisalTypeEnum; @@ -26,8 +30,8 @@ import com.hz.pm.api.performance.service.*; import com.hz.pm.api.performance.util.*; import com.hz.pm.api.portrait.model.entity.ProjectTag; import com.hz.pm.api.portrait.service.IProjectTagService; -import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.sys.model.entity.Role; import com.hz.pm.api.sys.service.IRoleService; @@ -47,6 +51,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.math.BigDecimal; +import java.math.RoundingMode; import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; @@ -139,31 +144,28 @@ public class VerifyManage { /** * 是否可以核查 * - * @param employeeCode - * @param projectCode - * @param appraisalId - * @return + * @param userId \ + * @param projectCode \ + * @param appraisalId \ + * @return \ */ - private Boolean checkCanVerify(String employeeCode, String projectCode, Long appraisalId) { - + private Boolean checkCanVerify(String userId, String projectCode, Long appraisalId) { // 首次核查(核查打分信息为空) // 从绩效评价打分信息表中查询打分类型为专家核查、打分人员为当前登录专家用户的打分信息 // 如果没有相关的打分信息,说明是当前登录复评用户是首次核查 - List scoreInfos = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) + Wrapper query = Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_VERIFY.getCode()) .eq(PerformanceAppraisalScoreInfo::getAppraisalId, appraisalId) .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode, projectCode) - .eq(PerformanceAppraisalScoreInfo::getAppraisalEmployeeCode, employeeCode)); - if (CollUtil.isEmpty(scoreInfos)) { - return true; - } - return Boolean.FALSE; + .eq(PerformanceAppraisalScoreInfo::getAppraisalUserId, userId) + .last(BizConst.LIMIT_1); + return performanceAppraisalScoreInfoService.count(query) == 0; } public PageVo groupProjectList(Long groupId, PerformanceAppraisalListReq req) { UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); - String employeeCode = userDetail.getEmployeeCode(); + String userIdStr = String.valueOf(userDetail.getUserId()); // 获取分组内的项目信息 PerformanceAppraisalProjectGroup projectGroup = groupService.getById(groupId); @@ -204,10 +206,10 @@ public class VerifyManage { BeanUtil.copyProperties(appraisalProject, vo); vo.setProjectId(appraisalProject.getProjectId()); vo.setProjectTypeName(ProjectTypeNewEnum.getDesc(p.getProjectType())); - vo.setCanVerify(checkCanVerify(employeeCode, appraisalProject.getProjectCode(), appraisalId)); + vo.setCanVerify(checkCanVerify(userIdStr, appraisalProject.getProjectCode(), appraisalId)); // 如果登录用户是核查组长,该项目可填写整改意见 String verifyLeader = projectGroup.getVerifyLeader(); - if (employeeCode.equals(verifyLeader)) { + if (userIdStr.equals(verifyLeader)) { vo.setCanRectify(Boolean.TRUE); } vo.setGroupId(groupId); @@ -220,7 +222,7 @@ public class VerifyManage { @Transactional(rollbackFor = Exception.class) public String submitVerify(ProjectAppraisalDTO param) { UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); - String employeeCode = userDetail.getEmployeeCode(); + String userIdStr = String.valueOf(userDetail.getUserId()); String username = userDetail.getUsername(); Long appraisalId = param.getAppraisalId(); Long appraisalProjectId = param.getAppraisalProjectId(); @@ -260,8 +262,8 @@ public class VerifyManage { scoreInfo.setAppraisalType(AppraisalTypeEnum.EXPERT_VERIFY.getCode()); scoreInfo.setTemplateDetailId(templateDetail.getId()); scoreInfo.setTemplateId(templateDetail.getTemplateId()); - scoreInfo.setAppraisalEmployeeCode(employeeCode); - scoreInfo.setAppraisalEmployeeName(username); + scoreInfo.setAppraisalUserName(username); + scoreInfo.setAppraisalUserId(userIdStr); scoreInfo.setAppraisalId(appraisalId); scoreInfo.setAppraisalProjectId(appraisalProjectId); scoreInfo.setAppraisalProjectCode(appraisalProjectCode); @@ -281,7 +283,7 @@ public class VerifyManage { if (Objects.nonNull(appraisalProject.getVerifyTotalScore())) { // 已经进行了核查,计算两个分值的平均分 BigDecimal add = verifyTotalScore.add(appraisalProject.getReAppraisalTotalScore()); - lastVerifyTotalScore = add.divide(BigDecimal.valueOf(2)); + lastVerifyTotalScore = add.divide(BigDecimal.valueOf(2), RoundingMode.HALF_UP); } else { // 还没有进行过复评 lastVerifyTotalScore = verifyTotalScore; @@ -298,7 +300,7 @@ public class VerifyManage { StringUtils.isNotBlank(param.getRectifyOpinion())) { appraisalProject.setIsRectify(param.getIsRectify()); appraisalProject.setRectifyOpinion(param.getRectifyOpinion()); - appraisalProject.setRectifySubmitEmployeeCode(employeeCode); + appraisalProject.setRectifySubmitUserId(userIdStr); appraisalProject.setRectifySubmitTime(LocalDateTime.now()); appraisalProject.setRectifyStatus(RectifyStatusEnum.TO_BE_SUBMITTED.getCode()); } @@ -317,7 +319,9 @@ public class VerifyManage { // 判断打分人员是否为分组内的核查人员 if (CollUtil.isNotEmpty(scoreInfoList)) { - Set users = scoreInfoList.stream().map(PerformanceAppraisalScoreInfo::getAppraisalEmployeeCode).collect(Collectors.toSet()); + Set users = scoreInfoList.stream() + .map(PerformanceAppraisalScoreInfo::getAppraisalUserId) + .collect(Collectors.toSet()); if (CollUtil.isNotEmpty(users)) { String verificationUsers = group.getVerificationUsers(); String join = String.join(StrPool.COMMA, users); @@ -330,29 +334,24 @@ public class VerifyManage { } public void exportScore(HttpServletResponse response, PerformanceAppraisalExportReq param) { - UserInfoDetails user = LoginUserUtil.loginUserDetail(); - String regionCode = user.getRegionCode(); String projectCode = param.getProjectCode(); Long appraisalId = param.getAppraisalId(); // 根据项目编码获取最新版本的项目信息 Project project = projectService.getProjectByCode(projectCode); - VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!"); + Assert.notNull(project, "项目不存在!"); // 根据项目类型、预算年度、批复金额、项目标签匹配本区域指标模版 String projectType = project.getProjectType(); Integer projectYear = project.getProjectYear(); BigDecimal approvalAmount = project.getApprovalAmount(); - VUtils.isTrue(Objects.isNull(approvalAmount)).throwMessage("未获取到该项目的立项批复金额"); + Assert.notNull(approvalAmount, "未获取到该项目的立项批复金额"); // 根据项目code获取项目标签ID列表 - List tagIdList = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) + String tagIdStr = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) .eq(ProjectTag::getProjectCode, projectCode)).stream() - .map(ProjectTag::getTagId).collect(Collectors.toList()); - VUtils.isTrue(CollUtil.isEmpty(tagIdList)).throwMessage("当前项目未设置标签,匹配不到指标模板,请至项目库或评价计划编辑页面设置标签!"); + .map(w -> w.getTagId().toString()).collect(Collectors.joining(",")); + Assert.notEmpty(tagIdStr, "当前项目未设置标签,请至项目库或评价计划编辑页面设置标签!"); - List strIdList = tagIdList.stream().map(String::valueOf).collect(Collectors.toList()); - String projectTagIds = String.join(StrPool.COMMA, strIdList); - - Integer amountRange = null; + Integer amountRange; if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.FIVE_MILLION)) < 0) { amountRange = ProjectBizConst.AMOUNT_RANGE_ONE; } else if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.FIVE_MILLION)) >= 0 && @@ -360,19 +359,20 @@ public class VerifyManage { amountRange = ProjectBizConst.AMOUNT_RANGE_TWO; } else if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.TWENTY_MILLION)) >= 0) { amountRange = ProjectBizConst.AMOUNT_RANGE_THREE; + } else { + amountRange = null; } - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class) - .eq(PerformanceIndicatorProjectTemplate::getRegionCode, regionCode) + LambdaQueryWrapper wrapper = Wrappers + .lambdaQuery(PerformanceIndicatorProjectTemplate.class) .eq(PerformanceIndicatorProjectTemplate::getProjectType, projectType) .eq(PerformanceIndicatorProjectTemplate::getProjectYear, projectYear) .eq(PerformanceIndicatorProjectTemplate::getAmountRange, amountRange) - .eq(PerformanceIndicatorProjectTemplate::getProjectTagIds, projectTagIds) + .eq(PerformanceIndicatorProjectTemplate::getProjectTagIds, tagIdStr) .eq(PerformanceIndicatorProjectTemplate::getStatus, CommonEnum.YES.getCode()) .orderByDesc(PerformanceIndicatorProjectTemplate::getUpdateOn); List templates = indicatorProjectTemplateService.list(wrapper); - VUtils.isTrue(CollUtil.isEmpty(templates)).throwMessage("该项目匹配不到指标模板,请返回上一页或者刷新重试。"); - if (templates.size() > 1) { - throw new BizException("当前项目匹配到多个模板,请返回模板库检查模板配置!"); + if (templates.size() != 1) { + throw BizException.wrap("当前项目模版配置错误!"); } PerformanceIndicatorProjectTemplate projectTemplate = templates.get(0); // 装配项目指标详情及分数信息 @@ -384,11 +384,12 @@ public class VerifyManage { List> exportDataList = Lists.newArrayList(); List> exportAdditionalDataList = Lists.newArrayList(); // 构建指标和打分详情 - List scoreInfoList = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) + List scoreInfoList = performanceAppraisalScoreInfoService.list(Wrappers + .lambdaQuery(PerformanceAppraisalScoreInfo.class) .eq(PerformanceAppraisalScoreInfo::getAppraisalId, appraisalId) - .and(wp -> wp.eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.SELF_APPRAISAL.getCode()).or() - .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.RE_APPRAISAL.getCode()).or() - .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_VERIFY.getCode())) + .and(wp -> wp.eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.SELF_APPRAISAL.getCode()) + .or().eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.RE_APPRAISAL.getCode()) + .or().eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_VERIFY.getCode())) .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode, projectCode) .orderBy(Boolean.TRUE, Boolean.TRUE, PerformanceAppraisalScoreInfo::getTemplateDetailId)); Map scoreInfoMap = scoreInfoList.stream() @@ -399,7 +400,7 @@ public class VerifyManage { .filter(s -> AppraisalTypeEnum.RE_APPRAISAL.getCode().equals(s.getAppraisalType())) .collect(Collectors.toList()); List reUserList = reScoreInfoList.stream() - .map(PerformanceAppraisalScoreInfo::getAppraisalEmployeeName) + .map(PerformanceAppraisalScoreInfo::getAppraisalUserName) .collect(Collectors.toList()); // 获取核查打分人员信息 @@ -407,12 +408,12 @@ public class VerifyManage { .filter(s -> AppraisalTypeEnum.EXPERT_VERIFY.getCode().equals(s.getAppraisalType())) .collect(Collectors.toList()); List verifyUserList = verifyScoreInfoList.stream() - .map(PerformanceAppraisalScoreInfo::getAppraisalEmployeeName) + .map(PerformanceAppraisalScoreInfo::getAppraisalUserName) .collect(Collectors.toList()); // 筛选出所有打分的三级指标模板详情ID for (PerformanceAppraisalScoreInfo scoreInfo : scoreInfoList) { - HashMap scoreMap = MapUtil.newHashMap(); + Map scoreMap = MapUtil.newHashMap(); Long detailId = scoreInfo.getTemplateDetailId(); PerformanceIndicatorProjectTemplateDetail thirdTemplateDetail = templateDetailMap.get(detailId); @@ -444,11 +445,11 @@ public class VerifyManage { scoreMap.put(ProjectBizConst.SELF_APPRAISAL_BASIS, appraisalScoreInfo.getAppraisalBasis()); scoreMap.put(ProjectBizConst.SELF_APPRAISAL_SCORE, appraisalScoreInfo.getAppraisalScore()); } else if (AppraisalTypeEnum.RE_APPRAISAL.getCode().equals(appraisalScoreInfo.getAppraisalType())) { - scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + ProjectBizConst.RE_APPRAISAL_BASIS, appraisalScoreInfo.getAppraisalBasis()); - scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + ProjectBizConst.RE_APPRAISAL_SCORE, appraisalScoreInfo.getAppraisalScore()); + scoreMap.put(appraisalScoreInfo.getAppraisalUserName() + ProjectBizConst.RE_APPRAISAL_BASIS, appraisalScoreInfo.getAppraisalBasis()); + scoreMap.put(appraisalScoreInfo.getAppraisalUserName() + ProjectBizConst.RE_APPRAISAL_SCORE, appraisalScoreInfo.getAppraisalScore()); } else if (AppraisalTypeEnum.EXPERT_VERIFY.getCode().equals(appraisalScoreInfo.getAppraisalType())) { - scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + ProjectBizConst.VERIFY_BASIS, appraisalScoreInfo.getAppraisalBasis()); - scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + ProjectBizConst.VERIFY_SCORE, appraisalScoreInfo.getAppraisalScore()); + scoreMap.put(appraisalScoreInfo.getAppraisalUserName() + ProjectBizConst.VERIFY_BASIS, appraisalScoreInfo.getAppraisalBasis()); + scoreMap.put(appraisalScoreInfo.getAppraisalUserName() + ProjectBizConst.VERIFY_SCORE, appraisalScoreInfo.getAppraisalScore()); } if (Boolean.TRUE.equals(thirdTemplateDetail.getIsAdditional())) { @@ -469,26 +470,26 @@ public class VerifyManage { // 需要从第几行开始合并 int mergeRowIndex = 2; - List headList = Lists.newArrayList(); - headList.add(new ExcelHead(ProjectBizConst.FIRST_INDEX_NAME, ProjectBizConst.FIRST_INDEX_TITLE, StrPool.EMPTY)); - headList.add(new ExcelHead(ProjectBizConst.SECOND_INDEX_NAME, ProjectBizConst.SECOND_INDEX_TITLE, StrPool.EMPTY)); - headList.add(new ExcelHead(ProjectBizConst.THIRD_INDEX_NAME, ProjectBizConst.THIRD_INDEX_TITLE, StrPool.EMPTY)); - headList.add(new ExcelHead(ProjectBizConst.INDEX_SCORE, ProjectBizConst.INDEX_SCORE_TITLE, StrPool.EMPTY)); - headList.add(new ExcelHead(ProjectBizConst.INDEX_DETAIL, ProjectBizConst.INDEX_DETAIL_TITLE, StrPool.EMPTY)); - headList.add(new ExcelHead(ProjectBizConst.GRADE_DETAIL, ProjectBizConst.GRADE_DETAIL_TITLE, StrPool.EMPTY)); - headList.add(new ExcelHead(ProjectBizConst.SUPPORT_MATERIAL, ProjectBizConst.SUPPORT_MATERIAL_TITLE, StrPool.EMPTY)); - headList.add(new ExcelHead(ProjectBizConst.SELF_APPRAISAL_BASIS, ProjectBizConst.SELF_APPRAISAL_BASIS_TITLE, StrPool.EMPTY)); - headList.add(new ExcelHead(ProjectBizConst.SELF_APPRAISAL_SCORE, ProjectBizConst.SELF_APPRAISAL_SCORE_TITLE, StrPool.EMPTY)); + List> headList = Lists.newArrayList(); + headList.add(new ExcelHead<>(ProjectBizConst.FIRST_INDEX_NAME, ProjectBizConst.FIRST_INDEX_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead<>(ProjectBizConst.SECOND_INDEX_NAME, ProjectBizConst.SECOND_INDEX_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead<>(ProjectBizConst.THIRD_INDEX_NAME, ProjectBizConst.THIRD_INDEX_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead<>(ProjectBizConst.INDEX_SCORE, ProjectBizConst.INDEX_SCORE_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead<>(ProjectBizConst.INDEX_DETAIL, ProjectBizConst.INDEX_DETAIL_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead<>(ProjectBizConst.GRADE_DETAIL, ProjectBizConst.GRADE_DETAIL_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead<>(ProjectBizConst.SUPPORT_MATERIAL, ProjectBizConst.SUPPORT_MATERIAL_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead<>(ProjectBizConst.SELF_APPRAISAL_BASIS, ProjectBizConst.SELF_APPRAISAL_BASIS_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead<>(ProjectBizConst.SELF_APPRAISAL_SCORE, ProjectBizConst.SELF_APPRAISAL_SCORE_TITLE, StrPool.EMPTY)); for (String reUser : reUserList) { - headList.add(new ExcelHead(reUser + ProjectBizConst.RE_APPRAISAL_BASIS, ProjectBizConst.RE_APPRAISAL_BASIS_TITLE, StrPool.EMPTY)); - headList.add(new ExcelHead(reUser + ProjectBizConst.RE_APPRAISAL_SCORE, ProjectBizConst.RE_APPRAISAL_SCORE_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead<>(reUser + ProjectBizConst.RE_APPRAISAL_BASIS, ProjectBizConst.RE_APPRAISAL_BASIS_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead<>(reUser + ProjectBizConst.RE_APPRAISAL_SCORE, ProjectBizConst.RE_APPRAISAL_SCORE_TITLE, StrPool.EMPTY)); } for (String verifyUser : verifyUserList) { - headList.add(new ExcelHead(verifyUser + ProjectBizConst.VERIFY_BASIS, ProjectBizConst.VERIFY_BASIS_TITLE, StrPool.EMPTY)); - headList.add(new ExcelHead(verifyUser + ProjectBizConst.VERIFY_SCORE, ProjectBizConst.VERIFY_SCORE_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead<>(verifyUser + ProjectBizConst.VERIFY_BASIS, ProjectBizConst.VERIFY_BASIS_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead<>(verifyUser + ProjectBizConst.VERIFY_SCORE, ProjectBizConst.VERIFY_SCORE_TITLE, StrPool.EMPTY)); } - headList.add(new ExcelHead(ProjectBizConst.IS_ADDITIONAL, ProjectBizConst.IS_ADDITIONAL_TITLE, StrPool.EMPTY)); + headList.add(new ExcelHead<>(ProjectBizConst.IS_ADDITIONAL, ProjectBizConst.IS_ADDITIONAL_TITLE, StrPool.EMPTY)); // 数据导出处理函数 try { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalProject.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalProject.java index c75c383..6ccdb1e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalProject.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalProject.java @@ -82,7 +82,7 @@ public class PerformanceAppraisalProject implements Serializable { private String rectifyOpinion; @ApiModelProperty("整改提交人员工code") - private String rectifySubmitEmployeeCode; + private String rectifySubmitUserId; @ApiModelProperty("整改提交时间") private LocalDateTime rectifySubmitTime; @@ -106,7 +106,7 @@ public class PerformanceAppraisalProject implements Serializable { private String rectifyResultAppendix; @ApiModelProperty("整改结果提交人员工code") - private String rectifyResSubEmpCode; + private String rectifyResSubUserId; @ApiModelProperty("整改结果提交时间") private LocalDateTime rectifyResSubTime; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalScoreInfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalScoreInfo.java index 2d158b0..249d86b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalScoreInfo.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/entity/PerformanceAppraisalScoreInfo.java @@ -54,10 +54,10 @@ public class PerformanceAppraisalScoreInfo implements Serializable { private String appraisalBasisAppendix; @ApiModelProperty("评价人员code") - private String appraisalEmployeeCode; + private String appraisalUserId; @ApiModelProperty("评价人员姓名") - private String appraisalEmployeeName; + private String appraisalUserName; @ApiModelProperty("评价类型 1 单位自评、2 复评人员复评、3 专家核查、4 专家整改审核、5 应用评价") private Integer appraisalType; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/RectifyDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/RectifyDetailVO.java index 5677f15..fa2c05b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/RectifyDetailVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/vo/RectifyDetailVO.java @@ -5,7 +5,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.io.Serializable; import java.time.LocalDateTime; /** @@ -16,15 +15,13 @@ import java.time.LocalDateTime; */ @Data @ApiModel(value = "整改详情", description = "整改详情") -public class RectifyDetailVO implements Serializable { - - private static final long serialVersionUID = 1L; +public class RectifyDetailVO { @ApiModelProperty("整改意见") private String rectifyOpinion; @ApiModelProperty("整改提交人") - private UserFullInfoDTO rectifySubmitEmployee; + private UserFullInfoDTO rectifySubmitUser; @ApiModelProperty("整改提交时间") private LocalDateTime rectifySubmitTime; @@ -36,7 +33,7 @@ public class RectifyDetailVO implements Serializable { private String rectifyResultAppendix; @ApiModelProperty("整改结果提交人") - private UserFullInfoDTO rectifyResSubEmployee; + private UserFullInfoDTO rectifyResSubUser; @ApiModelProperty("整改结果提交时间") private LocalDateTime rectifyResSubTime; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/ExcelUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/ExcelUtils.java index baa2a13..b46292a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/ExcelUtils.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/util/ExcelUtils.java @@ -50,12 +50,12 @@ public class ExcelUtils { * @param dataList 表内容数据转换 * @return List> */ - public static List> convertData(List headList, List> dataList) { + public static List> convertData(List> headList, List> dataList) { List> result = Lists.newArrayList(); //对 dataList 转为 easyExcel 的数据格式 for (Map data : dataList) { List row = Lists.newArrayList(); - for (ExcelHead h : headList) { + for (ExcelHead h : headList) { Object o = data.get(h.getFieldName()); //需要对null的处理,转换为空字符串 row.add(handler(o, h.getNullValue())); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/portrait/manage/TagManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/manage/TagManage.java index 164ae81..68748c6 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/portrait/manage/TagManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/manage/TagManage.java @@ -59,6 +59,7 @@ public class TagManage { /** * 标签分页 + * * @param areaCode * @param req * @return @@ -67,57 +68,51 @@ public class TagManage { RegionDTO regionDto = regionCacheHelper.getByCodeAndLevel(areaCode, RegionConst.RL_COUNTY); String regionCode = Objects.nonNull(regionDto) ? regionDto.getRegionCode() : null; LambdaQueryWrapper query = Wrappers.lambdaQuery(Tag.class) - .eq(Objects.nonNull(regionCode),Tag::getAreaCode, regionCode) - .like(StringUtils.isNotBlank(req.getName()),Tag::getName,req.getName()) + .eq(Objects.nonNull(regionCode), Tag::getAreaCode, regionCode) + .like(StringUtils.isNotBlank(req.getName()), Tag::getName, req.getName()) .orderByDesc(Tag::getUpdateOn); - checkAuth(query,LoginUserUtil.loginUserDetail()); + checkAuth(query, LoginUserUtil.loginUserDetail()); Page page = tagService.page(req.page(), query); long total; if ((total = page.getTotal()) == 0) { return PageVo.empty(); } List records = CollUtils.convert(page.getRecords(), - t -> BeanUtil.copyProperties(t,TagVO.class)); + t -> BeanUtil.copyProperties(t, TagVO.class)); return PageVo.of(records, total); } /** * 权限控制 - * @param query - * @param user + * + * @param query \ + * @param user \ */ private void checkAuth(LambdaQueryWrapper query, UserInfoDetails user) { //如果是超管 - if(user.getSuperAdmin()){ + if (user.getSuperAdmin() || user.getRegionAdmin()) { log.info(user.getUsername() + " 是超管,可以看所有标签"); - }else if(user.getRegionAdmin()){ - //如果是区域管理员 - log.info(user.getUsername() + " 是区管,可以看本区域" + user.getRegionCode() + "标签"); - if(!RegionConst.RC_HZ.equals(user.getRegionCode())){ - //非市本级的区管 只可以看自己区域的 - query.eq(Tag::getAreaCode,user.getRegionCode()); - } - //市本级 能看所有区域 - }else{ + } else { //其它角色全都看不见 - query.eq(Tag::getId,0L); + query.eq(Tag::getId, 0L); } } /** * 保存标签 - * @param dto - * @return + * + * @param dto \ + * @return \ */ public String save(TagDTO dto) { deduplicationName(dto); UserInfoDetails user = LoginUserUtil.loginUserDetail(); - Tag entity = BeanUtil.copyProperties(dto,Tag.class); - if(Objects.nonNull(dto.getId())){ + Tag entity = BeanUtil.copyProperties(dto, Tag.class); + if (Objects.nonNull(dto.getId())) { Tag old = tagService.getById(dto.getId()); VUtils.isTrue(Objects.isNull(old)).throwMessage("此id标签不存在!"); entity.setId(old.getId()); - }else{ + } else { entity.setId(null); entity.setCreateOn(LocalDateTime.now()); entity.setCreateBy(user.getUsername()); @@ -131,10 +126,11 @@ public class TagManage { /** * 标签名 去重 + * * @param dto */ private void deduplicationName(TagDTO dto) { - if(StringUtils.isNotBlank(dto.getName())){ + if (StringUtils.isNotBlank(dto.getName())) { long count = tagService.count(Wrappers.lambdaQuery(Tag.class) .eq(Tag::getAreaCode, dto.getAreaCode()) .eq(Tag::getName, dto.getName()) @@ -144,7 +140,7 @@ public class TagManage { } public String saveToProject(List dtos) { - if(CollUtil.isEmpty(dtos)){ + if (CollUtil.isEmpty(dtos)) { return "参入的标签为空"; } UserInfoDetails user = LoginUserUtil.loginUserDetail(); @@ -155,10 +151,10 @@ public class TagManage { .last(BizConst.LIMIT_1)); VUtils.isTrue(Objects.isNull(project) && Objects.isNull(baseinfo)).throwMessage("项目不存在!"); projectTagService.remove(Wrappers.lambdaQuery(ProjectTag.class) - .eq(ProjectTag::getProjectCode,projectCode)); + .eq(ProjectTag::getProjectCode, projectCode)); //去重 dtos = dtos.stream().distinct().collect(Collectors.toList()); - for(TagToProjectDTO dto : dtos){ + for (TagToProjectDTO dto : dtos) { Long tagId = dto.getTagId(); Tag tag = tagService.getById(tagId); VUtils.isTrue(Objects.isNull(tag)).throwMessage("标签不存在!"); @@ -178,7 +174,8 @@ public class TagManage { public String removeTagToProject(TagToProjectDTO dto) { String projectCode = dto.getProjectCode(); Project project = projectService.getProjectByCode(projectCode); - GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers + .lambdaQuery(GovBizProjectBaseinfo.class) .eq(GovBizProjectBaseinfo::getBaseProjId, projectCode) .last(BizConst.LIMIT_1)); VUtils.isTrue(Objects.isNull(project) && Objects.isNull(baseinfo)).throwMessage("项目不存在!"); @@ -202,6 +199,7 @@ public class TagManage { /** * 删除标签 + * * @param id * @return */ @@ -210,10 +208,10 @@ public class TagManage { VUtils.isTrue(Objects.isNull(tag)) .throwMessage("删除失败 此标签ID不存在!"); - if(tagService.removeById(id)){ + if (tagService.removeById(id)) { //关联关系 也要删 projectTagService.remove(Wrappers.lambdaQuery(ProjectTag.class) - .eq(ProjectTag::getTagId,id)); + .eq(ProjectTag::getTagId, id)); return "删除成功"; } return "删除失败"; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java index 7b6c6fc..5e10f1c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java @@ -66,7 +66,7 @@ public class DeclaredProjectController { @ApiOperation(value = "申报项目草稿箱详情", notes = "申报项目草稿箱详情") @GetMapping("/draft/{id}") public ProjectDraftVO draft(@PathVariable(value = "id") Long id) { - return declaredProjectManage.draftDatail(id); + return declaredProjectManage.draftDetail(id); } @ApiOperation(value = "申报项目保存至草稿箱", notes = "申报项目保存至草稿箱") diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java index 381ca93..50c4746 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java @@ -7,8 +7,8 @@ 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.hz.pm.api.common.model.constant.BizConst; 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.StateMachineUtil; import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.common.util.ExcelExportStyle; @@ -25,10 +25,10 @@ import com.hz.pm.api.projectdeclared.service.IContractService; import com.hz.pm.api.projectdeclared.service.IPaymentPlanService; import com.hz.pm.api.projectdeclared.service.IPreInsAcceptancePersonService; import com.hz.pm.api.projectdeclared.service.IPurchaseService; -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.model.entity.Project; +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.IProjectService; @@ -89,7 +89,6 @@ public class ConstructionManage { */ public PageVo projectLibList(ProjectListReq req) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); LambdaQueryWrapper query = ProjectHelper.projectQuery(req); //建设中状态 query.eq(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); @@ -97,7 +96,7 @@ public class ConstructionManage { query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); query.eq(Project::getNewest, Boolean.TRUE); //只能看自己单位的 - query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); + query.eq(Project::getBuildOrgCode, user.getMhUnitId()); query.orderByAsc(Project::getTransactionTime); Page page = projectService.page(req.page(), query); long total; @@ -136,7 +135,6 @@ public class ConstructionManage { */ public PageVo projectlistPerfect(ProjectListReq req) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); LambdaQueryWrapper query = ProjectHelper.projectQuery(req); //建设中状态以后的 都是 query.and(q1 -> q1.gt(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) @@ -144,7 +142,7 @@ public class ConstructionManage { .isNotNull(Project::getContractAmount))); query.eq(Project::getNewest, Boolean.TRUE); //只能看自己单位的 - query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); + query.eq(Project::getBuildOrgCode, user.getMhUnitId()); query.orderByAsc(Project::getUpdateOn); Page page = projectService.page(req.page(), query); @@ -172,9 +170,9 @@ public class ConstructionManage { /** * 判断 是否需要补充 * - * @param w - * @param paymentMap - * @return + * @param w \ + * @param paymentMap \ + * @return \ */ private Boolean checkIsSupplement(Project w, Map> paymentMap) { if (paymentMap.containsKey(w.getProjectCode())) { @@ -194,7 +192,6 @@ public class ConstructionManage { public void exportList(HttpServletResponse response, ProjectListReq param) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); LambdaQueryWrapper query = ProjectHelper.projectQuery(param); //待采购状态 query.eq(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); @@ -296,9 +293,6 @@ public class ConstructionManage { */ public String submitContract(ContractSaveDTO dto) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); - Long projectId = dto.getProjectId(); VUtils.isTrue(Objects.isNull(projectId)).throwMessage("提交失败 缺少项目ID!"); Project project = projectService.getNewProject(dto.getProjectId()); @@ -317,7 +311,7 @@ public class ConstructionManage { BeanUtil.copyProperties(dto, contractEntity); if (Objects.isNull(contract)) { contractEntity.setCreateOn(LocalDateTime.now()); - contractEntity.setCreateBy(employeeCode); + contractEntity.setCreateBy(user.getUserIdStr()); } else { contractEntity.setId(contract.getId()); } @@ -336,8 +330,8 @@ public class ConstructionManage { plan.setProjectCode(project.getProjectCode()); plan.setCreateOn(LocalDateTime.now()); plan.setUpdateOn(LocalDateTime.now()); - plan.setCreateBy(employeeCode); - plan.setUpdateBy(employeeCode); + plan.setCreateBy(user.getUserIdStr()); + plan.setUpdateBy(user.getUserIdStr()); return plan; }).collect(Collectors.toList()); @@ -378,7 +372,7 @@ public class ConstructionManage { query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); query.eq(Project::getNewest, Boolean.TRUE); //只能看自己单位的 - query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); + query.eq(Project::getBuildOrgCode, user.getMhUnitId()); //交货时间 排序 query.isNotNull(Project::getDeliveryTime); query.orderByAsc(Project::getDeliveryTime); @@ -420,7 +414,7 @@ public class ConstructionManage { LambdaQueryWrapper query = ProjectHelper.projectQuery(param); //待采购状态 //只能看自己单位的 - query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); + query.eq(Project::getBuildOrgCode, user.getMhUnitId()); query.eq(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); query.eq(Project::getNewest, Boolean.TRUE); @@ -503,9 +497,6 @@ public class ConstructionManage { */ public String submitPreIns(PreInsSaveDTO dto) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); - Long projectId = dto.getProjectId(); VUtils.isTrue(Objects.isNull(projectId)).throwMessage("提交失败 缺少项目ID!"); Project project = projectService.getNewProject(dto.getProjectId()); @@ -527,8 +518,8 @@ public class ConstructionManage { person.setProjectId(projectId); person.setCreateOn(LocalDateTime.now()); person.setUpdateOn(LocalDateTime.now()); - person.setCreateBy(employeeCode); - person.setUpdateBy(employeeCode); + person.setCreateBy(user.getUserIdStr()); + person.setUpdateBy(user.getMhUnitIdStr()); return person; }).collect(Collectors.toList()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java index 501006f..1a4b381 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java @@ -5,13 +5,12 @@ import com.alibaba.excel.EasyExcel; 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.hz.pm.api.common.model.constant.BizConst; -import com.hz.pm.api.common.model.constant.CommonConst; -import com.hz.pm.api.common.model.constant.RegionConst; import com.hz.pm.api.common.enumeration.CommonEnum; import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.model.constant.BizConst; +import com.hz.pm.api.common.model.constant.CommonConst; import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.common.util.ExcelExportStyle; @@ -21,14 +20,14 @@ import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; import com.hz.pm.api.projectdeclared.model.entity.ProjectConstructionSuggestions; import com.hz.pm.api.projectdeclared.model.req.ConstrctionPlanListReq; import com.hz.pm.api.projectdeclared.service.IConstrctionSuggestionsService; -import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; -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.InstTypeEnum; +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; @@ -100,29 +99,20 @@ public class ConstructionPlanManage { @Transactional(rollbackFor = Exception.class) public String startTheProcess(DefaultDeclaredDTO dto) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(Objects.isNull(user) || Objects.isNull(employeeCode)) - .throwMessage("获取登录用户失败!"); - + Long userId = user.getUserId(); ProjectDTO projectInfo = dto.getProjectInfo(); Long projectInfoId = projectInfo.getId(); - VUtils.isTrue(Objects.isNull(projectInfoId)).throwMessage("提交失败 缺少项目ID!"); + VUtils.isTrue(Objects.isNull(projectInfoId)).throwMessage("提交失败,缺少项目ID!"); Project oldProject = projectService.getById(projectInfoId); - VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); - VUtils.isTrue(StringUtils.isBlank(projectInfo.getConstructionPlanFile())).throwMessage("提交失败 请提交建设方案!"); + VUtils.isTrue(StringUtils.isBlank(projectInfo.getConstructionPlanFile())).throwMessage("提交失败,请提交建设方案!"); // 判断 项目当前状态 是不是 方案待申报 VUtils.isTrue(!ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode().equals(oldProject.getStatus()) || !ProjectStatusEnum.NOT_APPROVED.getCode().equals(oldProject.getStage())) .throwMessage("提交失败 该项目不是 方案待申报状态或者未立项阶段"); - if (StringUtils.isNotBlank(user.getRegionCode())) { - projectInfo.setAreaCode(user.getRegionCode()); - projectInfo.setArea(regionCacheHelper.getRegionName(user.getRegionCode(), RegionConst.RL_COUNTY)); - } - - projectInfo.setBuildOrgCode(user.getEmpPosUnitCode()); - projectInfo.setBuildOrgName(user.getEmpPosUnitName()); + projectInfo.setBuildOrgCode(user.getMhUnitIdStr()); + projectInfo.setBuildOrgName(user.getMhUnitName()); // 项目名称去重 if (StringUtils.isNotBlank(projectInfo.getProjectName()) && !projectInfo.getProjectName() @@ -135,8 +125,8 @@ public class ConstructionPlanManage { //如果主管单位没有 那么主管单位就是自己 if (CommonEnum.NO.getCode().equals(projectInfo.getIsSuperOrg())) { - projectInfo.setSuperOrgCode(user.getEmpPosUnitCode()); - projectInfo.setSuperOrg(user.getEmpPosUnitName()); + projectInfo.setSuperOrgCode(user.getMhUnitIdStr()); + projectInfo.setSuperOrg(user.getMhUnitName()); } Project constructProject = new Project(); @@ -144,16 +134,12 @@ public class ConstructionPlanManage { constructProject.setStatus(oldProject.getStatus()); constructProject.setStage(oldProject.getStage()); - String regionCode = user.getRegionCode(); - WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) - .eq(WflowModels::getRegionCode, regionCode) .eq(WflowModels::getProcessType, ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode()) .last(BizConst.LIMIT_1)); if (Objects.isNull(model)) { - log.error("此 【{}】区域找不到 建设申报流程配置", regionCode); - throw new BusinessException(String.format("此 【%s】区域找不到 建设申报流程配置", regionCode)); + throw new BusinessException("找不到建设申报流程配置"); } //如果被禁用了的话 直接跳过 进入到下一个状态 @@ -167,13 +153,13 @@ public class ConstructionPlanManage { } ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(declaredProjectManage.buildUser(employeeCode)); + params.setUser(declaredProjectManage.buildUser(userId)); params.setProcessUsers(Collections.emptyMap()); //放入条件判断的项目字段 //把条件值给放入工作流 defaultDeclaredProjectManage.buildCondition(params, oldProject, dto); // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 - Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode, constructProject); + Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(userId, constructProject); String instanceId = processService.startProcessLs(model, params, orgModelMap); log.info("建设方案项目申报成功 【{}】", instanceId); @@ -183,7 +169,7 @@ public class ConstructionPlanManage { //如果是重新提交 不用生成新版本 前面已经生成过了 buildProject = contructionPlanModifyProject(oldProject, instanceId); } else { - buildProject = projectLibManage.saveConstructProjectInDeclared(projectInfo, instanceId, employeeCode, oldProject); + buildProject = projectLibManage.saveConstructProjectInDeclared(projectInfo, instanceId, userId, oldProject); } //发送给第一个审批人消息 @@ -219,10 +205,6 @@ public class ConstructionPlanManage { */ @Transactional(rollbackFor = Exception.class) public String restartTheProcess(DefaultDeclaredDTO dto) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user) || Objects.isNull(user.getEmployeeCode())) - .throwMessage("获取登录用户失败!"); - ProjectDTO projectDto = dto.getProjectInfo(); VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); Project projectInfo = projectService.getById(projectDto.getId()); @@ -282,7 +264,7 @@ public class ConstructionPlanManage { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); //放入用户的单位 - req.setBuildOrgCode(user.getEmpPosUnitCode()); + req.setBuildOrgCode(user.getMhUnitIdStr()); return projectLibManage.projectLibList(req); } @@ -296,7 +278,7 @@ public class ConstructionPlanManage { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); //放入用户的单位 - req.setBuildOrgCode(user.getEmpPosUnitCode()); + req.setBuildOrgCode(user.getMhUnitIdStr()); req.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); req.setPageSize(CommonConst.EXPORT_PAGE_SIZE); LambdaQueryWrapper query = ProjectHelper.projectQuery(req); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java index 851f9b5..c56b597 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java @@ -8,16 +8,17 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Assert; 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.exception.BizException; 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.ningdatech.basic.util.StrPool; import com.hz.pm.api.common.model.constant.BizConst; -import com.hz.pm.api.common.model.constant.RegionConst; import com.hz.pm.api.common.enumeration.CommonEnum; import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; import com.hz.pm.api.common.helper.RegionCacheHelper; @@ -92,7 +93,7 @@ public class DeclaredProjectManage { private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; private final NoticeManage noticeManage; - + private final UserInfoHelper userInfoHelper; private final RegionCacheHelper regionCacheHelper; @@ -113,18 +114,10 @@ public class DeclaredProjectManage { @Transactional(rollbackFor = Exception.class) public String startTheProcess(DefaultDeclaredDTO dto) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); - ProjectDTO projectInfo = dto.getProjectInfo(); - if(StringUtils.isNotBlank(user.getRegionCode())){ - projectInfo.setAreaCode(user.getRegionCode()); - projectInfo.setArea(regionCacheHelper.getRegionName(user.getRegionCode(), RegionConst.RL_COUNTY)); - } - - projectInfo.setBuildOrgCode(user.getEmpPosUnitCode()); - projectInfo.setBuildOrgName(user.getEmpPosUnitName()); + projectInfo.setBuildOrgCode(user.getMhUnitIdStr()); + projectInfo.setBuildOrgName(user.getMhUnitName()); //项目名称去重 defaultDeclaredProjectManage.checkDuplication(projectInfo); @@ -136,31 +129,27 @@ public class DeclaredProjectManage { projectInfo.setIsSuperOrg(CommonEnum.YES.getCode()); //如果主管单位没有 那么主管单位就是自己 - if(CommonEnum.NO.getCode().equals(projectInfo.getIsSuperOrg())){ - projectInfo.setSuperOrgCode(user.getEmpPosUnitCode()); - projectInfo.setSuperOrg(user.getEmpPosUnitName()); + if (CommonEnum.NO.getCode().equals(projectInfo.getIsSuperOrg())) { + projectInfo.setSuperOrgCode(user.getMhUnitIdStr()); + projectInfo.setSuperOrg(user.getMhUnitName()); } //如果是重新提交的话 判断下 项目是否存在 - if(Objects.nonNull(projectInfo.getId())){ + if (Objects.nonNull(projectInfo.getId())) { //新申报的项目不允许带项目id projectInfo.setId(null); } - String regionCode = user.getRegionCode(); - WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) - .eq(WflowModels::getRegionCode, regionCode) .eq(WflowModels::getProcessType, ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode()) .last(BizConst.LIMIT_1)); if (Objects.isNull(model)) { - log.error("此 【{}】区域找不到单位流程配置", regionCode); - throw new BusinessException(String.format("此 【%s】区域找不到单位流程配置", regionCode)); + throw new BusinessException("找不到单位流程配置"); } ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode)); + params.setUser(defaultDeclaredProjectManage.buildUser(user.getUserId())); params.setProcessUsers(Collections.emptyMap()); //放入条件判断的项目字段 ProjectConditionDTO conditionDto = new ProjectConditionDTO(); @@ -173,21 +162,21 @@ public class DeclaredProjectManage { //开始申报 // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 Project project = new Project(); - BeanUtils.copyProperties(projectInfo,project); - Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode,project); - String instanceId = processService.startProcessLs(model, params,orgModelMap); + BeanUtils.copyProperties(projectInfo, project); + Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(user.getUserId(), project); + String instanceId = processService.startProcessLs(model, params, orgModelMap); log.info("申报项目成功 【{}】", instanceId); //如果是重新提交的话 判断下 项目是否存在 //保存项目相关 - Project buildProject = projectLibManage.saveProjectInDeclared(projectInfo,instanceId,employeeCode); - if(Objects.nonNull(projectInfo.getDraftId())){ + Project buildProject = projectLibManage.saveProjectInDeclared(projectInfo, instanceId, user.getUserId()); + if (Objects.nonNull(projectInfo.getDraftId())) { //如果是草稿箱提交 删除对应的草稿箱 projectDraftService.removeById(projectInfo.getDraftId()); } //发送给第一个审批人消息 - noticeManage.sendFirtUser(buildProject,model.getFormName(),instanceId, + noticeManage.sendFirtUser(buildProject, model.getFormName(), instanceId, WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); return instanceId; @@ -203,22 +192,17 @@ public class DeclaredProjectManage { @Transactional(rollbackFor = Exception.class) public String reStartTheProcess(DefaultDeclaredDTO dto) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user) || Objects.isNull(user.getEmployeeCode())) - .throwMessage("获取登录用户失败!"); - String employeeCode = user.getEmployeeCode(); ProjectDTO projectDto = dto.getProjectInfo(); - projectDto.setAreaCode(user.getRegionCode()); - projectDto.setArea(regionCacheHelper.getRegionName(user.getRegionCode(), RegionConst.RL_COUNTY)); - projectDto.setBuildOrgCode(user.getEmpPosUnitCode()); - projectDto.setBuildOrgName(user.getEmpPosUnitName()); + projectDto.setBuildOrgCode(user.getMhUnitIdStr()); + projectDto.setBuildOrgName(user.getMhUnitName()); VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); Project projectInfo = projectService.getById(projectDto.getId()); VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); //项目名称去重 - if(StringUtils.isNotBlank(projectDto.getProjectName()) && - !projectDto.getProjectName().equals(projectInfo.getProjectName())){ + if (StringUtils.isNotBlank(projectDto.getProjectName()) && + !projectDto.getProjectName().equals(projectInfo.getProjectName())) { projectDto.setProjectCode(projectInfo.getProjectCode()); defaultDeclaredProjectManage.checkDuplication(projectDto); } @@ -228,25 +212,22 @@ public class DeclaredProjectManage { projectInfo.setIsSuperOrg(CommonEnum.YES.getCode()); //如果主管单位没有 那么主管单位就是自己 - if(CommonEnum.NO.getCode().equals(projectDto.getIsSuperOrg())){ - projectInfo.setSuperOrgCode(user.getEmpPosUnitCode()); - projectInfo.setSuperOrg(user.getEmpPosUnitName()); - projectDto.setSuperOrgCode(user.getEmpPosUnitCode()); - projectDto.setSuperOrg(user.getEmpPosUnitName()); + if (CommonEnum.NO.getCode().equals(projectDto.getIsSuperOrg())) { + projectInfo.setSuperOrgCode(user.getMhUnitIdStr()); + projectInfo.setSuperOrg(user.getMhUnitName()); + projectDto.setSuperOrgCode(user.getMhUnitIdStr()); + projectDto.setSuperOrg(user.getMhUnitName()); } //判断申报金额 是否等于总的 判断年度支付金额 是否等于总金额 defaultDeclaredProjectManage.checkAmount(projectDto); - String regionCode = projectInfo.getAreaCode(); WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) - .eq(WflowModels::getRegionCode, regionCode) .eq(WflowModels::getProcessType, ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode()) .last(BizConst.LIMIT_1)); if (Objects.isNull(model)) { - log.error("此 【{}】区域找不到单位流程配置", regionCode); - throw new BusinessException(String.format("此 【%s】区域找不到单位流程配置", regionCode)); + throw new BusinessException("找不到单位流程配置"); } //首先要判断 项目当前状态 是不是 单位内部拒绝 @@ -255,24 +236,24 @@ public class DeclaredProjectManage { .throwMessage("提交失败 该项目不是 单位内部拒绝审核状态或者未立项阶段"); ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode)); + params.setUser(defaultDeclaredProjectManage.buildUser(user.getUserId())); params.setProcessUsers(Collections.emptyMap()); //把条件值给放入工作流 - defaultDeclaredProjectManage.buildCondition(params,dto); + defaultDeclaredProjectManage.buildCondition(params, dto); // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 Project project = new Project(); - BeanUtils.copyProperties(projectDto,project); - Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode,project); - String instanceId = processService.startProcessLs(model, params,orgModelMap); + BeanUtils.copyProperties(projectDto, project); + Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(user.getUserId(), project); + String instanceId = processService.startProcessLs(model, params, orgModelMap); log.info("重新申报项目成功 【{}】", instanceId); //保存项目相关 - Project buildProject = projectLibManage.saveProjectInDeclared(projectDto,instanceId,employeeCode); + Project buildProject = projectLibManage.saveProjectInDeclared(projectDto, instanceId, user.getUserId()); //发送给第一个审批人消息 - noticeManage.sendFirtUser(buildProject,model.getFormName(),instanceId, + noticeManage.sendFirtUser(buildProject, model.getFormName(), instanceId, WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); return instanceId; @@ -282,7 +263,7 @@ public class DeclaredProjectManage { Long userId = LoginUserUtil.getUserId(); Page page = params.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectDraft.class) - .eq(ProjectDraft::getUserId,userId) + .eq(ProjectDraft::getUserId, userId) .ge(Objects.nonNull(params.getStartTime()), ProjectDraft::getCreateOn, params.getStartTime()) .le(Objects.nonNull(params.getEndTime()), ProjectDraft::getCreateOn, params.getEndTime()) .eq(Objects.nonNull(params.getProjectType()), ProjectDraft::getProjectType, params.getProjectType()) @@ -304,16 +285,16 @@ public class DeclaredProjectManage { return PageVo.of(res, page.getTotal()); } - public ProjectDraftVO draftDatail(Long id) { + public ProjectDraftVO draftDetail(Long id) { ProjectDraft draft = projectDraftService.getById(id); ProjectDraftVO vo = new ProjectDraftVO(); BeanUtils.copyProperties(draft, vo); vo.setBizDomain(Objects.nonNull(draft.getBizDomain()) ? String.valueOf(draft.getBizDomain()) : StringUtils.EMPTY); - if(StringUtils.isNotBlank(draft.getProjectApplicationList())){ - vo.setApplicationList(JSON.parseArray(draft.getProjectApplicationList(),ProjectApplication.class)); + if (StringUtils.isNotBlank(draft.getProjectApplicationList())) { + vo.setApplicationList(JSON.parseArray(draft.getProjectApplicationList(), ProjectApplication.class)); } - if(StringUtils.isNotBlank(draft.getDynamicForm())){ - vo.setDynamicForm(JSON.parseObject(draft.getDynamicForm(),Map.class)); + if (StringUtils.isNotBlank(draft.getDynamicForm())) { + vo.setDynamicForm(JSON.parseObject(draft.getDynamicForm(), Map.class)); } return vo; } @@ -335,21 +316,20 @@ public class DeclaredProjectManage { draft.setIsHigherSuperOrg(CommonEnum.YES.getCode()); draft.setIsSuperOrg(CommonEnum.YES.getCode()); draft.setUserId(String.valueOf(userId)); - draft.setBuildOrgCode(user.getEmpPosUnitCode()); - draft.setBuildOrgName(user.getEmpPosUnitName()); - draft.setAreaCode(user.getRegionCode()); + draft.setBuildOrgCode(user.getMhUnitIdStr()); + draft.setBuildOrgName(user.getMhUnitName()); - if(CollUtil.isNotEmpty(projectInfo.getDynamicForm())){ + if (CollUtil.isNotEmpty(projectInfo.getDynamicForm())) { draft.setDynamicForm(JSON.toJSONString(projectInfo.getDynamicForm())); } - if(CollUtil.isNotEmpty(projectInfo.getApplicationList())){ + if (CollUtil.isNotEmpty(projectInfo.getApplicationList())) { draft.setProjectApplicationList(JSON.toJSONString(projectInfo.getApplicationList())); } if (Objects.isNull(draft.getId())) { draft.setCreateOn(LocalDateTime.now()); - }else{ + } else { ProjectDraft old = projectDraftService.getById(draft.getId()); - if(Objects.isNull(old)){ + if (Objects.isNull(old)) { draft.setCreateOn(LocalDateTime.now()); } } @@ -361,45 +341,44 @@ public class DeclaredProjectManage { /** * 项目列表 + * * @param req * @return */ public PageVo projectLibList(ProjectListReq req) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - //当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位 - preQuery(query,user); - query.eq(Project::getNewest,Boolean.TRUE); + // 当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位 + preQuery(query, user); + query.eq(Project::getNewest, Boolean.TRUE); Page page = projectService.page(req.page(), query); long total; if ((total = page.getTotal()) == 0) { return PageVo.empty(); } - List records = CollUtils.convert(page.getRecords(), w -> BeanUtil.copyProperties(w,ProjectLibListItemVO.class)); + List records = CollUtils.convert(page.getRecords(), w -> BeanUtil.copyProperties(w, ProjectLibListItemVO.class)); return PageVo.of(records, total); } //当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位 并且他是单位管理员 - private void preQuery(LambdaQueryWrapper query,UserFullInfoDTO user) { + private void preQuery(LambdaQueryWrapper query, UserFullInfoDTO user) { //如果当前登录是单位管理员 - if(user.getIsOrgAdmin()){ - query.and(s1 -> s1.eq(Project::getStatus,ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()) - .eq(Project::getSuperOrgCode,user.getEmpPosUnitCode()) - .or(q2 -> q2.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()))); - }else{ + if (user.getIsOrgAdmin()) { + query.and(s1 -> s1.eq(Project::getStatus, ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()) + .eq(Project::getSuperOrgCode, user.getMhUnitId()) + .or(q2 -> q2.eq(Project::getBuildOrgCode, user.getMhUnitId()))); + } else { //否则 只能看到 非预审 并且 - query.and(q2 -> q2.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode())); + query.and(q2 -> q2.eq(Project::getBuildOrgCode, user.getMhUnitId())); } } public void exportList(HttpServletResponse response, ProjectListReq param) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); LambdaQueryWrapper query = ProjectHelper.projectQuery(param); //当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位 - preQuery(query,user); - query.eq(Project::getNewest,Boolean.TRUE); + preQuery(query, user); + query.eq(Project::getNewest, Boolean.TRUE); List records = projectService.list(query); AtomicInteger serialNumber = new AtomicInteger(0); @@ -414,7 +393,7 @@ public class DeclaredProjectManage { return exportDTO; }).collect(Collectors.toList()); String fileName = "项目申报列表"; - ExcelDownUtil.setFileName(fileName,response); + ExcelDownUtil.setFileName(fileName, response); //数据导出处理函数 try { EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class) @@ -423,58 +402,59 @@ public class DeclaredProjectManage { .sheet(fileName) .doWrite(collect); } catch (IOException e) { - throw new RuntimeException(e); + throw new BizException(e); } } /** * 查询 核心业务 - * @param businessName - * @return + * + * @param businessName \ + * @return \ */ - public JSONObject bizList(String businessName,Integer limit, Integer page,String orgCode) { + public JSONObject bizList(String businessName, Integer limit, Integer page, String orgCode) { JSONObject jsonObject = new JSONObject(); UserInfoDetails user = LoginUserUtil.loginUserDetail(); - if(BizConst.DEV.equals(active)){ + if (BizConst.DEV.equals(active)) { jsonObject = JSONObject.parseObject(DeclaredProjectConst.Biz.CORE_BIZ); - if(CollUtil.isEmpty(jsonObject)){ + if (CollUtil.isEmpty(jsonObject)) { return jsonObject; } - if(StringUtils.isNotBlank(businessName)){ + if (StringUtils.isNotBlank(businessName)) { JSONArray dataArray = jsonObject.getJSONArray(BizConst.RESPONSE_KEY_DATA); - if(CollUtil.isEmpty(dataArray)){ + if (CollUtil.isEmpty(dataArray)) { return new JSONObject(); } - Iterator iter = dataArray.stream().iterator(); + Iterator iter = dataArray.stream().iterator(); JSONArray dataArrayRes = new JSONArray(); while (iter.hasNext()) { JSONObject value = (JSONObject) iter.next(); String businessValue = value.getString("matterName"); - if(StringUtils.isNotBlank(businessValue) && businessValue.contains(businessName)){ + if (StringUtils.isNotBlank(businessValue) && businessValue.contains(businessName)) { dataArrayRes.add(value); } } - jsonObject.put("data",dataArrayRes); - jsonObject.put("total",dataArrayRes.size()); + jsonObject.put("data", dataArrayRes); + jsonObject.put("total", dataArrayRes.size()); } - }else if(BizConst.PRE.equals(active) || - BizConst.PROD.equals(active)){ - if(StringUtils.isNotBlank(orgCode)){ + } else if (BizConst.PRE.equals(active) || + BizConst.PROD.equals(active)) { + if (StringUtils.isNotBlank(orgCode)) { String[] orgCodes = orgCode.split(StrPool.COMMA); JSONArray finalArray = new JSONArray(); - for(String og : orgCodes){ - JSONObject res = projectIrsManage.searchCoreBiz(businessName,og,limit,page); - if(Objects.nonNull(res)){ + for (String og : orgCodes) { + JSONObject res = projectIrsManage.searchCoreBiz(businessName, og, limit, page); + if (Objects.nonNull(res)) { JSONArray dataArray = res.getJSONArray(BizConst.RESPONSE_KEY_DATA); - if(CollUtil.isNotEmpty(dataArray)){ + if (CollUtil.isNotEmpty(dataArray)) { finalArray.addAll(dataArray); } } } - jsonObject.put("data",finalArray); - jsonObject.put("total",finalArray.size()); - }else{ - jsonObject = projectIrsManage.searchCoreBiz(businessName,user.getEmpPosUnitCode(),limit,page); + jsonObject.put("data", finalArray); + jsonObject.put("total", finalArray.size()); + } else { + jsonObject = projectIrsManage.searchCoreBiz(businessName, user.getMhUnitIdStr(), limit, page); } } return jsonObject; @@ -482,13 +462,13 @@ public class DeclaredProjectManage { /** * 预审失败的时候 可以删除项目 - * @param projectCode + * + * @param projectCode \ */ @Transactional public String removeProject(String projectCode) { Project project = projectService.getProjectByCode(projectCode); - VUtils.isTrue(Objects.isNull(project)) - .throwMessage("该项目不存在"); + Assert.notNull(project, "该项目不存在"); VUtils.isTrue(Objects.isNull(project.getStatus()) || !ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode().equals(project.getStatus())) .throwMessage("不是预审不通过 状态 不能删除!"); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DefaultDeclaredProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DefaultDeclaredProjectManage.java index d9b43ef..4f0e67e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DefaultDeclaredProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DefaultDeclaredProjectManage.java @@ -4,11 +4,10 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.TypeReference; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Maps; -import com.ningdatech.basic.function.VUtils; -import com.hz.pm.api.common.model.constant.BizConst; -import com.hz.pm.api.common.model.constant.RegionConst; import com.hz.pm.api.common.enumeration.CommonEnum; import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.model.constant.BizConst; +import com.hz.pm.api.common.model.constant.RegionConst; import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; import com.hz.pm.api.projectdeclared.model.dto.ProjectConditionDTO; import com.hz.pm.api.projectdeclared.model.po.DeclaredProjectStatisticsPO; @@ -17,6 +16,7 @@ import com.hz.pm.api.projectlib.model.dto.ProjectDTO; 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.ningdatech.basic.function.VUtils; import com.wflow.bean.entity.WflowModels; import com.wflow.bean.entity.WflowOrgModels; import com.wflow.enums.OrgTypeEnum; @@ -31,13 +31,13 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; + import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; /** * @Classname DefaultDeclaredProjectManage - * * @Description * @Date 2023/2/14 17:12 * @Author PoffyZhang @@ -59,24 +59,22 @@ public class DefaultDeclaredProjectManage { /** * 公共的发起流程方法 */ - public void startProcess(ProjectDTO projectDTO,UserFullInfoDTO user,Integer processType){ + public void startProcess(ProjectDTO projectDTO, UserFullInfoDTO user, Integer processType) { WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) - .eq(WflowModels::getRegionCode, user.getRegionCode()) .eq(WflowModels::getProcessType, processType) .last(BizConst.LIMIT_1)); if (Objects.isNull(model)) { - log.error("此 【{}】区域找不到对应流程配置", user.getRegionCode()); - throw new BusinessException(String.format("此 【%s】区域找不到对应流程配置", user.getRegionCode())); + throw new BusinessException("找不到对应流程配置"); } ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(buildUser(user.getEmployeeCode())); + params.setUser(buildUser(user.getUserId())); params.setProcessUsers(Collections.emptyMap()); //放入条件判断的项目字段 ProjectConditionDTO conditionDto = new ProjectConditionDTO(); BeanUtils.copyProperties(projectDTO, conditionDto); - Map formData = Maps.newHashMap(); + Map formData = Maps.newHashMap(); formData.putAll( JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference>() { }) @@ -86,16 +84,16 @@ public class DefaultDeclaredProjectManage { } //项目名称去重 - public void checkDuplication(ProjectDTO project){ + public void checkDuplication(ProjectDTO project) { VUtils.isTrue(projectService.count(Wrappers.lambdaQuery(Project.class) - .eq(Project::getProjectName,project.getProjectName()) - .eq(Project::getNewest,Boolean.TRUE) - .ne(Objects.nonNull(project.getProjectCode()),Project::getProjectCode,project.getProjectCode())) > 0) - .throwMessage(String.format("修改失败 此项目名 【%s】 已存在!",project.getProjectName())); + .eq(Project::getProjectName, project.getProjectName()) + .eq(Project::getNewest, Boolean.TRUE) + .ne(Objects.nonNull(project.getProjectCode()), Project::getProjectCode, project.getProjectCode())) > 0) + .throwMessage(String.format("修改失败 此项目名 【%s】 已存在!", project.getProjectName())); } public void checkAmount(ProjectDTO projectInfo) { - if(Objects.nonNull(projectInfo.getDeclareAmount())){ + if (Objects.nonNull(projectInfo.getDeclareAmount())) { BigDecimal declareAmount = projectInfo.getDeclareAmount(); BigDecimal govSuperFinanceAmount = projectInfo.getDeclareGovSuperiorFinanceAmount(); BigDecimal govOwnFinanceAmount = projectInfo.getDeclareGovOwnFinanceAmount(); @@ -105,16 +103,16 @@ public class DefaultDeclaredProjectManage { BigDecimal totalAmount = govSuperFinanceAmount .add(govOwnFinanceAmount).add(bankLendingAmount).add(haveAmount).add(otherAmount); VUtils.isTrue(declareAmount.compareTo(totalAmount) != 0) - .throwMessage(String.format("申报失败! 申报总金额【%s】 不等于其它申报金额 【%s】",declareAmount,totalAmount)); + .throwMessage(String.format("申报失败! 申报总金额【%s】 不等于其它申报金额 【%s】", declareAmount, totalAmount)); //判断 年度计划金额 如果开着的话 - if(Objects.nonNull(projectInfo.getAnnualPlanAmount())){ + if (Objects.nonNull(projectInfo.getAnnualPlanAmount())) { BigDecimal annualPlanAmount = projectInfo.getAnnualPlanAmount(); VUtils.isTrue(annualPlanAmount.compareTo(BigDecimal.ZERO) <= 0) - .throwMessage(String.format("申报失败! 年度支付总金额【%s】 不能小于等于0",annualPlanAmount)); + .throwMessage(String.format("申报失败! 年度支付总金额【%s】 不能小于等于0", annualPlanAmount)); VUtils.isTrue(annualPlanAmount.compareTo(declareAmount) > 0) - .throwMessage(String.format("申报失败! 年度支付总金额【%s】 不能大于申报金额 【%s】",annualPlanAmount,declareAmount)); + .throwMessage(String.format("申报失败! 年度支付总金额【%s】 不能大于申报金额 【%s】", annualPlanAmount, declareAmount)); BigDecimal annualGovSuperAmount = projectInfo.getAnnualPlanGovSuperiorFinanceAmount(); BigDecimal annualOwnSuperAmount = projectInfo.getAnnualPlanGovOwnFinanceAmount(); @@ -124,46 +122,46 @@ public class DefaultDeclaredProjectManage { BigDecimal totalAnnual = annualGovSuperAmount .add(annualOwnSuperAmount).add(annualBankLendingAmount).add(annualHaveAmount).add(anualOtherAmount); VUtils.isTrue(annualPlanAmount.compareTo(totalAnnual) != 0) - .throwMessage(String.format("申报失败! 年度支付总金额【%s】 不等于其它年度支付金额 【%s】",annualPlanAmount,totalAnnual)); + .throwMessage(String.format("申报失败! 年度支付总金额【%s】 不等于其它年度支付金额 【%s】", annualPlanAmount, totalAnnual)); } } } - public ProcessInstanceUserDto buildUser(String employeeCode){ - UserFullInfoDTO userInfoDetail = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); + public ProcessInstanceUserDto buildUser(Long userId) { + UserFullInfoDTO userInfoDetail = userInfoHelper.getUserFullInfo(userId); VUtils.isTrue(Objects.isNull(userInfoDetail)) - .throwMessage(String.format("【%s】获取不到用户!",employeeCode)); + .throwMessage(String.format("【%s】获取不到用户!", userId)); return ProcessInstanceUserDto.builder() - .userId(String.valueOf(userInfoDetail.getEmployeeCode())) + .userId(String.valueOf(userInfoDetail.getUserId())) .userName(userInfoDetail.getRealName()) - .orgCode(userInfoDetail.getEmpPosUnitCode()) - .orgName(userInfoDetail.getEmpPosUnitName()) + .orgCode(String.valueOf(userInfoDetail.getMhUnitId())) + .orgName(userInfoDetail.getMhUnitName()) .build(); } - public Map buildOrgModelMap(String employeeCode,Project project) { + public Map buildOrgModelMap(Long userId, Project project) { Map orgMap = new HashMap<>(); // 查出所有的单位流程配置 List orgModelsList = orgProcdefService.list(); - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); - if(Objects.isNull(userFullInfo)){ + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + if (Objects.isNull(userFullInfo)) { log.warn("取不到员工 返回空map"); return Collections.emptyMap(); } - String startOrgCode = userFullInfo.getEmpPosUnitCode(); - String startOrgName = userFullInfo.getEmpPosUnitName(); + String startOrgCode = String.valueOf(userFullInfo.getMhUnitId()); + String startOrgName = userFullInfo.getMhUnitName(); String startOrgParentCode; String startOrgParentName; // 如果申报时 上级主管单位,由该单位自己审核 - if (CommonEnum.NO.getCode().equals(project.getIsSuperOrg())){ + if (CommonEnum.NO.getCode().equals(project.getIsSuperOrg())) { startOrgParentCode = startOrgCode; startOrgParentName = startOrgName; - }else { + } else { startOrgParentCode = project.getSuperOrgCode(); startOrgParentName = project.getSuperOrg(); } @@ -175,7 +173,7 @@ public class DefaultDeclaredProjectManage { startOrgInfoDto.setOrgModelMap(orgModelsList.stream() .filter(v -> v.getOrgCode().equals(startOrgCode) && Boolean.FALSE.equals(v.getIsDelete()) - && (ProcessDefTypeEnum.SEAL.name().equals(v.getType())|| + && (ProcessDefTypeEnum.SEAL.name().equals(v.getType()) || ProcessDefTypeEnum.JOINT_REVIEW.name().equals(v.getType()) || ProcessDefTypeEnum.DEFAULT.name().equals(v.getType()))) .collect(Collectors.toMap(WflowOrgModels::getType, v -> v))); @@ -191,18 +189,18 @@ public class DefaultDeclaredProjectManage { ProcessDefTypeEnum.DEFAULT.name().equals(v.getType()))) .collect(Collectors.toMap(WflowOrgModels::getType, v -> v))); - orgMap.put(OrgTypeEnum.TARGET_OWNER.name(),startOrgInfoDto); - orgMap.put(OrgTypeEnum.TARGET_MANAGEMENT.name(),parentOrgInfoDto); + orgMap.put(OrgTypeEnum.TARGET_OWNER.name(), startOrgInfoDto); + orgMap.put(OrgTypeEnum.TARGET_MANAGEMENT.name(), parentOrgInfoDto); // 如果是指定单位,直接根据流程定义ID放入map OrgInfoDTO orgInfoDTO = new OrgInfoDTO(); orgInfoDTO.setOrgModelMap(orgModelsList.stream() .collect(Collectors.toMap(WflowOrgModels::getProcessDefId, v -> v))); - orgMap.put(OrgTypeEnum.TARGET_LABEL.name(),orgInfoDTO); + orgMap.put(OrgTypeEnum.TARGET_LABEL.name(), orgInfoDTO); //如果有上级条线主管单位 并且 不是市本级 - if(!RegionConst.RC_HZ.equals(project.getAreaCode()) && - CommonEnum.YES.getCode().equals(project.getIsHigherSuperOrg())){ + if (!RegionConst.RC_HZ.equals(project.getAreaCode()) && + CommonEnum.YES.getCode().equals(project.getIsHigherSuperOrg())) { OrgInfoDTO parentLineOrgInfoDto = new OrgInfoDTO(); parentLineOrgInfoDto.setOrganizationCode(project.getHigherSuperOrgCode()); parentLineOrgInfoDto.setOrganizationName(project.getHigherSuperOrg()); @@ -214,7 +212,7 @@ public class DefaultDeclaredProjectManage { ProcessDefTypeEnum.DEFAULT.name().equals(v.getType()))) .collect(Collectors.toMap(WflowOrgModels::getType, v -> v))); - orgMap.put(OrgTypeEnum.TARGET_LINE_MANAGEMENT.name(),parentLineOrgInfoDto); + orgMap.put(OrgTypeEnum.TARGET_LINE_MANAGEMENT.name(), parentLineOrgInfoDto); } return orgMap; } @@ -230,10 +228,10 @@ public class DefaultDeclaredProjectManage { String startOrgParentCode; String startOrgParentName; // 如果申报时 上级主管单位,由该单位自己审核 - if (CommonEnum.NO.getCode().equals(project.getIsSuperOrg())){ + if (CommonEnum.NO.getCode().equals(project.getIsSuperOrg())) { startOrgParentCode = startOrgCode; startOrgParentName = startOrgName; - }else { + } else { startOrgParentCode = project.getSuperOrgCode(); startOrgParentName = project.getSuperOrg(); } @@ -261,18 +259,18 @@ public class DefaultDeclaredProjectManage { ProcessDefTypeEnum.DEFAULT.name().equals(v.getType()))) .collect(Collectors.toMap(WflowOrgModels::getType, v -> v))); - orgMap.put(OrgTypeEnum.TARGET_OWNER.name(),startOrgInfoDto); - orgMap.put(OrgTypeEnum.TARGET_MANAGEMENT.name(),parentOrgInfoDto); + orgMap.put(OrgTypeEnum.TARGET_OWNER.name(), startOrgInfoDto); + orgMap.put(OrgTypeEnum.TARGET_MANAGEMENT.name(), parentOrgInfoDto); // 如果是指定单位,直接根据流程定义ID放入map OrgInfoDTO orgInfoDTO = new OrgInfoDTO(); orgInfoDTO.setOrgModelMap(orgModelsList.stream() .collect(Collectors.toMap(WflowOrgModels::getProcessDefId, v -> v))); - orgMap.put(OrgTypeEnum.TARGET_LABEL.name(),orgInfoDTO); + orgMap.put(OrgTypeEnum.TARGET_LABEL.name(), orgInfoDTO); //如果有上级条线主管单位 并且 不是市本级 - if(!RegionConst.RC_HZ.equals(project.getAreaCode()) && - CommonEnum.YES.getCode().equals(project.getIsHigherSuperOrg())){ + if (!RegionConst.RC_HZ.equals(project.getAreaCode()) && + CommonEnum.YES.getCode().equals(project.getIsHigherSuperOrg())) { OrgInfoDTO parentLineOrgInfoDto = new OrgInfoDTO(); parentLineOrgInfoDto.setOrganizationCode(project.getHigherSuperOrgCode()); parentLineOrgInfoDto.setOrganizationName(project.getHigherSuperOrg()); @@ -284,25 +282,26 @@ public class DefaultDeclaredProjectManage { ProcessDefTypeEnum.DEFAULT.name().equals(v.getType()))) .collect(Collectors.toMap(WflowOrgModels::getType, v -> v))); - orgMap.put(OrgTypeEnum.TARGET_LINE_MANAGEMENT.name(),parentLineOrgInfoDto); + orgMap.put(OrgTypeEnum.TARGET_LINE_MANAGEMENT.name(), parentLineOrgInfoDto); } return orgMap; } //根据提交者的单位 - public DeclaredProjectStatisticsPO declaredProjectOrgStatistics(Integer year, UserFullInfoDTO user){ + public DeclaredProjectStatisticsPO declaredProjectOrgStatistics(Integer year, UserFullInfoDTO user) { //查此人建设单位的项目 - return statisticsService.getOrgStatistics(user.getEmpPosUnitCode(),year); + return statisticsService.getOrgStatistics(user.getMhUnitIdStr(), year); } //根据提交者的区域 他是区管或者超管 - public DeclaredProjectStatisticsPO declaredProjectRegionStatistics(Integer year, UserFullInfoDTO user){ + public DeclaredProjectStatisticsPO declaredProjectRegionStatistics(Integer year, UserFullInfoDTO user) { //查此人建设单位的项目 - return statisticsService.getRegionStatistics(user.getRegionCode(),year); + return statisticsService.getRegionStatistics(null, year); } /** * 把条件值放入工作流 用于判断条件 根据dto + * * @param params * @param dto */ @@ -319,6 +318,7 @@ public class DefaultDeclaredProjectManage { /** * 把条件值放入工作流 用于判断条件 根据d项目实体 + * * @param params * @param projectInfo */ @@ -330,19 +330,19 @@ public class DefaultDeclaredProjectManage { })); } - public void buildCondition(ProcessStartParamsVo params, Project projectInfo,DefaultDeclaredDTO dto) { + public void buildCondition(ProcessStartParamsVo params, Project projectInfo, DefaultDeclaredDTO dto) { //放入条件判断的项目字段 优先取dto的 再取项目的 ProjectDTO pdto = dto.getProjectInfo(); ProjectConditionDTO conditionDto = new ProjectConditionDTO(); conditionDto.setProjectId(projectInfo.getId()); conditionDto.setDeclareAmount(Objects.nonNull(pdto) && Objects.nonNull(pdto.getDeclareAmount()) - ?pdto.getDeclareAmount() : projectInfo.getDeclareAmount()); + ? pdto.getDeclareAmount() : projectInfo.getDeclareAmount()); conditionDto.setIsDigitalReform(Objects.nonNull(pdto) && Objects.nonNull(pdto.getIsDigitalReform()) - ?pdto.getIsDigitalReform() : projectInfo.getIsDigitalReform()); + ? pdto.getIsDigitalReform() : projectInfo.getIsDigitalReform()); conditionDto.setIsTemporaryAugment(Objects.nonNull(pdto) && Objects.nonNull(pdto.getIsTemporaryAugment()) - ?pdto.getIsTemporaryAugment() : projectInfo.getIsTemporaryAugment()); + ? pdto.getIsTemporaryAugment() : projectInfo.getIsTemporaryAugment()); conditionDto.setBizDomain(Objects.nonNull(pdto) && Objects.nonNull(pdto.getBizDomain()) - ?pdto.getBizDomain() : projectInfo.getBizDomain()); + ? pdto.getBizDomain() : projectInfo.getBizDomain()); params.setFormData(JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference>() { })); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java index 1a7e573..864fe9f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java @@ -97,9 +97,9 @@ public class DelayedApplyManage { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - //待终验 并且已经过期 - //只能看自己单位的 - query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); + // 待终验 并且已经过期 + // 只能看自己单位的 + query.eq(Project::getBuildOrgCode, user.getMhUnitId()); query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); query.lt(Project::getPlanAcceptanceTime, LocalDateTime.now()); @@ -167,9 +167,9 @@ public class DelayedApplyManage { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); LambdaQueryWrapper query = ProjectHelper.projectQuery(param); - //待终验 - //只能看自己单位的 - query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); + // 待终验 + // 只能看自己单位的 + query.eq(Project::getBuildOrgCode, user.getMhUnitId()); query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); query.eq(Project::getNewest, Boolean.TRUE); @@ -197,7 +197,7 @@ public class DelayedApplyManage { String fileName = "待终验申请项目列表"; ExcelDownUtil.setFileName(fileName, response); - //数据导出处理函数 + // 数据导出处理函数 try { EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class) .autoCloseStream(false) @@ -218,9 +218,6 @@ public class DelayedApplyManage { */ public String delayedApply(DelayedApplyDTO dto) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); - Long projectId = dto.getProjectId(); Project project = projectService.getNewProject(projectId); VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); @@ -246,9 +243,6 @@ public class DelayedApplyManage { @Transactional(rollbackFor = Exception.class) public String startDelayedApplyProcess(DelayedApplyDTO dto) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); - Long projectId = dto.getProjectId(); Project project = projectService.getNewProject(projectId); VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); @@ -275,7 +269,7 @@ public class DelayedApplyManage { } ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode)); + params.setUser(defaultDeclaredProjectManage.buildUser(user.getUserId())); params.setProcessUsers(Collections.emptyMap()); //放入条件判断的项目字段 //把条件值给放入工作流 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java index 6d17295..bbf32d6 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java @@ -87,11 +87,10 @@ public class FinalAcceptanceManage { */ public PageVo projectLibList(ProjectListReq req) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); LambdaQueryWrapper query = ProjectHelper.projectQuery(req); //待终验 并且还未过期 //只能看自己单位的 - query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); + query.eq(Project::getBuildOrgCode, user.getMhUnitId()); query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); query.ge(Project::getPlanAcceptanceTime, LocalDateTime.now()); @@ -132,11 +131,10 @@ public class FinalAcceptanceManage { public void exportList(HttpServletResponse response, ProjectListReq param) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); LambdaQueryWrapper query = ProjectHelper.projectQuery(param); //待终验 //只能看自己单位的 - query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); + query.eq(Project::getBuildOrgCode, user.getMhUnitId()); query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); query.eq(Project::getNewest, Boolean.TRUE); @@ -199,10 +197,6 @@ public class FinalAcceptanceManage { */ public String startProcess(DefaultDeclaredDTO dto) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(Objects.isNull(user) || Objects.isNull(employeeCode)) - .throwMessage("获取登录用户失败!"); - ProjectDTO projectDto = dto.getProjectInfo(); VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); Project projectInfo = projectService.getNewProject(projectDto.getId()); @@ -228,13 +222,13 @@ public class FinalAcceptanceManage { .throwMessage("提交失败 该项目不是 待终验状态|不通过或者已立项阶段"); ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(declaredProjectManage.buildUser(employeeCode)); + params.setUser(declaredProjectManage.buildUser(user.getUserId())); params.setProcessUsers(Collections.emptyMap()); //放入条件判断的项目字段 //把条件值给放入工作流 declaredProjectManage.buildCondition(params, projectInfo); // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 - Map orgModelMap = declaredProjectManage.buildOrgModelMap(employeeCode, projectInfo); + Map orgModelMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), projectInfo); String instanceId = processInstanceService.startProcessLs(model, params, orgModelMap); log.info("终验方案项目申报成功 【{}】", instanceId); @@ -258,10 +252,6 @@ public class FinalAcceptanceManage { */ public String restartProcess(DefaultDeclaredDTO dto) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(Objects.isNull(user) || Objects.isNull(employeeCode)) - .throwMessage("获取登录用户失败!"); - ProjectDTO projectDto = dto.getProjectInfo(); VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("重新提交失败 缺少项目ID!"); Project projectInfo = projectService.getNewProject(projectDto.getId()); @@ -287,13 +277,13 @@ public class FinalAcceptanceManage { .throwMessage("提交失败 该项目不是 待终验状态|不通过或者已立项阶段"); ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(declaredProjectManage.buildUser(employeeCode)); + params.setUser(declaredProjectManage.buildUser(user.getUserId())); params.setProcessUsers(Collections.emptyMap()); //放入条件判断的项目字段 //把条件值给放入工作流 declaredProjectManage.buildCondition(params, projectInfo, dto); // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 - Map orgModelMap = declaredProjectManage.buildOrgModelMap(employeeCode, projectInfo); + Map orgModelMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), projectInfo); String instanceId = processInstanceService.startProcessLs(model, params, orgModelMap); log.info("终验方案项目重新申报成功 【{}】", instanceId); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java index a3849f6..4e2f66b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java @@ -28,7 +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.todocenter.constant.TodoCenterConstant; +import com.hz.pm.api.todocenter.constant.TodoCenterConst; 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; @@ -98,18 +98,15 @@ public class PrequalificationDeclaredProjectManage { @Transactional(rollbackFor = Exception.class) public String startTheProcess(DefaultDeclaredDTO dto) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(Objects.isNull(employeeCode)).throwMessage("获取登录用户失败!"); - ProjectDTO projectDto = dto.getProjectInfo(); VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); Project projectInfo = projectService.getNewProject(projectDto.getId()); VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); //要判断 当前操作人 是不是项目主管单位的人 - VUtils.isTrue(Objects.isNull(user.getEmpPosUnitCode())) + VUtils.isTrue(Objects.isNull(user.getMhUnitId())) .throwMessage(String.format("当前登录人没有单位 【%s】", user.getRealName())); - VUtils.isTrue(!user.getEmpPosUnitCode().equals(projectInfo.getSuperOrgCode())) + VUtils.isTrue(!user.getMhUnitIdStr().equals(projectInfo.getSuperOrgCode())) .throwMessage(String.format("只有主管单位 【%s】的人 才能够提交", projectInfo.getSuperOrg())); //首先要判断 项目当前状态 是不是 待预审 @@ -130,10 +127,10 @@ public class PrequalificationDeclaredProjectManage { //入库暂存表 后续处理 对接外部接口 projectInfo.setUpdateOn(LocalDateTime.now()); //保存一下 当前的主管单位发起人 - projectInfo.setPreStartUserId(employeeCode); + projectInfo.setPreStartUserId(user.getUserIdStr()); //当前实例置为空 - projectInfo.setInstCode(TodoCenterConstant.Declared.NULL_INST_CODE); - if (projectStagingService.addByProject(projectInfo, "省级部门联审") + projectInfo.setInstCode(TodoCenterConst.Declared.NULL_INST_CODE); + if (Boolean.TRUE.equals(projectStagingService.addByProject(projectInfo, "省级部门联审")) && projectService.updateById(projectInfo)) { return "提交省级部门联审成功"; } @@ -141,7 +138,7 @@ public class PrequalificationDeclaredProjectManage { } else if (ProjectStatusEnum.PRE_APPLYING .getCode().equals(projectInfo.getStatus())) { //如果是非省级联审的项目 直接提交 预审 - instanceId = directStartProcess(projectInfo, employeeCode, dto.getRestart()); + instanceId = directStartProcess(projectInfo, user.getUserId(), dto.getRestart()); } else { throw new BusinessException("项目状态 错误 project :" + projectInfo.getId() + "," + projectInfo.getStatus()); } @@ -157,10 +154,6 @@ public class PrequalificationDeclaredProjectManage { */ @Transactional(rollbackFor = Exception.class) public String restartTheProcess(DefaultDeclaredDTO dto) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(Objects.isNull(employeeCode)).throwMessage("获取登录用户失败!"); - ProjectDTO projectDto = dto.getProjectInfo(); VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); Project projectInfo = projectService.getById(projectDto.getId()); @@ -174,12 +167,12 @@ public class PrequalificationDeclaredProjectManage { } //直接提交预审方法 提取 在省级联审通过的时候 也可以用 - public String directStartProcess(Project projectInfo, String employeeCode, Boolean restart) { - VUtils.isTrue(Objects.isNull(employeeCode)) + public String directStartProcess(Project projectInfo, Long userId, Boolean restart) { + VUtils.isTrue(Objects.isNull(userId)) .throwMessage("发起人 员工code 不能为空!"); ProcessStartParamsVo params = new ProcessStartParamsVo(); - params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode)); + params.setUser(defaultDeclaredProjectManage.buildUser(userId)); params.setProcessUsers(Collections.emptyMap()); //把条件值给放入工作流 @@ -198,7 +191,7 @@ public class PrequalificationDeclaredProjectManage { } // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 - Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode, projectInfo); + Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(userId, projectInfo); String instanceId = processInstanceService.startProcessLs(model, params, orgModelMap); log.info("提交预审项目成功 【{}】", instanceId); @@ -288,8 +281,8 @@ public class PrequalificationDeclaredProjectManage { 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())) { + && StringUtils.isNotBlank(w.getSuperOrgCode()) + && w.getSuperOrgCode().equals(user.getMhUnitIdStr())) { item.setCanPreDeclared(Boolean.TRUE); } return item; @@ -305,13 +298,13 @@ public class PrequalificationDeclaredProjectManage { public UserFullInfoDTO buildPermission(LambdaQueryWrapper query, UserFullInfoDTO user) { if (user.getIsOrgAdmin()) { //单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 - query.and(q1 -> q1.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()) + query.and(q1 -> q1.eq(Project::getBuildOrgCode, user.getMhUnitId()) .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()))); + .eq(Project::getSuperOrgCode, user.getMhUnitId()))); } else { - query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); + query.eq(Project::getBuildOrgCode, user.getMhUnitId()); } return user; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectAdjustmentManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectAdjustmentManage.java index 2753b95..f5798ef 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectAdjustmentManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectAdjustmentManage.java @@ -152,7 +152,7 @@ public class ProjectAdjustmentManage { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); //放入用户的单位 - req.setBuildOrgCode(user.getEmpPosUnitCode()); + req.setBuildOrgCode(user.getMhUnitIdStr()); return projectLibManage.projectLibList(req); } @@ -167,7 +167,7 @@ public class ProjectAdjustmentManage { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); //放入用户的单位 - req.setBuildOrgCode(user.getEmpPosUnitCode()); + req.setBuildOrgCode(user.getMhUnitIdStr()); LambdaQueryWrapper query = ProjectHelper.projectQuery(req); List records = projectService.list(query); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java index 26bdf16..f8dc01d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java @@ -6,11 +6,6 @@ import com.alibaba.excel.EasyExcel; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; -import com.ningdatech.basic.exception.BizException; -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.helper.UserInfoHelper; import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.common.util.ExcelDownUtil; @@ -20,18 +15,22 @@ import com.hz.pm.api.projectdeclared.model.dto.PurchaseSaveDTO; import com.hz.pm.api.projectdeclared.model.entity.Purchase; import com.hz.pm.api.projectdeclared.model.vo.PurchaseVO; import com.hz.pm.api.projectdeclared.service.IPurchaseService; -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.model.entity.Project; +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.IProjectService; import com.hz.pm.api.user.security.model.UserFullInfoDTO; import com.hz.pm.api.user.util.LoginUserUtil; +import com.ningdatech.basic.exception.BizException; +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 lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; @@ -74,7 +73,7 @@ public class PurchaseManage { VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); LambdaQueryWrapper query = ProjectHelper.projectQuery(req); //只能看自己单位的 - query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); + query.eq(Project::getBuildOrgCode, user.getMhUnitId()); //待采购状态 query.in(Project::getStatus, Lists.newArrayList(ProjectStatusEnum.TO_BE_PURCHASED.getCode(), ProjectStatusEnum.OPERATION.getCode())); @@ -114,7 +113,7 @@ public class PurchaseManage { LambdaQueryWrapper query = ProjectHelper.projectQuery(param); //待采购状态 //只能看自己单位的 - query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); + query.eq(Project::getBuildOrgCode, user.getMhUnitId()); query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_PURCHASED.getCode()); query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); query.eq(Project::getNewest, Boolean.TRUE); @@ -171,9 +170,6 @@ public class PurchaseManage { */ public String submitResult(PurchaseSaveDTO dto) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String employeeCode = user.getEmployeeCode(); - VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); - Long projectId = dto.getProjectId(); VUtils.isTrue(Objects.isNull(projectId)).throwMessage("提交失败 缺少项目ID!"); Project project = projectService.getNewProject(dto.getProjectId()); @@ -190,23 +186,12 @@ public class PurchaseManage { Purchase purchase = BeanUtil.copyProperties(w, Purchase.class); purchase.setProjectId(projectId); if (!purchaseMap.containsKey(w.getId())) { - purchase.setCreateBy(employeeCode); + purchase.setCreateBy(user.getUserIdStr()); } return purchase; }); if (purchaseService.saveOrUpdateBatch(purchaseEntities)) { - // 如果 需要推送项目和应用管理的话 只有遂昌县才有 - // String areaCode = project.getAreaCode(); - // String appCode = dto.getAppCode(); - // if(RegionConst.RC_SC.equals(areaCode) && StringUtils.isNotBlank(appCode)){ - // try{ - // - // }catch (Exception e){ - // log.info("绑定以及推送项目和应用关系 失败! {}" + e.getMessage()); - // } - // } - //进入到下一状态 stateMachineUtil.pass(project); project.setUpdateOn(LocalDateTime.now()); @@ -214,9 +199,7 @@ public class PurchaseManage { LocalDateTime lastTransactionTime = null; BigDecimal transactionAmountTotal = BigDecimal.ZERO; for (Purchase purchase : purchaseEntities) { - if (lastTransactionTime == null) { - lastTransactionTime = purchase.getTransactionTime(); - } else if (purchase.getTransactionTime().isAfter(lastTransactionTime)) { + if (lastTransactionTime == null || purchase.getTransactionTime().isAfter(lastTransactionTime)) { lastTransactionTime = purchase.getTransactionTime(); } transactionAmountTotal = transactionAmountTotal.add(purchase.getTransactionAmount()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByDeptJointManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByDeptJointManage.java index 6db0e29..acdd7b0 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByDeptJointManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByDeptJointManage.java @@ -23,6 +23,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; + import java.time.LocalDateTime; import java.util.Collections; import java.util.Map; @@ -54,13 +55,14 @@ public class ReviewByDeptJointManage { /** * 部门联审 + * * @param project * @return */ @Transactional(rollbackFor = Exception.class) public Boolean startTheProcess(Project project) { //这里是任务发起的 所以用项目发起人 - String startUserCode = project.getSponsor(); + Long startUserCode = Long.parseLong(project.getSponsor()); VUtils.isTrue(Objects.isNull(project.getId())).throwMessage("提交失败 缺少项目ID!"); Project projectInfo = projectService.getNewProject(project.getId()); @@ -87,47 +89,24 @@ public class ReviewByDeptJointManage { ProcessStartParamsVo params = new ProcessStartParamsVo(); //发起人的信息 - params.setUser(declaredProjectManage.buildUser(projectInfo.getSponsor())); + params.setUser(declaredProjectManage.buildUser(Long.valueOf(projectInfo.getSponsor()))); params.setProcessUsers(Collections.emptyMap()); - - Map formData = Maps.newHashMap(); //放入条件判断的项目字段 //把条件值给放入工作流 - defaultDeclaredProjectManage.buildCondition(params,projectInfo); + defaultDeclaredProjectManage.buildCondition(params, projectInfo); // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 - Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(startUserCode,project); - String instanceId = processService.startProcessLs(model, params,orgModelMap); + Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(startUserCode, project); + String instanceId = processService.startProcessLs(model, params, orgModelMap); log.info("部门联审申报成功 【{}】", instanceId); //保存项目信息 - projectInfo = projectLibManage.saveProjectWithVersion(projectInfo,instanceId,ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode()); + projectInfo = projectLibManage.saveProjectWithVersion(projectInfo, instanceId, ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode()); //发送给第一个审批人消息 - noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, + noticeManage.sendFirtUser(projectInfo, model.getFormName(), instanceId, WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); - return Boolean.TRUE; } - private Boolean modifyProject(Project project, String instanceId) { - //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 - try { - project.setUpdateOn(LocalDateTime.now()); - project.setInstCode(instanceId); - projectService.updateById(project); - //保存项目和实例的关系 - ProjectInst projectInst = new ProjectInst(); - projectInst.setProjectId(project.getId()); - projectInst.setInstCode(instanceId); - projectInst.setCreatOn(LocalDateTime.now()); - projectInst.setUpdateOn(LocalDateTime.now()); - projectInst.setInstType(ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode()); - projectInstService.save(projectInst); - } catch (Exception e) { - log.error("部门联审 修改项目信息 错误 ", e); - throw new BusinessException("部门联审 修改项目信息 错误 :" + e.getMessage()); - } - return Boolean.TRUE; - } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByProvincialDeptManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByProvincialDeptManage.java index 9614e79..a551ce7 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByProvincialDeptManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByProvincialDeptManage.java @@ -11,7 +11,7 @@ import com.hz.pm.api.projectlib.model.entity.ProjectApplication; import com.hz.pm.api.projectlib.service.IProjectApplicationService; import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.provincial.service.IJoinReviewProvincialBureauService; -import com.hz.pm.api.todocenter.constant.TodoCenterConstant; +import com.hz.pm.api.todocenter.constant.TodoCenterConst; import com.ningdatech.basic.function.VUtils; import com.ningdatech.file.service.FileService; import com.wflow.exception.BusinessException; @@ -105,7 +105,7 @@ public class ReviewByProvincialDeptManage { //保存一下 当前的主管单位发起人 p.setPreStartUserId(p.getSponsor()); //当前实例置为空 - p.setInstCode(TodoCenterConstant.Declared.NULL_INST_CODE); + p.setInstCode(TodoCenterConst.Declared.NULL_INST_CODE); declaringDTO.getProjectInfo().setId(p.getId()); projectService.updateById(p); if (!joinReviewProvincialBureauService.pushImportProject( diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java index 35cdc40..7fdb5cb 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java @@ -2,6 +2,7 @@ package com.hz.pm.api.projectdeclared.manage; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.NumberUtil; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -90,16 +91,15 @@ public class ReviewChecklistManage { Map> approveMap = approves.stream().collect(Collectors.groupingBy(ReviewChecklistApprove::getProjectCode)); - List reviewHumans; + List reviewHumans; + // TODO if (BizConst.DEV.equals(active)) { - reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZYD; + reviewHumans = new ArrayList<>(); } else { - reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZZD; + reviewHumans = new ArrayList<>(); } - List users = userInfoHelper.getUserFullInfoByEmployeeCodes(reviewHumans); - Set userSet = Sets.newHashSet(); - Map userMap = users.stream().filter(u -> userSet.add(u.getEmployeeCode())) - .collect(Collectors.toMap(UserFullInfoDTO::getEmployeeCode, UserFullInfoDTO::getUsername)); + List users = userInfoHelper.listUserFullInfoByUserIds(reviewHumans); + Map userMap = CollUtils.listToMap(users, UserFullInfoDTO::getUserId, UserFullInfoDTO::getUsername); List records = CollUtils.convert(page.getRecords(), w -> { ProjectReviewCheckListItemVO item = new ProjectReviewCheckListItemVO(); item.setId(w.getId()); @@ -128,7 +128,7 @@ public class ReviewChecklistManage { } private String computeVerify(ProjectReviewCheckListItemVO item, List reviewChecklistApproves, - Map userMap, UserInfoDetails user) { + Map userMap, UserInfoDetails user) { List reviewHumans; if (BizConst.DEV.equals(active)) { reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZYD; @@ -161,38 +161,18 @@ public class ReviewChecklistManage { return finishNums + StrPool.SLASH + maxNums; } - private String convertUser(Map userMap, Set computeHumanSet) { + private String convertUser(Map userMap, Set computeHumanSet) { if (CollUtil.isEmpty(userMap) || CollUtil.isEmpty(computeHumanSet)) { return StringUtils.EMPTY; } - return computeHumanSet.stream().filter(s -> StringUtils.isNotBlank(s) && userMap.containsKey(s)) - .map(userMap::get).collect(Collectors.joining(StrPool.COMMA)); + return computeHumanSet.stream() + .filter(NumberUtil::isNumber) + .map(w -> userMap.get(Long.parseLong(w))) + .collect(Collectors.joining(StrPool.COMMA)); } public UserFullInfoDTO buildReviewCheckPermission(LambdaQueryWrapper query, UserInfoDetails user) { UserFullInfoDTO userDto = BeanUtil.copyProperties(user, UserFullInfoDTO.class); - //1.只有 市本级能看到 - String regionCode = user.getRegionCode(); - String employeeCode = user.getEmployeeCode(); - //如果是七大审查之一 就可以看 - List reviewHumans; - if (BizConst.DEV.equals(active)) { - reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZYD; - } else { - reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZZD; - } - if (reviewHumans.contains(employeeCode)) { - log.warn("为七大审查人之一 可以查看"); - return userDto; - } - - if (!regionCode.equals(RegionConst.RC_HZ) || StringUtils.isBlank(employeeCode)) { - log.info("当前操作人 不是市本级 或者没有钉钉工号 :{},{},{}", user.getUsername(), - user.getRegionCode(), user.getEmployeeCode()); - query.eq(Project::getId, 0L); - return userDto; - } - Optional currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(userDto); if (!currentUserDataScope.isPresent()) { log.warn("没有取到权限信息 当前查询 没有权限条件"); @@ -228,8 +208,8 @@ public class ReviewChecklistManage { /** * 去审批 * - * @param dtos - * @return + * @param dtos \ + * @return \ */ public String approve(List dtos) { if (CollUtil.isEmpty(dtos)) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/DeclaredStatisticsMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/DeclaredStatisticsMapper.java index 597892f..f4c7705 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/DeclaredStatisticsMapper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/DeclaredStatisticsMapper.java @@ -6,7 +6,7 @@ import org.apache.ibatis.annotations.Param; /** *

- * Mapper 接口 + * Mapper 接口 *

* * @author zpf @@ -14,7 +14,7 @@ import org.apache.ibatis.annotations.Param; */ public interface DeclaredStatisticsMapper extends BaseMapper { - DeclaredProjectStatisticsPO getOrgStatistics(@Param("orgCode") String orgCode,@Param("year") Integer year); + DeclaredProjectStatisticsPO getOrgStatistics(@Param("orgCode") String orgCode, @Param("year") Integer year); - DeclaredProjectStatisticsPO getRegionStatistics(@Param("regionCode") String regionCode,@Param("year") Integer year); + DeclaredProjectStatisticsPO getRegionStatistics(@Param("year") Integer year); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/DeclaredStatisticsMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/DeclaredStatisticsMapper.xml index 41d0e3b..f7eb0f7 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/DeclaredStatisticsMapper.xml +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/mapper/DeclaredStatisticsMapper.xml @@ -33,6 +33,6 @@ sum(p.approval_amount) approvalAmount FROM nd_project p - WHERE area_code = #{regionCode} and project_year = #{year} and newest = 1 + WHERE project_year = #{year} and newest = 1 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/DeclaredStatisticsServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/DeclaredStatisticsServiceImpl.java index bda7334..0a389b1 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/DeclaredStatisticsServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/DeclaredStatisticsServiceImpl.java @@ -8,7 +8,7 @@ import org.springframework.stereotype.Service; /** *

- * 服务实现类 + * 服务实现类 *

* * @author zpf @@ -22,21 +22,23 @@ public class DeclaredStatisticsServiceImpl implements IDeclaredStatisticsService /** * 根据userId 去查询 申报项目统计 根据单位 + * * @param orgCode * @return */ @Override - public DeclaredProjectStatisticsPO getOrgStatistics(String orgCode,Integer year) { - return declaredStatisticsMapper.getOrgStatistics(orgCode,year); + public DeclaredProjectStatisticsPO getOrgStatistics(String orgCode, Integer year) { + return declaredStatisticsMapper.getOrgStatistics(orgCode, year); } /** * 根据userId 去查询 申报项目统计 根据区域 + * * @param regionCode * @return */ @Override - public DeclaredProjectStatisticsPO getRegionStatistics(String regionCode,Integer year) { - return declaredStatisticsMapper.getRegionStatistics(regionCode,year); + public DeclaredProjectStatisticsPO getRegionStatistics(String regionCode, Integer year) { + return declaredStatisticsMapper.getRegionStatistics(year); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectRenewalFundDeclarationController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectRenewalFundDeclarationController.java index a2351f7..960044f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectRenewalFundDeclarationController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectRenewalFundDeclarationController.java @@ -49,7 +49,7 @@ public class ProjectRenewalFundDeclarationController { @ApiOperation("项目续建资金库能关联的项目列表") public PageVo projectlist(ProjectRenewalListReq req) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - return projectRenewalFundManage.projectlist(req,user); + return projectRenewalFundManage.projectList(req,user); } @GetMapping("/{id}") diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AbstractProcessBusinessHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AbstractProcessBusinessHandle.java index 97c0c3e..30c17b8 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AbstractProcessBusinessHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AbstractProcessBusinessHandle.java @@ -15,7 +15,9 @@ public abstract class AbstractProcessBusinessHandle { /** * 构造,子类必须实现 */ - public AbstractProcessBusinessHandle(){} + protected AbstractProcessBusinessHandle(){ + + } /** * 抽象的,所有具体处理者应该实现的处理逻辑 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ConstructionPlanReviewHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ConstructionPlanReviewHandle.java index d663d62..b136c5b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ConstructionPlanReviewHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ConstructionPlanReviewHandle.java @@ -11,7 +11,7 @@ import com.hz.pm.api.projectlib.model.entity.ProjectInst; import com.hz.pm.api.projectlib.service.IProjectInstService; import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.projectlib.utils.ProjectVersionUtil; -import com.hz.pm.api.todocenter.constant.TodoCenterConstant; +import com.hz.pm.api.todocenter.constant.TodoCenterConst; import com.hz.pm.api.todocenter.utils.BuildUserUtils; import com.ningdatech.basic.util.NdDateUtils; import com.wflow.workflow.bean.process.ProgressNode; @@ -63,7 +63,7 @@ public class ConstructionPlanReviewHandle extends AbstractProcessBusinessHandle ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) .in(ProjectInst::getProjectId, allVersionProjectIds) .eq(ProjectInst::getInstType, InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode()) - .ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) + .ne(ProjectInst::getInstCode, TodoCenterConst.Declared.NULL_INST_CODE) .orderByDesc(ProjectInst::getCreatOn) .last(BizConst.LIMIT_1)); ProcessProgressVo instanceDetail = null; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/DeptUnitedReviewHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/DeptUnitedReviewHandle.java index 16bbb0d..01fd70d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/DeptUnitedReviewHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/DeptUnitedReviewHandle.java @@ -9,7 +9,7 @@ import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; import com.hz.pm.api.projectlib.model.entity.ProjectInst; import com.hz.pm.api.projectlib.service.IProjectInstService; import com.hz.pm.api.projectlib.service.IProjectService; -import com.hz.pm.api.todocenter.constant.TodoCenterConstant; +import com.hz.pm.api.todocenter.constant.TodoCenterConst; import com.hz.pm.api.todocenter.utils.BuildUserUtils; import com.ningdatech.basic.util.NdDateUtils; import com.wflow.workflow.bean.process.ProgressNode; @@ -64,7 +64,7 @@ public class DeptUnitedReviewHandle extends AbstractProcessBusinessHandle { ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) .in(ProjectInst::getProjectId, allVersionProjectIds) .eq(ProjectInst::getInstType, InstTypeEnum.DEPT_UNITED_REVIEW.getCode()) - .ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) + .ne(ProjectInst::getInstCode, TodoCenterConst.Declared.NULL_INST_CODE) .orderByDesc(ProjectInst::getCreatOn) .last(BizConst.LIMIT_1)); if (Objects.isNull(projectInst)) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/PreliminaryPreviewHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/PreliminaryPreviewHandle.java index 98edfc0..b68ce96 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/PreliminaryPreviewHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/PreliminaryPreviewHandle.java @@ -12,7 +12,7 @@ import com.hz.pm.api.projectlib.model.entity.ProjectInst; import com.hz.pm.api.projectlib.service.IProjectInstService; import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.projectlib.utils.ProjectVersionUtil; -import com.hz.pm.api.todocenter.constant.TodoCenterConstant; +import com.hz.pm.api.todocenter.constant.TodoCenterConst; import com.hz.pm.api.todocenter.utils.BuildUserUtils; import com.wflow.workflow.bean.process.ProgressNode; import com.wflow.workflow.bean.vo.ProcessDetailVO; @@ -67,7 +67,7 @@ public class PreliminaryPreviewHandle extends AbstractProcessBusinessHandle { ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) .in(ProjectInst::getProjectId, allVersionProjectIds) .eq(ProjectInst::getInstType, InstTypeEnum.PRELIMINARY_PREVIEW.getCode()) - .ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) + .ne(ProjectInst::getInstCode, TodoCenterConst.Declared.NULL_INST_CODE) .orderByDesc(ProjectInst::getCreatOn) .last("limit 1")); ProcessProgressVo instanceDetail = null; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectFinalInspectionHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectFinalInspectionHandle.java index 4a53a4c..b69521b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectFinalInspectionHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectFinalInspectionHandle.java @@ -13,7 +13,7 @@ import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.entity.ProjectInst; import com.hz.pm.api.projectlib.service.IProjectInstService; import com.hz.pm.api.projectlib.service.IProjectService; -import com.hz.pm.api.todocenter.constant.TodoCenterConstant; +import com.hz.pm.api.todocenter.constant.TodoCenterConst; import com.hz.pm.api.todocenter.utils.BuildUserUtils; import com.wflow.workflow.bean.process.ProgressNode; import com.wflow.workflow.bean.vo.ProcessDetailVO; @@ -61,7 +61,7 @@ public class ProjectFinalInspectionHandle extends AbstractProcessBusinessHandle ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) .in(ProjectInst::getProjectId, allVersionProjectIds) .eq(ProjectInst::getInstType, InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode()) - .ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) + .ne(ProjectInst::getInstCode, TodoCenterConst.Declared.NULL_INST_CODE) .orderByDesc(ProjectInst::getCreatOn) .last(BizConst.LIMIT_1)); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProvinceUnitedReviewHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProvinceUnitedReviewHandle.java index d72e9f8..801f9c1 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProvinceUnitedReviewHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProvinceUnitedReviewHandle.java @@ -92,7 +92,6 @@ public class ProvinceUnitedReviewHandle extends AbstractProcessBusinessHandle { processSchedule.add(processDetailVO); return; } -// processDetailVO.setProcessProgressVo(project.getSjlsResult()); processDetailVO.setContent(project.getSjlsResult()); processDetailVO.setProcessName(CommonConst.PROVINCE_UNITED_REVIEW); processSchedule.add(processDetailVO); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/UnitInnerAuditHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/UnitInnerAuditHandle.java index 266a648..73c4cbc 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/UnitInnerAuditHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/UnitInnerAuditHandle.java @@ -11,7 +11,7 @@ import com.hz.pm.api.projectlib.model.entity.ProjectInst; import com.hz.pm.api.projectlib.service.IProjectInstService; import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.projectlib.utils.ProjectVersionUtil; -import com.hz.pm.api.todocenter.constant.TodoCenterConstant; +import com.hz.pm.api.todocenter.constant.TodoCenterConst; import com.hz.pm.api.todocenter.utils.BuildUserUtils; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.util.NdDateUtils; @@ -66,7 +66,7 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle { ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) .in(ProjectInst::getProjectId, allVersionProjectIds) .eq(ProjectInst::getInstType, InstTypeEnum.UNIT_INNER_AUDIT.getCode()) - .ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) + .ne(ProjectInst::getInstCode, TodoCenterConst.Declared.NULL_INST_CODE) .orderByDesc(ProjectInst::getCreatOn) .last(BizConst.LIMIT_1)); ProcessProgressVo instanceDetail = null; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java index 1dbba65..0937703 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java @@ -10,6 +10,7 @@ import cn.hutool.poi.excel.ExcelUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Assert; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; import com.hz.pm.api.common.model.constant.CommonConst; @@ -38,7 +39,7 @@ import com.hz.pm.api.projectlib.model.vo.AnnualPlanListItemVO; import com.hz.pm.api.projectlib.service.IProjectApplicationService; import com.hz.pm.api.projectlib.service.IProjectRenewalFundDeclarationService; import com.hz.pm.api.projectlib.service.IProjectService; -import com.hz.pm.api.todocenter.constant.TodoCenterConstant; +import com.hz.pm.api.todocenter.constant.TodoCenterConst; import com.hz.pm.api.user.security.model.UserFullInfoDTO; import com.hz.pm.api.user.util.LoginUserUtil; import com.ningdatech.basic.exception.BizException; @@ -171,7 +172,7 @@ public class AnnualPlanLibManage { // 项目编号不变,版本号加1 project.setProjectCode(oldProject.getProjectCode()); project.setVersion(oldProject.getVersion() + 1); - project.setInstCode(TodoCenterConstant.Declared.NULL_INST_CODE); + project.setInstCode(TodoCenterConst.Declared.NULL_INST_CODE); project.setId(null); if (projectService.save(project)) { applicationService.saveApplication(project, oldProject, Boolean.TRUE); @@ -251,19 +252,15 @@ public class AnnualPlanLibManage { switch (currentUserDataScope.get().getRole()) { case NORMAL_MEMBER: // 普通用户 只能看到自己单位去申报的 - query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); + query.eq(Project::getBuildOrgCode, user.getMhUnitId()); break; case COMPANY_MANAGER: // 单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 - query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); + query.eq(Project::getBuildOrgCode, user.getMhUnitId()); break; case SUPER_ADMIN: // 超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 break; - case REGION_MANAGER: - // 区域管理员 看到自己区域的项目 - query.eq(Project::getAreaCode, user.getRegionCode()); - break; default: // 没有权限的话 就让它查不到 query.eq(Project::getId, "NULL"); @@ -367,16 +364,16 @@ public class AnnualPlanLibManage { public void exportModifyList(ProjectListReq param, HttpServletResponse response) { int year = LocalDateTime.now().getYear(); Integer isTemporaryAugment = param.getIsTemporaryAugment(); - if (Objects.isNull(isTemporaryAugment)) { - throw new BizException("请传入是否临时增补标志!"); - } + Assert.notNull(isTemporaryAugment, "请传入是否临时增补标志"); param.setIsTemporaryAugment(isTemporaryAugment); - String fileName = null; + String fileName; // 设置excel的文件名称和是否增补 if (CommonEnum.NO.getCode().equals(isTemporaryAugment)) { - fileName = "丽水市" + year + "年数字化项目年度计划库编辑表"; + fileName = "杭州市" + year + "年数字化项目年度计划库编辑表"; } else if (CommonEnum.YES.getCode().equals(isTemporaryAugment)) { - fileName = "丽水市" + year + "年数字化项目年度计划增补库编辑表"; + fileName = "杭州市" + year + "年数字化项目年度计划增补库编辑表"; + } else { + throw BizException.wrap("是否临时增补标志无效"); } LambdaQueryWrapper query = ProjectHelper.projectQuery(param); query.eq(Project::getNewest, Boolean.TRUE); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ApplicationManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ApplicationManage.java index 367a935..fc81cfc 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ApplicationManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ApplicationManage.java @@ -68,6 +68,7 @@ public class ApplicationManage { /** * 保存 appCode + * * @param dto * @return */ @@ -79,7 +80,7 @@ public class ApplicationManage { app.setAppCode(dto.getAppCode()); app.setUpdateOn(LocalDateTime.now()); app.setUpdateBy(userId); - if(applicationService.updateById(app)){ + if (applicationService.updateById(app)) { return BizConst.SAVE_SUCCESS; } return BizConst.SAVE_FAIL; @@ -87,6 +88,7 @@ public class ApplicationManage { /** * 获取试运行报告 + * * @param appCode * @return */ @@ -98,33 +100,33 @@ public class ApplicationManage { //请求头 HttpHeaders headers = new HttpHeaders(); - for(Map.Entry entry : header.entrySet()){ + for (Map.Entry entry : header.entrySet()) { headers.add(entry.getKey(), entry.getValue()); } //封装请求头 HttpEntity> formEntity = new HttpEntity<>(headers); RestTemplate restTemplate = new RestTemplate(); - ResponseEntity forEntity = restTemplate.exchange(appUrl, HttpMethod.GET,formEntity, ApiResponse.class); + ResponseEntity forEntity = restTemplate.exchange(appUrl, HttpMethod.GET, formEntity, ApiResponse.class); - log.info("forEntity:",JSON.toJSONString(forEntity)); - log.info("body:",forEntity.getBody()); + log.info("forEntity:", JSON.toJSONString(forEntity)); + log.info("body:", forEntity.getBody()); ApiResponse body = forEntity.getBody(); - if(!body.getCode().equals(HttpStatus.OK.value())){ + if (!body.getCode().equals(HttpStatus.OK.value())) { throw new BizException(body.getMessage()); } Object data = body.getData(); - if(Objects.nonNull(data)){ + if (Objects.nonNull(data)) { JSONObject dataJson = JSON.parseObject(JSON.toJSONString(data)); JSONArray resourceList = dataJson.getJSONArray("resourceList"); - if(CollUtil.isNotEmpty(resourceList)){ + if (CollUtil.isNotEmpty(resourceList)) { JSONObject resource = JSON.parseObject(JSON.toJSONString(resourceList.get(0))); - if(StringUtils.isBlank(resource.getString("reportOss"))){ + if (StringUtils.isBlank(resource.getString("reportOss"))) { //暂时没有 appCode 所以先返回测试数据 return "https://irs-yyyw.oss-cn-hangzhou-zwynet-d01-a.internet.cloud.zj.gov.cn/tmp/%E6%B8%A9%E5%B7%9E%E5%B8%82%E4%B9%90%E6%B8%85%E5%B8%82%E5%8C%BA%E5%9F%9F%E4%BD%93%E6%A3%80%E4%BF%A1%E6%81%AF%E7%B3%BB%E7%BB%9F_9cf0b901f2ca4fbf8ff274da359ad219.html?Expires=1687833685&OSSAccessKeyId=wMhEw2BhpIDc1xwO&Signature=UPAbMdDy23FI1sNemszg5WH%2BG40%3D"; - }else{ + } else { return resource.getString("reportOss"); } } @@ -134,19 +136,19 @@ public class ApplicationManage { /** * 查询 待注册的 + * * @param req * @return */ public PageVo toRegisterAppProjectLibList(ProjectListReq req) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); //建设单位 就是当前人的单位 - String orgCode = user.getEmpPosUnitCode(); Page page = req.page(); - projectService.page(page,Wrappers.lambdaQuery(Project.class) + projectService.page(page, Wrappers.lambdaQuery(Project.class) .eq(Project::getStage, ProjectStatusEnum.NOT_APPROVED.getCode()) .eq(Project::getStatus, ProjectStatusEnum.TO_BE_APP_REGISTER.getCode()) - .eq(Project::getBuildOrgCode,orgCode)); - if(CollUtil.isEmpty(page.getRecords())){ + .eq(Project::getBuildOrgCode, user.getMhUnitId())); + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } @@ -154,24 +156,24 @@ public class ApplicationManage { //要去查询应用 此阶段 必定是 建设方案后的 所以直接查 建设方案的应用 List apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) .in(ProjectApplication::getProjectCode, projectCodes) - .eq(ProjectApplication::getIsConstruct,Boolean.TRUE)); + .eq(ProjectApplication::getIsConstruct, Boolean.TRUE)); Map> appMap = apps.stream().collect(Collectors.groupingBy(ProjectApplication::getProjectCode)); List res = page.getRecords().stream().map(p -> { - ProjectDetailVO vo = BeanUtil.copyProperties(p,ProjectDetailVO.class); - if(appMap.containsKey(p.getProjectCode())){ + ProjectDetailVO vo = BeanUtil.copyProperties(p, ProjectDetailVO.class); + if (appMap.containsKey(p.getProjectCode())) { List projectApplications = appMap.get(p.getProjectCode()); vo.setProjectApplications(convert(projectApplications)); } return vo; }).collect(Collectors.toList()); - return PageVo.of(res,page.getTotal()); + return PageVo.of(res, page.getTotal()); } private List convert(List projectApplications) { - if(CollUtil.isNotEmpty(projectApplications)){ + if (CollUtil.isNotEmpty(projectApplications)) { return projectApplications.stream() - .map(a -> BeanUtil.copyProperties(a,ProjectApplicationVO.class)) + .map(a -> BeanUtil.copyProperties(a, ProjectApplicationVO.class)) .collect(Collectors.toList()); } return Collections.emptyList(); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java index a0a1be6..ea0fed2 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java @@ -3,6 +3,7 @@ package com.hz.pm.api.projectlib.manage; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.lang.Assert; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; @@ -10,20 +11,13 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.file.entity.File; -import com.ningdatech.file.service.FileService; import com.hz.pm.api.common.compare.CompareUtils; -import com.hz.pm.api.common.model.constant.BizConst; -import com.hz.pm.api.common.model.constant.CommonConst; -import com.hz.pm.api.common.model.constant.RegionConst; import com.hz.pm.api.common.enumeration.CommonEnum; import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.model.constant.BizConst; +import com.hz.pm.api.common.model.constant.CommonConst; import com.hz.pm.api.common.model.entity.ExcelExportWriter; import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.common.util.BizUtils; @@ -38,7 +32,6 @@ import com.hz.pm.api.filemanage.model.entity.ProjectApplyBorrow; import com.hz.pm.api.filemanage.service.INdProjectApplyBorrowService; import com.hz.pm.api.gov.model.vo.GovBizProjectDetailVO; import com.hz.pm.api.gov.utils.ProjectConvertUtil; -import com.hz.pm.api.organization.model.entity.DingOrganization; import com.hz.pm.api.organization.service.IDingOrganizationService; import com.hz.pm.api.performance.model.dto.ProjectCoreBusinessDTO; import com.hz.pm.api.performance.model.entity.ProjectCoreBusinessIndicators; @@ -53,14 +46,14 @@ import com.hz.pm.api.projectdeclared.model.entity.*; import com.hz.pm.api.projectdeclared.model.vo.*; import com.hz.pm.api.projectdeclared.service.*; import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil; -import com.hz.pm.api.projectlib.model.constant.ProjectConstant; -import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; -import com.hz.pm.api.projectlib.model.enumeration.ProjectRenewalApprovalStatusEnum; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.handle.ProcessExecuteChainHandle; import com.hz.pm.api.projectlib.helper.ProjectHelper; +import com.hz.pm.api.projectlib.model.constant.ProjectConstant; import com.hz.pm.api.projectlib.model.dto.ProjectDTO; import com.hz.pm.api.projectlib.model.entity.*; +import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.model.enumeration.ProjectRenewalApprovalStatusEnum; +import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.model.po.ProjectPO; import com.hz.pm.api.projectlib.model.req.ProjectApplicationListReq; import com.hz.pm.api.projectlib.model.req.ProjectListReq; @@ -81,6 +74,11 @@ import com.hz.pm.api.todocenter.service.ITodoService; 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; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.file.entity.File; +import com.ningdatech.file.service.FileService; import com.wflow.exception.BusinessException; import com.wflow.workflow.bean.vo.ProcessDetailVO; import lombok.RequiredArgsConstructor; @@ -264,8 +262,8 @@ public class ProjectLibManage { item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); if (finalUser.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) - && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) - && w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) { + && StringUtils.isNotBlank(w.getSuperOrgCode()) + && w.getSuperOrgCode().equals(finalUser.getMhUnitIdStr())) { item.setCanPreDeclared(Boolean.TRUE); } item.setApprovedAmount(w.getApprovalAmount()); @@ -312,7 +310,7 @@ public class ProjectLibManage { .asc() .list(); Map> map = Maps.newHashMap(); - Map userMap = Maps.newHashMap(); + Map userMap = Maps.newHashMap(); if (CollUtil.isNotEmpty(tasks)) { map = tasks.stream() .collect(Collectors.groupingBy(Task::getProcessInstanceId)); @@ -341,8 +339,8 @@ public class ProjectLibManage { 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())) { + && StringUtils.isNotBlank(w.getSuperOrgCode()) + && w.getSuperOrgCode().equals(finalUser.getMhUnitIdStr())) { item.setCanPreDeclared(Boolean.TRUE); } item.setApprovedAmount(w.getApprovalAmount()); @@ -354,27 +352,23 @@ public class ProjectLibManage { } private List buildApproveUsers(String instCode, Map> map, - Map userMap) { + Map userMap) { if (map.containsKey(instCode)) { List tasks = map.get(instCode); - return tasks.stream().map(task -> userMap.get(task.getAssignee())) + return tasks.stream().map(task -> userMap.get(Long.parseLong(task.getAssignee()))) .filter(Objects::nonNull).collect(Collectors.toList()); } return Collections.emptyList(); } - private Map searchUser(List tasks, UserInfoHelper userInfoHelper) { + private Map searchUser(List tasks, UserInfoHelper userInfoHelper) { if (CollUtil.isEmpty(tasks)) { return Collections.emptyMap(); } - List users = userInfoHelper.getUserFullInfoByEmployeeCodes( - tasks.stream().map(Task::getAssignee).collect(Collectors.toSet())); - if (CollUtil.isNotEmpty(users)) { - Set employeeSet = Sets.newHashSet(); - return users.stream().filter(u -> employeeSet.add(u.getEmployeeCode())).collect(Collectors - .toMap(UserFullInfoDTO::getEmployeeCode, u -> u)); - } - return Collections.emptyMap(); + List users = userInfoHelper.listUserFullInfoByUserIds( + tasks.stream().map(w -> Long.parseLong(w.getAssignee())) + .collect(Collectors.toSet())); + return users.stream().collect(Collectors.toMap(UserFullInfoDTO::getUserId, u -> u)); } /** @@ -444,8 +438,8 @@ public class ProjectLibManage { item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); if (user.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) - && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(user.getEmpPosUnitCode()) - && w.getSuperOrgCode().equals(user.getEmpPosUnitCode())) { + && StringUtils.isNotBlank(w.getSuperOrgCode()) + && w.getSuperOrgCode().equals(user.getMhUnitIdStr())) { item.setCanPreDeclared(Boolean.TRUE); } item.setApprovedAmount(w.getApprovalAmount()); @@ -525,8 +519,8 @@ public class ProjectLibManage { item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); if (user.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) - && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(user.getEmpPosUnitCode()) - && w.getSuperOrgCode().equals(user.getEmpPosUnitCode())) { + && StringUtils.isNotBlank(w.getSuperOrgCode()) + && w.getSuperOrgCode().equals(user.getMhUnitIdStr())) { item.setCanPreDeclared(Boolean.TRUE); } item.setApprovedAmount(w.getApprovalAmount()); @@ -564,7 +558,7 @@ public class ProjectLibManage { .asc() .list(); Map> map = Maps.newHashMap(); - Map userMap = Maps.newHashMap(); + Map userMap = Maps.newHashMap(); if (CollUtil.isNotEmpty(tasks)) { map = tasks.stream() .collect(Collectors.groupingBy(Task::getProcessInstanceId)); @@ -593,8 +587,8 @@ public class ProjectLibManage { item.setApproveUsers(buildApproveUsers(w.getInstCode(), map, userMap)); if (user.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) - && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(user.getEmpPosUnitCode()) - && w.getSuperOrgCode().equals(user.getEmpPosUnitCode())) { + && StringUtils.isNotBlank(w.getSuperOrgCode()) + && w.getSuperOrgCode().equals(user.getMhUserId())) { item.setCanPreDeclared(Boolean.TRUE); } item.setApprovedAmount(w.getApprovalAmount()); @@ -841,12 +835,11 @@ public class ProjectLibManage { * * @param projectDto * @param instanceId - * @param employeeCode * @return */ public Project saveProjectInDeclared(ProjectDTO projectDto, String instanceId, - String employeeCode) { - Project project = saveProjectNewVersion(projectDto, instanceId, employeeCode, Boolean.FALSE); + Long userId) { + Project project = saveProjectNewVersion(projectDto, instanceId, userId, Boolean.FALSE); //保存项目和实例的关系 ProjectInst projectInst = new ProjectInst(); projectInst.setProjectId(project.getId()); @@ -862,16 +855,16 @@ public class ProjectLibManage { /** * 建设方案申报项目时 保存项目信息和其它相关联的信息 * - * @param projectDto - * @param instanceId - * @param employeeCode - * @param oldProject - * @return + * @param projectDto \ + * @param instanceId \ + * @param userId \ + * @param oldProject \ + * @return \ */ public Project saveConstructProjectInDeclared(ProjectDTO projectDto, String instanceId, - String employeeCode, Project oldProject) { + Long userId, Project oldProject) { - Project project = saveConstructProjectNewVersion(projectDto, instanceId, employeeCode, oldProject); + Project project = saveConstructProjectNewVersion(projectDto, instanceId, userId, oldProject); // 将旧的项目状态、阶段置为null,防止项目还会出现在待申报列表 LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(Project.class); updateWrapper.set(Project::getStage, null) @@ -894,11 +887,10 @@ public class ProjectLibManage { * * @param projectDto * @param instanceId - * @param employeeCode * @return */ public Project saveProjectNewVersion(ProjectDTO projectDto, String instanceId, - String employeeCode, Boolean isContruct) { + Long userId, Boolean isContruct) { //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 try { Project project = new Project(); @@ -910,7 +902,7 @@ public class ProjectLibManage { project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); project.setInstCode(instanceId); - project.setSponsor(employeeCode); + project.setSponsor(String.valueOf(userId)); String projectCode = generateProjectCodeUtil.generateProjectCode(projectDto); project.setProjectCode(projectCode); if (projectService.save(project)) { @@ -921,7 +913,7 @@ public class ProjectLibManage { project = newProjectWithVersion(projectDto, isContruct); if (Objects.nonNull(project)) { project.setInstCode(instanceId); - project.setSponsor(employeeCode); + project.setSponsor(String.valueOf(userId)); projectService.updateById(project); } } @@ -935,14 +927,14 @@ public class ProjectLibManage { /** * 建设方案申报项目时 保存项目信息和其它相关联的信息 * - * @param projectDto - * @param instanceId - * @param employeeCode - * @param oldProject - * @return + * @param projectDto \ + * @param instanceId \ + * @param userId \ + * @param oldProject \ + * @return \ */ public Project saveConstructProjectNewVersion(ProjectDTO projectDto, String instanceId, - String employeeCode, Project oldProject) { + Long userId, Project oldProject) { //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 try { Project project = new Project(); @@ -956,7 +948,7 @@ public class ProjectLibManage { project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); project.setInstCode(instanceId); - project.setSponsor(employeeCode); + project.setSponsor(String.valueOf(userId)); // 项目编号不变,版本号加1 project.setProjectCode(oldProject.getProjectCode()); project.setVersion(oldProject.getVersion() + 1); @@ -981,7 +973,7 @@ public class ProjectLibManage { project = newProjectWithVersion(projectDto, Boolean.TRUE); if (Objects.nonNull(project)) { project.setInstCode(instanceId); - project.setSponsor(employeeCode); + project.setSponsor(String.valueOf(userId)); projectService.updateById(project); } } @@ -1038,14 +1030,13 @@ public class ProjectLibManage { return project; } - public Project saveProjectWithVersionAndStatus(ProjectDTO projecDto, Integer stageCode, Integer statusCode, Boolean isConstruct) { - Project oldProject = projectService.getById(projecDto.getId()); + public Project saveProjectWithVersionAndStatus(ProjectDTO projectDto, Integer stageCode, Integer statusCode, Boolean isConstruct) { + Project oldProject = projectService.getById(projectDto.getId()); Project project = new Project(); - VUtils.isTrue(Objects.isNull(oldProject)) - .throwMessage("项目不存在!"); + Assert.notNull(oldProject, "项目不存在"); BeanUtil.copyProperties(oldProject, project, CopyOptions.create() .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - BeanUtil.copyProperties(projecDto, project, CopyOptions.create() + BeanUtil.copyProperties(projectDto, project, CopyOptions.create() .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); project.setVersion(oldProject.getVersion() + 1); project.setId(null); @@ -1065,20 +1056,20 @@ public class ProjectLibManage { if (projectService.save(project)) { projectService.reverseNewest(project.getProjectCode(), project.getId()); - saveApplication(projecDto, project, isConstruct); + saveApplication(projectDto, project, isConstruct); } return project; } - public Project saveProjectWithVersion(ProjectDTO projecDto, String instanceId, Integer instType, Boolean isConstruct) { - Project oldProject = projectService.getById(projecDto.getId()); + public Project saveProjectWithVersion(ProjectDTO projectDto, String instanceId, Integer instType, Boolean isConstruct) { + Project oldProject = projectService.getById(projectDto.getId()); Project project = new Project(); VUtils.isTrue(Objects.isNull(oldProject)) .throwMessage("项目不存在!"); BeanUtil.copyProperties(oldProject, project, CopyOptions.create() .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); - BeanUtil.copyProperties(projecDto, project, CopyOptions.create() + BeanUtil.copyProperties(projectDto, project, CopyOptions.create() .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); project.setVersion(oldProject.getVersion() + 1); project.setId(null); @@ -1099,7 +1090,7 @@ public class ProjectLibManage { projectService.reverseNewest(project.getProjectCode(), project.getId()); //app - saveApplication(projecDto, project, isConstruct); + saveApplication(projectDto, project, isConstruct); } return project; @@ -1107,8 +1098,7 @@ public class ProjectLibManage { public Project saveProjectWithVersion(Project oldProject, String instanceId, Integer instType) { Project project = new Project(); - VUtils.isTrue(Objects.isNull(oldProject)) - .throwMessage("项目不存在!"); + Assert.notNull(oldProject, "项目不存在"); BeanUtil.copyProperties(oldProject, project, CopyOptions.create() .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); project.setVersion(oldProject.getVersion() + 1); @@ -1250,27 +1240,12 @@ public class ProjectLibManage { // 从申请借阅信息表中查出本单位及下属单位审批通过的项目 LambdaQueryWrapper query = Wrappers.lambdaQuery(ProjectApplyBorrow.class) .select(ProjectApplyBorrow::getProjectId) - .in(ProjectApplyBorrow::getApplyBorrowEmpPosUnitCode, subOrgSet) + .in(ProjectApplyBorrow::getApplyBorrowOrgCode, subOrgSet) .eq(ProjectApplyBorrow::getIsSuccess, Boolean.TRUE); List applyBorrowProjectIdList = CollUtils.fieldList(projectApplyBorrowService.list(query), ProjectApplyBorrow::getProjectId); return applyBorrowProjectIdList.contains(project.getId()); } - private Set getSubOrgList(String empPosUnitCode) { - Set orgSet = new HashSet<>(); - // 先将自己加入子集 - orgSet.add(empPosUnitCode); - Set subOrgList = dingOrganizationService - .list(Wrappers.lambdaQuery(DingOrganization.class).eq(DingOrganization::getParentCode, empPosUnitCode)) - .stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toSet()); - // 遍历子集 - for (String orgCode : subOrgList) { - orgSet.addAll(getSubOrgList(orgCode)); - } - return orgSet; - } - - public void exportList(ProjectListReq param, HttpServletResponse response) { param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); @@ -1313,28 +1288,18 @@ public class ProjectLibManage { switch (currentUserDataScope.get().getRole()) { case NORMAL_MEMBER: //普通用户 只能看到自己单位去申报的 - query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); + query.eq(Project::getBuildOrgCode, user.getMhUnitId()); break; case COMPANY_MANAGER: //单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 - query.and(q1 -> q1.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()).or(q2 -> + query.and(q1 -> q1.eq(Project::getBuildOrgCode, user.getMhUnitId()).or(q2 -> q2.eq(Project::getStage, ProjectStatusEnum.NOT_APPROVED.getCode()) .eq(Project::getStatus, ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) - .eq(Project::getSuperOrgCode, user.getEmpPosUnitCode()))); + .eq(Project::getSuperOrgCode, user.getMhUnitId()))); break; case SUPER_ADMIN: //超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 break; - case REGION_MANAGER: - //区域管理员 看到自己区域的项目 如果是市本级 就看全市的 - if (RegionConst.RC_HZ.equals(user.getRegionCode())) { - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(user.getRegionCode(), - RegionConst.RL_CITY); - query.in(Project::getAreaCode, regionCodes); - } else { - query.eq(Project::getAreaCode, user.getRegionCode()); - } - break; case VISITOR: //访客可以看全市的 break; @@ -1359,27 +1324,16 @@ public class ProjectLibManage { case NORMAL_MEMBER: //普通用户 只能看到自己单位去申报的 req.setUserType("normal"); - req.setUserValue(user.getEmpPosUnitCode()); + req.setUserValue(user.getMhUnitIdStr()); break; case COMPANY_MANAGER: //单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 req.setUserType("org"); - req.setUserValue(user.getEmpPosUnitCode()); + req.setUserValue(user.getMhUnitIdStr()); break; case SUPER_ADMIN: //超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 break; - case REGION_MANAGER: - //区域管理员 看到自己区域的项目 如果是市本级 就看全市的 - if (RegionConst.RC_HZ.equals(user.getRegionCode())) { - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(user.getRegionCode(), - RegionConst.RL_CITY); - req.setRegionCodes(regionCodes); - } else { - req.setUserRegionCode(user.getRegionCode()); - } - req.setUserType("region"); - break; case VISITOR: //访客可以看全市的 break; @@ -1434,8 +1388,8 @@ public class ProjectLibManage { // 保存项目借阅信息 ProjectApplyBorrow projectApplyBorrow = new ProjectApplyBorrow(); projectApplyBorrow.setProjectId(project.getId()); - projectApplyBorrow.setApplyBorrowEmployeeCode(user.getEmployeeCode()); - projectApplyBorrow.setApplyBorrowEmpPosUnitCode(user.getEmpPosUnitCode()); + projectApplyBorrow.setApplyBorrowUserId(user.getUserIdStr()); + projectApplyBorrow.setApplyBorrowOrgCode(user.getMhUnitIdStr()); projectApplyBorrow.setInstanceId(instanceId); projectApplyBorrow.setCreateOn(LocalDateTime.now()); projectApplyBorrow.setCreateBy(LoginUserUtil.getUserId()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java index 51e4f6d..e4b4e0a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java @@ -114,12 +114,12 @@ public class ProjectRenewalFundManage { return PageVo.of(records, total); } - public PageVo projectlist(ProjectRenewalListReq req, UserFullInfoDTO user) { + public PageVo projectList(ProjectRenewalListReq req, UserFullInfoDTO user) { LambdaQueryWrapper query = ProjectRenewFundHelper.projectQuery(req); //项目查最新 query.eq(Project::getNewest, Boolean.TRUE); //自己单位 - query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); + query.eq(Project::getBuildOrgCode, user.getMhUnitId()); //立项批复后 都可以 query.gt(Project::getStatus, ProjectStatusEnum.APPROVED_AFTER_CHOICE.getCode()); Page page = projectService.page(req.page(), query); @@ -162,8 +162,8 @@ public class ProjectRenewalFundManage { item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); if (finalUser.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) - && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) - && w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) { + && StringUtils.isNotBlank(w.getSuperOrgCode()) + && w.getSuperOrgCode().equals(finalUser.getMhUnitIdStr())) { item.setCanPreDeclared(Boolean.TRUE); } item.setApprovedAmount(w.getApprovalAmount()); @@ -601,25 +601,15 @@ public class ProjectRenewalFundManage { case NORMAL_MEMBER: //普通用户 只能看到自己单位去申报的 req.setUserType("normal"); - req.setUserValue(user.getEmpPosUnitCode()); + req.setUserValue(user.getMhUnitIdStr()); break; case COMPANY_MANAGER: case SUPER_ADMIN: + case REGION_MANAGER: //单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 //超级管理员 也只能看本单位的 req.setUserType("org"); - req.setUserValue(user.getEmpPosUnitCode()); - break; - case REGION_MANAGER: - //区域管理员 看到自己区域的项目 如果是市本级 就看全市的 - if (RegionConst.RC_HZ.equals(user.getRegionCode())) { - Collection regionCodes = regionCacheHelper.listChildRegionCodeList(user.getRegionCode(), - RegionConst.RL_CITY); - req.setRegionCodes(regionCodes); - } else { - req.setUserRegionCode(user.getRegionCode()); - } - req.setUserType("region"); + req.setUserValue(user.getMhUnitIdStr()); break; case VISITOR: //访客可以看全市的 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/AnalysisEventMonitor.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/AnalysisEventMonitor.java deleted file mode 100644 index d4cd959..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/AnalysisEventMonitor.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.hz.pm.api.projectlib.model.entity; - -import com.alibaba.excel.context.AnalysisContext; -import com.alibaba.excel.event.AnalysisEventListener; -import com.ningdatech.basic.exception.BizException; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.util.*; - -/** - * @author CMM - * @since 2023/04/17 18:26 - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class AnalysisEventMonitor extends AnalysisEventListener> { - - private final List records = new ArrayList<>(); - - /** - * 存储Key - */ - Map key = new HashMap<>(); - /** - * keyList - */ - List keyList = new ArrayList<>(); - - @Override - public void onException(Exception exception, AnalysisContext context) throws Exception { - super.onException(exception, context); - throw BizException.wrap("导入年度计划解析失败"); - } - - @Override - public void invokeHeadMap(Map headMap, AnalysisContext context) { - Set integerSet = headMap.keySet(); - for (Integer integer : integerSet) { - keyList.add(headMap.get(integer)); - } - key.putAll(headMap); - } - - @Override - public void invoke(Map integerStringMap, AnalysisContext context) { - //Project project = new Project(); - //project.setId(data.getProjectId()); - //project.setProjectName(data.getProjectName()); - //project.setProjectIntroduction(data.getProjectIntroduction()); - //// 建设依据忽略 - //project.setIsFirst(CommonConst.NEW_CONSTRUCTION.equals(data.getIsFirst()) ? 1 : 0); - //String[] dataArr = data.getBuildCycle().split(CommonConst.ZHI); - //project.setBeginTime(dataArr[0].trim()); - //project.setEndTime(dataArr[1].trim()); - //project.setDeclareAmount(data.getDeclaredAmount()); - //project.setAnnualPlanAmount(data.getAnnualPlanAmount()); - //project.setDeclareHaveAmount(data.getDeclareHaveAmount()); - //project.setDeclareGovOwnFinanceAmount(data.getDeclareGovOwnFinanceAmount()); - //project.setDeclareGovSuperiorFinanceAmount(data.getDeclareGovSuperiorFinanceAmount()); - //project.setDeclareBankLendingAmount(data.getDeclareBankLendingAmount()); - //project.setDeclareOtherAmount(data.getDeclareOtherAmount()); - //project.setEngineeringSpeedOne(data.getFirstQuarter()); - //project.setEngineeringSpeedTwo(data.getSecondQuarter()); - //project.setEngineeringSpeedThree(data.getThirdQuarter()); - //project.setEngineeringSpeedFour(data.getFourthQuarter()); - //project.setBuildOrgName(data.getBuildUnitName()); - //project.setContactName(data.getContactName()); - //project.setResponsibleMan(data.getResponsibleMan()); - //project.setProjectRemarks(data.getProjectRemarks()); - //records.add(project); - } - - @Override - public void doAfterAllAnalysed(AnalysisContext context) { - //if (records.isEmpty()) { - // throw BizException.wrap("导入年度计划为空"); - //} - //List projectIds = CollUtils.fieldList(records, Project::getId); - //long count = projectService.count(Wrappers.lambdaQuery(Project.class) - // .in(Project::getId, projectIds)); - //if (count != records.size()) { - // throw BizException.wrap("请确保所有项目都存在"); - //} - //projectService.updateBatchById(records); - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectInst.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectInst.java index 7537377..2e7e20f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectInst.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/ProjectInst.java @@ -19,7 +19,7 @@ import lombok.Data; */ @TableName("nd_project_inst") @Data -@ApiModel(value = "NdProjectInst对象", description = "") +@ApiModel(value = "NdProjectInst对象") public class ProjectInst implements Serializable { private static final long serialVersionUID = 1L; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/po/ProjectPO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/po/ProjectPO.java index 0beb067..572339b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/po/ProjectPO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/po/ProjectPO.java @@ -19,7 +19,7 @@ import java.time.LocalDateTime; * @since 2023-09-26 */ @Data -@ApiModel(value = "NdProject对象", description = "") +@ApiModel(value = "NdProject对象") public class ProjectPO implements Serializable { private static final long serialVersionUID = 1L; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectLibListItemVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectLibListItemVO.java index bd01ced..654f9a3 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectLibListItemVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectLibListItemVO.java @@ -3,13 +3,9 @@ package com.hz.pm.api.projectlib.model.vo; import com.alibaba.fastjson.annotation.JSONField; import com.fasterxml.jackson.annotation.JsonFormat; import com.hz.pm.api.common.compare.Compare; -import com.hz.pm.api.common.enumeration.CommonEnum; import com.hz.pm.api.portrait.model.vo.TagVO; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; 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; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Builder; @@ -167,17 +163,5 @@ public class ProjectLibListItemVO { @ApiModelProperty("年度投资金额总额") private BigDecimal annualAccumulateAmount; private List annualAccumulateAmountList; - public Boolean getNeedUploadSuperLineFile() { - UserInfoDetails userInfoDetail = LoginUserUtil.loginUserDetail(); - //要满足条件 1.当前登录人是市本级单位 2.有上级条线单位 3.项目状态是待预审 - if (Objects.nonNull(userInfoDetail) && userInfoDetail.getIsMunicipalOrg() - && Objects.nonNull(this.isHigherSuperOrg) - && ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(this.status) - && CommonEnum.YES.getCode().equals(this.isHigherSuperOrg)) { - this.needUploadSuperLineFile = Boolean.TRUE; - return this.needUploadSuperLineFile; - } - this.needUploadSuperLineFile = null; - return this.needUploadSuperLineFile; - } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectRenewalFundDeclarationVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectRenewalFundDeclarationVO.java index c58c619..38b33e5 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectRenewalFundDeclarationVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectRenewalFundDeclarationVO.java @@ -6,7 +6,6 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.apache.commons.lang3.StringUtils; -import java.io.Serializable; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; @@ -22,7 +21,7 @@ import java.util.Objects; */ @ApiModel(value = "NdProjectRenewalFundDeclarationVO", description = "续建项目资金申请表") @Data -public class ProjectRenewalFundDeclarationVO implements Serializable { +public class ProjectRenewalFundDeclarationVO { private static final long serialVersionUID = 1L; @@ -97,8 +96,8 @@ public class ProjectRenewalFundDeclarationVO implements Serializable { @ApiModelProperty("年度投资金额详情") private List annualAccumulateAmountList; - public String getProjectTypeName(){ - if(Objects.nonNull(this.projectType)){ + public String getProjectTypeName() { + if (Objects.nonNull(this.projectType)) { return ProjectTypeNewEnum.getDesc(this.projectType); } return StringUtils.EMPTY; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/controller/TestController.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/controller/TestController.java index e93b011..78645e4 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/controller/TestController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/controller/TestController.java @@ -6,6 +6,7 @@ import com.hz.pm.api.provincial.model.res.SjApiResponse; import com.hz.pm.api.provincial.service.IJoinReviewProvincialBureauService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -25,15 +26,13 @@ import java.io.InputStream; */ @Slf4j @RestController +@RequiredArgsConstructor @RequestMapping("/api/v1/test") @Api(tags = "测试省局接口") public class TestController { - @Autowired - private IJoinReviewProvincialBureauService joinReviewProvincialBureauService; - - @Autowired - private ReviewByProvincialDeptManage provincialDeptManage; + private final IJoinReviewProvincialBureauService joinReviewProvincialBureauService; + private final ReviewByProvincialDeptManage provincialDeptManage; @GetMapping("/push") @ApiOperation("测试推送") @@ -52,9 +51,6 @@ public class TestController { @GetMapping("/path") @ApiOperation("测试获取详情") public String path() throws IOException { -// String template = ResourceUtil.getResource("template").getPath(); -// return template; - InputStream in = this.getClass().getResourceAsStream("/template/simsun.ttc"); StringBuilder sb = new StringBuilder(); int n; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/ProvincialProjectRes.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/ProvincialProjectRes.java index d341502..600dcfe 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/ProvincialProjectRes.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/ProvincialProjectRes.java @@ -7,7 +7,6 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import java.io.Serializable; import java.math.BigDecimal; import java.util.List; @@ -21,8 +20,8 @@ import java.util.List; @Builder @AllArgsConstructor @NoArgsConstructor -@ApiModel(value = "ProvincialProjectDTO", description = "") -public class ProvincialProjectRes implements Serializable { +@ApiModel(value = "ProvincialProjectDTO") +public class ProvincialProjectRes { @ApiModelProperty("项目审核结果 1审核中 2审核通过 3审核不通过") private Integer projectStatus; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/SjApiResponse.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/SjApiResponse.java index 5c3ea1c..414d1c4 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/SjApiResponse.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/model/res/SjApiResponse.java @@ -65,7 +65,7 @@ public class SjApiResponse implements Serializable { * @return ApiResponse */ public static SjApiResponse of(Integer code, String msg, T data) { - return new SjApiResponse(code, msg, data); + return new SjApiResponse<>(code, msg, data); } /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/safety/manage/SafetyRiskManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/safety/manage/SafetyRiskManage.java index 2004695..b475e83 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/safety/manage/SafetyRiskManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/safety/manage/SafetyRiskManage.java @@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Assert; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.hz.pm.api.common.model.constant.BizConst; @@ -87,20 +88,12 @@ public class SafetyRiskManage { */ private void checkAuth(LambdaQueryWrapper query, UserInfoDetails user) { //如果是超管 - if (user.getSuperAdmin()) { + if (user.getSuperAdmin() || user.getRegionAdmin()) { log.info(user.getUsername() + " 是超管,可以看所有项目"); - } else if (user.getRegionAdmin()) { - //如果是区域管理员 - log.info(user.getUsername() + " 是区管,可以看本区域" + user.getRegionCode() + "项目"); - if (!RegionConst.RC_HZ.equals(user.getRegionCode())) { - //不是丽水市本级的话 就只看 自己区域的 - query.eq(Project::getAreaCode, user.getRegionCode()); - } - //如果是市本级 就能看所有的 } else if (user.getIsOrgAdmin()) { //单位管理员 - log.info(user.getUsername() + " 是单位管理员,可以看单位 " + user.getEmpPosUnitName() + " 项目"); - query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); + log.info(user.getUsername() + " 是单位管理员,可以看单位 " + user.getMhUnitId() + " 项目"); + query.eq(Project::getBuildOrgCode, user.getMhUnitId()); } else { //其它角色全都看不见 query.eq(Project::getId, 0L); @@ -186,7 +179,7 @@ public class SafetyRiskManage { .eq(Project::getProjectCode, projectCode) .last(BizConst.LIMIT_1)); - VUtils.isTrue(Objects.isNull(project)).throwMessage("此项目并不存在!"); + Assert.notNull(project, "此项目并不存在!"); SupplierSafetyQualification entity = BeanUtil.copyProperties(dto, SupplierSafetyQualification.class); entity.setCreateBy(user.getUsername()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/CcTaskListener.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/CcTaskListener.java index 2f1a36f..2f21cbd 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/CcTaskListener.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/CcTaskListener.java @@ -111,7 +111,7 @@ public class CcTaskListener { Long projectId = projectInst.getProjectId(); Project project = projectService.getNewProject(projectId); - UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(task.getUserId()); + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(Long.valueOf(task.getUserId())); //发送消息 noticeManage.sendNotice(task.getUserId(), Objects.nonNull(user) ? user.getUserId() : 93L, project, instance.getProcessDefinitionName(), diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/EarlyWarningListener.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/EarlyWarningListener.java index e2064c6..5258b16 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/EarlyWarningListener.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/EarlyWarningListener.java @@ -23,6 +23,7 @@ import org.flowable.engine.history.HistoricProcessInstance; import org.springframework.context.event.EventListener; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; + import java.time.ZoneId; import java.util.List; import java.util.Objects; @@ -106,11 +107,11 @@ public class EarlyWarningListener { //项目 预警信息 projectEarlyWarningService.earlyWarning(project, - WarningRuleTypeEnum.PROCESS_WARNING.getCode(),noticeType); + WarningRuleTypeEnum.PROCESS_WARNING.getCode(), noticeType); - if(StringUtils.isBlank(noticeMethod) || + if (StringUtils.isBlank(noticeMethod) || (!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && - !noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ + !noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))) { log.info("通知方式为空或者错误!"); return; } @@ -118,15 +119,15 @@ public class EarlyWarningListener { //这一批员工要通知的员工号 String batchEmployees = hais.stream().map(HistoricActivityInstance::getAssignee) .collect(Collectors.joining(StrPool.COMMA)); - for(HistoricActivityInstance hai : hais){ + for (HistoricActivityInstance hai : hais) { String employeeCode = hai.getAssignee(); String taskId = hai.getTaskId(); - String path = "toDoCenter/handleDuringExamine?instanceId=" + + String path = "toDoCenter/handleDuringExamine?instanceId=" + instanceId + "&projectId=" + projectId + "&nodeId=" + nodeId + "&taskId=" + taskId; - earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,timeout,overTimeout, pi.getInstType(), + earlyWarningManage.doEarlyWarning(noticeMethod, noticeContent, timeout, overTimeout, pi.getInstType(), hai.getStartTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime() - ,employeeCode,project,WarningRuleTypeEnum.PROCESS_WARNING.getCode(),noticeType, - path,batchEmployees,nodeId); + , Long.valueOf(employeeCode), project, WarningRuleTypeEnum.PROCESS_WARNING.getCode(), noticeType, + path, batchEmployees, nodeId); } } } \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java index 757b9a2..08ee29f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java @@ -39,6 +39,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.context.event.EventListener; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; + import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -92,7 +93,7 @@ public class ProcessEndListener { try { Thread.sleep(3000); } catch (InterruptedException e) { - throw new RuntimeException(e); + throw new BizException(e); } //1.去查找 项目实例关系表 @@ -116,26 +117,22 @@ public class ProcessEndListener { //已经没有任务了 if (CollUtil.isEmpty(tasks) && CollUtil.isEmpty(historyTasks)) { - List historyTasksFinished = historyService.createHistoricTaskInstanceQuery() - .processInstanceId(instCode) - .finished() - .list(); - Long projectId = projectInst.getProjectId(); Project project = projectService.getNewProject(projectId); HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() .processInstanceId(instCode).singleResult(); //通过审核后 所处理的逻辑 - afterPassTodo(project,instance); + afterPassTodo(project, instance); } } /** * 审核通过后 所处理的逻辑 - * @param declaredProject - * @param instance + * + * @param declaredProject \ + * @param instance \ */ - public void afterPassTodo(Project declaredProject, HistoricProcessInstance instance){ + public void afterPassTodo(Project declaredProject, HistoricProcessInstance instance) { Long userId = 110L; // 获取流程通过后的流程实例 HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() @@ -148,7 +145,7 @@ public class ProcessEndListener { .last(BizConst.LIMIT_1)); Integer instType = projectInst.getInstType(); InstTypeEnum instTypeEnum = InstTypeEnum.getByCode(instType); - if (Objects.isNull(instTypeEnum)){ + if (Objects.isNull(instTypeEnum)) { throw new BizException("当前审批流类型不存在,流程类型code:" + instType); } @@ -184,20 +181,20 @@ public class ProcessEndListener { // 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 if (HisProInsEndActId.END.equals(newInstance.getEndActivityId())) { // 如果是申请延期和申请借阅审批流程,不走状态机 - if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) || InstTypeEnum.APPLY_BORROW.getCode().equals(instType)){ + if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) || InstTypeEnum.APPLY_BORROW.getCode().equals(instType)) { switch (instTypeEnum) { case APPLY_DELAY: // 保存延期申请记录,更新项目建设周期和计划验收时间 - handlerManage.updateProjectDelayApplyInfo(declaredProject,instanceId); + handlerManage.updateProjectDelayApplyInfo(declaredProject, instanceId); break; case APPLY_BORROW: // 更新申请借阅状态为成功 - handlerManage.updateProjectApplyBorrowInfo(declaredProject,instanceId); + handlerManage.updateProjectApplyBorrowInfo(declaredProject, instanceId); break; default: throw new BizException("传入实例类型错误: " + instTypeEnum); } - }else { + } else { switch (Objects.requireNonNull(ProjectStatusEnum.match(declaredProject.getStatus()))) { // 当前项目状态是预审中 case PRE_APPLYING: @@ -219,7 +216,7 @@ public class ProcessEndListener { .list(Wrappers.lambdaQuery(ProjectApplication.class) .eq(ProjectApplication::getProjectId, declaredProject.getId())); joinReviewProvincialBureauService.pushImportProject( - ApplicationConverter.convertProject(declaredProject, applications, fileService,active)); + ApplicationConverter.convertProject(declaredProject, applications, fileService, active)); handlerManage.updatePassProjectStatus(userId, declaredProject); break; } catch (Exception e) { @@ -238,7 +235,7 @@ public class ProcessEndListener { } } //发送消息 - noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), + noticeManage.sendNotice(instance.getStartUserId(), userId, declaredProject, instance.getProcessDefinitionName(), PASS_MSG_TEMPLATE2, MsgTypeEnum.PROJECT_REVIEW_PASS); } else { // 若有下一个审核人(当前节点的用户),会签/或签会有多个 @@ -249,8 +246,8 @@ public class ProcessEndListener { throw new BizException("审核人信息不存在!"); } //发送消息 - noticeManage.sendNotice(currentEmployeeCode,userId,declaredProject,instance.getProcessDefinitionName(), - PASS_MSG_TEMPLATE,MsgTypeEnum.PROJECT_REVIEW); + noticeManage.sendNotice(currentEmployeeCode, userId, declaredProject, instance.getProcessDefinitionName(), + PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); } } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java index 573fb32..fa5909c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java @@ -2,14 +2,15 @@ package com.hz.pm.api.scheduler.task; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.StopWatch; +import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; +import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.model.constant.RegionConst; -import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.common.statemachine.contant.RegionContant; import com.hz.pm.api.common.util.BizUtils; import com.hz.pm.api.dashboard.constant.DashboardConstant; @@ -27,10 +28,10 @@ import com.hz.pm.api.meta.model.entity.ExpertTag; import com.hz.pm.api.meta.service.IExpertTagService; import com.hz.pm.api.performance.model.entity.PerformanceAppraisalProject; import com.hz.pm.api.performance.service.IPerformanceAppraisalProjectService; -import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; 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.InstTypeEnum; +import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.service.IProjectInstService; import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.sys.model.dto.RegionDTO; @@ -44,6 +45,7 @@ import org.flowable.engine.history.HistoricActivityInstance; import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; + import java.math.BigDecimal; import java.net.InetAddress; import java.net.UnknownHostException; @@ -85,22 +87,20 @@ public class CockpitStatsStatisticsTask { private final IExpertIntentionWorkRegionService expertIntentionWorkRegionService; private final IExpertTagService expertTagService; - private List years = Lists.newArrayList(2021,2022,2023,2024,2025); - + private List years = Lists.newArrayList(2021, 2022, 2023, 2024, 2025); /** * 定义统计 驾驶舱数据 每天3点开始执行一次 - * */ @Scheduled(cron = "0 0 3 * * ?") public void doTask() throws UnknownHostException { if (!HOST.equals(InetAddress.getLocalHost().getHostName())) { log.info("定时器没开启或者host不对! {}:{}", - HOST,InetAddress.getLocalHost().getHostName()); + HOST, InetAddress.getLocalHost().getHostName()); return; } - if(BizConst.PRE.equals(active)){ + if (BizConst.PRE.equals(active)) { log.info("预发环境不用同步!"); return; } @@ -114,24 +114,24 @@ public class CockpitStatsStatisticsTask { //1.根据2个维度来统计 区域和分年 //1.总的 res.add(statisticsData(DashboardConstant.CockpitStats.TOTAL, - DashboardConstant.CockpitStats.TOTAL,DashboardConstant.CockpitStats.NONE_YEAR)); - for(Integer year : years){ + DashboardConstant.CockpitStats.TOTAL, DashboardConstant.CockpitStats.NONE_YEAR)); + for (Integer year : years) { res.add(statisticsData(DashboardConstant.CockpitStats.TOTAL, - DashboardConstant.CockpitStats.TOTAL,year)); + DashboardConstant.CockpitStats.TOTAL, year)); } List regions = regionCacheHelper.listChildren(RegionConst.RC_HZ, RegionConst.RL_CITY); regions = regions.stream().filter(r -> r.getRegionLevel() != RegionConst.RL_CITY).collect(Collectors.toList()); - for(RegionDTO regionDto : regions){ - res.add(statisticsData(regionDto.getRegionCode(),regionDto.getRegionName(), + for (RegionDTO regionDto : regions) { + res.add(statisticsData(regionDto.getRegionCode(), regionDto.getRegionName(), DashboardConstant.CockpitStats.NONE_YEAR)); - for(Integer year : years){ - res.add(statisticsData(regionDto.getRegionCode(),regionDto.getRegionName(),year)); + for (Integer year : years) { + res.add(statisticsData(regionDto.getRegionCode(), regionDto.getRegionName(), year)); } } //如果结果不为空 就删除之前的 插入最新的数据 - if(CollUtil.isNotEmpty(res)){ + if (CollUtil.isNotEmpty(res)) { //计算增长率 computeRates(res); List list = cockpitStatsService.list(); @@ -141,25 +141,25 @@ public class CockpitStatsStatisticsTask { } stopWatch.stop(); - log.info("驾驶舱数据统计任务结束====={}s",stopWatch.getTotalTimeSeconds()); + log.info("驾驶舱数据统计任务结束====={}s", stopWatch.getTotalTimeSeconds()); } private void computeRates(List res) { Map map = res.stream().collect(Collectors.toMap(r -> r.getRegionCode() + r.getYear(), r -> r)); - for(CockpitStats cockpitStats : res){ - if(Objects.isNull(cockpitStats.getYear())){ + for (CockpitStats cockpitStats : res) { + if (Objects.isNull(cockpitStats.getYear())) { continue; } //算增长率 //去年的数据 用于算 增长比例 - if(cockpitStats.getYear().equals(DashboardConstant.CockpitStats.NONE_YEAR)){ - Integer thisYear = LocalDateTime.now().getYear(); + if (cockpitStats.getYear().equals(DashboardConstant.CockpitStats.NONE_YEAR)) { + int thisYear = LocalDateTime.now().getYear(); CockpitStats thisYearData = map.get(cockpitStats.getRegionCode() + thisYear); CockpitStats lastYearData = map.get(cockpitStats.getRegionCode() + (thisYear - 1)); - buildMonitorRise(cockpitStats,thisYearData,lastYearData); - }else{ + buildMonitorRise(cockpitStats, thisYearData, lastYearData); + } else { CockpitStats lastYearData = map.get(cockpitStats.getRegionCode() + (cockpitStats.getYear() - 1)); - buildMonitorRise(cockpitStats,cockpitStats,lastYearData); + buildMonitorRise(cockpitStats, cockpitStats, lastYearData); } } @@ -167,6 +167,7 @@ public class CockpitStatsStatisticsTask { /** * 统计的具体逻辑 + * * @param regionCode * @param regionName * @param year @@ -179,38 +180,38 @@ public class CockpitStatsStatisticsTask { cockpitStats.setYear(year); //申报项目 + boolean condition = Objects.nonNull(year) && !year.equals(DashboardConstant.CockpitStats.NONE_YEAR); + boolean condition1 = Objects.isNull(year) || year.equals(DashboardConstant.CockpitStats.NONE_YEAR); List projects = projectService.list(Wrappers.lambdaQuery(Project.class) .eq(Project::getNewest, Boolean.TRUE) .eq(StringUtils.isNotBlank(regionCode) && !DashboardConstant.CockpitStats.TOTAL.equals(regionCode), Project::getAreaCode, regionCode) - .eq(Objects.nonNull(year) && !year.equals(DashboardConstant.CockpitStats.NONE_YEAR), - Project::getProjectYear, year) - .in(Objects.isNull(year) || year.equals(DashboardConstant.CockpitStats.NONE_YEAR), - Project::getProjectYear, years)); + .eq(condition, Project::getProjectYear, year) + .in(condition1, Project::getProjectYear, years)); //项目归集 List applieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .eq(Objects.nonNull(year) && !year.equals(DashboardConstant.CockpitStats.NONE_YEAR), + .eq(condition, GovBizProjectApply::getBaseProjSetYear, year) - .in(Objects.isNull(year) || year.equals(DashboardConstant.CockpitStats.NONE_YEAR), + .in(condition1, GovBizProjectApply::getBaseProjSetYear, years)); List yearProjIds = applieYears.stream().map(GovBizProjectApply::getBaseProjId) .collect(Collectors.toList()); List baseInfos = Lists.newArrayList(); - if(CollUtil.isNotEmpty(yearProjIds)){ + if (CollUtil.isNotEmpty(yearProjIds)) { baseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) .eq(StringUtils.isNotBlank(regionCode) && !DashboardConstant.CockpitStats.TOTAL.equals(regionCode), GovBizProjectBaseinfo::getBaseAreaCode, regionCode + RegionContant.MORE_CODE) - .in(GovBizProjectBaseinfo::getBaseProjId,yearProjIds)); + .in(GovBizProjectBaseinfo::getBaseProjId, yearProjIds)); } List approves = Lists.newArrayList(); List applies = Lists.newArrayList(); List procures = Lists.newArrayList(); List cimplements = Lists.newArrayList(); - if(CollUtil.isNotEmpty(baseInfos)){ + if (CollUtil.isNotEmpty(baseInfos)) { List baseProjIds = baseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId).collect(Collectors.toList()); approves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) .in(GovBizProjectApprove::getBaseProjId, baseProjIds)); @@ -227,35 +228,35 @@ public class CockpitStatsStatisticsTask { //1.项目监测 //1.1 超期在建项目 - Integer overdueConstructionProjectsNum = projects.stream().filter(p -> { - if(Objects.nonNull(p.getPlanAcceptanceTime()) && + Integer overdueConstructionProjectsNum = (int) projects.stream().filter(p -> { + if (Objects.nonNull(p.getPlanAcceptanceTime()) && p.getPlanAcceptanceTime().compareTo(LocalDateTime.now()) < 0 && - Objects.nonNull(p.getStatus()) && p.getStatus().compareTo(ProjectStatusEnum.ACCEPTED.getCode()) < 0){ + Objects.nonNull(p.getStatus()) && p.getStatus().compareTo(ProjectStatusEnum.ACCEPTED.getCode()) < 0) { return Boolean.TRUE; } return Boolean.FALSE; - }).collect(Collectors.toList()).size(); + }).count(); cockpitStats.setMonitorOverdueConstructionProjectsNum(overdueConstructionProjectsNum); //1.2 环节滞后项目 cockpitStats.setMonitorLaggingProjectsNum(computeLagging(projects)); //1.3预审驳回项目 - Integer preFailed = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && - p.getStatus().equals(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode())){ + Integer preFailed = (int) projects.stream().filter(p -> { + if (Objects.nonNull(p.getStatus()) && + p.getStatus().equals(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode())) { return Boolean.TRUE; } return Boolean.FALSE; - }).collect(Collectors.toList()).size(); + }).count(); cockpitStats.setMonitorRejectedPreReviewProjectsNum(preFailed); //1.4 建设方案评审失败 - Integer constructionFailed = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && p.getStatus().equals(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode())){ + Integer constructionFailed = (int) projects.stream().filter(p -> { + if (Objects.nonNull(p.getStatus()) && p.getStatus().equals(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode())) { return Boolean.TRUE; } return Boolean.FALSE; - }).collect(Collectors.toList()).size(); + }).count(); cockpitStats.setMonitorRejectedApproveProjectsNum(constructionFailed); //1.5 验收不达标 cockpitStats.setMonitorAcceptConditionsNotStandardsNum(0); @@ -265,16 +266,16 @@ public class CockpitStatsStatisticsTask { cockpitStats.setMonitorDeclaredAmount(BigDecimal.valueOf(totalDeclaredAmount)); //1.7 总安全投入 double totalSafetyAmount = projects.stream().mapToDouble(p -> { - if(Objects.nonNull(p.getSafetyInputDescribe())){ + if (Objects.nonNull(p.getSafetyInputDescribe())) { final Double[] total = {0.0}; - try{ + try { JSONArray array = JSON.parseArray(p.getSafetyInputDescribe()); array.forEach(j -> { JSONObject json = JSON.parseObject(JSON.toJSONString(j)); Double safetyInputAmount = json.getDouble(DashboardConstant.Protrait.FEILD_SAFETYMONEY); total[0] += safetyInputAmount; }); - }catch (Exception e){ + } catch (Exception e) { } return total[0]; @@ -292,10 +293,10 @@ public class CockpitStatsStatisticsTask { Integer guijiSecerecyGrade4 = 0; Integer guijiSecerecyGrade5 = 0; //项目归集 评审信息 - for (GovBizProjectApprove approve : approves){ + for (GovBizProjectApprove approve : approves) { String equalProtectionLevel = approve.getEqualProtectionLevel(); - if(StringUtils.isNotBlank(equalProtectionLevel)){ - switch (equalProtectionLevel){ + if (StringUtils.isNotBlank(equalProtectionLevel)) { + switch (equalProtectionLevel) { case "01": guijiSecerecyGrade1++; break; @@ -318,13 +319,13 @@ public class CockpitStatsStatisticsTask { } Integer passwordGradeNumGov = 0; - for (GovBizProjectCimplement cimplement : cimplements){ - if(StringUtils.isNotBlank(cimplement.getBaseInforLevelFile())){ - passwordGradeNumGov ++; + for (GovBizProjectCimplement cimplement : cimplements) { + if (StringUtils.isNotBlank(cimplement.getBaseInforLevelFile())) { + passwordGradeNumGov++; } } - if(Objects.nonNull(secrecyPasswordGradePo)){ + if (Objects.nonNull(secrecyPasswordGradePo)) { cockpitStats.setMonitorSecrecyGrade1Num(secrecyPasswordGradePo.getMonitorSecrecyGrade1Num() + guijiSecerecyGrade1); cockpitStats.setMonitorSecrecyGrade2Num(secrecyPasswordGradePo.getMonitorSecrecyGrade2Num() + guijiSecerecyGrade2); cockpitStats.setMonitorSecrecyGrade3Num(secrecyPasswordGradePo.getMonitorSecrecyGrade3Num() + guijiSecerecyGrade3); @@ -335,7 +336,7 @@ public class CockpitStatsStatisticsTask { cockpitStats.setMonitorPasswordGrade3Num(secrecyPasswordGradePo.getMonitorPasswordGrade3Num()); cockpitStats.setMonitorPasswordGrade4Num(secrecyPasswordGradePo.getMonitorPasswordGrade4Num()); cockpitStats.setMonitorPasswordGrade5Num(secrecyPasswordGradePo.getMonitorPasswordGrade5Num()); - }else{ + } else { cockpitStats.setMonitorSecrecyGrade1Num(guijiSecerecyGrade1); cockpitStats.setMonitorSecrecyGrade2Num(guijiSecerecyGrade2); cockpitStats.setMonitorSecrecyGrade3Num(guijiSecerecyGrade3); @@ -345,7 +346,7 @@ public class CockpitStatsStatisticsTask { } //2.专家统计 - List lsRegionCodes = RegionConst.LS_ARR; + List lsRegionCodes = RegionConst.LS_ARR; List intentions = expertIntentionWorkRegionService.list(Wrappers.lambdaQuery(ExpertIntentionWorkRegion.class) .eq(StringUtils.isNotBlank(regionCode) && !DashboardConstant.CockpitStats.TOTAL.equals(regionCode), ExpertIntentionWorkRegion::getRegionCode, regionCode) @@ -353,7 +354,7 @@ public class CockpitStatsStatisticsTask { ExpertIntentionWorkRegion::getRegionCode, lsRegionCodes)); List experts = Lists.newArrayList(); - if(CollUtil.isNotEmpty(intentions)){ + if (CollUtil.isNotEmpty(intentions)) { List userIds = intentions.stream().map(ExpertIntentionWorkRegion::getUserId) .collect(Collectors.toList()); experts = expertUserFullInfoService.list(Wrappers.lambdaQuery(ExpertUserFullInfo.class) @@ -371,8 +372,8 @@ public class CockpitStatsStatisticsTask { String dangzhengCode = DashboardConstant.Expert.DANGZHENG_CODE; String ruanyingCode = DashboardConstant.Expert.RUANYING_CODE; String caiwuCode = DashboardConstant.Expert.CAIWU_CODE; - List specialTags = Lists.newArrayList(networkCode,xinchuangCode,fanganCode,jishuCode, - dangzhengCode,ruanyingCode,caiwuCode); + List specialTags = Lists.newArrayList(networkCode, xinchuangCode, fanganCode, jishuCode, + dangzhengCode, ruanyingCode, caiwuCode); cockpitStats.setExpertTotalNum(experts.size()); Integer financialNum = 0; @@ -384,38 +385,38 @@ public class CockpitStatsStatisticsTask { Integer softHardPricingNum = 0; Integer technicalFeasibilityAssessmentNum = 0; Integer specialExpertNum = 0; - for(ExpertUserFullInfo e : experts){ - if(tagMap.containsKey(e.getUserId())){ + for (ExpertUserFullInfo e : experts) { + if (tagMap.containsKey(e.getUserId())) { List expertTags = tagMap.get(e.getUserId()); - Boolean isContain = Boolean.FALSE; - for(ExpertTag expertTag : expertTags){ - if(expertTag.getTagCode().equals(networkCode)){ + boolean isContain = Boolean.FALSE; + for (ExpertTag expertTag : expertTags) { + if (expertTag.getTagCode().equals(networkCode)) { networkSecurityNum++; } - if(expertTag.getTagCode().equals(caiwuCode)){ - financialNum ++; + if (expertTag.getTagCode().equals(caiwuCode)) { + financialNum++; } - if(expertTag.getTagCode().equals(xinchuangCode)){ - xinchuangNum ++; + if (expertTag.getTagCode().equals(xinchuangCode)) { + xinchuangNum++; } - if(expertTag.getTagCode().equals(fanganCode)){ + if (expertTag.getTagCode().equals(fanganCode)) { planRationalityNum++; } - if(expertTag.getTagCode().equals(jishuCode)){ - technicalFeasibilityAssessmentNum ++; + if (expertTag.getTagCode().equals(jishuCode)) { + technicalFeasibilityAssessmentNum++; } - if(expertTag.getTagCode().equals(dangzhengCode)){ - partyGovInfoNum ++; + if (expertTag.getTagCode().equals(dangzhengCode)) { + partyGovInfoNum++; } - if(expertTag.getTagCode().equals(ruanyingCode)){ - softHardPricingNum ++; + if (expertTag.getTagCode().equals(ruanyingCode)) { + softHardPricingNum++; } - if(specialTags.contains(expertTag.getTagCode())){ + if (specialTags.contains(expertTag.getTagCode())) { isContain = Boolean.TRUE; } } - if(isContain){ - specialExpertNum ++; + if (isContain) { + specialExpertNum++; } } } @@ -434,53 +435,52 @@ public class CockpitStatsStatisticsTask { //3.顶部数据 //3.1 计划项目数(申报项目:完成年度计划的项目总数 // 项目归集:评审中、待立项、已立项、已采购、已初验、已终验项目总和) - Integer planProjectNum = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && - p.getStatus().compareTo(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) >= 0){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - Integer planProjectNumGov = baseInfos.stream().filter(p -> { - if(Objects.nonNull(p.getBaseProjSetProg()) && + Integer planProjectNum = (int) projects.stream().filter(p -> { + if (Objects.nonNull(p.getStatus()) && + p.getStatus().compareTo(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) >= 0) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).count(); + Integer planProjectNumGov = (int) baseInfos.stream().filter(p -> { + if (Objects.nonNull(p.getBaseProjSetProg()) && //排除 已驳回 已终止 (!Lists.newArrayList(GovProjectStatusEnum.REJECTED.getCode(), - GovProjectStatusEnum.TERMINATED.getCode()).contains(p.getBaseProjSetProg()))){ + GovProjectStatusEnum.TERMINATED.getCode()).contains(p.getBaseProjSetProg()))) { return Boolean.TRUE; } return Boolean.FALSE; - }).collect(Collectors.toList()).size(); + }).count(); cockpitStats.setTopPlanProjectsNum(planProjectNum + planProjectNumGov); //3.2 批复项目数(申报项目:完成立项批复流程项目总数 项目归集:已立项、已采购、已初验、已终验项目总和) - Integer approvalNumDeclared = projects.stream().filter(p -> { - if(Objects.nonNull(p.getApprovalAmount())){ + Integer approvalNumDeclared = (int) projects.stream().filter(p -> { + if (Objects.nonNull(p.getApprovalAmount())) { return Boolean.TRUE; } return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - Integer approvalNumGov = baseInfos.stream().filter(p -> { - if(Objects.nonNull(p.getBaseProjSetProg()) && Lists.newArrayList(GovProjectStatusEnum.APPROVED.getCode(), - GovProjectStatusEnum.PURCHASED.getCode(),GovProjectStatusEnum.HAS_PRE_INS.getCode(), - GovProjectStatusEnum.HAS_FINAL_INS.getCode()).contains(p.getBaseProjSetProg())){ + }).count(); + Integer approvalNumGov = (int) baseInfos.stream().filter(p -> { + if (Objects.nonNull(p.getBaseProjSetProg()) && Lists.newArrayList(GovProjectStatusEnum.APPROVED.getCode(), + GovProjectStatusEnum.PURCHASED.getCode(), GovProjectStatusEnum.HAS_PRE_INS.getCode(), + GovProjectStatusEnum.HAS_FINAL_INS.getCode()).contains(p.getBaseProjSetProg())) { return Boolean.TRUE; } return Boolean.FALSE; - }).collect(Collectors.toList()).size(); + }).count(); BigDecimal approvalAmount = projects.stream().filter(p -> { - if(Objects.nonNull(p.getApprovalAmount())){ + if (Objects.nonNull(p.getApprovalAmount())) { return Boolean.TRUE; } return Boolean.FALSE; - }).map(Project::getApprovalAmount).reduce(BigDecimal::add).get(); + }).map(Project::getApprovalAmount).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); - BigDecimal approvalAmountGov = approves.stream().filter(a -> { - if(Objects.nonNull(a.getBaseInitialReviewTotalMoney())){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).map(GovBizProjectApprove::getBaseInitialReviewTotalMoney).reduce(BigDecimal::add).get(); + BigDecimal approvalAmountGov = approves.stream() + .map(GovBizProjectApprove::getBaseInitialReviewTotalMoney) + .filter(Objects::nonNull) + .reduce(BigDecimal::add) + .orElse(BigDecimal.ZERO); cockpitStats.setTopApprovalProjectsNum(approvalNumDeclared + approvalNumGov); cockpitStats.setTopApprovalProjectsAmount(approvalAmount.add(approvalAmountGov)); @@ -488,158 +488,157 @@ public class CockpitStatsStatisticsTask { OptionalDouble od = Stream.concat(projects.stream().map(Project::getBuildCycle), applies.stream().map(GovBizProjectApply::getBaseProjDuration)).mapToInt(c -> { try { - Integer buildCycle = Integer.valueOf(c); - return buildCycle; + return Integer.parseInt(c); } catch (Exception e) { return 0; } }).average(); - Double average = od.isPresent() ? od.getAsDouble() : 0.0; - cockpitStats.setTopAverageConstructionPeriod(average.intValue()); + double average = od.isPresent() ? od.getAsDouble() : 0.0; + cockpitStats.setTopAverageConstructionPeriod((int) average); //3.4 在建项目数 采购备案后的项目 - Integer contructionNum = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && + Integer constructionNum = (int) projects.stream().filter(p -> { + if (Objects.nonNull(p.getStatus()) && p.getStatus().compareTo(ProjectStatusEnum.TO_BE_PURCHASED.getCode()) >= 0 - && p.getStatus().compareTo(ProjectStatusEnum.ACCEPTED.getCode()) < 0){ + && p.getStatus().compareTo(ProjectStatusEnum.ACCEPTED.getCode()) < 0) { return Boolean.TRUE; } return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - Integer contructionNumGov = baseInfos.stream().filter(b -> { - if(Objects.nonNull(b.getBaseProjSetProg()) && - Lists.newArrayList(GovProjectStatusEnum.PURCHASED.getCode(),GovProjectStatusEnum.HAS_PRE_INS.getCode()).contains(b.getBaseProjSetProg())){ + }).count(); + Integer constructionNumGov = (int) baseInfos.stream().filter(b -> { + if (Objects.nonNull(b.getBaseProjSetProg()) && + Lists.newArrayList(GovProjectStatusEnum.PURCHASED.getCode(), GovProjectStatusEnum.HAS_PRE_INS.getCode()).contains(b.getBaseProjSetProg())) { return Boolean.TRUE; } return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - cockpitStats.setTopOngoingProjectsNum(contructionNum + contructionNumGov); + }).count(); + cockpitStats.setTopOngoingProjectsNum(constructionNum + constructionNumGov); //4.地图 只要放总数 取的时候 会有逻辑(也要取项目归集) cockpitStats.setProjectsTotal(projects.size() + baseInfos.size()); //5.下面项目状态数 //5.1 计划(申报项目:项目预审完成到年度计划未完成 项目归集:评审中) - Integer inPlanNum = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && + Integer inPlanNum = (int) projects.stream().filter(p -> { + if (Objects.nonNull(p.getStatus()) && p.getStatus().compareTo(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()) > 0 && - p.getStatus().compareTo(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()) <= 0){ + p.getStatus().compareTo(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()) <= 0) { return Boolean.TRUE; } return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - Integer inPlanNumGov = baseInfos.stream().filter(p -> { - if(Objects.nonNull(p.getBaseProjSetProg()) && - p.getBaseProjSetProg().equals(GovProjectStatusEnum.APPROVAL.getCode())){ + }).count(); + Integer inPlanNumGov = (int) baseInfos.stream().filter(p -> { + if (Objects.nonNull(p.getBaseProjSetProg()) && + p.getBaseProjSetProg().equals(GovProjectStatusEnum.APPROVAL.getCode())) { return Boolean.TRUE; } return Boolean.FALSE; - }).collect(Collectors.toList()).size(); + }).count(); cockpitStats.setProjectsTotalPlan(inPlanNum + inPlanNumGov); //5.2 处于申报(申报项目:年度计划完成到建设方案审批第一个节点审批未通过前 项目归集:待立项) - Integer inApplyNum = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && + Integer inApplyNum = (int) projects.stream().filter(p -> { + if (Objects.nonNull(p.getStatus()) && (ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode().equals(p.getStatus()) || (ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode().equals(p.getStatus()) && - searchSchemaReviewFlow(p.getProjectCode())))){ + searchSchemaReviewFlow(p.getProjectCode())))) { return Boolean.TRUE; } return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - Integer inApplyNumGov = baseInfos.stream().filter(p -> { - if(Objects.nonNull(p.getBaseProjSetProg()) && - p.getBaseProjSetProg().equals(GovProjectStatusEnum.PENDING.getCode())){ + }).count(); + Integer inApplyNumGov = (int) baseInfos.stream().filter(p -> { + if (Objects.nonNull(p.getBaseProjSetProg()) && + p.getBaseProjSetProg().equals(GovProjectStatusEnum.PENDING.getCode())) { return Boolean.TRUE; } return Boolean.FALSE; - }).collect(Collectors.toList()).size(); + }).count(); cockpitStats.setProjectsTotalApply(inApplyNum + inApplyNumGov); //5.3 处于审批 (申报项目:建设方案审批第一个节点审批通过到立项批复未完成 项目归集:已立项) - Integer inApproveNum = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && + Integer inApproveNum = (int) projects.stream().filter(p -> { + if (Objects.nonNull(p.getStatus()) && (ProjectStatusEnum.TO_BE_APPROVED.getCode().equals(p.getStatus()) || p.getStatus().compareTo(ProjectStatusEnum.APPROVED_AFTER_CHOICE.getCode()) > 0 || (ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode().equals(p.getStatus()) && - searchSchemaReviewedFlow(p.getProjectCode())))){ + searchSchemaReviewedFlow(p.getProjectCode())))) { return Boolean.TRUE; } return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - Integer inApproveNumGov = baseInfos.stream().filter(p -> { - if(Objects.nonNull(p.getBaseProjSetProg()) && - p.getBaseProjSetProg().equals(GovProjectStatusEnum.APPROVED.getCode())){ + }).count(); + Integer inApproveNumGov = (int) baseInfos.stream().filter(p -> { + if (Objects.nonNull(p.getBaseProjSetProg()) && + p.getBaseProjSetProg().equals(GovProjectStatusEnum.APPROVED.getCode())) { return Boolean.TRUE; } return Boolean.FALSE; - }).collect(Collectors.toList()).size(); + }).count(); cockpitStats.setProjectsTotalApprove(inApproveNum + inApproveNumGov); //5.4 建设 (申报项目:立项批复完成到项目初验未完成 项目归集:已采购) - Integer inConstructionNum = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && + Integer inConstructionNum = (int) projects.stream().filter(p -> { + if (Objects.nonNull(p.getStatus()) && (p.getStatus().compareTo(ProjectStatusEnum.APPROVED_AFTER_CHOICE.getCode()) > 0 && p.getStatus().compareTo(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) < 0) || //如果在建设中 那么初验材料为空代表 初验未完成 (p.getStatus().equals(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) && - StringUtils.isBlank(p.getPreliminaryInspectionMaterials()))){ + StringUtils.isBlank(p.getPreliminaryInspectionMaterials()))) { return Boolean.TRUE; } return Boolean.FALSE; - }).collect(Collectors.toList()).size(); - Integer inConstructionNumGov = baseInfos.stream().filter(p -> { - if(Objects.nonNull(p.getBaseProjSetProg()) && - p.getBaseProjSetProg().equals(GovProjectStatusEnum.PURCHASED.getCode())){ + }).count(); + Integer inConstructionNumGov = (int) baseInfos.stream().filter(p -> { + if (Objects.nonNull(p.getBaseProjSetProg()) && + p.getBaseProjSetProg().equals(GovProjectStatusEnum.PURCHASED.getCode())) { return Boolean.TRUE; } return Boolean.FALSE; - }).collect(Collectors.toList()).size(); + }).count(); cockpitStats.setProjectsTotalConstruction(inConstructionNum + inConstructionNumGov); //5.5 验收 (申报项目:项目初验完成到项目终验未完成 项目归集:已初验) - List inAccpetProjects = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && + List inAcceptProjects = projects.stream().filter(p -> { + if (Objects.nonNull(p.getStatus()) && p.getStatus().compareTo(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) > 0 && p.getStatus().compareTo(ProjectStatusEnum.ACCEPTED.getCode()) < 0 || //如果在建设中 那么初验材料不为空代表 初验完成 (p.getStatus().equals(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) && - StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials()))){ + StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials()))) { return Boolean.TRUE; } return Boolean.FALSE; }).collect(Collectors.toList()); - List inAccpetProjectsGov = baseInfos.stream().filter(b -> { - if(Objects.nonNull(b.getBaseProjSetProg()) && - b.getBaseProjSetProg().equals(GovProjectStatusEnum.HAS_PRE_INS.getCode())){ + List inAcceptProjectsGov = baseInfos.stream().filter(b -> { + if (Objects.nonNull(b.getBaseProjSetProg()) && + b.getBaseProjSetProg().equals(GovProjectStatusEnum.HAS_PRE_INS.getCode())) { return Boolean.TRUE; } return Boolean.FALSE; }).collect(Collectors.toList()); - cockpitStats.setProjectsTotalAccept(inAccpetProjects.size() + inAccpetProjectsGov.size()); + cockpitStats.setProjectsTotalAccept(inAcceptProjects.size() + inAcceptProjectsGov.size()); //5.6 运维(申报项目:项目验收完成后且项目未注销 项目归集:已终验) List inOperationProjects = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && - p.getStatus().equals(ProjectStatusEnum.ACCEPTED.getCode())){ + if (Objects.nonNull(p.getStatus()) && + p.getStatus().equals(ProjectStatusEnum.ACCEPTED.getCode())) { return Boolean.TRUE; } return Boolean.FALSE; }).collect(Collectors.toList()); - Integer inOperationProjectsGov = baseInfos.stream().filter(b -> { - if(Objects.nonNull(b.getBaseProjSetProg()) && - b.getBaseProjSetProg().equals(GovProjectStatusEnum.HAS_FINAL_INS.getCode())){ + int inOperationProjectsGov = (int) baseInfos.stream().filter(b -> { + if (Objects.nonNull(b.getBaseProjSetProg()) && + b.getBaseProjSetProg().equals(GovProjectStatusEnum.HAS_FINAL_INS.getCode())) { return Boolean.TRUE; } return Boolean.FALSE; - }).collect(Collectors.toList()).size(); + }).count(); cockpitStats.setProjectsTotalOperation(inOperationProjects.size() + inOperationProjectsGov); //5.7 绩效(申报项目:项目验收完成后且未完成绩效自评 项目归集:无) - List inAccpetCodes = inOperationProjects.stream().map(Project::getProjectCode).collect(Collectors.toList()); + List inAcceptCodes = inOperationProjects.stream().map(Project::getProjectCode).collect(Collectors.toList()); List performances = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) - .in(CollUtil.isNotEmpty(inAccpetCodes),PerformanceAppraisalProject::getProjectCode, inAccpetCodes) - .in(CollUtil.isEmpty(inAccpetCodes),PerformanceAppraisalProject::getProjectCode, Lists.newArrayList("NONE")) - .eq(PerformanceAppraisalProject::getIsReAppraisal,Boolean.TRUE) + .in(CollUtil.isNotEmpty(inAcceptCodes), PerformanceAppraisalProject::getProjectCode, inAcceptCodes) + .in(CollUtil.isEmpty(inAcceptCodes), PerformanceAppraisalProject::getProjectCode, Lists.newArrayList("NONE")) + .eq(PerformanceAppraisalProject::getIsReAppraisal, Boolean.TRUE) .isNull(PerformanceAppraisalProject::getReAppraisalTotalScore) ); cockpitStats.setProjectsTotalPerformance(performances.size()); @@ -664,7 +663,7 @@ public class CockpitStatsStatisticsTask { return p.getDeclareAmount(); } return BigDecimal.ZERO; - }).reduce(BigDecimal::add).get(); + }).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); cockpitStats.setRejectSavingsFunds(rejectPreSum); //7.3 柱状图 @@ -681,30 +680,21 @@ public class CockpitStatsStatisticsTask { //申报的申报金额(申报项目:初步方案申报金额 项目归集:项目总投资) final BigDecimal[] declaredAmountApprove = {BigDecimal.ZERO}; - normalProjects.stream().map(p -> { - BigDecimal declareAmount = Objects.nonNull(p.getDeclareAmount()) ? - p.getDeclareAmount() : BigDecimal.ZERO; - return declareAmount; - }).reduce(BigDecimal::add).ifPresent(b -> declaredAmountApprove[0] = b); + normalProjects.stream().map(p -> ObjectUtil.defaultIfNull(p.getDeclareAmount(), BigDecimal.ZERO)) + .reduce(BigDecimal::add).ifPresent(b -> declaredAmountApprove[0] = b); final BigDecimal[] declaredAmountApproveGov = {BigDecimal.ZERO}; - applies.stream().map(g -> { - BigDecimal totalAmount = Objects.nonNull(g.getBaseProjTotalAmount()) ? g.getBaseProjTotalAmount() : BigDecimal.ZERO; - return totalAmount; - }).reduce(BigDecimal::add).ifPresent(b -> declaredAmountApproveGov[0] = b); + applies.stream().map(g -> ObjectUtil.defaultIfNull(g.getBaseProjTotalAmount(), BigDecimal.ZERO)) + .reduce(BigDecimal::add).ifPresent(b -> declaredAmountApproveGov[0] = b); BigDecimal declaredAmountApproveTotal = declaredAmountApprove[0].add(declaredAmountApproveGov[0]); cockpitStats.setDeclaredAmountApprove(declaredAmountApproveTotal); //申报的批复金额(申报项目:建设方案申报金额 项目归集:建议总投资) final BigDecimal[] approvalAmountApprove = {BigDecimal.ZERO}; - normalProjects.stream().map(p -> { - BigDecimal declareAmount = Objects.nonNull(p.getApprovalAmount()) ? p.getApprovalAmount() : BigDecimal.ZERO; - return declareAmount; - }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApprove[0] = b); + normalProjects.stream().map(p -> ObjectUtil.defaultIfNull(p.getApprovalAmount(), BigDecimal.ZERO)) + .reduce(BigDecimal::add).ifPresent(b -> approvalAmountApprove[0] = b); final BigDecimal[] approvalAmountApproveGov = {BigDecimal.ZERO}; - approves.stream().map(p -> { - BigDecimal expertTotalMoney = Objects.nonNull(p.getBaseExpertTotalMoney()) ? p.getBaseExpertTotalMoney() : BigDecimal.ZERO; - return expertTotalMoney; - }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApproveGov[0] = b); + approves.stream().map(p -> ObjectUtil.defaultIfNull(p.getBaseExpertTotalMoney(), BigDecimal.ZERO)) + .reduce(BigDecimal::add).ifPresent(b -> approvalAmountApproveGov[0] = b); BigDecimal approvalAmountApproveTotal = approvalAmountApprove[0].add(approvalAmountApproveGov[0]); cockpitStats.setApprovalAmountApprove(approvalAmountApproveTotal); //申报的差额 @@ -716,15 +706,11 @@ public class CockpitStatsStatisticsTask { //批复的批复金额(申报项目:归集信息建议批复总投资 项目归集:建议批复总投资) final BigDecimal[] approvalAmountApproval = {BigDecimal.ZERO}; - normalProjects.stream().map(p -> { - BigDecimal proposeTotalInvest = Objects.nonNull(p.getProposeTotalInvest()) ? p.getProposeTotalInvest() : BigDecimal.ZERO; - return proposeTotalInvest; - }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApproval[0] = b); + normalProjects.stream().map(p -> ObjectUtil.defaultIfNull(p.getProposeTotalInvest(), BigDecimal.ZERO)) + .reduce(BigDecimal::add).ifPresent(b -> approvalAmountApproval[0] = b); final BigDecimal[] approvalAmountApprovalGov = {BigDecimal.ZERO}; - approves.stream().map(p -> { - BigDecimal reviewTotalMoney = Objects.nonNull(p.getBaseInitialReviewTotalMoney()) ? p.getBaseInitialReviewTotalMoney() : BigDecimal.ZERO; - return reviewTotalMoney; - }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApprovalGov[0] = b); + approves.stream().map(p -> ObjectUtil.defaultIfNull(p.getBaseInitialReviewTotalMoney(), BigDecimal.ZERO)) + .reduce(BigDecimal::add).ifPresent(b -> approvalAmountApprovalGov[0] = b); BigDecimal approvalAmountApprovalTotal = approvalAmountApproval[0].add(approvalAmountApprovalGov[0]); cockpitStats.setApprovalAmountApproval(approvalAmountApprovalTotal); @@ -737,16 +723,12 @@ public class CockpitStatsStatisticsTask { //合同的批复金额(申报项目:成交金额 项目归集:成交金额) final BigDecimal[] approvalAmountContract = {BigDecimal.ZERO}; - normalProjects.stream().map(p -> { - BigDecimal transactionAmount = Objects.nonNull(p.getTransactionAmount()) ? p.getTransactionAmount() : BigDecimal.ZERO; - return transactionAmount; - }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountContract[0] = b); + normalProjects.stream().map(p -> Objects.nonNull(p.getTransactionAmount()) ? p.getTransactionAmount() : BigDecimal.ZERO) + .reduce(BigDecimal::add).ifPresent(b -> approvalAmountContract[0] = b); final BigDecimal[] approvalAmountContractGov = {BigDecimal.ZERO}; - procures.stream().map(p -> { - BigDecimal purchaseAmount = Objects.nonNull(p.getBaseProjPurchaseAmount()) ? - p.getBaseProjPurchaseAmount() : BigDecimal.ZERO; - return purchaseAmount; - }).reduce(BigDecimal::add).ifPresent(b -> approvalAmountContractGov[0] = b); + procures.stream().map(p -> Objects.nonNull(p.getBaseProjPurchaseAmount()) ? + p.getBaseProjPurchaseAmount() : BigDecimal.ZERO).reduce(BigDecimal::add) + .ifPresent(b -> approvalAmountContractGov[0] = b); BigDecimal approvalAmountContractTotal = approvalAmountContract[0].add(approvalAmountContractGov[0]); cockpitStats.setApprovalAmountContract(approvalAmountContractTotal); @@ -765,7 +747,7 @@ public class CockpitStatsStatisticsTask { //9.绩效 List projectCodes = projects.stream().map(Project::getProjectCode).collect(Collectors.toList()); - if(CollUtil.isNotEmpty(projectCodes)){ + if (CollUtil.isNotEmpty(projectCodes)) { List performanceAll = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) .in(PerformanceAppraisalProject::getProjectCode, projectCodes)); List verified = performanceAll.stream().filter(p -> { @@ -836,12 +818,13 @@ public class CockpitStatsStatisticsTask { /** * 建设方案申报了 但未开始审核的项目 + * * @param projectCode * @return */ private boolean searchSchemaReviewFlow(String projectCode) { Project project = projectService.getProjectByCode(projectCode); - if(Objects.isNull(project)){ + if (Objects.isNull(project)) { return Boolean.FALSE; } List allVersionProjectId = projectService.getAllVersionProjectId(project); @@ -849,7 +832,7 @@ public class CockpitStatsStatisticsTask { .in(ProjectInst::getProjectId, allVersionProjectId) .eq(ProjectInst::getInstType, InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode()) .last(BizConst.LIMIT_1)); - if(Objects.isNull(pi)){ + if (Objects.isNull(pi)) { return Boolean.FALSE; } String instCode = pi.getInstCode(); @@ -866,15 +849,16 @@ public class CockpitStatsStatisticsTask { .asc() .list(); //已经完成的没有 未完成的有 则可计算 - if(CollUtil.isNotEmpty(unfinished) && CollUtil.isEmpty(finished)){ + if (CollUtil.isNotEmpty(unfinished) && CollUtil.isEmpty(finished)) { return Boolean.TRUE; } return Boolean.FALSE; } + //已经开始审批 private boolean searchSchemaReviewedFlow(String projectCode) { Project project = projectService.getProjectByCode(projectCode); - if(Objects.isNull(project)){ + if (Objects.isNull(project)) { return Boolean.FALSE; } List allVersionProjectId = projectService.getAllVersionProjectId(project); @@ -882,7 +866,7 @@ public class CockpitStatsStatisticsTask { .in(ProjectInst::getProjectId, allVersionProjectId) .eq(ProjectInst::getInstType, InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode()) .last(BizConst.LIMIT_1)); - if(Objects.isNull(pi)){ + if (Objects.isNull(pi)) { return Boolean.FALSE; } String instCode = pi.getInstCode(); @@ -893,7 +877,7 @@ public class CockpitStatsStatisticsTask { .asc() .list(); //已经完成的 则可计算 - if(CollUtil.isNotEmpty(finished)){ + if (CollUtil.isNotEmpty(finished)) { return Boolean.TRUE; } return Boolean.FALSE; @@ -901,6 +885,7 @@ public class CockpitStatsStatisticsTask { /** * 计算环节滞后项目 + * * @param projects * @return */ @@ -908,18 +893,18 @@ public class CockpitStatsStatisticsTask { List projectCodes = projects.stream().map(Project::getProjectCode).collect(Collectors.toList()); Map map = projects.stream().collect(Collectors.toMap(Project::getProjectCode, p -> p)); List records = Lists.newArrayList(); - if(CollUtil.isNotEmpty(projectCodes)){ + if (CollUtil.isNotEmpty(projectCodes)) { records = earlyWarningRecordsService.list(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) .in(WflowEarlyWarningRecords::getProjectCode, projectCodes)); } return records.stream().mapToInt(r -> { - if(!map.containsKey(r.getProjectCode())){ + if (!map.containsKey(r.getProjectCode())) { return 0; } Project project = map.get(r.getProjectCode()); //如果状态 相等 说明预警了 但是没处理 +1 - if(Objects.nonNull(project.getStatus()) && Objects.nonNull(r.getProjectStatus()) && - project.getStatus().equals(r.getProjectStatus())){ + if (Objects.nonNull(project.getStatus()) && Objects.nonNull(r.getProjectStatus()) && + project.getStatus().equals(r.getProjectStatus())) { return 1; } return 0; @@ -927,7 +912,7 @@ public class CockpitStatsStatisticsTask { } private void buildMonitorRise(CockpitStats cockpitStats, CockpitStats thisYearData, CockpitStats lastYearData) { - if(Objects.isNull(thisYearData) || Objects.isNull(lastYearData)){ + if (Objects.isNull(thisYearData) || Objects.isNull(lastYearData)) { return; } cockpitStats.setMonitorOverdueConstructionProjectsRise(BizUtils.computeRise(thisYearData.getMonitorOverdueConstructionProjectsNum(), diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CommonLogTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CommonLogTask.java deleted file mode 100644 index dec7f64..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CommonLogTask.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.hz.pm.api.scheduler.task; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollectionUtil; -import cn.hutool.core.io.FileUtil; -import cn.hutool.core.io.file.FileReader; -import cn.hutool.core.io.file.FileWriter; -import cn.hutool.core.lang.UUID; -import cn.hutool.json.JSONUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.log.mapper.OptLogMapper; -import com.ningdatech.log.model.domain.OptLog; -import com.hz.pm.api.common.model.constant.BizConst; -import com.hz.pm.api.common.model.constant.RegionConst; -import com.hz.pm.api.organization.mapper.DingEmployeeInfoMapper; -import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; -import com.hz.pm.api.scheduler.task.model.CommonLog; -import com.hz.pm.api.user.model.entity.UserInfo; -import com.hz.pm.api.user.service.IUserInfoService; -import lombok.RequiredArgsConstructor; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.List; - -/** - * 通用日志写入任务 - * @author liushuai - */ -@Component -@RequiredArgsConstructor -public class CommonLogTask { - private final OptLogMapper optLogMapper; - private final IUserInfoService userInfoService; - private final DingEmployeeInfoMapper dingEmployeeInfoMapper; - /** - * 日志记录文件位置 - */ - private final static String LOG_RECORD_ADDRESS = "/opt/log/"; - private final static String LOG_ID_FILE = "logId.txt"; - private final static String LOG_FILE = "common_log_"; - - @Value("${hostname}") - private String HOST_NAME; - - @Scheduled(fixedDelay = 120000) - public void writeLog() throws UnknownHostException { - // - if (!HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { - return; - } - //获取记录ID文件 - boolean idFileExist = FileUtil.exist(LOG_RECORD_ADDRESS + LOG_ID_FILE); - if (!idFileExist){ - FileUtil.touch(LOG_RECORD_ADDRESS + LOG_ID_FILE); - } - FileReader fileReader = new FileReader(LOG_RECORD_ADDRESS + LOG_ID_FILE); - String result = fileReader.readString(); - long startLogId = 0L; - if (StringUtils.isNotBlank(result)){ - startLogId = Long.parseLong(result); - } - LambdaQueryWrapper query = Wrappers.lambdaQuery(OptLog.class).gt(OptLog::getId,startLogId); - //查询日志 - List logList = optLogMapper.selectList(query); - DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - if (CollectionUtil.isNotEmpty(logList)){ - for (OptLog optLog : logList){ - CommonLog commonLog = new CommonLog(); - UserInfo userInfo = userInfoService.getById(optLog.getCreateBy()); - if (userInfo == null){ - continue; - } - String employeeCode = userInfo.getEmployeeCode(); - if (StringUtils.isNotBlank(employeeCode)){ - DingEmployeeInfo dingEmployeeInfo = dingEmployeeInfoMapper.selectOne(new LambdaQueryWrapper() - .eq(DingEmployeeInfo::getEmployeeCode,employeeCode) - .last(BizConst.LIMIT_1)); - if (dingEmployeeInfo != null){ - commonLog.setUserId(String.valueOf(dingEmployeeInfo.getAccountId())); - } - }else { - commonLog.setUserId(String.valueOf(userInfo.getId())); - } - commonLog.setUserRole("政府工作人员"); - commonLog.setAreaCode(userInfo.getRegionCode() + RegionConst.NINE_CODE_LAST); - String description = optLog.getDescription(); - if ("用户登录".equals(description)){ - commonLog.setActionType(1); - }else if (description.contains("退出登录")){ - commonLog.setActionType(2); - }else { - commonLog.setActionType(3); - } - String actionId = UUID.randomUUID().toString(); - commonLog.setActionId(actionId); - commonLog.setActionTime(df.format(optLog.getStartTime())); - commonLog.setActionDuration(optLog.getConsumingTime()); - commonLog.setActionStatus(0); - commonLog.setAppCode("A331101453557202109017383"); - //判断当天日志文件是否存在 - DateTimeFormatter dfNow = DateTimeFormatter.ofPattern("yyyyMMdd"); - String fileName = LOG_RECORD_ADDRESS + LOG_FILE + dfNow.format(LocalDateTime.now()) + ".log"; - boolean fileExist = FileUtil.exist(fileName); - if (!fileExist){ - //不存在则创建当天日志文件 - FileUtil.touch(fileName); - } - //写入通用规则 - FileWriter writer = new FileWriter(fileName); - writer.append(JSONUtil.toJsonStr(commonLog)); - writer.append("\n"); - if (commonLog.getActionType() == 3){ - CommonLog commonLogEnd = new CommonLog(); - BeanUtil.copyProperties(commonLog,commonLogEnd); - commonLogEnd.setActionType(4); - writer.append(JSONUtil.toJsonStr(commonLogEnd)); - writer.append("\n"); - } - } - //记录最后一个节点位置 - FileWriter writer = new FileWriter(LOG_RECORD_ADDRESS + LOG_ID_FILE); - writer.write(String.valueOf(logList.get(logList.size() - 1).getId())); - } - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningInstanceNotStartTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningInstanceNotStartTask.java index 27e2d41..1f6bcd7 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningInstanceNotStartTask.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningInstanceNotStartTask.java @@ -8,16 +8,15 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import com.hz.pm.api.projectlib.model.enumeration.*; -import com.ningdatech.basic.util.StrPool; -import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.projectdeclared.model.entity.Contract; import com.hz.pm.api.projectdeclared.model.entity.Operation; import com.hz.pm.api.projectdeclared.service.IContractService; import com.hz.pm.api.projectdeclared.service.IOperationService; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.entity.ProjectRenewalFundDeclaration; +import com.hz.pm.api.projectlib.model.enumeration.*; import com.hz.pm.api.projectlib.service.IProjectRenewalFundDeclarationService; import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.sys.manage.EarlyWarningManage; @@ -26,6 +25,7 @@ import com.hz.pm.api.sys.service.IProjectEarlyWarningService; import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.model.enumeration.RoleEnum; import com.hz.pm.api.user.service.IUserInfoService; +import com.ningdatech.basic.util.StrPool; import com.wflow.bean.entity.WflowEarlyWarning; import com.wflow.enums.WarningRuleTypeEnum; import com.wflow.service.IEarlyWarningService; @@ -35,9 +35,11 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; + import java.net.InetAddress; import java.net.UnknownHostException; -import java.time.*; +import java.time.Duration; +import java.time.LocalDateTime; import java.util.List; import java.util.Map; import java.util.Objects; @@ -87,17 +89,17 @@ public class EarlyWarningInstanceNotStartTask { // 1.查询 填报的 预警规则 填报类型的 每个区域 每个规则 List warnings = earlyWarningService.list(Wrappers.lambdaQuery(WflowEarlyWarning.class) .eq(WflowEarlyWarning::getRuleType, WarningRuleTypeEnum.DECLARED_WARNING.getCode())); - for(WflowEarlyWarning warning : warnings){ + for (WflowEarlyWarning warning : warnings) { //2. 取出rule的数据 - if(!warning.getIsOpen()){ + if (!warning.getIsOpen()) { log.info(warning.getId() + " 此规则关闭了"); continue; } String noticeMethod = warning.getNoticeMethod(); - if(StringUtils.isBlank(noticeMethod) || + if (StringUtils.isBlank(noticeMethod) || (!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && - !noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ + !noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))) { log.info("通知方式为空或者错误!"); return; } @@ -105,27 +107,27 @@ public class EarlyWarningInstanceNotStartTask { String noticeContent = warning.getNoticeContent(); String adventContent = warning.getAdventContent(); String rule = warning.getRule(); - if(StringUtils.isNotBlank(rule)){ + if (StringUtils.isNotBlank(rule)) { JSONArray ruleArray = JSON.parseArray(rule); - if(CollUtil.isNotEmpty(ruleArray)){ + if (CollUtil.isNotEmpty(ruleArray)) { ruleArray.forEach(r -> { JSONObject rJson = JSON.parseObject(JSON.toJSONString(r)); Integer time = rJson.getInteger("time"); Integer biz = rJson.getInteger("biz"); String notice = rJson.getString("notice"); Integer adventTime = rJson.getInteger("adventTime"); - if((Objects.isNull(time) && Objects.isNull(adventTime)) || Objects.isNull(biz)){ - log.info("规则数据 错误 :{}",rJson); + if ((Objects.isNull(time) && Objects.isNull(adventTime)) || Objects.isNull(biz)) { + log.info("规则数据 错误 :{}", rJson); return; } - if(StringUtils.isBlank(notice)){ + if (StringUtils.isBlank(notice)) { log.info("取不到提醒人配置 : " + rJson); return; } WarningFlowTypeEnum flowTypeEnum = WarningFlowTypeEnum.getByCode(biz); - if(Objects.isNull(flowTypeEnum)){ + if (Objects.isNull(flowTypeEnum)) { log.info("匹配不到 业务类型"); return; } @@ -139,99 +141,99 @@ public class EarlyWarningInstanceNotStartTask { List needNextProjects = projectService.list(Wrappers.lambdaQuery(Project.class) .eq(Project::getAreaCode, areaCode) .eq(Project::getNewest, Boolean.TRUE) - .eq(Project::getStatus,projectStutas)); + .eq(Project::getStatus, projectStutas)); - Map> noticeMap = Maps.newHashMap(); + Map> noticeMap = Maps.newHashMap(); //需要发通知的项目 List needToWaringProjects = needNextProjects.stream() .filter(p -> { //判断 当状态在 建设中的时候 是不是要初验了 - if(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(projectStutas)){ + if (ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(projectStutas)) { List allVersionProjectId = projectService.getAllVersionProjectId(p); //如果合同信息提交过了 才是 待初验状态 - if(StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials())){ - if(0L == contractService.count(Wrappers.lambdaQuery(Contract.class) - .in(Contract::getProjectId, allVersionProjectId))){ + if (StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials())) { + if (0L == contractService.count(Wrappers.lambdaQuery(Contract.class) + .in(Contract::getProjectId, allVersionProjectId))) { return Boolean.FALSE; } } } List noticeTypes = Lists.newArrayList(); - if(Objects.nonNull(time) && Duration.between(p.getUpdateOn(),LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 - Duration.between(p.getUpdateOn(),LocalDateTime.now()).toMinutes() <= time * 60 + 1){ //time * 60 + if (Objects.nonNull(time) && Duration.between(p.getUpdateOn(), LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 + Duration.between(p.getUpdateOn(), LocalDateTime.now()).toMinutes() <= time * 60 + 1) { //time * 60 noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.OVER.getCode()); } - if(Objects.nonNull(adventTime) && Duration.between(p.getUpdateOn(),LocalDateTime.now()).toMinutes() >= adventTime * 60 && //time * 60 - Duration.between(p.getUpdateOn(),LocalDateTime.now()).toMinutes() <= adventTime * 60 + 1){ + if (Objects.nonNull(adventTime) && Duration.between(p.getUpdateOn(), LocalDateTime.now()).toMinutes() >= adventTime * 60 && //time * 60 + Duration.between(p.getUpdateOn(), LocalDateTime.now()).toMinutes() <= adventTime * 60 + 1) { noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.ADVENT.getCode()); } - if(CollUtil.isNotEmpty(noticeTypes)){ - noticeMap.put(p.getProjectCode(),noticeTypes); + if (CollUtil.isNotEmpty(noticeTypes)) { + noticeMap.put(p.getProjectCode(), noticeTypes); //项目 填报预警 projectEarlyWarningService.earlyWarning(p, - WarningRuleTypeEnum.DECLARED_WARNING.getCode(),noticeTypes); + WarningRuleTypeEnum.DECLARED_WARNING.getCode(), noticeTypes); return Boolean.TRUE; } return Boolean.FALSE; }) .collect(Collectors.toList()); - if(StringUtils.isBlank(noticeMethod) || + if (StringUtils.isBlank(noticeMethod) || (!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && - !noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ + !noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))) { log.info("通知方式为空或者错误!"); return; } - for(Project needToWaringProject : needToWaringProjects){ + for (Project needToWaringProject : needToWaringProjects) { String username = null; String mobile = null; //去预警通知人 1.项目联系人 2.项目负责人 如果都包含 都要发 List batchEmployees = Lists.newArrayList(); - if(notice.contains(WarningNoticeTypeEnum.CONTACT.getCode().toString())){ + if (notice.contains(WarningNoticeTypeEnum.CONTACT.getCode().toString())) { String employeeCode = null; username = needToWaringProject.getContactName(); mobile = needToWaringProject.getContactPhone(); - if(StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)){ + if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)) { UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) .eq(UserInfo::getUsername, username) .eq(UserInfo::getMobile, mobile) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(user)){ + if (Objects.nonNull(user)) { employeeCode = user.getEmployeeCode(); } - if(Objects.nonNull(employeeCode)){ + if (Objects.nonNull(employeeCode)) { batchEmployees.add(employeeCode); } } } - if(notice.contains(WarningNoticeTypeEnum.RESPONSIBLE.getCode().toString())){ + if (notice.contains(WarningNoticeTypeEnum.RESPONSIBLE.getCode().toString())) { String employeeCode = null; username = needToWaringProject.getResponsibleMan(); mobile = needToWaringProject.getResponsibleManMobile(); - if(StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)){ + if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)) { UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) .eq(UserInfo::getUsername, username) .eq(UserInfo::getMobile, mobile) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(user)){ + if (Objects.nonNull(user)) { employeeCode = user.getEmployeeCode(); } - if(Objects.nonNull(employeeCode)){ + if (Objects.nonNull(employeeCode)) { batchEmployees.add(employeeCode); } } } - if(CollUtil.isNotEmpty(batchEmployees)){ - String batchEmployeesStr = batchEmployees.stream().collect(Collectors.joining(StrPool.COMMA)); - if(noticeMap.containsKey(needToWaringProject.getProjectCode())){ + if (CollUtil.isNotEmpty(batchEmployees)) { + String batchEmployeesStr = String.join(StrPool.COMMA, batchEmployees); + if (noticeMap.containsKey(needToWaringProject.getProjectCode())) { List noticeTypes = noticeMap.get(needToWaringProject.getProjectCode()); - for(Integer noticeType : noticeTypes) { + for (Integer noticeType : noticeTypes) { for (String employeeCode : batchEmployees) { earlyWarningManage.doEarlyWarning(noticeMethod, Objects.nonNull(noticeType) && noticeType.equals(1) ? noticeContent : adventContent, - adventTime,time, biz, - needToWaringProject.getUpdateOn(),employeeCode, needToWaringProject, + adventTime, time, biz, + needToWaringProject.getUpdateOn(), Long.valueOf(employeeCode), needToWaringProject, WarningRuleTypeEnum.DECLARED_WARNING.getCode(), noticeType, path, batchEmployeesStr, null); } @@ -261,17 +263,17 @@ public class EarlyWarningInstanceNotStartTask { // 1.查询 填报的 预警规则 填报类型的 每个区域 每个规则 List warnings = earlyWarningService.list(Wrappers.lambdaQuery(WflowEarlyWarning.class) .eq(WflowEarlyWarning::getRuleType, WarningRuleTypeEnum.OPERATION_WARNING.getCode())); - for(WflowEarlyWarning warning : warnings){ + for (WflowEarlyWarning warning : warnings) { //2. 取出rule的数据 - if(!warning.getIsOpen()){ + if (!warning.getIsOpen()) { log.info(warning.getId() + " 此规则关闭了"); continue; } String noticeMethod = warning.getNoticeMethod(); - if(StringUtils.isBlank(noticeMethod) || + if (StringUtils.isBlank(noticeMethod) || (!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && - !noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ + !noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))) { log.info("通知方式为空或者错误!"); return; } @@ -279,22 +281,22 @@ public class EarlyWarningInstanceNotStartTask { String noticeContent = warning.getNoticeContent(); String adventContent = warning.getAdventContent(); String rule = warning.getRule(); - if(StringUtils.isNotBlank(rule)){ + if (StringUtils.isNotBlank(rule)) { JSONArray ruleArray = JSON.parseArray(rule); - if(CollUtil.isNotEmpty(ruleArray)){ + if (CollUtil.isNotEmpty(ruleArray)) { ruleArray.forEach(r -> { JSONObject rJson = JSON.parseObject(JSON.toJSONString(r)); Integer time = rJson.getInteger("time"); Integer adventTime = rJson.getInteger("adventTime"); Integer biz = rJson.getInteger("biz"); String notice = rJson.getString("notice"); - if((Objects.isNull(time) && Objects.isNull(adventTime)) || Objects.isNull(biz)){ - log.info("规则数据 错误 :{}",rJson); + if ((Objects.isNull(time) && Objects.isNull(adventTime)) || Objects.isNull(biz)) { + log.info("规则数据 错误 :{}", rJson); return; } WarningOperationTypeEnum operationTypeEnum = WarningOperationTypeEnum.getByCode(biz); - if(Objects.isNull(operationTypeEnum)){ + if (Objects.isNull(operationTypeEnum)) { log.info("匹配不到 业务类型"); return; } @@ -308,131 +310,131 @@ public class EarlyWarningInstanceNotStartTask { List needNextProjects = projectService.list(Wrappers.lambdaQuery(Project.class) .eq(Project::getAreaCode, areaCode) .eq(Project::getNewest, Boolean.TRUE) - .eq(Project::getStatus,projectStutas)); + .eq(Project::getStatus, projectStutas)); List projectCodes = needNextProjects.stream().map(Project::getProjectCode).collect(Collectors.toList()); List operations = operationService.list(Wrappers.lambdaQuery(Operation.class) .in(Operation::getProjectCode, projectCodes)); - Map operationMap = operations.stream().collect(Collectors.toMap(Operation::getProjectCode,o -> o)); - Map> noticeMap = Maps.newHashMap(); + Map operationMap = operations.stream().collect(Collectors.toMap(Operation::getProjectCode, o -> o)); + Map> noticeMap = Maps.newHashMap(); //需要发通知的项目 List needToWaringProjects = needNextProjects.stream() .filter(p -> { //判断 当状态在 建设中的时候 是不是要初验了 - if(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(projectStutas)){ + if (ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(projectStutas)) { List allVersionProjectId = projectService.getAllVersionProjectId(p); //如果合同信息提交过了 才是 待初验状态 - if(StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials())){ - if(0L == contractService.count(Wrappers.lambdaQuery(Contract.class) - .in(Contract::getProjectId, allVersionProjectId))){ + if (StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials())) { + if (0L == contractService.count(Wrappers.lambdaQuery(Contract.class) + .in(Contract::getProjectId, allVersionProjectId))) { return Boolean.FALSE; } } } //判断 实施信息中 初验和终验的时间 - if(!operationMap.containsKey(p.getProjectCode())){ + if (!operationMap.containsKey(p.getProjectCode())) { return Boolean.FALSE; } Operation operation = operationMap.get(p.getProjectCode()); List noticeTypes = Lists.newArrayList(); - if(WarningOperationTypeEnum.CHUYAN.getCode().equals(biz)){ + if (WarningOperationTypeEnum.CHUYAN.getCode().equals(biz)) { //初验 - if(Objects.nonNull(time) && Duration.between(operation.getInitialInspectionDate(),LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 - Duration.between(operation.getInitialInspectionDate(),LocalDateTime.now()).toMinutes() <= time * 60 + 1){ //time * 60 + if (Objects.nonNull(time) && Duration.between(operation.getInitialInspectionDate(), LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 + Duration.between(operation.getInitialInspectionDate(), LocalDateTime.now()).toMinutes() <= time * 60 + 1) { //time * 60 noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.OVER.getCode()); } - if(Objects.nonNull(adventTime) && Duration.between(operation.getInitialInspectionDate(),LocalDateTime.now()).toMinutes() >= adventTime * 60 && //time * 60 - Duration.between(operation.getInitialInspectionDate(),LocalDateTime.now()).toMinutes() <= adventTime * 60 + 1){ + if (Objects.nonNull(adventTime) && Duration.between(operation.getInitialInspectionDate(), LocalDateTime.now()).toMinutes() >= adventTime * 60 && //time * 60 + Duration.between(operation.getInitialInspectionDate(), LocalDateTime.now()).toMinutes() <= adventTime * 60 + 1) { noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.ADVENT.getCode()); } - }else if(WarningOperationTypeEnum.ZHONGYAN.getCode().equals(biz)){ + } else if (WarningOperationTypeEnum.ZHONGYAN.getCode().equals(biz)) { //终验 - if(Objects.nonNull(time) && Duration.between(operation.getFinalInspectionDate(),LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 - Duration.between(operation.getFinalInspectionDate(),LocalDateTime.now()).toMinutes() <= time * 60 + 1){ //time * 60 + if (Objects.nonNull(time) && Duration.between(operation.getFinalInspectionDate(), LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 + Duration.between(operation.getFinalInspectionDate(), LocalDateTime.now()).toMinutes() <= time * 60 + 1) { //time * 60 noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.OVER.getCode()); } - if(Objects.nonNull(adventTime) && Duration.between(operation.getFinalInspectionDate(),LocalDateTime.now()).toMinutes() >= adventTime * 60 && //time * 60 - Duration.between(operation.getFinalInspectionDate(),LocalDateTime.now()).toMinutes() <= adventTime * 60 + 1){ //time * 60 + if (Objects.nonNull(adventTime) && Duration.between(operation.getFinalInspectionDate(), LocalDateTime.now()).toMinutes() >= adventTime * 60 && //time * 60 + Duration.between(operation.getFinalInspectionDate(), LocalDateTime.now()).toMinutes() <= adventTime * 60 + 1) { //time * 60 noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.ADVENT.getCode()); } } - if(CollUtil.isNotEmpty(noticeTypes)){ - noticeMap.put(p.getProjectCode(),noticeTypes); + if (CollUtil.isNotEmpty(noticeTypes)) { + noticeMap.put(p.getProjectCode(), noticeTypes); //项目 运维预警 projectEarlyWarningService.earlyWarning(p, - WarningRuleTypeEnum.OPERATION_WARNING.getCode(),noticeTypes); + WarningRuleTypeEnum.OPERATION_WARNING.getCode(), noticeTypes); return Boolean.TRUE; } return Boolean.FALSE; }) .collect(Collectors.toList()); - if(StringUtils.isBlank(noticeMethod) || + if (StringUtils.isBlank(noticeMethod) || (!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && - !noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ + !noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))) { log.info("通知方式为空或者错误!"); return; } - for(Project needToWaringProject : needToWaringProjects){ + for (Project needToWaringProject : needToWaringProjects) { //去预警通知 List batchEmployees = Lists.newArrayList(); - if(StringUtils.isBlank(notice)){ + if (StringUtils.isBlank(notice)) { String sponsor = needToWaringProject.getSponsor(); batchEmployees.add(sponsor); - }else{ + } else { //去预警通知人 1.项目联系人 2.项目负责人 如果都包含 都要发 - if(notice.contains(WarningNoticeTypeEnum.CONTACT.getCode().toString())){ + if (notice.contains(WarningNoticeTypeEnum.CONTACT.getCode().toString())) { String employeeCode = null; String username = needToWaringProject.getContactName(); String mobile = needToWaringProject.getContactPhone(); - if(StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)){ + if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)) { UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) .eq(UserInfo::getUsername, username) .eq(UserInfo::getMobile, mobile) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(user)){ + if (Objects.nonNull(user)) { employeeCode = user.getEmployeeCode(); } - if(Objects.nonNull(employeeCode)){ + if (Objects.nonNull(employeeCode)) { batchEmployees.add(employeeCode); } } } - if(notice.contains(WarningNoticeTypeEnum.RESPONSIBLE.getCode().toString())){ + if (notice.contains(WarningNoticeTypeEnum.RESPONSIBLE.getCode().toString())) { String employeeCode = null; String username = needToWaringProject.getResponsibleMan(); String mobile = needToWaringProject.getResponsibleManMobile(); - if(StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)){ + if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)) { UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) .eq(UserInfo::getUsername, username) .eq(UserInfo::getMobile, mobile) .last(BizConst.LIMIT_1)); - if(Objects.nonNull(user)){ + if (Objects.nonNull(user)) { employeeCode = user.getEmployeeCode(); } - if(Objects.nonNull(employeeCode)){ + if (Objects.nonNull(employeeCode)) { batchEmployees.add(employeeCode); } } } } - if(noticeMap.containsKey(needToWaringProject.getProjectCode())){ + if (noticeMap.containsKey(needToWaringProject.getProjectCode())) { List noticeTypes = noticeMap.get(needToWaringProject.getProjectCode()); - for(Integer noticeType : noticeTypes){ + for (Integer noticeType : noticeTypes) { for (String employeeCode : batchEmployees) { - earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&¬iceType.equals(1) ? noticeContent : adventContent, - adventTime,time,biz, - needToWaringProject.getUpdateOn(),employeeCode,needToWaringProject, - WarningRuleTypeEnum.OPERATION_WARNING.getCode(),noticeType,path, - batchEmployees.stream().collect(Collectors.joining(StrPool.COMMA)),null); + earlyWarningManage.doEarlyWarning(noticeMethod, Objects.nonNull(noticeType) && noticeType.equals(1) ? noticeContent : adventContent, + adventTime, time, biz, + needToWaringProject.getUpdateOn(), Long.valueOf(employeeCode), needToWaringProject, + WarningRuleTypeEnum.OPERATION_WARNING.getCode(), noticeType, path, + batchEmployees.stream().collect(Collectors.joining(StrPool.COMMA)), null); } } } @@ -449,6 +451,7 @@ public class EarlyWarningInstanceNotStartTask { /** * 续建项目资金 超时未审批定时器 + * * @throws UnknownHostException */ @Scheduled(cron = "20 0/2 * * * ?") @@ -464,9 +467,9 @@ public class EarlyWarningInstanceNotStartTask { // 1.查询 填报的 预警规则 填报类型的 每个区域 续建项目资金审批 List warnings = earlyWarningService.list(Wrappers.lambdaQuery(WflowEarlyWarning.class) .eq(WflowEarlyWarning::getRuleType, WarningRuleTypeEnum.RENEWAL_FUND.getCode())); - for(WflowEarlyWarning warning : warnings){ + for (WflowEarlyWarning warning : warnings) { //2. 取出rule的数据 - if(!warning.getIsOpen()){ + if (!warning.getIsOpen()) { log.info(warning.getId() + " 此规则关闭了"); continue; } @@ -474,23 +477,23 @@ public class EarlyWarningInstanceNotStartTask { String noticeMethod = warning.getNoticeMethod(); String noticeContent = warning.getNoticeContent(); String adventContent = warning.getAdventContent(); - if(StringUtils.isBlank(noticeMethod) || + if (StringUtils.isBlank(noticeMethod) || (!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && - !noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ + !noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))) { log.info("通知方式为空或者错误!"); return; } String rule = warning.getRule(); - if(StringUtils.isNotBlank(rule)){ + if (StringUtils.isNotBlank(rule)) { JSONArray ruleArray = JSON.parseArray(rule); - if(CollUtil.isNotEmpty(ruleArray)){ + if (CollUtil.isNotEmpty(ruleArray)) { ruleArray.forEach(r -> { JSONObject rJson = JSON.parseObject(JSON.toJSONString(r)); Integer time = rJson.getInteger("time"); Integer adventTime = rJson.getInteger("adventTime"); - if((Objects.isNull(time) && Objects.isNull(adventTime)) && Objects.isNull(adventTime)){ - log.info("规则数据 错误 :{}",rJson); + if ((Objects.isNull(time) && Objects.isNull(adventTime)) && Objects.isNull(adventTime)) { + log.info("规则数据 错误 :{}", rJson); return; } @@ -500,56 +503,56 @@ public class EarlyWarningInstanceNotStartTask { //查询 所有这个区域的项目 未提交的项目 List needNextProjects = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) .eq(ProjectRenewalFundDeclaration::getRegionCode, areaCode) - .eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE) + .eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PENDING.name())); - Map> noticeTypeMap = Maps.newHashMap(); + Map> noticeTypeMap = Maps.newHashMap(); //需要发通知的项目 List needToWaringProjects = needNextProjects.stream() .filter(p -> { //超时未审批 List noticeTypes = Lists.newArrayList(); - if(Objects.nonNull(time) && Duration.between(p.getCreateOn(),LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 - Duration.between(p.getCreateOn(),LocalDateTime.now()).toMinutes() <= time * 60 + 1){ //time * 60 + if (Objects.nonNull(time) && Duration.between(p.getCreateOn(), LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 + Duration.between(p.getCreateOn(), LocalDateTime.now()).toMinutes() <= time * 60 + 1) { //time * 60 noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.OVER.getCode()); } - if(Objects.nonNull(adventTime) && Duration.between(p.getCreateOn(),LocalDateTime.now()).toMinutes() >= adventTime * 60 && //time * 60 - Duration.between(p.getCreateOn(),LocalDateTime.now()).toMinutes() <= adventTime * 60 + 1){ //time * 60 + if (Objects.nonNull(adventTime) && Duration.between(p.getCreateOn(), LocalDateTime.now()).toMinutes() >= adventTime * 60 && //time * 60 + Duration.between(p.getCreateOn(), LocalDateTime.now()).toMinutes() <= adventTime * 60 + 1) { //time * 60 noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.ADVENT.getCode()); } - if(CollUtil.isNotEmpty(noticeTypes)){ - noticeTypeMap.put(p.getProjectCode(),noticeTypes); + if (CollUtil.isNotEmpty(noticeTypes)) { + noticeTypeMap.put(p.getProjectCode(), noticeTypes); //项目 运维预警 projectEarlyWarningService.earlyWarning(p.getProjectCode(), - WarningRuleTypeEnum.OPERATION_WARNING.getCode(),noticeTypes); + WarningRuleTypeEnum.OPERATION_WARNING.getCode(), noticeTypes); return Boolean.TRUE; } return Boolean.FALSE; }) .collect(Collectors.toList()); - if(StringUtils.isBlank(noticeMethod) || + if (StringUtils.isBlank(noticeMethod) || (!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && - !noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ + !noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))) { log.info("通知方式为空或者错误!"); return; } - for(ProjectRenewalFundDeclaration needToWaringProject : needToWaringProjects){ + for (ProjectRenewalFundDeclaration needToWaringProject : needToWaringProjects) { String path = "projectStoreManage/renewalProjectAsscess?projectRenewalId=" + needToWaringProject.getId(); Project project = projectService.getProjectByCode(needToWaringProject.getProjectCode()); //去预警通知 发给区管 - List users = roleManage.getUsersByRoleType(RoleEnum.REGION_MANAGER.name(),needToWaringProject.getRegionCode()); + List users = roleManage.getUsersByRoleType(RoleEnum.REGION_MANAGER.name()); String employeesStr = users.stream().map(UserInfo::getEmployeeCode) .collect(Collectors.joining(StrPool.COMMA)); - for(UserInfo user : users){ - if(noticeTypeMap.containsKey(needToWaringProject.getProjectCode())){ + for (UserInfo user : users) { + if (noticeTypeMap.containsKey(needToWaringProject.getProjectCode())) { List noticeTypes = noticeTypeMap.get(needToWaringProject.getProjectCode()); - for(Integer noticeType : noticeTypes){ - earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&¬iceType.equals(1) ? noticeContent : adventContent, - adventTime,time,null, - needToWaringProject.getUpdateOn(),user.getEmployeeCode(),project, - WarningRuleTypeEnum.RENEWAL_FUND.getCode(),noticeType,path,employeesStr,needToWaringProject.getId().toString()); + for (Integer noticeType : noticeTypes) { + earlyWarningManage.doEarlyWarning(noticeMethod, Objects.nonNull(noticeType) && noticeType.equals(1) ? noticeContent : adventContent, + adventTime, time, null, + needToWaringProject.getUpdateOn(), Long.valueOf(user.getEmployeeCode()), project, + WarningRuleTypeEnum.RENEWAL_FUND.getCode(), noticeType, path, employeesStr, needToWaringProject.getId().toString()); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/SynProjectCollectionTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/SynProjectCollectionTask.java index 4092d37..3d41804 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/SynProjectCollectionTask.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/SynProjectCollectionTask.java @@ -37,8 +37,8 @@ import java.util.StringJoiner; * @author ZPF * @since 2023/08/31 18:16 */ -@Component @Slf4j +@Component @RequiredArgsConstructor public class SynProjectCollectionTask { @@ -48,35 +48,21 @@ public class SynProjectCollectionTask { @Value("${spring.profiles.active}") public String active; - @Autowired - private GovProjectCollectionManage collectionManage; - - @Autowired - private IGovBizProjectBaseinfoService baseinfoService; - @Autowired - private IGovBizProjectApplyService applyService; - @Autowired - private IGovBizProjectApproveService approveService; - - @Autowired - private IGovBizProjectCimplementService cimplementService; - - @Autowired - private IGovBizProjectMimplementService mimplementService; - - @Autowired - private IGovBizProjectProcureService procureService; - @Autowired - private IProjectService projectService; - @Autowired - private ProjectLibManage projectLibManage; + private final GovProjectCollectionManage collectionManage; + private final IGovBizProjectBaseinfoService baseinfoService; + private final IGovBizProjectApplyService applyService; + private final IGovBizProjectApproveService approveService; + private final IGovBizProjectCimplementService cimplementService; + private final IGovBizProjectMimplementService mimplementService; + private final IGovBizProjectProcureService procureService; + private final IProjectService projectService; + private final ProjectLibManage projectLibManage; + private final FileService fileService; - @Autowired - private FileService fileService; + private static final Integer PAGE_NUMBER = 1; - private final Integer PAGE_NUMBER = 1; /** * 前置机每天晚上10点自动清空,第二天早上6点获取数据 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/staging/contants/StagingContant.java b/hz-pm-api/src/main/java/com/hz/pm/api/staging/contants/StagingContant.java index 8591833..cd76638 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/staging/contants/StagingContant.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/staging/contants/StagingContant.java @@ -6,6 +6,10 @@ package com.hz.pm.api.staging.contants; public interface StagingContant { class Retry { + + private Retry() { + } + public static final Integer MAX_RETRY_TIMES = 10; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/staging/service/impl/NdWorkNoticeStagingServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/staging/service/impl/NdWorkNoticeStagingServiceImpl.java index 75fc836..33f7749 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/staging/service/impl/NdWorkNoticeStagingServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/staging/service/impl/NdWorkNoticeStagingServiceImpl.java @@ -1,11 +1,11 @@ package com.hz.pm.api.staging.service.impl; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hz.pm.api.staging.contants.StagingContant; import com.hz.pm.api.staging.enums.MsgTypeEnum; -import com.hz.pm.api.staging.model.entity.WorkNoticeStaging; import com.hz.pm.api.staging.mapper.NdWorkNoticeStagingMapper; +import com.hz.pm.api.staging.model.entity.WorkNoticeStaging; import com.hz.pm.api.staging.service.INdWorkNoticeStagingService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hz.pm.api.staging.utils.WorkNoticeFlowMapUtil; import com.hz.pm.api.todocenter.bean.entity.WorkNoticeInfo; import lombok.RequiredArgsConstructor; @@ -31,7 +31,6 @@ public class NdWorkNoticeStagingServiceImpl extends ServiceImpl 0) { dead = Boolean.TRUE; @@ -69,6 +68,7 @@ public class NdWorkNoticeStagingServiceImpl extends ServiceImpl intervalTimeMap = Maps.newHashMap(); + private static final Map INTERVAL_TIME_MAP = Maps.newHashMap(); - /** - * 扫描的间隔越来越长 秒数 - */ - public WorkNoticeFlowMapUtil(){ - intervalTimeMap.put(0,60); - intervalTimeMap.put(1,60 * 2); - intervalTimeMap.put(2,60 * 6); - intervalTimeMap.put(3,60 * 15); - intervalTimeMap.put(4,60 * 30); - intervalTimeMap.put(5,60 * 60); - intervalTimeMap.put(6,60 * 60 * 2); - intervalTimeMap.put(7,60 * 60 * 5); - intervalTimeMap.put(8,60 * 60 * 12); - intervalTimeMap.put(9,60 * 60 * 24); - intervalTimeMap.put(10,60 * 60 * 72); - intervalTimeMap.put(11,60 * 60 * 216); + + static { + INTERVAL_TIME_MAP.put(0, 60); + INTERVAL_TIME_MAP.put(1, 60 * 2); + INTERVAL_TIME_MAP.put(2, 60 * 6); + INTERVAL_TIME_MAP.put(3, 60 * 15); + INTERVAL_TIME_MAP.put(4, 60 * 30); + INTERVAL_TIME_MAP.put(5, 60 * 60); + INTERVAL_TIME_MAP.put(6, 60 * 60 * 2); + INTERVAL_TIME_MAP.put(7, 60 * 60 * 5); + INTERVAL_TIME_MAP.put(8, 60 * 60 * 12); + INTERVAL_TIME_MAP.put(9, 60 * 60 * 24); + INTERVAL_TIME_MAP.put(10, 60 * 60 * 72); + INTERVAL_TIME_MAP.put(11, 60 * 60 * 216); } + + public static Integer get(Integer times) { + return INTERVAL_TIME_MAP.get(times); + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/contants/UserGuidanceContant.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/contants/UserGuidanceContant.java index 9f51129..4cb5313 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/contants/UserGuidanceContant.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/contants/UserGuidanceContant.java @@ -11,6 +11,10 @@ public interface UserGuidanceContant { Integer ALL_FINISHED_NUM = 2; class OrgModel { + + private OrgModel() { + } + public static final String GUIDANCE_NAME = "配置单位流程"; public static final String GUIDANCE_REMARK = "用户项目审核,请先配置单位默认流程"; public static final String GUIDANCE_PATH1 = "unitSet/flowPathConfiguration"; @@ -20,12 +24,20 @@ public interface UserGuidanceContant { } class FiscalCode { + + private FiscalCode() { + } + public static final String GUIDANCE_NAME = "配置财政编码"; public static final String GUIDANCE_REMARK = "用于生成项目唯一编码"; public static final String GUIDANCE_PATH = "unitSet/fiscalCodeSet"; } class Signature { + + private Signature() { + } + public static final String GUIDANCE_NAME = "配置印章编码"; public static final String GUIDANCE_REMARK = "用于电子签章"; public static final String GUIDANCE_PATH = "unitSet/fiscalCodeSet"; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/convert/RegionConverter.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/convert/RegionConverter.java index a90aa59..e5f8b91 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/convert/RegionConverter.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/convert/RegionConverter.java @@ -23,6 +23,9 @@ import java.util.stream.Collectors; */ public class RegionConverter { + private RegionConverter() { + } + public static RegionDTO toRegionDTO(Region region) { RegionDTO dto = new RegionDTO(); dto.setRegionLevel(region.getRegionLevel()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java index bfda643..b36535f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java @@ -3,19 +3,18 @@ package com.hz.pm.api.sys.manage; import com.hz.pm.api.common.enumeration.CommonEnum; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.meeting.helper.YxtCallOrSmsHelper; +import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; import com.hz.pm.api.projectlib.model.enumeration.WarningFlowTypeEnum; import com.hz.pm.api.projectlib.model.enumeration.WarningOperationTypeEnum; -import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.staging.enums.MsgTypeEnum; import com.hz.pm.api.staging.service.INdWorkNoticeStagingService; import com.hz.pm.api.sys.model.entity.Notify; import com.hz.pm.api.sys.model.entity.WflowEarlyWarningRecords; import com.hz.pm.api.sys.service.IEarlyWarningRecordsService; import com.hz.pm.api.sys.service.INotifyService; -import com.hz.pm.api.todocenter.bean.entity.WorkNoticeInfo; import com.hz.pm.api.user.security.model.UserFullInfoDTO; -import com.ningdatech.yxt.model.cmd.SendSmsCmd; +import com.ningdatech.yxt.model.cmd.SendSmsCmd.SendSmsContext; import com.wflow.enums.WarningNoticeTypeEnum; import com.wflow.enums.WarningRuleTypeEnum; import lombok.AllArgsConstructor; @@ -55,15 +54,15 @@ public class EarlyWarningManage { * @param noticeMethod * @param noticeContent * @param adventTimeout - * @param employeeCode + * @param userId * @param project */ public void doEarlyWarning(String noticeMethod, String noticeContent, Integer adventTimeout, Integer overTimeout, - Integer biz, LocalDateTime startTime, String employeeCode, + Integer biz, LocalDateTime startTime, Long userId, Project project, Integer ruleType, Integer noticeType, String path, String batchEmployees, String nodeId) { //1.存入 预警记录 - UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(userId); WflowEarlyWarningRecords records = new WflowEarlyWarningRecords(); String content; @@ -134,13 +133,13 @@ public class EarlyWarningManage { records.setNoticeContent(content); records.setProjectName(project.getProjectName()); records.setWarningUsername(Objects.nonNull(user) ? user.getUsername() : StringUtils.EMPTY); - records.setWarningEmployeecode(employeeCode); + records.setWarningUserId(String.valueOf(userId)); records.setProjectId(project.getId()); records.setProjectCode(project.getProjectCode()); records.setProjectStatus(project.getStatus()); records.setNoticeType(noticeType); records.setPath(path); - records.setBatchEmployees(batchEmployees); + records.setBatchUserIds(batchEmployees); records.setBiz(biz); records.setNodeId(nodeId); records.setOverTime(overTimeout); @@ -153,20 +152,20 @@ public class EarlyWarningManage { //3.发短信 if (noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode()))) { - SendSmsCmd.SendSmsContext context = new SendSmsCmd.SendSmsContext(); + SendSmsContext context = new SendSmsContext(); context.setReceiveNumber(user.getMobile()); context.setContent(content); yxtCallOrSmsHelper.sendSms(context); } //4.浙政钉 - if (noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode()))) { + /*if (noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode()))) { // 获取发送浙政钉工作通知必要信息 - WorkNoticeInfo passWorkNoticeInfo = noticeManage.getSendWorkNoticeInfo(employeeCode); + WorkNoticeInfo passWorkNoticeInfo = noticeManage.getSendWorkNoticeInfo(userId); passWorkNoticeInfo.setMsg(content); // 放入工作通知暂存表中,通过扫表异步发送 workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo, MsgTypeEnum.PROJECT_REVIEW); - } + }*/ } /** @@ -175,15 +174,15 @@ public class EarlyWarningManage { * @param noticeMethod * @param noticeContent * @param adventTimeout - * @param employeeCode + * @param userId * @param project */ public void urging(String noticeMethod, String noticeContent, Integer adventTimeout, Integer overTimeout, - Integer biz, LocalDateTime startTime, String employeeCode, + Integer biz, LocalDateTime startTime, Long userId, Project project, Integer ruleType, Integer noticeType, String path, String batchEmployees, String nodeId) { //1.存入 预警记录 - UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(userId); WflowEarlyWarningRecords records = new WflowEarlyWarningRecords(); String content; @@ -254,13 +253,13 @@ public class EarlyWarningManage { records.setNoticeContent(content); records.setProjectName(project.getProjectName()); records.setWarningUsername(Objects.nonNull(user) ? user.getUsername() : StringUtils.EMPTY); - records.setWarningEmployeecode(employeeCode); + records.setWarningUserId(String.valueOf(userId)); records.setProjectId(project.getId()); records.setProjectCode(project.getProjectCode()); records.setProjectStatus(project.getStatus()); records.setNoticeType(noticeType); records.setPath(path); - records.setBatchEmployees(batchEmployees); + records.setBatchUserIds(batchEmployees); records.setBiz(biz); records.setNodeId(nodeId); earlyWarningRecordsService.save(records); @@ -272,20 +271,20 @@ public class EarlyWarningManage { //3.发短信 if (noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode()))) { - SendSmsCmd.SendSmsContext context = new SendSmsCmd.SendSmsContext(); + SendSmsContext context = new SendSmsContext(); context.setReceiveNumber(user.getMobile()); context.setContent(content); yxtCallOrSmsHelper.sendSms(context); } - //4.浙政钉 + /*//4.浙政钉 if (noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode()))) { // 获取发送浙政钉工作通知必要信息 WorkNoticeInfo passWorkNoticeInfo = noticeManage.getSendWorkNoticeInfo(employeeCode); passWorkNoticeInfo.setMsg(content); // 放入工作通知暂存表中,通过扫表异步发送 workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo, MsgTypeEnum.PROJECT_REVIEW); - } + }*/ } /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java index e147c0c..144f745 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java @@ -7,12 +7,6 @@ import com.alibaba.fastjson.JSON; 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.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.model.IdVo; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.file.entity.vo.result.AttachFileVo; -import com.ningdatech.file.service.FileService; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.common.util.BizUtils; import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; @@ -41,6 +35,12 @@ import com.hz.pm.api.user.security.model.UserFullInfoDTO; import com.hz.pm.api.user.security.model.UserInfoDetails; import com.hz.pm.api.user.service.IUserInfoService; import com.hz.pm.api.user.util.LoginUserUtil; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.model.IdVo; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.file.entity.vo.result.AttachFileVo; +import com.ningdatech.file.service.FileService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -90,7 +90,7 @@ public class NoticeManage { @Transactional(rollbackFor = Exception.class) public IdVo saveOrModify(NoticeSaveReq req) { Notice notice = BeanUtil.copyProperties(req, Notice.class); - permissionsSave(notice,LoginUserUtil.loginUserDetail()); + permissionsSave(notice, LoginUserUtil.loginUserDetail()); noticeService.saveOrUpdate(notice); return IdVo.of(notice.getId()); } @@ -135,7 +135,7 @@ public class NoticeManage { .eq(req.getType() != null, Notice::getType, req.getType()) .orderByDesc(Notice::getToppedTime, Notice::getUpdateOn); UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - permissionsWrapperByEdit(wrapper,user); + permissionsWrapperByEdit(wrapper, user); Page page = noticeService.page(req.page(), wrapper); if (page.getTotal() == 0) { return PageVo.empty(); @@ -159,7 +159,7 @@ public class NoticeManage { .eq(req.getType() != null, Notice::getType, req.getType()) .orderByDesc(Notice::getToppedTime, Notice::getUpdateOn); UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - permissionsWrapper(wrapper,user); + permissionsWrapper(wrapper, user); Page page = noticeService.page(req.page(), wrapper); if (page.getTotal() == 0) { return PageVo.empty(); @@ -176,13 +176,13 @@ public class NoticeManage { return PageVo.of(tempDataList, page.getTotal()); } - public Map> listToMapByManager(NoticeListReq req,UserFullInfoDTO user) { + public Map> listToMapByManager(NoticeListReq req, UserFullInfoDTO user) { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Notice.class) .eq(req.getEnabled() != null, Notice::getEnabled, req.getEnabled()) .like(StrUtil.isNotBlank(req.getTitle()), Notice::getTitle, req.getTitle()) .eq(req.getType() != null, Notice::getType, req.getType()) .orderByDesc(Notice::getToppedTime, Notice::getUpdateOn); - permissionsWrapper(wrapper,user); + permissionsWrapper(wrapper, user); List records = noticeService.list(wrapper); return CollUtils.convert(records, w -> NoticeListItemVO .builder() @@ -202,15 +202,16 @@ public class NoticeManage { /** * 发送消息 - * @param employeeCode 员工号 - * @param userId 用户ID - * @param project 项目 + * + * @param employeeCode 员工号 + * @param userId 用户ID + * @param project 项目 * @param procDefinitionName 流程定义名 - * @param template 消息模板内容 - * @param msgTypeEnum 枚举 + * @param template 消息模板内容 + * @param msgTypeEnum 枚举 */ public void sendNotice(String employeeCode, Long userId, Project project, String procDefinitionName, - String template, MsgTypeEnum msgTypeEnum){ + String template, MsgTypeEnum msgTypeEnum) { // 获取发送浙政钉工作通知必要信息 WorkNoticeInfo passWorkNoticeInfo = getSendWorkNoticeInfo(employeeCode); String passMsg = String.format(template, project.getProjectName(), procDefinitionName); @@ -226,13 +227,13 @@ public class NoticeManage { /** * 获取发送浙政钉工作通知的信息 * - * @param currentEmployeeCode + * @param employeeCode \ * @return com.hz.pm.api.todocenter.bean.entity.WorkNoticeInfo * @author CMM * @since 2023/02/15 14:04 */ - public WorkNoticeInfo getSendWorkNoticeInfo(String currentEmployeeCode) { - UserInfo auditUserInfo = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class).eq(UserInfo::getEmployeeCode,currentEmployeeCode).last("limit 1")); + public WorkNoticeInfo getSendWorkNoticeInfo(String employeeCode) { + UserInfo auditUserInfo = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class).eq(UserInfo::getEmployeeCode, employeeCode).last("limit 1")); if (Objects.isNull(auditUserInfo)) { throw new BizException("该用户不存在!"); } @@ -245,7 +246,7 @@ public class NoticeManage { // 根据浙政钉用户ID获取部门code DingEmployeeInfo employeeInfo = dingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) .eq(DingEmployeeInfo::getAccountId, accountId) - .eq(DingEmployeeInfo::getMainJob,String.valueOf(Boolean.TRUE)) + .eq(DingEmployeeInfo::getMainJob, String.valueOf(Boolean.TRUE)) .last("limit 1")); String organizationCode = employeeInfo.getOrganizationCode(); workNoticeInfo.setOrganizationCode(organizationCode); @@ -265,6 +266,7 @@ public class NoticeManage { /** * 装配项目审核工作通知 + * * @param userId * @param project * @param msg @@ -286,12 +288,13 @@ public class NoticeManage { /** * 找寻第一个审核人 去发消息 + * * @param project * @param formName * @param template * @param msgTypeEnum */ - public void sendFirtUser(Project project, String formName,String instanceId, String template, MsgTypeEnum msgTypeEnum) { + public void sendFirtUser(Project project, String formName, String instanceId, String template, MsgTypeEnum msgTypeEnum) { try { List activityInstances = runtimeService.createActivityInstanceQuery() .processInstanceId(instanceId) @@ -301,13 +304,13 @@ public class NoticeManage { .list(); for (ActivityInstance activityInstance : activityInstances) { - if(StringUtils.isNotBlank(activityInstance.getAssignee())){ - UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(activityInstance.getAssignee()); + if (StringUtils.isNotBlank(activityInstance.getAssignee())) { + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(Long.valueOf(activityInstance.getAssignee())); sendNotice(activityInstance.getAssignee(), user.getUserId(), project, formName, template, msgTypeEnum); } } - }catch (Exception e){ + } catch (Exception e) { log.error("发送消息失败 :" + e); } @@ -315,57 +318,51 @@ public class NoticeManage { /** * 公告保存 权限控制 - * @param notice - * @param user + * + * @param notice \ + * @param user \ */ private void permissionsSave(Notice notice, UserInfoDetails user) { List userRoleList = user.getUserRoleList(); - if(CollUtil.isEmpty(userRoleList)){ + if (CollUtil.isEmpty(userRoleList)) { //默认 权限是单位 notice.setPermissions(NoticePermissionsEnum.ORG.getCode()); - notice.setPermissionsValue(user.getEmpPosUnitCode()); + notice.setPermissionsValue(user.getMhUnitIdStr()); return; } - if(user.getSuperAdmin()){ + if (user.getSuperAdmin()) { notice.setPermissions(NoticePermissionsEnum.SUPER.getCode()); return; - }else if(user.getRegionAdmin()){ - notice.setPermissions(NoticePermissionsEnum.REGION.getCode()); - notice.setPermissionsValue(user.getRegionCode()); - return; - }else if(user.getIsOrgAdmin()){ + } else if (user.getIsOrgAdmin()) { notice.setPermissions(NoticePermissionsEnum.ORG.getCode()); - notice.setPermissionsValue(user.getEmpPosUnitCode()); + notice.setPermissionsValue(user.getMhUnitIdStr()); return; } notice.setPermissions(NoticePermissionsEnum.ORG.getCode()); - notice.setPermissionsValue(user.getEmpPosUnitCode()); + notice.setPermissionsValue(user.getMhUnitIdStr()); } /** * 列表查询 权限体现 - * @param wrapper + * + * @param wrapper \ */ - private void permissionsWrapper(LambdaQueryWrapper wrapper,UserFullInfoDTO user) { - wrapper.and(q3 -> q3.eq(Notice::getPermissions,NoticePermissionsEnum.SUPER.getCode()) - .or(q1 -> q1.eq(Notice::getPermissions,NoticePermissionsEnum.REGION.getCode()) - .eq(Notice::getPermissionsValue,user.getRegionCode())) - .or(q2 -> q2.eq(Notice::getPermissions,NoticePermissionsEnum.ORG.getCode()) - .eq(Notice::getPermissionsValue,user.getEmpPosUnitCode()))); + private void permissionsWrapper(LambdaQueryWrapper wrapper, UserFullInfoDTO user) { + wrapper.and(q3 -> q3.eq(Notice::getPermissions, NoticePermissionsEnum.SUPER.getCode()) + .or(q1 -> q1.eq(Notice::getPermissions, NoticePermissionsEnum.REGION.getCode())) + .or(q2 -> q2.eq(Notice::getPermissions, NoticePermissionsEnum.ORG.getCode()) + .eq(Notice::getPermissionsValue, user.getMhUnitId()))); } - private void permissionsWrapperByEdit(LambdaQueryWrapper wrapper,UserFullInfoDTO user) { + private void permissionsWrapperByEdit(LambdaQueryWrapper wrapper, UserFullInfoDTO user) { //如果是超管 就能看所有 - if(user.getSuperAdmin()){ + if (user.getSuperAdmin() || user.getRegionAdmin()) { log.info(user.getUsername() + ",超管可以看所有"); - }else if(user.getRegionAdmin()){ - wrapper.eq(Notice::getPermissions,NoticePermissionsEnum.REGION.getCode()) - .eq(Notice::getPermissionsValue,user.getRegionCode()); - }else if(user.getIsOrgAdmin()){ - wrapper.eq(Notice::getPermissions,NoticePermissionsEnum.ORG.getCode()) - .eq(Notice::getPermissionsValue,user.getEmpPosUnitCode()); - }else{ - wrapper.eq(Notice::getCreateOn,user.getUserId()); + } else if (user.getIsOrgAdmin()) { + wrapper.eq(Notice::getPermissions, NoticePermissionsEnum.ORG.getCode()) + .eq(Notice::getPermissionsValue, user.getMhUnitId()); + } else { + wrapper.eq(Notice::getCreateOn, user.getUserId()); } } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/RoleManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/RoleManage.java index 686f59e..724f602 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/RoleManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/RoleManage.java @@ -41,9 +41,7 @@ public class RoleManage { private final IMenuService menuService; private final IRoleMenuService roleMenuService; private final IRoleMenuDatascopeService roleMenuDatascopeService; - - private final IUserRoleService iUserRoleService; - + private final IUserRoleService userRoleService; private final IUserInfoService userInfoService; public PageVo queryList(RolePageReq rolePageReq) { @@ -94,12 +92,12 @@ public class RoleManage { Role regionRole = roleService.getOne(Wrappers.lambdaQuery(Role.class) .eq(Role::getCode, roleType) .last(BizConst.LIMIT_1)); - if(Objects.isNull(regionRole)){ + if (Objects.isNull(regionRole)) { return Collections.emptyList(); } - List userRoles = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) + List userRoles = userRoleService.list(Wrappers.lambdaQuery(UserRole.class) .eq(UserRole::getRoleId, regionRole.getId())); - if(CollUtil.isEmpty(userRoles)){ + if (CollUtil.isEmpty(userRoles)) { return Collections.emptyList(); } List userIds = userRoles.stream().map(UserRole::getUserId) @@ -107,22 +105,4 @@ public class RoleManage { return userInfoService.listByIds(userIds); } - public List getUsersByRoleType(String roleType,String regionCode) { - Role regionRole = roleService.getOne(Wrappers.lambdaQuery(Role.class) - .eq(Role::getCode, roleType) - .last(BizConst.LIMIT_1)); - if(Objects.isNull(regionRole)){ - return Collections.emptyList(); - } - List userRoles = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) - .eq(UserRole::getRoleId, regionRole.getId())); - if(CollUtil.isEmpty(userRoles)){ - return Collections.emptyList(); - } - List userIds = userRoles.stream().map(UserRole::getUserId) - .collect(Collectors.toList()); - return userInfoService.list(Wrappers.lambdaQuery(UserInfo.class) - .in(UserInfo::getId,userIds) - .eq(UserInfo::getRegionCode,regionCode)); - } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/UserGuidanceManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/UserGuidanceManage.java index 15c1198..75fa8c4 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/UserGuidanceManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/UserGuidanceManage.java @@ -1,6 +1,7 @@ package com.hz.pm.api.sys.manage; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.lang.Assert; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; import com.hz.pm.api.expert.entity.ExpertUserFullInfo; @@ -56,14 +57,13 @@ public class UserGuidanceManage { /** * 查询用户引导 详情 + * * @param user * @return */ public UserGuidanceVO detailUserGuidance(UserInfoDetails user) { UserGuidanceVO vo = new UserGuidanceVO(); - //单位code - String empPosUnitCode = user.getEmpPosUnitCode(); - vo.setEmpPosUnitCode(empPosUnitCode); + vo.setOrgCode(user.getMhUnitId()); //用户信息 String username = user.getUsername(); vo.setUsername(username); @@ -79,21 +79,21 @@ public class UserGuidanceManage { Integer finishedNum = 0; //1.去查询 用户所在单位 有没有单位默认流程配置 并且process 不能为空 WflowOrgModels orgModel = orgProcdefService.getOne(Wrappers.lambdaQuery(WflowOrgModels.class) - .eq(WflowOrgModels::getOrgCode, empPosUnitCode) + .eq(WflowOrgModels::getOrgCode, user.getMhUnitId()) .eq(WflowOrgModels::getType, ProcessDefTypeEnum.DEFAULT.name()) .eq(WflowOrgModels::getIsDelete, Boolean.FALSE) .last(BizConst.LIMIT_1)); - if(Objects.isNull(orgModel)){ + if (Objects.isNull(orgModel)) { orgModelGuidance.setPath(UserGuidanceContant.OrgModel.GUIDANCE_PATH1); orgModelGuidance.setIsFinish(Boolean.FALSE); - }else{ + } else { orgModelGuidance.setPath(UserGuidanceContant.OrgModel.GUIDANCE_PATH2 + orgModel.getProcessDefId()); //判断process是否为空 - if(StringUtils.isNotBlank(orgModel.getProcess()) && - !UserGuidanceContant.OrgModel.EMPTY_PROCESS.equals(orgModel.getProcess())){ + if (StringUtils.isNotBlank(orgModel.getProcess()) && + !UserGuidanceContant.OrgModel.EMPTY_PROCESS.equals(orgModel.getProcess())) { orgModelGuidance.setIsFinish(Boolean.TRUE); - finishedNum ++; - }else{ + finishedNum++; + } else { orgModelGuidance.setIsFinish(Boolean.FALSE); } } @@ -105,22 +105,22 @@ public class UserGuidanceManage { signatureGuidance.setRemark(UserGuidanceContant.Signature.GUIDANCE_REMARK); signatureGuidance.setPath(UserGuidanceContant.Signature.GUIDANCE_PATH); CompanySignature signature = signatureService.getOne(Wrappers.lambdaQuery(CompanySignature.class) - .eq(CompanySignature::getOrganizationCode, empPosUnitCode) + .eq(CompanySignature::getOrganizationCode, user.getMhUnitId()) .last(BizConst.LIMIT_1)); - if(Objects.isNull(signature)){ + if (Objects.isNull(signature)) { signatureGuidance.setIsFinish(Boolean.FALSE); - }else{ + } else { //判断印章编码是否为空 - if(StringUtils.isNotBlank(signature.getSealSn())){ + if (StringUtils.isNotBlank(signature.getSealSn())) { signatureGuidance.setIsFinish(Boolean.TRUE); - finishedNum ++; - }else{ + finishedNum++; + } else { signatureGuidance.setIsFinish(Boolean.FALSE); } } details.add(signatureGuidance); - if(UserGuidanceContant.ALL_FINISHED_NUM.equals(finishedNum)){ + if (UserGuidanceContant.ALL_FINISHED_NUM.equals(finishedNum)) { vo.setIsAllFinished(Boolean.TRUE); } vo.setDetails(details); @@ -129,24 +129,24 @@ public class UserGuidanceManage { /** * 删除重复用户 + * * @param userId * @return */ public String removeRepeat(Long userId) { UserInfo user = userInfoService.getById(userId); - VUtils.isTrue(Objects.isNull(user)).throwMessage("该用户不存在 删除重复失败"); + Assert.notNull(user, "该用户不存在 删除重复失败"); List repeatUsers = userInfoService.list(Wrappers.lambdaQuery(UserInfo.class) .eq(UserInfo::getUsername, user.getUsername()) .ne(UserInfo::getId, userId) .isNull(UserInfo::getAccountId)); - if(CollUtil.isNotEmpty(repeatUsers)){ + if (CollUtil.isNotEmpty(repeatUsers)) { List repeatIds = repeatUsers.stream().map(UserInfo::getId).collect(Collectors.toList()); userInfoService.removeBatchByIds(repeatIds); userAuthService.remove(Wrappers.lambdaQuery(UserAuth.class) - .in(UserAuth::getUserId,repeatIds)); - userRoleService.remove(Wrappers.lambdaQuery(UserRole.class) - .in(UserRole::getUserId,repeatIds)); - for(Long repeatId : repeatIds){ + .in(UserAuth::getUserId, repeatIds)); + userRoleService.remove(Wrappers.lambdaQuery(UserRole.class).in(UserRole::getUserId, repeatIds)); + for (Long repeatId : repeatIds) { ExpertUserFullInfo expert = expertUserFullInfoService.getByUserId(repeatId); expert.setUserId(userId); expertUserFullInfoService.updateById(expert); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/RoleUpdateDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/RoleUpdateDTO.java index 15fecda..cc70cb0 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/RoleUpdateDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/dto/RoleUpdateDTO.java @@ -27,9 +27,7 @@ import java.util.List; @EqualsAndHashCode(callSuper = false) @Builder @ApiModel(value = "RoleUpdateDTO", description = "角色") -public class RoleUpdateDTO implements Serializable { - - private static final long serialVersionUID = 1L; +public class RoleUpdateDTO { @ApiModelProperty(value = "主键") @NotNull(message = "id不能为空", groups = Update.class) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/WflowEarlyWarningRecords.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/WflowEarlyWarningRecords.java index bea2507..551ade1 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/WflowEarlyWarningRecords.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/WflowEarlyWarningRecords.java @@ -81,7 +81,7 @@ public class WflowEarlyWarningRecords implements Serializable { * 预警员工号 */ @ApiModelProperty(value = "预警员工号") - private String warningEmployeecode; + private String warningUserId; /** * 通知方式 @@ -120,7 +120,7 @@ public class WflowEarlyWarningRecords implements Serializable { private String nodeId; @ApiModelProperty(value = "这一批要通知的员工号") - private String batchEmployees; + private String batchUserIds; @ApiModelProperty(value = "临期时要记录下 超期的时间") private Integer overTime; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/ProjectEarlyWarningVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/ProjectEarlyWarningVO.java index c88de44..a5a76dc 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/ProjectEarlyWarningVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/ProjectEarlyWarningVO.java @@ -68,7 +68,7 @@ public class ProjectEarlyWarningVO implements Serializable { @ApiModelProperty(value = "预警ID") private Long recordId; @ApiModelProperty(value = "预警员工号") - private String warningEmployeecode; + private String warningUserId; @ApiModelProperty(value = "通知方式 0浙政钉 1短信 逗号分隔") private String noticeMethod; @ApiModelProperty(value = "通知内容") @@ -80,7 +80,7 @@ public class ProjectEarlyWarningVO implements Serializable { @ApiModelProperty(value = "路径") private String path; @ApiModelProperty(value = "这一批要通知的员工号") - private String batchEmployees; + private String batchUserIds; private LocalDateTime createOn; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/UserGuidanceVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/UserGuidanceVO.java index 974721f..302f86d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/UserGuidanceVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/UserGuidanceVO.java @@ -38,7 +38,7 @@ public class UserGuidanceVO { * 单位code */ @ApiModelProperty(value = "单位code") - private String empPosUnitCode; + private Long orgCode; /** * 是否全部完成 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IRoleService.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IRoleService.java index aa2dbf1..07278ef 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IRoleService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IRoleService.java @@ -65,7 +65,7 @@ public interface IRoleService extends IService { * @param name / * @return 存在返回真 */ - Boolean check(String name); + boolean check(String name); /** * 校验角色名 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IUserRoleService.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IUserRoleService.java index 6af1af9..fe2b362 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IUserRoleService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IUserRoleService.java @@ -7,7 +7,6 @@ import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.sys.model.entity.UserRole; import java.util.Collection; -import java.util.Collections; import java.util.List; /** @@ -36,6 +35,7 @@ public interface IUserRoleService extends IService { * @author WendyYang **/ List listUserIdByRoleId(Long roleId); + List listUserIdByRoleIds(Collection roleId); default UserRole getOne(Long userId, Long roleId) { @@ -46,4 +46,10 @@ public interface IUserRoleService extends IService { return getOne(eq); } + default List listByUserId(Long userId) { + LambdaQueryWrapper eq = Wrappers.lambdaQuery(UserRole.class) + .eq(UserRole::getUserId, userId); + return list(eq); + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/RoleServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/RoleServiceImpl.java index 530f815..d9fd252 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/RoleServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/impl/RoleServiceImpl.java @@ -173,7 +173,7 @@ public class RoleServiceImpl extends ServiceImpl implements IR } @Override - public Boolean check(String name) { + public boolean check(String name) { return super.count(Wrappers.lambdaQuery(Role.class).eq(Role::getName, name)) > 0; } @@ -187,7 +187,6 @@ public class RoleServiceImpl extends ServiceImpl implements IR roleMenuService.remove(Wrappers.lambdaQuery(RoleMenu.class).eq(RoleMenu::getRoleId, roleId)); if (CollUtil.isNotEmpty(menuIds)) { Set toAddMenus = new HashSet<>(); - // Set addParentIds = new HashSet<>(); for (Long menuId : menuIds) { Menu menu = menuService.getById(menuId); if (Objects.isNull(menu)) { @@ -195,8 +194,6 @@ public class RoleServiceImpl extends ServiceImpl implements IR } RoleMenu roleMenu = new RoleMenu(null, menuId, roleId); toAddMenus.add(roleMenu); - // 父级菜单 - // addParent(toAddMenus, menu, roleId, addParentIds); } if (CollUtil.isNotEmpty(toAddMenus)) { roleMenuService.saveBatch(toAddMenus); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/utils/EarlyWarningUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/utils/EarlyWarningUtil.java index a30a6bc..bf440da 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/utils/EarlyWarningUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/utils/EarlyWarningUtil.java @@ -14,51 +14,46 @@ import com.hz.pm.api.user.security.model.UserInfoDetails; */ public class EarlyWarningUtil { - public static void buildPermissonWrapper(LambdaQueryWrapper wrapper, - UserInfoDetails user) { + private EarlyWarningUtil() { + } + + public static void buildPermissionWrapper(LambdaQueryWrapper wrapper, + UserInfoDetails user) { //如果是超管的话 - if(user.getSuperAdmin()){ - //可以看所有 - //如果是区管 - }else if(user.getRegionAdmin()){ - wrapper.eq(WflowEarlyWarningRecords::getAreaCode,user.getRegionCode()); - }else if(user.getIsOrgAdmin()){ - wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode,user.getEmpPosUnitCode()); - }else{ + if (user.getSuperAdmin() || user.getRegionAdmin()) { + // 可以看所有 + } else if (user.getIsOrgAdmin()) { + wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode, user.getMhUnitId()); + } else { //否则都只能看自己单位的 - wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode,user.getEmpPosUnitCode()); + wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode, user.getMhUnitId()); } } - public static void buildPermissonFullWrapper(LambdaQueryWrapper wrapper, - UserFullInfoDTO user) { + public static void buildPermissionFullWrapper(LambdaQueryWrapper wrapper, + UserFullInfoDTO user) { //如果是超管的话 - if(user.getSuperAdmin()){ - //可以看所有 - //如果是区管 - }else if(user.getRegionAdmin()){ - wrapper.eq(WflowEarlyWarningRecords::getAreaCode,user.getRegionCode()); - }else if(user.getIsOrgAdmin()){ - wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode,user.getEmpPosUnitCode()); - }else{ + if (user.getSuperAdmin() || user.getRegionAdmin()) { + // 可以看所有 + } else if (user.getIsOrgAdmin()) { + wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode, user.getMhUnitId()); + } else { //否则都只能看自己单位的 - wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode,user.getEmpPosUnitCode()); + wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode, user.getMhUnitId()); } } - public static void buildPermissonProjectWrapper(LambdaQueryWrapper wrapper, - UserFullInfoDTO user) { + public static void buildPermissionProjectWrapper(LambdaQueryWrapper wrapper, + UserFullInfoDTO user) { //如果是超管的话 - if(user.getSuperAdmin()){ - //可以看所有 - //如果是区管 - }else if(user.getRegionAdmin()){ - wrapper.eq(Project::getAreaCode,user.getRegionCode()); - }else if(user.getIsOrgAdmin()){ - wrapper.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); - }else{ + if (user.getSuperAdmin()) { + // 看所有 + } else if (user.getIsOrgAdmin()) { + wrapper.eq(Project::getBuildOrgCode, user.getMhUnitId()); + } else { //否则都只能看自己单位的 - wrapper.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); + wrapper.eq(Project::getBuildOrgCode, user.getMhUnitId()); } } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/constant/TodoCenterConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/constant/TodoCenterConst.java new file mode 100644 index 0000000..9c9a156 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/constant/TodoCenterConst.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.todocenter.constant; +/** + * @author ZPF + * @since 2023/04/02 14:56 + */ +public interface TodoCenterConst { + + class Handler { + + private Handler() { + } + + public static final String ACTIVITY_APPROVAL = "userTask"; + + public static final String OR_SIGN_FLAG = "MI_END"; + + public static final String TASKID_ERROR = "TASKID_ERROR"; + } + + class Declared { + + private Declared() { + } + + public static final String NULL_INST_CODE = "EMPTY"; + + } + + class SealTemplate{ + + private SealTemplate() { + } + + public static final String CITY_TEMPLATE = "市级-预审申请单"; + public static final String COUNTRY_TEMPLATE = "区县-预审申请单"; + public static final String CONSTRUCT_TEMPLATE = "建设方案申请单"; + + public static final String COUNTRY_SEAL_POS_PAGE = "6"; + public static final Float COUNTRY_SEAL_POS_X = 487F; + public static final Float COUNTRY_SEAL_POS_Y = 380F; + public static final Integer COUNTRY_SEAL_SIGN_TYPE = 1; + + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/constant/TodoCenterConstant.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/constant/TodoCenterConstant.java deleted file mode 100644 index 5a1792f..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/constant/TodoCenterConstant.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.hz.pm.api.todocenter.constant; -/** - * @author ZPF - * @since 2023/04/02 14:56 - */ -public interface TodoCenterConstant { - - class Handler { - - public static final String ACTIVITY_APPROVAL = "userTask"; - - public static final String OR_SIGN_FLAG = "MI_END"; - - public static final String TASKID_ERROR = "TASKID_ERROR"; - } - - class Declared { - - public static final String NULL_INST_CODE = "EMPTY"; - - } - - class SealTemplate{ - public static final String CITY_TEMPLATE = "市级-预审申请单"; - public static final String COUNTRY_TEMPLATE = "区县-预审申请单"; - public static final String CONSTRUCT_TEMPLATE = "建设方案申请单"; - - public static final String COUNTRY_SEAL_POS_PAGE = "6"; - public static final Float COUNTRY_SEAL_POS_X = 487F; - public static final Float COUNTRY_SEAL_POS_Y = 380F; - public static final Integer COUNTRY_SEAL_SIGN_TYPE = 1; - - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/constant/WorkNoticeConstant.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/constant/WorkNoticeConstant.java index 4026006..8b07769 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/constant/WorkNoticeConstant.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/constant/WorkNoticeConstant.java @@ -4,23 +4,27 @@ package com.hz.pm.api.todocenter.constant; * @author CMM * @since 2023/02/01 14:56 */ -public interface WorkNoticeConstant { - public final String PASS_MSG_TEMPLATE = "【%s】的【%s】需要您审核。"; - public final String PASS_MSG_TEMPLATE2 = "【%s】已通过【%s】,请及时开始下一步操作。"; - public final String BACK_MSG_TEMPLATE = "【%s】的【%s】被退回,请及时处理。"; - public final String REJECT_MSG_TEMPLATE = "【%s】的【%s】被驳回,请及时处理。"; +public class WorkNoticeConstant { - public final String CC_MSG_TEMPLATE = "【%s】的【%s】有消息抄送您,请查看详情"; + private WorkNoticeConstant() { + } - public final String AUDIT_WORK_TITLE = "审核任务"; + public static final String PASS_MSG_TEMPLATE = "【%s】的【%s】需要您审核。"; + public static final String PASS_MSG_TEMPLATE2 = "【%s】已通过【%s】,请及时开始下一步操作。"; + public static final String BACK_MSG_TEMPLATE = "【%s】的【%s】被退回,请及时处理。"; + public static final String REJECT_MSG_TEMPLATE = "【%s】的【%s】被驳回,请及时处理。"; - public final String EXPERT_REVIEW_TEMPLATE = "【%s】的【%s】待您评审,请及时处理。"; - public final String REVIEW_MEETING_TEMPLATE = "【%s】已完成专家抽取,请及时处理。"; - public final String WARNING_ALERT_TEMPLATE = "【%s】的【%s】待您审核,已停留2小时,请及时处理。"; + public static final String CC_MSG_TEMPLATE = "【%s】的【%s】有消息抄送您,请查看详情"; - public final String PROJECT_ID = "projectId"; - public final String INSTANCE_ID = "instanceId"; - public final String MEETING_ID = "meetingId"; + public static final String AUDIT_WORK_TITLE = "审核任务"; + + public static final String EXPERT_REVIEW_TEMPLATE = "【%s】的【%s】待您评审,请及时处理。"; + public static final String REVIEW_MEETING_TEMPLATE = "【%s】已完成专家抽取,请及时处理。"; + public static final String WARNING_ALERT_TEMPLATE = "【%s】的【%s】待您审核,已停留2小时,请及时处理。"; + + public static final String PROJECT_ID = "projectId"; + public static final String INSTANCE_ID = "instanceId"; + public static final String MEETING_ID = "meetingId"; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/handle/WithDrawHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/handle/WithDrawHandle.java index a06e647..e652664 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/handle/WithDrawHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/handle/WithDrawHandle.java @@ -3,10 +3,11 @@ package com.hz.pm.api.todocenter.handle; import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.util.StrUtils; import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; import com.hz.pm.api.projectlib.model.entity.ProjectInst; import com.hz.pm.api.projectlib.service.IProjectInstService; -import com.hz.pm.api.todocenter.constant.TodoCenterConstant; +import com.hz.pm.api.todocenter.constant.TodoCenterConst; 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; @@ -51,57 +52,58 @@ public class WithDrawHandle { /** * 判断 当前流程 可否被当前登录人 所撤回 + * * @param instanceId * @param progressInstanceDetail * @return */ - public Boolean checkCanWithdraw(String instanceId, ProcessProgressVo progressInstanceDetail,String taskId) { + public Boolean checkCanWithdraw(String instanceId, ProcessProgressVo progressInstanceDetail, String taskId) { HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() .processInstanceId(instanceId).singleResult(); UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); String employeeCode = userInfoDetails.getEmployeeCode(); //如果不是审核中 - if(!ProcessStatusEnum.UNDER_REVIEW.getDesc() - .equals(progressInstanceDetail.getStatus())){ + if (!ProcessStatusEnum.UNDER_REVIEW.getDesc() + .equals(progressInstanceDetail.getStatus())) { return Boolean.FALSE; } // 如果当前登录用户是流程发起人,判断流程是否已经开始审批,如果开始审批,不能撤回 Boolean userIsRoot = checkUserIsRoot(instanceId, null); - if (Boolean.TRUE.equals(userIsRoot) && canRootWithDraw(historicProcessInstance, employeeCode)){ + if (Boolean.TRUE.equals(userIsRoot) && canRootWithDraw(historicProcessInstance, employeeCode)) { return Boolean.TRUE; } ReqProcessHandlerDTO dto = new ReqProcessHandlerDTO(); dto.setTaskId(taskId); dto.setInstanceId(instanceId); - return checkUserIsBefore(progressInstanceDetail.getProgressInfo(),dto); + return checkUserIsBefore(progressInstanceDetail.getProgressInfo(), dto); } // 判断当前操作人 是上一个节点的审批人 - public Boolean checkUserIsBefore(List currentProgressInfo, ReqProcessHandlerDTO param) { + public Boolean checkUserIsBefore(List currProgressInfo, ReqProcessHandlerDTO param) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); // 先排除掉抄送任务节点 - currentProgressInfo = currentProgressInfo.stream() + currProgressInfo = currProgressInfo.stream() .filter(c -> !NodeTypeEnum.CC.name().equals(c.getNodeType().name())) .collect(Collectors.toList()); - if (CollUtil.isEmpty(currentProgressInfo)){ + if (CollUtil.isEmpty(currProgressInfo)) { return Boolean.FALSE; } String taskId = param.getTaskId(); //1.判断出 当前审批人和上一个审批人 如果传了taskid - ProgressNode progressNode = StringUtils.isBlank(taskId) ? - currentProgressInfo.get(currentProgressInfo.size() - 1) - : findSubNodeByTaskId(taskId,currentProgressInfo); + ProgressNode progressNode = StrUtils.isBlank(taskId) ? + currProgressInfo.get(currProgressInfo.size() - 1) + : findSubNodeByTaskId(taskId, currProgressInfo); - if (Objects.isNull(progressNode)){ + if (Objects.isNull(progressNode)) { return Boolean.FALSE; } - ProgressNode beforeProgressNode = null; - ProgressNode currentProgressNode = null; + ProgressNode beforeProgressNode; + ProgressNode currProgressNode; // 说明当前节点是子流程节点 // 如果是会签 或签 当前和上个 @@ -113,64 +115,62 @@ public class WithDrawHandle { children = children.stream() .filter(c -> !NodeTypeEnum.CC.name().equals(c.getNodeType().name())) .collect(Collectors.toList()); - if (CollUtil.isEmpty(children)){ + if (CollUtil.isEmpty(children)) { return Boolean.FALSE; } - currentProgressNode = children.get(children.size() - 1); + currProgressNode = children.get(children.size() - 1); //把当前和上一个节点和 会签或签的情况 都check出来 - beforeProgressNode = checkBeforeNodeAndOr(children,currentProgressNode,thisAndOr,beforeAndOr); + beforeProgressNode = checkBeforeNodeAndOr(children, currProgressNode, thisAndOr, beforeAndOr); } else { - currentProgressNode = currentProgressInfo.get(currentProgressInfo.size() - 1); + currProgressNode = currProgressInfo.get(currProgressInfo.size() - 1); // 把当前和上一个节点和 会签或签的情况 都check出来 - beforeProgressNode = checkBeforeNodeAndOr(currentProgressInfo,currentProgressNode,thisAndOr,beforeAndOr); + beforeProgressNode = checkBeforeNodeAndOr(currProgressInfo, currProgressNode, thisAndOr, beforeAndOr); } // 判断当前工作流任务前一个审核人的部门和当前登录用户的部门是否是同一个,如果是同一个才可以撤回,否则抛出异常 // 获取当前当前工作流任务当前审核人信息 - UserFullInfoDTO currentUserInfo = userInfoHelper.getUserFullInfoByEmployeeCode(currentProgressNode.getUserId()); - if(Objects.isNull(currentUserInfo) || !currentUserInfo.getEmpPosUnitCode().equals(user.getEmpPosUnitCode())){ + UserFullInfoDTO currUser = userInfoHelper.getUserFullInfo(Long.valueOf(currProgressNode.getUserId())); + if (Objects.isNull(currUser) || !currUser.getMhUnitId().equals(user.getMhUnitId())) { return Boolean.FALSE; } - Boolean isAndOr = Boolean.FALSE; + boolean isAndOr = Boolean.FALSE; - //判断当前子流程是否结束 如果结束了 必不能撤回 - Boolean thisSubNodeOver = Boolean.FALSE; //当前节点是 会签|或签的情况 - if(CollUtil.isNotEmpty(thisAndOr)){ + if (CollUtil.isNotEmpty(thisAndOr)) { Integer finishNodes = 0; - for(ProgressNode n : thisAndOr){ - if(Objects.nonNull(n.getFinishTime())){ + for (ProgressNode n : thisAndOr) { + if (Objects.nonNull(n.getFinishTime())) { //当前会签 有审批过的 那么上个会签|或签 无论如何 就不可能可以撤回了 beforeAndOr = Collections.emptyList(); - finishNodes ++; + finishNodes++; } //找到了 当前的操作人 在当前的 会签|或签 中 并且已经审批了 - if(n.getUserId().equals(user.getEmployeeCode()) && - Objects.nonNull(n.getFinishTime())){ + if (n.getUserId().equals(user.getUserIdStr()) && + Objects.nonNull(n.getFinishTime())) { beforeProgressNode = n; //说明当前操作人 在上个会签或者或签节点 isAndOr = Boolean.TRUE; } } //如果都审批过了 结束了 那说明此子流程已经结束了 不能再撤回了 - if(finishNodes.equals(thisAndOr.size())){ + if (finishNodes.equals(thisAndOr.size())) { return Boolean.FALSE; } - }else{ + } else { //如果当前不是会签|或签 就判断 当前最后一个节点 结束了没 //如果结束了 也同样 直接不能撤回 - if(Objects.nonNull(currentProgressNode.getFinishTime())){ + if (Objects.nonNull(currProgressNode.getFinishTime())) { return Boolean.FALSE; } } //如果上个会签没取到 还有种情况是 会签 或签 并且在上个节点 - if(!isAndOr && CollUtil.isNotEmpty(beforeAndOr)) { + if (!isAndOr && CollUtil.isNotEmpty(beforeAndOr)) { for (ProgressNode n : beforeAndOr) { - if (n.getUserId().equals(user.getEmployeeCode()) - && !TodoCenterConstant.Handler.OR_SIGN_FLAG.equals(n.getWithdrawFlag())) { + if (n.getUserId().equals(user.getUserIdStr()) + && !TodoCenterConst.Handler.OR_SIGN_FLAG.equals(n.getWithdrawFlag())) { beforeProgressNode = n; //说明当前操作人 在上个会签或者或签节点 isAndOr = Boolean.TRUE; @@ -179,47 +179,46 @@ public class WithDrawHandle { } } - if(!isAndOr && (Objects.isNull(beforeProgressNode) - || !user.getEmployeeCode().equals(beforeProgressNode.getUserId()))){ + if (!isAndOr && (Objects.isNull(beforeProgressNode) + || !user.getUserIdStr().equals(beforeProgressNode.getUserId()))) { return Boolean.FALSE; } //如果是true 把对应操作人 在上个审批节点的task 也传入 - if(Objects.nonNull(param)){ - // 获取bpmn文件中节点的连线关系,如果前一个节点的下一个节点是抄送节点, - // 获取抄送节点传入param中,在执行撤回操作时,将抄送信息从抄送表中删除 - HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery() - .processInstanceId(param.getInstanceId()) - .singleResult(); - BpmnModel bpmnModel = repositoryService.getBpmnModel(processInstance.getProcessDefinitionId()); - // 传节点定义key 获取撤回操作人在流程配置中所在的节点 - FlowNode flowNode = (FlowNode) bpmnModel.getFlowElement(beforeProgressNode.getNodeId()); - List outgoingFlows = flowNode.getOutgoingFlows(); - for (SequenceFlow outgoingFlow : outgoingFlows) { - //获取输出节点元素 - FlowElement targetFlowElement = outgoingFlow.getTargetFlowElement(); - // 获取下一个抄送任务的节点 - if(targetFlowElement instanceof ServiceTask){ - param.setCcNodeId(targetFlowElement.getId()); - break; - } + // 获取bpmn文件中节点的连线关系,如果前一个节点的下一个节点是抄送节点, + // 获取抄送节点传入param中,在执行撤回操作时,将抄送信息从抄送表中删除 + HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery() + .processInstanceId(param.getInstanceId()) + .singleResult(); + BpmnModel bpmnModel = repositoryService.getBpmnModel(processInstance.getProcessDefinitionId()); + // 传节点定义key 获取撤回操作人在流程配置中所在的节点 + FlowNode flowNode = (FlowNode) bpmnModel.getFlowElement(beforeProgressNode.getNodeId()); + List outgoingFlows = flowNode.getOutgoingFlows(); + for (SequenceFlow outgoingFlow : outgoingFlows) { + //获取输出节点元素 + FlowElement targetFlowElement = outgoingFlow.getTargetFlowElement(); + // 获取下一个抄送任务的节点 + if (targetFlowElement instanceof ServiceTask) { + param.setCcNodeId(targetFlowElement.getId()); + break; } - param.setTaskId(beforeProgressNode.getTaskId()); } + param.setTaskId(beforeProgressNode.getTaskId()); return Boolean.TRUE; } /** * 找到其 所在的子流程父节点 + * * @param taskId * @return */ - private ProgressNode findSubNodeByTaskId(String taskId,List currentProgressInfos) { - for(ProgressNode progressNode : currentProgressInfos){ - if(progressNode.getNodeType().equals(NodeTypeEnum.SUB)){ + private ProgressNode findSubNodeByTaskId(String taskId, List currentProgressInfos) { + for (ProgressNode progressNode : currentProgressInfos) { + if (progressNode.getNodeType().equals(NodeTypeEnum.SUB)) { List children = progressNode.getChildren(); - for(ProgressNode c : children){ - if(taskId.equals(c.getTaskId())){ + for (ProgressNode c : children) { + if (taskId.equals(c.getTaskId())) { //如果任务ID对得上 返回其 所在的子流程 return progressNode; } @@ -231,18 +230,20 @@ public class WithDrawHandle { /** * 判断撤回用户 是不是发起人 + * * @param processInstanceId * @param task * @return */ - public Boolean checkUserIsRoot(String processInstanceId,String task){ + public Boolean checkUserIsRoot(String processInstanceId, String task) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); // 获取当前要处理的流程实例 HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() .processInstanceId(processInstanceId) .singleResult(); - if (user.getEmployeeCode().equals(instance.getStartUserId()) && - (Objects.isNull(task) || user.getEmployeeCode().equals(instance.getStartUserId()))) { + String userId = user.getUserIdStr(); + if (userId.equals(instance.getStartUserId()) && + (Objects.isNull(task) || userId.equals(instance.getStartUserId()))) { return Boolean.TRUE; } return Boolean.FALSE; @@ -251,14 +252,15 @@ public class WithDrawHandle { /** * 把上一个节点 和 或签 会签情况都check出来 + * * @param progressNodes andOr - * @param thisAndOr beforeAndOr + * @param thisAndOr beforeAndOr * @return */ - public ProgressNode checkBeforeNodeAndOr(List progressNodes,ProgressNode curr, - List thisAndOr,List beforeAndOr) { + public ProgressNode checkBeforeNodeAndOr(List progressNodes, ProgressNode curr, + List thisAndOr, List beforeAndOr) { ProgressNode beforeNode = null; - if(progressNodes.size() == 1){ + if (progressNodes.size() == 1) { return null; } //进入上一个节点的标识 @@ -267,20 +269,20 @@ public class WithDrawHandle { String thisAndOrNodeId = curr.getNodeId(); //假设 作为上一个会签/或签的第一个点 ProgressNode beforeAndOrNode = null; - for(int i = progressNodes.size() - 2;i >= 0;i--){ + for (int i = progressNodes.size() - 2; i >= 0; i--) { //说明有会签 或签 - if(progressNodes.get(i).getNodeId().equals(thisAndOrNodeId)){ + if (progressNodes.get(i).getNodeId().equals(thisAndOrNodeId)) { //还在当前节点 - if(!enterBefore){ - if(thisAndOr.isEmpty()){ + if (!enterBefore) { + if (thisAndOr.isEmpty()) { //放入当前的那个点 thisAndOr.add(curr); } thisAndOr.add(progressNodes.get(i)); } //如果在上个节点了 - else{ - if(beforeAndOr.isEmpty()){ + else { + if (beforeAndOr.isEmpty()) { //放入假设的那个点 beforeAndOr.add(beforeAndOrNode); //如果 上个节点也是 会签|或签 那么就置为null @@ -288,11 +290,11 @@ public class WithDrawHandle { } beforeAndOr.add(progressNodes.get(i)); } - }else{ + } else { thisAndOrNodeId = progressNodes.get(i).getNodeId(); //存在假设可能 beforeAndOrNode = progressNodes.get(i); - if(!enterBefore){ + if (!enterBefore) { beforeNode = progressNodes.get(i); enterBefore = Boolean.TRUE; continue; @@ -306,9 +308,10 @@ public class WithDrawHandle { /** * 1.判断 当前 撤回人 是否是 发起人 * 2.并且流程 尚未开始审批 + * * @return */ - public boolean canRootWithDraw(HistoricProcessInstance instance,String employeeCode) { + public boolean canRootWithDraw(HistoricProcessInstance instance, String employeeCode) { String startUserId = instance.getStartUserId(); // 如果是申请延期或者申请借阅审批流程,流程发起人不能撤回,直接返回false String instanceId = instance.getId(); @@ -317,24 +320,24 @@ public class WithDrawHandle { Integer instType = projectInst.getInstType(); if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) || - InstTypeEnum.APPLY_BORROW.getCode().equals(instType)){ + InstTypeEnum.APPLY_BORROW.getCode().equals(instType)) { return Boolean.FALSE; } //如果流程发起人 不是 当前登录人 直接返回false - if(StringUtils.isBlank(employeeCode) || StringUtils.isBlank(startUserId) - || !employeeCode.equals(startUserId)){ + if (StringUtils.isBlank(employeeCode) || StringUtils.isBlank(startUserId) + || !employeeCode.equals(startUserId)) { return Boolean.FALSE; } List finished = historyService.createHistoricActivityInstanceQuery() .processInstanceId(instance.getId()).finished() - .activityType(TodoCenterConstant.Handler.ACTIVITY_APPROVAL) + .activityType(TodoCenterConst.Handler.ACTIVITY_APPROVAL) .orderByHistoricActivityInstanceEndTime().asc().list(); List instances = finished.stream() .filter(a -> !HisProInsEndActId.WITHDRAW.equals(a.getDeleteReason())) .collect(Collectors.toList()); //如果有已经被审核过的 节点 返回false - if(CollUtil.isNotEmpty(instances)){ + if (CollUtil.isNotEmpty(instances)) { return Boolean.FALSE; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java index 2eadbac..3a8bd21 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java @@ -53,7 +53,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.todocenter.constant.TodoCenterConstant; +import com.hz.pm.api.todocenter.constant.TodoCenterConst; import com.hz.pm.api.user.util.LoginUserUtil; import com.wflow.contants.HisProInsEndActId; import com.wflow.workflow.bean.process.ProgressNode; @@ -489,7 +489,7 @@ public class HandlerManage { stateMachineUtil.withDraw(declaredProject); declaredProject.setUpdateOn(LocalDateTime.now()); declaredProject.setUpdateBy(userId); - declaredProject.setInstCode(TodoCenterConstant.Declared.NULL_INST_CODE); + declaredProject.setInstCode(TodoCenterConst.Declared.NULL_INST_CODE); projectService.updateById(declaredProject); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java index d9e9e35..cc3d74e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java @@ -9,15 +9,16 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.Assert; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; +import com.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.model.constant.CommonConst; import com.hz.pm.api.common.model.constant.RegionConst; -import com.hz.pm.api.common.enumeration.CommonEnum; -import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.common.model.entity.ExcelExportWriter; import com.hz.pm.api.common.util.BizUtils; import com.hz.pm.api.common.util.ExcelDownUtil; @@ -38,7 +39,7 @@ import com.hz.pm.api.signature.entity.CompanySignature; import com.hz.pm.api.signature.service.ICompanySignatureService; import com.hz.pm.api.sys.model.entity.Region; import com.hz.pm.api.sys.service.IRegionService; -import com.hz.pm.api.todocenter.constant.TodoCenterConstant; +import com.hz.pm.api.todocenter.constant.TodoCenterConst; import com.hz.pm.api.todocenter.enumeration.IsAppendProjectEnum; import com.hz.pm.api.todocenter.enumeration.IsOrNotEnum; import com.hz.pm.api.todocenter.handle.PassHandle; @@ -153,19 +154,11 @@ public class TodoCenterManage { * @since 2023/02/18 */ public PageVo todoProjectList(ToBeProcessedReq param) { - String employeeCode = param.getEmployeeCode(); - if (StringUtils.isBlank(employeeCode)) { + String userIdStr = String.valueOf(param.getUserId()); + if (StringUtils.isBlank(userIdStr)) { // 获取登录用户ID Long userId = Optional.ofNullable(param.getLoginUserId()).orElseGet(LoginUserUtil::getUserId); - // 获取登录用户全量信息 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - // 获取员工浙政钉code - if (Objects.nonNull(userFullInfo)) { - employeeCode = userFullInfo.getEmployeeCode(); - } - if (StringUtils.isBlank(employeeCode)) { - return PageVo.empty(); - } + userIdStr = String.valueOf(userId); } // 查出项目库项目 @@ -184,7 +177,7 @@ public class TodoCenterManage { .orderByDesc(ProjectInst::getProjectId)); Map projectInfoMap = projectInstList.stream() .filter(p -> StringUtils.isNotBlank(p.getInstCode()) && - !TodoCenterConstant.Declared.NULL_INST_CODE.equals(p.getInstCode())) + !TodoCenterConst.Declared.NULL_INST_CODE.equals(p.getInstCode())) .collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); @@ -197,7 +190,7 @@ public class TodoCenterManage { Integer pageNumber = param.getPageNumber(); Integer pageSize = param.getPageSize(); req.setProcessDefId(param.getProcessDefId()); - req.setEmployeeCode(employeeCode); + req.setEmployeeCode(userIdStr); //有待办节点的(不包含退回) List todoList = processTaskService.getUserTodoList(req); //有退回待办的 @@ -274,10 +267,8 @@ public class TodoCenterManage { // 获取登录用户ID Long userId = LoginUserUtil.getUserId(); - // 获取用户全量用户信息 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); // 获取登录用户浙政钉code - String employeeCode = userFullInfo.getEmployeeCode(); + String userIdStr = String.valueOf(userId); List userTodoList = Lists.newArrayList(); Map projectInfoMap = MapUtil.newHashMap(); @@ -285,9 +276,6 @@ public class TodoCenterManage { ProjectListReq projectListReq = new ProjectListReq(); BeanUtils.copyProperties(param, projectListReq); List projects = projectLibManage.projectList(projectListReq); - if (StringUtils.isBlank(employeeCode)) { - projects = Collections.emptyList(); - } if (CollUtil.isNotEmpty(projects)) { Map projectsMap = CollUtils.listToMap(projects, Project::getId); // 再查出项目关联的流程实例ID @@ -301,7 +289,7 @@ public class TodoCenterManage { TodoCenterListReqDTO req = new TodoCenterListReqDTO(); req.setInstCodes(instCodes); req.setProcessDefId(param.getProcessDefId()); - req.setEmployeeCode(employeeCode); + req.setEmployeeCode(userIdStr); // 有待办节点的(不包含退回) List todoList = processTaskService.getUserTodoList(req); @@ -347,7 +335,7 @@ public class TodoCenterManage { // 获取登录用户ID UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); // 获取登录用户浙政钉code - String employeeCode = user.getEmployeeCode(); + String userIdStr = user.getUserIdStr(); // 获取入参 String processInstanceId = param.getInstanceId(); Long projectId = param.getProjectId(); @@ -380,26 +368,26 @@ public class TodoCenterManage { //前置判断前端传的taskId是否存在不存在的情况 有可能是 或签被别人审批掉了 Task task = taskService.createTaskQuery().taskId(param.getTaskId()).active().singleResult(); if (ObjectUtil.isNull(task)) { - return TodoCenterConstant.Handler.TASKID_ERROR; + return TodoCenterConst.Handler.TASKID_ERROR; } String nodeId = task.getTaskDefinitionKey(); // 通过该任务,流程到下一审核人处 - processTaskService.handleTask(param, employeeCode); + processTaskService.handleTask(param, userIdStr); //通过审核后 所处理的逻辑 handlerManage.afterPassTodo(declaredProject, instance); - return findNextTaskId(instance, employeeCode, nodeId, param.getTaskId()); + return findNextTaskId(instance, userIdStr, nodeId, param.getTaskId()); } // 驳回 case REJECT: { //前置判断前端传的taskId是否存在不存在的情况 有可能是 或签被别人审批掉了 Task task = taskService.createTaskQuery().taskId(param.getTaskId()).active().singleResult(); if (ObjectUtil.isNull(task)) { - return TodoCenterConstant.Handler.TASKID_ERROR; + return TodoCenterConst.Handler.TASKID_ERROR; } // 驳回该任务,中止流程并使项目进入对应状态,给项目创建人、流程发起人发送浙政钉工作通知: // 【项目名称】的【流程名称】被驳回,请及时处理。 - processTaskService.handleTask(param, employeeCode); + processTaskService.handleTask(param, userIdStr); //驳回审核后 所处理的逻辑 handlerManage.afterRejectTodo(declaredProject, instance); } @@ -409,10 +397,10 @@ public class TodoCenterManage { //前置判断前端传的taskId是否存在不存在的情况 有可能是 或签被别人审批掉了 Task task = taskService.createTaskQuery().taskId(param.getTaskId()).active().singleResult(); if (ObjectUtil.isNull(task)) { - return TodoCenterConstant.Handler.TASKID_ERROR; + return TodoCenterConst.Handler.TASKID_ERROR; } // 退回该任务 - processTaskService.handleTaskLs(param, employeeCode); + processTaskService.handleTaskLs(param, userIdStr); //退回审核后 所处理的逻辑 handlerManage.afterBackTodo(declaredProject, instance); } @@ -424,9 +412,9 @@ public class TodoCenterManage { * 不判断前端传的taskId * 1.先判断 用户是否是ROOT 发起人 并且流程没有开始审批 */ - if (withDrawHandle.canRootWithDraw(instance, employeeCode)) { + if (withDrawHandle.canRootWithDraw(instance, userIdStr)) { // 登录用户是流程发起人,且是流程发起人撤回 - processTaskService.rootWithdrawTask(param, employeeCode); + processTaskService.rootWithdrawTask(param, userIdStr); //发起人撤回 handlerManage.rootWithDraw(declaredProject); } else { @@ -438,13 +426,13 @@ public class TodoCenterManage { //前置判断前端传的taskId是否存在不存在的情况 有可能是 或签被别人审批掉了 HistoricTaskInstance taskInst = historyService.createHistoricTaskInstanceQuery().taskId(param.getTaskId()).finished().singleResult(); if (ObjectUtil.isNull(taskInst)) { - return TodoCenterConstant.Handler.TASKID_ERROR; + return TodoCenterConst.Handler.TASKID_ERROR; } String nodeId = taskInst.getTaskDefinitionKey(); //上个审批人处理逻辑 processTaskService.lastWithdrawTask(param); - return findNextTaskId(instance, employeeCode, nodeId, param.getTaskId()); + return findNextTaskId(instance, userIdStr, nodeId, param.getTaskId()); } } break; @@ -463,10 +451,10 @@ public class TodoCenterManage { /** * 调用IRS接口,获取盖章后的pdf文件,上传到OSS,并保存文件ID到项目库中 * - * @param req - * @param declaredProject - * @param templateName - * @param notSealedFileId + * @param req \ + * @param declaredProject \ + * @param templateName \ + * @param notSealedFileId \ * @return void * @author CMM * @since 2023/03/16 21:34 @@ -492,7 +480,7 @@ public class TodoCenterManage { UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); // 获取印章编号 CompanySignature companySignature = companySignatureService.getOne(Wrappers.lambdaQuery(CompanySignature.class) - .eq(CompanySignature::getOrganizationCode, userFullInfo.getEmpPosUnitCode())); + .eq(CompanySignature::getOrganizationCode, userFullInfo.getMhUnitId())); sealSn = companySignature.getSealSn(); } else { // 区县预审时,对有上级条线主管单位并进行了盖章的情况,需要根据上次的印章编号再次盖章 @@ -532,12 +520,12 @@ public class TodoCenterManage { FileResultVO resultVo = fileService.upload(multipartFile, "default"); // 将返回的文件ID更新到项目库中对应的项目下 // 根据模版名称判断是预审申请单还是建设方案申请单 - if (TodoCenterConstant.SealTemplate.CITY_TEMPLATE.equals(templateName) || - TodoCenterConstant.SealTemplate.COUNTRY_TEMPLATE.equals(templateName)) { + if (TodoCenterConst.SealTemplate.CITY_TEMPLATE.equals(templateName) || + TodoCenterConst.SealTemplate.COUNTRY_TEMPLATE.equals(templateName)) { //放到项目申报书字段 declaredProject.setProjectApplicationForm(BizUtils.buildFileJson(resultVo)); declaredProject.setUpdateOn(LocalDateTime.now()); - } else if (TodoCenterConstant.SealTemplate.CONSTRUCT_TEMPLATE.equals(templateName)) { + } else if (TodoCenterConst.SealTemplate.CONSTRUCT_TEMPLATE.equals(templateName)) { declaredProject.setConstructFileId(resultVo.getId()); declaredProject.setConstructFileName(resultVo.getOriginalFileName()); declaredProject.setUpdateOn(LocalDateTime.now()); @@ -625,21 +613,20 @@ public class TodoCenterManage { //如果是 子流程 if (Objects.nonNull(p.getNodeType()) && NodeTypeEnum.SUB.name().equals(p.getNodeType().name())) { //如果不是上级条线单位 根本不用理 - if (!p.getIsHighLine()) { + if (Boolean.FALSE.equals(p.getIsHighLine())) { return; } List children = p.getChildren(); ProgressNode progressNode = children.get(0); String userId = progressNode.getUserId(); - if (StringUtils.isBlank(userId)) { + if (StrUtil.isBlank(userId)) { return; } - UserFullInfoDTO userFullInfoDTO = userInfoHelper.getUserFullInfoByEmployeeCode(userId); - if (Objects.nonNull(userFullInfoDTO) && user.getEmpPosUnitCode() - .equals(userFullInfoDTO.getEmpPosUnitCode())) { + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(Long.valueOf(userId)); + if (userFullInfo != null && user.getMhUnitId().equals(userFullInfo.getMhUnitId())) { //说明是此单位的人 //那么要去看 taskId 是不是 在这个单位内的任务 - Boolean isContainsTask = HandlerManage.checkIsContainsTask(children, taskId); + boolean isContainsTask = HandlerManage.checkIsContainsTask(children, taskId); if (isContainsTask) { res[0] = Boolean.TRUE; } @@ -661,10 +648,8 @@ public class TodoCenterManage { // 获取登录用户ID Long userId = LoginUserUtil.getUserId(); - // 获取登录用户全量信息 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); // 获取登录用户浙政钉code - String employeeCode = userFullInfo.getEmployeeCode(); + String userIdStr = String.valueOf(userId); // 查出项目库项目 ProjectListReq projectListReq = new ProjectListReq(); @@ -681,7 +666,7 @@ public class TodoCenterManage { .orderByDesc(ProjectInst::getProjectId)); Map projectInfoMap = projectInstList.stream() .filter(p -> StringUtils.isNotBlank(p.getInstCode()) && - !TodoCenterConstant.Declared.NULL_INST_CODE.equals(p.getInstCode())) + !TodoCenterConst.Declared.NULL_INST_CODE.equals(p.getInstCode())) .collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); @@ -690,8 +675,8 @@ public class TodoCenterManage { Integer pageNumber = param.getPageNumber(); Integer pageSize = param.getPageSize(); req.setProcessDefId(param.getProcessDefId()); - req.setUserId(String.valueOf(userId)); - req.setEmployeeCode(employeeCode); + req.setUserId(userIdStr); + req.setEmployeeCode(userIdStr); req.setInstCodes(instCodes); List iDoList = processTaskService.getUserIdoList(req); if (CollUtil.isEmpty(iDoList)) { @@ -732,10 +717,8 @@ public class TodoCenterManage { public void idoExport(HttpServletResponse response, ToBeProcessedExportReq param) { // 获取登录用户ID Long userId = LoginUserUtil.getUserId(); - // 获取登录用户全量信息 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); // 获取登录用户浙政钉code - String employeeCode = userFullInfo.getEmployeeCode(); + String userIdStr = String.valueOf(userId); //因为要解耦 不能把项目和工作流一起查 // 查出项目库项目 @@ -754,15 +737,15 @@ public class TodoCenterManage { .orderByDesc(ProjectInst::getProjectId)); projectInfoMap = projectInstList.stream() .filter(p -> StringUtils.isNotBlank(p.getInstCode()) && - !TodoCenterConstant.Declared.NULL_INST_CODE.equals(p.getInstCode())) + !TodoCenterConst.Declared.NULL_INST_CODE.equals(p.getInstCode())) .collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); // 查出用户工作流 TodoCenterListReqDTO req = new TodoCenterListReqDTO(); req.setProcessDefId(param.getProcessDefId()); - req.setUserId(String.valueOf(userId)); - req.setEmployeeCode(employeeCode); + req.setUserId(userIdStr); + req.setEmployeeCode(userIdStr); req.setInstCodes(instCodes); userIdoList = processTaskService.getUserIdoList(req); } @@ -804,14 +787,8 @@ public class TodoCenterManage { public PageVo mySubmittedList(ToBeProcessedReq param) { // 获取登录用户ID Long userId = LoginUserUtil.getUserId(); - // 获取登录用户全量信息 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); // 获取登录用户浙政钉code - String employeeCode = userFullInfo.getEmployeeCode(); - - if (StringUtils.isBlank(employeeCode)) { - return PageVo.empty(); - } + String userIdStr = String.valueOf(userId); // 查出项目库项目 ProjectListReq projectListReq = new ProjectListReq(); @@ -830,7 +807,7 @@ public class TodoCenterManage { .orderByDesc(ProjectInst::getProjectId)); Map projectInfoMap = projectInstList.stream() .filter(p -> StringUtils.isNotBlank(p.getInstCode()) && - !TodoCenterConstant.Declared.NULL_INST_CODE.equals(p.getInstCode())) + !TodoCenterConst.Declared.NULL_INST_CODE.equals(p.getInstCode())) .collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); @@ -839,8 +816,8 @@ public class TodoCenterManage { Integer pageNumber = param.getPageNumber(); Integer pageSize = param.getPageSize(); req.setProcessDefId(param.getProcessDefId()); - req.setUserId(String.valueOf(userId)); - req.setEmployeeCode(employeeCode); + req.setUserId(userIdStr); + req.setEmployeeCode(userIdStr); req.setInstCodes(instCodes); List submittedList = processInstanceService.getUserSubmittedList(req); @@ -881,10 +858,8 @@ public class TodoCenterManage { // 获取登录用户ID long userId = LoginUserUtil.getUserId(); - // 获取登录用户全量信息 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); // 获取登录用户浙政钉code - String employeeCode = userFullInfo.getEmployeeCode(); + String userIdStr = String.valueOf(userId); // 查出项目库项目 ProjectListReq projectListReq = new ProjectListReq(); @@ -894,28 +869,24 @@ public class TodoCenterManage { List userSubmittedList = Lists.newArrayList(); Map projectInfoMap = Maps.newHashMap(); - if (StringUtils.isBlank(employeeCode)) { - projects = Collections.emptyList(); - } - if (CollUtil.isNotEmpty(projects)) { - Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); + Map projectsMap = CollUtils.listToMap(projects, Project::getId); // 再查出项目关联的流程实例ID - List projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList()); + List projectIdList = CollUtils.fieldList(projects, Project::getId); List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) .in(ProjectInst::getProjectId, projectIdList) .orderByDesc(ProjectInst::getProjectId)); projectInfoMap = projectInstList.stream() .filter(p -> StringUtils.isNotBlank(p.getInstCode()) && - !TodoCenterConstant.Declared.NULL_INST_CODE.equals(p.getInstCode())) + !TodoCenterConst.Declared.NULL_INST_CODE.equals(p.getInstCode())) .collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); // 查出用户工作流 TodoCenterListReqDTO req = new TodoCenterListReqDTO(); req.setProcessDefId(param.getProcessDefId()); - req.setUserId(String.valueOf(userId)); - req.setEmployeeCode(employeeCode); + req.setUserId(userIdStr); + req.setEmployeeCode(userIdStr); req.setInstCodes(instCodes); userSubmittedList = processInstanceService.getUserSubmittedList(req); } @@ -959,15 +930,11 @@ public class TodoCenterManage { // 获取登录用户ID Long userId = LoginUserUtil.getUserId(); // 获取登录用户全量信息 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - // 获取登录用户浙政钉code - String employeeCode = userFullInfo.getEmployeeCode(); - + String userIdStr = String.valueOf(userId); // 查出项目库项目 ProjectListReq projectListReq = new ProjectListReq(); BeanUtils.copyProperties(param, projectListReq); List projects = projectLibManage.projectList(projectListReq); - if (CollUtil.isEmpty(projects)) { return PageVo.empty(); } @@ -980,7 +947,7 @@ public class TodoCenterManage { .orderByDesc(ProjectInst::getProjectId)); Map projectInfoMap = projectInstList.stream() .filter(p -> StringUtils.isNotBlank(p.getInstCode()) && - !TodoCenterConstant.Declared.NULL_INST_CODE.equals(p.getInstCode())) + !TodoCenterConst.Declared.NULL_INST_CODE.equals(p.getInstCode())) .collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); @@ -989,8 +956,8 @@ public class TodoCenterManage { Integer pageNumber = param.getPageNumber(); Integer pageSize = param.getPageSize(); req.setProcessDefId(param.getProcessDefId()); - req.setUserId(String.valueOf(userId)); - req.setEmployeeCode(employeeCode); + req.setUserId(userIdStr); + req.setEmployeeCode(userIdStr); req.setInstCodes(instCodes); List ccMeList = processInstanceService.getCcMeList(req); @@ -1032,11 +999,7 @@ public class TodoCenterManage { // 获取登录用户ID Long userId = LoginUserUtil.getUserId(); - // 获取登录用户全量信息 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - // 获取登录用户浙政钉code - String employeeCode = userFullInfo.getEmployeeCode(); - + String userIdStr = String.valueOf(userId); // 查出项目库项目 ProjectListReq projectListReq = new ProjectListReq(); BeanUtils.copyProperties(param, projectListReq); @@ -1053,15 +1016,15 @@ public class TodoCenterManage { .orderByDesc(ProjectInst::getProjectId)); projectInfoMap = projectInstList.stream() .filter(p -> StringUtils.isNotBlank(p.getInstCode()) && - !TodoCenterConstant.Declared.NULL_INST_CODE.equals(p.getInstCode())) + !TodoCenterConst.Declared.NULL_INST_CODE.equals(p.getInstCode())) .collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); // 分页查出用户工作流 TodoCenterListReqDTO req = new TodoCenterListReqDTO(); req.setProcessDefId(param.getProcessDefId()); - req.setUserId(String.valueOf(userId)); - req.setEmployeeCode(employeeCode); + req.setUserId(userIdStr); + req.setEmployeeCode(userIdStr); req.setInstCodes(instCodes); ccMeList = processInstanceService.getCcMeList(req); } @@ -1103,7 +1066,7 @@ public class TodoCenterManage { ProjectDTO projectDto = dto.getProjectInfo(); Project projectInfo = projectService.getById(projectDto.getId()); - VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("调整失败 此项目不存在!"); + Assert.notNull(projectInfo, "调整失败 此项目不存在!"); //项目名称去重 //项目名称去重 @@ -1142,8 +1105,7 @@ public class TodoCenterManage { private Boolean modifyProject(ProjectDTO projectDto, Project oldProject) { //先修改项目信息 Project project = new Project(); - VUtils.isTrue(Objects.isNull(oldProject)) - .throwMessage("项目不存在!"); + Assert.notNull(oldProject, "项目不存在!"); BeanUtil.copyProperties(oldProject, project, CopyOptions.create() .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); BeanUtil.copyProperties(projectDto, project, CopyOptions.create() @@ -1221,11 +1183,11 @@ public class TodoCenterManage { */ public NotSealedInfoVO getNotSealedPdf(SealInfoDTO req) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - String empPosUnitCode = user.getEmpPosUnitCode(); Long projectId = req.getProjectId(); String auditOpinion = req.getAuditOpinion(); String auditDate = NdDateUtils.format(LocalDateTime.now(), NdDateUtils.DEFAULT_DATE_TIME_FORMAT); NotSealedInfoVO notSealedInfoVo = new NotSealedInfoVO(); + String mhUnitId = user.getMhUnitId().toString(); // 判断项目盖章审批类型 Project project = projectService.getById(projectId); String buildOrgCode = project.getBuildOrgCode(); @@ -1236,154 +1198,31 @@ public class TodoCenterManage { // 如果为预审申报审批 if (InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType)) { // 再根据项目所属区域判断是市级预审还是区县预审 - String areaCode = project.getAreaCode(); - String areaName = project.getArea(); Long pretrialFileId = project.getPretrialFileId(); - Region region = regionService.getOne(Wrappers.lambdaQuery(Region.class) - .eq(Region::getRegionCode, areaCode) - .eq(Region::getRegionName, areaName)); - VUtils.isTrue(Objects.isNull(region)).throwMessage("项目所属区域不存在!"); - Integer regionLevel = region.getRegionLevel(); - if (CommonEnum.LS_SBJ.getDesc().equals(areaName)) { - regionLevel = RegionConst.RL_CITY; - } // 获取项目申报时是否选择了主管单位和上级条线主管单位 // 主管单位信息 Integer isSuperOrg = project.getIsSuperOrg(); String superOrgCode = project.getSuperOrgCode(); // 上级条线主管单位信息 - Integer isHigherSuperOrg = project.getIsHigherSuperOrg(); - String higherSuperOrgCode = project.getHigherSuperOrgCode(); - switch (regionLevel) { - // 市级预审(市本级) - case RegionConst.RL_CITY: - // 如果项目关联的预审文件ID不为空,说明已经提交过审核意见,直接返回文件ID - if (Boolean.TRUE.equals(getCityNotSealedInfoVO(pretrialFileId, notSealedInfoVo))) { - return notSealedInfoVo; - } - String cityTemplateName = TodoCenterConstant.SealTemplate.CITY_TEMPLATE; - // 设置pdf模板参数 - JSONObject cityParamsMap = assemblyPdfParams(project, cityTemplateName); - // 盖章审核为主管单位审核 - if (CommonEnum.YES.getCode().equals(isSuperOrg)) { - // 有主管单位信息且登录用户所在单位是主管单位 - checkEmpPosUnitCode(empPosUnitCode, auditOpinion, auditDate, superOrgCode, cityParamsMap); - } else if (CommonEnum.NO.getCode().equals(isSuperOrg)) { - // 没有选主管单位,默认为项目建设单位且登录用户所在单位为项目建设单位 - checkEmpPosUnitCode(empPosUnitCode, auditOpinion, auditDate, buildOrgCode, cityParamsMap); - } - Long cityPdfId = generateNotSealedPdf(projectId, cityTemplateName, cityParamsMap); - notSealedInfoVo.setFileId(cityPdfId); - checkAuditOpinion(auditOpinion, notSealedInfoVo); - return notSealedInfoVo; - // 区县预审 - case RegionConst.RL_COUNTY: - String countryTemplateName = TodoCenterConstant.SealTemplate.COUNTRY_TEMPLATE; - String sealNo = null; - Long notSealedId = null; - // 设置pdf模板参数 - JSONObject countryParamsMap = assemblyPdfParams(project, countryTemplateName); - // 以是否有上级主管单位的维度判断(有上级条线主管单位,才有可能需要盖两次章) - if (CommonEnum.YES.getCode().equals(isHigherSuperOrg)) { - // 盖章审核登录用户所在单位为上级条线主管单位,此时为区县预审盖章流程第一个章 - if (empPosUnitCode.equals(higherSuperOrgCode)) { - // 有上级条线主管单位信息且登录用户所在单位是上级条线主管单位, - // 如果项目关联的预审文件ID和上级条线审核意见不为空,说明已经提交过审核意见,直接返回文件ID - if (Boolean.TRUE.equals(getCountryHigherNotSealedInfoVO(pretrialFileId, notSealedInfoVo, - project.getCountryHigherSealAuditOpinion()))) { - return notSealedInfoVo; - } - countryParamsMap.put("higherOrgOpinion", auditOpinion); - countryParamsMap.put("higherOrgAuditDate", auditDate); - // 获取上级条线主管单位印章编号 - CompanySignature companySignature = - companySignatureService.getOne(Wrappers.lambdaQuery(CompanySignature.class) - .eq(CompanySignature::getOrganizationCode, higherSuperOrgCode)); - if (Objects.nonNull(companySignature)) { - sealNo = companySignature.getSealSn(); - } - // 保存区县预审上级条线主管单位盖章审核意见、审核日期和盖章编号 - project.setCountryHigherSealNo(sealNo); - project.setCountryHigherSealAuditOpinion(auditOpinion); - project.setCountryHigherSealAuditDate(auditDate); - projectService.updateById(project); - countryParamsMap.put("superOrgOpinion", null); - countryParamsMap.put("superOrgAuditDate", null); - // 直接返回装填了上级条线主管单位意见的未盖章文件 - notSealedId = generateNotSealedPdf(projectId, countryTemplateName, countryParamsMap); - } - // 盖章审核登录用户所在单位不为上级条线主管单位(可能为选择的主管单位、项目建设单位、其他单位), - // 此时为区县预审盖章流程第二个章 - else if (CommonEnum.YES.getCode().equals(isSuperOrg)) { - // 有上级条线主管单位信息且有本级主管单位信息 - // 有主管单位信息且登录用户所在单位是主管单位 - // 装配本级主管单位审核意见 - // 如果项目关联的预审文件ID和上级条线审核意见以及区县审核意见不为空,说明已经提交过审核意见,直接返回文件ID - if (Boolean.TRUE.equals(getCountryNotSealedInfoVO(pretrialFileId, notSealedInfoVo, - project.getCountryHigherSealAuditOpinion(), project.getCountrySealAuditOpinion()))) { - return notSealedInfoVo; - } - // 保存区县本级主管单位盖章审核意见、审核日期 - project.setCountrySealAuditOpinion(auditOpinion); - project.setCountrySealAuditDate(auditDate); - projectService.updateById(project); - checkEmpPosUnitCode(empPosUnitCode, auditOpinion, auditDate, superOrgCode, countryParamsMap); - // 装配上级条线主管单位意见,调用盖章接口, - // 重新生成上级条线主管单位盖章而本级主管单位未盖章的pdf文件 - SealInfoDTO sealInfoDTO = getHigherSealInfoDTO(project, countryParamsMap); - Long notSealedPdfId = generateNotSealedPdf(projectId, countryTemplateName, countryParamsMap); - notSealedId = generateSealedPdf(sealInfoDTO, project, countryTemplateName, notSealedPdfId); - } else if (CommonEnum.NO.getCode().equals(isSuperOrg)) { - // 有上级条线主管单位信息,没有本级主管单位信息 - // 没有选主管单位,默认为项目建设单位且登录用户所在单位为项目建设单位 - // 如果项目关联的预审文件ID和上级条线审核意见以及区县审核意见不为空,说明已经提交过审核意见,直接返回文件ID - if (Boolean.TRUE.equals(getCountryNotSealedInfoVO(pretrialFileId, notSealedInfoVo, - project.getCountryHigherSealAuditOpinion(), project.getCountrySealAuditOpinion()))) { - return notSealedInfoVo; - } - // 保存区县本级主管单位盖章审核意见、审核日期 - project.setCountrySealAuditOpinion(auditOpinion); - project.setCountrySealAuditDate(auditDate); - projectService.updateById(project); - checkEmpPosUnitCode(empPosUnitCode, auditOpinion, auditDate, buildOrgCode, countryParamsMap); - // 装配上级条线主管单位意见,调用盖章接口, - // 重新生成上级条线主管单位盖章而本级主管单位未盖章的pdf文件 - SealInfoDTO sealInfoDTO = getHigherSealInfoDTO(project, countryParamsMap); - Long notSealedPdfId = generateNotSealedPdf(projectId, countryTemplateName, countryParamsMap); - notSealedId = generateSealedPdf(sealInfoDTO, project, countryTemplateName, notSealedPdfId); - } - } - // 没有上级主管条线单位 - else if (CommonEnum.NO.getCode().equals(isHigherSuperOrg)) { - // 如果项目关联的预审文件ID不为空,说明已经提交过审核意见,直接返回文件ID - if (Boolean.TRUE.equals(getCityNotSealedInfoVO(pretrialFileId, notSealedInfoVo))) { - return notSealedInfoVo; - } - // 有本级主管单位信息 - if (CommonEnum.YES.getCode().equals(isSuperOrg)) { - // 登录用户所在单位是本级主管单位,装配本级主管单位审核意见 - checkEmpPosUnitCode(empPosUnitCode, auditOpinion, auditDate, superOrgCode, countryParamsMap); - // 直接返回装配了本级主管单位审核意见的未盖章文件 - countryParamsMap.put("higherOrgOpinion", null); - countryParamsMap.put("higherOrgAuditDate", null); - notSealedId = generateNotSealedPdf(projectId, countryTemplateName, countryParamsMap); - } - // 没有选主管单位,默认为项目建设单位 - else if (CommonEnum.NO.getCode().equals(isSuperOrg)) { - // 登录用户所在单位为项目建设单位 - checkEmpPosUnitCode(empPosUnitCode, auditOpinion, auditDate, buildOrgCode, countryParamsMap); - // 直接返回装配了项目建设单位审核意见的未盖章文件 - countryParamsMap.put("higherOrgOpinion", null); - countryParamsMap.put("higherOrgAuditDate", null); - notSealedId = generateNotSealedPdf(projectId, countryTemplateName, countryParamsMap); - } - } - notSealedInfoVo.setFileId(notSealedId); - checkAuditOpinion(auditOpinion, notSealedInfoVo); - return notSealedInfoVo; - default: - throw new IllegalStateException("Unexpected value: " + regionLevel); + // 如果项目关联的预审文件ID不为空,说明已经提交过审核意见,直接返回文件ID + if (Boolean.TRUE.equals(getCityNotSealedInfoVO(pretrialFileId, notSealedInfoVo))) { + return notSealedInfoVo; } + String cityTemplateName = TodoCenterConst.SealTemplate.CITY_TEMPLATE; + // 设置pdf模板参数 + JSONObject cityParamsMap = assemblyPdfParams(project, cityTemplateName); + // 盖章审核为主管单位审核 + if (CommonEnum.YES.getCode().equals(isSuperOrg)) { + // 有主管单位信息且登录用户所在单位是主管单位 + checkEmpPosUnitCode(mhUnitId, auditOpinion, auditDate, superOrgCode, cityParamsMap); + } else if (CommonEnum.NO.getCode().equals(isSuperOrg)) { + // 没有选主管单位,默认为项目建设单位且登录用户所在单位为项目建设单位 + checkEmpPosUnitCode(mhUnitId, auditOpinion, auditDate, buildOrgCode, cityParamsMap); + } + Long cityPdfId = generateNotSealedPdf(projectId, cityTemplateName, cityParamsMap); + notSealedInfoVo.setFileId(cityPdfId); + checkAuditOpinion(auditOpinion, notSealedInfoVo); + return notSealedInfoVo; } // 如果为建设方案申报审批 else if (InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(instType)) { @@ -1393,7 +1232,7 @@ public class TodoCenterManage { return notSealedInfoVo; } // 设置pdf模板参数 - String constructTemplateName = TodoCenterConstant.SealTemplate.CONSTRUCT_TEMPLATE; + String constructTemplateName = TodoCenterConst.SealTemplate.CONSTRUCT_TEMPLATE; JSONObject constructParamsMap = assemblyPdfParams(project, constructTemplateName); // 审核为指定大数据局盖章 // 获取流程配置的指定单位信息 @@ -1422,41 +1261,6 @@ public class TodoCenterManage { return false; } - private Boolean getCountryHigherNotSealedInfoVO(Long fileId, NotSealedInfoVO notSealedInfoVo, String auditOpinion) { - if (Objects.nonNull(fileId) && StringUtils.isNotBlank(auditOpinion)) { - notSealedInfoVo.setFileId(fileId); - notSealedInfoVo.setIsCommit(Boolean.TRUE); - return true; - } - return false; - } - - private Boolean getCountryNotSealedInfoVO(Long fileId, NotSealedInfoVO notSealedInfoVo, String higherAuditOpinion, - String auditOpinion) { - if (Objects.nonNull(fileId) && StringUtils.isNotBlank(higherAuditOpinion) - && StringUtils.isNotBlank(auditOpinion)) { - notSealedInfoVo.setFileId(fileId); - notSealedInfoVo.setIsCommit(Boolean.TRUE); - return true; - } - return false; - } - - private SealInfoDTO getHigherSealInfoDTO(Project project, JSONObject countryParamsMap) { - String countrySealAuditOpinion = project.getCountryHigherSealAuditOpinion(); - String countrySealAuditDate = project.getCountryHigherSealAuditDate(); - countryParamsMap.put("higherOrgOpinion", countrySealAuditOpinion); - countryParamsMap.put("higherOrgAuditDate", countrySealAuditDate); - SealInfoDTO sealInfoDTO = new SealInfoDTO(); - sealInfoDTO.setPosPage(TodoCenterConstant.SealTemplate.COUNTRY_SEAL_POS_PAGE); - sealInfoDTO.setProjectId(project.getId()); - sealInfoDTO.setPosX(TodoCenterConstant.SealTemplate.COUNTRY_SEAL_POS_X); - sealInfoDTO.setPosY(TodoCenterConstant.SealTemplate.COUNTRY_SEAL_POS_Y); - sealInfoDTO.setSignType(TodoCenterConstant.SealTemplate.COUNTRY_SEAL_SIGN_TYPE); - sealInfoDTO.setSealSn(project.getCountryHigherSealNo()); - return sealInfoDTO; - } - private void checkEmpPosUnitCode(String empPosUnitCode, String auditOpinion, String auditDate, String orgCode, JSONObject cityParamsMap) { if (empPosUnitCode.equals(orgCode)) { cityParamsMap.put("superOrgOpinion", auditOpinion); @@ -1493,12 +1297,12 @@ public class TodoCenterManage { String superOrgOpinion = paramsMap.getString("superOrgOpinion"); String higherOrgOpinion = paramsMap.getString("higherOrgOpinion"); if (StringUtils.isNotBlank(superOrgOpinion) || StringUtils.isNotBlank(higherOrgOpinion)) { - if (TodoCenterConstant.SealTemplate.CITY_TEMPLATE.equals(templateName) || - TodoCenterConstant.SealTemplate.COUNTRY_TEMPLATE.equals(templateName)) { + if (TodoCenterConst.SealTemplate.CITY_TEMPLATE.equals(templateName) || + TodoCenterConst.SealTemplate.COUNTRY_TEMPLATE.equals(templateName)) { //放到项目申报书字段 declaredProject.setProjectApplicationForm(BizUtils.buildFileJson(resultVo)); declaredProject.setUpdateOn(LocalDateTime.now()); - } else if (TodoCenterConstant.SealTemplate.CONSTRUCT_TEMPLATE.equals(templateName)) { + } else if (TodoCenterConst.SealTemplate.CONSTRUCT_TEMPLATE.equals(templateName)) { declaredProject.setConstructFileId(resultVo.getId()); declaredProject.setConstructFileName(resultVo.getOriginalFileName()); declaredProject.setUpdateOn(LocalDateTime.now()); @@ -1676,11 +1480,11 @@ public class TodoCenterManage { switch (regionLevel) { // 市级预审(市本级) case RegionConst.RL_CITY: - String cityTemplateName = TodoCenterConstant.SealTemplate.CITY_TEMPLATE; + String cityTemplateName = TodoCenterConst.SealTemplate.CITY_TEMPLATE; return generateSealedPdf(req, declaredProject, cityTemplateName, notSealedFileId); // 区县预审 case RegionConst.RL_COUNTY: - String countryTemplateName = TodoCenterConstant.SealTemplate.COUNTRY_TEMPLATE; + String countryTemplateName = TodoCenterConst.SealTemplate.COUNTRY_TEMPLATE; return generateSealedPdf(req, declaredProject, countryTemplateName, notSealedFileId); default: throw new IllegalStateException("Unexpected value: " + regionLevel); @@ -1689,30 +1493,26 @@ public class TodoCenterManage { // 如果为建设方案申报审批 else if (InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(instType)) { // 设置pdf模板参数 - String constructTemplateName = TodoCenterConstant.SealTemplate.CONSTRUCT_TEMPLATE; + String constructTemplateName = TodoCenterConst.SealTemplate.CONSTRUCT_TEMPLATE; return generateSealedPdf(req, declaredProject, constructTemplateName, notSealedFileId); } return null; } //获取当前登录人的 待办中心统计数据 - public TodoCenterStatisticsVO todoCenterStatistics(String employeeCode) { + public TodoCenterStatisticsVO todoCenterStatistics(Long userId) { //为了查询效率 还是自己去写统计接口 - TodoCenterStatisticsPO statistics = statisticsService.getStatistics(employeeCode); + TodoCenterStatisticsPO statistics = statisticsService.getStatistics(userId); return BeanUtil.copyProperties(statistics, TodoCenterStatisticsVO.class); } public TodoNumVO getTodoNums(ToBeProcessedReq param) { // 获取登录用户ID Long userId = LoginUserUtil.getUserId(); + String userIdStr = String.valueOf(userId); // 获取登录用户全量信息 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); // 获取员工浙政钉code TodoNumVO todoNumVo = new TodoNumVO(); - String employeeCode = userFullInfo.getEmployeeCode(); - if (StringUtils.isBlank(employeeCode)) { - return todoNumVo; - } // 查出项目库项目 ProjectListReq projectListReq = new ProjectListReq(); @@ -1732,8 +1532,8 @@ public class TodoCenterManage { TodoCenterListReqDTO req = new TodoCenterListReqDTO(); req.setInstCodes(instCodes); req.setProcessDefId(param.getProcessDefId()); - req.setUserId(String.valueOf(userId)); - req.setEmployeeCode(employeeCode); + req.setUserId(userIdStr); + req.setEmployeeCode(userIdStr); //有待办节点的(不包含退回) List todoList = processTaskService.getUserTodoList(req); //有退回待办的 @@ -1751,7 +1551,7 @@ public class TodoCenterManage { Map projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v)); Map projectInfoMap = projectInstList.stream() .filter(p -> StringUtils.isNotBlank(p.getInstCode()) && - !TodoCenterConstant.Declared.NULL_INST_CODE.equals(p.getInstCode())) + !TodoCenterConst.Declared.NULL_INST_CODE.equals(p.getInstCode())) .collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); // 关联项目信息 List projectList = list.stream() @@ -1835,14 +1635,11 @@ public class TodoCenterManage { public Object saveAuditOpinion(ReqAuditOpinionSaveDTO param) { // 获取登录用户ID UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - // 获取登录用户浙政钉code - String employeeCode = user.getEmployeeCode(); - //前置判断前端传的taskId是否存在不存在的情况 有可能是 或签被别人审批掉了 Task task = taskService.createTaskQuery().taskId(param.getTaskId()).active().singleResult(); if (ObjectUtil.isNull(task)) { - return TodoCenterConstant.Handler.TASKID_ERROR; + return TodoCenterConst.Handler.TASKID_ERROR; } - return processTaskService.saveAuditOpinion(param, employeeCode); + return processTaskService.saveAuditOpinion(param, user.getUserIdStr()); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/AdjustHandleDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/AdjustHandleDTO.java index 353fc50..b1704ce 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/AdjustHandleDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/dto/AdjustHandleDTO.java @@ -1,19 +1,16 @@ package com.hz.pm.api.todocenter.model.dto; -import java.io.Serializable; -import java.util.Map; - -import javax.validation.constraints.NotNull; - +import cn.hutool.core.collection.CollUtil; import com.google.common.collect.Maps; import com.hz.pm.api.projectlib.model.dto.ProjectDTO; - -import cn.hutool.core.collection.CollUtil; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import javax.validation.constraints.NotNull; +import java.util.Map; + /** * @Classname DefaultDeclaredDTO * @Description @@ -23,24 +20,23 @@ import lombok.NoArgsConstructor; @Data @NoArgsConstructor @AllArgsConstructor -public class AdjustHandleDTO implements Serializable { - - private static final long serialVersionUID = 1L; +public class AdjustHandleDTO { @NotNull @ApiModelProperty("项目信息") private ProjectDTO projectInfo; @ApiModelProperty("表单信息 新增模块") - private Map formData; + private Map formData; - public Map getFormData(){ - if(CollUtil.isEmpty(this.formData)){ + public Map getFormData() { + if (CollUtil.isEmpty(this.formData)) { this.formData = Maps.newHashMap(); return this.formData; } return this.formData; } + @ApiModelProperty("项目ID") @NotNull(message = "要处理的项目ID不能为空!") private Long projectId; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/req/ToBeProcessedReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/req/ToBeProcessedReq.java index fb379d5..bbbf202 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/req/ToBeProcessedReq.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/model/req/ToBeProcessedReq.java @@ -8,6 +8,7 @@ import com.ningdatech.basic.model.PagePo; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import org.springframework.format.annotation.DateTimeFormat; @@ -20,12 +21,15 @@ import org.springframework.format.annotation.DateTimeFormat; @Data @NoArgsConstructor @AllArgsConstructor +@EqualsAndHashCode(callSuper = true) public class ToBeProcessedReq extends PagePo implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty("项目名称") private String projectName; + private Long userId; + @ApiModelProperty("申报单位名称") private String buildOrgName; @@ -46,9 +50,6 @@ public class ToBeProcessedReq extends PagePo implements Serializable { @ApiModelProperty("流程配置ID") private String processDefId; - @ApiModelProperty("登录人员工号") - private String employeeCode; - private Long loginUserId; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/StatisticsService.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/StatisticsService.java index 99726e6..f11680f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/StatisticsService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/StatisticsService.java @@ -11,5 +11,5 @@ import com.hz.pm.api.todocenter.model.po.TodoCenterStatisticsPO; public interface StatisticsService { //根据用户id 去查询 一些统计数据 - TodoCenterStatisticsPO getStatistics(String employeeCode); + TodoCenterStatisticsPO getStatistics(Long userId); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/StatisticsServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/StatisticsServiceImpl.java index b4e6189..1dd5bf2 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/StatisticsServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/StatisticsServiceImpl.java @@ -28,23 +28,23 @@ public class StatisticsServiceImpl implements StatisticsService { private final TaskService taskService; @Override - public TodoCenterStatisticsPO getStatistics(String employeeCode) { + public TodoCenterStatisticsPO getStatistics(Long userId) { TodoCenterStatisticsPO res = new TodoCenterStatisticsPO(); - + String userIdStr = String.valueOf(userId); TodoCenterListReqDTO req = new TodoCenterListReqDTO(); - req.setEmployeeCode(employeeCode); + req.setEmployeeCode(userIdStr); Integer todoCount = processTaskService.getTodoCount(req); res.setTodoNum(todoCount); Integer idoCount = processTaskService.getUserIdoCount(req); res.setIdoNum(idoCount); - TodoCenterStatisticsPO submit = mapper.mysubmitNum(employeeCode); + TodoCenterStatisticsPO submit = mapper.mysubmitNum(userIdStr); if(Objects.nonNull(submit)){ res.setMysubmitNum(submit.getMysubmitNum()); } - TodoCenterStatisticsPO ccMe = mapper.ccNums(employeeCode); + TodoCenterStatisticsPO ccMe = mapper.ccNums(userIdStr); if(Objects.nonNull(ccMe)){ res.setCcmeNum(ccMe.getCcmeNum()); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/TodoServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/TodoServiceImpl.java index 768111f..665df6a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/TodoServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/TodoServiceImpl.java @@ -117,15 +117,14 @@ public class TodoServiceImpl implements ITodoService { if(StringUtils.isBlank(userId)){ return; } - UserFullInfoDTO userFullInfoDTO = userInfoHelper.getUserFullInfoByEmployeeCode(userId); - if(Objects.nonNull(userFullInfoDTO) && user.getEmpPosUnitCode() - .equals(userFullInfoDTO.getEmpPosUnitCode())){ + UserFullInfoDTO userFullInfoDTO = userInfoHelper.getUserFullInfo(Long.valueOf(userId)); + if(Objects.nonNull(userFullInfoDTO) && user.getMhUnitId() + .equals(userFullInfoDTO.getMhUnitId())){ //说明是此单位的人 //那么要去看 taskId 是不是 在这个单位内的任务 boolean isContainsTask = HandlerManage.checkIsContainsTask(children,taskId); if(isContainsTask){ res[0] = Boolean.TRUE; - return; } } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/BuildUserUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/BuildUserUtils.java index d696ed4..ac2784b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/BuildUserUtils.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/BuildUserUtils.java @@ -3,6 +3,7 @@ package com.hz.pm.api.todocenter.utils; import cn.hutool.core.collection.CollUtil; import com.google.common.collect.Sets; import com.hz.pm.api.user.manage.UserInfoManage; +import com.ningdatech.basic.util.CollUtils; import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; import com.wflow.workflow.bean.process.ProgressNode; import lombok.RequiredArgsConstructor; @@ -37,9 +38,11 @@ public class BuildUserUtils { userSet.add(node.getUserId()); } }); - Map userMap = userInfoManage.getUserMapByEmployeeCode(userSet); - buildUser(progressInfo,userMap); + List tmpUserIds = CollUtils.convert(userSet, Long::parseLong); + Map userMap = userInfoManage.getUserMapByUserIds(tmpUserIds); + buildUser(progressInfo, userMap); } + private void buildUser(List progressInfo, Map userMap) { for (ProgressNode progressNode : progressInfo) { progressNode.setUser(userMap.get(progressNode.getUserId())); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java index b57aeef..b88db3d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java @@ -10,7 +10,7 @@ import com.hz.pm.api.user.util.LoginUserUtil; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.util.StrPool; import com.hz.pm.api.common.model.constant.BizConst; -import com.hz.pm.api.user.security.auth.constants.SessionTimeConstant; +import com.hz.pm.api.user.security.auth.constants.SessionTimeConst; import com.ningdatech.log.annotation.WebLog; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -86,7 +86,7 @@ public class UserAuthController { response.setContentType(StrPool.CONTENT_TYPE); Cookie cookie = new Cookie(BizConst.COOKIE_KEY, null); cookie.setPath(request.getContextPath() + "/"); - cookie.setMaxAge(SessionTimeConstant.SESSION_EXPIRED); + cookie.setMaxAge(SessionTimeConst.SESSION_EXPIRED); response.addCookie(cookie); response.setStatus(HttpStatus.UNAUTHORIZED.value()); response.getWriter().write(objectMapper.writeValueAsString(BizConst.UNAUTHENTICATED)); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserInfoController.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserInfoController.java index 17dfa6f..31b309d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserInfoController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserInfoController.java @@ -1,16 +1,16 @@ package com.hz.pm.api.user.controller; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; import com.hz.pm.api.user.manage.UserInfoManage; import com.hz.pm.api.user.model.po.ReqUserDetailEditPO; -import com.hz.pm.api.user.model.po.ReqUserDetailPO; import com.hz.pm.api.user.model.po.ReqUserDisableOrEnablePO; -import com.hz.pm.api.user.model.po.ReqUserInfoListPO; +import com.hz.pm.api.user.model.po.UserDetailReq; +import com.hz.pm.api.user.model.po.UserInfoListReq; import com.hz.pm.api.user.model.vo.ResUserDetailVO; -import com.hz.pm.api.user.model.vo.ResUserInfoListVO; +import com.hz.pm.api.user.model.vo.UserInfoListVO; import com.hz.pm.api.user.model.vo.UserRoleVO; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -36,7 +36,7 @@ public class UserInfoController { @ApiOperation(value = "用户列表搜索", notes = "用户列表搜索") @PostMapping("/list") - public PageVo userInfoList(@Valid @RequestBody ReqUserInfoListPO req) { + public PageVo userInfoList(@Valid @RequestBody UserInfoListReq req) { return userInfoManage.list(req); } @@ -48,7 +48,7 @@ public class UserInfoController { @ApiOperation(value = "用户详情", notes = "用户详情") @PostMapping("/detail") - public ResUserDetailVO userInfoDetail(@Valid @RequestBody ReqUserDetailPO req) { + public ResUserDetailVO userInfoDetail(@Valid @RequestBody UserDetailReq req) { return userInfoManage.userInfoDetail(req); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/convert/UserInfoConvertor.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/convert/UserInfoConvertor.java index d2ece63..c0b27bf 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/convert/UserInfoConvertor.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/convert/UserInfoConvertor.java @@ -23,19 +23,13 @@ public class UserInfoConvertor { userInfoDetails.setUsername(userFullInfo.getUsername()); userInfoDetails.setRealName(userFullInfo.getRealName()); userInfoDetails.setUserRoleList(userFullInfo.getUserRoleList()); - userInfoDetails.setRegionCode(userFullInfo.getRegionCode()); - userInfoDetails.setRegionLevel(userFullInfo.getRegionLevel()); userInfoDetails.setIdentifier(userFullInfo.getIdentifier()); userInfoDetails.setPassword(userFullInfo.getCredential()); - userInfoDetails.setEmployeeCode(userFullInfo.getEmployeeCode()); - userInfoDetails.setOrganizationCode(userFullInfo.getOrganizationCode()); - userInfoDetails.setOrganizationName(userFullInfo.getOrganizationName()); - userInfoDetails.setEmpPosUnitCode(userFullInfo.getEmpPosUnitCode()); - userInfoDetails.setEmpPosUnitName(userFullInfo.getEmpPosUnitName()); + userInfoDetails.setMhUnitId(userFullInfo.getMhUnitId()); + userInfoDetails.setMhUnitName(userFullInfo.getMhUnitName()); userInfoDetails.setMobile(userFullInfo.getMobile()); + userInfoDetails.setMhUserId(userFullInfo.getMhUserId()); return userInfoDetails; } - - } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java index 0678e6a..e1bb6b9 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java @@ -3,6 +3,8 @@ package com.hz.pm.api.user.manage; import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hz.pm.api.user.helper.MhUnitCache; +import com.hz.pm.api.user.model.dto.MhUnitDTO; import com.hz.pm.api.user.model.dto.MhUnitTreeDTO; import com.hz.pm.api.user.model.entity.MhUnit; import com.hz.pm.api.user.service.IMhUnitService; @@ -25,12 +27,11 @@ import java.util.List; public class MhUnitManage { private final IMhUnitService mhUnitService; + private final MhUnitCache mhUnitCache; public List getMhUnitTree() { - LambdaQueryWrapper query = Wrappers.lambdaQuery(MhUnit.class) - .select(MhUnit::getId, MhUnit::getName, MhUnit::getParentId, MhUnit::getSort); - List units = mhUnitService.list(query); - List nodes = BeanUtil.copyToList(units, MhUnitTreeDTO.class); + List allUnits = mhUnitCache.all(); + List nodes = BeanUtil.copyToList(allUnits, MhUnitTreeDTO.class); return TreeUtil.convertToTree(nodes, 0L); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java index adb95ff..27a2d5f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java @@ -92,10 +92,9 @@ public class SyncMhUserOrgManage { userInfo.setRealName(mhUser.getUserName()); userInfo.setUsername(mhUser.getAccount()); userInfo.setId(userIdMap.get(mhUser.getUserId())); - userInfo.setRegionCode("330100"); MhUnit unit = unitMap.get(mhUser.getMhUnitId()); if (unit != null) { - userInfo.setEmpPosUnitName(unit.getName()); + userInfo.setMhUnitName(unit.getName()); } if (PhoneUtil.isMobile(mhUser.getAccount())) { userInfo.setMobile(mhUser.getAccount()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java index d6d6e10..baec1c8 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java @@ -7,12 +7,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.common.helper.UserInfoHelper; -import com.hz.pm.api.common.model.constant.RegionConst; import com.hz.pm.api.common.util.BizUtils; import com.hz.pm.api.common.util.StrUtils; -import com.hz.pm.api.ding.constants.DingOrganizationContant; import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; -import com.hz.pm.api.organization.model.entity.DingOrganization; import com.hz.pm.api.organization.service.IDingEmployeeInfoService; import com.hz.pm.api.organization.service.IDingOrganizationService; import com.hz.pm.api.sys.model.entity.Role; @@ -22,17 +19,16 @@ import com.hz.pm.api.sys.service.IUserRoleService; import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; import com.hz.pm.api.user.model.po.ReqUserDetailEditPO; -import com.hz.pm.api.user.model.po.ReqUserDetailPO; +import com.hz.pm.api.user.model.po.UserDetailReq; import com.hz.pm.api.user.model.po.ReqUserDisableOrEnablePO; -import com.hz.pm.api.user.model.po.ReqUserInfoListPO; +import com.hz.pm.api.user.model.po.UserInfoListReq; import com.hz.pm.api.user.model.vo.ResUserDetailVO; -import com.hz.pm.api.user.model.vo.ResUserInfoListVO; +import com.hz.pm.api.user.model.vo.UserInfoListVO; import com.hz.pm.api.user.model.vo.UserRoleVO; import com.hz.pm.api.user.security.model.UserFullInfoDTO; import com.hz.pm.api.user.service.IUserInfoService; import com.hz.pm.api.user.util.LoginUserUtil; import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.model.GenericResult; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; import com.ningdatech.zwdd.ZwddIntegrationProperties; @@ -49,31 +45,27 @@ import java.util.stream.Collectors; /** * @author liuxinxin - * @date 2023/2/13 上午9:09 + * @since 2023/2/13 上午9:09 */ @Component @RequiredArgsConstructor public class UserInfoManage { private final UserAuthManage userAuthManage; - private final IUserInfoService iUserInfoService; - private final IRoleService iRoleService; - private final IDingOrganizationService iDingOrganizationService; - private final IDingEmployeeInfoService iDingEmployeeInfoService; - private final IUserRoleService iUserRoleService; + private final IUserInfoService userInfoService; + private final IRoleService roleService; + private final IDingOrganizationService dingOrganizationService; + private final IDingEmployeeInfoService dingEmployeeInfoService; + private final IUserRoleService userRoleService; private final UserInfoHelper userInfoHelper; private final RegionCacheHelper regionCacheHelper; - private final ZwddIntegrationProperties zwddIntegrationProperties; - private final ZwddClient zwddClient; - public PageVo list(ReqUserInfoListPO req) { + public PageVo list(UserInfoListReq req) { String phoneNo = req.getPhoneNo(); - String orgCode = req.getOrgCode(); String name = req.getName(); - String orgName = req.getOrgName(); - Long regionId = req.getRegionId(); + String mhUnitName = req.getMhUnitName(); List userIdList = getRoleCompliantUserIdList(req.getUserRoleList()); if (userIdList != null && userIdList.isEmpty()) { @@ -81,155 +73,82 @@ public class UserInfoManage { } LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(UserInfo.class) - .like(StringUtils.isNotBlank(phoneNo), UserInfo::getMobile, phoneNo) - .like(StringUtils.isNotBlank(name), UserInfo::getRealName, name) + .like(StrUtils.isNotBlank(phoneNo), UserInfo::getMobile, phoneNo) + .like(StrUtils.isNotBlank(name), UserInfo::getRealName, name) .in(Objects.nonNull(userIdList), UserInfo::getId, userIdList) - .eq(Objects.nonNull(regionId), UserInfo::getRegionCode, regionId) - .like(StringUtils.isNotBlank(orgName), UserInfo::getEmpPosUnitName, orgName) - .eq(StringUtils.isNotBlank(orgCode), UserInfo::getEmpPosUnitCode, orgCode) + .like(StrUtils.isNotBlank(mhUnitName), UserInfo::getMhUnitName, mhUnitName) .orderByDesc(UserInfo::getUpdateOn); - Page page = iUserInfoService.page(req.page(), wrapper); - List records = page.getRecords(); - long total = page.getTotal(); - List result = new ArrayList<>(); - if (records != null && !records.isEmpty()) { - List employeeCodeList = records.stream().map(UserInfo::getEmployeeCode) - .distinct().collect(Collectors.toList()); - - List employeeInfoList = iDingEmployeeInfoService.getEmployeeList(employeeCodeList); - Map empCodeOrgMap = iDingOrganizationService.getEmpCodeOrgMap(employeeInfoList); - - records.forEach(r -> { - ResUserInfoListVO item = new ResUserInfoListVO(); - item.setName(r.getRealName()); - String employeeCode = r.getEmployeeCode(); - if (StringUtils.isNotBlank(employeeCode)) { - DingOrganization dingOrganization = empCodeOrgMap.get(employeeCode); - if (Objects.nonNull(dingOrganization)) { - item.setOrgName(dingOrganization.getOrganizationName()); - item.setOrgCode(dingOrganization.getOrganizationCode()); - String regionCode = dingOrganization.getDivisionCode(); - item.setRegionCode(regionCode); - if (Objects.nonNull(regionCode)) { - item.setRegionName(regionCacheHelper.getDisplayName(regionCode, RegionConst.RL_COUNTY)); - } - } - - } - userStatusAssembler(item, r); - item.setUpdateTime(r.getUpdateOn()); - item.setEmployeeCode(r.getEmployeeCode()); - item.setUserRoleList(getUserRoleVOList(item.getUserId())); - result.add(item); - }); - } - return PageVo.of(result, total); - } - - private List getCompliantOrgEmpCodeList(String orgName, String orgCode) { - if (StringUtils.isBlank(orgName) && StringUtils.isBlank(orgCode)) { - return Collections.emptyList(); - } - List compliantOrgCodeList = new ArrayList<>(); - - // 查重符合筛选条件的组织列表 - if (StringUtils.isNotBlank(orgName)) { - List dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .like(DingOrganization::getOrganizationName, orgName) - .eq(DingOrganization::getTypeCode, DingOrganizationContant.UNIT_TYPE) - ); - - List compliantOrgNameCodeList = dingOrganizationList.stream() - .map(DingOrganization::getOrganizationCode) - .collect(Collectors.toList()); - if (CollUtil.isEmpty(compliantOrgNameCodeList)) { - return new ArrayList<>(); - } - - // 取交集 - List tempCompliantOrgCodeList = new ArrayList<>(); - for (String compliantOrgNameCode : compliantOrgNameCodeList) { - if (compliantOrgCodeList.contains(compliantOrgNameCode)) { - tempCompliantOrgCodeList.add(compliantOrgNameCode); - } - } - compliantOrgCodeList = tempCompliantOrgCodeList; - if (CollUtil.isEmpty(compliantOrgCodeList)) { - return new ArrayList<>(); - } - } - - if (StringUtils.isNotBlank(orgCode)) { - compliantOrgCodeList.add(orgCode); - } - if (CollUtil.isEmpty(compliantOrgCodeList)) { - return new ArrayList<>(); + Page page = userInfoService.page(req.page(), wrapper); + if (page.getTotal() == 0) { + return PageVo.empty(); } - - // 查重符合筛选条件的用户code列表 - List dingEmployeeInfoList = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) - .in(DingEmployeeInfo::getEmpPosUnitCode, compliantOrgCodeList)); - - return dingEmployeeInfoList.stream() - .map(DingEmployeeInfo::getEmployeeCode).distinct().collect(Collectors.toList()); + List result = new ArrayList<>(); + page.getRecords().forEach(r -> { + UserInfoListVO item = new UserInfoListVO(); + item.setName(r.getRealName()); + userStatusBuilder(item, r); + item.setUpdateTime(r.getUpdateOn()); + item.setEmployeeCode(r.getEmployeeCode()); + item.setUserRoleList(getUserRole(item.getUserId())); + item.setUserId(r.getId()); + item.setPhoneNo(r.getMobile()); + item.setMhUnitId(r.getMhUnitId()); + item.setMhUnitName(r.getMhUnitName()); + result.add(item); + }); + return PageVo.of(result, page.getTotal()); } /** * 获取符合查询条件的 用户 userId * - * @param userRoleList + * @param user */ - private List getRoleCompliantUserIdList(List userRoleList) { - if (CollUtil.isNotEmpty(userRoleList)) { - userRoleList.removeIf(r -> Objects.isNull(r.getId())); + @SuppressWarnings("all") + private List getRoleCompliantUserIdList(List userRoles) { + if (CollUtil.isNotEmpty(userRoles)) { + userRoles.removeIf(r -> Objects.isNull(r.getId())); } - if (CollUtil.isEmpty(userRoleList)) { + if (CollUtil.isEmpty(userRoles)) { return null; } - List roleIdList = CollUtils.fieldList(userRoleList, UserRoleVO::getId); - List compliantUserIdList = iUserRoleService.listUserIdByRoleIds(roleIdList); - if (CollUtil.isEmpty(compliantUserIdList)) { - return new ArrayList<>(); - } - return iUserInfoService.list(Wrappers.lambdaQuery(UserInfo.class) - .in(UserInfo::getId, compliantUserIdList)) - .stream().map(UserInfo::getId).collect(Collectors.toList()); - + List roleIds = CollUtils.fieldList(userRoles, UserRoleVO::getId); + return userRoleService.listUserIdByRoleIds(roleIds); } /** * 装配用户状态 及 userId * - * @param resListVO - * @param userInfo + * @param resUser \ + * @param userInfo \ */ - private void userStatusAssembler(ResUserInfoListVO resListVO, UserInfo userInfo) { + private static void userStatusBuilder(UserInfoListVO resUser, UserInfo userInfo) { if (Objects.nonNull(userInfo)) { - resListVO.setPhoneNo(userInfo.getMobile()); + resUser.setPhoneNo(userInfo.getMobile()); if (StringUtils.isNotBlank(userInfo.getAvailable()) && UserAvailableEnum.ENABLE.name().equals(userInfo.getAvailable())) { - resListVO.setStatus(UserAvailableEnum.ENABLE.name()); + resUser.setStatus(UserAvailableEnum.ENABLE.name()); } else { - resListVO.setStatus(UserAvailableEnum.DISABLE.name()); + resUser.setStatus(UserAvailableEnum.DISABLE.name()); } - resListVO.setUserId(userInfo.getId()); + resUser.setUserId(userInfo.getId()); } else { - resListVO.setStatus(UserAvailableEnum.DISABLE.name()); + resUser.setStatus(UserAvailableEnum.DISABLE.name()); } } - private List getUserRoleVOList(Long userId) { + private List getUserRole(Long userId) { List userRoleInfoList = new ArrayList<>(); if (Objects.isNull(userId)) { return userRoleInfoList; } - List userRoleList = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) + List userRoleList = userRoleService.list(Wrappers.lambdaQuery(UserRole.class) .eq(UserRole::getUserId, userId).orderByAsc(UserRole::getCreateOn)); if (CollUtil.isNotEmpty(userRoleList)) { List roleIdList = userRoleList.stream().map(UserRole::getRoleId).collect(Collectors.toList()); - List roleList = iRoleService.listByIds(roleIdList); + List roleList = roleService.listByIds(roleIdList); roleList.forEach(r -> { UserRoleVO userRoleVO = new UserRoleVO(); userRoleVO.setId(r.getId()); @@ -252,51 +171,45 @@ public class UserInfoManage { } else { throw BizException.wrap("用户参数缺失"); } - UserInfo userInfo = iUserInfoService.getById(userId); + UserInfo userInfo = userInfoService.getById(userId); userInfo.setAvailable(req.getOperation()); - iUserInfoService.updateById(userInfo); + userInfoService.updateById(userInfo); if ("DISABLE".equals(userInfo.getAvailable())) { userAuthManage.kickOff(userId); } } - public ResUserDetailVO userInfoDetail(ReqUserDetailPO reqUserDetailPO) { - Long userId = reqUserDetailPO.getUserId(); - String employeeCode = reqUserDetailPO.getEmployeeCode(); - if (StringUtils.isBlank(employeeCode) && Objects.isNull(userId)) { - throw new BizException("employeeCode and userId can't not be null"); - } - if (Objects.isNull(userId)) { - userId = generateUserId(reqUserDetailPO.getEmployeeCode()); + public ResUserDetailVO userInfoDetail(UserDetailReq req) { + Long userId = req.getUserId(); + String employeeCode = req.getEmployeeCode(); + if (StrUtils.isBlank(employeeCode) && Objects.isNull(userId)) { + throw new IllegalArgumentException("参数缺失"); } - - UserInfo userInfo = iUserInfoService.getById(userId); + UserInfo userInfo = userInfoService.getById(userId); if (Objects.isNull(userInfo)) { return null; } - ResUserDetailVO resUserDetailVO = new ResUserDetailVO(); - resUserDetailVO.setRealName(userInfo.getRealName()); - resUserDetailVO.setUserId(userInfo.getId()); - resUserDetailVO.setPhoneNo(userInfo.getMobile()); - resUserDetailVO.setStatus(userInfo.getAvailable()); + ResUserDetailVO resUserDetail = new ResUserDetailVO(); + resUserDetail.setRealName(userInfo.getRealName()); + resUserDetail.setUserId(userInfo.getId()); + resUserDetail.setPhoneNo(userInfo.getMobile()); + resUserDetail.setStatus(userInfo.getAvailable()); // 装配用户角色信息列表 - List userRoleList = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) - .eq(UserRole::getUserId, userId)); - List userRoleInfoList = new ArrayList<>(); + List userRoleList = userRoleService.listByUserId(userId); if (CollUtil.isNotEmpty(userRoleList)) { - List roleIdList = userRoleList.stream().map(UserRole::getRoleId).collect(Collectors.toList()); - List roleList = iRoleService.list(Wrappers.lambdaQuery(Role.class).in(Role::getId, roleIdList)); - userRoleInfoList = roleList.stream().map(r -> { + List roleIdList = CollUtils.fieldList(userRoleList, UserRole::getRoleId); + List roleList = roleService.listByIds(roleIdList); + List userRoles = roleList.stream().map(r -> { UserRoleVO userRoleVO = new UserRoleVO(); userRoleVO.setId(r.getId()); userRoleVO.setName(r.getName()); return userRoleVO; }).collect(Collectors.toList()); + resUserDetail.setUserRoleInfoList(userRoles); } - resUserDetailVO.setUserRoleInfoList(userRoleInfoList); - return resUserDetailVO; + return resUserDetail; } @Transactional(rollbackFor = Exception.class) @@ -309,7 +222,7 @@ public class UserInfoManage { } userId = generateUserId(employeeCode); } - UserInfo userInfo = iUserInfoService.getById(userId); + UserInfo userInfo = userInfoService.getById(userId); String oldUserStatus = userInfo.getAvailable(); // 绑定用户手机号 bandUserMobile(userInfo, reqUserDetailEditPO); @@ -317,10 +230,10 @@ public class UserInfoManage { userInfo.setAvailable(reqUserDetailEditPO.getStatus()); userInfo.setUpdateOn(LocalDateTime.now()); userInfo.setUpdateBy(LoginUserUtil.getUserId()); - iUserInfoService.updateById(userInfo); + userInfoService.updateById(userInfo); List userRoleInfoList = reqUserDetailEditPO.getUserRoleInfoList(); - iUserRoleService.remove(Wrappers.lambdaQuery(UserRole.class).eq(UserRole::getUserId, userId)); + userRoleService.remove(Wrappers.lambdaQuery(UserRole.class).eq(UserRole::getUserId, userId)); if (CollUtil.isNotEmpty(userRoleInfoList)) { Long finalUserId = userId; List userRoleList = userRoleInfoList.stream().map(r -> { @@ -329,7 +242,7 @@ public class UserInfoManage { saveRecord.setUserId(finalUserId); return saveRecord; }).collect(Collectors.toList()); - iUserRoleService.saveBatch(userRoleList); + userRoleService.saveBatch(userRoleList); } // 刷新用户权限 仅原状态为正常才需要刷新session if ("ENABLE".equals(oldUserStatus)) { @@ -352,7 +265,7 @@ public class UserInfoManage { String employeeCode = reqUserDetailEditPO.getEmployeeCode(); Long userId = userInfo.getId(); // 校验手机号是否重复 - UserInfo repeatMobileUserInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) + UserInfo repeatMobileUserInfo = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) .eq(UserInfo::getMobile, reqUserDetailEditPO.getPhoneNo()).ne(UserInfo::getId, userId)); if (Objects.nonNull(repeatMobileUserInfo)) { throw new BizException("该手机号码已被绑定,请问重复绑定"); @@ -362,21 +275,21 @@ public class UserInfoManage { userInfo.setMobile(phoneNo); // 更新浙政钉相关数据 if (StringUtils.isNotBlank(phoneNo)) { - iDingEmployeeInfoService + dingEmployeeInfoService .update(Wrappers.lambdaUpdate(DingEmployeeInfo.class) .eq(DingEmployeeInfo::getMainJob, "true") .eq(DingEmployeeInfo::getEmployeeCode, employeeCode) .set(DingEmployeeInfo::getBindUserMobile, phoneNo)); - iUserInfoService.updateById(userInfo); + userInfoService.updateById(userInfo); } } @Transactional(rollbackFor = Exception.class) public Long generateUserId(String employeeCode) { - UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) + UserInfo userInfo = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) .eq(UserInfo::getEmployeeCode, employeeCode)); if (Objects.isNull(userInfo)) { - List dingEmployeeInfoList = iDingEmployeeInfoService + List dingEmployeeInfoList = dingEmployeeInfoService .list(Wrappers.lambdaQuery(DingEmployeeInfo.class) .eq(DingEmployeeInfo::getEmployeeCode, employeeCode) .eq(DingEmployeeInfo::getMainJob, "true")); @@ -395,7 +308,7 @@ public class UserInfoManage { .createOn(LocalDateTime.now()) .updateOn(LocalDateTime.now()) .build(); - iUserInfoService.save(userInfo); + userInfoService.save(userInfo); } return userInfo.getId(); } @@ -403,114 +316,54 @@ public class UserInfoManage { public ResUserDetailVO currentUserInfo() { Long userId = LoginUserUtil.getUserId(); - UserInfo userInfo = iUserInfoService.getById(userId); + UserInfo userInfo = userInfoService.getById(userId); if (Objects.isNull(userInfo)) { return null; } - ResUserDetailVO resUserDetailVO = new ResUserDetailVO(); - resUserDetailVO.setRealName(userInfo.getRealName()); - resUserDetailVO.setUserId(userInfo.getId()); - resUserDetailVO.setPhoneNo(userInfo.getMobile()); - resUserDetailVO.setStatus(userInfo.getAvailable()); - resUserDetailVO.setEmployeeCode(userInfo.getEmployeeCode()); - resUserDetailVO.setAvatar(makeAvatar(userInfo.getAvatar())); + ResUserDetailVO resUserDetail = new ResUserDetailVO(); + resUserDetail.setRealName(userInfo.getRealName()); + resUserDetail.setUserId(userInfo.getId()); + resUserDetail.setPhoneNo(userInfo.getMobile()); + resUserDetail.setStatus(userInfo.getAvailable()); + resUserDetail.setEmployeeCode(userInfo.getEmployeeCode()); + resUserDetail.setMhUnitId(userInfo.getMhUnitId()); + resUserDetail.setMhUnitName(userInfo.getMhUnitName()); // 装配用户角色信息列表 - List userRoleList = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) - .eq(UserRole::getUserId, userId)); - List userRoleInfoList = new ArrayList<>(); + List userRoleList = userRoleService.listByUserId(userId); if (CollUtil.isNotEmpty(userRoleList)) { - List roleIdList = userRoleList.stream().map(UserRole::getRoleId).collect(Collectors.toList()); - List roleList = iRoleService.list(Wrappers.lambdaQuery(Role.class).in(Role::getId, roleIdList)); - roleList.forEach(r -> { - UserRoleVO userRoleVO = new UserRoleVO(); - userRoleVO.setId(r.getId()); - userRoleVO.setName(r.getName()); - userRoleVO.setCode(r.getCode()); - userRoleInfoList.add(userRoleVO); - }); - } - resUserDetailVO.setUserRoleInfoList(userRoleInfoList); - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - if (Objects.nonNull(userFullInfo)) { - resUserDetailVO.setOrgCode(userFullInfo.getOrganizationCode()); - resUserDetailVO.setOrgName(userFullInfo.getOrganizationName()); - resUserDetailVO.setRegionCode(userFullInfo.getRegionCode()); - resUserDetailVO.setRegionLevel(userFullInfo.getRegionLevel()); - resUserDetailVO.setRegionName(regionCacheHelper.getRegionName(userFullInfo.getRegionCode() - , RegionConst.RL_COUNTY)); - resUserDetailVO.setEmpPosUnitCode(userFullInfo.getEmpPosUnitCode()); - resUserDetailVO.setEmpPosUnitName(userFullInfo.getEmpPosUnitName()); - } - return resUserDetailVO; - } - - //生成头像 链接 - private String makeAvatar(String avatar) { - try { - GenericResult accessToken = zwddClient.getAccessToken(); - String token = accessToken.getData(); - String res = "https://" + zwddIntegrationProperties.getDomain() + "/media/download?" + - "access_token=" + token + "&media_id=" + avatar; - return res; - } catch (Exception e) { + List roleIdList = CollUtils.fieldList(userRoleList,UserRole::getRoleId); + List roleList = roleService.listByIds(roleIdList); + List userRoles = roleList.stream().map(r -> { + UserRoleVO userRole = new UserRoleVO(); + userRole.setId(r.getId()); + userRole.setName(r.getName()); + userRole.setCode(r.getCode()); + return userRole; + }).collect(Collectors.toList()); + resUserDetail.setUserRoleInfoList(userRoles); } - return org.apache.commons.lang3.StringUtils.EMPTY; - } - - public Map getUserMapByIds(Set staterUsers) { - List userInfos = iUserInfoService.listByIds(staterUsers); - return userInfos.stream().map(u -> { - ProcessInstanceUserDto userInfo = new ProcessInstanceUserDto(); - userInfo.setUserId(u.getEmployeeCode()); - userInfo.setUserName(u.getRealName()); - // 根据 单位code获取单位名称 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(u.getId()); - if (Objects.nonNull(userFullInfo)) { - userInfo.setOrgCode(userFullInfo.getEmpPosUnitCode()); - userInfo.setOrgName(userFullInfo.getEmpPosUnitName()); - } - return userInfo; - }).collect(Collectors.toMap((ProcessInstanceUserDto::getUserId), v -> v)); + return resUserDetail; } - public Map getUserMapByEmployeeCode(Set staterUsers) { + public Map getUserMapByUserIds(Collection staterUsers) { if (CollUtil.isEmpty(staterUsers)) { return Collections.emptyMap(); } - List userInfos = iUserInfoService.list(Wrappers.lambdaQuery(UserInfo.class) - .in(UserInfo::getEmployeeCode, staterUsers)); + List userInfos = userInfoService.listByIds(staterUsers); if (CollUtil.isEmpty(userInfos)) { return Collections.emptyMap(); } return userInfos.stream().map(u -> { ProcessInstanceUserDto userInfo = new ProcessInstanceUserDto(); - userInfo.setUserId(u.getEmployeeCode()); + userInfo.setUserId(String.valueOf(u.getId())); userInfo.setUserName(u.getRealName()); - // 根据 单位code获取单位名称 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(u.getId()); - if (Objects.nonNull(userFullInfo)) { - userInfo.setOrgCode(userFullInfo.getEmpPosUnitCode()); - userInfo.setOrgName(userFullInfo.getEmpPosUnitName()); - } + userInfo.setOrgCode(String.valueOf(u.getMhUnitId())); + userInfo.setOrgName(u.getMhUnitName()); return userInfo; }).collect(Collectors.toMap((ProcessInstanceUserDto::getUserId), v -> v)); } - public ProcessInstanceUserDto getUserInfo(String userId) { - UserInfo userInfo = iUserInfoService.getById(userId); - ProcessInstanceUserDto processInstanceUserDto = new ProcessInstanceUserDto(); - processInstanceUserDto.setUserId(String.valueOf(userInfo.getId())); - processInstanceUserDto.setUserName(userInfo.getRealName()); - // 根据 单位code获取单位名称 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userInfo.getId()); - if (Objects.nonNull(userFullInfo)) { - processInstanceUserDto.setOrgCode(userFullInfo.getEmpPosUnitCode()); - processInstanceUserDto.setOrgName(userFullInfo.getEmpPosUnitName()); - } - return processInstanceUserDto; - } - /** * 获取当前用户可控角色列表 * @@ -519,7 +372,7 @@ public class UserInfoManage { public List getControlledRoleList() { Long userId = LoginUserUtil.getUserId(); // 装配用户角色信息列表 - List userRoleList = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) + List userRoleList = userRoleService.list(Wrappers.lambdaQuery(UserRole.class) .eq(UserRole::getUserId, userId)); List controlledRoleVOList = new ArrayList<>(); @@ -527,7 +380,7 @@ public class UserInfoManage { if (CollUtil.isNotEmpty(userRoleList)) { List roleIdList = userRoleList.stream().map(UserRole::getRoleId).distinct().collect(Collectors.toList()); - List roleList = iRoleService.list(Wrappers.lambdaQuery(Role.class).in(Role::getId, roleIdList)); + List roleList = roleService.list(Wrappers.lambdaQuery(Role.class).in(Role::getId, roleIdList)); for (Role role : roleList) { List manageRoleIdList = BizUtils.splitToLong(role.getManageRoleIds()); @@ -536,7 +389,7 @@ public class UserInfoManage { } } controlledRoleIdList = controlledRoleIdList.stream().distinct().collect(Collectors.toList()); - List controlledRoleList = iRoleService.list(Wrappers.lambdaQuery(Role.class).in(Role::getId, controlledRoleIdList)); + List controlledRoleList = roleService.list(Wrappers.lambdaQuery(Role.class).in(Role::getId, controlledRoleIdList)); controlledRoleVOList = controlledRoleList.stream().map(r -> { UserRoleVO userRoleVO = new UserRoleVO(); @@ -557,7 +410,7 @@ public class UserInfoManage { */ public UserFullInfoDTO queryUserInfoInPasswordAuth(String username) { // TODO 目前账号密码登陆测试使用 强制用户登录 userId 1L - UserInfo userInfo = iUserInfoService.getById(username); + UserInfo userInfo = userInfoService.getById(username); if (Objects.isNull(userInfo)) { return null; } @@ -572,7 +425,7 @@ public class UserInfoManage { * @return / */ public UserFullInfoDTO queryUserInfoInPhoneNoAuth(String phoneNo) { - UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) + UserInfo userInfo = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) .eq(UserInfo::getMobile, phoneNo)); if (Objects.isNull(userInfo)) { return null; @@ -590,7 +443,7 @@ public class UserInfoManage { public UserFullInfoDTO queryUserInfoInAccountIdAuth(String accountId) { // 获取用户信息 - UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) + UserInfo userInfo = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) .eq(UserInfo::getAccountId, accountId)); if (Objects.isNull(userInfo)) { return null; @@ -600,7 +453,7 @@ public class UserInfoManage { } public UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode) { - UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) + UserInfo userInfo = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) .eq(UserInfo::getEmployeeCode, employeeCode).last("limit 1")); if (Objects.isNull(userInfo)) { return null; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/UserInfo.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/UserInfo.java index 7080ba1..21c36c3 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/UserInfo.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/entity/UserInfo.java @@ -12,8 +12,6 @@ import java.io.Serializable; import java.time.LocalDateTime; - - /** *

* @@ -57,12 +55,9 @@ public class UserInfo implements Serializable { private String employeeCode; - private String regionCode; - private Long mhUnitId; - private String empPosUnitCode; - private String empPosUnitName; + private String mhUnitName; @ApiModelProperty("头像") private String avatar; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqUserDetailPO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqUserDetailPO.java deleted file mode 100644 index 4608f2f..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqUserDetailPO.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.hz.pm.api.user.model.po; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author liuxinxin - * @date 2023/2/15 上午8:43 - */ -@Data -@ApiModel("获取用户详情请求") -public class ReqUserDetailPO { - - @ApiModelProperty("用户id") - private Long userId; - - @ApiModelProperty("浙政钉 用户编码") - private String employeeCode; - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqUserInfoListPO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqUserInfoListPO.java deleted file mode 100644 index 1764949..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqUserInfoListPO.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.hz.pm.api.user.model.po; - -import com.ningdatech.basic.model.PagePo; -import com.hz.pm.api.user.model.vo.UserRoleVO; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.List; - -/** - * @author liuxinxin - * @date 2023/2/13 上午9:10 - */ -@Data -@ApiModel("用户管理查询 请求入参") -public class ReqUserInfoListPO extends PagePo { - - @ApiModelProperty("姓名") - private String name; - - @ApiModelProperty("手机号码") - private String phoneNo; - - @ApiModelProperty("所在单位(主职)") - private String orgName; - - @ApiModelProperty("所在单位Code(主职)") - private String orgCode; - - @ApiModelProperty("所属区域") - private Long regionId; - - @ApiModelProperty("所属区域名称") - private Long regionName; - - @ApiModelProperty("用户角色") - private List userRoleList; - - @ApiModelProperty("状态") - private String status; - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/UserDetailReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/UserDetailReq.java new file mode 100644 index 0000000..11cf48e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/UserDetailReq.java @@ -0,0 +1,21 @@ +package com.hz.pm.api.user.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2023/2/15 上午8:43 + */ +@Data +@ApiModel("获取用户详情请求") +public class UserDetailReq { + + @ApiModelProperty("用户id") + private Long userId; + + @ApiModelProperty("浙政钉 用户编码") + private String employeeCode; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/UserInfoListReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/UserInfoListReq.java new file mode 100644 index 0000000..07775bd --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/UserInfoListReq.java @@ -0,0 +1,39 @@ +package com.hz.pm.api.user.model.po; + +import com.ningdatech.basic.model.PagePo; +import com.hz.pm.api.user.model.vo.UserRoleVO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2023/2/13 上午9:10 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel("用户管理查询 请求入参") +public class UserInfoListReq extends PagePo { + + @ApiModelProperty("姓名") + private String name; + + @ApiModelProperty("手机号码") + private String phoneNo; + + @ApiModelProperty("所在单位") + private String mhUnitName; + + @ApiModelProperty("所在单位Code") + private Long mhUnitId; + + @ApiModelProperty("用户角色") + private List userRoleList; + + @ApiModelProperty("状态") + private String status; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserDetailVO.java index fea6e63..63aa5ce 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserDetailVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserDetailVO.java @@ -1,6 +1,5 @@ package com.hz.pm.api.user.model.vo; -import com.hz.pm.api.common.model.constant.RegionConst; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -10,7 +9,7 @@ import java.util.List; /** * @author liuxinxin - * @date 2023/2/15 上午8:43 + * @since 2023/2/15 上午8:43 */ @Data @ApiModel("获取用户详情请求") @@ -31,23 +30,11 @@ public class ResUserDetailVO { @ApiModelProperty("浙政钉 用户编码") private String employeeCode; - @ApiModelProperty("所在单位(主职)") - private String orgName; + @ApiModelProperty("所在单位") + private String mhUnitName; - @ApiModelProperty("所在单位(主职)code") - private String orgCode; - - @ApiModelProperty("所属区域") - private Long regionId; - private String regionCode; - private Integer regionLevel; - private String regionName; - - @ApiModelProperty("用户任职所在单位code") - private String empPosUnitCode; - - @ApiModelProperty("用户任职所在单位") - private String empPosUnitName; + @ApiModelProperty("所在单位code") + private Long mhUnitId; @ApiModelProperty("用户角色") private List userRoleList; @@ -61,12 +48,4 @@ public class ResUserDetailVO { @ApiModelProperty("头像") private String avatar; - //是否是市级单位 - public Boolean getIsMunicipalOrg(){ - //如果是丽水市本级的code 就是 - if(RegionConst.RC_HZ.equals(this.regionCode)){ - return Boolean.TRUE; - } - return Boolean.FALSE; - } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserInfoListVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserInfoListVO.java deleted file mode 100644 index bf066df..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/ResUserInfoListVO.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.hz.pm.api.user.model.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.time.LocalDateTime; -import java.util.List; - -/** - *

- * ResUserInfoListVO - *

- * - * @author WendyYang - * @since 15:24 2024/1/10 - */ -@Data -@ApiModel("用户管理查询 请求response") -public class ResUserInfoListVO { - - @ApiModelProperty("用户id") - private Long userId; - - @ApiModelProperty("浙政钉 用户编码") - private String employeeCode; - - @ApiModelProperty("姓名") - private String name; - - @ApiModelProperty("手机号码") - private String phoneNo; - - @ApiModelProperty("所在单位(主职)") - private String orgName; - - @ApiModelProperty("所在单位(主职)code") - private String orgCode; - - @ApiModelProperty("所属区域") - private Long regionId; - private Integer regionLevel; - private String regionCode; - private String regionName; - - @ApiModelProperty("用户角色") - private List userRoleList; - - @ApiModelProperty("状态") - private String status; - - @ApiModelProperty("更新时间") - private LocalDateTime updateTime; - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/UserInfoListVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/UserInfoListVO.java new file mode 100644 index 0000000..799fc78 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/UserInfoListVO.java @@ -0,0 +1,49 @@ +package com.hz.pm.api.user.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * ResUserInfoListVO + *

+ * + * @author WendyYang + * @since 15:24 2024/1/10 + */ +@Data +@ApiModel("用户管理查询 请求response") +public class UserInfoListVO { + + @ApiModelProperty("用户id") + private Long userId; + + @ApiModelProperty("浙政钉 用户编码") + private String employeeCode; + + @ApiModelProperty("姓名") + private String name; + + @ApiModelProperty("手机号码") + private String phoneNo; + + @ApiModelProperty("所在单位") + private String mhUnitName; + + @ApiModelProperty("所在单位code") + private Long mhUnitId; + + @ApiModelProperty("用户角色") + private List userRoleList; + + @ApiModelProperty("状态") + private String status; + + @ApiModelProperty("更新时间") + private LocalDateTime updateTime; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/constants/SessionTimeConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/constants/SessionTimeConst.java new file mode 100644 index 0000000..ea0b22b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/constants/SessionTimeConst.java @@ -0,0 +1,18 @@ +package com.hz.pm.api.user.security.auth.constants; + +/** + * @Author LiuXinXin + * @Date 2022/2/17 12:59 上午 + * @Version 1.0 + **/ +public class SessionTimeConst { + + private SessionTimeConst() { + } + + public static final Integer SESSION_TIME_SECONDS = 24 * 60 * 60 * 10; + public static final Integer SESSION_EXPIRED = 0; + + public static final String UNIVERSAL_VERIFICATION_CODE = "9527"; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/constants/SessionTimeConstant.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/constants/SessionTimeConstant.java deleted file mode 100644 index 33f6971..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/constants/SessionTimeConstant.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.hz.pm.api.user.security.auth.constants; - -/** - * @Author LiuXinXin - * @Date 2022/2/17 12:59 上午 - * @Version 1.0 - **/ -public class SessionTimeConstant { - - public static final Integer SESSION_TIME_SECONDS = 24 * 60 * 60 * 10; - public static final Integer SESSION_EXPIRED = 0; - - public static final String UNIVERSAL_VERIFICATION_CODE = "9527"; -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/credential/CredentialAuthProvider.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/credential/CredentialAuthProvider.java index a9d836d..7370024 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/credential/CredentialAuthProvider.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/auth/credential/CredentialAuthProvider.java @@ -3,7 +3,7 @@ package com.hz.pm.api.user.security.auth.credential; import com.hz.pm.api.sms.constant.VerificationCodeType; import com.hz.pm.api.sms.helper.VerifyCodeCheckHelper; import com.hz.pm.api.user.model.enumeration.LoginTypeEnum; -import com.hz.pm.api.user.security.auth.constants.SessionTimeConstant; +import com.hz.pm.api.user.security.auth.constants.SessionTimeConst; import com.hz.pm.api.user.security.auth.constants.UserDetailsServiceConstant; import com.hz.pm.api.user.security.validate.CommonLoginException; import com.ningdatech.basic.exception.BizException; @@ -79,7 +79,7 @@ public class CredentialAuthProvider implements AuthenticationProvider { if (Boolean.FALSE.equals(phoneVerifyCodeSkip)) { // 校验短信验证码 boolean verificationResult = verifyCodeCheckHelper.verification(VerificationCodeType.LOGIN, principal, credentials); - if (!verificationResult && !SessionTimeConstant.UNIVERSAL_VERIFICATION_CODE.equals(credentials)) { + if (!verificationResult && !SessionTimeConst.UNIVERSAL_VERIFICATION_CODE.equals(credentials)) { throw new CommonLoginException("验证码错误"); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/config/RedisSessionConfig.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/config/RedisSessionConfig.java index 5866b66..2d55c5b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/config/RedisSessionConfig.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/config/RedisSessionConfig.java @@ -1,7 +1,7 @@ package com.hz.pm.api.user.security.config;//package com.hz.pm.api.user.security.auth.config; import com.hz.pm.api.common.model.constant.BizConst; -import com.hz.pm.api.user.security.auth.constants.SessionTimeConstant; +import com.hz.pm.api.user.security.auth.constants.SessionTimeConst; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; @@ -30,7 +30,7 @@ public class RedisSessionConfig { sessionIdResolver.setCookieSerializer(cookieSerializer); // 设置到 sessionIdResolver 中 cookieSerializer.setCookieName(BizConst.COOKIE_KEY); - cookieSerializer.setCookieMaxAge(SessionTimeConstant.SESSION_TIME_SECONDS); + cookieSerializer.setCookieMaxAge(SessionTimeConst.SESSION_TIME_SECONDS); return sessionIdResolver; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserFullInfoDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserFullInfoDTO.java index 0fa9956..6307cfb 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserFullInfoDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserFullInfoDTO.java @@ -12,7 +12,7 @@ import java.util.stream.Collectors; /** * @author liuxinxin - * @date 2023/1/4 下午5:07 + * @since 2023/1/4 下午5:07 */ @Data @@ -20,6 +20,12 @@ public class UserFullInfoDTO { private Long userId; + private String mhUnitName; + + private Long mhUnitId; + + private String mhUserId; + private String realName; private String username; @@ -29,45 +35,11 @@ public class UserFullInfoDTO { private String credential; /** - * 所属区域编码 - */ - private String regionCode; - /** - * 所属区域编码 - */ - private Integer regionLevel; - - /** - * 浙政钉扫码 员工code - */ - private String employeeCode; - - /** - * 浙政钉组织code - */ - private String organizationCode; - - /** * 手机号码 */ private String mobile; /** - * 浙政钉组织名称 - */ - private String organizationName; - - /** - * 任职所在单位code - */ - private String empPosUnitCode; - - /** - * 任职所在单位 - */ - private String empPosUnitName; - - /** * 用户角色 */ private List userRoleList; @@ -83,7 +55,7 @@ public class UserFullInfoDTO { /** * 取最高的权限 * - * @return + * @return \ */ public RoleEnum getRoleCode() { if (CollUtil.isNotEmpty(this.userRoleList)) { @@ -93,35 +65,35 @@ public class UserFullInfoDTO { return null; } - public Boolean getIsOrgAdmin() { - if (CollUtil.isNotEmpty(this.userRoleList)) { - for (Role role : this.userRoleList) { - RoleEnum roleEnum = RoleEnum.mathByName(role.getCode()); - if (Objects.nonNull(roleEnum) && roleEnum.eq(RoleEnum.COMPANY_MANAGER.name())) { - return Boolean.TRUE; - } - } - } - return Boolean.FALSE; + public boolean getIsOrgAdmin() { + return containsRole(RoleEnum.COMPANY_MANAGER); } - public Boolean getSuperAdmin() { - if (CollUtil.isNotEmpty(this.userRoleList)) { - for (Role role : this.userRoleList) { - RoleEnum roleEnum = RoleEnum.mathByName(role.getCode()); - if (Objects.nonNull(roleEnum) && roleEnum.eq(RoleEnum.SUPER_ADMIN.name())) { - return Boolean.TRUE; - } - } - } - return Boolean.FALSE; + public boolean getSuperAdmin() { + return containsRole(RoleEnum.SUPER_ADMIN); } - public Boolean getRegionAdmin() { + public boolean getRegionAdmin() { + return containsRole(RoleEnum.REGION_MANAGER); + } + + public Boolean notAdmin() { + return !getSuperAdmin() && !getRegionAdmin() && !getIsOrgAdmin(); + } + + public String getMhUnitIdStr() { + return String.valueOf(getMhUnitId()); + } + + public String getUserIdStr() { + return String.valueOf(getUserId()); + } + + private boolean containsRole(RoleEnum targetRole) { if (CollUtil.isNotEmpty(this.userRoleList)) { for (Role role : this.userRoleList) { RoleEnum roleEnum = RoleEnum.mathByName(role.getCode()); - if (Objects.nonNull(roleEnum) && roleEnum.eq(RoleEnum.REGION_MANAGER.name())) { + if (Objects.nonNull(roleEnum) && roleEnum.eq(targetRole.name())) { return Boolean.TRUE; } } @@ -129,10 +101,4 @@ public class UserFullInfoDTO { return Boolean.FALSE; } - public Boolean notAdmin() { - if(!getSuperAdmin() && !getRegionAdmin() && !getIsOrgAdmin()){ - return Boolean.TRUE; - } - return Boolean.FALSE; - } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java index a89b4e7..7dd62a9 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java @@ -2,25 +2,21 @@ package com.hz.pm.api.user.security.model; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; -import com.ningdatech.basic.auth.AbstractLoginUser; -import com.hz.pm.api.common.model.constant.RegionConst; import com.hz.pm.api.sys.model.entity.Role; import com.hz.pm.api.user.model.enumeration.RoleEnum; +import com.ningdatech.basic.auth.AbstractLoginUser; import lombok.Data; import lombok.EqualsAndHashCode; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Objects; +import java.util.*; import java.util.stream.Collectors; /** * @author LiuXinXin - * @date 2022/8/1 下午3:32 + * @since 2022/8/1 下午3:32 */ @Data @EqualsAndHashCode(callSuper = true) @@ -28,16 +24,9 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails { private static final long serialVersionUID = -8219907690673456440L; - private String realName; - private String password; /** - * 所属区域编码 - */ - private String regionCode; - - /** * 所属区域层级 */ private Integer regionLevel; @@ -48,38 +37,38 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails { private String employeeCode; /** - * 浙政钉组织code + * 用户所属单位 */ - private String organizationCode; + private String mhUnitName; /** - * 浙政钉组织名称 + * 用户所属单位ID */ - private String organizationName; + private Long mhUnitId; + + private String mhUserId; /** * 用户角色 */ private List userRoleList; - /** - * 任职所在单位code - */ - private String empPosUnitCode; - /** - * 任职所在单位 - */ - private String empPosUnitName; + private String mobile; + public String getUserIdStr() { + return String.valueOf(getUserId()); + } - private String mobile; + public String getMhUnitIdStr() { + return String.valueOf(getMhUnitId()); + } /** * 获取用户权限 * - * @return + * @return \ */ @Override public Collection getAuthorities() { @@ -90,7 +79,7 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails { } return authorities; } - return new ArrayList<>(); + return Collections.emptyList(); } @Override @@ -126,7 +115,7 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails { /** * 取最高的权限 * - * @return + * @return \ */ public RoleEnum getRoleCode() { if (CollUtil.isNotEmpty(this.userRoleList)) { @@ -136,35 +125,23 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails { return null; } - public Boolean getIsOrgAdmin() { - if (CollUtil.isNotEmpty(this.userRoleList)) { - for (Role role : this.userRoleList) { - RoleEnum roleEnum = RoleEnum.mathByName(role.getCode()); - if (Objects.nonNull(roleEnum) && roleEnum.eq(RoleEnum.COMPANY_MANAGER.name())) { - return Boolean.TRUE; - } - } - } - return Boolean.FALSE; + public boolean getIsOrgAdmin() { + return containsRole(RoleEnum.COMPANY_MANAGER); } - public Boolean getSuperAdmin() { - if (CollUtil.isNotEmpty(this.userRoleList)) { - for (Role role : this.userRoleList) { - RoleEnum roleEnum = RoleEnum.mathByName(role.getCode()); - if (Objects.nonNull(roleEnum) && roleEnum.eq(RoleEnum.SUPER_ADMIN.name())) { - return Boolean.TRUE; - } - } - } - return Boolean.FALSE; + public boolean getSuperAdmin() { + return containsRole(RoleEnum.SUPER_ADMIN); } - public Boolean getRegionAdmin() { + public boolean getRegionAdmin() { + return containsRole(RoleEnum.REGION_MANAGER); + } + + private boolean containsRole(RoleEnum targetRole) { if (CollUtil.isNotEmpty(this.userRoleList)) { for (Role role : this.userRoleList) { RoleEnum roleEnum = RoleEnum.mathByName(role.getCode()); - if (Objects.nonNull(roleEnum) && roleEnum.eq(RoleEnum.REGION_MANAGER.name())) { + if (Objects.nonNull(roleEnum) && roleEnum.eq(targetRole.name())) { return Boolean.TRUE; } } @@ -172,11 +149,4 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails { return Boolean.FALSE; } - public Boolean getIsMunicipalOrg() { - //如果是丽水市本级的code 就是 - if (RegionConst.RC_HZ.equals(this.regionCode)) { - return Boolean.TRUE; - } - return Boolean.FALSE; - } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/util/LoginUserUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/util/LoginUserUtil.java index 25243f1..023dcb4 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/util/LoginUserUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/util/LoginUserUtil.java @@ -10,10 +10,13 @@ import java.util.stream.Collectors; /** - * @Author liuxinxin - * @Date 2022/9/30 12:26 下午 - * @Version 1.0 - **/ + *

+ * LoginUserUtil + *

+ * + * @author WendyYang + * @since 15:42 2024/1/12 + */ public class LoginUserUtil extends AbstractLoginUserUtil { public static UserInfoDetails loginUserDetail() { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java index 07f47ec..4185ad0 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java @@ -90,11 +90,11 @@ public class WorkbenchManage { StopWatch stopWatch = new StopWatch(); stopWatch.start(); //1.待办中心数据 - TodoCenterStatisticsVO statisticsVO = todoCenterManage.todoCenterStatistics(user.getEmployeeCode()); + TodoCenterStatisticsVO statisticsVO = todoCenterManage.todoCenterStatistics(user.getUserId()); ToBeProcessedReq toBeProcessedReq = new ToBeProcessedReq(); toBeProcessedReq.page(1, 5); toBeProcessedReq.setLoginUserId(userId); - toBeProcessedReq.setEmployeeCode(user.getEmployeeCode()); + toBeProcessedReq.setUserId(user.getUserId()); statisticsVO.setTodoList(todoCenterManage.todoProjectList(toBeProcessedReq).getRecords() .stream().map(WorkbenchConverter::convert).collect(Collectors.toList())); res.setTodoCerter(statisticsVO); @@ -156,7 +156,7 @@ public class WorkbenchManage { WorkbenchVO.ProjectEarlyWarning projectEarlyWarning = new WorkbenchVO.ProjectEarlyWarning(); LambdaQueryWrapper projectWrapper = Wrappers.lambdaQuery(Project.class) .eq(Project::getNewest, Boolean.TRUE); - EarlyWarningUtil.buildPermissonProjectWrapper(projectWrapper, user); + EarlyWarningUtil.buildPermissionProjectWrapper(projectWrapper, user); List projects = projectService.list(projectWrapper); Set projectCodeS = Sets.newHashSet(); Map projectNameMap = projects.stream() @@ -169,12 +169,12 @@ public class WorkbenchManage { LambdaQueryWrapper overWrapper = Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) .eq(WflowEarlyWarningRecords::getNoticeType, WarningNoticeTypeEnum.OVER.getCode()) .or(q2 -> q2.isNull(WflowEarlyWarningRecords::getNoticeType)); - EarlyWarningUtil.buildPermissonFullWrapper(overWrapper, user); + EarlyWarningUtil.buildPermissionFullWrapper(overWrapper, user); long overCount = earlyWarningRecordsService.count(overWrapper); accumulate.setOver((int) overCount); LambdaQueryWrapper adventWrapper = Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) .eq(WflowEarlyWarningRecords::getNoticeType, WarningNoticeTypeEnum.ADVENT.getCode()); - EarlyWarningUtil.buildPermissonFullWrapper(adventWrapper, user); + EarlyWarningUtil.buildPermissionFullWrapper(adventWrapper, user); long adventCount = earlyWarningRecordsService.count(adventWrapper); accumulate.setAdvent((int) adventCount); projectEarlyWarning.setAccumulate(accumulate); @@ -187,18 +187,15 @@ public class WorkbenchManage { Page normalPage = Page.of(1, 1000); LambdaQueryWrapper overPewWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class) .eq(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.OVER_TIME.name()) - .eq(user.getRegionAdmin() && !user.getSuperAdmin(), ProjectEarlyWarning::getAreaCode, user.getRegionCode()) - .eq((user.getIsOrgAdmin() && !user.getSuperAdmin()) || user.notAdmin(), ProjectEarlyWarning::getBuildOrgCode, user.getEmpPosUnitCode()); + .eq((user.getIsOrgAdmin() && !user.getSuperAdmin()) || user.notAdmin(), ProjectEarlyWarning::getBuildOrgCode, user.getMhUnitId()); projectEarlyWarningService.page(overPage, overPewWrapper); LambdaQueryWrapper adventPewWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class) .eq(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.ADVENT_TIME.name()) - .eq(user.getRegionAdmin() && !user.getSuperAdmin(), ProjectEarlyWarning::getAreaCode, user.getRegionCode()) - .eq((user.getIsOrgAdmin() && !user.getSuperAdmin()) || user.notAdmin(), ProjectEarlyWarning::getBuildOrgCode, user.getEmpPosUnitCode()); + .eq((user.getIsOrgAdmin() && !user.getSuperAdmin()) || user.notAdmin(), ProjectEarlyWarning::getBuildOrgCode, user.getMhUnitId()); projectEarlyWarningService.page(adventPage, adventPewWrapper); LambdaQueryWrapper normalWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class) .eq(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.NORMAL.name()) - .eq(user.getRegionAdmin() && !user.getSuperAdmin(), ProjectEarlyWarning::getAreaCode, user.getRegionCode()) - .eq((user.getIsOrgAdmin() && !user.getSuperAdmin()) || user.notAdmin(), ProjectEarlyWarning::getBuildOrgCode, user.getEmpPosUnitCode()); + .eq((user.getIsOrgAdmin() && !user.getSuperAdmin()) || user.notAdmin(), ProjectEarlyWarning::getBuildOrgCode, user.getMhUnitId()); projectEarlyWarningService.page(normalPage, normalWrapper); WorkbenchVO.WarningStatistics cuurent = new WorkbenchVO.WarningStatistics(); @@ -211,8 +208,7 @@ public class WorkbenchManage { projectEarlyWarning.setCurrent(cuurent); List warningRecords = earlyWarningRecordsService.list(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) - .eq(user.getRegionAdmin() && !user.getSuperAdmin(), WflowEarlyWarningRecords::getAreaCode, user.getRegionCode()) - .eq((user.getIsOrgAdmin() && !user.getSuperAdmin()) || user.notAdmin(), WflowEarlyWarningRecords::getBuildOrgCode, user.getEmpPosUnitCode()) + .eq((user.getIsOrgAdmin() && !user.getSuperAdmin()) || user.notAdmin(), WflowEarlyWarningRecords::getBuildOrgCode, user.getMhUnitId()) .orderByDesc(WflowEarlyWarningRecords::getWarningTime)); Set projectCodeSet = Sets.newHashSet(); Map warningMap = warningRecords.stream() @@ -228,11 +224,11 @@ public class WorkbenchManage { WflowEarlyWarningRecords record = warningMap.get(vo.getProjectCode()); vo.setWarningTime(record.getWarningTime()); vo.setInstStart(record.getInstStart()); - vo.setWarningEmployeecode(record.getWarningEmployeecode()); + vo.setWarningUserId(record.getWarningUserId()); vo.setNoticeMethod(record.getNoticeMethod()); vo.setNoticeContent(record.getNoticeContent()); vo.setPath(record.getPath()); - vo.setBatchEmployees(record.getBatchEmployees()); + vo.setBatchUserIds(record.getBatchUserIds()); vo.setRecordId(record.getId()); } else { vo.setWarningTime(now); @@ -255,11 +251,11 @@ public class WorkbenchManage { WflowEarlyWarningRecords record = warningMap.get(vo.getProjectCode()); vo.setWarningTime(record.getWarningTime()); vo.setInstStart(record.getInstStart()); - vo.setWarningEmployeecode(record.getWarningEmployeecode()); + vo.setWarningUserId(record.getWarningUserId()); vo.setNoticeMethod(record.getNoticeMethod()); vo.setNoticeContent(record.getNoticeContent()); vo.setPath(record.getPath()); - vo.setBatchEmployees(record.getBatchEmployees()); + vo.setBatchUserIds(record.getBatchUserIds()); vo.setRecordId(record.getId()); } else { vo.setWarningTime(now); @@ -281,11 +277,11 @@ public class WorkbenchManage { WflowEarlyWarningRecords record = warningMap.get(vo.getProjectCode()); vo.setWarningTime(record.getWarningTime()); vo.setInstStart(record.getInstStart()); - vo.setWarningEmployeecode(record.getWarningEmployeecode()); + vo.setWarningUserId(record.getWarningUserId()); vo.setNoticeMethod(record.getNoticeMethod()); vo.setNoticeContent(record.getNoticeContent()); vo.setPath(record.getPath()); - vo.setBatchEmployees(record.getBatchEmployees()); + vo.setBatchUserIds(record.getBatchUserIds()); vo.setRecordId(record.getId()); } vo.setProjectName(projectNameMap.get(o.getProjectCode())); @@ -314,7 +310,7 @@ public class WorkbenchManage { Integer noticeType = record.getNoticeType(); String projectCode = record.getProjectCode(); Project project = projectService.getProjectByCode(projectCode); - String batchEmployees = record.getBatchEmployees(); + String batchEmployees = record.getBatchUserIds(); Integer ruleType = record.getRuleType(); String areaCode = record.getAreaCode(); //如果是临期 可以取到 超期的小时数 @@ -324,7 +320,7 @@ public class WorkbenchManage { VUtils.isTrue(Objects.isNull(project)).throwMessage("催办失败,项目不存在!"); if (StringUtils.isBlank(batchEmployees)) { //如果批次员工号不存在 就取当前 - batchEmployees = record.getWarningEmployeecode(); + batchEmployees = record.getWarningUserId(); } String noticeContent = record.getNoticeContent(); //查出配置的模板 @@ -343,8 +339,11 @@ public class WorkbenchManage { //算出 当前和他的 小时差 临期 long adventBetween = ChronoUnit.HOURS.between(instStart, LocalDateTime.now()); for (String employee : employees) { - earlyWarningManage.urging(noticeMethod, noticeContent, (int) adventBetween, (int) adventBetween, - biz, instStart, employee, project, ruleType, noticeType, path, batchEmployees, record.getNodeId()); + earlyWarningManage.urging(noticeMethod, noticeContent, + (int) adventBetween, (int) adventBetween, + biz, instStart, Long.valueOf(employee), + project, ruleType, noticeType, path, + batchEmployees, record.getNodeId()); } return "催办成功了" + employees.length + "个人"; } diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/irs/EmployeeTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/irs/EmployeeTest.java deleted file mode 100644 index 2058bff..0000000 --- a/hz-pm-api/src/test/java/com/hz/pm/api/irs/EmployeeTest.java +++ /dev/null @@ -1,224 +0,0 @@ -package com.hz.pm.api.irs; - -import cn.hutool.core.collection.CollUtil; -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.toolkit.StringUtils; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.basic.model.GenericResult; -import com.hz.pm.api.AppTests; -import com.hz.pm.api.common.model.constant.BizConst; -import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; -import com.hz.pm.api.organization.model.entity.DingOrganization; -import com.hz.pm.api.organization.service.IDingEmployeeInfoService; -import com.hz.pm.api.organization.service.IDingOrganizationService; -import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; -import com.hz.pm.api.user.model.entity.UserInfo; -import com.hz.pm.api.user.service.IUserInfoService; -import com.ningdatech.zwdd.ZwddIntegrationProperties; -import com.ningdatech.zwdd.client.ZwddClient; -import com.ningdatech.zwdd.model.Page; -import com.ningdatech.zwdd.model.dto.EmployeeAccountIdDTO; -import com.ningdatech.zwdd.model.query.PageOrganizationEmployeePositionsQuery; -import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition; -import org.junit.Test; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; - -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - -/** - * @Classname EmployeeTest - * @Description - * @Date 2023/9/11 10:59 - * @Author PoffyZhang - */ -public class EmployeeTest extends AppTests { - - @Autowired - private IDingOrganizationService iDingOrganizationService; - - @Autowired - private ZwddIntegrationProperties zwddIntegrationProperties; - - @Autowired - private IDingEmployeeInfoService iDingEmployeeInfoService; - - @Autowired - private ZwddClient zwddClient; - - @Autowired - private IUserInfoService iUserInfoService; - - @Test - public void test(){ - String orgCode = "GO_3663776dcc2c414db2ed947e225bfc5b"; - DingOrganization org = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getOrganizationCode, orgCode) - .last(BizConst.LIMIT_1)); - VUtils.isTrue(Objects.isNull(org)).throwMessage("单位不存在"); - System.out.println("所属单位 {} 要更新员工信息了:" + org.getOrganizationName()); - - List allOrganizationEmployeePositionList = new ArrayList<>(); - String organizationCode = orgCode; - PageOrganizationEmployeePositionsQuery query = new PageOrganizationEmployeePositionsQuery(); - query.setEmployeeStatus("A"); - query.setOrganizationCode(organizationCode); - query.setReturnTotalSize(true); - query.setTenantId(zwddIntegrationProperties.getTenantId()); - int pageNo = 1; - query.setPageNo(pageNo); - query.setPageSize(100); - - // 查询组织下 用户信息 - GenericResult> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); - Page data = firstPageGenericResult.getData(); - if (Objects.isNull(data)){ - System.out.println("响应为空:{}" + organizationCode); - return; - } - System.out.println(JSON.toJSONString(data.getData())); - if (CollUtil.isNotEmpty(data.getData())) { - allOrganizationEmployeePositionList.addAll(data.getData()); - } - Long totalSize = data.getTotalSize(); - - System.out.println("dingOrganization :{}" + JSON.toJSONString(org)); - - System.out.println("totalSize :{},{}" + totalSize + "," + org.getOrganizationName()); - - List dingEmployeeInfoSaveRecordList = new ArrayList<>(); - assemblerAccountId(allOrganizationEmployeePositionList, dingEmployeeInfoSaveRecordList); - System.out.println("dingEmployeeInfoSaveRecordList :{}" + JSON.toJSONString(dingEmployeeInfoSaveRecordList)); - // 批量保存用户信息 - saveBatch(dingEmployeeInfoSaveRecordList); - } - - private void saveBatch(List dingEmployeeInfoSaveRecordList) { - dingEmployeeInfoSaveRecordList = dingEmployeeInfoSaveRecordList.stream() - .filter(r -> ("true".equals(r.getMainJob()) - && "A".equals(r.getEmpStatus()) - && StringUtils.isNotBlank(r.getEmpPosUnitCode()) - && StringUtils.isNotBlank(r.getEmployeeCode())) - || "GE_48606ed7c10d4d15b0f931a9a4b89f21".equals(r.getEmployeeCode()) - ).collect(Collectors.toList()); - - Set uniqueKeySet = new HashSet(); - - List saveList = new ArrayList<>(); - - for (DingEmployeeInfo dingEmployeeInfo : dingEmployeeInfoSaveRecordList) { - if (uniqueKeySet.add(dingEmployeeInfo.getEmployeeCode() + dingEmployeeInfo.getEmpPosUnitCode())) { - saveList.add(dingEmployeeInfo); - } - } - - List organizations = iDingOrganizationService.list(); - Map organizationMap = organizations.stream().collect(Collectors.toMap(DingOrganization::getOrganizationCode, o -> o)); - - System.out.println("saveList:" + JSON.toJSONString(saveList)); - for (DingEmployeeInfo dingEmployeeInfo : saveList) { - String employeeCode = dingEmployeeInfo.getEmployeeCode(); - - DingEmployeeInfo employeeInfo = iDingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) - .eq(DingEmployeeInfo::getEmployeeCode, employeeCode) - .last(BizConst.LIMIT_1)); - if (Objects.isNull(employeeInfo)) { - iDingEmployeeInfoService.save(dingEmployeeInfo); - } else { - dingEmployeeInfo.setId(employeeInfo.getId()); - iDingEmployeeInfoService.saveOrUpdate(dingEmployeeInfo); - } - generateOrUpdateUserInfo(dingEmployeeInfo,organizationMap); - } - } - - private void assemblerAccountId(List segment, List dingEmployeeInfoSaveRecordList) { - List employeeCodes = segment.stream().map(OrganizationEmployeePosition::getEmployeeCode).distinct().collect(Collectors.toList()); - GenericResult> listGenericResult = zwddClient.listEmployeeAccountIds(employeeCodes); - List employeeAccountIdDTOList = listGenericResult.getData(); - if (CollUtil.isNotEmpty(employeeAccountIdDTOList)) { - Map employeeCodeAccountIdMap = employeeAccountIdDTOList.stream().filter(Objects::nonNull) - .collect(Collectors.toMap(EmployeeAccountIdDTO::getEmployeeCode, EmployeeAccountIdDTO::getAccountId)); - - List dingEmployeeInfos = buildDingEmployeeInfoRecordList(segment); - - dingEmployeeInfos = dingEmployeeInfos.stream().map(r -> { - r.setAccountId(employeeCodeAccountIdMap.get(r.getEmployeeCode())); - return r; - }).collect(Collectors.toList()); - dingEmployeeInfoSaveRecordList.addAll(dingEmployeeInfos); - } - } - private List buildDingEmployeeInfoRecordList(List allOrganizationEmployeePositionList) { - List saveRecordList = new ArrayList<>(); - for (OrganizationEmployeePosition organizationEmployeePosition : allOrganizationEmployeePositionList) { - List govEmployeePositions = organizationEmployeePosition.getGovEmployeePositions(); - if (CollUtil.isNotEmpty(govEmployeePositions)) { - List segmentSaveRecordList = new ArrayList<>(); - for (OrganizationEmployeePosition.GovEmployeePosition govEmployeePosition : govEmployeePositions) { - DingEmployeeInfo dingEmployeeInfo = new DingEmployeeInfo(); - BeanUtils.copyProperties(organizationEmployeePosition, dingEmployeeInfo); - dingEmployeeInfo.setMainJob(govEmployeePosition.getMainJob()); - dingEmployeeInfo.setEmpPosUnitCode(govEmployeePosition.getEmpPosUnitCode()); - dingEmployeeInfo.setEmpPosEmployeeRoleCode(govEmployeePosition.getEmpPosEmployeeRoleCode()); - dingEmployeeInfo.setEmpPosInnerInstitutionCode(govEmployeePosition.getEmpPosInnerInstitutionCode()); - dingEmployeeInfo.setEmployeeCode(govEmployeePosition.getEmployeeCode()); - dingEmployeeInfo.setJobAttributesCode(govEmployeePosition.getJobAttributesCode()); - dingEmployeeInfo.setOrganizationCode(govEmployeePosition.getOrganizationCode()); - dingEmployeeInfo.setEmpPosVirtualOrganizationCode(govEmployeePosition.getEmpPosVirtualOrganizationCode()); - dingEmployeeInfo.setEmpStatus(govEmployeePosition.getStatus()); - dingEmployeeInfo.setCreateOn(LocalDateTime.now()); - dingEmployeeInfo.setUpdateOn(LocalDateTime.now()); - dingEmployeeInfo.setCreateBy(-1L); - dingEmployeeInfo.setUpdateBy(-1L); - segmentSaveRecordList.add(dingEmployeeInfo); - } - saveRecordList.addAll(segmentSaveRecordList); - } else { - DingEmployeeInfo dingEmployeeInfo = new DingEmployeeInfo(); - BeanUtils.copyProperties(organizationEmployeePosition, dingEmployeeInfo); - saveRecordList.add(dingEmployeeInfo); - } - } - return saveRecordList; - } - - public void generateOrUpdateUserInfo(DingEmployeeInfo dingEmployeeInfo,Map organizationMap) { - String employeeCode = dingEmployeeInfo.getEmployeeCode(); - UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) - .eq(UserInfo::getEmployeeCode, employeeCode)); - if (Objects.isNull(userInfo)) { - userInfo = UserInfo.builder() - .accountId(dingEmployeeInfo.getAccountId()) - .username(dingEmployeeInfo.getEmployeeName()) - .realName(dingEmployeeInfo.getEmployeeName()) - .employeeCode(dingEmployeeInfo.getEmployeeCode()) - .available(UserAvailableEnum.DISABLE.name()) - .createBy(-1L) - .updateBy(-1L) - .createOn(LocalDateTime.now()) - .updateOn(LocalDateTime.now()) - .empPosUnitCode(dingEmployeeInfo.getEmpPosUnitCode()) - .avatar(dingEmployeeInfo.getAvatar()) - .build(); - if(StringUtils.isNotBlank(userInfo.getEmpPosUnitCode()) && organizationMap.containsKey(userInfo.getEmpPosUnitCode())){ - DingOrganization dingOrganization = organizationMap.get(userInfo.getEmpPosUnitCode()); - userInfo.setEmpPosUnitName(dingOrganization.getOrganizationName()); - userInfo.setRegionCode(dingOrganization.getDivisionCode()); - } - iUserInfoService.save(userInfo); - }else{ - userInfo.setAvatar(dingEmployeeInfo.getAvatar()); - userInfo.setEmpPosUnitCode(dingEmployeeInfo.getEmpPosUnitCode()); - if(StringUtils.isNotBlank(userInfo.getEmpPosUnitCode()) && organizationMap.containsKey(userInfo.getEmpPosUnitCode())){ - DingOrganization dingOrganization = organizationMap.get(userInfo.getEmpPosUnitCode()); - userInfo.setEmpPosUnitName(dingOrganization.getOrganizationName()); - userInfo.setRegionCode(dingOrganization.getDivisionCode()); - } - iUserInfoService.updateById(userInfo); - } - } -} diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/provincial/Test.java b/hz-pm-api/src/test/java/com/hz/pm/api/provincial/Test.java index c4fcb7f..50250ac 100644 --- a/hz-pm-api/src/test/java/com/hz/pm/api/provincial/Test.java +++ b/hz-pm-api/src/test/java/com/hz/pm/api/provincial/Test.java @@ -3,21 +3,21 @@ package com.hz.pm.api.provincial; import cn.hutool.crypto.SecureUtil; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.file.service.FileService; import com.hz.pm.api.AppTests; import com.hz.pm.api.common.model.constant.ProjectDeclareConst; import com.hz.pm.api.common.model.constant.RegionConst; import com.hz.pm.api.projectdeclared.converter.ApplicationConverter; import com.hz.pm.api.projectdeclared.manage.PrequalificationDeclaredProjectManage; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.service.IProjectApplicationService; import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.provincial.service.IJoinReviewProvincialBureauService; import com.hz.pm.api.staging.contants.StagingContant; import com.hz.pm.api.staging.model.entity.ProjectStaging; import com.hz.pm.api.staging.service.IProjectStagingService; +import com.ningdatech.file.service.FileService; import com.wflow.exception.BusinessException; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -37,7 +37,7 @@ import java.util.List; * @Author PoffyZhang */ @Slf4j -public class Test extends AppTests{// +public class Test extends AppTests {// @Autowired private PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage; @@ -68,19 +68,13 @@ public class Test extends AppTests{// log.info("" + bytesToSign); - String secret = "75152a97f20e4c4c854dc6301cf72ad4"; - String str = SecureUtil.hmacSha256(secret).digestBase64(bytesToSign,false); + String secret = "75152a97f20e4c4c854dc6301cf72ad4"; + String str = SecureUtil.hmacSha256(secret).digestBase64(bytesToSign, false); log.info("" + str); } @org.junit.Test - public void Test222(){ - Project project = projectService.getById(340); - prequalificationDeclaredProjectManage.directStartProcess(project,project.getPreStartUserId(),Boolean.FALSE); - } - - @org.junit.Test - public void Test3333(){ + public void Test3333() { String url = "http://devplat.oss-cn-hangzhou.aliyuncs.com/2023/04/13/5b2e1ef734e14437ba350ef97202c5b7.pdf?Expires=1681367401&OSSAccessKeyId=LTAI4GL7uypycnBjiRn55rMG&Signature=5PbIhpHNZvA2o8xYy8Ujw9Ibhl8%3D"; String s = "Expires"; System.out.println(url.replaceAll("&?" + s + "=[^&]*&", StringUtils.EMPTY)); @@ -90,33 +84,33 @@ public class Test extends AppTests{// private String active; @org.junit.Test - public void Test4444(){ + public void Test4444() { // 对接省级联审的接口 Project p = projectService.getById(448); List applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) .eq(ProjectApplication::getProjectId, p.getId())); - if(!joinReviewProvincialBureauService.pushImportProject( - ApplicationConverter.convertProject(p,applications,fileService,active))){ + if (!joinReviewProvincialBureauService.pushImportProject( + ApplicationConverter.convertProject(p, applications, fileService, active))) { throw new BusinessException("提交省级部门联审失败"); } System.out.println("成功"); } @org.junit.Test - public void test5(){ + public void test5() { //1. 定时取 项目暂存表的数据 去进行状态继续流转 List stagingList = projectStagingService.list(Wrappers.lambdaQuery(ProjectStaging.class) - .eq(ProjectStaging::getDead,Boolean.FALSE) + .eq(ProjectStaging::getDead, Boolean.FALSE) .le(ProjectStaging::getNextTime, LocalDateTime.now()) .le(ProjectStaging::getRetryTimes, StagingContant.Retry.MAX_RETRY_TIMES) .orderByAsc(ProjectStaging::getProjectId)); - log.info("需要状态流转的项目 size:{} :{}",stagingList.size(), JSON.toJSONString(stagingList)); + log.info("需要状态流转的项目 size:{} :{}", stagingList.size(), JSON.toJSONString(stagingList)); } @org.junit.Test - public void test6(){ + public void test6() { List projectList = projectService.list(Wrappers.lambdaQuery(Project.class) .eq(Project::getStage, ProjectStatusEnum.NOT_APPROVED.getCode()) .eq(Project::getStatus, ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()) @@ -124,6 +118,6 @@ public class Test extends AppTests{// .eq(Project::getAreaCode, RegionConst.RC_HZ) .orderByAsc(Project::getCreateOn)); - log.info("需要去查询省级联审结果的项目 size:{}",projectList.size()); + log.info("需要去查询省级联审结果的项目 size:{}", projectList.size()); } } From 33c008dc40cf361aaff2fb3f0c1104b747318f82 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Tue, 16 Jan 2024 14:14:30 +0800 Subject: [PATCH 22/44] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=A0=91=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/common/helper/impl/UserInfoHelperImpl.java | 5 +- .../hz/pm/api/common/model/constant/BizConst.java | 1 + .../pm/api/common/model/constant/RegionConst.java | 2 +- .../action/HzProjectDeclareAction.java | 279 +++++++++++++++++++ .../statemachine/action/ProjectDeclareAction.java | 4 +- .../action/ProjectDeclareChoiceAction.java | 50 ++-- .../action/ProjectDeclareJNAction.java | 279 ------------------- .../action/ProjectDeclareJYAction.java | 279 ------------------- .../action/ProjectDeclareKFBAction.java | 279 ------------------- .../action/ProjectDeclareLDAction.java | 279 ------------------- .../action/ProjectDeclareLQAction.java | 279 ------------------- .../action/ProjectDeclareQTAction.java | 279 ------------------- .../action/ProjectDeclareQYAction.java | 279 ------------------- .../action/ProjectDeclareSBJAction.java | 279 ------------------- .../action/ProjectDeclareSCAction.java | 287 -------------------- .../action/ProjectDeclareSYAction.java | 279 ------------------- .../action/ProjectDeclareYHAction.java | 280 ------------------- .../builder/ProjectDeclareStateMachineBuilder.java | 4 +- .../ProjectDeclareStateMachineBuilderImpl.java | 279 +++++++++++++++++++ .../ProjectDeclareStateMachineJNBuilder.java | 284 -------------------- .../ProjectDeclareStateMachineJYBuilder.java | 285 -------------------- .../ProjectDeclareStateMachineKFQBuilder.java | 285 -------------------- .../ProjectDeclareStateMachineLDBuilder.java | 285 -------------------- .../ProjectDeclareStateMachineLQBuilder.java | 286 -------------------- .../ProjectDeclareStateMachineQTBuilder.java | 285 -------------------- .../ProjectDeclareStateMachineQYBuilder.java | 285 -------------------- .../ProjectDeclareStateMachineSBJBuilder.java | 285 -------------------- .../ProjectDeclareStateMachineSCBuilder.java | 295 --------------------- .../ProjectDeclareStateMachineSYBuilder.java | 285 -------------------- .../ProjectDeclareStateMachineYHBuilder.java | 285 -------------------- .../common/statemachine/contant/RegionContant.java | 38 --- .../statemachine/util/MachineBuilderFounder.java | 57 ---- .../common/statemachine/util/StateMachineUtil.java | 20 +- .../controller/CompanyFiscalCodeController.java | 4 +- .../api/fiscal/manage/CompanyFiscalCodeManage.java | 36 ++- .../fiscal/service/ICompanyFiscalCodeService.java | 2 +- .../service/impl/CompanyFiscalCodeServiceImpl.java | 2 +- .../organization/controller/ProcDefController.java | 9 +- .../performance/manage/IndicatorConfigManage.java | 161 +++++------ ...PerformanceIndicatorProjectTemplateSaveDTO.java | 3 - .../pm/api/portrait/controller/TagController.java | 6 +- .../com/hz/pm/api/portrait/manage/TagManage.java | 58 ++-- .../com/hz/pm/api/portrait/model/dto/TagDTO.java | 10 +- .../com/hz/pm/api/portrait/model/vo/TagVO.java | 8 +- .../manage/DeclaredProjectManage.java | 9 +- .../manage/ReviewChecklistManage.java | 10 +- .../ProjectRenewalFundDeclarationController.java | 3 +- .../handle/ProcessExecuteChainHandle.java | 39 +-- .../manage/ProjectRenewalFundManage.java | 30 ++- .../scheduler/task/CockpitStatsStatisticsTask.java | 3 - .../hz/pm/api/sys/controller/FormController.java | 7 +- .../api/sys/controller/SysProcDefController.java | 8 +- .../sys/model/vo/WflowEarlyWarningRecordsVO.java | 4 +- .../pm/api/user/controller/MhUnitController.java | 19 ++ .../com/hz/pm/api/user/manage/MhUnitManage.java | 94 +++++++ .../com/hz/pm/api/user/manage/UserInfoManage.java | 26 +- .../pm/api/user/model/dto/MhUnitUserTreeDTO.java | 41 +++ .../user/model/enumeration/UnitUserNodeType.java | 16 ++ .../com/hz/pm/api/user/model/po/MhUnitListReq.java | 23 ++ .../com/hz/pm/api/user/model/po/UserTreeReq.java | 20 ++ .../com/hz/pm/api/user/model/vo/MhUnitListVO.java | 29 ++ .../hz/pm/api/sys/service/IMenuServiceTest.java | 14 + hz-pm-api/src/test/resources/application-dev.yml | 33 +-- hz-pm-api/src/test/resources/security/auth-dev.yml | 4 +- 64 files changed, 1089 insertions(+), 6604 deletions(-) create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/HzProjectDeclareAction.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareJNAction.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareJYAction.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareKFBAction.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareLDAction.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareLQAction.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareQTAction.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareQYAction.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSBJAction.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSCAction.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSYAction.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareYHAction.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilderImpl.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineJNBuilder.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineJYBuilder.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineKFQBuilder.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineLDBuilder.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineLQBuilder.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineQTBuilder.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineQYBuilder.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSBJBuilder.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSCBuilder.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSYBuilder.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineYHBuilder.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/contant/RegionContant.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/MachineBuilderFounder.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitUserTreeDTO.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/model/enumeration/UnitUserNodeType.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/MhUnitListReq.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/UserTreeReq.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/MhUnitListVO.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java index f7464f1..6fb1551 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/helper/impl/UserInfoHelperImpl.java @@ -77,12 +77,11 @@ public class UserInfoHelperImpl implements UserInfoHelper { userFullInfo.setMhUserId(userInfo.getMhUserId()); userFullInfo.setIdentifier(userInfo.getRealName()); userFullInfo.setRealName(userInfo.getRealName()); - userFullInfo.setMhUnitId(userFullInfo.getMhUnitId()); - userFullInfo.setMhUnitName(userFullInfo.getMhUnitName()); + userFullInfo.setMhUnitId(userInfo.getMhUnitId()); + userFullInfo.setMhUnitName(userInfo.getMhUnitName()); userFullInfo.setUsername(userInfo.getRealName()); userFullInfo.setMobile(userInfo.getMobile()); userFullInfo.setAccountId(userInfo.getAccountId()); - String available = userInfo.getAvailable(); if (StringUtils.isNotBlank(available)) { userFullInfo.setAvailable(UserAvailableEnum.valueOf(available)); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/BizConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/BizConst.java index 5f90688..7382f81 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/BizConst.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/BizConst.java @@ -65,6 +65,7 @@ public class BizConst { * 浙江省的region_id */ public static final long ZJ_REGION_CODE = 330000L; + public static final String NINE_AREA_CODE_LAST = "000"; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/RegionConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/RegionConst.java index 38fb723..4957888 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/RegionConst.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/model/constant/RegionConst.java @@ -25,7 +25,7 @@ public interface RegionConst { //---------------------------------------地区编码(缩写RC)------------------------------------------------------------- /** - * 丽水行政区划编码 + * 杭州市行政区划编码 */ String RC_HZ = "330100"; //丽水开发区 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/HzProjectDeclareAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/HzProjectDeclareAction.java new file mode 100644 index 0000000..0b252ac --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/HzProjectDeclareAction.java @@ -0,0 +1,279 @@ +package com.hz.pm.api.common.statemachine.action; + +import com.hz.pm.api.common.model.constant.StateMachineConst; +import com.hz.pm.api.common.statemachine.builder.ProjectDeclareStateMachineBuilderImpl; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.extern.slf4j.Slf4j; +import org.springframework.messaging.Message; +import org.springframework.statemachine.annotation.OnTransition; +import org.springframework.statemachine.annotation.WithStateMachine; + +/** + * 项目申报状态机action集合类 + * 市本级 + * @author CMM + * @since 2023/02/08 13:48 + */ +@Slf4j +@WithStateMachine(id = ProjectDeclareStateMachineBuilderImpl.MACHINE_ID) +public class HzProjectDeclareAction { + + private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") + public void UNDER_INTERNAL_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") + public void UNDER_INTERNAL_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") + public void UNDER_INTERNAL_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") + public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") + public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); + } + + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") + public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") + public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") + public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); + } + + @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") + public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") + public void PRELIMINARY_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") + public void PRELIMINARY_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); + } + + @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") + public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); + } + + @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") + public void PRE_APPLYING_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); + } + + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") + public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") + public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") + public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); + } + + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") + public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") + public void ANNUAL_PLAN_SUSPEND(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); + } + + @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") + public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); + } + + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") + public void PLAN_TO_DECLARE_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void DECLARE_PLAN_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") + public void PLAN_REVIEW_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") + public void PLAN_REVIEW_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") + public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") + public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); + } + + + @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") + public void PROJECT_APPROVAL(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待立项批复批复后,项目一级状态变更为已立项 + project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") + public void TO_BE_APPROVED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") + public void PURCHASE_PUT_ON_RECORD(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.OPERATION.getCode()); + } + + @OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") + public void START_TO_WORK(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); + } + + @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") + public void TO_BE_PURCHASED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 待采购状态撤回后,项目一级状态回退到未立项 + project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); + } + + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") + public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + } + + @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") + public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); + } + + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } + + @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") + public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); + } + + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") + public void FINAL_ACCEPTANCE_PASS(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + // 终验审核通过后,项目一级状态变更为已归档 + project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); + project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") + public void FINAL_ACCEPTANCE_REJECT(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "TO_BE_FINALLY_INSPECTED") + public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + } + + @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") + public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); + project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); + } +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareAction.java index 68eeb56..3f3b652 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareAction.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareAction.java @@ -1,7 +1,7 @@ package com.hz.pm.api.common.statemachine.action; import com.hz.pm.api.common.model.constant.StateMachineConst; -import com.hz.pm.api.common.statemachine.contant.RegionContant; +import com.hz.pm.api.common.statemachine.builder.ProjectDeclareStateMachineBuilderImpl; import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.model.entity.Project; @@ -17,7 +17,7 @@ import org.springframework.statemachine.annotation.WithStateMachine; * @since 2023/02/08 13:48 */ @Slf4j -@WithStateMachine(id = RegionContant.LS_SBJ_CODE) +@WithStateMachine(id = ProjectDeclareStateMachineBuilderImpl.MACHINE_ID) public class ProjectDeclareAction { private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java index b5eff58..500a784 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java @@ -1,6 +1,8 @@ package com.hz.pm.api.common.statemachine.action; import cn.hutool.core.collection.CollUtil; +import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.toolkit.Assert; import com.hz.pm.api.common.model.constant.ProjectDeclareConst; import com.hz.pm.api.common.model.constant.StateMachineConst; import com.hz.pm.api.common.enumeration.CommonEnum; @@ -32,7 +34,7 @@ public class ProjectDeclareChoiceAction implements Action stateContext) { log.info(String.valueOf(stateContext.getTarget().getId())); ProjectStatusEnum projectStatusEnum = stateContext.getTarget().getId(); - switch (projectStatusEnum){ + switch (projectStatusEnum) { case PENDING_PREQUALIFICATION_CHOICE: preDeclareChoice(stateContext); break; @@ -48,49 +50,61 @@ public class ProjectDeclareChoiceAction implements Action stateContext) { - List projectApplications = stateContext.getMessage().getHeaders().get(APPLICATION_DECLARE, List.class); - Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); - log.info("立项批复之后,项目的状态为:{}" + project.getStatus()); + Project project = getProject(stateContext); + List projectApplications = getProjectApplication(stateContext); + log.info("立项批复之后,项目的状态为:{}", project.getStatus()); // 判断 是否有初次创建的应用 - if (CollUtil.isEmpty(projectApplications)){ + if (CollUtil.isEmpty(projectApplications)) { project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); } - final Boolean[] isFirstApp = {Boolean.FALSE}; - projectApplications.stream().forEach(app -> { + final boolean[] isFirstApp = {Boolean.FALSE}; + projectApplications.forEach(app -> { Integer isFirst = app.getIsFirst(); - if(isFirst.equals(CommonEnum.YES.getCode())){ + if (isFirst.equals(CommonEnum.YES.getCode())) { isFirstApp[0] = Boolean.TRUE; } }); - if(isFirstApp[0]){ + if (isFirstApp[0]) { project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); project.setStatus(ProjectStatusEnum.TO_BE_APP_REGISTER.getCode()); - }else{ + } else { project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); } } private void preDeclareChoice(StateContext stateContext) { - Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); - log.info("预审申报事件之前,项目的状态为:{}"+project.getStatus()); + Project project = getProject(stateContext); + log.info("预审申报事件之前,项目的状态为:{}", project.getStatus()); if (StateMachineUtil.isCityProject(project) && StateMachineUtil.judgeDeclareAmount(project, - ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)){ + ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)) { project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()); - }else { + } else { project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); } } private void preWithDrawChoice(StateContext stateContext) { - Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); - log.info("预审中撤回事件之前,项目的状态为:{}"+project.getStatus()); + Project project = getProject(stateContext); + log.info("预审中撤回事件之前,项目的状态为:{}", project.getStatus()); if (StateMachineUtil.isCityProject(project) && StateMachineUtil.judgeDeclareAmount(project, - ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)){ + ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)) { project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - }else { + } else { project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); } } + + private Project getProject(StateContext stateContext) { + Project project = stateContext.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); + Assert.notNull(project, "项目信息获取失败%s", JSONUtil.toJsonStr(stateContext.getMessage())); + return project; + } + + @SuppressWarnings("unchecked") + private List getProjectApplication(StateContext stateContext) { + return stateContext.getMessage().getHeaders().get(APPLICATION_DECLARE, List.class); + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareJNAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareJNAction.java deleted file mode 100644 index 6a63e55..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareJNAction.java +++ /dev/null @@ -1,279 +0,0 @@ -package com.hz.pm.api.common.statemachine.action; - -import com.hz.pm.api.common.model.constant.StateMachineConst; -import com.hz.pm.api.common.statemachine.contant.RegionContant; -import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.Project; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.statemachine.annotation.OnTransition; -import org.springframework.statemachine.annotation.WithStateMachine; - -/** - * 项目申报状态机action集合类 - * 景宁畲族自治县 - * @author CMM - * @since 2023/02/08 13:48 - */ -@Slf4j -@WithStateMachine(id = RegionContant.LS_JN_CODE) -public class ProjectDeclareJNAction { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") - public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") - public void UNDER_INTERNAL_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") - public void UNDER_INTERNAL_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") - public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") - public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") - public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") - public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") - public void PRELIMINARY_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") - public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") - public void PLAN_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") - public void PLAN_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - - @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") - public void PROJECT_APPROVAL(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") - public void TO_BE_APPROVED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - - @OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") - public void PURCHASE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.OPERATION.getCode()); - } - @OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") - public void START_TO_WORK(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") - public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") - public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") - public void FINAL_ACCEPTANCE_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 终验审核通过后,项目一级状态变更为已归档 - project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); - project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") - public void FINAL_ACCEPTANCE_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareJYAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareJYAction.java deleted file mode 100644 index a0c4521..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareJYAction.java +++ /dev/null @@ -1,279 +0,0 @@ -package com.hz.pm.api.common.statemachine.action; - -import com.hz.pm.api.common.model.constant.StateMachineConst; -import com.hz.pm.api.common.statemachine.contant.RegionContant; -import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.Project; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.statemachine.annotation.OnTransition; -import org.springframework.statemachine.annotation.WithStateMachine; - -/** - * 项目申报状态机action集合类 - * 缙云县 - * @author CMM - * @since 2023/02/08 13:48 - */ -@Slf4j -@WithStateMachine(id = RegionContant.LS_JY_CODE) -public class ProjectDeclareJYAction { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") - public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") - public void UNDER_INTERNAL_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") - public void UNDER_INTERNAL_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") - public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") - public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") - public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") - public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") - public void PRELIMINARY_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") - public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") - public void PLAN_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") - public void PLAN_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - - @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") - public void PROJECT_APPROVAL(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") - public void TO_BE_APPROVED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") - public void PURCHASE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.OPERATION.getCode()); - } - - @OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") - public void START_TO_WORK(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") - public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") - public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") - public void FINAL_ACCEPTANCE_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 终验审核通过后,项目一级状态变更为已归档 - project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); - project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") - public void FINAL_ACCEPTANCE_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareKFBAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareKFBAction.java deleted file mode 100644 index 9189f14..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareKFBAction.java +++ /dev/null @@ -1,279 +0,0 @@ -package com.hz.pm.api.common.statemachine.action; - -import com.hz.pm.api.common.model.constant.StateMachineConst; -import com.hz.pm.api.common.statemachine.contant.RegionContant; -import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.Project; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.statemachine.annotation.OnTransition; -import org.springframework.statemachine.annotation.WithStateMachine; - -/** - * 项目申报状态机action集合类 - * 开发区 - * @author CMM - * @since 2023/02/08 13:48 - */ -@Slf4j -@WithStateMachine(id = RegionContant.LS_KFQ_CODE) -public class ProjectDeclareKFBAction { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") - public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") - public void UNDER_INTERNAL_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") - public void UNDER_INTERNAL_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") - public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") - public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") - public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") - public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") - public void PRELIMINARY_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") - public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") - public void PLAN_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") - public void PLAN_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - - @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") - public void PROJECT_APPROVAL(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") - public void TO_BE_APPROVED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") - public void PURCHASE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.OPERATION.getCode()); - } - - @OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") - public void START_TO_WORK(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") - public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") - public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") - public void FINAL_ACCEPTANCE_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 终验审核通过后,项目一级状态变更为已归档 - project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); - project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") - public void FINAL_ACCEPTANCE_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareLDAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareLDAction.java deleted file mode 100644 index 7b7c50c..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareLDAction.java +++ /dev/null @@ -1,279 +0,0 @@ -package com.hz.pm.api.common.statemachine.action; - -import com.hz.pm.api.common.model.constant.StateMachineConst; -import com.hz.pm.api.common.statemachine.contant.RegionContant; -import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.Project; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.statemachine.annotation.OnTransition; -import org.springframework.statemachine.annotation.WithStateMachine; - -/** - * 项目申报状态机action集合类 - * 莲都区 - * @author CMM - * @since 2023/02/08 13:48 - */ -@Slf4j -@WithStateMachine(id = RegionContant.LS_LD_CODE) -public class ProjectDeclareLDAction { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") - public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") - public void UNDER_INTERNAL_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") - public void UNDER_INTERNAL_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") - public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") - public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") - public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") - public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") - public void PRELIMINARY_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") - public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") - public void PLAN_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") - public void PLAN_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - - @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") - public void PROJECT_APPROVAL(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") - public void TO_BE_APPROVED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") - public void PURCHASE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.OPERATION.getCode()); - } - - @OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") - public void START_TO_WORK(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") - public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") - public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") - public void FINAL_ACCEPTANCE_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 终验审核通过后,项目一级状态变更为已归档 - project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); - project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") - public void FINAL_ACCEPTANCE_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareLQAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareLQAction.java deleted file mode 100644 index f664b7b..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareLQAction.java +++ /dev/null @@ -1,279 +0,0 @@ -package com.hz.pm.api.common.statemachine.action; - -import com.hz.pm.api.common.model.constant.StateMachineConst; -import com.hz.pm.api.common.statemachine.contant.RegionContant; -import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.Project; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.statemachine.annotation.OnTransition; -import org.springframework.statemachine.annotation.WithStateMachine; - -/** - * 项目申报状态机action集合类 - * ;龙泉市 - * @author CMM - * @since 2023/02/08 13:48 - */ -@Slf4j -@WithStateMachine(id = RegionContant.LS_LQ_CODE) -public class ProjectDeclareLQAction { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") - public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") - public void UNDER_INTERNAL_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") - public void UNDER_INTERNAL_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") - public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") - public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") - public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") - public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") - public void PRELIMINARY_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") - public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "TO_BE_APPROVED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") - public void PLAN_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - - @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") - public void PROJECT_APPROVAL(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") - public void TO_BE_APPROVED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") - public void PURCHASE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.OPERATION.getCode()); - } - - @OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") - public void START_TO_WORK(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") - public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") - public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") - public void FINAL_ACCEPTANCE_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 终验审核通过后,项目一级状态变更为已归档 - project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); - project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") - public void FINAL_ACCEPTANCE_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareQTAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareQTAction.java deleted file mode 100644 index aaaea23..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareQTAction.java +++ /dev/null @@ -1,279 +0,0 @@ -package com.hz.pm.api.common.statemachine.action; - -import com.hz.pm.api.common.model.constant.StateMachineConst; -import com.hz.pm.api.common.statemachine.contant.RegionContant; -import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.Project; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.statemachine.annotation.OnTransition; -import org.springframework.statemachine.annotation.WithStateMachine; - -/** - * 项目申报状态机action集合类 - * 青田县 - * @author CMM - * @since 2023/02/08 13:48 - */ -@Slf4j -@WithStateMachine(id = RegionContant.LS_QT_CODE) -public class ProjectDeclareQTAction { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") - public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") - public void UNDER_INTERNAL_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") - public void UNDER_INTERNAL_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") - public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") - public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") - public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") - public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") - public void PRELIMINARY_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") - public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") - public void PLAN_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") - public void PLAN_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - - @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") - public void PROJECT_APPROVAL(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") - public void TO_BE_APPROVED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") - public void PURCHASE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.OPERATION.getCode()); - } - - @OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") - public void START_TO_WORK(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") - public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") - public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") - public void FINAL_ACCEPTANCE_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 终验审核通过后,项目一级状态变更为已归档 - project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); - project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") - public void FINAL_ACCEPTANCE_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareQYAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareQYAction.java deleted file mode 100644 index 54fcb7d..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareQYAction.java +++ /dev/null @@ -1,279 +0,0 @@ -package com.hz.pm.api.common.statemachine.action; - -import com.hz.pm.api.common.model.constant.StateMachineConst; -import com.hz.pm.api.common.statemachine.contant.RegionContant; -import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.Project; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.statemachine.annotation.OnTransition; -import org.springframework.statemachine.annotation.WithStateMachine; - -/** - * 项目申报状态机action集合类 - * 庆元县 - * @author CMM - * @since 2023/02/08 13:48 - */ -@Slf4j -@WithStateMachine(id = RegionContant.LS_QY_CODE) -public class ProjectDeclareQYAction { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") - public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") - public void UNDER_INTERNAL_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") - public void UNDER_INTERNAL_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") - public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") - public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") - public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") - public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") - public void PRELIMINARY_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") - public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") - public void PLAN_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") - public void PLAN_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - - @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") - public void PROJECT_APPROVAL(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") - public void TO_BE_APPROVED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") - public void PURCHASE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.OPERATION.getCode()); - } - - @OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") - public void START_TO_WORK(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") - public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") - public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") - public void FINAL_ACCEPTANCE_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 终验审核通过后,项目一级状态变更为已归档 - project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); - project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") - public void FINAL_ACCEPTANCE_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSBJAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSBJAction.java deleted file mode 100644 index adc1d69..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSBJAction.java +++ /dev/null @@ -1,279 +0,0 @@ -package com.hz.pm.api.common.statemachine.action; - -import com.hz.pm.api.common.model.constant.StateMachineConst; -import com.hz.pm.api.common.statemachine.contant.RegionContant; -import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.Project; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.statemachine.annotation.OnTransition; -import org.springframework.statemachine.annotation.WithStateMachine; - -/** - * 项目申报状态机action集合类 - * 市本级 - * @author CMM - * @since 2023/02/08 13:48 - */ -@Slf4j -@WithStateMachine(id = RegionContant.LS_SBJ_CODE) -public class ProjectDeclareSBJAction { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") - public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") - public void UNDER_INTERNAL_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") - public void UNDER_INTERNAL_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") - public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") - public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") - public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") - public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") - public void PRELIMINARY_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") - public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") - public void PLAN_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") - public void PLAN_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - - @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") - public void PROJECT_APPROVAL(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") - public void TO_BE_APPROVED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") - public void PURCHASE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.OPERATION.getCode()); - } - - @OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") - public void START_TO_WORK(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") - public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") - public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") - public void FINAL_ACCEPTANCE_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 终验审核通过后,项目一级状态变更为已归档 - project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); - project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") - public void FINAL_ACCEPTANCE_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "TO_BE_FINALLY_INSPECTED") - public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSCAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSCAction.java deleted file mode 100644 index 4e311d1..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSCAction.java +++ /dev/null @@ -1,287 +0,0 @@ -package com.hz.pm.api.common.statemachine.action; - -import com.hz.pm.api.common.model.constant.StateMachineConst; -import com.hz.pm.api.common.statemachine.contant.RegionContant; -import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.Project; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.statemachine.annotation.OnTransition; -import org.springframework.statemachine.annotation.WithStateMachine; - -/** - * 项目申报状态机action集合类 - * 遂昌县 - * @author CMM - * @since 2023/02/08 13:48 - */ -@Slf4j -@WithStateMachine(id = RegionContant.LS_SC_CODE) -public class ProjectDeclareSCAction { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") - public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") - public void UNDER_INTERNAL_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") - public void UNDER_INTERNAL_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") - public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") - public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") - public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") - public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") - public void PRELIMINARY_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") - public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") - public void PLAN_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") - public void PLAN_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - - @OnTransition(source = "TO_BE_APPROVED", target = "APPROVED_AFTER_CHOICE") - public void PROJECT_APPROVAL(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.APPROVED_AFTER_CHOICE.getCode()); - } - - @OnTransition(source = "TO_BE_APP_REGISTER", target = "TO_BE_PURCHASED") - public void REGISTER_APP(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") - public void TO_BE_APPROVED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") - public void PURCHASE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.OPERATION.getCode()); - } - - @OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") - public void START_TO_WORK(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") - public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") - public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") - public void FINAL_ACCEPTANCE_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 终验审核通过后,项目一级状态变更为已归档 - project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); - project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") - public void FINAL_ACCEPTANCE_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSYAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSYAction.java deleted file mode 100644 index 9b262b3..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareSYAction.java +++ /dev/null @@ -1,279 +0,0 @@ -package com.hz.pm.api.common.statemachine.action; - -import com.hz.pm.api.common.model.constant.StateMachineConst; -import com.hz.pm.api.common.statemachine.contant.RegionContant; -import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.Project; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.statemachine.annotation.OnTransition; -import org.springframework.statemachine.annotation.WithStateMachine; - -/** - * 项目申报状态机action集合类 - * 松阳县 - * @author CMM - * @since 2023/02/08 13:48 - */ -@Slf4j -@WithStateMachine(id = RegionContant.LS_SY_CODE) -public class ProjectDeclareSYAction { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") - public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") - public void UNDER_INTERNAL_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") - public void UNDER_INTERNAL_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") - public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") - public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") - public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") - public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") - public void PRELIMINARY_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") - public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") - public void PLAN_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") - public void PLAN_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - - @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") - public void PROJECT_APPROVAL(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") - public void TO_BE_APPROVED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") - public void PURCHASE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.OPERATION.getCode()); - } - - @OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") - public void START_TO_WORK(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") - public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") - public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") - public void FINAL_ACCEPTANCE_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 终验审核通过后,项目一级状态变更为已归档 - project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); - project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") - public void FINAL_ACCEPTANCE_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareYHAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareYHAction.java deleted file mode 100644 index 4960ffa..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareYHAction.java +++ /dev/null @@ -1,280 +0,0 @@ -package com.hz.pm.api.common.statemachine.action; - -import com.hz.pm.api.common.model.constant.StateMachineConst; -import com.hz.pm.api.common.statemachine.contant.RegionContant; -import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.Project; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.statemachine.annotation.OnTransition; -import org.springframework.statemachine.annotation.WithStateMachine; - -/** - * 项目申报状态机action集合类 - * 云和县 - * @author CMM - * @since 2023/02/08 13:48 - */ -@Slf4j -@WithStateMachine(id = RegionContant.LS_YH_CODE) -public class ProjectDeclareYHAction { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") - public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") - public void UNDER_INTERNAL_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") - public void UNDER_INTERNAL_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") - public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") - public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") - public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") - public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") - public void PRELIMINARY_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") - public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") - public void PLAN_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") - public void PLAN_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - - @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") - public void PROJECT_APPROVAL(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") - public void TO_BE_APPROVED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - - @OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") - public void PURCHASE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.OPERATION.getCode()); - } - - @OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") - public void START_TO_WORK(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") - public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") - public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") - public void FINAL_ACCEPTANCE_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 终验审核通过后,项目一级状态变更为已归档 - project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); - project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") - public void FINAL_ACCEPTANCE_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_REVIEW_FAILED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_RE_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java index 78abf56..174eb70 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilder.java @@ -14,10 +14,11 @@ import org.springframework.statemachine.persist.StateMachinePersister; * @since 2023/02/07 15:56 */ public interface ProjectDeclareStateMachineBuilder { + StateMachine build() throws Exception; /** * 构建状态机 - * @param beanFactory + * @param beanFactory \ * @author CMM * @since 2023/02/07 16:15 */ @@ -29,4 +30,5 @@ public interface ProjectDeclareStateMachineBuilder { * @since 2023/02/07 16:22 */ StateMachinePersister getProjectPersister(); + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilderImpl.java new file mode 100644 index 0000000..29b1e7f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilderImpl.java @@ -0,0 +1,279 @@ +package com.hz.pm.api.common.statemachine.builder; + +import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; +import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; +import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; +import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.model.entity.Project; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.statemachine.StateMachine; +import org.springframework.statemachine.StateMachineContext; +import org.springframework.statemachine.StateMachinePersist; +import org.springframework.statemachine.config.EnableStateMachine; +import org.springframework.statemachine.config.StateMachineBuilder; +import org.springframework.statemachine.persist.DefaultStateMachinePersister; +import org.springframework.statemachine.persist.StateMachinePersister; +import org.springframework.statemachine.support.DefaultStateMachineContext; +import org.springframework.stereotype.Component; + +import java.util.EnumSet; + +/** + * 项目申报状态机 + * 市本级 + * + * @author CMM + * @since 2023/02/07 15:56 + */ +@Slf4j +@Component +@EnableStateMachine(name = ProjectDeclareStateMachineBuilderImpl.MACHINE_ID) +@RequiredArgsConstructor +public class ProjectDeclareStateMachineBuilderImpl implements ProjectDeclareStateMachineBuilder { + + public static final String MACHINE_ID = "projectDeclareStateMachine"; + + private static final ProjectDeclareGuardFactory PROJECT_DECLARE_GUARD_FACTORY = new ProjectDeclareGuardFactory(); + private final BeanFactory beanFactory; + + @Override + public StateMachine build() throws Exception { + StateMachine stateMachine = build(beanFactory); + log.info("状态机ID:" + stateMachine.getId()); + stateMachine.start(); + return stateMachine; + } + + /** + * 构建状态机 + * + * @param beanFactory + * @author CMM + * @since 2023/02/07 16:15 + */ + @Override + public StateMachine build(BeanFactory beanFactory) throws Exception { + StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); + builder.configureConfiguration() + .withConfiguration() + .machineId(MACHINE_ID) + .beanFactory(beanFactory); + + builder.configureStates() + .withStates() + .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .states(EnumSet.allOf(ProjectStatusEnum.class)); + + builder.configureTransitions() + // 单位内部审核通过,从单位内部审核中到待预审 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() + // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() + // 单位内部审核中撤回,从单位内部审核中到待申报 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .target(ProjectStatusEnum.TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() + // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 + .withExternal() + .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) + .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) + .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() + + // 待预审预审申报,从待预审到待预审选择 + .withExternal() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() + // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS, PROJECT_DECLARE_GUARD_FACTORY.new PendingPreQualificationChoiceGuard(), new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING, new ProjectDeclareChoiceAction()).and() + + // 省级部门联审通过,从省级部门联审中到省级部门联审成功 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) + .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() + // 省级部门联审通过,从省级部门联审成功到预审中 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) + .target(ProjectStatusEnum.PRE_APPLYING) + .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() + // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) + .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() + // 省级部门联审中撤回,从省级部门联审中到待预审 + .withExternal() + .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) + .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() + + // 预审通过,从预审中到部门联审中 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() + // 预审驳回,从预审中到预审不通过 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() + // 预审中撤回,从预审中到预审中撤回选择态 + .withExternal() + .source(ProjectStatusEnum.PRE_APPLYING) + .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() + // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS, PROJECT_DECLARE_GUARD_FACTORY.new PendingPreQualificationChoiceGuard() + , new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PENDING_PREQUALIFICATION, new ProjectDeclareChoiceAction()).and() + // 预审不通过重新提交,从预审不通过到待预审选择 + .withExternal() + .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) + .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() + // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 + .withChoice() + .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS, PROJECT_DECLARE_GUARD_FACTORY.new PendingPreQualificationChoiceGuard(), new ProjectDeclareChoiceAction()) + .last(ProjectStatusEnum.PRE_APPLYING, new ProjectDeclareChoiceAction()).and() + // 部门联审通过,从部门联审中到年度计划中 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() + // 部门联审驳回,从部门联审中到部门联审不通过 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() + // 部门联审中撤回,从部门联审中到预审中 + .withExternal() + .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) + .target(ProjectStatusEnum.PRE_APPLYING) + .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() + // 年度计划中开启方案申报,从年度计划中到方案待申报 + .withExternal() + .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() + // 年度计划中暂缓,从年度计划中到被暂缓 + .withExternal() + .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) + .target(ProjectStatusEnum.BE_SUSPENDED) + .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() + // 方案待申报申报方案,从方案待申报到方案评审中 + .withExternal() + .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() + // 方案评审通过,从方案评审中到待立项批复 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.TO_BE_APPROVED) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() + // 方案评审驳回,从方案评审中到方案评审不通过 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() + // 方案评审中撤回,从方案评审中到方案待申报 + .withExternal() + .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) + .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() + // 方案评审不通过重新提交,从方案评审不通过到方案评审中 + .withExternal() + .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) + .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() + // 待立项批复批复,从待立项批复到待采购 + .withExternal() + .source(ProjectStatusEnum.TO_BE_APPROVED) + .target(ProjectStatusEnum.TO_BE_PURCHASED) + .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() + // 待采购采购备案,从待采购到实施中 + .withExternal() + .source(ProjectStatusEnum.TO_BE_PURCHASED) + .target(ProjectStatusEnum.OPERATION) + .event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() + + // 待开工 实施,从实施到建设中 + .withExternal() + .source(ProjectStatusEnum.OPERATION) + .target(ProjectStatusEnum.UNDER_CONSTRUCTION) + .event(ProjectStatusChangeEvent.START_TO_WORK).and() + // 建设中初验备案,从建设中到待终验 + .withExternal() + .source(ProjectStatusEnum.UNDER_CONSTRUCTION) + .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() + // 待终验终验申请,从待终验到终验审核中 + .withExternal() + .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() + // 终审审核通过,从终审审核中到已归档 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.ARCHIVED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() + // 终审审核不通过,从终审审核中到终审审核不通过 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() + // 终审审核中撤回,从终审审核中到待终验 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) + .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() + // 终验中 重新提交 + .withExternal() + .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) + .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) + .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); + return builder.build(); + } + + /** + * 持久化配置 + * + * @author CMM + * @since 2023/02/07 16:22 + */ + @Bean(name = "projectDeclareStatePersister") + @Override + public StateMachinePersister getProjectPersister() { + return new DefaultStateMachinePersister<>(new StateMachinePersist() { + @Override + public void write(StateMachineContext context, Project contextObj) { + log.info("当前项目为:{}", contextObj); + } + + @Override + public StateMachineContext read(Project contextObj) { + return new DefaultStateMachineContext<>(ProjectStatusEnum.match(contextObj.getStatus()), + null, null, null, null); + } + }); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineJNBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineJNBuilder.java deleted file mode 100644 index 0ba5909..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineJNBuilder.java +++ /dev/null @@ -1,284 +0,0 @@ -package com.hz.pm.api.common.statemachine.builder; - -import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; -import com.hz.pm.api.common.statemachine.contant.RegionContant; -import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.Project; -import lombok.RequiredArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.StateMachineContext; -import org.springframework.statemachine.StateMachinePersist; -import org.springframework.statemachine.config.EnableStateMachine; -import org.springframework.statemachine.config.StateMachineBuilder; -import org.springframework.statemachine.persist.DefaultStateMachinePersister; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.statemachine.support.DefaultStateMachineContext; -import org.springframework.stereotype.Component; - -import java.util.EnumSet; - -/** - * 项目申报状态机 - * 景宁畲族自治县 - * @author CMM - * @since 2023/02/07 15:56 - */ -@Component -@EnableStateMachine(name= ProjectDeclareStateMachineJNBuilder.MACHINEID_TO) -@RequiredArgsConstructor -public class ProjectDeclareStateMachineJNBuilder implements ProjectDeclareStateMachineBuilder{ - private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); - private final BeanFactory beanFactory; - private Logger logger = LoggerFactory.getLogger(getClass()); - - private StateMachinePersister stateMachinePersister; - /** - * TO状态机 - */ - public final static String MACHINEID_TO = RegionContant.LS_JN_CODE; - - @Override - public StateMachine build() throws Exception { - StateMachine stateMachine = build(beanFactory); - logger.info("状态机ID:" + stateMachine.getId()); - stateMachine.start(); - return stateMachine; - } - /** - * 构建状态机 - * @param beanFactory - * @author CMM - * @since 2023/02/07 16:15 - */ - @Override - public StateMachine build(BeanFactory beanFactory) throws Exception { - StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); - builder.configureConfiguration() - .withConfiguration() - .machineId(MACHINEID_TO) - .beanFactory(beanFactory); - - builder.configureStates() - .withStates() - .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .states(EnumSet.allOf(ProjectStatusEnum.class)); - - builder.configureTransitions() - // 单位内部审核通过,从单位内部审核中到待预审 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() - // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() - // 单位内部审核中撤回,从单位内部审核中到待申报 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() - // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() - - // 待预审预审申报,从待预审到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() - // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - - // 省级部门联审通过,从省级部门联审中到省级部门联审成功 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() - // 省级部门联审通过,从省级部门联审成功到预审中 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() - // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() - // 省级部门联审中撤回,从省级部门联审中到待预审 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() - - // 预审通过,从预审中到部门联审中 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() - // 预审驳回,从预审中到预审不通过 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() - // 预审中撤回,从预审中到预审中撤回选择态 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() - // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() - ,new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() - // 预审不通过重新提交,从预审不通过到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() - // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - // 部门联审通过,从部门联审中到年度计划中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() - // 部门联审驳回,从部门联审中到部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() - // 部门联审中撤回,从部门联审中到预审中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() - // 年度计划中开启方案申报,从年度计划中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() - // 年度计划中暂缓,从年度计划中到被暂缓 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.BE_SUSPENDED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() - // 方案待申报申报方案,从方案待申报到方案评审中 - .withExternal() - .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() - // 方案评审通过,从方案评审中到待立项批复 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.TO_BE_APPROVED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() - // 方案评审驳回,从方案评审中到方案评审不通过 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() - // 方案评审中撤回,从方案评审中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() - // 方案评审不通过重新提交,从方案评审不通过到方案评审中 - .withExternal() - .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() - // 待立项批复批复,从待立项批复到待采购 - .withExternal() - .source(ProjectStatusEnum.TO_BE_APPROVED) - .target(ProjectStatusEnum.TO_BE_PURCHASED) - .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() - // 待采购采购备案,从待采购到实施中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_PURCHASED) - .target(ProjectStatusEnum.OPERATION) - .event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() - // 待开工 实施,从实施到建设中 - .withExternal() - .source(ProjectStatusEnum.OPERATION) - .target(ProjectStatusEnum.UNDER_CONSTRUCTION) - .event(ProjectStatusChangeEvent.START_TO_WORK).and() - // 建设中初验备案,从建设中到待终验 - .withExternal() - .source(ProjectStatusEnum.UNDER_CONSTRUCTION) - .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() - // 待终验终验申请,从待终验到终验审核中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() - // 终审审核通过,从终审审核中到已归档 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.ARCHIVED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() - // 终审审核不通过,从终审审核中到终审审核不通过 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() - // 终审审核中撤回,从终审审核中到待终验 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() - // 终验中 重新提交 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); - return builder.build(); - } - - /** - * 持久化配置 - * @author CMM - * @since 2023/02/07 16:22 - */ - @Bean(name = "projectDeclareStateMachineJNPersister") - @Override - public StateMachinePersister getProjectPersister() { - StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { - @Override - public void write(StateMachineContext context, Project contextObj) { - } - - @Override - public StateMachineContext read(Project contextObj) { - StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), - null, null, null, null, RegionContant.LS_JN_CODE); - return result; - } - }); - stateMachinePersister = sp; - return sp; - } - - public StateMachinePersister getStateMachinePersister(){ - return stateMachinePersister; - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineJYBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineJYBuilder.java deleted file mode 100644 index 7ceb5ca..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineJYBuilder.java +++ /dev/null @@ -1,285 +0,0 @@ -package com.hz.pm.api.common.statemachine.builder; - -import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; -import com.hz.pm.api.common.statemachine.contant.RegionContant; -import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.Project; -import lombok.RequiredArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.StateMachineContext; -import org.springframework.statemachine.StateMachinePersist; -import org.springframework.statemachine.config.EnableStateMachine; -import org.springframework.statemachine.config.StateMachineBuilder; -import org.springframework.statemachine.persist.DefaultStateMachinePersister; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.statemachine.support.DefaultStateMachineContext; -import org.springframework.stereotype.Component; - -import java.util.EnumSet; - -/** - * 项目申报状态机 - * 缙云县 - * @author CMM - * @since 2023/02/07 15:56 - */ -@Component -@EnableStateMachine(name= ProjectDeclareStateMachineJYBuilder.MACHINEID_TO) -@RequiredArgsConstructor -public class ProjectDeclareStateMachineJYBuilder implements ProjectDeclareStateMachineBuilder { - private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); - private final BeanFactory beanFactory; - private Logger logger = LoggerFactory.getLogger(getClass()); - - private StateMachinePersister stateMachinePersister; - /** - * TO状态机 - */ - public final static String MACHINEID_TO = RegionContant.LS_JY_CODE; - - @Override - public StateMachine build() throws Exception { - StateMachine stateMachine = build(beanFactory); - logger.info("状态机ID:" + stateMachine.getId()); - stateMachine.start(); - return stateMachine; - } - /** - * 构建状态机 - * @param beanFactory - * @author CMM - * @since 2023/02/07 16:15 - */ - @Override - public StateMachine build(BeanFactory beanFactory) throws Exception { - StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); - builder.configureConfiguration() - .withConfiguration() - .machineId(MACHINEID_TO) - .beanFactory(beanFactory); - - builder.configureStates() - .withStates() - .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .states(EnumSet.allOf(ProjectStatusEnum.class)); - - builder.configureTransitions() - // 单位内部审核通过,从单位内部审核中到待预审 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() - // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() - // 单位内部审核中撤回,从单位内部审核中到待申报 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() - // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() - - // 待预审预审申报,从待预审到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() - // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - - // 省级部门联审通过,从省级部门联审中到省级部门联审成功 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() - // 省级部门联审通过,从省级部门联审成功到预审中 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() - // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() - // 省级部门联审中撤回,从省级部门联审中到待预审 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() - - // 预审通过,从预审中到部门联审中 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() - // 预审驳回,从预审中到预审不通过 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() - // 预审中撤回,从预审中到预审中撤回选择态 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() - // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() - ,new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() - // 预审不通过重新提交,从预审不通过到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() - // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - // 部门联审通过,从部门联审中到年度计划中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() - // 部门联审驳回,从部门联审中到部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() - // 部门联审中撤回,从部门联审中到预审中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() - // 年度计划中开启方案申报,从年度计划中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() - // 年度计划中暂缓,从年度计划中到被暂缓 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.BE_SUSPENDED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() - // 方案待申报申报方案,从方案待申报到方案评审中 - .withExternal() - .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() - // 方案评审通过,从方案评审中到待立项批复 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.TO_BE_APPROVED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() - // 方案评审驳回,从方案评审中到方案评审不通过 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() - // 方案评审中撤回,从方案评审中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() - // 方案评审不通过重新提交,从方案评审不通过到方案评审中 - .withExternal() - .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() - // 待立项批复批复,从待立项批复到待采购 - .withExternal() - .source(ProjectStatusEnum.TO_BE_APPROVED) - .target(ProjectStatusEnum.TO_BE_PURCHASED) - .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() - // 待采购采购备案,从待采购到实施中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_PURCHASED) - .target(ProjectStatusEnum.OPERATION) - .event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() - - // 待开工 实施,从实施到建设中 - .withExternal() - .source(ProjectStatusEnum.OPERATION) - .target(ProjectStatusEnum.UNDER_CONSTRUCTION) - .event(ProjectStatusChangeEvent.START_TO_WORK).and() - // 建设中初验备案,从建设中到待终验 - .withExternal() - .source(ProjectStatusEnum.UNDER_CONSTRUCTION) - .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() - // 待终验终验申请,从待终验到终验审核中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() - // 终审审核通过,从终审审核中到已归档 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.ARCHIVED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() - // 终审审核不通过,从终审审核中到终审审核不通过 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() - // 终审审核中撤回,从终审审核中到待终验 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() - // 终验中 重新提交 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); - return builder.build(); - } - - /** - * 持久化配置 - * @author CMM - * @since 2023/02/07 16:22 - */ - @Bean(name = "projectDeclareStateMachineJYPersister") - @Override - public StateMachinePersister getProjectPersister() { - StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { - @Override - public void write(StateMachineContext context, Project contextObj) { - } - - @Override - public StateMachineContext read(Project contextObj) { - StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), - null, null, null, null, RegionContant.LS_JY_CODE); - return result; - } - }); - stateMachinePersister = sp; - return sp; - } - - public StateMachinePersister getStateMachinePersister(){ - return stateMachinePersister; - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineKFQBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineKFQBuilder.java deleted file mode 100644 index 8d983e4..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineKFQBuilder.java +++ /dev/null @@ -1,285 +0,0 @@ -package com.hz.pm.api.common.statemachine.builder; - -import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; -import com.hz.pm.api.common.statemachine.contant.RegionContant; -import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.Project; -import lombok.RequiredArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.StateMachineContext; -import org.springframework.statemachine.StateMachinePersist; -import org.springframework.statemachine.config.EnableStateMachine; -import org.springframework.statemachine.config.StateMachineBuilder; -import org.springframework.statemachine.persist.DefaultStateMachinePersister; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.statemachine.support.DefaultStateMachineContext; -import org.springframework.stereotype.Component; - -import java.util.EnumSet; - -/** - * 项目申报状态机 - * 开发区 - * @author CMM - * @since 2023/02/07 15:56 - */ -@Component -@EnableStateMachine(name= ProjectDeclareStateMachineKFQBuilder.MACHINEID_TO) -@RequiredArgsConstructor -public class ProjectDeclareStateMachineKFQBuilder implements ProjectDeclareStateMachineBuilder { - private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); - private final BeanFactory beanFactory; - private Logger logger = LoggerFactory.getLogger(getClass()); - - private StateMachinePersister stateMachinePersister; - /** - * TO状态机 - */ - public final static String MACHINEID_TO = RegionContant.LS_KFQ_CODE; - - @Override - public StateMachine build() throws Exception { - StateMachine stateMachine = build(beanFactory); - logger.info("状态机ID:" + stateMachine.getId()); - stateMachine.start(); - return stateMachine; - } - /** - * 构建状态机 - * @param beanFactory - * @author CMM - * @since 2023/02/07 16:15 - */ - @Override - public StateMachine build(BeanFactory beanFactory) throws Exception { - StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); - builder.configureConfiguration() - .withConfiguration() - .machineId(MACHINEID_TO) - .beanFactory(beanFactory); - - builder.configureStates() - .withStates() - .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .states(EnumSet.allOf(ProjectStatusEnum.class)); - - builder.configureTransitions() - // 单位内部审核通过,从单位内部审核中到待预审 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() - // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() - // 单位内部审核中撤回,从单位内部审核中到待申报 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() - // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() - - // 待预审预审申报,从待预审到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() - // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - - // 省级部门联审通过,从省级部门联审中到省级部门联审成功 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() - // 省级部门联审通过,从省级部门联审成功到预审中 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() - // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() - // 省级部门联审中撤回,从省级部门联审中到待预审 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() - - // 预审通过,从预审中到部门联审中 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() - // 预审驳回,从预审中到预审不通过 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() - // 预审中撤回,从预审中到预审中撤回选择态 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() - // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() - ,new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() - // 预审不通过重新提交,从预审不通过到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() - // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - // 部门联审通过,从部门联审中到年度计划中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() - // 部门联审驳回,从部门联审中到部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() - // 部门联审中撤回,从部门联审中到预审中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() - // 年度计划中开启方案申报,从年度计划中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() - // 年度计划中暂缓,从年度计划中到被暂缓 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.BE_SUSPENDED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() - // 方案待申报申报方案,从方案待申报到方案评审中 - .withExternal() - .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() - // 方案评审通过,从方案评审中到待立项批复 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.TO_BE_APPROVED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() - // 方案评审驳回,从方案评审中到方案评审不通过 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() - // 方案评审中撤回,从方案评审中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() - // 方案评审不通过重新提交,从方案评审不通过到方案评审中 - .withExternal() - .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() - // 待立项批复批复,从待立项批复到待采购 - .withExternal() - .source(ProjectStatusEnum.TO_BE_APPROVED) - .target(ProjectStatusEnum.TO_BE_PURCHASED) - .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() - // 待采购采购备案,从待采购到实施中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_PURCHASED) - .target(ProjectStatusEnum.OPERATION) - .event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() - - // 待开工 实施,从实施到建设中 - .withExternal() - .source(ProjectStatusEnum.OPERATION) - .target(ProjectStatusEnum.UNDER_CONSTRUCTION) - .event(ProjectStatusChangeEvent.START_TO_WORK).and() - // 建设中初验备案,从建设中到待终验 - .withExternal() - .source(ProjectStatusEnum.UNDER_CONSTRUCTION) - .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() - // 待终验终验申请,从待终验到终验审核中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() - // 终审审核通过,从终审审核中到已归档 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.ARCHIVED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() - // 终审审核不通过,从终审审核中到终审审核不通过 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() - // 终审审核中撤回,从终审审核中到待终验 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() - // 终验中 重新提交 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); - return builder.build(); - } - - /** - * 持久化配置 - * @author CMM - * @since 2023/02/07 16:22 - */ - @Bean(name = "projectDeclareStateMachineKFQPersister") - @Override - public StateMachinePersister getProjectPersister() { - StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { - @Override - public void write(StateMachineContext context, Project contextObj) { - } - - @Override - public StateMachineContext read(Project contextObj) { - StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), - null, null, null, null, RegionContant.LS_KFQ_CODE); - return result; - } - }); - stateMachinePersister = sp; - return sp; - } - - public StateMachinePersister getStateMachinePersister(){ - return stateMachinePersister; - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineLDBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineLDBuilder.java deleted file mode 100644 index 55afce7..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineLDBuilder.java +++ /dev/null @@ -1,285 +0,0 @@ -package com.hz.pm.api.common.statemachine.builder; - -import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; -import com.hz.pm.api.common.statemachine.contant.RegionContant; -import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.Project; -import lombok.RequiredArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.StateMachineContext; -import org.springframework.statemachine.StateMachinePersist; -import org.springframework.statemachine.config.EnableStateMachine; -import org.springframework.statemachine.config.StateMachineBuilder; -import org.springframework.statemachine.persist.DefaultStateMachinePersister; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.statemachine.support.DefaultStateMachineContext; -import org.springframework.stereotype.Component; - -import java.util.EnumSet; - -/** - * 项目申报状态机 - * 莲都区 - * @author CMM - * @since 2023/02/07 15:56 - */ -@Component -@EnableStateMachine(name= ProjectDeclareStateMachineLDBuilder.MACHINEID_TO) -@RequiredArgsConstructor -public class ProjectDeclareStateMachineLDBuilder implements ProjectDeclareStateMachineBuilder { - private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); - private final BeanFactory beanFactory; - - private StateMachinePersister stateMachinePersister; - private Logger logger = LoggerFactory.getLogger(getClass()); - /** - * TO状态机 - */ - public final static String MACHINEID_TO = RegionContant.LS_LD_CODE; - - @Override - public StateMachine build() throws Exception { - StateMachine stateMachine = build(beanFactory); - logger.info("状态机ID:" + stateMachine.getId()); - stateMachine.start(); - return stateMachine; - } - /** - * 构建状态机 - * @param beanFactory - * @author CMM - * @since 2023/02/07 16:15 - */ - @Override - public StateMachine build(BeanFactory beanFactory) throws Exception { - StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); - builder.configureConfiguration() - .withConfiguration() - .machineId(MACHINEID_TO) - .beanFactory(beanFactory); - - builder.configureStates() - .withStates() - .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .states(EnumSet.allOf(ProjectStatusEnum.class)); - - builder.configureTransitions() - // 单位内部审核通过,从单位内部审核中到待预审 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() - // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() - // 单位内部审核中撤回,从单位内部审核中到待申报 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() - // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() - - // 待预审预审申报,从待预审到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() - // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - - // 省级部门联审通过,从省级部门联审中到省级部门联审成功 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() - // 省级部门联审通过,从省级部门联审成功到预审中 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() - // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() - // 省级部门联审中撤回,从省级部门联审中到待预审 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() - - // 预审通过,从预审中到部门联审中 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() - // 预审驳回,从预审中到预审不通过 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() - // 预审中撤回,从预审中到预审中撤回选择态 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() - // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() - ,new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() - // 预审不通过重新提交,从预审不通过到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() - // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - // 部门联审通过,从部门联审中到年度计划中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() - // 部门联审驳回,从部门联审中到部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() - // 部门联审中撤回,从部门联审中到预审中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() - // 年度计划中开启方案申报,从年度计划中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() - // 年度计划中暂缓,从年度计划中到被暂缓 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.BE_SUSPENDED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() - // 方案待申报申报方案,从方案待申报到方案评审中 - .withExternal() - .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() - // 方案评审通过,从方案评审中到待立项批复 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.TO_BE_APPROVED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() - // 方案评审驳回,从方案评审中到方案评审不通过 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() - // 方案评审中撤回,从方案评审中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() - // 方案评审不通过重新提交,从方案评审不通过到方案评审中 - .withExternal() - .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() - // 待立项批复批复,从待立项批复到待采购 - .withExternal() - .source(ProjectStatusEnum.TO_BE_APPROVED) - .target(ProjectStatusEnum.TO_BE_PURCHASED) - .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() - // 待采购采购备案,从待采购到实施中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_PURCHASED) - .target(ProjectStatusEnum.OPERATION) - .event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() - - // 待开工 实施,从实施到建设中 - .withExternal() - .source(ProjectStatusEnum.OPERATION) - .target(ProjectStatusEnum.UNDER_CONSTRUCTION) - .event(ProjectStatusChangeEvent.START_TO_WORK).and() - // 建设中初验备案,从建设中到待终验 - .withExternal() - .source(ProjectStatusEnum.UNDER_CONSTRUCTION) - .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() - // 待终验终验申请,从待终验到终验审核中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() - // 终审审核通过,从终审审核中到已归档 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.ARCHIVED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() - // 终审审核不通过,从终审审核中到终审审核不通过 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() - // 终审审核中撤回,从终审审核中到待终验 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() - // 终验中 重新提交 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); - return builder.build(); - } - - /** - * 持久化配置 - * @author CMM - * @since 2023/02/07 16:22 - */ - @Bean(name = "projectDeclareStateMachineLDPersister") - @Override - public StateMachinePersister getProjectPersister() { - StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { - @Override - public void write(StateMachineContext context, Project contextObj) { - } - - @Override - public StateMachineContext read(Project contextObj) { - StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), - null, null, null, null, RegionContant.LS_LD_CODE); - return result; - } - }); - stateMachinePersister = sp; - return sp; - } - - public StateMachinePersister getStateMachinePersister(){ - return stateMachinePersister; - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineLQBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineLQBuilder.java deleted file mode 100644 index d539c3c..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineLQBuilder.java +++ /dev/null @@ -1,286 +0,0 @@ -package com.hz.pm.api.common.statemachine.builder; - -import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; -import com.hz.pm.api.common.statemachine.contant.RegionContant; -import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.Project; -import lombok.RequiredArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.StateMachineContext; -import org.springframework.statemachine.StateMachinePersist; -import org.springframework.statemachine.config.EnableStateMachine; -import org.springframework.statemachine.config.StateMachineBuilder; -import org.springframework.statemachine.persist.DefaultStateMachinePersister; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.statemachine.support.DefaultStateMachineContext; -import org.springframework.stereotype.Component; - -import java.util.EnumSet; - -/** - * 项目申报状态机 - * 龙泉市 - * @author CMM - * @since 2023/02/07 15:56 - */ -@Component -@EnableStateMachine(name= ProjectDeclareStateMachineLQBuilder.MACHINEID_TO) -@RequiredArgsConstructor -public class ProjectDeclareStateMachineLQBuilder implements ProjectDeclareStateMachineBuilder { - private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); - private final BeanFactory beanFactory; - - private StateMachinePersister stateMachinePersister; - private Logger logger = LoggerFactory.getLogger(getClass()); - /** - * TO状态机 - */ - public final static String MACHINEID_TO = RegionContant.LS_LQ_CODE; - - @Override - public StateMachine build() throws Exception { - StateMachine stateMachine = build(beanFactory); - logger.info("状态机ID:" + stateMachine.getId()); - stateMachine.start(); - return stateMachine; - } - /** - * 构建状态机 - * @param beanFactory - * @author CMM - * @since 2023/02/07 16:15 - */ - @Override - public StateMachine build(BeanFactory beanFactory) throws Exception { - StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); - builder.configureConfiguration() - .withConfiguration() - .machineId(MACHINEID_TO) - .beanFactory(beanFactory); - - builder.configureStates() - .withStates() - .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .states(EnumSet.allOf(ProjectStatusEnum.class)); - - builder.configureTransitions() - // 单位内部审核通过,从单位内部审核中到待预审 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() - // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() - // 单位内部审核中撤回,从单位内部审核中到待申报 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() - // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() - - // 待预审预审申报,从待预审到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() - // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - - // 省级部门联审通过,从省级部门联审中到省级部门联审成功 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() - // 省级部门联审通过,从省级部门联审成功到预审中 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() - // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() - // 省级部门联审中撤回,从省级部门联审中到待预审 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() - - // 预审通过,从预审中到部门联审中 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() - // 预审驳回,从预审中到预审不通过 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() - // 预审中撤回,从预审中到预审中撤回选择态 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() - // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() - ,new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() - // 预审不通过重新提交,从预审不通过到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() - // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - // 部门联审通过,从部门联审中到 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() - // 部门联审驳回,从部门联审中到部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() - // 部门联审中撤回,从部门联审中到预审中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() - - // 年度计划中开启方案申报,从年度计划中到立项批复 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.TO_BE_APPROVED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() - // 年度计划中暂缓,从年度计划中到被暂缓 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.BE_SUSPENDED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() - // 方案待申报申报方案,从方案待申报到方案评审中 - .withExternal() - .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() - // 方案评审通过,从方案评审中到待立项批复 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() - // 方案评审驳回,从方案评审中到方案评审不通过 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() - // 方案评审中撤回,从方案评审中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() - // 方案评审不通过重新提交,从方案评审不通过到方案评审中 - .withExternal() - .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() - // 待立项批复批复,从待立项批复到待采购 - .withExternal() - .source(ProjectStatusEnum.TO_BE_APPROVED) - .target(ProjectStatusEnum.TO_BE_PURCHASED) - .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() - // 待采购采购备案,从待采购到实施中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_PURCHASED) - .target(ProjectStatusEnum.OPERATION) - .event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() - - // 待开工 实施,从实施到建设中 - .withExternal() - .source(ProjectStatusEnum.OPERATION) - .target(ProjectStatusEnum.UNDER_CONSTRUCTION) - .event(ProjectStatusChangeEvent.START_TO_WORK).and() - // 建设中初验备案,从建设中到待终验 - .withExternal() - .source(ProjectStatusEnum.UNDER_CONSTRUCTION) - .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() - // 待终验终验申请,从待终验到终验审核中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() - // 终审审核通过,从终审审核中到已归档 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.ARCHIVED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() - // 终审审核不通过,从终审审核中到终审审核不通过 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() - // 终审审核中撤回,从终审审核中到待终验 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() - // 终验中 重新提交 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); - return builder.build(); - } - - /** - * 持久化配置 - * @author CMM - * @since 2023/02/07 16:22 - */ - @Bean(name = "projectDeclareStateMachineLQPersister") - @Override - public StateMachinePersister getProjectPersister() { - StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { - @Override - public void write(StateMachineContext context, Project contextObj) { - logger.info(contextObj.toString()); - } - - @Override - public StateMachineContext read(Project contextObj) { - return new DefaultStateMachineContext<>(ProjectStatusEnum.match(contextObj.getStatus()), - null, null, null, null, RegionContant.LS_LQ_CODE); - } - }); - stateMachinePersister = sp; - return sp; - } - - public StateMachinePersister getStateMachinePersister(){ - return stateMachinePersister; - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineQTBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineQTBuilder.java deleted file mode 100644 index d50ee0d..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineQTBuilder.java +++ /dev/null @@ -1,285 +0,0 @@ -package com.hz.pm.api.common.statemachine.builder; - -import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; -import com.hz.pm.api.common.statemachine.contant.RegionContant; -import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.Project; -import lombok.RequiredArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.StateMachineContext; -import org.springframework.statemachine.StateMachinePersist; -import org.springframework.statemachine.config.EnableStateMachine; -import org.springframework.statemachine.config.StateMachineBuilder; -import org.springframework.statemachine.persist.DefaultStateMachinePersister; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.statemachine.support.DefaultStateMachineContext; -import org.springframework.stereotype.Component; - -import java.util.EnumSet; - -/** - * 项目申报状态机 - * 青田县 - * @author CMM - * @since 2023/02/07 15:56 - */ -@Component -@EnableStateMachine(name= ProjectDeclareStateMachineQTBuilder.MACHINEID_TO) -@RequiredArgsConstructor -public class ProjectDeclareStateMachineQTBuilder implements ProjectDeclareStateMachineBuilder { - private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); - private final BeanFactory beanFactory; - - private StateMachinePersister stateMachinePersister; - private Logger logger = LoggerFactory.getLogger(getClass()); - /** - * TO状态机 - */ - public final static String MACHINEID_TO = RegionContant.LS_QT_CODE; - - @Override - public StateMachine build() throws Exception { - StateMachine stateMachine = build(beanFactory); - logger.info("状态机ID:" + stateMachine.getId()); - stateMachine.start(); - return stateMachine; - } - /** - * 构建状态机 - * @param beanFactory - * @author CMM - * @since 2023/02/07 16:15 - */ - @Override - public StateMachine build(BeanFactory beanFactory) throws Exception { - StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); - builder.configureConfiguration() - .withConfiguration() - .machineId(MACHINEID_TO) - .beanFactory(beanFactory); - - builder.configureStates() - .withStates() - .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .states(EnumSet.allOf(ProjectStatusEnum.class)); - - builder.configureTransitions() - // 单位内部审核通过,从单位内部审核中到待预审 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() - // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() - // 单位内部审核中撤回,从单位内部审核中到待申报 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() - // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() - - // 待预审预审申报,从待预审到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() - // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - - // 省级部门联审通过,从省级部门联审中到省级部门联审成功 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() - // 省级部门联审通过,从省级部门联审成功到预审中 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() - // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() - // 省级部门联审中撤回,从省级部门联审中到待预审 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() - - // 预审通过,从预审中到部门联审中 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() - // 预审驳回,从预审中到预审不通过 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() - // 预审中撤回,从预审中到预审中撤回选择态 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() - // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() - ,new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() - // 预审不通过重新提交,从预审不通过到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() - // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - // 部门联审通过,从部门联审中到年度计划中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() - // 部门联审驳回,从部门联审中到部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() - // 部门联审中撤回,从部门联审中到预审中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() - // 年度计划中开启方案申报,从年度计划中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() - // 年度计划中暂缓,从年度计划中到被暂缓 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.BE_SUSPENDED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() - // 方案待申报申报方案,从方案待申报到方案评审中 - .withExternal() - .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() - // 方案评审通过,从方案评审中到待立项批复 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.TO_BE_APPROVED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() - // 方案评审驳回,从方案评审中到方案评审不通过 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() - // 方案评审中撤回,从方案评审中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() - // 方案评审不通过重新提交,从方案评审不通过到方案评审中 - .withExternal() - .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() - // 待立项批复批复,从待立项批复到待采购 - .withExternal() - .source(ProjectStatusEnum.TO_BE_APPROVED) - .target(ProjectStatusEnum.TO_BE_PURCHASED) - .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() - // 待采购采购备案,从待采购到实施中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_PURCHASED) - .target(ProjectStatusEnum.OPERATION) - .event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() - - // 待开工 实施,从实施到建设中 - .withExternal() - .source(ProjectStatusEnum.OPERATION) - .target(ProjectStatusEnum.UNDER_CONSTRUCTION) - .event(ProjectStatusChangeEvent.START_TO_WORK).and() - // 建设中初验备案,从建设中到待终验 - .withExternal() - .source(ProjectStatusEnum.UNDER_CONSTRUCTION) - .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() - // 待终验终验申请,从待终验到终验审核中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() - // 终审审核通过,从终审审核中到已归档 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.ARCHIVED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() - // 终审审核不通过,从终审审核中到终审审核不通过 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() - // 终审审核中撤回,从终审审核中到待终验 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() - // 终验中 重新提交 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); - return builder.build(); - } - - /** - * 持久化配置 - * @author CMM - * @since 2023/02/07 16:22 - */ - @Bean(name = "projectDeclareStateMachineQTPersister") - @Override - public StateMachinePersister getProjectPersister() { - StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { - @Override - public void write(StateMachineContext context, Project contextObj) { - } - - @Override - public StateMachineContext read(Project contextObj) { - StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), - null, null, null, null, RegionContant.LS_QT_CODE); - return result; - } - }); - stateMachinePersister = sp; - return sp; - } - - public StateMachinePersister getStateMachinePersister(){ - return stateMachinePersister; - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineQYBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineQYBuilder.java deleted file mode 100644 index be23bd9..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineQYBuilder.java +++ /dev/null @@ -1,285 +0,0 @@ -package com.hz.pm.api.common.statemachine.builder; - -import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; -import com.hz.pm.api.common.statemachine.contant.RegionContant; -import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.Project; -import lombok.RequiredArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.StateMachineContext; -import org.springframework.statemachine.StateMachinePersist; -import org.springframework.statemachine.config.EnableStateMachine; -import org.springframework.statemachine.config.StateMachineBuilder; -import org.springframework.statemachine.persist.DefaultStateMachinePersister; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.statemachine.support.DefaultStateMachineContext; -import org.springframework.stereotype.Component; - -import java.util.EnumSet; - -/** - * 项目申报状态机 - * 庆元县 - * @author CMM - * @since 2023/02/07 15:56 - */ -@Component -@EnableStateMachine(name= ProjectDeclareStateMachineQYBuilder.MACHINEID_TO) -@RequiredArgsConstructor -public class ProjectDeclareStateMachineQYBuilder implements ProjectDeclareStateMachineBuilder { - private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); - private final BeanFactory beanFactory; - - private StateMachinePersister stateMachinePersister; - private Logger logger = LoggerFactory.getLogger(getClass()); - /** - * TO状态机 - */ - public final static String MACHINEID_TO = RegionContant.LS_QY_CODE; - - @Override - public StateMachine build() throws Exception { - StateMachine stateMachine = build(beanFactory); - logger.info("状态机ID:" + stateMachine.getId()); - stateMachine.start(); - return stateMachine; - } - /** - * 构建状态机 - * @param beanFactory - * @author CMM - * @since 2023/02/07 16:15 - */ - @Override - public StateMachine build(BeanFactory beanFactory) throws Exception { - StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); - builder.configureConfiguration() - .withConfiguration() - .machineId(MACHINEID_TO) - .beanFactory(beanFactory); - - builder.configureStates() - .withStates() - .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .states(EnumSet.allOf(ProjectStatusEnum.class)); - - builder.configureTransitions() - // 单位内部审核通过,从单位内部审核中到待预审 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() - // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() - // 单位内部审核中撤回,从单位内部审核中到待申报 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() - // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() - - // 待预审预审申报,从待预审到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() - // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - - // 省级部门联审通过,从省级部门联审中到省级部门联审成功 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() - // 省级部门联审通过,从省级部门联审成功到预审中 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() - // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() - // 省级部门联审中撤回,从省级部门联审中到待预审 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() - - // 预审通过,从预审中到部门联审中 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() - // 预审驳回,从预审中到预审不通过 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() - // 预审中撤回,从预审中到预审中撤回选择态 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() - // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() - ,new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() - // 预审不通过重新提交,从预审不通过到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() - // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - // 部门联审通过,从部门联审中到年度计划中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() - // 部门联审驳回,从部门联审中到部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() - // 部门联审中撤回,从部门联审中到预审中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() - // 年度计划中开启方案申报,从年度计划中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() - // 年度计划中暂缓,从年度计划中到被暂缓 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.BE_SUSPENDED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() - // 方案待申报申报方案,从方案待申报到方案评审中 - .withExternal() - .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() - // 方案评审通过,从方案评审中到待立项批复 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.TO_BE_APPROVED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() - // 方案评审驳回,从方案评审中到方案评审不通过 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() - // 方案评审中撤回,从方案评审中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() - // 方案评审不通过重新提交,从方案评审不通过到方案评审中 - .withExternal() - .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() - // 待立项批复批复,从待立项批复到待采购 - .withExternal() - .source(ProjectStatusEnum.TO_BE_APPROVED) - .target(ProjectStatusEnum.TO_BE_PURCHASED) - .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() - // 待采购采购备案,从待采购到实施中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_PURCHASED) - .target(ProjectStatusEnum.OPERATION) - .event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() - - // 待开工 实施,从实施到建设中 - .withExternal() - .source(ProjectStatusEnum.OPERATION) - .target(ProjectStatusEnum.UNDER_CONSTRUCTION) - .event(ProjectStatusChangeEvent.START_TO_WORK).and() - // 建设中初验备案,从建设中到待终验 - .withExternal() - .source(ProjectStatusEnum.UNDER_CONSTRUCTION) - .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() - // 待终验终验申请,从待终验到终验审核中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() - // 终审审核通过,从终审审核中到已归档 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.ARCHIVED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() - // 终审审核不通过,从终审审核中到终审审核不通过 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() - // 终审审核中撤回,从终审审核中到待终验 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() - // 终验中 重新提交 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); - return builder.build(); - } - - /** - * 持久化配置 - * @author CMM - * @since 2023/02/07 16:22 - */ - @Bean(name = "projectDeclareStateMachineQYPersister") - @Override - public StateMachinePersister getProjectPersister() { - StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { - @Override - public void write(StateMachineContext context, Project contextObj) { - } - - @Override - public StateMachineContext read(Project contextObj) { - StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), - null, null, null, null, RegionContant.LS_QY_CODE); - return result; - } - }); - stateMachinePersister = sp; - return sp; - } - - public StateMachinePersister getStateMachinePersister(){ - return stateMachinePersister; - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSBJBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSBJBuilder.java deleted file mode 100644 index 75e600a..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSBJBuilder.java +++ /dev/null @@ -1,285 +0,0 @@ -package com.hz.pm.api.common.statemachine.builder; - -import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; -import com.hz.pm.api.common.statemachine.contant.RegionContant; -import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.Project; -import lombok.RequiredArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.StateMachineContext; -import org.springframework.statemachine.StateMachinePersist; -import org.springframework.statemachine.config.EnableStateMachine; -import org.springframework.statemachine.config.StateMachineBuilder; -import org.springframework.statemachine.persist.DefaultStateMachinePersister; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.statemachine.support.DefaultStateMachineContext; -import org.springframework.stereotype.Component; - -import java.util.EnumSet; - -/** - * 项目申报状态机 - * 市本级 - * @author CMM - * @since 2023/02/07 15:56 - */ -@Component -@EnableStateMachine(name= ProjectDeclareStateMachineSBJBuilder.MACHINEID_TO) -@RequiredArgsConstructor -public class ProjectDeclareStateMachineSBJBuilder implements ProjectDeclareStateMachineBuilder { - private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); - private final BeanFactory beanFactory; - - private StateMachinePersister stateMachinePersister; - private Logger logger = LoggerFactory.getLogger(getClass()); - /** - * TO状态机 - */ - public final static String MACHINEID_TO = RegionContant.LS_SBJ_CODE; - - @Override - public StateMachine build() throws Exception { - StateMachine stateMachine = build(beanFactory); - logger.info("状态机ID:" + stateMachine.getId()); - stateMachine.start(); - return stateMachine; - } - /** - * 构建状态机 - * @param beanFactory - * @author CMM - * @since 2023/02/07 16:15 - */ - @Override - public StateMachine build(BeanFactory beanFactory) throws Exception { - StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); - builder.configureConfiguration() - .withConfiguration() - .machineId(MACHINEID_TO) - .beanFactory(beanFactory); - - builder.configureStates() - .withStates() - .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .states(EnumSet.allOf(ProjectStatusEnum.class)); - - builder.configureTransitions() - // 单位内部审核通过,从单位内部审核中到待预审 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() - // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() - // 单位内部审核中撤回,从单位内部审核中到待申报 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() - // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() - - // 待预审预审申报,从待预审到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() - // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - - // 省级部门联审通过,从省级部门联审中到省级部门联审成功 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() - // 省级部门联审通过,从省级部门联审成功到预审中 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() - // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() - // 省级部门联审中撤回,从省级部门联审中到待预审 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() - - // 预审通过,从预审中到部门联审中 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() - // 预审驳回,从预审中到预审不通过 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() - // 预审中撤回,从预审中到预审中撤回选择态 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() - // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() - ,new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() - // 预审不通过重新提交,从预审不通过到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() - // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - // 部门联审通过,从部门联审中到年度计划中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() - // 部门联审驳回,从部门联审中到部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() - // 部门联审中撤回,从部门联审中到预审中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() - // 年度计划中开启方案申报,从年度计划中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() - // 年度计划中暂缓,从年度计划中到被暂缓 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.BE_SUSPENDED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() - // 方案待申报申报方案,从方案待申报到方案评审中 - .withExternal() - .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() - // 方案评审通过,从方案评审中到待立项批复 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.TO_BE_APPROVED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() - // 方案评审驳回,从方案评审中到方案评审不通过 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() - // 方案评审中撤回,从方案评审中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() - // 方案评审不通过重新提交,从方案评审不通过到方案评审中 - .withExternal() - .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() - // 待立项批复批复,从待立项批复到待采购 - .withExternal() - .source(ProjectStatusEnum.TO_BE_APPROVED) - .target(ProjectStatusEnum.TO_BE_PURCHASED) - .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() - // 待采购采购备案,从待采购到实施中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_PURCHASED) - .target(ProjectStatusEnum.OPERATION) - .event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() - - // 待开工 实施,从实施到建设中 - .withExternal() - .source(ProjectStatusEnum.OPERATION) - .target(ProjectStatusEnum.UNDER_CONSTRUCTION) - .event(ProjectStatusChangeEvent.START_TO_WORK).and() - // 建设中初验备案,从建设中到待终验 - .withExternal() - .source(ProjectStatusEnum.UNDER_CONSTRUCTION) - .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() - // 待终验终验申请,从待终验到终验审核中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() - // 终审审核通过,从终审审核中到已归档 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.ARCHIVED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() - // 终审审核不通过,从终审审核中到终审审核不通过 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() - // 终审审核中撤回,从终审审核中到待终验 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() - // 终验中 重新提交 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); - return builder.build(); - } - - /** - * 持久化配置 - * @author CMM - * @since 2023/02/07 16:22 - */ - @Bean(name = "projectDeclareStateMachineSBJPersister") - @Override - public StateMachinePersister getProjectPersister() { - StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { - @Override - public void write(StateMachineContext context, Project contextObj) { - } - - @Override - public StateMachineContext read(Project contextObj) { - StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), - null, null, null, null, RegionContant.LS_SBJ_CODE); - return result; - } - }); - stateMachinePersister = sp; - return sp; - } - - public StateMachinePersister getStateMachinePersister(){ - return stateMachinePersister; - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSCBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSCBuilder.java deleted file mode 100644 index 174e05e..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSCBuilder.java +++ /dev/null @@ -1,295 +0,0 @@ -package com.hz.pm.api.common.statemachine.builder; - -import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; -import com.hz.pm.api.common.statemachine.contant.RegionContant; -import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.Project; -import lombok.RequiredArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.StateMachineContext; -import org.springframework.statemachine.StateMachinePersist; -import org.springframework.statemachine.config.EnableStateMachine; -import org.springframework.statemachine.config.StateMachineBuilder; -import org.springframework.statemachine.persist.DefaultStateMachinePersister; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.statemachine.support.DefaultStateMachineContext; -import org.springframework.stereotype.Component; - -import java.util.EnumSet; - -/** - * 项目申报状态机 - * 遂昌县 - * @author CMM - * @since 2023/02/07 15:56 - */ -@Component -@EnableStateMachine(name= ProjectDeclareStateMachineSCBuilder.MACHINEID_TO) -@RequiredArgsConstructor -public class ProjectDeclareStateMachineSCBuilder implements ProjectDeclareStateMachineBuilder{ - private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); - private final BeanFactory beanFactory; - - private StateMachinePersister stateMachinePersister; - private Logger logger = LoggerFactory.getLogger(getClass()); - /** - * TO状态机 - */ - public final static String MACHINEID_TO = RegionContant.LS_SC_CODE; - - @Override - public StateMachine build() throws Exception { - StateMachine stateMachine = build(beanFactory); - logger.info("状态机ID:" + stateMachine.getId()); - stateMachine.start(); - return stateMachine; - } - /** - * 构建状态机 - * @param beanFactory - * @author CMM - * @since 2023/02/07 16:15 - */ - @Override - public StateMachine build(BeanFactory beanFactory) throws Exception { - StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); - builder.configureConfiguration() - .withConfiguration() - .machineId(MACHINEID_TO) - .beanFactory(beanFactory); - - builder.configureStates() - .withStates() - .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .choice(ProjectStatusEnum.APPROVED_AFTER_CHOICE) - .states(EnumSet.allOf(ProjectStatusEnum.class)); - - builder.configureTransitions() - // 单位内部审核通过,从单位内部审核中到待预审 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() - // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() - // 单位内部审核中撤回,从单位内部审核中到待申报 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() - // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() - - // 待预审预审申报,从待预审到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() - // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - - // 省级部门联审通过,从省级部门联审中到省级部门联审成功 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() - // 省级部门联审通过,从省级部门联审成功到预审中 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() - // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() - // 省级部门联审中撤回,从省级部门联审中到待预审 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() - - // 预审通过,从预审中到部门联审中 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() - // 预审驳回,从预审中到预审不通过 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() - // 预审中撤回,从预审中到预审中撤回选择态 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() - // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() - ,new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() - // 预审不通过重新提交,从预审不通过到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() - // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - // 部门联审通过,从部门联审中到年度计划中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() - // 部门联审驳回,从部门联审中到部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() - // 部门联审中撤回,从部门联审中到预审中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() - // 年度计划中开启方案申报,从年度计划中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() - // 年度计划中暂缓,从年度计划中到被暂缓 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.BE_SUSPENDED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() - // 方案待申报申报方案,从方案待申报到方案评审中 - .withExternal() - .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() - // 方案评审通过,从方案评审中到待立项批复 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.TO_BE_APPROVED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() - // 方案评审驳回,从方案评审中到方案评审不通过 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() - // 方案评审中撤回,从方案评审中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() - // 方案评审不通过重新提交,从方案评审不通过到方案评审中 - .withExternal() - .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() - // 待立项批复批复,从待立项批复到待采购 - .withExternal() - .source(ProjectStatusEnum.TO_BE_APPROVED) - .target(ProjectStatusEnum.APPROVED_AFTER_CHOICE) - .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() - .withChoice() - .source(ProjectStatusEnum.APPROVED_AFTER_CHOICE) - .first(ProjectStatusEnum.TO_BE_APP_REGISTER,projectDeclareGuardFactory.new ApprovedAfterChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.TO_BE_PURCHASED,new ProjectDeclareChoiceAction()).and() - //待所有应用都注册 并且 绑定了关系后 再进入下一状态 待采购 - .withExternal() - .source(ProjectStatusEnum.TO_BE_APP_REGISTER) - .target(ProjectStatusEnum.TO_BE_PURCHASED) - .event(ProjectStatusChangeEvent.REGISTER_APP).and() - // 待采购采购备案,从待采购到实施中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_PURCHASED) - .target(ProjectStatusEnum.OPERATION) - .event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() - - // 待开工 实施,从实施到建设中 - .withExternal() - .source(ProjectStatusEnum.OPERATION) - .target(ProjectStatusEnum.UNDER_CONSTRUCTION) - .event(ProjectStatusChangeEvent.START_TO_WORK).and() - // 建设中初验备案,从建设中到待终验 - .withExternal() - .source(ProjectStatusEnum.UNDER_CONSTRUCTION) - .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() - // 待终验终验申请,从待终验到终验审核中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() - // 终审审核通过,从终审审核中到已归档 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.ARCHIVED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() - // 终审审核不通过,从终审审核中到终审审核不通过 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() - // 终审审核中撤回,从终审审核中到待终验 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() - // 终验中 重新提交 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); - return builder.build(); - } - - /** - * 持久化配置 - * @author CMM - * @since 2023/02/07 16:22 - */ - @Bean(name = "projectDeclareStateMachineSCPersister") - @Override - public StateMachinePersister getProjectPersister() { - StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { - @Override - public void write(StateMachineContext context, Project contextObj) { - } - - @Override - public StateMachineContext read(Project contextObj) { - StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), - null, null, null, null, RegionContant.LS_SC_CODE); - return result; - } - }); - stateMachinePersister = sp; - return sp; - } - - public StateMachinePersister getStateMachinePersister(){ - return stateMachinePersister; - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSYBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSYBuilder.java deleted file mode 100644 index 201adc5..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineSYBuilder.java +++ /dev/null @@ -1,285 +0,0 @@ -package com.hz.pm.api.common.statemachine.builder; - -import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; -import com.hz.pm.api.common.statemachine.contant.RegionContant; -import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.Project; -import lombok.RequiredArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.StateMachineContext; -import org.springframework.statemachine.StateMachinePersist; -import org.springframework.statemachine.config.EnableStateMachine; -import org.springframework.statemachine.config.StateMachineBuilder; -import org.springframework.statemachine.persist.DefaultStateMachinePersister; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.statemachine.support.DefaultStateMachineContext; -import org.springframework.stereotype.Component; - -import java.util.EnumSet; - -/** - * 项目申报状态机 - * 松阳县 - * @author CMM - * @since 2023/02/07 15:56 - */ -@Component -@EnableStateMachine(name= ProjectDeclareStateMachineSYBuilder.MACHINEID_TO) -@RequiredArgsConstructor -public class ProjectDeclareStateMachineSYBuilder implements ProjectDeclareStateMachineBuilder { - private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); - private final BeanFactory beanFactory; - - private StateMachinePersister stateMachinePersister; - private Logger logger = LoggerFactory.getLogger(getClass()); - /** - * TO状态机 - */ - public final static String MACHINEID_TO = RegionContant.LS_SY_CODE; - - @Override - public StateMachine build() throws Exception { - StateMachine stateMachine = build(beanFactory); - logger.info("状态机ID:" + stateMachine.getId()); - stateMachine.start(); - return stateMachine; - } - /** - * 构建状态机 - * @param beanFactory - * @author CMM - * @since 2023/02/07 16:15 - */ - @Override - public StateMachine build(BeanFactory beanFactory) throws Exception { - StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); - builder.configureConfiguration() - .withConfiguration() - .machineId(MACHINEID_TO) - .beanFactory(beanFactory); - - builder.configureStates() - .withStates() - .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .states(EnumSet.allOf(ProjectStatusEnum.class)); - - builder.configureTransitions() - // 单位内部审核通过,从单位内部审核中到待预审 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() - // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() - // 单位内部审核中撤回,从单位内部审核中到待申报 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() - // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() - - // 待预审预审申报,从待预审到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() - // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - - // 省级部门联审通过,从省级部门联审中到省级部门联审成功 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() - // 省级部门联审通过,从省级部门联审成功到预审中 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() - // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() - // 省级部门联审中撤回,从省级部门联审中到待预审 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() - - // 预审通过,从预审中到部门联审中 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() - // 预审驳回,从预审中到预审不通过 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() - // 预审中撤回,从预审中到预审中撤回选择态 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() - // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() - ,new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() - // 预审不通过重新提交,从预审不通过到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() - // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - // 部门联审通过,从部门联审中到年度计划中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() - // 部门联审驳回,从部门联审中到部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() - // 部门联审中撤回,从部门联审中到预审中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() - // 年度计划中开启方案申报,从年度计划中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() - // 年度计划中暂缓,从年度计划中到被暂缓 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.BE_SUSPENDED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() - // 方案待申报申报方案,从方案待申报到方案评审中 - .withExternal() - .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() - // 方案评审通过,从方案评审中到待立项批复 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.TO_BE_APPROVED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() - // 方案评审驳回,从方案评审中到方案评审不通过 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() - // 方案评审中撤回,从方案评审中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() - // 方案评审不通过重新提交,从方案评审不通过到方案评审中 - .withExternal() - .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() - // 待立项批复批复,从待立项批复到待采购 - .withExternal() - .source(ProjectStatusEnum.TO_BE_APPROVED) - .target(ProjectStatusEnum.TO_BE_PURCHASED) - .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() - // 待采购采购备案,从待采购到实施中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_PURCHASED) - .target(ProjectStatusEnum.OPERATION) - .event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() - - // 待开工 实施,从实施到建设中 - .withExternal() - .source(ProjectStatusEnum.OPERATION) - .target(ProjectStatusEnum.UNDER_CONSTRUCTION) - .event(ProjectStatusChangeEvent.START_TO_WORK).and() - // 建设中初验备案,从建设中到待终验 - .withExternal() - .source(ProjectStatusEnum.UNDER_CONSTRUCTION) - .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() - // 待终验终验申请,从待终验到终验审核中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() - // 终审审核通过,从终审审核中到已归档 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.ARCHIVED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() - // 终审审核不通过,从终审审核中到终审审核不通过 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() - // 终审审核中撤回,从终审审核中到待终验 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() - // 终验中 重新提交 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); - return builder.build(); - } - - /** - * 持久化配置 - * @author CMM - * @since 2023/02/07 16:22 - */ - @Bean(name = "projectDeclareStateMachineSYPersister") - @Override - public StateMachinePersister getProjectPersister() { - StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { - @Override - public void write(StateMachineContext context, Project contextObj) { - } - - @Override - public StateMachineContext read(Project contextObj) { - StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), - null, null, null, null, RegionContant.LS_SY_CODE); - return result; - } - }); - stateMachinePersister = sp; - return sp; - } - - public StateMachinePersister getStateMachinePersister(){ - return stateMachinePersister; - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineYHBuilder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineYHBuilder.java deleted file mode 100644 index 343d56d..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineYHBuilder.java +++ /dev/null @@ -1,285 +0,0 @@ -package com.hz.pm.api.common.statemachine.builder; - -import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; -import com.hz.pm.api.common.statemachine.contant.RegionContant; -import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.Project; -import lombok.RequiredArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.statemachine.StateMachine; -import org.springframework.statemachine.StateMachineContext; -import org.springframework.statemachine.StateMachinePersist; -import org.springframework.statemachine.config.EnableStateMachine; -import org.springframework.statemachine.config.StateMachineBuilder; -import org.springframework.statemachine.persist.DefaultStateMachinePersister; -import org.springframework.statemachine.persist.StateMachinePersister; -import org.springframework.statemachine.support.DefaultStateMachineContext; -import org.springframework.stereotype.Component; - -import java.util.EnumSet; - -/** - * 项目申报状态机 - * 云和县 - * @author CMM - * @since 2023/02/07 15:56 - */ -@Component -@EnableStateMachine(name= ProjectDeclareStateMachineYHBuilder.MACHINEID_TO) -@RequiredArgsConstructor -public class ProjectDeclareStateMachineYHBuilder implements ProjectDeclareStateMachineBuilder { - private static final ProjectDeclareGuardFactory projectDeclareGuardFactory = new ProjectDeclareGuardFactory(); - private final BeanFactory beanFactory; - - private StateMachinePersister stateMachinePersister; - private Logger logger = LoggerFactory.getLogger(getClass()); - /** - * TO状态机 - */ - public final static String MACHINEID_TO = RegionContant.LS_YH_CODE; - - @Override - public StateMachine build() throws Exception { - StateMachine stateMachine = build(beanFactory); - logger.info("状态机ID:" + stateMachine.getId()); - stateMachine.start(); - return stateMachine; - } - /** - * 构建状态机 - * @param beanFactory - * @author CMM - * @since 2023/02/07 16:15 - */ - @Override - public StateMachine build(BeanFactory beanFactory) throws Exception { - StateMachineBuilder.Builder builder = StateMachineBuilder.builder(); - builder.configureConfiguration() - .withConfiguration() - .machineId(MACHINEID_TO) - .beanFactory(beanFactory); - - builder.configureStates() - .withStates() - .initial(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .choice(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .choice(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .states(EnumSet.allOf(ProjectStatusEnum.class)); - - builder.configureTransitions() - // 单位内部审核通过,从单位内部审核中到待预审 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_PASS).and() - // 单位内部审核驳回,从单位内部审核中到单位内部审核不通过 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT).and() - // 单位内部审核中撤回,从单位内部审核中到待申报 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .target(ProjectStatusEnum.TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_WITHDRAW).and() - // 单位内部审核不通过重新提交,从单位内部审核不通过到单位内部审核中 - .withExternal() - .source(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS) - .target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) - .event(ProjectStatusChangeEvent.UNDER_INTERNAL_REJECT_RESUBMIT).and() - - // 待预审预审申报,从待预审到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_DECLARE).and() - // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - - // 省级部门联审通过,从省级部门联审中到省级部门联审成功 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_PASS).and() - // 省级部门联审通过,从省级部门联审成功到预审中 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW).and() - // 省级部门联审不通过,从省级部门联审中到省级部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED) - .event(ProjectStatusChangeEvent.PROVINCIAL_DEPARTMENT_REVIEW_REJECT).and() - // 省级部门联审中撤回,从省级部门联审中到待预审 - .withExternal() - .source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION) - .event(ProjectStatusChangeEvent.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW).and() - - // 预审通过,从预审中到部门联审中 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_PASS).and() - // 预审驳回,从预审中到预审不通过 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT).and() - // 预审中撤回,从预审中到预审中撤回选择态 - .withExternal() - .source(ProjectStatusEnum.PRE_APPLYING) - .target(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .event(ProjectStatusChangeEvent.PRE_APPLYING_WITHDRAW).and() - // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard() - ,new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PENDING_PREQUALIFICATION,new ProjectDeclareChoiceAction()).and() - // 预审不通过重新提交,从预审不通过到待预审选择 - .withExternal() - .source(ProjectStatusEnum.PREQUALIFICATION_FAILED) - .target(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .event(ProjectStatusChangeEvent.PRELIMINARY_REVIEW_REJECT_RESUBMIT).and() - // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 - .withChoice() - .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),new ProjectDeclareChoiceAction()) - .last(ProjectStatusEnum.PRE_APPLYING,new ProjectDeclareChoiceAction()).and() - // 部门联审通过,从部门联审中到年度计划中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS).and() - // 部门联审驳回,从部门联审中到部门联审不通过 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_REJECT).and() - // 部门联审中撤回,从部门联审中到预审中 - .withExternal() - .source(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) - .target(ProjectStatusEnum.PRE_APPLYING) - .event(ProjectStatusChangeEvent.DEPARTMENT_JOINT_REVIEW_WITHDRAW).and() - // 年度计划中开启方案申报,从年度计划中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE).and() - // 年度计划中暂缓,从年度计划中到被暂缓 - .withExternal() - .source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) - .target(ProjectStatusEnum.BE_SUSPENDED) - .event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() - // 方案待申报申报方案,从方案待申报到方案评审中 - .withExternal() - .source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.DECLARE_PLAN).and() - // 方案评审通过,从方案评审中到待立项批复 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.TO_BE_APPROVED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_PASS).and() - // 方案评审驳回,从方案评审中到方案评审不通过 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT).and() - // 方案评审中撤回,从方案评审中到方案待申报 - .withExternal() - .source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .target(ProjectStatusEnum.PLAN_TO_BE_DECLARED) - .event(ProjectStatusChangeEvent.SCHEME_UNDER_REVIEW_WITHDRAW).and() - // 方案评审不通过重新提交,从方案评审不通过到方案评审中 - .withExternal() - .source(ProjectStatusEnum.SCHEME_REVIEW_FAILED) - .target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.PLAN_REVIEW_REJECT_RESUBMIT).and() - // 待立项批复批复,从待立项批复到待采购 - .withExternal() - .source(ProjectStatusEnum.TO_BE_APPROVED) - .target(ProjectStatusEnum.TO_BE_PURCHASED) - .event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() - // 待采购采购备案,从待采购到实施中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_PURCHASED) - .target(ProjectStatusEnum.OPERATION) - .event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() - - // 待开工 实施,从实施到建设中 - .withExternal() - .source(ProjectStatusEnum.OPERATION) - .target(ProjectStatusEnum.UNDER_CONSTRUCTION) - .event(ProjectStatusChangeEvent.START_TO_WORK).and() - // 建设中初验备案,从建设中到待终验 - .withExternal() - .source(ProjectStatusEnum.UNDER_CONSTRUCTION) - .target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() - // 待终验终验申请,从待终验到终验审核中 - .withExternal() - .source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() - // 终审审核通过,从终审审核中到已归档 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.ARCHIVED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS).and() - // 终审审核不通过,从终审审核中到终审审核不通过 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_REJECT).and() - // 终审审核中撤回,从终审审核中到待终验 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW).and() - // 终验中 重新提交 - .withExternal() - .source(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED) - .target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) - .event(ProjectStatusChangeEvent.FINAL_RE_ACCEPTANCE_APPLICATION).and(); - return builder.build(); - } - - /** - * 持久化配置 - * @author CMM - * @since 2023/02/07 16:22 - */ - @Bean(name = "projectDeclareStateMachineYHPersister") - @Override - public StateMachinePersister getProjectPersister() { - StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist() { - @Override - public void write(StateMachineContext context, Project contextObj) { - } - - @Override - public StateMachineContext read(Project contextObj) { - StateMachineContext result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), - null, null, null, null, RegionContant.LS_YH_CODE); - return result; - } - }); - stateMachinePersister = sp; - return sp; - } - - public StateMachinePersister getStateMachinePersister(){ - return stateMachinePersister; - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/contant/RegionContant.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/contant/RegionContant.java deleted file mode 100644 index b3684ec..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/contant/RegionContant.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.hz.pm.api.common.statemachine.contant; - -/** - * @Classname RegionContant - * @Description - * @Date 2023/6/13 13:57 - * @Author PoffyZhang - */ -public class RegionContant { - - private RegionContant() { - } - - //市本级 - public static final String LS_SBJ_CODE = "330100"; - //莲都区 - public static final String LS_LD_CODE = "331102"; - //青田县 - public static final String LS_QT_CODE = "331121"; - //缙云县 - public static final String LS_JY_CODE = "331122"; - //遂昌县 - public static final String LS_SC_CODE = "331123"; - //松阳县 - public static final String LS_SY_CODE = "331124"; - //云和县 - public static final String LS_YH_CODE = "331125"; - //庆元县 - public static final String LS_QY_CODE = "331126"; - //景宁畲族自治县 - public static final String LS_JN_CODE = "331127"; - //龙泉市 - public static final String LS_LQ_CODE = "331181"; - //开发区 - public static final String LS_KFQ_CODE = "331199"; - - public static final String MORE_CODE = "000"; -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/MachineBuilderFounder.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/MachineBuilderFounder.java deleted file mode 100644 index 433b0f8..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/MachineBuilderFounder.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.hz.pm.api.common.statemachine.util; - -import com.hz.pm.api.common.statemachine.builder.*; -import com.hz.pm.api.common.statemachine.contant.RegionContant; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; -import java.util.HashMap; -import java.util.Map; - -/** - * 项目申报状态机 - * - * @author CMM - * @since 2023/02/07 15:56 - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class MachineBuilderFounder { - - private static final Map MACHINE_BUILDER_MAP = new HashMap<>(16); - - public static ProjectDeclareStateMachineBuilder getByRegion(String regionCode) { - return MACHINE_BUILDER_MAP.get(regionCode); - } - - private final ProjectDeclareStateMachineSBJBuilder projectDeclareStateMachineSBJBuilder; - private final ProjectDeclareStateMachineLDBuilder projectDeclareStateMachineLDBuilder; - private final ProjectDeclareStateMachineQTBuilder projectDeclareStateMachineQTBuilder; - private final ProjectDeclareStateMachineJYBuilder projectDeclareStateMachineJYBuilder; - private final ProjectDeclareStateMachineSCBuilder projectDeclareStateMachineSCBuilder; - private final ProjectDeclareStateMachineSYBuilder projectDeclareStateMachineSYBuilder; - private final ProjectDeclareStateMachineYHBuilder projectDeclareStateMachineYHBuilder; - private final ProjectDeclareStateMachineQYBuilder projectDeclareStateMachineQYBuilder; - private final ProjectDeclareStateMachineJNBuilder projectDeclareStateMachineJNBuilder; - private final ProjectDeclareStateMachineLQBuilder projectDeclareStateMachineLQBuilder; - private final ProjectDeclareStateMachineKFQBuilder projectDeclareStateMachineKFQBuilder; - - @PostConstruct - public void machineBuilderFounder(){ - MACHINE_BUILDER_MAP.put(RegionContant.LS_SBJ_CODE, projectDeclareStateMachineSBJBuilder); - MACHINE_BUILDER_MAP.put(RegionContant.LS_LD_CODE, projectDeclareStateMachineLDBuilder); - MACHINE_BUILDER_MAP.put(RegionContant.LS_QT_CODE, projectDeclareStateMachineQTBuilder); - MACHINE_BUILDER_MAP.put(RegionContant.LS_JY_CODE, projectDeclareStateMachineJYBuilder); - MACHINE_BUILDER_MAP.put(RegionContant.LS_SC_CODE, projectDeclareStateMachineSCBuilder); - MACHINE_BUILDER_MAP.put(RegionContant.LS_SY_CODE, projectDeclareStateMachineSYBuilder); - MACHINE_BUILDER_MAP.put(RegionContant.LS_YH_CODE, projectDeclareStateMachineYHBuilder); - MACHINE_BUILDER_MAP.put(RegionContant.LS_QY_CODE, projectDeclareStateMachineQYBuilder); - MACHINE_BUILDER_MAP.put(RegionContant.LS_JN_CODE, projectDeclareStateMachineJNBuilder); - MACHINE_BUILDER_MAP.put(RegionContant.LS_LQ_CODE, projectDeclareStateMachineLQBuilder); - MACHINE_BUILDER_MAP.put(RegionContant.LS_KFQ_CODE, projectDeclareStateMachineKFQBuilder); - } - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtil.java index 4965c52..4266363 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtil.java @@ -1,16 +1,15 @@ package com.hz.pm.api.common.statemachine.util; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.function.VUtils; import com.hz.pm.api.common.model.constant.RegionConst; import com.hz.pm.api.common.model.constant.StateMachineConst; import com.hz.pm.api.common.statemachine.builder.ProjectDeclareStateMachineBuilder; import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; +import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; import com.hz.pm.api.projectlib.service.IProjectApplicationService; +import com.ningdatech.basic.exception.BizException; import com.wflow.exception.BusinessException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -39,6 +38,10 @@ public class StateMachineUtil { private static final String APPLICATION_DECLARE = StateMachineConst.APPLICATION_DECLARE; + //================================================================================================================== + + private final ProjectDeclareStateMachineBuilder projectDeclareStateMachineBuilder; + private final INdProjectStatusChangeService projectStatusChangeService; private final IProjectApplicationService projectApplicationService; @@ -79,17 +82,14 @@ public class StateMachineUtil { ProjectStatusChange projectStatusChange = new ProjectStatusChange(); projectStatusChange.setBeforeStatus(project.getStatus()); - ProjectDeclareStateMachineBuilder builder = MachineBuilderFounder.getByRegion(project.getAreaCode()); - - VUtils.isTrue(Objects.isNull(builder)).throwMessage("状态机初始化失败!"); - //获取TO状态机 - StateMachine stateMachine = builder.build(); + // 获取TO状态机 + StateMachine stateMachine = projectDeclareStateMachineBuilder.build(); Message message = MessageBuilder.withPayload(event) .setHeader(PROJECT_DECLARE, project) .setHeader(APPLICATION_DECLARE, projectApplicationService.getApplicationsByProject(project)) .build(); //初始化状态机 - StateMachinePersister projectDeclareStateMachinePersister = builder.getProjectPersister(); + StateMachinePersister projectDeclareStateMachinePersister = projectDeclareStateMachineBuilder.getProjectPersister(); projectDeclareStateMachinePersister.restore(stateMachine, project); stateMachine.sendEvent(message); projectStatusChange.setProjectId(project.getId()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/controller/CompanyFiscalCodeController.java b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/controller/CompanyFiscalCodeController.java index 1d54af5..7acccdb 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/controller/CompanyFiscalCodeController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/controller/CompanyFiscalCodeController.java @@ -35,8 +35,8 @@ public class CompanyFiscalCodeController { @ApiOperation(value = "财政编码-配置", notes = "财政编码配置") @PostMapping("/fiscal-and-seal/configure") @WebLog("财政编码-配置") - public void fiscalAndSealCodeConfigure(@Valid @RequestBody CompanyFiscalCodeAndSealSnReq companyFiscalCodeAndSealSnReq) { - companyFiscalCodeManage.fiscalCodeConfigure(companyFiscalCodeAndSealSnReq); + public void fiscalAndSealCodeConfigure(@Valid @RequestBody CompanyFiscalCodeAndSealSnReq req) { + companyFiscalCodeManage.fiscalCodeConfigure(req); } @ApiOperation(value = "获取财政编码-配置", notes = "获取财政编码配置") diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/manage/CompanyFiscalCodeManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/manage/CompanyFiscalCodeManage.java index c6eb529..49beb70 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/manage/CompanyFiscalCodeManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/manage/CompanyFiscalCodeManage.java @@ -1,6 +1,5 @@ package com.hz.pm.api.fiscal.manage; -import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.common.util.StrUtils; import com.hz.pm.api.fiscal.entity.CompanyFiscalCode; import com.hz.pm.api.fiscal.model.po.CompanyFiscalCodeAndSealSnReq; @@ -25,10 +24,8 @@ import java.util.Objects; @RequiredArgsConstructor public class CompanyFiscalCodeManage { - private final UserInfoHelper userInfoHelper; - - private final ICompanyFiscalCodeService iCompanyFiscalCodeService; - private final ICompanySignatureService iCompanySignatureService; + private final ICompanyFiscalCodeService fiscalCodeService; + private final ICompanySignatureService signatureService; public void fiscalCodeConfigure(CompanyFiscalCodeAndSealSnReq req) { @@ -39,9 +36,8 @@ public class CompanyFiscalCodeManage { } else { temOrgCode = req.getOrganizationCode(); } - // TODO 校验用户权限 - // 保存财政编码配置 - CompanyFiscalCode companyFiscalCode = iCompanyFiscalCodeService.getByOrganizationCode(temOrgCode); + // 保存财政编码配置 TODO 校验用户权限 + CompanyFiscalCode companyFiscalCode = fiscalCodeService.getByOrgCode(temOrgCode); if (Objects.isNull(companyFiscalCode)) { companyFiscalCode = new CompanyFiscalCode(); companyFiscalCode.setOrganizationCode(temOrgCode); @@ -52,11 +48,11 @@ public class CompanyFiscalCodeManage { companyFiscalCode.setFiscalCode(fiscalCode); companyFiscalCode.setUpdateOn(LocalDateTime.now()); companyFiscalCode.setUpdateBy(userDetail.getUserId()); - iCompanyFiscalCodeService.saveOrUpdate(companyFiscalCode); + fiscalCodeService.saveOrUpdate(companyFiscalCode); // 保存印章配置 - CompanySignature signature = iCompanySignatureService.getByOrganizationCode(temOrgCode); + CompanySignature signature = signatureService.getByOrganizationCode(temOrgCode); if (Objects.isNull(signature)) { signature = new CompanySignature(); signature.setOrganizationCode(temOrgCode); @@ -67,7 +63,7 @@ public class CompanyFiscalCodeManage { signature.setUpdateOn(LocalDateTime.now()); signature.setCreateBy(userDetail.getUserId()); signature.setUpdateBy(userDetail.getUserId()); - iCompanySignatureService.saveOrUpdate(signature); + signatureService.saveOrUpdate(signature); } public CompanyFiscalCodeAndSealSnVO getFiscalCodeConfigure(ReqGetCompanyFiscalCodeAndSealSnPO request) { @@ -78,16 +74,16 @@ public class CompanyFiscalCodeManage { } else { temOrgCode = request.getOrganizationCode(); } - CompanySignature companySignature = iCompanySignatureService.getByOrganizationCode(temOrgCode); - if (Objects.isNull(companySignature)) { + CompanySignature signature = signatureService.getByOrganizationCode(temOrgCode); + if (Objects.isNull(signature)) { return null; } - CompanyFiscalCode companyFiscalCode = iCompanyFiscalCodeService.getByOrganizationCode(temOrgCode); - CompanyFiscalCodeAndSealSnVO returnVO = new CompanyFiscalCodeAndSealSnVO(); - returnVO.setCreateTime(companySignature.getCreateOn()); - returnVO.setUpdateTime(companySignature.getUpdateOn()); - returnVO.setFiscalCode(companyFiscalCode.getFiscalCode()); - returnVO.setSealSn(companySignature.getSealSn()); - return returnVO; + CompanyFiscalCode cfc = fiscalCodeService.getByOrgCode(temOrgCode); + CompanyFiscalCodeAndSealSnVO res = new CompanyFiscalCodeAndSealSnVO(); + res.setCreateTime(signature.getCreateOn()); + res.setUpdateTime(signature.getUpdateOn()); + res.setFiscalCode(cfc.getFiscalCode()); + res.setSealSn(signature.getSealSn()); + return res; } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/service/ICompanyFiscalCodeService.java b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/service/ICompanyFiscalCodeService.java index 992447c..d4f7807 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/service/ICompanyFiscalCodeService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/service/ICompanyFiscalCodeService.java @@ -16,7 +16,7 @@ import java.util.Map; */ public interface ICompanyFiscalCodeService extends IService { - CompanyFiscalCode getByOrganizationCode(String orgCode); + CompanyFiscalCode getByOrgCode(String orgCode); /** * 获取 key orgCode fiscalCode diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/service/impl/CompanyFiscalCodeServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/service/impl/CompanyFiscalCodeServiceImpl.java index a323ecf..cc1cba9 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/service/impl/CompanyFiscalCodeServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/fiscal/service/impl/CompanyFiscalCodeServiceImpl.java @@ -29,7 +29,7 @@ public class CompanyFiscalCodeServiceImpl extends ServiceImpl projectIndexTemplateList(PerformanceAppraisalListReq req) { Page page = req.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class) - .like(StringUtils.isNotBlank(req.getTemplateName()), PerformanceIndicatorProjectTemplate::getName, req.getTemplateName()) - .eq(StringUtils.isNotBlank(req.getRegionCode()), PerformanceIndicatorProjectTemplate::getRegionCode,req.getRegionCode()) + .like(StrUtils.isNotBlank(req.getTemplateName()), PerformanceIndicatorProjectTemplate::getName, req.getTemplateName()) .orderByDesc(PerformanceIndicatorProjectTemplate::getCreateOn); - indicatorProjectTemplateService.page(page,wrapper); + indicatorProjectTemplateService.page(page, wrapper); - if(CollUtil.isEmpty(page.getRecords())){ + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } @@ -86,40 +89,40 @@ public class IndicatorConfigManage { .map(p -> BeanUtil.copyProperties(p, ProjectIndexTemplateVO.class)) .collect(Collectors.toList()); - return PageVo.of(res,page.getTotal()); + return PageVo.of(res, page.getTotal()); } /** * 查询项目模板详情 - * @param id - * @return + * + * @param id \ + * @return \ */ public ProjectIndexTemplateVO projectDetail(Long id) { PerformanceIndicatorProjectTemplate template = indicatorProjectTemplateService.getById(id); - if(Objects.isNull(template)){ + if (Objects.isNull(template)) { return null; } ProjectIndexTemplateVO vo = BeanUtil.copyProperties(template, ProjectIndexTemplateVO.class); String projectTagIds = template.getProjectTagIds(); - if (StringUtils.isNotBlank(projectTagIds)){ - List proTagIdList = Arrays.stream(projectTagIds.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); - vo.setProjectTagIds(proTagIdList); + if (StringUtils.isNotBlank(projectTagIds)) { + vo.setProjectTagIds(BizUtils.splitToLong(projectTagIds)); } // 获取模版绩效指标详情 List templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id) - .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.FALSE)); + .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional, Boolean.FALSE)); // 获取模版附加绩效指标详情 List additionalTemplateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id) - .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE)); - if(CollUtil.isNotEmpty(templateDetails)){ + .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional, Boolean.TRUE)); + if (CollUtil.isNotEmpty(templateDetails)) { List templateDetailVos = templateDetailBuildHelper.buildTemplateDetail(templateDetails, null, null); vo.setTemplateDetails(templateDetailVos); } - if (CollUtil.isNotEmpty(additionalTemplateDetails)){ + if (CollUtil.isNotEmpty(additionalTemplateDetails)) { List additionalTemplateDetailVos = templateDetailBuildHelper.buildTemplateDetail(additionalTemplateDetails, null, null); vo.setAdditionalIndexDetails(additionalTemplateDetailVos); } @@ -128,6 +131,7 @@ public class IndicatorConfigManage { /** * 项目指标 模板保存 + * * @param dto * @return */ @@ -138,35 +142,35 @@ public class IndicatorConfigManage { List projectTagIds = dto.getProjectTagIds(); List tagIdList = projectTagIds.stream().map(String::valueOf).collect(Collectors.toList()); template.setProjectTagIds(String.join(StrPool.COMMA, tagIdList)); - if (Objects.isNull(dto.getStatus())){ + if (Objects.isNull(dto.getStatus())) { // 默认模版禁用 template.setStatus(0); } - if(Objects.nonNull(dto.getId())){ + if (Objects.nonNull(dto.getId())) { PerformanceIndicatorProjectTemplate old = indicatorProjectTemplateService.getById(dto.getId()); VUtils.isTrue(Objects.isNull(old)).throwMessage("该模板不存在!"); template.setId(old.getId()); - }else{ + } else { template.setId(null); template.setCreateOn(LocalDateTime.now()); template.setCreateBy(user.getUsername()); } template.setUpdateOn(LocalDateTime.now()); template.setUpdateBy(user.getUsername()); - if(indicatorProjectTemplateService.saveOrUpdate(template)){ + if (indicatorProjectTemplateService.saveOrUpdate(template)) { //保存 模板指标的详情 - if(CollUtil.isNotEmpty(dto.getTemplateDetails())){ + if (CollUtil.isNotEmpty(dto.getTemplateDetails())) { //先删除 indicatorProjectTemplateDetailService.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) - .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId,dto.getId()) - .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.FALSE)); - analysisTemplateDetails(dto.getTemplateDetails(),template.getId()); + .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, dto.getId()) + .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional, Boolean.FALSE)); + analysisTemplateDetails(dto.getTemplateDetails(), template.getId()); //校检 所有3级指标(不包括附加指标) 总分是不是100 List indexList = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, template.getId()) - .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.FALSE) - .eq(PerformanceIndicatorProjectTemplateDetail::getType,PerformanceTemplateTypeEnum.THIRD_INDEX.getCode())); - if(CollUtil.isNotEmpty(indexList)){ + .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional, Boolean.FALSE) + .eq(PerformanceIndicatorProjectTemplateDetail::getType, PerformanceTemplateTypeEnum.THIRD_INDEX.getCode())); + if (CollUtil.isNotEmpty(indexList)) { BigDecimal sum = indexList.stream() .map(PerformanceIndicatorProjectTemplateDetail::getIndexScore) .filter(Objects::nonNull) @@ -176,11 +180,11 @@ public class IndicatorConfigManage { } } // 保存 模版附加指标详情 - if (CollUtil.isNotEmpty(dto.getAdditionalIndexDetails())){ + if (CollUtil.isNotEmpty(dto.getAdditionalIndexDetails())) { indicatorProjectTemplateDetailService.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) - .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId,dto.getId()) - .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE)); - analysisAdditionalTemplateDetails(dto.getAdditionalIndexDetails(),template.getId()); + .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, dto.getId()) + .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional, Boolean.TRUE)); + analysisAdditionalTemplateDetails(dto.getAdditionalIndexDetails(), template.getId()); } return BizConst.SAVE_SUCCESS; } @@ -189,37 +193,39 @@ public class IndicatorConfigManage { /** * 解析 项目考核指标 + * * @param templateDetails * @return */ public void analysisTemplateDetails( - List templateDetails,Long templateId) { - if(CollUtil.isEmpty(templateDetails)){ + List templateDetails, Long templateId) { + if (CollUtil.isEmpty(templateDetails)) { return; } - analysisTemplateDetailsInner(templateDetails,templateId,null); + analysisTemplateDetailsInner(templateDetails, templateId, null); } /** * 解析 项目附加考核指标 + * * @param additionalTemplateDetails * @return */ public void analysisAdditionalTemplateDetails( - List additionalTemplateDetails,Long templateId) { - if(CollUtil.isEmpty(additionalTemplateDetails)){ + List additionalTemplateDetails, Long templateId) { + if (CollUtil.isEmpty(additionalTemplateDetails)) { return; } - analysisAdditionalTemplateDetailsInner(additionalTemplateDetails,templateId,null); + analysisAdditionalTemplateDetailsInner(additionalTemplateDetails, templateId, null); } public void analysisTemplateDetailsInner(List templateDetails, - Long templateId,Long parentId) { - if(CollUtil.isEmpty(templateDetails)){ + Long templateId, Long parentId) { + if (CollUtil.isEmpty(templateDetails)) { return; } UserInfoDetails user = LoginUserUtil.loginUserDetail(); - for(ProjectTemplateDetailDTO detail : templateDetails){ + for (ProjectTemplateDetailDTO detail : templateDetails) { //计算阶段的 PerformanceIndicatorProjectTemplateDetail templateDetail = BeanUtil.copyProperties(detail, PerformanceIndicatorProjectTemplateDetail.class); templateDetail.setCreateBy(user.getUsername()); @@ -233,19 +239,19 @@ public class IndicatorConfigManage { indicatorProjectTemplateDetailService.save(templateDetail); - if(CollUtil.isNotEmpty(detail.getChildren())){ - analysisTemplateDetailsInner(detail.getChildren(),templateId,templateDetail.getId()); + if (CollUtil.isNotEmpty(detail.getChildren())) { + analysisTemplateDetailsInner(detail.getChildren(), templateId, templateDetail.getId()); } } } public void analysisAdditionalTemplateDetailsInner(List templateDetails, - Long templateId,Long parentId) { - if(CollUtil.isEmpty(templateDetails)){ + Long templateId, Long parentId) { + if (CollUtil.isEmpty(templateDetails)) { return; } UserInfoDetails user = LoginUserUtil.loginUserDetail(); - for(ProjectTemplateDetailDTO detail : templateDetails){ + for (ProjectTemplateDetailDTO detail : templateDetails) { //计算阶段的 PerformanceIndicatorProjectTemplateDetail templateDetail = BeanUtil.copyProperties(detail, PerformanceIndicatorProjectTemplateDetail.class); templateDetail.setCreateBy(user.getUsername()); @@ -260,14 +266,15 @@ public class IndicatorConfigManage { indicatorProjectTemplateDetailService.save(templateDetail); - if(CollUtil.isNotEmpty(detail.getChildren())){ - analysisAdditionalTemplateDetailsInner(detail.getChildren(),templateId,templateDetail.getId()); + if (CollUtil.isNotEmpty(detail.getChildren())) { + analysisAdditionalTemplateDetailsInner(detail.getChildren(), templateId, templateDetail.getId()); } } } /** * 装配 模板详情 + * * @param templateDetails * @return */ @@ -310,11 +317,11 @@ public class IndicatorConfigManage { } return res; } - + /** * 删除项目模板 - * + * * @param id * @return */ @@ -328,8 +335,8 @@ public class IndicatorConfigManage { if (indicatorProjectTemplateService.removeById(id)) { indicatorProjectTemplateDetailService - .remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) - .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id)); + .remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) + .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id)); return "删除成功"; } return "操作失败"; @@ -337,7 +344,7 @@ public class IndicatorConfigManage { public Boolean enOrDisProjectIndexTemplate(Long templateId, boolean active) { PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getById(templateId); - if (Boolean.TRUE.equals(active)){ + if (Boolean.TRUE.equals(active)) { // 根据创建模板时选择的项目类型、预算年度、项目金额、项目标签 // 判断模板是否可以启用(同一套组合只能启用一套模板) PerformanceIndicatorProjectTemplate template = indicatorProjectTemplateService.getOne(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class) @@ -345,12 +352,12 @@ public class IndicatorConfigManage { .eq(PerformanceIndicatorProjectTemplate::getProjectYear, projectTemplate.getProjectYear()) .eq(PerformanceIndicatorProjectTemplate::getAmountRange, projectTemplate.getAmountRange()) .eq(PerformanceIndicatorProjectTemplate::getProjectTagIds, projectTemplate.getProjectTagIds()) - .eq(PerformanceIndicatorProjectTemplate::getStatus,CommonEnum.YES.getCode())); - if (Objects.nonNull(template)){ + .eq(PerformanceIndicatorProjectTemplate::getStatus, CommonEnum.YES.getCode())); + if (Objects.nonNull(template)) { throw new BizException("相同配置的模板已存在,当前模板无法启用!"); } projectTemplate.setStatus(CommonEnum.YES.getCode()); - }else { + } else { projectTemplate.setStatus(CommonEnum.NO.getCode()); } return indicatorProjectTemplateService.updateById(projectTemplate); @@ -361,7 +368,7 @@ public class IndicatorConfigManage { UserInfoDetails user = LoginUserUtil.loginUserDetail(); PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getById(templateId); PerformanceIndicatorProjectTemplate newTemplate = new PerformanceIndicatorProjectTemplate(); - BeanUtils.copyProperties(projectTemplate,newTemplate); + BeanUtils.copyProperties(projectTemplate, newTemplate); // 复制后,项目模版名称变更为xxx副本,状态为禁用 newTemplate.setName(projectTemplate.getName() + CommonConst.COPY); newTemplate.setStatus(CommonEnum.NO.getCode()); @@ -381,7 +388,7 @@ public class IndicatorConfigManage { List thirdList = projectTemplateDetails.stream() .filter(p -> PerformanceTemplateTypeEnum.THIRD_INDEX.getCode().equals(p.getType())) .collect(Collectors.toList()); - if (CollUtil.isEmpty(thirdList)){ + if (CollUtil.isEmpty(thirdList)) { throw new BizException("当前模板未配置三级指!"); } List templateDetails = Lists.newArrayList(); @@ -400,7 +407,7 @@ public class IndicatorConfigManage { // 再保存关联的二级指标 Long thirdParentId = templateDetail.getParentId(); PerformanceIndicatorProjectTemplateDetail secondTemplateDetail = detailMap.get(thirdParentId); - if (Objects.isNull(secondTemplateDetail)){ + if (Objects.isNull(secondTemplateDetail)) { throw new BizException("三级指标:" + templateDetail.getName() + "对应的二级指标不存在"); } PerformanceIndicatorProjectTemplateDetail newSecondTemplateDetail = new PerformanceIndicatorProjectTemplateDetail(); @@ -420,7 +427,7 @@ public class IndicatorConfigManage { // 再保存关联的一级指标 Long secondParentId = secondTemplateDetail.getParentId(); PerformanceIndicatorProjectTemplateDetail firstTemplateDetail = detailMap.get(secondParentId); - if (Objects.isNull(firstTemplateDetail)){ + if (Objects.isNull(firstTemplateDetail)) { throw new BizException("二级指标:" + secondTemplateDetail.getName() + "对应的一级指标不存在"); } PerformanceIndicatorProjectTemplateDetail newFirstTemplateDetail = new PerformanceIndicatorProjectTemplateDetail(); @@ -453,32 +460,32 @@ public class IndicatorConfigManage { .eq(Objects.nonNull(req.getIndexLevel()), PerformanceAppraisalProjectIndicator::getIndexLevel, req.getIndexLevel()) .eq(StringUtils.isNotBlank(req.getRegionCode()), PerformanceAppraisalProjectIndicator::getRegionCode, req.getRegionCode()) .orderByDesc(PerformanceAppraisalProjectIndicator::getCreateOn); - projectIndicatorService.page(page,wrapper); + projectIndicatorService.page(page, wrapper); - if (CollUtil.isEmpty(page.getRecords())){ + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } List result = page.getRecords().stream() .map(i -> BeanUtil.copyProperties(i, ProjectIndexVO.class)) .collect(Collectors.toList()); - return PageVo.of(result,page.getTotal()); + return PageVo.of(result, page.getTotal()); } public String projectIndexSave(PerformanceIndicatorProjectIndexSaveDTO dto) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); PerformanceAppraisalProjectIndicator projectIndicator = BeanUtil.copyProperties(dto, PerformanceAppraisalProjectIndicator.class); - if(Objects.nonNull(dto.getId())){ + if (Objects.nonNull(dto.getId())) { PerformanceAppraisalProjectIndicator old = projectIndicatorService.getById(dto.getId()); - VUtils.isTrue(Objects.isNull(old)).throwMessage("该项目指标不存在!"); + Assert.notNull(old, "该项目指标不存在!"); projectIndicator.setId(old.getId()); - }else{ + } else { projectIndicator.setId(null); projectIndicator.setCreateOn(LocalDateTime.now()); projectIndicator.setCreateBy(user.getUsername()); } projectIndicator.setUpdateOn(LocalDateTime.now()); projectIndicator.setUpdateBy(user.getUsername()); - if(projectIndicatorService.saveOrUpdate(projectIndicator)){ + if (projectIndicatorService.saveOrUpdate(projectIndicator)) { return "指标新增成功"; } return "指标新增失败"; @@ -495,7 +502,7 @@ public class IndicatorConfigManage { public ProjectIndexVO projectIndexDetail(Long id) { PerformanceAppraisalProjectIndicator projectIndex = projectIndicatorService.getById(id); - if(Objects.isNull(projectIndex)){ + if (Objects.isNull(projectIndex)) { return null; } return BeanUtil.copyProperties(projectIndex, ProjectIndexVO.class); @@ -505,33 +512,33 @@ public class IndicatorConfigManage { Page page = req.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisalAppIndicator.class) .like(StringUtils.isNotBlank(req.getIndexName()), PerformanceAppraisalAppIndicator::getIndexName, req.getIndexName()) - .orderBy(Boolean.FALSE,Boolean.TRUE, PerformanceAppraisalAppIndicator::getSort); - appIndicatorService.page(page,wrapper); + .orderBy(Boolean.FALSE, Boolean.TRUE, PerformanceAppraisalAppIndicator::getSort); + appIndicatorService.page(page, wrapper); - if (CollUtil.isEmpty(page.getRecords())){ + if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } List result = page.getRecords().stream() .map(i -> BeanUtil.copyProperties(i, AppIndexVO.class)) .collect(Collectors.toList()); - return PageVo.of(result,page.getTotal()); + return PageVo.of(result, page.getTotal()); } public String appIndexSave(PerformanceIndicatorAppIndexSaveDTO dto) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); PerformanceAppraisalAppIndicator appIndicator = BeanUtil.copyProperties(dto, PerformanceAppraisalAppIndicator.class); - if(Objects.nonNull(dto.getId())){ + if (Objects.nonNull(dto.getId())) { PerformanceAppraisalAppIndicator old = appIndicatorService.getById(dto.getId()); - VUtils.isTrue(Objects.isNull(old)).throwMessage("该项目指标不存在!"); + Assert.notNull(old, "该项目指标不存在!"); appIndicator.setId(old.getId()); - }else{ + } else { appIndicator.setId(null); appIndicator.setCreateOn(LocalDateTime.now()); appIndicator.setCreateBy(user.getUsername()); } appIndicator.setUpdateOn(LocalDateTime.now()); appIndicator.setUpdateBy(user.getUsername()); - if(appIndicatorService.saveOrUpdate(appIndicator)){ + if (appIndicatorService.saveOrUpdate(appIndicator)) { return "指标新增成功"; } return "指标新增失败"; @@ -548,7 +555,7 @@ public class IndicatorConfigManage { public AppIndexVO appIndexDetail(Long id) { PerformanceAppraisalAppIndicator appIndex = appIndicatorService.getById(id); - if(Objects.isNull(appIndex)){ + if (Objects.isNull(appIndex)) { return null; } return BeanUtil.copyProperties(appIndex, AppIndexVO.class); @@ -556,9 +563,9 @@ public class IndicatorConfigManage { public Boolean enOrDisAppIndex(Long appId, Boolean state) { PerformanceAppraisalAppIndicator appIndicator = appIndicatorService.getById(appId); - if (Boolean.TRUE.equals(state)){ + if (Boolean.TRUE.equals(state)) { appIndicator.setIsDisplay(Boolean.TRUE); - }else { + } else { appIndicator.setIsDisplay(Boolean.FALSE); } return appIndicatorService.updateById(appIndicator); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java index 2033046..7e3ef23 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java @@ -25,9 +25,6 @@ public class PerformanceIndicatorProjectTemplateSaveDTO implements Serializable @ApiModelProperty("模板名称") private String name; - @ApiModelProperty("丽水 区域code") - private String regionCode; - @ApiModelProperty("项目年度") private Integer projectYear; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/portrait/controller/TagController.java b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/controller/TagController.java index c0bf6e4..2a6401f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/portrait/controller/TagController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/controller/TagController.java @@ -28,10 +28,10 @@ import java.util.List; public class TagController { private final TagManage tagManage; - @GetMapping("/list/{areaCode}") + @GetMapping("/list") @ApiOperation("按区域查询标签列表") - public PageVo list(@PathVariable String areaCode, TagPageReq req) { - return tagManage.list(areaCode,req); + public PageVo list(TagPageReq req) { + return tagManage.list(req); } @PostMapping("/save") diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/portrait/manage/TagManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/manage/TagManage.java index 68748c6..88398bd 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/portrait/manage/TagManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/manage/TagManage.java @@ -3,14 +3,12 @@ package com.hz.pm.api.portrait.manage; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Assert; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.basic.util.CollUtils; -import com.hz.pm.api.common.model.constant.BizConst; -import com.hz.pm.api.common.model.constant.RegionConst; import com.hz.pm.api.common.helper.RegionCacheHelper; +import com.hz.pm.api.common.model.constant.BizConst; +import com.hz.pm.api.common.util.StrUtils; import com.hz.pm.api.gov.model.entity.GovBizProjectBaseinfo; import com.hz.pm.api.gov.service.IGovBizProjectBaseinfoService; import com.hz.pm.api.portrait.model.dto.TagDTO; @@ -23,9 +21,11 @@ import com.hz.pm.api.portrait.service.IProjectTagService; import com.hz.pm.api.portrait.service.ITagService; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.service.IProjectService; -import com.hz.pm.api.sys.model.dto.RegionDTO; import com.hz.pm.api.user.security.model.UserInfoDetails; 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 lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -37,10 +37,12 @@ import java.util.Objects; import java.util.stream.Collectors; /** - * @Classname TagManage - * @Description - * @Date 2023/8/2 14:10 - * @Author PoffyZhang + *

+ * TagManage-项目标签管理 + *

+ * + * @author WendyYang + * @since 11:37 2024/1/15 */ @Component @Slf4j @@ -60,26 +62,21 @@ public class TagManage { /** * 标签分页 * - * @param areaCode - * @param req - * @return + * @param req \ + * @return \ */ - public PageVo list(String areaCode, TagPageReq req) { - RegionDTO regionDto = regionCacheHelper.getByCodeAndLevel(areaCode, RegionConst.RL_COUNTY); - String regionCode = Objects.nonNull(regionDto) ? regionDto.getRegionCode() : null; + public PageVo list(TagPageReq req) { LambdaQueryWrapper query = Wrappers.lambdaQuery(Tag.class) - .eq(Objects.nonNull(regionCode), Tag::getAreaCode, regionCode) - .like(StringUtils.isNotBlank(req.getName()), Tag::getName, req.getName()) + .like(StrUtils.isNotBlank(req.getName()), Tag::getName, req.getName()) .orderByDesc(Tag::getUpdateOn); checkAuth(query, LoginUserUtil.loginUserDetail()); Page page = tagService.page(req.page(), query); - long total; - if ((total = page.getTotal()) == 0) { + if (page.getTotal() == 0) { return PageVo.empty(); } List records = CollUtils.convert(page.getRecords(), t -> BeanUtil.copyProperties(t, TagVO.class)); - return PageVo.of(records, total); + return PageVo.of(records, page.getTotal()); } /** @@ -110,7 +107,7 @@ public class TagManage { Tag entity = BeanUtil.copyProperties(dto, Tag.class); if (Objects.nonNull(dto.getId())) { Tag old = tagService.getById(dto.getId()); - VUtils.isTrue(Objects.isNull(old)).throwMessage("此id标签不存在!"); + Assert.notNull(old, "此id标签不存在!"); entity.setId(old.getId()); } else { entity.setId(null); @@ -131,11 +128,11 @@ public class TagManage { */ private void deduplicationName(TagDTO dto) { if (StringUtils.isNotBlank(dto.getName())) { - long count = tagService.count(Wrappers.lambdaQuery(Tag.class) - .eq(Tag::getAreaCode, dto.getAreaCode()) + LambdaQueryWrapper query = Wrappers.lambdaQuery(Tag.class) .eq(Tag::getName, dto.getName()) - .ne(Objects.nonNull(dto.getId()), Tag::getId, dto.getId())); - VUtils.isTrue(count > 0).throwMessage("保存失败!此区域标签名重复!"); + .ne(Objects.nonNull(dto.getId()), Tag::getId, dto.getId()); + long count = tagService.count(query); + Assert.isTrue(count == 0, "保存失败!此区域标签名重复!"); } } @@ -158,8 +155,6 @@ public class TagManage { Long tagId = dto.getTagId(); Tag tag = tagService.getById(tagId); VUtils.isTrue(Objects.isNull(tag)).throwMessage("标签不存在!"); - VUtils.isTrue(!tag.getAreaCode().equals(project.getAreaCode())) - .throwMessage("项目和标签不是一个区域的!"); ProjectTag projectTag = new ProjectTag(); projectTag.setProjectCode(projectCode); projectTag.setTagId(tagId); @@ -182,16 +177,11 @@ public class TagManage { Long tagId = dto.getTagId(); Tag tag = tagService.getById(tagId); VUtils.isTrue(Objects.isNull(tag)).throwMessage("标签不存在!"); - - VUtils.isTrue(!tag.getAreaCode().equals(project.getAreaCode())) - .throwMessage("项目和标签不是一个区域的!"); - ProjectTag pt = projectTagService.getOne(Wrappers.lambdaQuery(ProjectTag.class) .eq(ProjectTag::getProjectCode, projectCode) .eq(ProjectTag::getTagId, tagId)); - VUtils.isTrue(Objects.isNull(pt)) - .throwMessage("该项目没有绑定此标签!"); + Assert.notNull(pt, "该项目没有绑定此标签!"); projectTagService.removeById(pt.getId()); return "删除成功"; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/dto/TagDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/dto/TagDTO.java index 03f0d06..c63183d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/dto/TagDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/dto/TagDTO.java @@ -4,9 +4,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import javax.validation.constraints.NotNull; -import java.io.Serializable; - /** *

* 标签 @@ -17,9 +14,7 @@ import java.io.Serializable; */ @Data @ApiModel(value = "Tag对象", description = "标签") -public class TagDTO implements Serializable { - - private static final long serialVersionUID = 1L; +public class TagDTO { @ApiModelProperty("主键") private Long id; @@ -30,7 +25,4 @@ public class TagDTO implements Serializable { @ApiModelProperty("备注") private String remark; - @ApiModelProperty("区域CODE") - @NotNull(message = "区域CODE必填") - private String areaCode; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/vo/TagVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/vo/TagVO.java index e9c2467..2b83c93 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/vo/TagVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/vo/TagVO.java @@ -17,9 +17,7 @@ import java.time.LocalDateTime; */ @Data @ApiModel(value = "Tag对象", description = "标签") -public class TagVO implements Serializable { - - private static final long serialVersionUID = 1L; +public class TagVO { @ApiModelProperty("主键") private Long id; @@ -33,8 +31,8 @@ public class TagVO implements Serializable { @ApiModelProperty("区域CODE") private String areaCode; - private LocalDateTime createOn; private LocalDateTime updateOn; - private String createBy; + private String updateBy; + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java index c56b597..69dcef5 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java @@ -145,7 +145,7 @@ public class DeclaredProjectManage { .last(BizConst.LIMIT_1)); if (Objects.isNull(model)) { - throw new BusinessException("找不到单位流程配置"); + throw BizException.wrap("找不到单位流程配置"); } ProcessStartParamsVo params = new ProcessStartParamsVo(); @@ -363,13 +363,14 @@ public class DeclaredProjectManage { //当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位 并且他是单位管理员 private void preQuery(LambdaQueryWrapper query, UserFullInfoDTO user) { //如果当前登录是单位管理员 + String mhUnitId = user.getMhUnitIdStr(); if (user.getIsOrgAdmin()) { query.and(s1 -> s1.eq(Project::getStatus, ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()) - .eq(Project::getSuperOrgCode, user.getMhUnitId()) - .or(q2 -> q2.eq(Project::getBuildOrgCode, user.getMhUnitId()))); + .eq(Project::getSuperOrgCode, mhUnitId) + .or(q2 -> q2.eq(Project::getBuildOrgCode, mhUnitId))); } else { //否则 只能看到 非预审 并且 - query.and(q2 -> q2.eq(Project::getBuildOrgCode, user.getMhUnitId())); + query.and(q2 -> q2.eq(Project::getBuildOrgCode, mhUnitId)); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java index 7fdb5cb..beec306 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java @@ -98,8 +98,14 @@ public class ReviewChecklistManage { } else { reviewHumans = new ArrayList<>(); } - List users = userInfoHelper.listUserFullInfoByUserIds(reviewHumans); - Map userMap = CollUtils.listToMap(users, UserFullInfoDTO::getUserId, UserFullInfoDTO::getUsername); + Map userMap; + if (!reviewHumans.isEmpty()) { + List users = userInfoHelper.listUserFullInfoByUserIds(reviewHumans); + userMap = CollUtils.listToMap(users, UserFullInfoDTO::getUserId, UserFullInfoDTO::getUsername); + } else { + userMap = Collections.emptyMap(); + } + List records = CollUtils.convert(page.getRecords(), w -> { ProjectReviewCheckListItemVO item = new ProjectReviewCheckListItemVO(); item.setId(w.getId()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectRenewalFundDeclarationController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectRenewalFundDeclarationController.java index 960044f..e6b3f14 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectRenewalFundDeclarationController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectRenewalFundDeclarationController.java @@ -48,8 +48,7 @@ public class ProjectRenewalFundDeclarationController { @GetMapping("/project-list") @ApiOperation("项目续建资金库能关联的项目列表") public PageVo projectlist(ProjectRenewalListReq req) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - return projectRenewalFundManage.projectList(req,user); + return projectRenewalFundManage.projectList(req); } @GetMapping("/{id}") diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java index c9ef5a1..eaa4b64 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java @@ -5,13 +5,13 @@ import com.google.common.collect.Lists; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.model.constant.ProjectDeclareConst; import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; -import com.hz.pm.api.common.statemachine.contant.RegionContant; import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.service.IProjectService; import com.wflow.bean.entity.WflowModels; import com.wflow.workflow.bean.vo.ProcessDetailVO; import com.wflow.workflow.service.ProcessModelService; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -27,27 +27,21 @@ import java.util.Objects; * @since 2023/02/26 21:36 */ @Component +@RequiredArgsConstructor public class ProcessExecuteChainHandle { - @Autowired - private IProjectService projectService; - - @Autowired - private ProcessModelService processModelService; + private final IProjectService projectService; + private final ProcessModelService processModelService; /** * 具体处理者的集合 */ - private List processBusinessHandles; - - public ProcessExecuteChainHandle(List processBusinessHandles) { - this.processBusinessHandles = processBusinessHandles; - } + private final List processBusinessHandles; /** * 遍历处理链,通过前缀判断能否处理逻辑,如果不能继续遍历 * - * @param projectId + * @param projectId \ * @return void * @author CMM * @since 2023/02/26 @@ -57,30 +51,19 @@ public class ProcessExecuteChainHandle { List handles = Lists.newArrayList(); for (AbstractProcessBusinessHandle processBusinessHandle : processBusinessHandles) { - if (Objects.nonNull(project) && RegionContant.LS_LQ_CODE.equals(project.getAreaCode())) { - if (processBusinessHandle instanceof AnnualPlanHandle) { - processBusinessHandle.setOrder(7); - } else if (processBusinessHandle instanceof ConstructionPlanReviewHandle) { - processBusinessHandle.setOrder(6); - } - } else { - if (processBusinessHandle instanceof AnnualPlanHandle) { - processBusinessHandle.setOrder(6); - } else if (processBusinessHandle instanceof ConstructionPlanReviewHandle) { - processBusinessHandle.setOrder(7); - } + if (processBusinessHandle instanceof AnnualPlanHandle) { + processBusinessHandle.setOrder(6); + } else if (processBusinessHandle instanceof ConstructionPlanReviewHandle) { + processBusinessHandle.setOrder(7); } //建设方案 if (processBusinessHandle instanceof ConstructionPlanReviewHandle) { WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) - .eq(WflowModels::getRegionCode, project.getAreaCode()) .eq(WflowModels::getProcessType, ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode()) .last(BizConst.LIMIT_1)); - if (Objects.nonNull(model)) { - if (!model.getIsStop()) { + if (Objects.nonNull(model) && (Boolean.FALSE.equals(model.getIsStop()))) { handles.add(processBusinessHandle); - } } } else if (processBusinessHandle instanceof ProvinceUnitedReviewHandle) { //省级联审 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java index e4b4e0a..5fa9af5 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java @@ -3,11 +3,14 @@ package com.hz.pm.api.projectlib.manage; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.excel.EasyExcel; +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.plugins.pagination.Page; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import com.hz.pm.api.user.security.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; @@ -114,7 +117,8 @@ public class ProjectRenewalFundManage { return PageVo.of(records, total); } - public PageVo projectList(ProjectRenewalListReq req, UserFullInfoDTO user) { + public PageVo projectList(ProjectRenewalListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); LambdaQueryWrapper query = ProjectRenewFundHelper.projectQuery(req); //项目查最新 query.eq(Project::getNewest, Boolean.TRUE); @@ -126,19 +130,20 @@ public class ProjectRenewalFundManage { if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } - UserFullInfoDTO finalUser = user; - Set projectCodes = page.getRecords().stream() - .map(Project::getProjectCode).collect(Collectors.toSet()); + List projectCodes = CollUtils.fieldList(page.getRecords(), Project::getProjectCode); - Map> renewalMap = Maps.newHashMap(); + Map> renewalMap; if (CollUtil.isNotEmpty(projectCodes)) { - List renewalDeclarations = projectRenewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + Wrapper prfQuery = Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) .eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) - .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); - renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId)); + .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear); + List renewalDeclarations = projectRenewalFundDeclarationService.list(prfQuery); + renewalMap = CollUtils.group(renewalDeclarations, ProjectRenewalFundDeclaration::getProjectId); + } else { + renewalMap = Collections.emptyMap(); } Map> finalRenewalMap = renewalMap; @@ -160,10 +165,10 @@ public class ProjectRenewalFundManage { item.setProcessStatus(w.getProcessStatus()); item.setInstCode(w.getInstCode()); item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - if (finalUser.getIsOrgAdmin() && - ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) + if (user.getIsOrgAdmin() && + ProjectStatusEnum.PENDING_PREQUALIFICATION.eq(item.getStatus()) && StringUtils.isNotBlank(w.getSuperOrgCode()) - && w.getSuperOrgCode().equals(finalUser.getMhUnitIdStr())) { + && w.getSuperOrgCode().equals(user.getMhUnitIdStr())) { item.setCanPreDeclared(Boolean.TRUE); } item.setApprovedAmount(w.getApprovalAmount()); @@ -249,7 +254,6 @@ public class ProjectRenewalFundManage { } vo.setProjectName(baseinfo.getBaseProjName()); vo.setProjectType(baseinfo.getBaseProjType()); -// vo.setStage(project.getStage()); vo.setStatus(StringUtils.isNotBlank(baseinfo.getBaseProjSetProg()) ? Integer.parseInt(baseinfo.getBaseProjSetProg()) : null); vo.setBuildOrgName(baseinfo.getBaseBuildDeprt()); @@ -294,7 +298,7 @@ public class ProjectRenewalFundManage { annualAmounts.add(AnnualAmountVO.builder() .projectId(operationBaseinfo.getId()) .projectCode(operationBaseinfo.getBaseProjId()) - .projectYear(StringUtils.isNotBlank(apply.getBaseProjSetYear()) ? Integer.parseInt(apply.getBaseProjSetYear()) : null) + .projectYear(StrUtil.isNotBlank(apply.getBaseProjSetYear()) ? Integer.parseInt(apply.getBaseProjSetYear()) : null) .annualAmount(apply.getBaseProjDeclAmount()) .build()); List renewalDeclarations = projectRenewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java index fa5909c..efdb176 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/CockpitStatsStatisticsTask.java @@ -11,7 +11,6 @@ import com.google.common.collect.Lists; import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.model.constant.RegionConst; -import com.hz.pm.api.common.statemachine.contant.RegionContant; import com.hz.pm.api.common.util.BizUtils; import com.hz.pm.api.dashboard.constant.DashboardConstant; import com.hz.pm.api.dashboard.model.entity.CockpitStats; @@ -202,8 +201,6 @@ public class CockpitStatsStatisticsTask { if (CollUtil.isNotEmpty(yearProjIds)) { baseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) - .eq(StringUtils.isNotBlank(regionCode) && !DashboardConstant.CockpitStats.TOTAL.equals(regionCode), - GovBizProjectBaseinfo::getBaseAreaCode, regionCode + RegionContant.MORE_CODE) .in(GovBizProjectBaseinfo::getBaseProjId, yearProjIds)); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/FormController.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/FormController.java index a6dcab8..e802917 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/FormController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/FormController.java @@ -1,5 +1,6 @@ package com.hz.pm.api.sys.controller; +import com.hz.pm.api.common.model.constant.RegionConst; import com.ningdatech.log.annotation.WebLog; import com.wflow.bean.dto.WflowFormsDto; import com.wflow.bean.vo.WflowFormVo; @@ -28,9 +29,9 @@ public class FormController { private final WflowFormsService formService; @ApiOperation(value = "获取系统表单", notes = "获取系统表单") - @GetMapping("/{regionCode}") - public WflowFormVo detail(@PathVariable(value = "regionCode") String regionCode) { - return formService.getFormByRegionCode(regionCode); + @GetMapping + public WflowFormVo detail() { + return formService.getFormByRegionCode(RegionConst.RC_HZ); } @ApiOperation(value = "编辑系统表单", notes = "编辑系统表单") diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/SysProcDefController.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/SysProcDefController.java index 15e0aaa..622ff05 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/SysProcDefController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/SysProcDefController.java @@ -1,5 +1,7 @@ package com.hz.pm.api.sys.controller; +import com.hz.pm.api.common.model.constant.BizConst; +import com.hz.pm.api.common.model.constant.RegionConst; import com.ningdatech.basic.model.PageVo; import com.ningdatech.log.annotation.WebLog; import com.wflow.bean.dto.WflowModelHistorysDto; @@ -33,9 +35,9 @@ public class SysProcDefController { @ApiOperation(value = "系统流程配置列表", notes = "系统流程配置列表") @GetMapping("/list") - public PageVo list(@RequestParam String regionCode, @RequestParam(defaultValue = "1") Integer pageNumber, + public PageVo list(@RequestParam(defaultValue = "1") Integer pageNumber, @RequestParam(defaultValue = "10") Integer pageSize) { - return modelGroupService.getModelsPage(regionCode,pageNumber,pageSize); + return modelGroupService.getModelsPage(RegionConst.RC_HZ, pageNumber, pageSize); } @ApiOperation(value = "系统流程配置详情", notes = "系统流程配置详情") @@ -56,7 +58,7 @@ public class SysProcDefController { public String enOrDisModel(@PathVariable String formId, @PathVariable Boolean state) { modelGroupService.enOrDisModel(formId, !state); - return Boolean.TRUE.equals(state) ? "启用流程成功":"停用流程成功"; + return Boolean.TRUE.equals(state) ? "启用流程成功" : "停用流程成功"; } @ApiOperation(value = "系统流程配置发布", notes = "系统流程配置发布") diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/WflowEarlyWarningRecordsVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/WflowEarlyWarningRecordsVO.java index 22c02ae..fc846c7 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/WflowEarlyWarningRecordsVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/model/vo/WflowEarlyWarningRecordsVO.java @@ -74,7 +74,7 @@ public class WflowEarlyWarningRecordsVO implements Serializable { * 预警员工号 */ @ApiModelProperty(value = "预警员工号") - private String warningEmployeecode; + private String warningUserId; /** * 通知方式 @@ -112,7 +112,7 @@ public class WflowEarlyWarningRecordsVO implements Serializable { @ApiModelProperty(value = "路径") private String path; @ApiModelProperty(value = "这一批要通知的员工号") - private String batchEmployees; + private String batchUserIds; private LocalDateTime createOn; private String createBy; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java index 212776c..2fc9d0d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java @@ -2,6 +2,12 @@ package com.hz.pm.api.user.controller; import com.hz.pm.api.user.manage.MhUnitManage; import com.hz.pm.api.user.model.dto.MhUnitTreeDTO; +import com.hz.pm.api.user.model.dto.MhUnitUserTreeDTO; +import com.hz.pm.api.user.model.po.MhUnitListReq; +import com.hz.pm.api.user.model.po.UserTreeReq; +import com.hz.pm.api.user.model.vo.MhUnitListVO; +import com.ningdatech.basic.model.PageVo; +import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -25,8 +31,21 @@ public class MhUnitController { private final MhUnitManage mhUnitManage; @GetMapping("/tree") + @ApiOperation("单位树") public List getMhUnitTree() { return mhUnitManage.getMhUnitTree(); } + @GetMapping("/page") + @ApiOperation("单位列表") + public PageVo page(MhUnitListReq req) { + return mhUnitManage.page(req); + } + + @GetMapping("/user/tree") + @ApiOperation("用户组织树") + public List getUserTree(UserTreeReq req) { + return mhUnitManage.getUserTree(req); + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java index e1bb6b9..5343764 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java @@ -3,15 +3,28 @@ package com.hz.pm.api.user.manage; import cn.hutool.core.bean.BeanUtil; 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.hz.pm.api.common.util.StrUtils; import com.hz.pm.api.user.helper.MhUnitCache; import com.hz.pm.api.user.model.dto.MhUnitDTO; import com.hz.pm.api.user.model.dto.MhUnitTreeDTO; +import com.hz.pm.api.user.model.dto.MhUnitUserTreeDTO; import com.hz.pm.api.user.model.entity.MhUnit; +import com.hz.pm.api.user.model.entity.UserInfo; +import com.hz.pm.api.user.model.enumeration.UnitUserNodeType; +import com.hz.pm.api.user.model.po.MhUnitListReq; +import com.hz.pm.api.user.model.po.UserTreeReq; +import com.hz.pm.api.user.model.vo.MhUnitListVO; import com.hz.pm.api.user.service.IMhUnitService; +import com.hz.pm.api.user.service.IUserInfoService; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; import com.ningdatech.basic.util.TreeUtil; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -28,6 +41,7 @@ public class MhUnitManage { private final IMhUnitService mhUnitService; private final MhUnitCache mhUnitCache; + private final IUserInfoService userInfoService; public List getMhUnitTree() { List allUnits = mhUnitCache.all(); @@ -35,4 +49,84 @@ public class MhUnitManage { return TreeUtil.convertToTree(nodes, 0L); } + public PageVo page(MhUnitListReq req) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(MhUnit.class) + .like(StrUtils.isNotBlank(req.getName()), MhUnit::getName, req.getName()); + Page page = mhUnitService.page(req.page(), query); + if (page.getTotal() == 0) { + return PageVo.empty(); + } + List records = BeanUtil.copyToList(page.getRecords(), MhUnitListVO.class); + return PageVo.of(records, page.getTotal()); + } + + public List getUserTree(UserTreeReq req) { + List selectedUnitIds = new ArrayList<>(); + List selectedUsers = new ArrayList<>(); + List selectedUnits = new ArrayList<>(); + if (req.getId() != null) { + // 查询单位 + LambdaQueryWrapper unitQuery = Wrappers.lambdaQuery(MhUnit.class) + .select(MhUnit::getId) + .like(StrUtils.isNotBlank(req.getName()), MhUnit::getName, req.getName()) + .eq(MhUnit::getParentId, req.getId()); + List units = mhUnitService.list(unitQuery); + selectedUnitIds.addAll(CollUtils.fieldList(units, MhUnit::getId)); + // 查询用户 + LambdaQueryWrapper userQuery = Wrappers.lambdaQuery(UserInfo.class) + .select(UserInfo::getMhUnitId, UserInfo::getId, UserInfo::getRealName) + .like(StrUtils.isNotBlank(req.getName()), UserInfo::getRealName, req.getName()) + .eq(UserInfo::getMhUnitId, req.getId()) + .last("limit 100"); + List userInfos = userInfoService.list(userQuery); + selectedUnitIds.addAll(CollUtils.fieldList(userInfos, UserInfo::getMhUnitId)); + userInfos.forEach(w -> selectedUsers.add(getMhUnitUserTree(w))); + if (selectedUnitIds.isEmpty()) { + return Collections.emptyList(); + } + String rootId = UnitUserNodeType.UNIT + "#" + req.getId(); + selectedUnitIds.forEach(w -> { + MhUnitDTO unit = mhUnitCache.getById(w); + if (unit != null) { + selectedUnits.add(getMhUnitUserTree(unit)); + } + }); + selectedUnits.addAll(selectedUsers); + return TreeUtil.convertToTree(selectedUnits, rootId); + } else { + // 如果没有查询指定组织,那么直接查询第一级组织 + List childrenUnits = mhUnitCache.getChildren(0L); + if (childrenUnits.isEmpty()) { + return Collections.emptyList(); + } + for (MhUnitDTO unit : childrenUnits) { + selectedUnits.add(getMhUnitUserTree(unit)); + } + selectedUnits.sort(selectedUnits.get(0).comparator()); + return selectedUnits; + } + } + + private MhUnitUserTreeDTO getMhUnitUserTree(MhUnitDTO unit) { + MhUnitUserTreeDTO node = new MhUnitUserTreeDTO(); + node.setSort(unit.getSort()); + node.setName(unit.getName()); + node.setBizId(unit.getId()); + node.setParentId(UnitUserNodeType.UNIT.name() + "#" + unit.getParentId()); + node.setId(UnitUserNodeType.UNIT.name() + "#" + unit.getId()); + node.setType(UnitUserNodeType.UNIT); + return node; + } + + private MhUnitUserTreeDTO getMhUnitUserTree(UserInfo w) { + MhUnitUserTreeDTO node = new MhUnitUserTreeDTO(); + node.setSort((short) 1); + node.setName(w.getRealName()); + node.setBizId(w.getId()); + node.setParentId(UnitUserNodeType.UNIT.name() + "#" + w.getMhUnitId()); + node.setId(UnitUserNodeType.USER.name() + "#" + w.getId()); + node.setType(UnitUserNodeType.USER); + return node; + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java index baec1c8..dd211ce 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java @@ -5,13 +5,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.common.util.BizUtils; import com.hz.pm.api.common.util.StrUtils; import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; import com.hz.pm.api.organization.service.IDingEmployeeInfoService; -import com.hz.pm.api.organization.service.IDingOrganizationService; import com.hz.pm.api.sys.model.entity.Role; import com.hz.pm.api.sys.model.entity.UserRole; import com.hz.pm.api.sys.service.IRoleService; @@ -19,8 +17,8 @@ import com.hz.pm.api.sys.service.IUserRoleService; import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; import com.hz.pm.api.user.model.po.ReqUserDetailEditPO; -import com.hz.pm.api.user.model.po.UserDetailReq; import com.hz.pm.api.user.model.po.ReqUserDisableOrEnablePO; +import com.hz.pm.api.user.model.po.UserDetailReq; import com.hz.pm.api.user.model.po.UserInfoListReq; import com.hz.pm.api.user.model.vo.ResUserDetailVO; import com.hz.pm.api.user.model.vo.UserInfoListVO; @@ -31,8 +29,6 @@ import com.hz.pm.api.user.util.LoginUserUtil; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.zwdd.ZwddIntegrationProperties; -import com.ningdatech.zwdd.client.ZwddClient; import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; import lombok.RequiredArgsConstructor; import org.springframework.aop.framework.AopContext; @@ -54,29 +50,21 @@ public class UserInfoManage { private final UserAuthManage userAuthManage; private final IUserInfoService userInfoService; private final IRoleService roleService; - private final IDingOrganizationService dingOrganizationService; private final IDingEmployeeInfoService dingEmployeeInfoService; private final IUserRoleService userRoleService; private final UserInfoHelper userInfoHelper; - private final RegionCacheHelper regionCacheHelper; - private final ZwddIntegrationProperties zwddIntegrationProperties; - private final ZwddClient zwddClient; public PageVo list(UserInfoListReq req) { - String phoneNo = req.getPhoneNo(); - String name = req.getName(); - String mhUnitName = req.getMhUnitName(); - List userIdList = getRoleCompliantUserIdList(req.getUserRoleList()); if (userIdList != null && userIdList.isEmpty()) { return PageVo.empty(); } - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(UserInfo.class) - .like(StrUtils.isNotBlank(phoneNo), UserInfo::getMobile, phoneNo) - .like(StrUtils.isNotBlank(name), UserInfo::getRealName, name) + .eq(StrUtils.isNotBlank(req.getPhoneNo()), UserInfo::getMobile, req.getPhoneNo()) + .like(StrUtils.isNotBlank(req.getName()), UserInfo::getRealName, req.getName()) .in(Objects.nonNull(userIdList), UserInfo::getId, userIdList) - .like(StrUtils.isNotBlank(mhUnitName), UserInfo::getMhUnitName, mhUnitName) + .like(StrUtils.isNotBlank(req.getMhUnitName()), UserInfo::getMhUnitName, req.getMhUnitName()) + .eq(Objects.nonNull(req.getMhUnitId()), UserInfo::getMhUnitId, req.getMhUnitId()) .orderByDesc(UserInfo::getUpdateOn); Page page = userInfoService.page(req.page(), wrapper); @@ -114,6 +102,8 @@ public class UserInfoManage { return null; } List roleIds = CollUtils.fieldList(userRoles, UserRoleVO::getId); + LambdaQueryWrapper urQuery = Wrappers.lambdaQuery(UserRole.class) + .select(UserRole::getUserId).in(UserRole::getRoleId,roleIds); return userRoleService.listUserIdByRoleIds(roleIds); } @@ -332,7 +322,7 @@ public class UserInfoManage { // 装配用户角色信息列表 List userRoleList = userRoleService.listByUserId(userId); if (CollUtil.isNotEmpty(userRoleList)) { - List roleIdList = CollUtils.fieldList(userRoleList,UserRole::getRoleId); + List roleIdList = CollUtils.fieldList(userRoleList, UserRole::getRoleId); List roleList = roleService.listByIds(roleIdList); List userRoles = roleList.stream().map(r -> { UserRoleVO userRole = new UserRoleVO(); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitUserTreeDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitUserTreeDTO.java new file mode 100644 index 0000000..9e39aa7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitUserTreeDTO.java @@ -0,0 +1,41 @@ +package com.hz.pm.api.user.model.dto; + +import com.hz.pm.api.user.model.enumeration.UnitUserNodeType; +import com.ningdatech.basic.model.ITree; +import lombok.Data; + +import java.util.Comparator; +import java.util.List; + +/** + *

+ * MhUnitTreeDTO + *

+ * + * @author WendyYang + * @since 15:29 2024/1/10 + */ +@Data +public class MhUnitUserTreeDTO implements ITree { + + private String id; + + private String parentId; + + private String name; + + private Long bizId; + + private UnitUserNodeType type; + + private Short sort; + + private List children; + + @Override + public Comparator comparator() { + return Comparator.comparing(MhUnitUserTreeDTO::getType, Comparator.reverseOrder()) + .thenComparing(MhUnitUserTreeDTO::getSort); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/enumeration/UnitUserNodeType.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/enumeration/UnitUserNodeType.java new file mode 100644 index 0000000..dbeeec3 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/enumeration/UnitUserNodeType.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.user.model.enumeration; + +/** + *

+ * UnitUserNodeType + *

+ * + * @author WendyYang + * @since 09:55 2024/1/16 + */ +public enum UnitUserNodeType { + + USER, + UNIT + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/MhUnitListReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/MhUnitListReq.java new file mode 100644 index 0000000..fafca13 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/MhUnitListReq.java @@ -0,0 +1,23 @@ +package com.hz.pm.api.user.model.po; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * MhUnitListReq + *

+ * + * @author WendyYang + * @since 10:21 2024/1/15 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class MhUnitListReq extends PagePo { + + @ApiModelProperty("单位名称") + private String name; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/UserTreeReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/UserTreeReq.java new file mode 100644 index 0000000..9549009 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/UserTreeReq.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.user.model.po; + +import lombok.Data; + +/** + *

+ * UserTreeReq + *

+ * + * @author WendyYang + * @since 09:46 2024/1/16 + */ +@Data +public class UserTreeReq { + + private String name; + + private Long id; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/MhUnitListVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/MhUnitListVO.java new file mode 100644 index 0000000..beb331f --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/MhUnitListVO.java @@ -0,0 +1,29 @@ +package com.hz.pm.api.user.model.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * MhUnitListVO + *

+ * + * @author WendyYang + * @since 10:20 2024/1/15 + */ +@Data +public class MhUnitListVO { + + @ApiModelProperty("单位ID") + private Long id; + + @ApiModelProperty("单位名称") + private String name; + + @ApiModelProperty("上级单位ID") + private Long parentId; + + @ApiModelProperty("排序号") + private Short sort; + +} diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/sys/service/IMenuServiceTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/sys/service/IMenuServiceTest.java index 7b246b5..0818ec1 100644 --- a/hz-pm-api/src/test/java/com/hz/pm/api/sys/service/IMenuServiceTest.java +++ b/hz-pm-api/src/test/java/com/hz/pm/api/sys/service/IMenuServiceTest.java @@ -6,11 +6,13 @@ import cn.hutool.db.Db; import cn.hutool.db.Entity; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hz.pm.api.AppTests; import com.hz.pm.api.sys.model.entity.Menu; import com.hz.pm.api.sys.model.entity.Role; import com.hz.pm.api.sys.model.entity.RoleMenu; +import com.hz.pm.api.sys.model.entity.UserRole; import com.hz.pm.api.user.model.enumeration.RoleEnum; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -110,4 +112,16 @@ class IMenuServiceTest extends AppTests { }); } + @Test + public void test1(){ + List roleIds = Arrays.asList(1, 2); + LambdaQueryWrapper urQuery = Wrappers.lambdaQuery(UserRole.class) + .select(UserRole::getUserId).in(UserRole::getRoleId,roleIds); + System.out.println(urQuery.toString()); + System.out.println(urQuery.getSqlSelect()); + System.out.println(urQuery.getTargetSql()); + System.out.println(urQuery.getSqlComment()); + System.out.println(urQuery.getSqlSet()); + } + } \ No newline at end of file diff --git a/hz-pm-api/src/test/resources/application-dev.yml b/hz-pm-api/src/test/resources/application-dev.yml index dcb2b54..ff2b36b 100644 --- a/hz-pm-api/src/test/resources/application-dev.yml +++ b/hz-pm-api/src/test/resources/application-dev.yml @@ -43,7 +43,7 @@ spring: datasource: type: com.zaxxer.hikari.HikariDataSource driverClassName: dm.jdbc.driver.DmDriver - url: jdbc:dm://47.98.125.47:5236/HZ_PROJECT_MANAGEMENT?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8 + url: jdbc:dm://47.98.125.47:5236/HZ_PROJECT_MANAGEMENT1?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8 username: SYSDBA password: SYSDBA # 数据源 @@ -159,7 +159,7 @@ organization: - GO_ff70e47bae684fdba0d64f4acab85661 yxt: -# wsdl-url: http://115.239.137.23:9501/ws/v1?wsdl + # wsdl-url: http://115.239.137.23:9501/ws/v1?wsdl wsdl-url: classpath:/wsdl.xml #账号 user-code: hzndkj @@ -171,7 +171,7 @@ yxt: #省局联审 请求信息 provincial: -# host: http://zj.ningdatech.com/prometheus-zhejiang_foreign + # host: http://zj.ningdatech.com/prometheus-zhejiang_foreign host: http://223.4.72.75/prometheus-zhejiang_foreign pushUrl: /api/v1/foreign/importantPro detailUrl: /api/v1/foreign/importantProView @@ -238,22 +238,25 @@ project: login: phone-verify-code: skip: true - url: http://lspm.ningdatech.com/login -web: - url: http://lspm.ningdatech.com -# 专家报名验证码校验 -expert-registration: - verify-code: - check: false sync-mh-expert: open: false sync-mh-unit: open: false sync-mh-user: open: false +sync-mh-company: + open: false mh: -# sso: -# client-id: ningda-74a5e5da-3bc3-414a-b9e6-004b7d87e310 -# client-secret: ningda-df746ce4-0c79-4242-b3c7-90ff8630c9742c6727cd-3ae7-48ae-87ad-2b39188ebabd - api-host: http://10.54.38.13:8081/mh-gateway/auth-single - expert-qr-code-url: https://jiema.wwei.cn/uploads/2023/12/28/658d7a3f15f06.jpg \ No newline at end of file + # sso: + # client-id: ningda-74a5e5da-3bc3-414a-b9e6-004b7d87e310 + # client-secret: ningda-df746ce4-0c79-4242-b3c7-90ff8630c9742c6727cd-3ae7-48ae-87ad-2b39188ebabd + # api-host: http://10.54.38.13:8081/mh-gateway/auth-single + expert-qr-code-url: https://jiema.wwei.cn/uploads/2023/12/28/658d7a3f15f06.jpg + file: + down-url: https://weixin.hzszxc.hzswb.cn:8443/mh-gateway/oss/oss/previewFileLogin + detail-url: https://weixin.hzszxc.hzswb.cn:8443/mh-gateway/oss/ossfile/getFileInfoList +auth-code: + secret-key: nqkmzqojg5j4eiypr3rb8s7nb4noa8b2 +agent-login: + proxy: + secret-key: nqkwiqojg7g4eiypr3rb8s7nb4noa8b2 \ No newline at end of file diff --git a/hz-pm-api/src/test/resources/security/auth-dev.yml b/hz-pm-api/src/test/resources/security/auth-dev.yml index c9ebc91..d84a5d7 100644 --- a/hz-pm-api/src/test/resources/security/auth-dev.yml +++ b/hz-pm-api/src/test/resources/security/auth-dev.yml @@ -3,7 +3,7 @@ security: auth-require-url: /api/v1/user/auth/auth-require invalid-session-url: /api/v1/user/auth/invalid-session password-login-url: /api/v1/user/auth/login - agent-login-url: /api/v1/user/auth/agent-login + auth-code-login-url: /api/v1/user/auth/authCodeLogin mh-login-url: /api/v1/user/auth/mh-login logout-url: /api/v1/user/auth/logout common-login-url: /api/v1/user/auth/common-login @@ -19,6 +19,7 @@ security: - /api/v1/user/auth/login/password - /api/v1/user/auth/forget-password - /api/v1/user/auth/common-login + - /api/v1/user/auth/common-login - /doc.html - /ok.html - /open/api/** @@ -40,6 +41,7 @@ security: - /api/v1/wps-convert/** - /api/v1/belong-org/business-strip/list - /expert/ephemeral/*/registration + - /api/v1/mh/sync/** ignore-csrf-urls: - /api/v1/user/auth/** - /v2/api-docs From d1d84c1760bf38e875d7422a7dd03bdd51d352e7 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Tue, 16 Jan 2024 16:18:55 +0800 Subject: [PATCH 23/44] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=A0=91=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/hz/pm/api/user/controller/MhUnitController.java | 2 ++ .../src/main/java/com/hz/pm/api/user/controller/UserAuthController.java | 1 - .../src/main/java/com/hz/pm/api/user/controller/UserInfoController.java | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java index 2fc9d0d..05551e0 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java @@ -7,6 +7,7 @@ import com.hz.pm.api.user.model.po.MhUnitListReq; import com.hz.pm.api.user.model.po.UserTreeReq; import com.hz.pm.api.user.model.vo.MhUnitListVO; import com.ningdatech.basic.model.PageVo; +import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; @@ -23,6 +24,7 @@ import java.util.List; * @author WendyYang * @since 15:28 2024/1/10 */ +@Api(tags = "组织管理") @RestController @RequiredArgsConstructor @RequestMapping("/api/v1/mh/unit") diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java index b88db3d..8a3ae1c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserAuthController.java @@ -34,7 +34,6 @@ import java.io.IOException; * @author Liuxinxin * @since 2023-01-04 */ - @RestController @RequestMapping("/api/v1/user/auth") @Api(tags = {"用户鉴权-相关接口"}) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserInfoController.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserInfoController.java index 31b309d..384a8c5 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserInfoController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/UserInfoController.java @@ -29,7 +29,7 @@ import java.util.List; @RestController @RequestMapping("/api/v1/user-info") @RequiredArgsConstructor -@Api(value = "UserInfoController", tags = "用户管理") +@Api(tags = "用户管理") public class UserInfoController { private final UserInfoManage userInfoManage; From 8f47042dabd9e8424fc393f9ba8b400b6838ec5a Mon Sep 17 00:00:00 2001 From: WendyYang Date: Wed, 17 Jan 2024 00:23:28 +0800 Subject: [PATCH 24/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=83=A8=E9=97=A8?= =?UTF-8?q?=E8=81=94=E5=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../statemachine/action/ProjectDeclareAction.java | 273 --------------------- .../action/ProjectDeclareChoiceAction.java | 4 +- .../ProjectDeclareStateMachineBuilderImpl.java | 9 +- .../factory/ProjectDeclareGuardFactory.java | 13 +- .../common/statemachine/util/StateMachineUtil.java | 7 +- .../api/filemanage/manage/ProjectFileManage.java | 2 +- .../api/gov/manage/GovProjectCollectionManage.java | 16 +- .../com/hz/pm/api/irs/manage/IrsProjectManage.java | 4 +- .../performance/manage/OrgSelfAppraisalManage.java | 4 +- .../hz/pm/api/performance/manage/VerifyManage.java | 13 +- .../controller/ConstructionController.java | 2 +- .../projectdeclared/manage/ConstructionManage.java | 13 +- .../manage/ConstructionPlanManage.java | 2 +- .../manage/DeclaredProjectManage.java | 6 +- .../manage/DefaultDeclaredProjectManage.java | 17 +- .../projectdeclared/manage/DelayedApplyManage.java | 2 +- .../manage/FinalAcceptanceManage.java | 22 +- .../PrequalificationDeclaredProjectManage.java | 17 +- .../api/projectdeclared/manage/PurchaseManage.java | 4 +- .../manage/ReviewByDeptJointManage.java | 18 +- .../handle/ProcessExecuteChainHandle.java | 3 +- .../hz/pm/api/projectlib/helper/ProjectHelper.java | 3 +- .../api/projectlib/manage/ApplicationManage.java | 2 +- .../projectlib/manage/ProjectCollectionManage.java | 18 +- .../pm/api/projectlib/manage/ProjectLibManage.java | 21 +- .../manage/ProjectRenewalFundManage.java | 2 +- .../hz/pm/api/projectlib/mapper/ProjectMapper.xml | 43 +--- .../projectlib/model/enumeration/InstTypeEnum.java | 17 +- .../api/projectlib/model/req/ProjectListReq.java | 9 - .../hz/pm/api/safety/manage/SafetyRiskManage.java | 1 - .../pm/api/scheduler/listener/CcTaskListener.java | 2 +- .../api/scheduler/listener/ProcessEndListener.java | 7 +- .../com/hz/pm/api/sys/manage/NoticeManage.java | 14 +- .../hz/pm/api/sys/manage/UserGuidanceManage.java | 4 +- .../com/hz/pm/api/sys/utils/EarlyWarningUtil.java | 4 +- .../hz/pm/api/todocenter/manage/HandlerManage.java | 176 +++++++------ .../pm/api/todocenter/manage/TodoCenterManage.java | 8 +- .../todocenter/service/impl/TodoServiceImpl.java | 2 +- hz-pm-api/src/main/resources/application-dev.yml | 2 +- .../hz/pm/api/sys/service/IMenuServiceTest.java | 22 +- 40 files changed, 222 insertions(+), 586 deletions(-) delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareAction.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareAction.java deleted file mode 100644 index 3f3b652..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareAction.java +++ /dev/null @@ -1,273 +0,0 @@ -package com.hz.pm.api.common.statemachine.action; - -import com.hz.pm.api.common.model.constant.StateMachineConst; -import com.hz.pm.api.common.statemachine.builder.ProjectDeclareStateMachineBuilderImpl; -import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.Project; -import lombok.extern.slf4j.Slf4j; -import org.springframework.messaging.Message; -import org.springframework.statemachine.annotation.OnTransition; -import org.springframework.statemachine.annotation.WithStateMachine; - -/** - * 项目申报状态机action集合类 - * - * @author CMM - * @since 2023/02/08 13:48 - */ -@Slf4j -@WithStateMachine(id = ProjectDeclareStateMachineBuilderImpl.MACHINE_ID) -public class ProjectDeclareAction { - - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "PENDING_PREQUALIFICATION") - public void UNDER_INTERNAL_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "UNDER_INTERNAL_AUDIT_NOT_PASS") - public void UNDER_INTERNAL_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT_NOT_PASS.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT", target = "TO_BE_DECLARED") - public void UNDER_INTERNAL_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "UNDER_INTERNAL_AUDIT_NOT_PASS", target = "UNDER_INTERNAL_AUDIT") - public void UNDER_INTERNAL_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PENDING_PREQUALIFICATION", target = "UNDER_INTERNAL_AUDIT") - public void PENDING_PREQUALIFICATION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); - } - - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS") - public void PROVINCIAL_DEPARTMENT_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS", target = "PRE_APPLYING") - public void PROVINCIAL_PASS_TO_PRELIMINARY_REVIEW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED") - public void PROVINCIAL_DEPARTMENT_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED.getCode()); - } - - @OnTransition(source = "JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS", target = "PENDING_PREQUALIFICATION") - public void JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "DEPARTMENT_JOINT_REVIEW") - public void PRELIMINARY_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_FAILED") - public void PRELIMINARY_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()); - } - - @OnTransition(source = "PREQUALIFICATION_FAILED", target = "PENDING_PREQUALIFICATION_CHOICE") - public void PRELIMINARY_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE.getCode()); - } - - @OnTransition(source = "PRE_APPLYING", target = "PREQUALIFICATION_WITHDRAW_CHOICE") - public void PRE_APPLYING_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE.getCode()); - } - - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "IN_THE_ANNUAL_PLAN") - public void DEPARTMENT_UNITED_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "DEPARTMENT_JOINT_REVIEW_FAILED") - public void DEPARTMENT_UNITED_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "DEPARTMENT_JOINT_REVIEW", target = "PRE_APPLYING") - public void DEPARTMENT_JOINT_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } - - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "PLAN_TO_BE_DECLARED") - public void ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "BE_SUSPENDED") - public void ANNUAL_PLAN_SUSPEND(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.BE_SUSPENDED.getCode()); - } - - @OnTransition(source = "IN_THE_ANNUAL_PLAN", target = "DEPARTMENT_JOINT_REVIEW") - public void IN_THE_ANNUAL_PLAN_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode()); - } - - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "PLAN_TO_BE_DECLARED", target = "IN_THE_ANNUAL_PLAN") - public void PLAN_TO_DECLARE_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void DECLARE_PLAN_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "TO_BE_APPROVED") - public void PLAN_REVIEW_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "SCHEME_REVIEW_FAILED") - public void PLAN_REVIEW_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "SCHEME_REVIEW_FAILED", target = "SCHEME_UNDER_REVIEW") - public void PLAN_REVIEW_REJECT_RESUBMIT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "SCHEME_UNDER_REVIEW", target = "PLAN_TO_BE_DECLARED") - public void SCHEME_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - } - - - @OnTransition(source = "TO_BE_APPROVED", target = "TO_BE_PURCHASED") - public void PROJECT_APPROVAL(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待立项批复批复后,项目一级状态变更为已立项 - project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - @OnTransition(source = "TO_BE_APPROVED", target = "SCHEME_UNDER_REVIEW") - public void TO_BE_APPROVED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); - } - - - @OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION") - public void PURCHASE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.OPERATION.getCode()); - } - @OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION") - public void START_TO_WORK(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - @OnTransition(source = "TO_BE_PURCHASED", target = "TO_BE_APPROVED") - public void TO_BE_PURCHASED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 待采购状态撤回后,项目一级状态回退到未立项 - project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); - project.setStatus(ProjectStatusEnum.TO_BE_APPROVED.getCode()); - } - - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_FINALLY_INSPECTED") - public void PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); - } - - @OnTransition(source = "UNDER_CONSTRUCTION", target = "TO_BE_PURCHASED") - public void UNDER_CONSTRUCTION_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.TO_BE_PURCHASED.getCode()); - } - - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_APPLICATION(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } - - @OnTransition(source = "TO_BE_FINALLY_INSPECTED", target = "UNDER_CONSTRUCTION") - public void TO_BE_FINALLY_INSPECTED_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); - } - - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "ARCHIVED") - public void FINAL_ACCEPTANCE_PASS(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - // 终验审核通过后,项目一级状态变更为已归档 - project.setStage(ProjectStatusEnum.ARCHIVED.getCode()); - project.setStatus(ProjectStatusEnum.ACCEPTED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_REVIEW_FAILED") - public void FINAL_ACCEPTANCE_REJECT(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_REVIEW_FAILED.getCode()); - } - - @OnTransition(source = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW", target = "FINAL_ACCEPTANCE_IS_UNDER_REVIEW") - public void FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(Message message) { - Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); - project.setStatus(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW.getCode()); - } -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java index 500a784..1c91186 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java @@ -77,7 +77,7 @@ public class ProjectDeclareChoiceAction implements Action stateContext) { Project project = getProject(stateContext); log.info("预审申报事件之前,项目的状态为:{}", project.getStatus()); - if (StateMachineUtil.isCityProject(project) && StateMachineUtil.judgeDeclareAmount(project, + if (StateMachineUtil.isCityProject() && StateMachineUtil.judgeDeclareAmount(project, ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)) { project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()); } else { @@ -88,7 +88,7 @@ public class ProjectDeclareChoiceAction implements Action stateContext) { Project project = getProject(stateContext); log.info("预审中撤回事件之前,项目的状态为:{}", project.getStatus()); - if (StateMachineUtil.isCityProject(project) && StateMachineUtil.judgeDeclareAmount(project, + if (StateMachineUtil.isCityProject() && StateMachineUtil.judgeDeclareAmount(project, ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)) { project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); } else { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilderImpl.java index 29b1e7f..128c098 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilderImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilderImpl.java @@ -36,7 +36,6 @@ public class ProjectDeclareStateMachineBuilderImpl implements ProjectDeclareStat public static final String MACHINE_ID = "projectDeclareStateMachine"; - private static final ProjectDeclareGuardFactory PROJECT_DECLARE_GUARD_FACTORY = new ProjectDeclareGuardFactory(); private final BeanFactory beanFactory; @Override @@ -99,7 +98,7 @@ public class ProjectDeclareStateMachineBuilderImpl implements ProjectDeclareStat // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 .withChoice() .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS, PROJECT_DECLARE_GUARD_FACTORY.new PendingPreQualificationChoiceGuard(), new ProjectDeclareChoiceAction()) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS, new ProjectDeclareGuardFactory.PendingPreQualificationChoiceGuard(), new ProjectDeclareChoiceAction()) .last(ProjectStatusEnum.PRE_APPLYING, new ProjectDeclareChoiceAction()).and() // 省级部门联审通过,从省级部门联审中到省级部门联审成功 @@ -141,7 +140,7 @@ public class ProjectDeclareStateMachineBuilderImpl implements ProjectDeclareStat // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 .withChoice() .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS, PROJECT_DECLARE_GUARD_FACTORY.new PendingPreQualificationChoiceGuard() + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS, new ProjectDeclareGuardFactory.PendingPreQualificationChoiceGuard() , new ProjectDeclareChoiceAction()) .last(ProjectStatusEnum.PENDING_PREQUALIFICATION, new ProjectDeclareChoiceAction()).and() // 预审不通过重新提交,从预审不通过到待预审选择 @@ -152,7 +151,7 @@ public class ProjectDeclareStateMachineBuilderImpl implements ProjectDeclareStat // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 .withChoice() .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS, PROJECT_DECLARE_GUARD_FACTORY.new PendingPreQualificationChoiceGuard(), new ProjectDeclareChoiceAction()) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS, new ProjectDeclareGuardFactory.PendingPreQualificationChoiceGuard(), new ProjectDeclareChoiceAction()) .last(ProjectStatusEnum.PRE_APPLYING, new ProjectDeclareChoiceAction()).and() // 部门联审通过,从部门联审中到年度计划中 .withExternal() @@ -271,7 +270,7 @@ public class ProjectDeclareStateMachineBuilderImpl implements ProjectDeclareStat @Override public StateMachineContext read(Project contextObj) { return new DefaultStateMachineContext<>(ProjectStatusEnum.match(contextObj.getStatus()), - null, null, null, null); + null, null, null, null, MACHINE_ID); } }); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java index 6e879df..35d5bdc 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java @@ -26,20 +26,17 @@ import static com.hz.pm.api.common.model.constant.StateMachineConst.APPLICATION_ public class ProjectDeclareGuardFactory { private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; - public class PendingPreQualificationChoiceGuard implements Guard { + public static class PendingPreQualificationChoiceGuard implements Guard { @Override public boolean evaluate(StateContext context) { Project project = context.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); // 判断申报项目是否是市级项目,且申报金额是否大于等于1000万元 - if (StateMachineUtil.isCityProject(project) && StateMachineUtil.judgeDeclareAmount(project, - ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)){ - return true; - } - return false; + return StateMachineUtil.isCityProject() && StateMachineUtil.judgeDeclareAmount(project, + ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT); } } - public class ApprovedAfterChoiceGuard implements Guard { + public static class ApprovedAfterChoiceGuard implements Guard { @Override public boolean evaluate(StateContext context) { List projectApplications = context.getMessage().getHeaders().get(APPLICATION_DECLARE, List.class); @@ -48,7 +45,7 @@ public class ProjectDeclareGuardFactory { if (CollUtil.isEmpty(projectApplications)){ return res[0]; } - projectApplications.stream().forEach(app -> { + projectApplications.forEach(app -> { Integer isFirst = app.getIsFirst(); if(isFirst.equals(CommonEnum.YES.getCode())){ res[0] = Boolean.TRUE; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtil.java index 4266363..757ce5f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtil.java @@ -1,6 +1,5 @@ package com.hz.pm.api.common.statemachine.util; -import com.hz.pm.api.common.model.constant.RegionConst; import com.hz.pm.api.common.model.constant.StateMachineConst; import com.hz.pm.api.common.statemachine.builder.ProjectDeclareStateMachineBuilder; import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; @@ -117,13 +116,11 @@ public class StateMachineUtil { /** * 判断申报项目是否为市级项目 * - * @param project \ * @return boolean * @since 2023/02/07 17:05 */ - public static boolean isCityProject(Project project) { - String areaCode = project.getAreaCode(); - return areaCode.equals(RegionConst.RC_HZ); + public static boolean isCityProject() { + return Boolean.FALSE; } public ProjectStatusChangeEvent getProjectStatusPassEvent(Integer status) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java index a2e0980..69a40fd 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java @@ -278,7 +278,7 @@ public class ProjectFileManage { projectLibManage.saveProjectByApplyBorrow(project, user, instanceId); // 发送给第一个审批人消息 - noticeManage.sendFirtUser(project, model.getFormName(), instanceId, WorkNoticeConstant.PASS_MSG_TEMPLATE, + noticeManage.sendFirstUser(project, model.getFormName(), instanceId, WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); return instanceId; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java index 05c429a..8f83303 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java @@ -182,8 +182,6 @@ public class GovProjectCollectionManage { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) .like(StringUtils.isNotBlank(req.getProjectName()), GovBizProjectBaseinfo::getBaseProjName, req.getProjectName()) .like(StringUtils.isNotBlank(req.getBuildOrg()), GovBizProjectBaseinfo::getBaseBuildDeprt, req.getBuildOrg()) - .eq(StringUtils.isNotBlank(req.getAreaCode()), GovBizProjectBaseinfo::getBaseAreaCode, req.getAreaCode() + BizConst.NINE_AREA_CODE_LAST) - .eq(StringUtils.isNotBlank(req.getRegionCode()), GovBizProjectBaseinfo::getBaseAreaCode, req.getRegionCode() + BizConst.NINE_AREA_CODE_LAST) .gt(Objects.nonNull(req.getCreateOnMin()), GovBizProjectBaseinfo::getTongTime, req.getCreateOnMin()) .le(Objects.nonNull(req.getCreateOnMax()), GovBizProjectBaseinfo::getTongTime, req.getCreateOnMax()) .eq(StringUtils.isNotBlank(req.getProjectType()), GovBizProjectBaseinfo::getBaseProjType, req.getProjectType()) @@ -208,10 +206,10 @@ public class GovProjectCollectionManage { Map applyMap = Maps.newHashMap(); if (CollUtil.isNotEmpty(projIds)) { - List applys = projectApplyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) + List applies = projectApplyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) .in(GovBizProjectApply::getBaseProjId, projIds) .eq(GovBizProjectApply::getDeleted, Boolean.FALSE)); - applyMap = applys.stream().collect(Collectors.toMap(GovBizProjectApply::getBaseProjId, a -> a)); + applyMap = applies.stream().collect(Collectors.toMap(GovBizProjectApply::getBaseProjId, a -> a)); } Map finalApplyMap = applyMap; @@ -246,8 +244,6 @@ public class GovProjectCollectionManage { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) .like(StringUtils.isNotBlank(req.getProjectName()), GovOperationProjectBaseinfo::getBaseProjName, req.getProjectName()) .like(StringUtils.isNotBlank(req.getBuildOrg()), GovOperationProjectBaseinfo::getBaseBuildDeprt, req.getBuildOrg()) - .eq(StringUtils.isNotBlank(req.getAreaCode()), GovOperationProjectBaseinfo::getBaseAreaCode, req.getAreaCode() + BizConst.NINE_AREA_CODE_LAST) - .eq(StringUtils.isNotBlank(req.getRegionCode()), GovOperationProjectBaseinfo::getBaseAreaCode, req.getRegionCode() + BizConst.NINE_AREA_CODE_LAST) .gt(Objects.nonNull(req.getCreateOnMin()), GovOperationProjectBaseinfo::getTongTime, req.getCreateOnMin()) .le(Objects.nonNull(req.getCreateOnMax()), GovOperationProjectBaseinfo::getTongTime, req.getCreateOnMax()) .eq(StringUtils.isNotBlank(req.getProjectType()), GovOperationProjectBaseinfo::getBaseProjType, req.getProjectType()) @@ -305,8 +301,6 @@ public class GovProjectCollectionManage { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovBizProjectDraft.class) .like(StringUtils.isNotBlank(req.getProjectName()), GovBizProjectDraft::getBaseProjName, req.getProjectName()) .like(StringUtils.isNotBlank(req.getBuildOrg()), GovBizProjectDraft::getBaseBuildDeprt, req.getBuildOrg()) - .eq(StringUtils.isNotBlank(req.getAreaCode()), GovBizProjectDraft::getBaseAreaCode, req.getAreaCode() + BizConst.NINE_AREA_CODE_LAST) - .eq(StringUtils.isNotBlank(req.getRegionCode()), GovBizProjectDraft::getBaseAreaCode, req.getRegionCode() + BizConst.NINE_AREA_CODE_LAST) .gt(Objects.nonNull(req.getCreateOnMin()), GovBizProjectDraft::getTongTime, req.getCreateOnMin()) .le(Objects.nonNull(req.getCreateOnMax()), GovBizProjectDraft::getTongTime, req.getCreateOnMax()) .eq(StringUtils.isNotBlank(req.getProjectType()), GovBizProjectDraft::getBaseProjType, req.getProjectType()) @@ -349,8 +343,6 @@ public class GovProjectCollectionManage { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovOperationProjectDraft.class) .like(StringUtils.isNotBlank(req.getProjectName()), GovOperationProjectDraft::getBaseProjName, req.getProjectName()) .like(StringUtils.isNotBlank(req.getBuildOrg()), GovOperationProjectDraft::getBaseBuildDeprt, req.getBuildOrg()) - .eq(StringUtils.isNotBlank(req.getAreaCode()), GovOperationProjectDraft::getBaseAreaCode, req.getAreaCode() + BizConst.NINE_AREA_CODE_LAST) - .eq(StringUtils.isNotBlank(req.getRegionCode()), GovOperationProjectDraft::getBaseAreaCode, req.getRegionCode() + BizConst.NINE_AREA_CODE_LAST) .gt(Objects.nonNull(req.getCreateOnMin()), GovOperationProjectDraft::getTongTime, req.getCreateOnMin()) .le(Objects.nonNull(req.getCreateOnMax()), GovOperationProjectDraft::getTongTime, req.getCreateOnMax()) .eq(StringUtils.isNotBlank(req.getProjectType()), GovOperationProjectDraft::getBaseProjType, req.getProjectType()) @@ -385,8 +377,6 @@ public class GovProjectCollectionManage { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) .like(StringUtils.isNotBlank(req.getProjectName()), GovBizProjectBaseinfo::getBaseProjName, req.getProjectName()) .like(StringUtils.isNotBlank(req.getBuildOrg()), GovBizProjectBaseinfo::getBaseBuildDeprt, req.getBuildOrg()) - .eq(StringUtils.isNotBlank(req.getAreaCode()), GovBizProjectBaseinfo::getAreaCode, req.getAreaCode()) - .eq(StringUtils.isNotBlank(req.getRegionCode()), GovBizProjectBaseinfo::getAreaCode, req.getRegionCode()) .gt(Objects.nonNull(req.getCreateOnMin()), GovBizProjectBaseinfo::getTongTime, req.getCreateOnMin()) .le(Objects.nonNull(req.getCreateOnMax()), GovBizProjectBaseinfo::getTongTime, req.getCreateOnMax()) .eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) @@ -398,8 +388,6 @@ public class GovProjectCollectionManage { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) .like(StringUtils.isNotBlank(req.getProjectName()), GovOperationProjectBaseinfo::getBaseProjName, req.getProjectName()) .like(StringUtils.isNotBlank(req.getBuildOrg()), GovOperationProjectBaseinfo::getBaseBuildDeprt, req.getBuildOrg()) - .eq(StringUtils.isNotBlank(req.getAreaCode()), GovOperationProjectBaseinfo::getAreaCode, req.getAreaCode()) - .eq(StringUtils.isNotBlank(req.getRegionCode()), GovOperationProjectBaseinfo::getAreaCode, req.getRegionCode()) .gt(Objects.nonNull(req.getCreateOnMin()), GovOperationProjectBaseinfo::getTongTime, req.getCreateOnMin()) .le(Objects.nonNull(req.getCreateOnMax()), GovOperationProjectBaseinfo::getTongTime, req.getCreateOnMax()) .eq(GovOperationProjectBaseinfo::getDeleted, Boolean.FALSE) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java index 0005d94..fd86f59 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/IrsProjectManage.java @@ -46,8 +46,6 @@ public class IrsProjectManage { Page page = req.page(); UserInfoDetails user = LoginUserUtil.loginUserDetail(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class) - .eq(StringUtils.isNotBlank(req.getAreaCode()), Project::getAreaCode, req.getAreaCode()) - .eq(StringUtils.isNotBlank(req.getRegionCode()), Project::getAreaCode, req.getRegionCode()) .eq(StringUtils.isNotBlank(req.getProjectType()), Project::getProjectType, req.getProjectType()) .eq(Objects.nonNull(req.getStatus()), Project::getStatus, req.getStatus()) .eq(Objects.nonNull(req.getStage()), Project::getStage, req.getStage()) @@ -78,7 +76,7 @@ public class IrsProjectManage { if (user.getSuperAdmin() || user.getRegionAdmin()) { log.info("超管 都可看 项目档案列表"); } else { - wrapper.eq(Project::getBuildOrgCode, user.getMhUnitId()); + wrapper.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); } } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/OrgSelfAppraisalManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/OrgSelfAppraisalManage.java index 3342b60..e9f7e32 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/OrgSelfAppraisalManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/OrgSelfAppraisalManage.java @@ -158,7 +158,7 @@ public class OrgSelfAppraisalManage { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class) .in(Project::getProjectCode, projectCodes) .eq(Project::getNewest, Boolean.TRUE) - .eq(Project::getBuildOrgCode, user.getMhUnitId()) + .eq(Project::getBuildOrgCode, user.getMhUnitIdStr()) .like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); projectService.page(page, wrapper); @@ -211,7 +211,7 @@ public class OrgSelfAppraisalManage { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class) .in(Project::getProjectCode, projectCodes) .eq(Project::getNewest, Boolean.TRUE) - .eq(Project::getBuildOrgCode, user.getMhUnitId()) + .eq(Project::getBuildOrgCode, user.getMhUnitIdStr()) .like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); projectService.page(page, wrapper); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/VerifyManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/VerifyManage.java index 85a14b4..e121f82 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/VerifyManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/VerifyManage.java @@ -16,6 +16,7 @@ import com.google.common.collect.Lists; import com.hz.pm.api.common.enumeration.CommonEnum; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.common.util.StrUtils; import com.hz.pm.api.performance.constant.ProjectBizConst; import com.hz.pm.api.performance.enumration.AppraisalTypeEnum; import com.hz.pm.api.performance.enumration.RectifyStatusEnum; @@ -105,12 +106,14 @@ public class VerifyManage { List projectGroups = groupService.list(); for (PerformanceAppraisalProjectGroup projectGroup : projectGroups) { String verificationUsers = projectGroup.getVerificationUsers(); - if (verificationUsers.contains(StrPool.COMMA)) { - if (verificationUsers.contains(employeeCode)) { + if (StrUtils.isNotBlank(verificationUsers)) { + if (verificationUsers.contains(StrPool.COMMA)) { + if (verificationUsers.contains(employeeCode)) { + groups.add(projectGroup); + } + } else if (verificationUsers.equals(employeeCode)) { groups.add(projectGroup); } - } else if (verificationUsers.equals(employeeCode)) { - groups.add(projectGroup); } } // 当前登录专家没有绩效分组信息 @@ -165,7 +168,7 @@ public class VerifyManage { public PageVo groupProjectList(Long groupId, PerformanceAppraisalListReq req) { UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); - String userIdStr = String.valueOf(userDetail.getUserId()); + String userIdStr = userDetail.getUserIdStr(); // 获取分组内的项目信息 PerformanceAppraisalProjectGroup projectGroup = groupService.getById(groupId); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ConstructionController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ConstructionController.java index 3cf1cb8..4c68509 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ConstructionController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ConstructionController.java @@ -46,7 +46,7 @@ public class ConstructionController { @ApiOperation(value = "已经完善合同信息的项目列表", notes = "已经完善合同信息的项目列表") @GetMapping("/contract/project-list-perfect") public PageVo projectlistPerfect(@ModelAttribute ProjectListReq req) { - return constructionManage.projectlistPerfect(req); + return constructionManage.projectListPerfect(req); } @GetMapping("/contract/export") diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java index 50c4746..b99f18e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java @@ -96,7 +96,7 @@ public class ConstructionManage { query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); query.eq(Project::getNewest, Boolean.TRUE); //只能看自己单位的 - query.eq(Project::getBuildOrgCode, user.getMhUnitId()); + query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); query.orderByAsc(Project::getTransactionTime); Page page = projectService.page(req.page(), query); long total; @@ -130,10 +130,10 @@ public class ConstructionManage { /** * 已完善合同信息的列表 * - * @param req - * @return + * @param req \ + * @return \ */ - public PageVo projectlistPerfect(ProjectListReq req) { + public PageVo projectListPerfect(ProjectListReq req) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); LambdaQueryWrapper query = ProjectHelper.projectQuery(req); //建设中状态以后的 都是 @@ -142,7 +142,7 @@ public class ConstructionManage { .isNotNull(Project::getContractAmount))); query.eq(Project::getNewest, Boolean.TRUE); //只能看自己单位的 - query.eq(Project::getBuildOrgCode, user.getMhUnitId()); + query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); query.orderByAsc(Project::getUpdateOn); Page page = projectService.page(req.page(), query); @@ -191,7 +191,6 @@ public class ConstructionManage { } public void exportList(HttpServletResponse response, ProjectListReq param) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); LambdaQueryWrapper query = ProjectHelper.projectQuery(param); //待采购状态 query.eq(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); @@ -372,7 +371,7 @@ public class ConstructionManage { query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); query.eq(Project::getNewest, Boolean.TRUE); //只能看自己单位的 - query.eq(Project::getBuildOrgCode, user.getMhUnitId()); + query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); //交货时间 排序 query.isNotNull(Project::getDeliveryTime); query.orderByAsc(Project::getDeliveryTime); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java index 1a4b381..6308418 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java @@ -173,7 +173,7 @@ public class ConstructionPlanManage { } //发送给第一个审批人消息 - noticeManage.sendFirtUser(buildProject, model.getFormName(), instanceId, + noticeManage.sendFirstUser(buildProject, model.getFormName(), instanceId, WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); return instanceId; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java index 69dcef5..641f27b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DeclaredProjectManage.java @@ -113,7 +113,7 @@ public class DeclaredProjectManage { */ @Transactional(rollbackFor = Exception.class) public String startTheProcess(DefaultDeclaredDTO dto) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); ProjectDTO projectInfo = dto.getProjectInfo(); projectInfo.setBuildOrgCode(user.getMhUnitIdStr()); @@ -176,7 +176,7 @@ public class DeclaredProjectManage { } //发送给第一个审批人消息 - noticeManage.sendFirtUser(buildProject, model.getFormName(), instanceId, + noticeManage.sendFirstUser(buildProject, model.getFormName(), instanceId, WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); return instanceId; @@ -253,7 +253,7 @@ public class DeclaredProjectManage { Project buildProject = projectLibManage.saveProjectInDeclared(projectDto, instanceId, user.getUserId()); //发送给第一个审批人消息 - noticeManage.sendFirtUser(buildProject, model.getFormName(), instanceId, + noticeManage.sendFirstUser(buildProject, model.getFormName(), instanceId, WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); return instanceId; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DefaultDeclaredProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DefaultDeclaredProjectManage.java index 4f0e67e..a18cd53 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DefaultDeclaredProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DefaultDeclaredProjectManage.java @@ -1,5 +1,6 @@ package com.hz.pm.api.projectdeclared.manage; +import cn.hutool.core.lang.Assert; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.TypeReference; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -128,16 +129,14 @@ public class DefaultDeclaredProjectManage { } public ProcessInstanceUserDto buildUser(Long userId) { - UserFullInfoDTO userInfoDetail = userInfoHelper.getUserFullInfo(userId); - - VUtils.isTrue(Objects.isNull(userInfoDetail)) - .throwMessage(String.format("【%s】获取不到用户!", userId)); + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(userId); + Assert.notNull(user, "【%s】获取不到用户!", userId); return ProcessInstanceUserDto.builder() - .userId(String.valueOf(userInfoDetail.getUserId())) - .userName(userInfoDetail.getRealName()) - .orgCode(String.valueOf(userInfoDetail.getMhUnitId())) - .orgName(userInfoDetail.getMhUnitName()) + .userId(user.getUserIdStr()) + .userName(user.getRealName()) + .orgCode(user.getMhUnitIdStr()) + .orgName(user.getMhUnitName()) .build(); } @@ -153,7 +152,7 @@ public class DefaultDeclaredProjectManage { return Collections.emptyMap(); } - String startOrgCode = String.valueOf(userFullInfo.getMhUnitId()); + String startOrgCode = userFullInfo.getMhUnitIdStr(); String startOrgName = userFullInfo.getMhUnitName(); String startOrgParentCode; String startOrgParentName; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java index 864fe9f..19f486a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java @@ -283,7 +283,7 @@ public class DelayedApplyManage { projectLibManage.saveProjectByApplyDelay(dto, project, instanceId); //发送给第一个审批人消息 - noticeManage.sendFirtUser(project, model.getFormName(), instanceId, + noticeManage.sendFirstUser(project, model.getFormName(), instanceId, WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); return instanceId; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java index bbf32d6..e56d51e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java @@ -6,27 +6,25 @@ 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.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.util.ExcelDownUtil; import com.hz.pm.api.common.util.ExcelExportStyle; import com.hz.pm.api.projectdeclared.model.dto.DeclaredProjectExportDTO; import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; import com.hz.pm.api.projectdeclared.model.vo.FinalAcceptanceVO; -import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; -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.enumeration.InstTypeEnum; +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.IProjectService; -import com.hz.pm.api.staging.enums.MsgTypeEnum; import com.hz.pm.api.sys.manage.NoticeManage; -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.exception.BizException; @@ -55,6 +53,9 @@ import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; +import static com.hz.pm.api.staging.enums.MsgTypeEnum.PROJECT_REVIEW; +import static com.hz.pm.api.todocenter.constant.WorkNoticeConstant.PASS_MSG_TEMPLATE; + /** * @Classname FinalAcceptanceManage * @Description 终验 @@ -90,7 +91,7 @@ public class FinalAcceptanceManage { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); //待终验 并且还未过期 //只能看自己单位的 - query.eq(Project::getBuildOrgCode, user.getMhUnitId()); + query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); query.ge(Project::getPlanAcceptanceTime, LocalDateTime.now()); @@ -238,8 +239,7 @@ public class FinalAcceptanceManage { InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode(), Boolean.FALSE); //发送给第一个审批人消息 - noticeManage.sendFirtUser(projectInfo, model.getFormName(), instanceId, - WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); + noticeManage.sendFirstUser(projectInfo, model.getFormName(), instanceId, PASS_MSG_TEMPLATE, PROJECT_REVIEW); return instanceId; } @@ -293,9 +293,7 @@ public class FinalAcceptanceManage { InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode(), Boolean.TRUE); //发送给第一个审批人消息 - noticeManage.sendFirtUser(projectInfo, model.getFormName(), instanceId, - WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); - + noticeManage.sendFirstUser(projectInfo, model.getFormName(), instanceId, PASS_MSG_TEMPLATE, PROJECT_REVIEW); return instanceId; } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java index 4e2f66b..79364db 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java @@ -178,16 +178,12 @@ public class PrequalificationDeclaredProjectManage { //把条件值给放入工作流 defaultDeclaredProjectManage.buildCondition(params, projectInfo); - String regionCode = projectInfo.getAreaCode(); - WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) - .eq(WflowModels::getRegionCode, regionCode) .eq(WflowModels::getProcessType, ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode()) .last(BizConst.LIMIT_1)); if (Objects.isNull(model)) { - log.error("此 【{}】区域找不到 预审流程配置", regionCode); - throw new BusinessException(String.format("此 【%s】区域找不到 预审流程配置", regionCode)); + throw new BusinessException("找不到预审流程配置"); } // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 @@ -206,7 +202,7 @@ public class PrequalificationDeclaredProjectManage { } //发送给第一个审批人消息 - noticeManage.sendFirtUser(projectInfo, model.getFormName(), instanceId, + noticeManage.sendFirstUser(projectInfo, model.getFormName(), instanceId, WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); return instanceId; @@ -295,18 +291,17 @@ public class PrequalificationDeclaredProjectManage { * * @param query */ - public UserFullInfoDTO buildPermission(LambdaQueryWrapper query, UserFullInfoDTO user) { + public void buildPermission(LambdaQueryWrapper query, UserFullInfoDTO user) { if (user.getIsOrgAdmin()) { //单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 - query.and(q1 -> q1.eq(Project::getBuildOrgCode, user.getMhUnitId()) + query.and(q1 -> q1.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()) .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.getMhUnitId()))); + .eq(Project::getSuperOrgCode, user.getMhUnitIdStr()))); } else { - query.eq(Project::getBuildOrgCode, user.getMhUnitId()); + query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); } - return user; } public void exportList(HttpServletResponse response, PrequalificationDeclaredListReq preReq) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java index f8dc01d..d0a6b4c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java @@ -70,10 +70,10 @@ public class PurchaseManage { */ public PageVo projectLibList(ProjectListReq req) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); + Assert.notNull(user, "获取登录用户失败!"); LambdaQueryWrapper query = ProjectHelper.projectQuery(req); //只能看自己单位的 - query.eq(Project::getBuildOrgCode, user.getMhUnitId()); + query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); //待采购状态 query.in(Project::getStatus, Lists.newArrayList(ProjectStatusEnum.TO_BE_PURCHASED.getCode(), ProjectStatusEnum.OPERATION.getCode())); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByDeptJointManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByDeptJointManage.java index acdd7b0..90af76e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByDeptJointManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewByDeptJointManage.java @@ -1,18 +1,16 @@ package com.hz.pm.api.projectdeclared.manage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Maps; -import com.ningdatech.basic.function.VUtils; import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.manage.ProjectLibManage; 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.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.todocenter.constant.WorkNoticeConstant; +import com.ningdatech.basic.function.VUtils; import com.wflow.bean.entity.WflowModels; import com.wflow.exception.BusinessException; import com.wflow.workflow.bean.dto.OrgInfoDTO; @@ -24,7 +22,6 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; -import java.time.LocalDateTime; import java.util.Collections; import java.util.Map; import java.util.Objects; @@ -67,16 +64,13 @@ public class ReviewByDeptJointManage { VUtils.isTrue(Objects.isNull(project.getId())).throwMessage("提交失败 缺少项目ID!"); Project projectInfo = projectService.getNewProject(project.getId()); VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); - String regionCode = projectInfo.getAreaCode(); WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) - .eq(WflowModels::getRegionCode, regionCode) .eq(WflowModels::getProcessType, ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode()) .last("limit 1")); if (Objects.isNull(model)) { - log.error("此 【{}】区域找不到 部门联审申报流程配置", regionCode); - throw new BusinessException(String.format("此 【%s】区域找不到 部门联审申报流程配置", regionCode)); + throw new BusinessException("找不到部门联审申报流程配置"); } //要判断 项目当前状态 是不是 部门联审 VUtils.isTrue(!ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW.getCode().equals(projectInfo.getStatus()) || @@ -84,8 +78,7 @@ public class ReviewByDeptJointManage { .throwMessage("提交失败 该项目不是 省级部门联审状态状态或者未立项阶段"); // 再判断 该项目是否 真实走完 预审审批 并且提取出 提交人 - VUtils.isTrue(Objects.isNull(projectInfo.getSponsor())) - .throwMessage("提交失败 项目信息 缺少项目发起人!"); + VUtils.isTrue(Objects.isNull(projectInfo.getSponsor())).throwMessage("提交失败 项目信息 缺少项目发起人!"); ProcessStartParamsVo params = new ProcessStartParamsVo(); //发起人的信息 @@ -104,8 +97,7 @@ public class ReviewByDeptJointManage { projectInfo = projectLibManage.saveProjectWithVersion(projectInfo, instanceId, ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode()); //发送给第一个审批人消息 - noticeManage.sendFirtUser(projectInfo, model.getFormName(), instanceId, - WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); + noticeManage.sendFirstUser(projectInfo, model.getFormName(), instanceId, WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); return Boolean.TRUE; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java index eaa4b64..3c1940d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java @@ -12,7 +12,6 @@ import com.wflow.bean.entity.WflowModels; import com.wflow.workflow.bean.vo.ProcessDetailVO; import com.wflow.workflow.service.ProcessModelService; import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.Collections; @@ -67,7 +66,7 @@ public class ProcessExecuteChainHandle { } } else if (processBusinessHandle instanceof ProvinceUnitedReviewHandle) { //省级联审 - if (StateMachineUtil.isCityProject(project) && StateMachineUtil.judgeDeclareAmount(project, + if (StateMachineUtil.isCityProject() && StateMachineUtil.judgeDeclareAmount(project, ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)) { handles.add(processBusinessHandle); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectHelper.java index e34c4fe..8595aff 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectHelper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/helper/ProjectHelper.java @@ -34,8 +34,7 @@ public class ProjectHelper { **/ public static LambdaQueryWrapper projectQuery(ProjectListReq req) { LambdaQueryWrapper query = new LambdaQueryWrapper<>(); - query.eq(req.getRegionCode() != null, Project::getAreaCode, req.getRegionCode()) - .eq(req.getUserId() != null, Project::getCreateBy, req.getUserId()) + query.eq(req.getUserId() != null, Project::getCreateBy, req.getUserId()) .like(StrUtil.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()) .eq(req.getProjectType() != null, Project::getProjectType, req.getProjectType()) .eq(req.getProjectYear() != null, Project::getProjectYear, req.getProjectYear()) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ApplicationManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ApplicationManage.java index fc81cfc..0e1c3dc 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ApplicationManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ApplicationManage.java @@ -147,7 +147,7 @@ public class ApplicationManage { projectService.page(page, Wrappers.lambdaQuery(Project.class) .eq(Project::getStage, ProjectStatusEnum.NOT_APPROVED.getCode()) .eq(Project::getStatus, ProjectStatusEnum.TO_BE_APP_REGISTER.getCode()) - .eq(Project::getBuildOrgCode, user.getMhUnitId())); + .eq(Project::getBuildOrgCode, user.getMhUnitIdStr())); if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectCollectionManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectCollectionManage.java index 2f252c5..646c1db 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectCollectionManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectCollectionManage.java @@ -67,13 +67,6 @@ public class ProjectCollectionManage { .like(StringUtils.isNotBlank(req.getBuildOrg()), ProjectCollection::getBuildOrg, req.getBuildOrg()) .eq(Objects.nonNull(buildOrgCode), ProjectCollection::getBuildOrgCode, buildOrgCode); //处理 行政区域 - if (StringUtils.isNotBlank(req.getRegionCode())) { - List regions = regionCacheHelper.listChildren(req.getRegionCode(), req.getRegionLevel()); - - if (CollUtil.isNotEmpty(regions)) { - wrapper.in(ProjectCollection::getAreaCode, regions.stream().map(RegionDTO::getRegionCode).collect(Collectors.toList())); - } - } collectionService.page(page, wrapper); @@ -81,12 +74,11 @@ public class ProjectCollectionManage { return PageVo.empty(); } - List res = page.getRecords().stream() - .map(record -> { - ProjectCollectionVO vo = BeanUtil.copyProperties(record, ProjectCollectionVO.class); - vo.setArea(regionCacheHelper.getDisplayName(record.getAreaCode(), RegionConst.RL_COUNTY)); - return vo; - }).collect(Collectors.toList()); + List res = page.getRecords().stream().map(w -> { + ProjectCollectionVO vo = BeanUtil.copyProperties(w, ProjectCollectionVO.class); + vo.setArea(regionCacheHelper.getDisplayName(w.getAreaCode(), RegionConst.RL_COUNTY)); + return vo; + }).collect(Collectors.toList()); return PageVo.of(res, page.getTotal()); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java index ea0fed2..ccffadd 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java @@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.lang.Assert; +import cn.hutool.core.util.NumberUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; @@ -86,6 +87,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.flowable.engine.TaskService; import org.flowable.task.api.Task; +import org.flowable.task.api.TaskInfo; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; @@ -355,8 +357,11 @@ public class ProjectLibManage { Map userMap) { if (map.containsKey(instCode)) { List tasks = map.get(instCode); - return tasks.stream().map(task -> userMap.get(Long.parseLong(task.getAssignee()))) - .filter(Objects::nonNull).collect(Collectors.toList()); + return tasks.stream().map(TaskInfo::getAssignee) + .filter(NumberUtil::isNumber) + .map(w -> userMap.get(Long.parseLong(w))) + .filter(Objects::nonNull) + .collect(Collectors.toList()); } return Collections.emptyList(); } @@ -365,9 +370,13 @@ public class ProjectLibManage { if (CollUtil.isEmpty(tasks)) { return Collections.emptyMap(); } - List users = userInfoHelper.listUserFullInfoByUserIds( - tasks.stream().map(w -> Long.parseLong(w.getAssignee())) - .collect(Collectors.toSet())); + Set userIds = tasks.stream().filter(w -> NumberUtil.isNumber(w.getAssignee())) + .map(w -> Long.parseLong(w.getAssignee())) + .collect(Collectors.toSet()); + if (userIds.isEmpty()) { + return Collections.emptyMap(); + } + List users = userInfoHelper.listUserFullInfoByUserIds(userIds); return users.stream().collect(Collectors.toMap(UserFullInfoDTO::getUserId, u -> u)); } @@ -719,7 +728,7 @@ public class ProjectLibManage { .in(ProjectCoreBusinessIndicators::getApplicationId, applicationIds)); Map> coreBizMap = coreBizs.stream().collect(Collectors.groupingBy(ProjectCoreBusinessIndicators::getApplicationId)); - Optional.ofNullable(applications).ifPresent(apps -> + Optional.of(applications).ifPresent(apps -> vo.setProjectApplications(CollUtils.convert(apps, app -> ProjectHelper.convertVOWithMap(app, coreBizMap)) )); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java index 5fa9af5..3e033cf 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectRenewalFundManage.java @@ -123,7 +123,7 @@ public class ProjectRenewalFundManage { //项目查最新 query.eq(Project::getNewest, Boolean.TRUE); //自己单位 - query.eq(Project::getBuildOrgCode, user.getMhUnitId()); + query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); //立项批复后 都可以 query.gt(Project::getStatus, ProjectStatusEnum.APPROVED_AFTER_CHOICE.getCode()); Page page = projectService.page(req.page(), query); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml index 3ddb4ae..eb22a32 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml @@ -235,12 +235,6 @@ and b.id = #{req.id} - - and b.base_area_code = concat(#{req.regionCode},'000') - - - and b.base_area_code = concat(#{req.regionCode},'000') - and b.base_proj_name like concat('%',#{req.projectName},'%') @@ -350,12 +344,6 @@ and p.id = #{req.id} - - and p.area_code = #{req.regionCode} - - - and p.area_code = #{req.areaCode} - and p.project_name like concat('%',#{req.projectName},'%') @@ -399,17 +387,6 @@ and (p.build_org_code = #{req.userValue} or (p.stage = 10000 and p.status = 10003 and p.super_org_code = #{req.userValue})) - - - and p.area_code in - - #{code} - - - - and p.area_code = #{req.userRegionCode} - - UNION ALL ( SELECT @@ -441,12 +418,6 @@ and b.id = #{req.id} - - and b.base_area_code = concat(#{req.regionCode},'000') - - - and b.base_area_code = concat(#{req.regionCode},'000') - and b.base_proj_name like concat('%',#{req.projectName},'%') @@ -488,19 +459,7 @@ and b.base_build_deprt_ding = #{req.userValue} - - - - and b.base_area_code in - - concat(#{code},'000') - - - - and b.base_area_code = concat(#{req.userRegionCode},'000') - - - ) + ) ) ORDER BY update_on DESC diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/InstTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/InstTypeEnum.java index 245dba7..affeed2 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/InstTypeEnum.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/enumeration/InstTypeEnum.java @@ -8,8 +8,8 @@ import org.apache.commons.lang3.StringUtils; import java.util.Objects; /** - * * 实例类型枚举 + * * @author CMM * @since 2023/02/24 16:14 */ @@ -22,13 +22,13 @@ public enum InstTypeEnum { */ UNIT_INNER_AUDIT(1, "单位内部审批流程"), PRELIMINARY_PREVIEW(2, "项目预审审批流程"), - DEPT_UNITED_REVIEW(3,"部门联合审批流程"), - CONSTRUCTION_PLAN_REVIEW(4,"建设方案审批流程"), - PROJECT_FINAL_INSPECTION(5,"验收申报审批流程"), + DEPT_UNITED_REVIEW(3, "部门联合审批流程"), + CONSTRUCTION_PLAN_REVIEW(4, "建设方案审批流程"), + PROJECT_FINAL_INSPECTION(5, "验收申报审批流程"), - APPLY_DELAY(6,"申请延期审批流程"), + APPLY_DELAY(6, "申请延期审批流程"), - APPLY_BORROW(7,"申请借阅审批流程"); + APPLY_BORROW(7, "申请借阅审批流程"); private Integer code; private String desc; @@ -56,4 +56,9 @@ public enum InstTypeEnum { } return null; } + + public boolean eq(Integer code) { + return this.getCode().equals(code); + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java index afc231f..29339e5 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/ProjectListReq.java @@ -30,15 +30,6 @@ public class ProjectListReq extends PagePo { private Long id; - @ApiModelProperty("区域编码") - private String regionCode; - - @ApiModelProperty("区域编码") - private String areaCode; - - @ApiModelProperty("区域等级") - private Integer regionLevel = 3; - @ApiModelProperty("项目名称") private String projectName; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/safety/manage/SafetyRiskManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/safety/manage/SafetyRiskManage.java index b475e83..a6c2aa8 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/safety/manage/SafetyRiskManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/safety/manage/SafetyRiskManage.java @@ -65,7 +65,6 @@ public class SafetyRiskManage { public PageVo personMonitorList(ProjectListReq req) { LambdaQueryWrapper query = Wrappers.lambdaQuery(Project.class) .eq(Project::getNewest, Boolean.TRUE) - .eq(StringUtils.isNotBlank(req.getRegionCode()), Project::getAreaCode, req.getRegionCode()) .like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()) .like(StringUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) .orderByDesc(Project::getUpdateOn); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/CcTaskListener.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/CcTaskListener.java index 2f21cbd..ad98880 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/CcTaskListener.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/CcTaskListener.java @@ -114,7 +114,7 @@ public class CcTaskListener { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(Long.valueOf(task.getUserId())); //发送消息 - noticeManage.sendNotice(task.getUserId(), Objects.nonNull(user) ? user.getUserId() : 93L, project, instance.getProcessDefinitionName(), + noticeManage.sendNotice(Objects.nonNull(user) ? user.getUserId() : 93L, project, instance.getProcessDefinitionName(), CC_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW_CC); }); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java index 08ee29f..f37de6b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java @@ -208,7 +208,7 @@ public class ProcessEndListener { // 当前项目状态是部门联审中 case DEPARTMENT_JOINT_REVIEW: //如果是 区县 并且 500万及以上要推送省局重大项目 - if (!StateMachineUtil.isCityProject(declaredProject) && + if (!StateMachineUtil.isCityProject() && StateMachineUtil.judgeDeclareAmount(declaredProject, ProjectDeclareConst.Number.DECLARE_COUNTY_AMOUNT_JUDGEMENT)) { try { @@ -235,8 +235,7 @@ public class ProcessEndListener { } } //发送消息 - noticeManage.sendNotice(instance.getStartUserId(), userId, declaredProject, instance.getProcessDefinitionName(), - PASS_MSG_TEMPLATE2, MsgTypeEnum.PROJECT_REVIEW_PASS); + noticeManage.sendNotice(userId, declaredProject, instance.getProcessDefinitionName(), PASS_MSG_TEMPLATE2, MsgTypeEnum.PROJECT_REVIEW_PASS); } else { // 若有下一个审核人(当前节点的用户),会签/或签会有多个 // 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 @@ -246,7 +245,7 @@ public class ProcessEndListener { throw new BizException("审核人信息不存在!"); } //发送消息 - noticeManage.sendNotice(currentEmployeeCode, userId, declaredProject, instance.getProcessDefinitionName(), + noticeManage.sendNotice(userId, declaredProject, instance.getProcessDefinitionName(), PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java index 144f745..0ec49ce 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java @@ -203,25 +203,24 @@ public class NoticeManage { /** * 发送消息 * - * @param employeeCode 员工号 * @param userId 用户ID * @param project 项目 * @param procDefinitionName 流程定义名 * @param template 消息模板内容 * @param msgTypeEnum 枚举 */ - public void sendNotice(String employeeCode, Long userId, Project project, String procDefinitionName, + public void sendNotice(Long userId, Project project, String procDefinitionName, String template, MsgTypeEnum msgTypeEnum) { // 获取发送浙政钉工作通知必要信息 - WorkNoticeInfo passWorkNoticeInfo = getSendWorkNoticeInfo(employeeCode); String passMsg = String.format(template, project.getProjectName(), procDefinitionName); - passWorkNoticeInfo.setMsg(passMsg); // 放入系统通知表中,保存记录 Notify notify = assemblyAuditNotify(userId, project, passMsg); notify.setType(msgTypeEnum.name()); notifyService.save(notify); // 放入工作通知暂存表中,通过扫表异步发送 - workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo, msgTypeEnum); + // WorkNoticeInfo passWorkNoticeInfo = getSendWorkNoticeInfo(employeeCode); + // passWorkNoticeInfo.setMsg(passMsg); + // workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo, msgTypeEnum); } /** @@ -294,7 +293,7 @@ public class NoticeManage { * @param template * @param msgTypeEnum */ - public void sendFirtUser(Project project, String formName, String instanceId, String template, MsgTypeEnum msgTypeEnum) { + public void sendFirstUser(Project project, String formName, String instanceId, String template, MsgTypeEnum msgTypeEnum) { try { List activityInstances = runtimeService.createActivityInstanceQuery() .processInstanceId(instanceId) @@ -306,8 +305,7 @@ public class NoticeManage { for (ActivityInstance activityInstance : activityInstances) { if (StringUtils.isNotBlank(activityInstance.getAssignee())) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(Long.valueOf(activityInstance.getAssignee())); - sendNotice(activityInstance.getAssignee(), user.getUserId(), project, formName, - template, msgTypeEnum); + sendNotice(user.getUserId(), project, formName, template, msgTypeEnum); } } } catch (Exception e) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/UserGuidanceManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/UserGuidanceManage.java index 75fa8c4..a4f956f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/UserGuidanceManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/UserGuidanceManage.java @@ -79,7 +79,7 @@ public class UserGuidanceManage { Integer finishedNum = 0; //1.去查询 用户所在单位 有没有单位默认流程配置 并且process 不能为空 WflowOrgModels orgModel = orgProcdefService.getOne(Wrappers.lambdaQuery(WflowOrgModels.class) - .eq(WflowOrgModels::getOrgCode, user.getMhUnitId()) + .eq(WflowOrgModels::getOrgCode, user.getMhUnitIdStr()) .eq(WflowOrgModels::getType, ProcessDefTypeEnum.DEFAULT.name()) .eq(WflowOrgModels::getIsDelete, Boolean.FALSE) .last(BizConst.LIMIT_1)); @@ -105,7 +105,7 @@ public class UserGuidanceManage { signatureGuidance.setRemark(UserGuidanceContant.Signature.GUIDANCE_REMARK); signatureGuidance.setPath(UserGuidanceContant.Signature.GUIDANCE_PATH); CompanySignature signature = signatureService.getOne(Wrappers.lambdaQuery(CompanySignature.class) - .eq(CompanySignature::getOrganizationCode, user.getMhUnitId()) + .eq(CompanySignature::getOrganizationCode, user.getMhUnitIdStr()) .last(BizConst.LIMIT_1)); if (Objects.isNull(signature)) { signatureGuidance.setIsFinish(Boolean.FALSE); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/utils/EarlyWarningUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/utils/EarlyWarningUtil.java index bf440da..1ac5ae8 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/utils/EarlyWarningUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/utils/EarlyWarningUtil.java @@ -49,10 +49,10 @@ public class EarlyWarningUtil { if (user.getSuperAdmin()) { // 看所有 } else if (user.getIsOrgAdmin()) { - wrapper.eq(Project::getBuildOrgCode, user.getMhUnitId()); + wrapper.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); } else { //否则都只能看自己单位的 - wrapper.eq(Project::getBuildOrgCode, user.getMhUnitId()); + wrapper.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java index 3a8bd21..1f0f81d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java @@ -1,70 +1,71 @@ package com.hz.pm.api.todocenter.manage; -import static com.hz.pm.api.todocenter.constant.WorkNoticeConstant.*; - -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.*; -import java.util.stream.Collectors; - +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DatePattern; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; -import com.ningdatech.basic.util.NdDateUtils; -import com.ningdatech.file.service.FileService; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.model.constant.ProjectDeclareConst; +import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.filemanage.model.entity.ProjectApplyBorrow; import com.hz.pm.api.filemanage.service.INdProjectApplyBorrowService; import com.hz.pm.api.projectdeclared.converter.ApplicationConverter; -import com.hz.pm.api.projectdeclared.model.entity.ProjectConstructionSuggestions; -import com.hz.pm.api.projectdeclared.service.IConstrctionSuggestionsService; -import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; -import com.hz.pm.api.projectlib.model.entity.ProjectDelayApply; -import com.hz.pm.api.projectlib.service.INdProjectDelayApplyService; -import com.hz.pm.api.provincial.service.IJoinReviewProvincialBureauService; -import org.apache.commons.lang3.StringUtils; -import org.flowable.engine.HistoryService; -import org.flowable.engine.RuntimeService; -import org.flowable.engine.TaskService; -import org.flowable.engine.history.HistoricProcessInstance; -import org.flowable.engine.task.Comment; -import org.flowable.variable.api.history.HistoricVariableInstance; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.exception.BizException; -import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.projectdeclared.manage.DeclaredProjectManage; import com.hz.pm.api.projectdeclared.model.dto.ProjectDraftSaveDTO; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectdeclared.model.entity.ProjectConstructionSuggestions; +import com.hz.pm.api.projectdeclared.service.IConstrctionSuggestionsService; import com.hz.pm.api.projectlib.model.dto.ProjectApplicationDTO; 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.ProjectApplication; +import com.hz.pm.api.projectlib.model.entity.ProjectDelayApply; import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; +import com.hz.pm.api.projectlib.service.INdProjectDelayApplyService; import com.hz.pm.api.projectlib.service.IProjectApplicationService; import com.hz.pm.api.projectlib.service.IProjectInstService; import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.provincial.service.IJoinReviewProvincialBureauService; 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.todocenter.constant.TodoCenterConst; import com.hz.pm.api.user.util.LoginUserUtil; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.file.service.FileService; import com.wflow.contants.HisProInsEndActId; import com.wflow.workflow.bean.process.ProgressNode; import com.wflow.workflow.bean.process.enums.NodeTypeEnum; import com.wflow.workflow.bean.vo.ProcessProgressVo; import com.wflow.workflow.enums.ProcessHandlerEnum; import com.wflow.workflow.service.ProcessInstanceService; - -import cn.hutool.core.collection.CollUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.flowable.engine.HistoryService; +import org.flowable.engine.RuntimeService; +import org.flowable.engine.TaskService; +import org.flowable.engine.history.HistoricProcessInstance; +import org.flowable.engine.task.Comment; +import org.flowable.variable.api.history.HistoricVariableInstance; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.HashMap; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; + +import static com.hz.pm.api.todocenter.constant.WorkNoticeConstant.*; /** * @Classname HandlerManage @@ -181,7 +182,7 @@ public class HandlerManage { case DEPARTMENT_JOINT_REVIEW: log.info("部门联审成功后 要判断是否是 区县重大项目"); - Boolean isImport = !StateMachineUtil.isCityProject(declaredProject) && + boolean isImport = !StateMachineUtil.isCityProject() && StateMachineUtil.judgeDeclareAmount(declaredProject, ProjectDeclareConst.Number.DECLARE_COUNTY_AMOUNT_JUDGEMENT); log.info("isImport :{}", isImport); @@ -199,8 +200,8 @@ public class HandlerManage { log.info("区县推送省级联审失败[{}],{}", declaredProject.getProjectName(), e.getMessage()); log.error("区县推送省级联审失败:" + e); } - break; } + break; // 当前项目状态是单位内部审核中 case UNDER_INTERNAL_AUDIT: // 当前项目状态是方案评审中 @@ -218,8 +219,7 @@ public class HandlerManage { } } //发送消息 - noticeManage.sendNotice(instance.getStartUserId(), userId, declaredProject, instance.getProcessDefinitionName(), - PASS_MSG_TEMPLATE2, MsgTypeEnum.PROJECT_REVIEW_PASS); + noticeManage.sendNotice(userId, declaredProject, instance.getProcessDefinitionName(), PASS_MSG_TEMPLATE2, MsgTypeEnum.PROJECT_REVIEW_PASS); } else { // 若有下一个审核人(当前节点的用户),会签/或签会有多个 // 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 @@ -229,7 +229,7 @@ public class HandlerManage { throw new BizException("审核人信息不存在!"); } //发送消息 - noticeManage.sendNotice(currentEmployeeCode, userId, declaredProject, instance.getProcessDefinitionName(), + noticeManage.sendNotice(userId, declaredProject, instance.getProcessDefinitionName(), PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); } } @@ -316,7 +316,7 @@ public class HandlerManage { updateRejectProjectStatus(userId, declaredProject, instType); } //发送消息 - noticeManage.sendNotice(instance.getStartUserId(), userId, declaredProject, instance.getProcessDefinitionName(), + noticeManage.sendNotice(userId, declaredProject, instance.getProcessDefinitionName(), REJECT_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW_REJECT); } @@ -412,26 +412,24 @@ public class HandlerManage { } // 给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被退回,请及时处理。 //发送消息 - noticeManage.sendNotice(instance.getStartUserId(), userId, declaredProject, instance.getProcessDefinitionName(), - BACK_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW_BACK); + noticeManage.sendNotice(userId, declaredProject, instance.getProcessDefinitionName(), BACK_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW_BACK); } /** * 当为通过操作时,更新项目表中项目状态 * - * @param userId - * @param declaredProject - * @return void + * @param userId \ + * @param project \ * @author CMM * @since 2023/02/08 */ - public void updatePassProjectStatus(Long userId, Project declaredProject) { + public void updatePassProjectStatus(Long userId, Project project) { try { - stateMachineUtil.pass(declaredProject); - declaredProject.setUpdateOn(LocalDateTime.now()); - declaredProject.setUpdateBy(userId); - projectService.updateById(declaredProject); + stateMachineUtil.pass(project); + project.setUpdateOn(LocalDateTime.now()); + project.setUpdateBy(userId); + projectService.updateById(project); } catch (Exception e) { log.error("状态机执行失败", e); throw new BizException("状态机执行失败!"); @@ -441,76 +439,76 @@ public class HandlerManage { /** * 当为驳回操作时,更新项目表中的项目状态 * - * @param userId - * @param declaredProject - * @param instType - * @return void + * @param userId \ + * @param project \ + * @param instType \ * @author CMM * @since 2023/02/08 */ - private void updateRejectProjectStatus(Long userId, Project declaredProject, Integer instType) { - stateMachineUtil.reject(declaredProject); + private void updateRejectProjectStatus(Long userId, Project project, Integer instType) { + stateMachineUtil.reject(project); LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(); - declaredProject.setUpdateOn(LocalDateTime.now()); - declaredProject.setUpdateBy(userId); - projectService.updateById(declaredProject); + project.setUpdateOn(LocalDateTime.now()); + project.setUpdateBy(userId); + projectService.updateById(project); // 如果是预审审批驳回,需要重新盖章,原来盖过章的文件要清空 - if (InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType)) { + if (InstTypeEnum.PRELIMINARY_PREVIEW.eq(instType)) { updateWrapper.set(Project::getPretrialFileId, null) .set(Project::getPretrialFileName, null) - .eq(Project::getId, declaredProject.getId()); - projectService.update(updateWrapper); - } else if (InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(instType)) { + .eq(Project::getId, project.getId()); + } else if (InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.eq(instType)) { updateWrapper.set(Project::getConstructFileId, null) .set(Project::getConstructFileName, null) - .eq(Project::getId, declaredProject.getId()); - projectService.update(updateWrapper); + .eq(Project::getId, project.getId()); + } else { + return; } + projectService.update(updateWrapper); } /** * 当为撤回操作时,更新项目表中的项目状态为前一个状态 * * @param userId - * @param declaredProject + * @param project * @return void * @author CMM * @since 2023/02/08 */ @Transactional(rollbackFor = Exception.class) - public void updateWithdrawProjectStatus(Long userId, Project declaredProject) { + public void updateWithdrawProjectStatus(Long userId, Project project) { // 删除关联表信息 projectInstService.remove(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getProjectId, declaredProject.getId()) - .eq(ProjectInst::getInstCode, declaredProject.getInstCode())); + .eq(ProjectInst::getProjectId, project.getId()) + .eq(ProjectInst::getInstCode, project.getInstCode())); //删除项目的实例信息 - historyService.deleteHistoricProcessInstance(declaredProject.getInstCode()); + historyService.deleteHistoricProcessInstance(project.getInstCode()); - stateMachineUtil.withDraw(declaredProject); - declaredProject.setUpdateOn(LocalDateTime.now()); - declaredProject.setUpdateBy(userId); - declaredProject.setInstCode(TodoCenterConst.Declared.NULL_INST_CODE); - projectService.updateById(declaredProject); + stateMachineUtil.withDraw(project); + project.setUpdateOn(LocalDateTime.now()); + project.setUpdateBy(userId); + project.setInstCode(TodoCenterConst.Declared.NULL_INST_CODE); + projectService.updateById(project); } public void deleteBackComments(List approves) { if (CollUtil.isNotEmpty(approves)) { for (HistoricVariableInstance approve : approves) { - if (approve.getValue() instanceof ProcessHandlerEnum) { - if (ProcessHandlerEnum.BACK.equals(ProcessHandlerEnum.getEnumByName(String.valueOf(approve.getValue())))) { - runtimeService.removeVariable(approve.getProcessInstanceId(), approve.getVariableName()); - - Comment comment; - Optional first = taskService.getProcessInstanceComments(approve.getProcessInstanceId()) - .stream() - .filter(c -> c.getTaskId().equals(approve.getVariableName().replace("approve_", StringUtils.EMPTY))) - .findFirst(); - if (first.isPresent()) { - comment = first.get(); - taskService.deleteComment(comment.getId()); - } - break; + if (approve.getValue() instanceof ProcessHandlerEnum + && (ProcessHandlerEnum.BACK.equals(ProcessHandlerEnum.getEnumByName(String.valueOf(approve.getValue()))))) { + runtimeService.removeVariable(approve.getProcessInstanceId(), approve.getVariableName()); + + Comment comment; + Optional first = taskService.getProcessInstanceComments(approve.getProcessInstanceId()) + .stream() + .filter(c -> c.getTaskId().equals(approve.getVariableName().replace("approve_", StringUtils.EMPTY))) + .findFirst(); + if (first.isPresent()) { + comment = first.get(); + taskService.deleteComment(comment.getId()); } + break; + } } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java index cc3d74e..77e0c9d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java @@ -154,12 +154,8 @@ public class TodoCenterManage { * @since 2023/02/18 */ public PageVo todoProjectList(ToBeProcessedReq param) { - String userIdStr = String.valueOf(param.getUserId()); - if (StringUtils.isBlank(userIdStr)) { - // 获取登录用户ID - Long userId = Optional.ofNullable(param.getLoginUserId()).orElseGet(LoginUserUtil::getUserId); - userIdStr = String.valueOf(userId); - } + Long userId = Optional.ofNullable(param.getUserId()).orElseGet(LoginUserUtil::getUserId); + String userIdStr = String.valueOf(userId); // 查出项目库项目 ProjectListReq projectListReq = new ProjectListReq(); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/TodoServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/TodoServiceImpl.java index 665df6a..ce38589 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/TodoServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/TodoServiceImpl.java @@ -62,7 +62,7 @@ public class TodoServiceImpl implements ITodoService { */ @Override public ProcessProgressDetailVO getProcessDetail(ProcessDetailReq request) { - String employeeCode = LoginUserUtil.loginUserDetail().getEmployeeCode(); + String employeeCode = LoginUserUtil.loginUserDetail().getUserIdStr(); String instanceId = request.getInstanceId(); String nodeId = request.getNodeId(); Long projectId = request.getProjectId(); diff --git a/hz-pm-api/src/main/resources/application-dev.yml b/hz-pm-api/src/main/resources/application-dev.yml index 59d0b5e..9df7157 100644 --- a/hz-pm-api/src/main/resources/application-dev.yml +++ b/hz-pm-api/src/main/resources/application-dev.yml @@ -43,7 +43,7 @@ spring: datasource: type: com.zaxxer.hikari.HikariDataSource driverClassName: dm.jdbc.driver.DmDriver - url: jdbc:dm://47.98.125.47:5236/HZ_PROJECT_MANAGEMENT1?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8 + url: jdbc:dm://47.98.125.47:5236/HZ_PROJECT_MANAGEMENT1?nullToEmpty=true&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8 username: SYSDBA password: SYSDBA # 数据源 diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/sys/service/IMenuServiceTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/sys/service/IMenuServiceTest.java index 0818ec1..b32fe65 100644 --- a/hz-pm-api/src/test/java/com/hz/pm/api/sys/service/IMenuServiceTest.java +++ b/hz-pm-api/src/test/java/com/hz/pm/api/sys/service/IMenuServiceTest.java @@ -6,14 +6,14 @@ import cn.hutool.db.Db; import cn.hutool.db.Entity; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hz.pm.api.AppTests; import com.hz.pm.api.sys.model.entity.Menu; import com.hz.pm.api.sys.model.entity.Role; import com.hz.pm.api.sys.model.entity.RoleMenu; -import com.hz.pm.api.sys.model.entity.UserRole; import com.hz.pm.api.user.model.enumeration.RoleEnum; +import com.wflow.bean.entity.WflowOrgModels; +import com.wflow.service.OrgProcdefService; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -112,16 +112,16 @@ class IMenuServiceTest extends AppTests { }); } + @Autowired + private OrgProcdefService orgProcdefService; + @Test - public void test1(){ - List roleIds = Arrays.asList(1, 2); - LambdaQueryWrapper urQuery = Wrappers.lambdaQuery(UserRole.class) - .select(UserRole::getUserId).in(UserRole::getRoleId,roleIds); - System.out.println(urQuery.toString()); - System.out.println(urQuery.getSqlSelect()); - System.out.println(urQuery.getTargetSql()); - System.out.println(urQuery.getSqlComment()); - System.out.println(urQuery.getSqlSet()); + public void test1() { + WflowOrgModels orgModel = orgProcdefService.getOne(Wrappers.lambdaQuery(WflowOrgModels.class) + .eq(WflowOrgModels::getOrgCode, null) + .eq(WflowOrgModels::getType, "DEFAULT") + .eq(WflowOrgModels::getIsDelete, Boolean.FALSE) + .last("limit 1")); } } \ No newline at end of file From 95af9bd29c9368f609c885194d08a2d5de338b55 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 18 Jan 2024 09:31:25 +0800 Subject: [PATCH 25/44] =?UTF-8?q?=E5=B9=B4=E5=BA=A6=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E5=BA=93=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../action/ProjectDeclareChoiceAction.java | 14 +---- .../ProjectDeclareStateMachineBuilderImpl.java | 10 ++-- .../factory/ProjectDeclareGuardFactory.java | 34 +----------- .../common/statemachine/util/StateMachineUtil.java | 10 ---- .../api/filemanage/manage/ProjectFileManage.java | 61 +++++++++++----------- .../projectdeclared/manage/ConstructionManage.java | 3 +- .../projectdeclared/manage/DelayedApplyManage.java | 6 +-- .../manage/FinalAcceptanceManage.java | 7 +-- .../manage/ReviewChecklistManage.java | 3 +- .../utils/GenerateProjectCodeUtil.java | 12 +++-- .../handle/ProcessExecuteChainHandle.java | 7 +-- .../projectlib/handle/ProjectApprovalHandle.java | 38 ++------------ .../api/projectlib/manage/AnnualPlanLibManage.java | 11 ++-- .../api/scheduler/listener/ProcessEndListener.java | 19 +------ .../hz/pm/api/todocenter/manage/HandlerManage.java | 25 +-------- .../pm/api/todocenter/manage/TodoCenterManage.java | 2 +- 16 files changed, 65 insertions(+), 197 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java index 1c91186..c481265 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/action/ProjectDeclareChoiceAction.java @@ -77,23 +77,13 @@ public class ProjectDeclareChoiceAction implements Action stateContext) { Project project = getProject(stateContext); log.info("预审申报事件之前,项目的状态为:{}", project.getStatus()); - if (StateMachineUtil.isCityProject() && StateMachineUtil.judgeDeclareAmount(project, - ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)) { - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()); - } else { - project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); - } + project.setStatus(ProjectStatusEnum.PRE_APPLYING.getCode()); } private void preWithDrawChoice(StateContext stateContext) { Project project = getProject(stateContext); log.info("预审中撤回事件之前,项目的状态为:{}", project.getStatus()); - if (StateMachineUtil.isCityProject() && StateMachineUtil.judgeDeclareAmount(project, - ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)) { - project.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()); - } else { - project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); - } + project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); } private Project getProject(StateContext stateContext) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilderImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilderImpl.java index 128c098..0bda86b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilderImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/builder/ProjectDeclareStateMachineBuilderImpl.java @@ -2,9 +2,9 @@ package com.hz.pm.api.common.statemachine.builder; import com.hz.pm.api.common.statemachine.action.ProjectDeclareChoiceAction; import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; +import com.hz.pm.api.common.statemachine.factory.ProjectDeclareGuardFactory.PendingPreQualificationChoiceGuard; import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.BeanFactory; @@ -98,7 +98,7 @@ public class ProjectDeclareStateMachineBuilderImpl implements ProjectDeclareStat // 待预审申报,从待预审选择->省级部门联审中,预审中,完成其中一种状态 .withChoice() .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS, new ProjectDeclareGuardFactory.PendingPreQualificationChoiceGuard(), new ProjectDeclareChoiceAction()) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS, new PendingPreQualificationChoiceGuard(), new ProjectDeclareChoiceAction()) .last(ProjectStatusEnum.PRE_APPLYING, new ProjectDeclareChoiceAction()).and() // 省级部门联审通过,从省级部门联审中到省级部门联审成功 @@ -140,7 +140,7 @@ public class ProjectDeclareStateMachineBuilderImpl implements ProjectDeclareStat // 预审中撤回,从预审中撤回选择态->省级部门联审成功,待预审,完成其中一种状态 .withChoice() .source(ProjectStatusEnum.PREQUALIFICATION_WITHDRAW_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS, new ProjectDeclareGuardFactory.PendingPreQualificationChoiceGuard() + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS, new PendingPreQualificationChoiceGuard() , new ProjectDeclareChoiceAction()) .last(ProjectStatusEnum.PENDING_PREQUALIFICATION, new ProjectDeclareChoiceAction()).and() // 预审不通过重新提交,从预审不通过到待预审选择 @@ -151,7 +151,7 @@ public class ProjectDeclareStateMachineBuilderImpl implements ProjectDeclareStat // 预审不通过重新提交,从待预审选择->省级部门联审中,预审中,完成其中一种状态 .withChoice() .source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) - .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS, new ProjectDeclareGuardFactory.PendingPreQualificationChoiceGuard(), new ProjectDeclareChoiceAction()) + .first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS, new PendingPreQualificationChoiceGuard(), new ProjectDeclareChoiceAction()) .last(ProjectStatusEnum.PRE_APPLYING, new ProjectDeclareChoiceAction()).and() // 部门联审通过,从部门联审中到年度计划中 .withExternal() diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java index 35d5bdc..ee03737 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/factory/ProjectDeclareGuardFactory.java @@ -1,21 +1,10 @@ package com.hz.pm.api.common.statemachine.factory; -import cn.hutool.core.collection.CollUtil; -import com.hz.pm.api.common.model.constant.ProjectDeclareConst; -import com.hz.pm.api.common.model.constant.StateMachineConst; -import com.hz.pm.api.common.enumeration.CommonEnum; -import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; -import com.hz.pm.api.projectlib.model.entity.Project; -import com.hz.pm.api.projectlib.model.entity.ProjectApplication; import org.springframework.statemachine.StateContext; import org.springframework.statemachine.guard.Guard; -import java.util.List; - -import static com.hz.pm.api.common.model.constant.StateMachineConst.APPLICATION_DECLARE; - /** * 项目申报状态机guard集合类 * @@ -24,34 +13,13 @@ import static com.hz.pm.api.common.model.constant.StateMachineConst.APPLICATION_ */ public class ProjectDeclareGuardFactory { - private static final String PROJECT_DECLARE = StateMachineConst.PROJECT_DECLARE; public static class PendingPreQualificationChoiceGuard implements Guard { @Override public boolean evaluate(StateContext context) { - Project project = context.getMessage().getHeaders().get(PROJECT_DECLARE, Project.class); // 判断申报项目是否是市级项目,且申报金额是否大于等于1000万元 - return StateMachineUtil.isCityProject() && StateMachineUtil.judgeDeclareAmount(project, - ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT); + return true; } } - public static class ApprovedAfterChoiceGuard implements Guard { - @Override - public boolean evaluate(StateContext context) { - List projectApplications = context.getMessage().getHeaders().get(APPLICATION_DECLARE, List.class); - final Boolean[] res = {Boolean.FALSE}; - // 判断 是否有初次创建的应用 - if (CollUtil.isEmpty(projectApplications)){ - return res[0]; - } - projectApplications.forEach(app -> { - Integer isFirst = app.getIsFirst(); - if(isFirst.equals(CommonEnum.YES.getCode())){ - res[0] = Boolean.TRUE; - } - }); - return res[0]; - } - } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtil.java index 757ce5f..3bf473e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/statemachine/util/StateMachineUtil.java @@ -113,16 +113,6 @@ public class StateMachineUtil { return flag > 0 || flag == 0; } - /** - * 判断申报项目是否为市级项目 - * - * @return boolean - * @since 2023/02/07 17:05 - */ - public static boolean isCityProject() { - return Boolean.FALSE; - } - public ProjectStatusChangeEvent getProjectStatusPassEvent(Integer status) { ProjectStatusChangeEvent event = ProjectStatusChangeEvent.getPassValueByCode(status); if (Objects.isNull(event)) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java index 69a40fd..820d346 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java @@ -2,28 +2,21 @@ package com.hz.pm.api.filemanage.manage; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.NumberUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +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.plugins.pagination.Page; import com.google.common.collect.Lists; -import com.hz.pm.api.common.util.StrUtils; -import com.hz.pm.api.user.helper.MhUnitCache; -import com.hz.pm.api.user.model.dto.MhUnitDTO; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.basic.util.CollUtils; -import com.ningdatech.file.entity.File; -import com.ningdatech.file.service.FileService; -import com.ningdatech.file.utils.StrPool; -import com.hz.pm.api.common.model.constant.BizConst; -import com.hz.pm.api.common.model.constant.CommonConst; 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.model.constant.CommonConst; import com.hz.pm.api.common.util.ExcelDownUtil; +import com.hz.pm.api.common.util.StrUtils; import com.hz.pm.api.expert.manage.ExpertReviewManage; import com.hz.pm.api.expert.model.vo.ExpertReviewDetailVO; import com.hz.pm.api.expert.model.vo.ProjectReviewDetailVO; @@ -33,8 +26,6 @@ import com.hz.pm.api.filemanage.model.vo.ProjectApplyBorrowVO; import com.hz.pm.api.filemanage.model.vo.ProjectFileListVO; import com.hz.pm.api.filemanage.model.vo.ProjectFileVO; import com.hz.pm.api.filemanage.service.INdProjectApplyBorrowService; -import com.hz.pm.api.organization.model.entity.DingOrganization; -import com.hz.pm.api.organization.service.IDingOrganizationService; import com.hz.pm.api.projectdeclared.manage.ConstructionManage; import com.hz.pm.api.projectdeclared.manage.DefaultDeclaredProjectManage; import com.hz.pm.api.projectdeclared.manage.FinalAcceptanceManage; @@ -47,12 +38,12 @@ import com.hz.pm.api.projectdeclared.model.vo.PreInsVO; import com.hz.pm.api.projectdeclared.model.vo.PurchaseVO; import com.hz.pm.api.projectdeclared.service.IContractService; import com.hz.pm.api.projectdeclared.service.IPurchaseService; -import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.manage.ProjectLibManage; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.entity.ProjectApplication; import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.model.vo.ProjectDetailVO; import com.hz.pm.api.projectlib.service.IProjectApplicationService; import com.hz.pm.api.projectlib.service.IProjectInstService; @@ -60,8 +51,18 @@ 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.todocenter.constant.WorkNoticeConstant; +import com.hz.pm.api.user.helper.MhUnitCache; +import com.hz.pm.api.user.model.dto.MhUnitDTO; 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; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.file.entity.File; +import com.ningdatech.file.service.FileService; +import com.ningdatech.file.utils.StrPool; import com.wflow.bean.entity.WflowModels; import com.wflow.contants.HisProInsEndActId; import com.wflow.exception.BusinessException; @@ -122,8 +123,7 @@ public class ProjectFileManage { private final MhUnitCache mhUnitCache; public PageVo list(ProjectFileListParam req) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - + UserInfoDetails user = LoginUserUtil.loginUserDetail(); LambdaQueryWrapper query = Wrappers.lambdaQuery(Project.class) .like(StrUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()) .like(StrUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) @@ -140,7 +140,7 @@ public class ProjectFileManage { ProjectFileListVO vo = new ProjectFileListVO(); vo.setId(p.getId()); // 用户只可查阅自己及下属单位的项目档案和已经申请借阅通过的项目档案 - if (StrUtils.isBlank(p.getBuildOrgCode()) + if (NumberUtil.isNumber(p.getBuildOrgCode()) || subOrgSet.contains(Long.parseLong(p.getBuildOrgCode())) || checkCanRead(subOrgSet, p)) { vo.setCanRead(Boolean.TRUE); @@ -149,12 +149,13 @@ public class ProjectFileManage { vo.setPojectCode(p.getProjectCode()); vo.setProjectName(p.getProjectName()); // 判断当前项目,当前登录用户是否已经开启了申请借阅并且没有审批完成 - ProjectApplyBorrow projectApplyBorrow = projectApplyBorrowService.getOne(Wrappers - .lambdaQuery(ProjectApplyBorrow.class) - .eq(ProjectApplyBorrow::getApplyBorrowUserId, user.getUserId()) + Wrapper pabQuery = Wrappers.lambdaQuery(ProjectApplyBorrow.class) + .select(ProjectApplyBorrow::getInstanceId) + .eq(ProjectApplyBorrow::getApplyBorrowUserId, user.getUserIdStr()) .eq(ProjectApplyBorrow::getProjectId, p.getId()) .orderByDesc(ProjectApplyBorrow::getCreateOn) - .last("limit 1")); + .last(BizConst.LIMIT_1); + ProjectApplyBorrow projectApplyBorrow = projectApplyBorrowService.getOne(pabQuery); if (Objects.nonNull(projectApplyBorrow)) { String instCode = projectApplyBorrow.getInstanceId(); // 获取流程实例 @@ -173,14 +174,14 @@ public class ProjectFileManage { // 从申请借阅信息表中查询当前项目是否有当前登录用户发起的申请借阅审批流程 ProjectApplyBorrow applyBorrow = projectApplyBorrowService.getOne(Wrappers .lambdaQuery(ProjectApplyBorrow.class) - .eq(ProjectApplyBorrow::getApplyBorrowUserId, user.getUserId()) + .eq(ProjectApplyBorrow::getApplyBorrowUserId, user.getUserIdStr()) .eq(ProjectApplyBorrow::getProjectId, p.getId()) .eq(ProjectApplyBorrow::getInstanceId, instCode)); // 延期申请流程还未审核结束 - if (Objects.nonNull(applyBorrow) && InstTypeEnum.APPLY_BORROW.getCode().equals(instType) + if (Objects.nonNull(applyBorrow) && InstTypeEnum.APPLY_BORROW.eq(instType) && Objects.isNull(newInstance.getEndActivityId())) { vo.setCanApplyBorrow(Boolean.FALSE); - } else if (InstTypeEnum.APPLY_BORROW.getCode().equals(instType) && + } else if (InstTypeEnum.APPLY_BORROW.eq(instType) && HisProInsEndActId.REJECT.equals(newInstance.getEndActivityId())) { // 如果是延期申请审核被驳回,设置项目可以申请延期申报 vo.setCanApplyBorrow(Boolean.TRUE); @@ -195,10 +196,12 @@ public class ProjectFileManage { private boolean checkCanRead(List subOrgSet, Project project) { // 从申请借阅信息表中查出本单位及下属单位审批通过的项目 + List subOrgSetStr = CollUtils.convert(subOrgSet, String::valueOf); HashSet borrowProjectIdSet = new HashSet<>(); List applyBorrowProjectIdList = projectApplyBorrowService .list(Wrappers.lambdaQuery(ProjectApplyBorrow.class) - .in(ProjectApplyBorrow::getApplyBorrowOrgCode, subOrgSet) + .select(ProjectApplyBorrow::getProjectId) + .in(ProjectApplyBorrow::getApplyBorrowOrgCode, subOrgSetStr) .eq(ProjectApplyBorrow::getIsSuccess, Boolean.TRUE)) .stream().map(ProjectApplyBorrow::getProjectId) .filter(borrowProjectIdSet::add) @@ -242,10 +245,6 @@ public class ProjectFileManage { return projectFileVo; } - public String wantRead(Long projectId) { - return "申请成功"; - } - public String startApplyBorrowProcess(Long projectId) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); Project project = projectService.getNewProject(projectId); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java index b99f18e..f2caf79 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java @@ -33,6 +33,7 @@ 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.IProjectService; 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; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.function.VUtils; @@ -363,7 +364,7 @@ public class ConstructionManage { * @return */ public PageVo preProjectlist(ProjectListReq req) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); LambdaQueryWrapper query = ProjectHelper.projectQuery(req); //建设中状态 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java index 19f486a..9a5a682 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java @@ -256,16 +256,12 @@ public class DelayedApplyManage { || project.getPlanAcceptanceTime().isAfter(LocalDateTime.now())) .throwMessage("当前项目还未过期验收"); - String regionCode = project.getAreaCode(); - WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) - .eq(WflowModels::getRegionCode, regionCode) .eq(WflowModels::getProcessType, ProjectProcessStageEnum.APPLY_DELAY.getCode()) .last(BizConst.LIMIT_1)); if (Objects.isNull(model)) { - log.error("此 【{}】区域找不到延期申请流程配置", regionCode); - throw new BusinessException(String.format("此 【%s】区域找不到延期申请流程配置", regionCode)); + throw new BusinessException("找不到延期申请流程配置"); } ProcessStartParamsVo params = new ProcessStartParamsVo(); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java index e56d51e..5918874 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java @@ -207,7 +207,6 @@ public class FinalAcceptanceManage { String regionCode = projectInfo.getAreaCode(); WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) - .eq(WflowModels::getRegionCode, regionCode) .eq(WflowModels::getProcessType, ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode()) .last(BizConst.LIMIT_1)); @@ -258,16 +257,12 @@ public class FinalAcceptanceManage { VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("重新提交失败 此项目不存在!"); VUtils.isTrue(StringUtils.isBlank(projectDto.getFinalAcceptanceMaterials())).throwMessage("提交失败 请提交终验材料!"); - String regionCode = projectInfo.getAreaCode(); - WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) - .eq(WflowModels::getRegionCode, regionCode) .eq(WflowModels::getProcessType, ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode()) .last(BizConst.LIMIT_1)); if (Objects.isNull(model)) { - log.error("此 【{}】区域找不到 验收申报流程配置", regionCode); - throw new BusinessException(String.format("此 【%s】区域找不到 验收申报流程配置", regionCode)); + throw new BusinessException("找不到验收申报流程配置"); } //首先要判断 项目当前状态 是不是 方案待申报 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java index beec306..5cd58cc 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java @@ -73,8 +73,7 @@ public class ReviewChecklistManage { query.eq(Project::getNewest, Boolean.TRUE); //建设方案提交后的状态 query.ge(Project::getStatus, ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()) - .ne(Project::getStatus, ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()) - .eq(Project::getAreaCode, RegionConst.RC_HZ); + .ne(Project::getStatus, ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); UserInfoDetails user = LoginUserUtil.loginUserDetail(); buildReviewCheckPermission(query, user); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/GenerateProjectCodeUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/GenerateProjectCodeUtil.java index da84473..c0426a3 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/GenerateProjectCodeUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/GenerateProjectCodeUtil.java @@ -38,7 +38,8 @@ public class GenerateProjectCodeUtil { public String generateProjectCode(ProjectDTO project) { // 获取所属行政区划代码(9位) - String areaCode = project.getAreaCode() + ProjectCodeContant.REGION_LAST_3; + // String areaCode = project.getAreaCode() + ProjectCodeContant.REGION_LAST_3; + String areaCode = RegionConst.RC_HZ + ProjectCodeContant.REGION_LAST_3; // 获取建设年度 (10-13) String year = Objects.nonNull(project.getProjectYear()) ? String.valueOf(project.getProjectYear()) : String.valueOf(LocalDateTime.now().getYear()); @@ -55,7 +56,8 @@ public class GenerateProjectCodeUtil { public String generateProjectCode(ProjectCollection project) { // 获取所属行政区划代码(9位) - String areaCode = project.getAreaCode() + ProjectCodeContant.REGION_LAST_3; + // String areaCode = project.getAreaCode() + ProjectCodeContant.REGION_LAST_3; + String areaCode = RegionConst.RC_HZ + ProjectCodeContant.REGION_LAST_3; // 获取建设年度 (10-13) String year = Objects.nonNull(project.getProjectYear()) ? String.valueOf(project.getProjectYear()) : String.valueOf(LocalDateTime.now().getYear()); @@ -78,7 +80,8 @@ public class GenerateProjectCodeUtil { VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("没有项目基本信息 无法生成项目编号!"); VUtils.isTrue(Objects.isNull(apply)).throwMessage("没有项目申报信息 无法生成项目编号!"); - String areaCode = (StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode() : RegionConst.RC_HZ + BizConst.NINE_AREA_CODE_LAST); + // String areaCode = (StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode() : RegionConst.RC_HZ + BizConst.NINE_AREA_CODE_LAST); + String areaCode = RegionConst.RC_HZ + BizConst.NINE_AREA_CODE_LAST; // 获取建设年度 (10-13) String year = Objects.nonNull(apply.getBaseProjSetYear()) ? apply.getBaseProjSetYear() : String.valueOf(LocalDateTime.now().getYear()); @@ -101,7 +104,8 @@ public class GenerateProjectCodeUtil { VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("没有项目基本信息 无法生成项目编号!"); VUtils.isTrue(Objects.isNull(apply)).throwMessage("没有项目申报信息 无法生成项目编号!"); - String areaCode = (StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode() : RegionConst.RC_HZ + BizConst.NINE_AREA_CODE_LAST); + // String areaCode = (StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode() : RegionConst.RC_HZ + BizConst.NINE_AREA_CODE_LAST); + String areaCode = RegionConst.RC_HZ + BizConst.NINE_AREA_CODE_LAST; // 获取建设年度 (10-13) String year = Objects.nonNull(apply.getBaseProjSetYear()) ? apply.getBaseProjSetYear() : String.valueOf(LocalDateTime.now().getYear()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java index 3c1940d..fa7180b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java @@ -46,8 +46,6 @@ public class ProcessExecuteChainHandle { * @since 2023/02/26 */ public List handle(Long projectId, List processSchedule) { - Project project = projectService.getById(projectId); - List handles = Lists.newArrayList(); for (AbstractProcessBusinessHandle processBusinessHandle : processBusinessHandles) { if (processBusinessHandle instanceof AnnualPlanHandle) { @@ -66,10 +64,7 @@ public class ProcessExecuteChainHandle { } } else if (processBusinessHandle instanceof ProvinceUnitedReviewHandle) { //省级联审 - if (StateMachineUtil.isCityProject() && StateMachineUtil.judgeDeclareAmount(project, - ProjectDeclareConst.Number.DECLARE_AMOUNT_JUDGEMENT)) { - handles.add(processBusinessHandle); - } + // TODO } else { handles.add(processBusinessHandle); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectApprovalHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectApprovalHandle.java index 5bfba80..25bcb56 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectApprovalHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProjectApprovalHandle.java @@ -4,10 +4,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.model.constant.CommonConst; import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.manage.AnnualPlanLibManage; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; +import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; import com.hz.pm.api.projectlib.service.IProjectService; import com.wflow.workflow.bean.vo.ProcessDetailVO; @@ -15,12 +15,9 @@ import com.wflow.workflow.enums.StepStatusEnum; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; -import java.util.Arrays; import java.util.List; import java.util.Objects; -import static com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum.*; - /** * 立项批复处理 * @@ -32,35 +29,10 @@ import static com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum.*; public class ProjectApprovalHandle extends AbstractProcessBusinessHandle { private final INdProjectStatusChangeService projectStatusChangeService; private final IProjectService projectService; - private final AnnualPlanLibManage annualPlanLibManage; private Integer order = 8; - /** - * 项目状态为:待立项批复之前的状态 - */ - private static final List PROJECT_APPROVAL_LIST_STATUS = Arrays.asList( - NOT_APPROVED, - UNDER_INTERNAL_AUDIT, - UNDER_INTERNAL_AUDIT_NOT_PASS, - PENDING_PREQUALIFICATION, - JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS, - JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS, - THE_JOINT_REVIEW_OF_PROVINCIAL_DEPARTMENTS_FAILED, - PRE_APPLYING, - PREQUALIFICATION_FAILED, - DEPARTMENT_JOINT_REVIEW, - DEPARTMENT_JOINT_REVIEW_FAILED, - IN_THE_ANNUAL_PLAN, - BE_SUSPENDED, - SCHEME_UNDER_REVIEW, - SCHEME_REVIEW_FAILED, - TO_BE_DECLARED, - PLAN_TO_BE_DECLARED - ); - - public ProjectApprovalHandle(AnnualPlanLibManage annualPlanLibManage, INdProjectStatusChangeService projectStatusChangeService, IProjectService projectService){ - this.annualPlanLibManage = annualPlanLibManage; + public ProjectApprovalHandle(AnnualPlanLibManage annualPlanLibManage, INdProjectStatusChangeService projectStatusChangeService, IProjectService projectService) { this.projectStatusChangeService = projectStatusChangeService; this.projectService = projectService; } @@ -73,12 +45,12 @@ public class ProjectApprovalHandle extends AbstractProcessBusinessHandle { //查出历史版本的 所有项目ID List allVersionProjectIds = projectService.getAllVersionProjectId(project); Integer status = project.getStatus(); - if(Objects.isNull(status)){ + if (Objects.isNull(status)) { return; } // 项目状态为待立项批复之前的状态 - if (status < ProjectStatusEnum.TO_BE_APPROVED.getCode()){ + if (status < ProjectStatusEnum.TO_BE_APPROVED.getCode()) { processDetailVO.setStepStatus(StepStatusEnum.NOT_START); processDetailVO.setProcessName(CommonConst.PROJECT_APPROVAL); processSchedule.add(processDetailVO); @@ -86,7 +58,7 @@ public class ProjectApprovalHandle extends AbstractProcessBusinessHandle { } // 当前项目状态为待立项批复 - if (ProjectStatusEnum.TO_BE_APPROVED.getCode().equals(status)){ + if (ProjectStatusEnum.TO_BE_APPROVED.getCode().equals(status)) { // 根据建设方案评审通过的时间获取 ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) .in(ProjectStatusChange::getProjectId, allVersionProjectIds) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java index 0937703..23a51af 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AnnualPlanLibManage.java @@ -240,23 +240,23 @@ public class AnnualPlanLibManage { /** * build 项目的角色权限到req * - * @param query + * @param query \ */ - public UserFullInfoDTO buildProjectLibPermission(LambdaQueryWrapper query) { + public void buildProjectLibPermission(LambdaQueryWrapper query) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); Optional currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(user); if (!currentUserDataScope.isPresent()) { log.warn("没有取到权限信息 当前查询 没有权限条件"); - return user; + return; } switch (currentUserDataScope.get().getRole()) { case NORMAL_MEMBER: // 普通用户 只能看到自己单位去申报的 - query.eq(Project::getBuildOrgCode, user.getMhUnitId()); + query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); break; case COMPANY_MANAGER: // 单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 - query.eq(Project::getBuildOrgCode, user.getMhUnitId()); + query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); break; case SUPER_ADMIN: // 超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 @@ -266,7 +266,6 @@ public class AnnualPlanLibManage { query.eq(Project::getId, "NULL"); break; } - return user; } @Transactional(rollbackFor = Exception.class) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java index f37de6b..71dc2bd 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java @@ -207,24 +207,7 @@ public class ProcessEndListener { case UNDER_INTERNAL_AUDIT: // 当前项目状态是部门联审中 case DEPARTMENT_JOINT_REVIEW: - //如果是 区县 并且 500万及以上要推送省局重大项目 - if (!StateMachineUtil.isCityProject() && - StateMachineUtil.judgeDeclareAmount(declaredProject, - ProjectDeclareConst.Number.DECLARE_COUNTY_AMOUNT_JUDGEMENT)) { - try { - List applications = projectApplicationService - .list(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectId, declaredProject.getId())); - joinReviewProvincialBureauService.pushImportProject( - ApplicationConverter.convertProject(declaredProject, applications, fileService, active)); - handlerManage.updatePassProjectStatus(userId, declaredProject); - break; - } catch (Exception e) { - log.info("区县推送省级联审失败[{}],{}", declaredProject.getProjectName(), e.getMessage()); - log.error("区县推送省级联审失败:" + e); - } - } - // 当前项目状态是方案评审中 + // 当前项目状态是方案评审中 case SCHEME_UNDER_REVIEW: // 当前项目状态是终验审核中 case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java index 1f0f81d..0a0a4ae 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java @@ -156,7 +156,7 @@ public class HandlerManage { // 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 if (HisProInsEndActId.END.equals(newInstance.getEndActivityId())) { // 如果是申请延期和申请借阅审批流程,不走状态机 - if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) || InstTypeEnum.APPLY_BORROW.getCode().equals(instType)) { + if (InstTypeEnum.APPLY_DELAY.eq(instType) || InstTypeEnum.APPLY_BORROW.eq(instType)) { switch (instTypeEnum) { case APPLY_DELAY: // 保存延期申请记录,更新项目建设周期和计划验收时间 @@ -180,29 +180,6 @@ public class HandlerManage { break; // 当前项目状态是部门联审中 case DEPARTMENT_JOINT_REVIEW: - log.info("部门联审成功后 要判断是否是 区县重大项目"); - - boolean isImport = !StateMachineUtil.isCityProject() && - StateMachineUtil.judgeDeclareAmount(declaredProject, - ProjectDeclareConst.Number.DECLARE_COUNTY_AMOUNT_JUDGEMENT); - log.info("isImport :{}", isImport); - //如果是 区县 并且 500万及以上要推送省局重大项目 - if (isImport) { - try { - List applications = projectApplicationService - .list(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectCode, declaredProject.getProjectCode())); - joinReviewProvincialBureauService.pushImportProject( - ApplicationConverter.convertProject(declaredProject, applications, fileService, active)); - updatePassProjectStatus(userId, declaredProject); - break; - } catch (Exception e) { - log.info("区县推送省级联审失败[{}],{}", declaredProject.getProjectName(), e.getMessage()); - log.error("区县推送省级联审失败:" + e); - } - } - break; - // 当前项目状态是单位内部审核中 case UNDER_INTERNAL_AUDIT: // 当前项目状态是方案评审中 case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java index 77e0c9d..354fb2b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java @@ -329,7 +329,7 @@ public class TodoCenterManage { */ public String handler(ReqProcessHandlerDTO param) { // 获取登录用户ID - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); // 获取登录用户浙政钉code String userIdStr = user.getUserIdStr(); // 获取入参 From 6b55e103ffc9c15fdd1efba8c79d77a3b7896333 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 18 Jan 2024 15:20:22 +0800 Subject: [PATCH 26/44] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BA=93=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/filemanage/manage/ProjectFileManage.java | 2 +- .../model/req/PerformanceAppraisalListReq.java | 2 + .../api/portrait/service/IProjectTagService.java | 18 +- .../pm/api/projectlib/manage/ProjectLibManage.java | 320 ++++++++------------- .../hz/pm/api/projectlib/mapper/ProjectMapper.xml | 12 - .../pm/api/projectlib/service/IProjectService.java | 2 +- .../service/impl/ProjectServiceImpl.java | 2 +- .../pm/api/workbench/manage/WorkbenchManage.java | 2 +- 8 files changed, 147 insertions(+), 213 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java index 820d346..cd19471 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java @@ -140,7 +140,7 @@ public class ProjectFileManage { ProjectFileListVO vo = new ProjectFileListVO(); vo.setId(p.getId()); // 用户只可查阅自己及下属单位的项目档案和已经申请借阅通过的项目档案 - if (NumberUtil.isNumber(p.getBuildOrgCode()) + if (!NumberUtil.isNumber(p.getBuildOrgCode()) || subOrgSet.contains(Long.parseLong(p.getBuildOrgCode())) || checkCanRead(subOrgSet, p)) { vo.setCanRead(Boolean.TRUE); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/req/PerformanceAppraisalListReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/req/PerformanceAppraisalListReq.java index d047c07..2331bfe 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/req/PerformanceAppraisalListReq.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/model/req/PerformanceAppraisalListReq.java @@ -3,6 +3,7 @@ package com.hz.pm.api.performance.model.req; import com.ningdatech.basic.model.PagePo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; /** *

@@ -13,6 +14,7 @@ import lombok.Data; * @since 09:32 2023/06/13 */ @Data +@EqualsAndHashCode(callSuper = true) public class PerformanceAppraisalListReq extends PagePo { @ApiModelProperty("计划名称") diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/portrait/service/IProjectTagService.java b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/service/IProjectTagService.java index 0c08527..19cf8e8 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/portrait/service/IProjectTagService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/service/IProjectTagService.java @@ -1,10 +1,16 @@ package com.hz.pm.api.portrait.service; +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.portrait.model.entity.ProjectTag; import com.hz.pm.api.portrait.model.entity.Tag; +import com.ningdatech.basic.util.CollUtils; +import java.util.Collection; import java.util.List; +import java.util.Map; +import java.util.Set; /** * @Classname ITagService @@ -15,8 +21,16 @@ import java.util.List; public interface IProjectTagService extends IService { /** * 获取项目 标签 - * @param projectCode - * @return + * @param projectCode \ + * @return \ */ List getProjectTas(String projectCode); + + + default Map> listByProjectCodes(Collection projectCodes){ + LambdaQueryWrapper query = Wrappers.lambdaQuery(ProjectTag.class) + .in(ProjectTag::getProjectCode, projectCodes); + return CollUtils.group(list(query), ProjectTag::getProjectCode); + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java index ccffadd..37bd0d0 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java @@ -15,7 +15,6 @@ import com.google.common.collect.Maps; import com.hz.pm.api.common.compare.CompareUtils; import com.hz.pm.api.common.enumeration.CommonEnum; import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; -import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.model.constant.CommonConst; @@ -33,7 +32,6 @@ import com.hz.pm.api.filemanage.model.entity.ProjectApplyBorrow; import com.hz.pm.api.filemanage.service.INdProjectApplyBorrowService; import com.hz.pm.api.gov.model.vo.GovBizProjectDetailVO; import com.hz.pm.api.gov.utils.ProjectConvertUtil; -import com.hz.pm.api.organization.service.IDingOrganizationService; import com.hz.pm.api.performance.model.dto.ProjectCoreBusinessDTO; import com.hz.pm.api.performance.model.entity.ProjectCoreBusinessIndicators; import com.hz.pm.api.performance.service.IProjectCoreBusinessIndicatorsService; @@ -115,7 +113,6 @@ public class ProjectLibManage { private final IProjectApplicationService applicationService; private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; private final ProcessExecuteChainHandle processExecuteHandle; - private final RegionCacheHelper regionCacheHelper; private final FileService fileService; private final IProjectApplicationService projectApplicationService; private final GenerateProjectCodeUtil generateProjectCodeUtil; @@ -123,7 +120,6 @@ public class ProjectLibManage { private final StateMachineUtil stateMachineUtil; private final INdProjectDelayApplyService projectDelayApplyService; private final INdProjectApplyBorrowService projectApplyBorrowService; - private final IDingOrganizationService dingOrganizationService; private final IContractService contractService; private final IPurchaseService purchaseService; private final IPreInsAcceptancePersonService acceptancePersonService; @@ -159,18 +155,8 @@ public class ProjectLibManage { List projectCodes = page.getRecords().stream() .map(Project::getProjectCode).collect(Collectors.toList()); + Map> renewalMap = listRenewDeclarations(projectCodes); - Map> renewalMap = Maps.newHashMap(); - if (CollUtil.isNotEmpty(projectCodes)) { - List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) - .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) - .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) - .eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) - .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); - renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId)); - } - - Map> finalRenewalMap = renewalMap; List records = CollUtils.convert(page.getRecords(), w -> { ProjectLibListItemVO item = new ProjectLibListItemVO(); item.setId(w.getId()); @@ -189,10 +175,10 @@ public class ProjectLibManage { item.setProcessStatus(w.getProcessStatus()); item.setInstCode(w.getInstCode()); item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - if (finalRenewalMap.containsKey(item.getId())) { - List prfs = finalRenewalMap.get(item.getId()); - item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), prfs)); - item.setAnnualAccumulateAmountList(convertAccmulate(w, prfs)); + List fundDeclarations = renewalMap.get(w.getId()); + if (fundDeclarations != null) { + item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), fundDeclarations)); + item.setAnnualAccumulateAmountList(convertAccmulate(w, fundDeclarations)); } else { item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); item.setAnnualAccumulateAmountList(convertAccmulate(w, Collections.emptyList())); @@ -216,34 +202,9 @@ public class ProjectLibManage { Set projectCodes = page.getRecords().stream() .map(Project::getProjectCode).collect(Collectors.toSet()); - List pts = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) - .in(ProjectTag::getProjectCode, projectCodes)); - Map> tagMap = Maps.newHashMap(); - Map tagNameMap = Maps.newHashMap(); - if (CollUtil.isNotEmpty(pts)) { - tagMap = pts.stream().collect(Collectors.groupingBy(ProjectTag::getProjectCode)); - Set tagIds = pts.stream().map(ProjectTag::getTagId).collect(Collectors.toSet()); - List tags = tagService.list(Wrappers.lambdaQuery(Tag.class) - .in(Tag::getId, tagIds)); - if (CollUtil.isNotEmpty(tags)) { - tagNameMap = tags.stream().collect(Collectors.toMap(Tag::getId, Tag::getName)); - } - } - Map> finalTagMap = tagMap; - Map finalTagNameMap = tagNameMap; + Map> projectTagMap = getProjectTags(projectCodes); - - Map> renewalMap = Maps.newHashMap(); - if (CollUtil.isNotEmpty(projectCodes)) { - List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) - .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) - .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) - .eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) - .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); - renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId)); - } - - Map> finalRenewalMap = renewalMap; + Map> renewalMap = listRenewDeclarations(projectCodes); List records = CollUtils.convert(page.getRecords(), w -> { ProjectLibListItemVO item = new ProjectLibListItemVO(); item.setId(w.getId()); @@ -262,8 +223,7 @@ public class ProjectLibManage { item.setProcessStatus(w.getProcessStatus()); item.setInstCode(w.getInstCode()); item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - if (finalUser.getIsOrgAdmin() && - ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) + if (finalUser.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.eq(item.getStatus()) && StringUtils.isNotBlank(w.getSuperOrgCode()) && w.getSuperOrgCode().equals(finalUser.getMhUnitIdStr())) { item.setCanPreDeclared(Boolean.TRUE); @@ -271,11 +231,11 @@ public class ProjectLibManage { item.setApprovedAmount(w.getApprovalAmount()); item.setAnnualPlanAmount(w.getAnnualPlanAmount()); item.setPrePlanProjectId(w.getPrePlanProjectId()); - setTag(item, finalTagMap, finalTagNameMap); - if (finalRenewalMap.containsKey(item.getId())) { - List prfs = finalRenewalMap.get(item.getId()); - item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), prfs)); - item.setAnnualAccumulateAmountList(convertAccmulate(w, prfs)); + item.setTags(projectTagMap.get(w.getProjectCode())); + List fundDeclarations = renewalMap.get(w.getId()); + if (fundDeclarations != null) { + item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), fundDeclarations)); + item.setAnnualAccumulateAmountList(convertAccmulate(w, fundDeclarations)); } else { item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); item.setAnnualAccumulateAmountList(convertAccmulate(w, Collections.emptyList())); @@ -304,8 +264,8 @@ public class ProjectLibManage { UserFullInfoDTO finalUser = user; Set instCodes = page.getRecords().stream() - .filter(p -> StringUtils.isNotBlank(p.getInstCode())) - .map(Project::getInstCode).collect(Collectors.toSet()); + .map(Project::getInstCode) + .filter(StringUtils::isNotBlank).collect(Collectors.toSet()); List tasks = taskService.createTaskQuery() .processInstanceIdIn(instCodes) .orderByTaskCreateTime() @@ -314,8 +274,7 @@ public class ProjectLibManage { Map> map = Maps.newHashMap(); Map userMap = Maps.newHashMap(); if (CollUtil.isNotEmpty(tasks)) { - map = tasks.stream() - .collect(Collectors.groupingBy(Task::getProcessInstanceId)); + map = tasks.stream().collect(Collectors.groupingBy(Task::getProcessInstanceId)); userMap = searchUser(tasks, userInfoHelper); } @@ -339,8 +298,7 @@ public class ProjectLibManage { 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()) + if (finalUser.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.eq(item.getStatus()) && StringUtils.isNotBlank(w.getSuperOrgCode()) && w.getSuperOrgCode().equals(finalUser.getMhUnitIdStr())) { item.setCanPreDeclared(Boolean.TRUE); @@ -380,6 +338,30 @@ public class ProjectLibManage { return users.stream().collect(Collectors.toMap(UserFullInfoDTO::getUserId, u -> u)); } + private Map> getProjectTags(Collection projectCodes) { + Map> projectTagMap = projectTagService.listByProjectCodes(projectCodes); + if (CollUtil.isNotEmpty(projectTagMap)) { + Set tagIds = projectTagMap.values().stream() + .flatMap(Collection::stream) + .map(ProjectTag::getTagId) + .collect(Collectors.toSet()); + List tags = tagService.listByIds(tagIds); + Map tagMap = CollUtils.listToMap(tags, Tag::getId); + return projectTagMap.entrySet().stream() + .collect(Collectors.toMap(Map.Entry::getKey, w -> w.getValue().stream().map(tg -> { + Tag tag = tagMap.get(tg.getTagId()); + if (tag == null) { + return null; + } + TagVO tagVO = new TagVO(); + tagVO.setId(tag.getId()); + tagVO.setName(tag.getName()); + return tagVO; + }).filter(Objects::nonNull).collect(Collectors.toList()))); + } + return Collections.emptyMap(); + } + /** * 项目申报和项目归集的并集 * @@ -388,44 +370,17 @@ public class ProjectLibManage { * @return */ public PageVo projectAllListWithPermission(ProjectListReq req, UserFullInfoDTO user) { - req = buildProjectLibPermission(req, user); + if (!buildProjectLibPermission(req, user)) { + return PageVo.empty(); + } Page page = projectService.pageAllWithPermission(req.page(), req); - if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } + Set projectCodes = CollUtils.fieldSet(page.getRecords(), ProjectPO::getProjectCode); + Map> projectTagsMap = getProjectTags(projectCodes); + Map> renewalMap = listRenewDeclarations(projectCodes); - Set projectCodes = page.getRecords().stream() - .map(ProjectPO::getProjectCode).collect(Collectors.toSet()); - - List pts = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) - .in(ProjectTag::getProjectCode, projectCodes)); - - Map> tagMap = Maps.newHashMap(); - Map tagNameMap = Maps.newHashMap(); - if (CollUtil.isNotEmpty(pts)) { - tagMap = pts.stream().collect(Collectors.groupingBy(ProjectTag::getProjectCode)); - Set tagIds = pts.stream().map(ProjectTag::getTagId).collect(Collectors.toSet()); - List tags = tagService.list(Wrappers.lambdaQuery(Tag.class) - .in(Tag::getId, tagIds)); - if (CollUtil.isNotEmpty(tags)) { - tagNameMap = tags.stream().collect(Collectors.toMap(Tag::getId, Tag::getName)); - } - } - Map> finalTagMap = tagMap; - Map finalTagNameMap = tagNameMap; - - Map> renewalMap = Maps.newHashMap(); - if (CollUtil.isNotEmpty(projectCodes)) { - List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) - .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) - .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) - .eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) - .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); - renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId)); - } - - Map> finalRenewalMap = renewalMap; List records = CollUtils.convert(page.getRecords(), w -> { ProjectLibListItemVO item = new ProjectLibListItemVO(); item.setId(w.getId()); @@ -445,8 +400,7 @@ public class ProjectLibManage { item.setProcessStatus(w.getProcessStatus()); item.setInstCode(w.getInstCode()); item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - if (user.getIsOrgAdmin() && - ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) + if (user.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.eq(item.getStatus()) && StringUtils.isNotBlank(w.getSuperOrgCode()) && w.getSuperOrgCode().equals(user.getMhUnitIdStr())) { item.setCanPreDeclared(Boolean.TRUE); @@ -454,14 +408,14 @@ public class ProjectLibManage { item.setApprovedAmount(w.getApprovalAmount()); item.setAnnualPlanAmount(w.getAnnualPlanAmount()); item.setPrePlanProjectId(w.getPrePlanProjectId()); - setTag(item, finalTagMap, finalTagNameMap); - if (finalRenewalMap.containsKey(item.getId())) { - List prfs = finalRenewalMap.get(item.getId()); - item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), prfs)); - item.setAnnualAccumulateAmountList(convertAccmulate(w, prfs)); + item.setTags(projectTagsMap.get(w.getProjectCode())); + List currRenewDeclarations = renewalMap.get(item.getId()); + if (currRenewDeclarations != null) { + item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), currRenewDeclarations)); + item.setAnnualAccumulateAmountList(convertAccumulate(w, currRenewDeclarations)); } else { item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); - item.setAnnualAccumulateAmountList(convertAccmulate(w, Collections.emptyList())); + item.setAnnualAccumulateAmountList(convertAccumulate(w, Collections.emptyList())); } return item; }); @@ -469,44 +423,19 @@ public class ProjectLibManage { } public PageVo libListWithPermission(ProjectListReq req, UserFullInfoDTO user) { - req = buildProjectLibPermission(req, user); - Page page = projectService.pagelibWithPermission(req.page(), req); + if (!buildProjectLibPermission(req, user)) { + return PageVo.empty(); + } + Page page = projectService.pageLibWithPermission(req.page(), req); if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); } - Set projectCodes = page.getRecords().stream() .map(ProjectPO::getProjectCode).collect(Collectors.toSet()); + Map> projectTagsMap = getProjectTags(projectCodes); + Map> renewalMap = listRenewDeclarations(projectCodes); - List pts = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) - .in(ProjectTag::getProjectCode, projectCodes)); - - Map> tagMap = Maps.newHashMap(); - Map tagNameMap = Maps.newHashMap(); - if (CollUtil.isNotEmpty(pts)) { - tagMap = pts.stream().collect(Collectors.groupingBy(ProjectTag::getProjectCode)); - Set tagIds = pts.stream().map(ProjectTag::getTagId).collect(Collectors.toSet()); - List tags = tagService.list(Wrappers.lambdaQuery(Tag.class) - .in(Tag::getId, tagIds)); - if (CollUtil.isNotEmpty(tags)) { - tagNameMap = tags.stream().collect(Collectors.toMap(Tag::getId, Tag::getName)); - } - } - Map> finalTagMap = tagMap; - Map finalTagNameMap = tagNameMap; - - Map> renewalMap = Maps.newHashMap(); - if (CollUtil.isNotEmpty(projectCodes)) { - List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) - .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) - .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) - .eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) - .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); - renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId)); - } - - Map> finalRenewalMap = renewalMap; List records = CollUtils.convert(page.getRecords(), w -> { ProjectLibListItemVO item = new ProjectLibListItemVO(); item.setId(w.getId()); @@ -526,8 +455,7 @@ public class ProjectLibManage { item.setProcessStatus(w.getProcessStatus()); item.setInstCode(w.getInstCode()); item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - if (user.getIsOrgAdmin() && - ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) + if (user.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.eq(item.getStatus()) && StringUtils.isNotBlank(w.getSuperOrgCode()) && w.getSuperOrgCode().equals(user.getMhUnitIdStr())) { item.setCanPreDeclared(Boolean.TRUE); @@ -535,24 +463,41 @@ public class ProjectLibManage { item.setApprovedAmount(w.getApprovalAmount()); item.setAnnualPlanAmount(w.getAnnualPlanAmount()); item.setPrePlanProjectId(w.getPrePlanProjectId()); - setTag(item, finalTagMap, finalTagNameMap); - if (finalRenewalMap.containsKey(item.getId())) { - List prfs = finalRenewalMap.get(item.getId()); - item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), prfs)); - item.setAnnualAccumulateAmountList(convertAccmulate(w, prfs)); + item.setTags(projectTagsMap.get(w.getProjectCode())); + List currRenewDeclarations = renewalMap.get(item.getId()); + if (currRenewDeclarations != null) { + item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(), currRenewDeclarations)); + item.setAnnualAccumulateAmountList(convertAccumulate(w, currRenewDeclarations)); } else { item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); - item.setAnnualAccumulateAmountList(convertAccmulate(w, Collections.emptyList())); + item.setAnnualAccumulateAmountList(convertAccumulate(w, Collections.emptyList())); } return item; }); return PageVo.of(records, page.getTotal()); } - public PageVo listWithPermissionWorkbentch(ProjectListReq req, - UserFullInfoDTO user) { - req = buildProjectLibPermission(req, user); - Page page = projectService.pagelibWithPermission(req.page(), req); + private Map> listRenewDeclarations(Collection projectCodes) { + Map> renewalMap; + if (CollUtil.isNotEmpty(projectCodes)) { + List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .in(ProjectRenewalFundDeclaration::getProjectCode, projectCodes) + .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) + .eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) + .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); + renewalMap = CollUtils.group(renewalDeclarations, ProjectRenewalFundDeclaration::getProjectId); + } else { + renewalMap = Collections.emptyMap(); + } + return renewalMap; + } + + public PageVo listWithPermissionWorkBench(ProjectListReq req, + UserFullInfoDTO user) { + if (!buildProjectLibPermission(req, user)) { + return PageVo.empty(); + } + Page page = projectService.pageLibWithPermission(req.page(), req); if (CollUtil.isEmpty(page.getRecords())) { return PageVo.empty(); @@ -560,7 +505,8 @@ public class ProjectLibManage { Set instCodes = page.getRecords().stream() .map(ProjectPO::getInstCode) - .filter(StringUtils::isNotBlank).collect(Collectors.toSet()); + .filter(StringUtils::isNotBlank) + .collect(Collectors.toSet()); List tasks = taskService.createTaskQuery() .processInstanceIdIn(instCodes) .orderByTaskCreateTime() @@ -594,8 +540,7 @@ public class ProjectLibManage { item.setInstCode(w.getInstCode()); item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); item.setApproveUsers(buildApproveUsers(w.getInstCode(), map, userMap)); - if (user.getIsOrgAdmin() && - ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) + if (user.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.eq(item.getStatus()) && StringUtils.isNotBlank(w.getSuperOrgCode()) && w.getSuperOrgCode().equals(user.getMhUserId())) { item.setCanPreDeclared(Boolean.TRUE); @@ -608,15 +553,15 @@ public class ProjectLibManage { return PageVo.of(records, page.getTotal()); } - public static BigDecimal computeAmount(BigDecimal cuurentAmount, List prfs) { - BigDecimal res = Objects.isNull(cuurentAmount) ? BigDecimal.ZERO : cuurentAmount; + public static BigDecimal computeAmount(BigDecimal currentAmount, List prfs) { + BigDecimal res = Objects.isNull(currentAmount) ? BigDecimal.ZERO : currentAmount; for (ProjectRenewalFundDeclaration prf : prfs) { res = res.add(prf.getAnnualPaymentAmount()); } return res; } - public static List convertAccmulate(ProjectPO project, List prfs) { + public static List convertAccumulate(ProjectPO project, List prfs) { List annualAmounts = Lists.newArrayList(); annualAmounts.add(AnnualAmountVO.builder() .projectId(project.getId()) @@ -650,22 +595,6 @@ public class ProjectLibManage { return annualAmounts; } - private void setTag(ProjectLibListItemVO item, Map> finalTagMap, Map finalTagNameMap) { - if (finalTagMap.containsKey(item.getProjectCode())) { - List tags = Lists.newArrayList(); - List projectTags = finalTagMap.get(item.getProjectCode()); - for (ProjectTag pt : projectTags) { - if (finalTagNameMap.containsKey(pt.getTagId())) { - TagVO vo = new TagVO(); - vo.setId(pt.getTagId()); - vo.setName(finalTagNameMap.get(pt.getTagId())); - tags.add(vo); - } - } - item.setTags(tags); - } - } - public List projectList(ProjectListReq req) { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); return projectService.list(query); @@ -1322,38 +1251,39 @@ public class ProjectLibManage { return user; } - public ProjectListReq buildProjectLibPermission(ProjectListReq req, UserFullInfoDTO user) { - Optional currentUserDataScope = DataScopeUtil.getCurrentUserDataScopeHasUserId(user); - if (!currentUserDataScope.isPresent()) { + public boolean buildProjectLibPermission(ProjectListReq req, UserFullInfoDTO user) { + boolean queryState = true; + Optional dataScope = DataScopeUtil.getCurrentUserDataScopeHasUserId(user); + if (!dataScope.isPresent()) { log.warn("没有取到权限信息 当前查询 没有权限条件"); - return req; - } - - switch (currentUserDataScope.get().getRole()) { - case NORMAL_MEMBER: - //普通用户 只能看到自己单位去申报的 - req.setUserType("normal"); - req.setUserValue(user.getMhUnitIdStr()); - break; - case COMPANY_MANAGER: - //单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 - req.setUserType("org"); - req.setUserValue(user.getMhUnitIdStr()); - break; - case SUPER_ADMIN: - //超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 - break; - case VISITOR: - //访客可以看全市的 - break; - case DASHBOARD: - break; - default: - //没有权限的话 就让它查不到 - req.setId(0L); - break; + queryState = Boolean.FALSE; + } else { + switch (dataScope.get().getRole()) { + case NORMAL_MEMBER: + //普通用户 只能看到自己单位去申报的 + req.setUserType("normal"); + req.setUserValue(user.getMhUnitIdStr()); + break; + case COMPANY_MANAGER: + //单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 + req.setUserType("org"); + req.setUserValue(user.getMhUnitIdStr()); + break; + case SUPER_ADMIN: + //超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 + break; + case VISITOR: + //访客可以看全市的 + break; + case DASHBOARD: + break; + default: + //没有权限的话 就让它查不到 + queryState = Boolean.FALSE; + break; + } } - return req; + return queryState; } public void saveProjectByApplyDelay(DelayedApplyDTO dto, Project project, String instanceId) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml index eb22a32..b26ca24 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml @@ -53,12 +53,6 @@ and p.id = #{req.id} - - and p.area_code = #{req.regionCode} - - - and p.area_code = #{req.areaCode} - and p.project_name like concat('%',#{req.projectName},'%') @@ -144,12 +138,6 @@ and b.id = #{req.id} - - and b.base_area_code = concat(#{req.regionCode},'000') - - - and b.base_area_code = concat(#{req.regionCode},'000') - and b.base_proj_name like concat('%',#{req.projectName},'%') diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectService.java index a780642..cd4758d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectService.java @@ -32,7 +32,7 @@ public interface IProjectService extends IService { Page pageAllWithPermission(Page page, ProjectListReq req); - Page pagelibWithPermission(Page page, ProjectListReq req); + Page pageLibWithPermission(Page page, ProjectListReq req); default void reverseNewest(String projectCode, Long projectId) { LambdaUpdateWrapper wrapper = Wrappers.lambdaUpdate(Project.class) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectServiceImpl.java index ec522d4..4028c39 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/ProjectServiceImpl.java @@ -108,7 +108,7 @@ public class ProjectServiceImpl extends ServiceImpl impl } @Override - public Page pagelibWithPermission(Page page, ProjectListReq req) { + public Page pageLibWithPermission(Page page, ProjectListReq req) { return projectMapper.pageLibWithPermission(page, req); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java index 4185ad0..334923c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java @@ -144,7 +144,7 @@ public class WorkbenchManage { ProjectListReq projectListReq = new ProjectListReq(); projectListReq.page(1, 2000); projectListReq.setProjectYear(year); - res.setProjects(new ArrayList<>(projectLibManage.listWithPermissionWorkbentch(projectListReq, user).getRecords())); + res.setProjects(new ArrayList<>(projectLibManage.listWithPermissionWorkBench(projectListReq, user).getRecords())); log.info("工作台 项目列表 耗时,{} s", stopWatch.getTotalTimeSeconds()); }, ForkJoinPool.commonPool()) ).join(); From 9d378af9e224940d8c5e6d3c4520a1ac7ea33578 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 18 Jan 2024 17:46:32 +0800 Subject: [PATCH 27/44] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BA=93=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../todocenter/service/impl/TodoServiceImpl.java | 57 +++++++++++----------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/TodoServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/TodoServiceImpl.java index ce38589..f3e114e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/TodoServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/service/impl/TodoServiceImpl.java @@ -67,25 +67,25 @@ public class TodoServiceImpl implements ITodoService { String nodeId = request.getNodeId(); Long projectId = request.getProjectId(); String taskId = request.getTaskId(); - ProcessProgressVo progressInstanceDetail = processInstanceService.getProgressInstanceDetail(nodeId, instanceId,taskId); + ProcessProgressVo instDetail = processInstanceService.getProgressInstanceDetail(nodeId, instanceId, taskId); - if(Objects.isNull(progressInstanceDetail)){ + if (Objects.isNull(instDetail)) { return null; } - List progressInfo = progressInstanceDetail.getProgressInfo(); + List progressInfo = instDetail.getProgressInfo(); Boolean isHighLine = Boolean.FALSE; - if (CollUtil.isNotEmpty(progressInfo)){ + if (CollUtil.isNotEmpty(progressInfo)) { buildUserUtils.buildUserByProcessInfo(progressInfo); - isHighLine = checkHighLine(progressInfo,taskId,LoginUserUtil.loginUserDetail()); + isHighLine = checkHighLine(progressInfo, taskId, LoginUserUtil.loginUserDetail()); } ProcessProgressDetailVO res = new ProcessProgressDetailVO(); - res.setProcessProgressVo(progressInstanceDetail); - res.setStatus(progressInstanceDetail.getStatus()); + res.setProcessProgressVo(instDetail); + res.setStatus(instDetail.getStatus()); res.setProjectId(projectId); - res.setCanWithdraw(withDrawHandle.checkCanWithdraw(instanceId,progressInstanceDetail,request.getTaskId())); + res.setCanWithdraw(withDrawHandle.checkCanWithdraw(instanceId, instDetail, request.getTaskId())); res.setIsHighLine(isHighLine); - passHandle.checkCanPassOrSeal(request.getInstanceId(),request.getTaskId(),employeeCode,res); + passHandle.checkCanPassOrSeal(request.getInstanceId(), request.getTaskId(), employeeCode, res); //是不是被 驳回|退回 res.setIsChange(isChangeRecord(projectId)); return res; @@ -93,38 +93,38 @@ public class TodoServiceImpl implements ITodoService { /** * 筛选 当前登录人 是不是 上级条线单位的审批 - * @param progressInfo - * @param taskId - * @param user - * @return + * + * @param progressInfo \ + * @param taskId \ + * @param user \ + * @return \ */ private boolean checkHighLine(List progressInfo, String taskId, UserInfoDetails user) { - if(CollUtil.isEmpty(progressInfo)){ + if (CollUtil.isEmpty(progressInfo)) { return Boolean.FALSE; } final Boolean[] res = {Boolean.FALSE}; progressInfo.forEach(p -> { //如果是 子流程 - if(Objects.nonNull(p.getNodeType()) && NodeTypeEnum.SUB.name().equals(p.getNodeType().name())){ + if (Objects.nonNull(p.getNodeType()) && NodeTypeEnum.SUB.name().equals(p.getNodeType().name())) { //如果不是上级条线单位 根本不用理 - if(!p.getIsHighLine()){ + if (Boolean.FALSE.equals(p.getIsHighLine())) { return; } List children = p.getChildren(); ProgressNode progressNode = children.get(0); String userId = progressNode.getUserId(); - if(StringUtils.isBlank(userId)){ + if (StringUtils.isBlank(userId)) { return; } - UserFullInfoDTO userFullInfoDTO = userInfoHelper.getUserFullInfo(Long.valueOf(userId)); - if(Objects.nonNull(userFullInfoDTO) && user.getMhUnitId() - .equals(userFullInfoDTO.getMhUnitId())){ + UserFullInfoDTO currUser = userInfoHelper.getUserFullInfo(userId); + if (Objects.nonNull(currUser) && user.getMhUnitId().equals(currUser.getMhUnitId())) { //说明是此单位的人 //那么要去看 taskId 是不是 在这个单位内的任务 - boolean isContainsTask = HandlerManage.checkIsContainsTask(children,taskId); - if(isContainsTask){ - res[0] = Boolean.TRUE; + boolean isContainsTask = HandlerManage.checkIsContainsTask(children, taskId); + if (isContainsTask) { + res[0] = Boolean.TRUE; } } } @@ -134,14 +134,15 @@ public class TodoServiceImpl implements ITodoService { /** * 判断 当前项目是不是被驳回 或者 退回过 - * @param projectId - * @return + * + * @param projectId \ + * @return \ */ @Override public boolean isChangeRecord(Long projectId) { //1.先判断下 项目存不存在 Project project = projectService.getById(projectId); - if(Objects.isNull(project)){ + if (Objects.isNull(project)) { return Boolean.FALSE; } @@ -152,12 +153,12 @@ public class TodoServiceImpl implements ITodoService { .in(ProjectInst::getProjectId, projectIds) .orderByDesc(ProjectInst::getInstType) .last("limit 2")); - if(CollUtil.isEmpty(pis)){ + if (CollUtil.isEmpty(pis)) { return Boolean.FALSE; } //判断 项目关联的最新的2个实例 如果类型不匹配 也不属于是变更了 //还要看 项目当前的流程实例code 是不是 关联的最新实例 - if( pis.size() < 2 || + if (pis.size() < 2 || !pis.get(0).getInstCode().equals(project.getInstCode()) || pis.get(0).getProjectId().equals(pis.get(1).getProjectId()) || !pis.get(0).getInstType().equals(pis.get(1).getInstType())) { From d5704b7e3cf5ba3ae44bf4798212e3e71d8a9816 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 18 Jan 2024 20:02:02 +0800 Subject: [PATCH 28/44] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BA=93=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pm/api/todocenter/handle/WithDrawHandle.java | 37 ++++++++++------------ .../pm/api/todocenter/manage/TodoCenterManage.java | 4 +-- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/handle/WithDrawHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/handle/WithDrawHandle.java index e652664..fab24ff 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/handle/WithDrawHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/handle/WithDrawHandle.java @@ -1,11 +1,12 @@ package com.hz.pm.api.todocenter.handle; import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.common.util.StrUtils; -import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; import com.hz.pm.api.projectlib.service.IProjectInstService; import com.hz.pm.api.todocenter.constant.TodoCenterConst; import com.hz.pm.api.user.security.model.UserFullInfoDTO; @@ -19,7 +20,6 @@ import com.wflow.workflow.bean.vo.ProcessProgressVo; import com.wflow.workflow.enums.ProcessStatusEnum; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; import org.assertj.core.util.Lists; import org.flowable.bpmn.model.*; import org.flowable.engine.HistoryService; @@ -61,7 +61,7 @@ public class WithDrawHandle { HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() .processInstanceId(instanceId).singleResult(); UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); - String employeeCode = userInfoDetails.getEmployeeCode(); + String userId = userInfoDetails.getEmployeeCode(); //如果不是审核中 if (!ProcessStatusEnum.UNDER_REVIEW.getDesc() .equals(progressInstanceDetail.getStatus())) { @@ -69,7 +69,7 @@ public class WithDrawHandle { } // 如果当前登录用户是流程发起人,判断流程是否已经开始审批,如果开始审批,不能撤回 Boolean userIsRoot = checkUserIsRoot(instanceId, null); - if (Boolean.TRUE.equals(userIsRoot) && canRootWithDraw(historicProcessInstance, employeeCode)) { + if (Boolean.TRUE.equals(userIsRoot) && canRootWithDraw(historicProcessInstance, userId)) { return Boolean.TRUE; } ReqProcessHandlerDTO dto = new ReqProcessHandlerDTO(); @@ -264,7 +264,7 @@ public class WithDrawHandle { return null; } //进入上一个节点的标识 - Boolean enterBefore = Boolean.FALSE; + boolean enterBefore = Boolean.FALSE; //假设 作为当前会签的第一个点 String thisAndOrNodeId = curr.getNodeId(); //假设 作为上一个会签/或签的第一个点 @@ -309,23 +309,22 @@ public class WithDrawHandle { * 1.判断 当前 撤回人 是否是 发起人 * 2.并且流程 尚未开始审批 * - * @return + * @return 、 */ - public boolean canRootWithDraw(HistoricProcessInstance instance, String employeeCode) { + public boolean canRootWithDraw(HistoricProcessInstance instance, String userId) { String startUserId = instance.getStartUserId(); // 如果是申请延期或者申请借阅审批流程,流程发起人不能撤回,直接返回false - String instanceId = instance.getId(); - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getInstCode, instanceId)); + LambdaQueryWrapper piQuery = Wrappers.lambdaQuery(ProjectInst.class) + .select(ProjectInst::getInstType) + .eq(ProjectInst::getInstCode, instance.getId()); + ProjectInst projectInst = projectInstService.getOne(piQuery); Integer instType = projectInst.getInstType(); - if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) || - InstTypeEnum.APPLY_BORROW.getCode().equals(instType)) { + if (InstTypeEnum.APPLY_DELAY.eq(instType) || InstTypeEnum.APPLY_BORROW.eq(instType)) { return Boolean.FALSE; } //如果流程发起人 不是 当前登录人 直接返回false - if (StringUtils.isBlank(employeeCode) || StringUtils.isBlank(startUserId) - || !employeeCode.equals(startUserId)) { + if (StrUtils.hasBlank(userId, startUserId) || !userId.equals(startUserId)) { return Boolean.FALSE; } @@ -333,14 +332,10 @@ public class WithDrawHandle { .processInstanceId(instance.getId()).finished() .activityType(TodoCenterConst.Handler.ACTIVITY_APPROVAL) .orderByHistoricActivityInstanceEndTime().asc().list(); - List instances = finished.stream() + long count = finished.stream() .filter(a -> !HisProInsEndActId.WITHDRAW.equals(a.getDeleteReason())) - .collect(Collectors.toList()); + .count(); //如果有已经被审核过的 节点 返回false - if (CollUtil.isNotEmpty(instances)) { - return Boolean.FALSE; - } - - return Boolean.TRUE; + return count == 0; } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java index 354fb2b..3d9f787 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java @@ -322,7 +322,7 @@ public class TodoCenterManage { /** * 流程处理相关操作 * - * @param param + * @param param \ * @return void * @author CMM * @since 2023/02/01 @@ -403,7 +403,7 @@ public class TodoCenterManage { break; // 撤回(流程发起人和当前流程审核人的前一个审核人操作) case WITHDRAW: { - /** + /* * 新逻辑 * 不判断前端传的taskId * 1.先判断 用户是否是ROOT 发起人 并且流程没有开始审批 From 665039d4a40e8f521fcb28ed2c3d04370b1150f7 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 18 Jan 2024 21:09:47 +0800 Subject: [PATCH 29/44] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BA=93=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dashboard/manage/MeetingStatisticsManage.java | 35 +++++----- .../external/todo/dto/AddSingleWkHandleDTO.java | 2 - .../api/filemanage/manage/DocumentationManage.java | 12 ++-- .../hz/pm/api/leave/entity/po/LeaveCreateReq.java | 6 +- .../performance/manage/IndicatorConfigManage.java | 17 +++-- .../projectdeclared/manage/DelayedApplyManage.java | 42 ++++++------ .../projectdeclared/manage/OperationManage.java | 24 +++---- .../api/projectlib/manage/ApplicationManage.java | 4 +- .../JoinReviewProvincialBureauServiceImpl.java | 80 +++++++++++----------- .../hz/pm/api/sys/manage/EarlyWarningManage.java | 21 ------ .../com/hz/pm/api/sys/manage/NoticeManage.java | 4 -- .../com/hz/pm/api/sys/manage/NotifyManage.java | 3 +- 12 files changed, 111 insertions(+), 139 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/MeetingStatisticsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/MeetingStatisticsManage.java index 17893a6..909a5c9 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/MeetingStatisticsManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/MeetingStatisticsManage.java @@ -57,8 +57,8 @@ public class MeetingStatisticsManage { List meetings = meetingService.list(Wrappers.lambdaQuery(Meeting.class)); //查出 年份的 会议数据 meetings = meetings.stream().filter(m -> { - if(Objects.nonNull(m.getStartTime()) && - (Objects.isNull(year) || year.equals(m.getStartTime().getYear()))){ + if (Objects.nonNull(m.getStartTime()) && + (Objects.isNull(year) || year.equals(m.getStartTime().getYear()))) { return Boolean.TRUE; } return Boolean.FALSE; @@ -72,10 +72,10 @@ public class MeetingStatisticsManage { //评审数 List expertReviews = Lists.newArrayList(); Integer reviewsTotal = 0; - if(CollUtil.isNotEmpty(meetingIds)){ + if (CollUtil.isNotEmpty(meetingIds)) { expertReviews = expertReviewService.list(Wrappers.lambdaQuery(ExpertReview.class) .eq(ExpertReview::getIsFinal, Boolean.TRUE) - .in(ExpertReview::getMeetingId,meetingIds)); + .in(ExpertReview::getMeetingId, meetingIds)); reviewsTotal = expertReviews.size(); } //通过的评审 @@ -91,18 +91,15 @@ public class MeetingStatisticsManage { res.setPassReview(passExpertReviews.size()); res.setNotPassRate(reviewsTotal.compareTo(0) == 0 ? BigDecimal.ZERO : BigDecimal.valueOf(notpassExpertReviews.size()).multiply(BigDecimal.valueOf(100) - .divide(BigDecimal.valueOf(reviewsTotal), RoundingMode.HALF_UP))); + .divide(BigDecimal.valueOf(reviewsTotal), RoundingMode.HALF_UP))); //各区域 List regions = regionCacheHelper.listChildren(RegionConst.RC_HZ, RegionConst.RL_CITY) .stream().filter(r -> r.getRegionLevel().equals(RegionConst.RL_COUNTY)) .sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); List regionMeetngs = Lists.newArrayList(); - for(RegionDTO region : regions){ - regionMeetngs.add(DataDTO.of(region.getRegionName(),region.getRegionCode(),meetings.stream().filter(m -> { - - return Boolean.FALSE; - }).collect(Collectors.toList()).size())); + for (RegionDTO region : regions) { + regionMeetngs.add(DataDTO.of(region.getRegionName(), region.getRegionCode(), meetings.size())); } res.setRegionMeetings(regionMeetngs); @@ -110,14 +107,14 @@ public class MeetingStatisticsManage { List meetingTypes = Lists.newArrayList(); meetingTypes.add(DataDTO.of("预审会议", ReviewTemplateTypeEnum.PRELIMINARY_SCHEME_REVIEW.getCode().toString(), meetings.stream().filter(m -> { - if(StringUtils.isNotBlank(m.getType()) && + if (StringUtils.isNotBlank(m.getType()) && m.getType().equals(ReviewTemplateTypeEnum.PRELIMINARY_SCHEME_REVIEW.getCode() - .toString())){ + .toString())) { return Boolean.TRUE; } return Boolean.FALSE; }).collect(Collectors.toList()).size())); - Long yanshouCount = meetings.stream().filter(m -> { + long yanshouCount = meetings.stream().filter(m -> { if (StringUtils.isNotBlank(m.getType()) && m.getType().equals(ReviewTemplateTypeEnum.ACCEPTANCE_SCHEME_REVIEW.getCode() .toString())) { @@ -125,13 +122,13 @@ public class MeetingStatisticsManage { } return Boolean.FALSE; }).count(); - meetingTypes.add(DataDTO.of("验收会议",ReviewTemplateTypeEnum.ACCEPTANCE_SCHEME_REVIEW.getCode().toString(), - yanshouCount.intValue())); + meetingTypes.add(DataDTO.of("验收会议", ReviewTemplateTypeEnum.ACCEPTANCE_SCHEME_REVIEW.getCode().toString(), + (int) yanshouCount)); res.setMeetingTypes(meetingTypes); //各区县评审 不通过率 List regionNotpassReview = Lists.newArrayList(); - for(RegionDTO region : regions){ + for (RegionDTO region : regions) { DataDTO data = new DataDTO(); data.setCode(region.getRegionCode()); data.setName(region.getRegionName()); @@ -151,7 +148,7 @@ public class MeetingStatisticsManage { data.setRate(CollUtil.isEmpty(regionReviews) ? BigDecimal.ZERO : BigDecimal.valueOf(regionNotpass).multiply(BigDecimal.valueOf(100)) - .divide(BigDecimal.valueOf(regionReviews.size()),BigDecimal.ROUND_CEILING,RoundingMode.HALF_UP)); + .divide(BigDecimal.valueOf(regionReviews.size()), BigDecimal.ROUND_CEILING, RoundingMode.HALF_UP)); regionNotpassReview.add(data); } @@ -176,7 +173,7 @@ public class MeetingStatisticsManage { .collect(Collectors.toList()); List projectCodes = orgProjects.stream().map(Project::getProjectCode) .collect(Collectors.toList()); - if(CollUtil.isEmpty(projectCodes)){ + if (CollUtil.isEmpty(projectCodes)) { return data; } List reviews = finalExpertReviews.stream().filter(r -> Objects.nonNull(r.getProjectCode()) && @@ -186,7 +183,7 @@ public class MeetingStatisticsManage { .count(); data.setRate(CollUtil.isEmpty(reviews) ? BigDecimal.ZERO : BigDecimal.valueOf(orgNotpass).multiply(BigDecimal.valueOf(100)) - .divide(BigDecimal.valueOf(reviews.size()),BigDecimal.ROUND_CEILING,RoundingMode.HALF_UP)); + .divide(BigDecimal.valueOf(reviews.size()), BigDecimal.ROUND_CEILING, RoundingMode.HALF_UP)); return data; }) .filter(d -> Objects.nonNull(d.getRate())) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/todo/dto/AddSingleWkHandleDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/todo/dto/AddSingleWkHandleDTO.java index ebc4dca..5c136ab 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/external/todo/dto/AddSingleWkHandleDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/todo/dto/AddSingleWkHandleDTO.java @@ -4,8 +4,6 @@ import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; -import java.io.Serializable; - /** * @author 王仁康 * @date 2024-01-02 16:55:51 diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/DocumentationManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/DocumentationManage.java index e0a406f..e98478f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/DocumentationManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/DocumentationManage.java @@ -2,6 +2,7 @@ package com.hz.pm.api.filemanage.manage; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Assert; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.hz.pm.api.filemanage.model.dto.DocumentationGroupSaveDTO; @@ -106,7 +107,7 @@ public class DocumentationManage { * @param id * @return */ - @Transactional + @Transactional(rollbackFor = Exception.class) public String deleteGroup(Long id) { DocumentationGroup group = documentationGroupService.getById(id); VUtils.isTrue(Objects.isNull(group)).throwMessage("该分组不存在!"); @@ -125,22 +126,21 @@ public class DocumentationManage { * @param dto * @return */ + @Transactional(rollbackFor = Exception.class) public String addDoc(DocumentationSaveDTO dto) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); Long fileId = dto.getFileId(); File file = fileService.getById(fileId); - - VUtils.isTrue(Objects.isNull(file)).throwMessage("该文件不存在!"); + Assert.notNull(file, "该文件不存在!"); DocumentationGroup group = documentationGroupService.getById(dto.getGroupId()); - - VUtils.isTrue(Objects.isNull(group)).throwMessage("分组不存在!"); + Assert.notNull(group, "分组不存在!"); Documentation documentation = new Documentation(); documentation.setCreateBy(user.getRealName()); documentation.setCreateOn(LocalDateTime.now()); - documentation.setSize(Objects.nonNull(file.getSize()) ? file.getSize() / 1000L : 0L); + documentation.setSize(file.getSize() / 1000L); documentation.setFileId(fileId); documentation.setGroupId(dto.getGroupId()); documentation.setFileName(file.getOriginalFileName()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/po/LeaveCreateReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/po/LeaveCreateReq.java index 1c3eded..7c2990b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/po/LeaveCreateReq.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/leave/entity/po/LeaveCreateReq.java @@ -62,10 +62,10 @@ public class LeaveCreateReq { if (!this.getStartTime().isBefore(this.getEndTime())) { throw new BizException("无效的请假时间"); } - if (leaveTypeEnum.equals(LeaveTypeEnum.FIXED_TERM)) { - if (this.getFixedType() == null || this.getFixedType().isEmpty()) { + if (leaveTypeEnum.equals(LeaveTypeEnum.FIXED_TERM) + && (this.getFixedType() == null || this.getFixedType().isEmpty())) { throw new BizException("固定时段不能为空"); - } + } } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/IndicatorConfigManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/IndicatorConfigManage.java index e78f485..b6e1913 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/IndicatorConfigManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/IndicatorConfigManage.java @@ -7,15 +7,11 @@ import com.baomidou.mybatisplus.core.toolkit.Assert; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; -import com.hz.pm.api.common.util.BizUtils; -import com.hz.pm.api.common.util.StrUtils; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.basic.util.StrPool; +import com.hz.pm.api.common.enumeration.CommonEnum; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.model.constant.CommonConst; -import com.hz.pm.api.common.enumeration.CommonEnum; +import com.hz.pm.api.common.util.BizUtils; +import com.hz.pm.api.common.util.StrUtils; import com.hz.pm.api.performance.enumration.PerformanceTemplateTypeEnum; import com.hz.pm.api.performance.helper.TemplateDetailBuildHelper; import com.hz.pm.api.performance.model.dto.PerformanceIndicatorAppIndexSaveDTO; @@ -37,6 +33,10 @@ import com.hz.pm.api.performance.service.IPerformanceIndicatorProjectTemplateDet import com.hz.pm.api.performance.service.IPerformanceIndicatorProjectTemplateService; import com.hz.pm.api.user.security.model.UserInfoDetails; import com.hz.pm.api.user.util.LoginUserUtil; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.StrPool; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -46,7 +46,6 @@ import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; import java.time.LocalDateTime; -import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Objects; @@ -148,7 +147,7 @@ public class IndicatorConfigManage { } if (Objects.nonNull(dto.getId())) { PerformanceIndicatorProjectTemplate old = indicatorProjectTemplateService.getById(dto.getId()); - VUtils.isTrue(Objects.isNull(old)).throwMessage("该模板不存在!"); + Assert.notNull(old, "该模板不存在!"); template.setId(old.getId()); } else { template.setId(null); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java index 9a5a682..08d945f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/DelayedApplyManage.java @@ -4,30 +4,26 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import com.alibaba.excel.EasyExcel; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Assert; 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.exception.BizException; -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.util.ExcelDownUtil; import com.hz.pm.api.common.util.ExcelExportStyle; import com.hz.pm.api.projectdeclared.model.dto.DeclaredProjectExportDTO; import com.hz.pm.api.projectdeclared.model.dto.DelayedApplyDTO; import com.hz.pm.api.projectdeclared.model.vo.DelayedApplyVO; -import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; -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.entity.Project; import com.hz.pm.api.projectlib.model.entity.ProjectDelayApply; import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; +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.INdProjectDelayApplyService; @@ -37,7 +33,13 @@ import com.hz.pm.api.staging.enums.MsgTypeEnum; import com.hz.pm.api.sys.manage.NoticeManage; import com.hz.pm.api.todocenter.constant.WorkNoticeConstant; 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; +import com.ningdatech.basic.exception.BizException; +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.contants.HisProInsEndActId; import com.wflow.exception.BusinessException; @@ -94,12 +96,11 @@ public class DelayedApplyManage { * @return */ public PageVo projectLibList(ProjectListReq req) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); LambdaQueryWrapper query = ProjectHelper.projectQuery(req); // 待终验 并且已经过期 // 只能看自己单位的 - query.eq(Project::getBuildOrgCode, user.getMhUnitId()); + query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); query.lt(Project::getPlanAcceptanceTime, LocalDateTime.now()); @@ -148,12 +149,12 @@ public class DelayedApplyManage { .eq(ProjectInst::getInstCode, instCode)); Integer instType = projectInst.getInstType(); // 延期申请流程还未审核结束 - if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) && + if (InstTypeEnum.APPLY_DELAY.eq(instType) && Objects.isNull(newInstance.getEndActivityId())) { item.setCanDelayApply(Boolean.FALSE); } // 如果是延期申请审核被驳回,设置项目可以申请延期申报 - else if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) && + else if (InstTypeEnum.APPLY_DELAY.eq(instType) && HisProInsEndActId.REJECT.equals(newInstance.getEndActivityId())) { item.setCanDelayApply(Boolean.TRUE); } @@ -217,14 +218,13 @@ public class DelayedApplyManage { * @return */ public String delayedApply(DelayedApplyDTO dto) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); Long projectId = dto.getProjectId(); Project project = projectService.getNewProject(projectId); - VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); + Assert.notNull(project, "提交失败 此项目不存在!"); //首先要判断 项目当前状态 是不是 以终验 - VUtils.isTrue(!ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode().equals(project.getStatus()) || - !ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage())) + VUtils.isTrue(!ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.eq(project.getStatus()) || + !ProjectStatusEnum.PROJECT_APPROVED.eq(project.getStage())) .throwMessage("提交失败 该项目不是 已立项|待终验"); VUtils.isTrue(Objects.isNull(project.getPlanAcceptanceTime()) @@ -242,14 +242,14 @@ public class DelayedApplyManage { */ @Transactional(rollbackFor = Exception.class) public String startDelayedApplyProcess(DelayedApplyDTO dto) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); Long projectId = dto.getProjectId(); Project project = projectService.getNewProject(projectId); VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); //首先要判断 项目当前状态 是不是 以终验 - VUtils.isTrue(!ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode().equals(project.getStatus()) || - !ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage())) + VUtils.isTrue(!ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.eq(project.getStatus()) || + !ProjectStatusEnum.PROJECT_APPROVED.eq(project.getStage())) .throwMessage("提交失败 该项目不是 已立项|待终验"); VUtils.isTrue(Objects.isNull(project.getPlanAcceptanceTime()) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/OperationManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/OperationManage.java index 7139d1e..ee1084f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/OperationManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/OperationManage.java @@ -1,19 +1,20 @@ package com.hz.pm.api.projectdeclared.manage; import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.toolkit.Assert; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.function.VUtils; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.projectdeclared.model.dto.OperationDTO; import com.hz.pm.api.projectdeclared.model.entity.Operation; import com.hz.pm.api.projectdeclared.model.vo.OperationVO; import com.hz.pm.api.projectdeclared.service.IOperationService; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.user.security.model.UserInfoDetails; import com.hz.pm.api.user.util.LoginUserUtil; +import com.ningdatech.basic.function.VUtils; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -40,31 +41,30 @@ public class OperationManage { /** * 获取实施详情 + * * @param projectId * @return */ public OperationVO detail(Long projectId) { Project project = projectService.getNewProject(projectId); - VUtils.isTrue(Objects.isNull(project)) - .throwMessage("项目不存在!"); + Assert.notNull(project, "项目不存在!"); Operation operation = operationService.getOne(Wrappers.lambdaQuery(Operation.class) .eq(Operation::getProjectCode, project.getProjectCode()) .last(BizConst.LIMIT_1)); - return BeanUtil.copyProperties(operation,OperationVO.class); + return BeanUtil.copyProperties(operation, OperationVO.class); } public String pushOperation(OperationDTO operation) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); Project project = projectService.getNewProject(operation.getProjectId()); - VUtils.isTrue(Objects.isNull(project)) - .throwMessage("项目不存在!"); + Assert.notNull(project, "项目不存在!"); //首先要判断 项目当前状态 是不是 待开工状态 - VUtils.isTrue(!ProjectStatusEnum.OPERATION.getCode().equals(project.getStatus()) || - !ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage())) + VUtils.isTrue(!ProjectStatusEnum.OPERATION.eq(project.getStatus()) || + !ProjectStatusEnum.PROJECT_APPROVED.eq(project.getStage())) .throwMessage("提交失败 该项目不是 待开工或者已立项阶段"); Operation old = operationService.getOne(Wrappers.lambdaQuery(Operation.class) @@ -72,9 +72,9 @@ public class OperationManage { .last(BizConst.LIMIT_1)); Operation entity = BeanUtil.copyProperties(operation, Operation.class); - if(Objects.nonNull(old)){ + if (Objects.nonNull(old)) { entity.setId(old.getId()); - }else{ + } else { entity.setCreateOn(LocalDateTime.now()); entity.setCreateBy(user.getUsername()); } @@ -83,7 +83,7 @@ public class OperationManage { entity.setUpdateBy(user.getUsername()); //强制放入 计划终验时间 entity.setFinalInspectionDate(project.getPlanAcceptanceTime()); - if(operationService.saveOrUpdate(entity)){ + if (operationService.saveOrUpdate(entity)) { stateMachineUtil.pass(project); project.setUpdateOn(LocalDateTime.now()); projectService.updateById(project); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ApplicationManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ApplicationManage.java index 0e1c3dc..530d916 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ApplicationManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ApplicationManage.java @@ -2,6 +2,7 @@ package com.hz.pm.api.projectlib.manage; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.lang.Assert; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -75,8 +76,7 @@ public class ApplicationManage { public String saveAppCode(ApplicationAppCodeSaveDTO dto) { Long userId = LoginUserUtil.getUserId(); ProjectApplication app = applicationService.getById(dto.getId()); - VUtils.isTrue(Objects.isNull(app)).throwMessage("该应用不存在"); - + Assert.notNull(app, "该应用不存在"); app.setAppCode(dto.getAppCode()); app.setUpdateOn(LocalDateTime.now()); app.setUpdateBy(userId); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/service/impl/JoinReviewProvincialBureauServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/service/impl/JoinReviewProvincialBureauServiceImpl.java index 0a49f6f..3b73032 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/service/impl/JoinReviewProvincialBureauServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/service/impl/JoinReviewProvincialBureauServiceImpl.java @@ -28,6 +28,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; + import javax.annotation.Resource; import java.util.Collections; import java.util.List; @@ -72,25 +73,25 @@ public class JoinReviewProvincialBureauServiceImpl implements IJoinReviewProvinc /** * 推送/保存 重大接口到 省局联审 + * * @return */ @Override - public Boolean pushImportProject(ProvincialProjectDTO project){ - Long timeStamp = System.currentTimeMillis()/1000; - String url = provincialProperties.getHost() + provincialProperties.getPushUrl() - + "?timestamp=" + timeStamp; - log.info("省局推送联审url {}",url); - ResponseEntity responseEntity = null; + public Boolean pushImportProject(ProvincialProjectDTO project) { + Long timeStamp = System.currentTimeMillis() / 1000; + String url = provincialProperties.getHost() + provincialProperties.getPushUrl() + "?timestamp=" + timeStamp; + log.info("省局推送联审url {}", url); + ResponseEntity responseEntity; - String signature = getSha256(timeStamp,provincialProperties.getPushUrl(), - HttpMethod.POST.name(),provincialProperties.getKey(),provincialProperties.getSecret()); + String signature = getSha256(timeStamp, provincialProperties.getPushUrl(), + HttpMethod.POST.name(), provincialProperties.getKey(), provincialProperties.getSecret()); //发送post请求 RequestEntity requestEntity = RequestEntity .post(url) .header("Accept", MediaType.APPLICATION_JSON.toString()) - .header("X-Hmac-Auth-Key",provincialProperties.getKey()) - .header("X-Hmac-Auth-Signature",signature) + .header("X-Hmac-Auth-Key", provincialProperties.getKey()) + .header("X-Hmac-Auth-Signature", signature) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON) .body(project); @@ -99,8 +100,8 @@ public class JoinReviewProvincialBureauServiceImpl implements IJoinReviewProvinc log.info("省局联审 提交body :{}", JSON.toJSONString(requestEntity.getBody())); try { responseEntity = restTemplate.exchange(requestEntity, ProvinceApiResponse.class); - log.info("省局联审 响应 :{}",responseEntity); - if(responseEntity.getBody().getCode().equals(200)){ + log.info("省局联审 响应 :{}", responseEntity); + if (responseEntity.getBody().getCode().equals(200)) { return Boolean.TRUE; } } catch (Exception e) { @@ -112,37 +113,38 @@ public class JoinReviewProvincialBureauServiceImpl implements IJoinReviewProvinc /** * 获取流程审批详情 + * * @param projectId * @return */ @Override public SjApiResponse processInfo(String projectId) { - Long timeStamp = System.currentTimeMillis()/1000; + Long timeStamp = System.currentTimeMillis() / 1000; String url = provincialProperties.getHost() + provincialProperties.getDetailUrl() + "?timestamp=" + timeStamp; - log.info("省局获取审核详情 url {}",url); + log.info("省局获取审核详情 url {}", url); ResponseEntity responseEntity = null; - String signature = getSha256(timeStamp,provincialProperties.getDetailUrl(), - HttpMethod.POST.name(),provincialProperties.getKey(),provincialProperties.getSecret()); + String signature = getSha256(timeStamp, provincialProperties.getDetailUrl(), + HttpMethod.POST.name(), provincialProperties.getKey(), provincialProperties.getSecret()); JSONObject jsonBaby = new JSONObject(); - jsonBaby.put("projectId",projectId); - log.info("请求体 :{}",jsonBaby); + jsonBaby.put("projectId", projectId); + log.info("请求体 :{}", jsonBaby); //发送post请求 RequestEntity requestEntity = RequestEntity .post(url) .header("Accept", MediaType.APPLICATION_JSON.toString()) - .header("X-Hmac-Auth-Key",provincialProperties.getKey()) - .header("X-Hmac-Auth-Signature",signature) + .header("X-Hmac-Auth-Key", provincialProperties.getKey()) + .header("X-Hmac-Auth-Signature", signature) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON) .body(jsonBaby); //也可以是DTO try { - responseEntity = restTemplate.exchange(requestEntity,SjApiResponse.class); - log.info("获取审批详情 响应 :{}",responseEntity); + responseEntity = restTemplate.exchange(requestEntity, SjApiResponse.class); + log.info("获取审批详情 响应 :{}", responseEntity); } catch (Exception e) { log.error("[省局获取审核详情] http request error", e); } @@ -153,42 +155,42 @@ public class JoinReviewProvincialBureauServiceImpl implements IJoinReviewProvinc @Override public List searchGovUnits() { long timeStamp = System.currentTimeMillis(); - Long timeSeconds = System.currentTimeMillis()/1000; + Long timeSeconds = System.currentTimeMillis() / 1000; String appSecret = govAppSecret; String appKey = govAppKey; String method = HttpMethod.POST.name(); - String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,method); + String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, method); String sign = MD5.create().digestHex(appKey + secret + timeStamp); HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); RestTemplate restTemplate; - if(Objects.nonNull(factory)){ + if (Objects.nonNull(factory)) { restTemplate = new RestTemplate(factory); - }else{ + } else { restTemplate = new RestTemplate(); } - String authSignature = getSha256(timeSeconds,provincialProperties.getDomainUrl(), HttpMethod.POST.name(), - provincialProperties.getKey(),provincialProperties.getSecret()); + String authSignature = getSha256(timeSeconds, provincialProperties.getDomainUrl(), HttpMethod.POST.name(), + provincialProperties.getKey(), provincialProperties.getSecret()); String url = govUrl + "?appKey=" + appKey + "×tamp=" + timeSeconds + "&sign=" + sign + "&authKey=" + provincialProperties.getKey() + "&authSignature=" + authSignature + "&requestTime=" + timeStamp; - log.info("gov search url :{}",url); - ResponseEntity forEntity = restTemplate.postForEntity(url,null, JSONObject.class, Maps.newHashMap()); + log.info("gov search url :{}", url); + ResponseEntity forEntity = restTemplate.postForEntity(url, null, JSONObject.class, Maps.newHashMap()); JSONObject body = forEntity.getBody(); - log.info("seach response :{}",body); - if(Objects.isNull(body)){ + log.info("seach response :{}", body); + if (Objects.isNull(body)) { return Collections.emptyList(); } String code = body.getString(IrsContant.RefreshToken.RESPONSE_KEY_CODE); - if(IrsContant.RefreshToken.SUCESS_CODE.equals(code)){ + if (IrsContant.RefreshToken.SUCESS_CODE.equals(code)) { JSONObject datas = body.getJSONObject(IrsContant.RefreshToken.RESPONSE_KEY_DATAS); - if(Objects.isNull(datas)){ + if (Objects.isNull(datas)) { return Collections.emptyList(); } JSONArray jsonArray = datas.getJSONArray(BizConst.RESPONSE_KEY_DATA); - if(CollUtil.isEmpty(jsonArray)){ + if (CollUtil.isEmpty(jsonArray)) { return Collections.emptyList(); } return jsonArray.stream().map(j -> { @@ -203,11 +205,11 @@ public class JoinReviewProvincialBureauServiceImpl implements IJoinReviewProvinc return Collections.emptyList(); } - private static String getSha256(Long timeStamp,String url,String method,String key,String secret){ + private static String getSha256(Long timeStamp, String url, String method, String key, String secret) { String bytesToSign = method + StrUtil.LF + url + StrUtil.LF + timeStamp + StrUtil.LF + key; - log.info("加密message :{}",bytesToSign); - String res = SecureUtil.hmacSha256(secret).digestBase64(bytesToSign,false); - log.info("加密结果 :{}",res); + log.info("加密message :{}", bytesToSign); + String res = SecureUtil.hmacSha256(secret).digestBase64(bytesToSign, false); + log.info("加密结果 :{}", res); return res; } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java index b36535f..04652e8 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java @@ -8,7 +8,6 @@ import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; import com.hz.pm.api.projectlib.model.enumeration.WarningFlowTypeEnum; import com.hz.pm.api.projectlib.model.enumeration.WarningOperationTypeEnum; import com.hz.pm.api.staging.enums.MsgTypeEnum; -import com.hz.pm.api.staging.service.INdWorkNoticeStagingService; import com.hz.pm.api.sys.model.entity.Notify; import com.hz.pm.api.sys.model.entity.WflowEarlyWarningRecords; import com.hz.pm.api.sys.service.IEarlyWarningRecordsService; @@ -44,8 +43,6 @@ public class EarlyWarningManage { private final YxtCallOrSmsHelper yxtCallOrSmsHelper; - private final INdWorkNoticeStagingService workNoticeStagingService; - private final INotifyService notifyService; /** @@ -157,15 +154,6 @@ public class EarlyWarningManage { context.setContent(content); yxtCallOrSmsHelper.sendSms(context); } - - //4.浙政钉 - /*if (noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode()))) { - // 获取发送浙政钉工作通知必要信息 - WorkNoticeInfo passWorkNoticeInfo = noticeManage.getSendWorkNoticeInfo(userId); - passWorkNoticeInfo.setMsg(content); - // 放入工作通知暂存表中,通过扫表异步发送 - workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo, MsgTypeEnum.PROJECT_REVIEW); - }*/ } /** @@ -276,15 +264,6 @@ public class EarlyWarningManage { context.setContent(content); yxtCallOrSmsHelper.sendSms(context); } - - /*//4.浙政钉 - if (noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode()))) { - // 获取发送浙政钉工作通知必要信息 - WorkNoticeInfo passWorkNoticeInfo = noticeManage.getSendWorkNoticeInfo(employeeCode); - passWorkNoticeInfo.setMsg(content); - // 放入工作通知暂存表中,通过扫表异步发送 - workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo, MsgTypeEnum.PROJECT_REVIEW); - }*/ } /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java index 0ec49ce..358de99 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java @@ -217,10 +217,6 @@ public class NoticeManage { Notify notify = assemblyAuditNotify(userId, project, passMsg); notify.setType(msgTypeEnum.name()); notifyService.save(notify); - // 放入工作通知暂存表中,通过扫表异步发送 - // WorkNoticeInfo passWorkNoticeInfo = getSendWorkNoticeInfo(employeeCode); - // passWorkNoticeInfo.setMsg(passMsg); - // workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo, msgTypeEnum); } /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NotifyManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NotifyManage.java index 1a22ab5..1b2dbb7 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NotifyManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NotifyManage.java @@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Assert; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ningdatech.basic.function.VUtils; @@ -76,7 +77,7 @@ public class NotifyManage { public Boolean read(Long id) { Notify one = notifyService.getById(id); - VUtils.isTrue(Objects.isNull(one)).throwMessage("该通知不存在"); + Assert.notNull(one, "该通知不存在"); one.setReaded(Boolean.TRUE); return notifyService.updateById(one); } From a01303e63d4345dfddf4ecf06643c81b70875691 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Fri, 19 Jan 2024 15:59:08 +0800 Subject: [PATCH 30/44] =?UTF-8?q?=E5=8D=95=E4=BD=8D=E5=90=8D=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/filemanage/manage/ProjectFileManage.java | 4 +-- .../com/hz/pm/api/user/helper/MhUnitCache.java | 10 ++++---- .../pm/api/user/helper/impl/MhUnitCacheImpl.java | 29 +++++++++++----------- .../com/hz/pm/api/user/manage/MhUnitManage.java | 12 ++++----- .../hz/pm/api/user/manage/SyncMhUserOrgManage.java | 2 ++ .../com/hz/pm/api/user/manage/UserInfoManage.java | 2 +- .../com/hz/pm/api/user/model/dto/MhUnitDTO.java | 24 ------------------ .../java/com/hz/pm/api/user/model/dto/UnitDTO.java | 24 ++++++++++++++++++ .../hz/pm/api/user/model/po/UserInfoListReq.java | 2 +- 9 files changed, 55 insertions(+), 54 deletions(-) delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitDTO.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/UnitDTO.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java index cd19471..ce5ce57 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/filemanage/manage/ProjectFileManage.java @@ -52,7 +52,7 @@ import com.hz.pm.api.staging.enums.MsgTypeEnum; import com.hz.pm.api.sys.manage.NoticeManage; import com.hz.pm.api.todocenter.constant.WorkNoticeConstant; import com.hz.pm.api.user.helper.MhUnitCache; -import com.hz.pm.api.user.model.dto.MhUnitDTO; +import com.hz.pm.api.user.model.dto.UnitDTO; 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; @@ -539,7 +539,7 @@ public class ProjectFileManage { } } if (StrUtils.isNotBlank(vo.getApplyBorrowOrgCode())) { - MhUnitDTO mhUnit = mhUnitCache.getById(Long.parseLong(vo.getApplyBorrowOrgCode())); + UnitDTO mhUnit = mhUnitCache.getById(Long.parseLong(vo.getApplyBorrowOrgCode())); vo.setApplyBorrowOrgName(mhUnit.getName()); } if (Objects.nonNull(vo.getProjectId())) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/MhUnitCache.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/MhUnitCache.java index 4a42e10..a8c5744 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/MhUnitCache.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/MhUnitCache.java @@ -1,6 +1,6 @@ package com.hz.pm.api.user.helper; -import com.hz.pm.api.user.model.dto.MhUnitDTO; +import com.hz.pm.api.user.model.dto.UnitDTO; import java.util.List; @@ -14,15 +14,15 @@ import java.util.List; */ public interface MhUnitCache { - List all(); + List all(); - MhUnitDTO getById(Long id); + UnitDTO getById(Long id); - List getChildren(Long id); + List getChildren(Long id); List getChildrenIds(Long id); - List getChildrenRecursion(Long id); + List getChildrenRecursion(Long id); List getChildrenIdsRecursion(Long id); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java index eef0aa1..7e7b929 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java @@ -7,11 +7,8 @@ import com.github.benmanes.caffeine.cache.CacheLoader; import com.github.benmanes.caffeine.cache.Caffeine; import com.github.benmanes.caffeine.cache.LoadingCache; import com.google.common.collect.Lists; -import com.hz.pm.api.meta.assembler.MetaTagAssembler; -import com.hz.pm.api.meta.model.dto.TagDTO; -import com.hz.pm.api.meta.model.dto.TagTreeDTO; import com.hz.pm.api.user.helper.MhUnitCache; -import com.hz.pm.api.user.model.dto.MhUnitDTO; +import com.hz.pm.api.user.model.dto.UnitDTO; import com.hz.pm.api.user.model.entity.MhUnit; import com.hz.pm.api.user.service.IMhUnitService; import com.ningdatech.basic.util.CollUtils; @@ -24,7 +21,6 @@ import org.springframework.stereotype.Component; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; /** *

@@ -42,7 +38,7 @@ public class MhUnitCacheImpl implements MhUnitCache, InitializingBean { private static final Long ALL = -1L; private final IMhUnitService mhUnitService; - private LoadingCache cache; + private LoadingCache cache; private final Map> childIdMap = new ConcurrentHashMap<>(); @@ -58,19 +54,22 @@ public class MhUnitCacheImpl implements MhUnitCache, InitializingBean { public void afterPropertiesSet() { cache = Caffeine.newBuilder() .refreshAfterWrite(7, TimeUnit.DAYS) - .build(new CacheLoader() { + .build(new CacheLoader() { @Override - public MhUnitDTO load(@NonNull Long key) { + public UnitDTO load(@NonNull Long key) { log.info("刷新当前标签树:{}", key); // 查询全部 MhUnit unit = mhUnitService.getById(key); + if (unit == null) { + return null; + } putToChildIdMap(unit.getId(), unit.getParentId()); - return BeanUtil.copyProperties(unit, MhUnitDTO.class); + return BeanUtil.copyProperties(unit, UnitDTO.class); } @Override - public @NonNull Map loadAll(@NonNull Iterable keys) { + public @NonNull Map loadAll(@NonNull Iterable keys) { List allUnits; if (CollUtil.isEmpty(keys)) { allUnits = mhUnitService.list(); @@ -84,7 +83,7 @@ public class MhUnitCacheImpl implements MhUnitCache, InitializingBean { } return CollUtils.listToMap(allUnits, MhUnit::getId, w -> { putToChildIdMap(w.getId(), w.getParentId()); - return BeanUtil.copyProperties(w, MhUnitDTO.class); + return BeanUtil.copyProperties(w, UnitDTO.class); }); } }); @@ -93,17 +92,17 @@ public class MhUnitCacheImpl implements MhUnitCache, InitializingBean { } @Override - public List all() { + public List all() { return new ArrayList<>(cache.asMap().values()); } @Override - public MhUnitDTO getById(Long id) { + public UnitDTO getById(Long id) { return cache.get(id); } @Override - public List getChildren(Long id) { + public List getChildren(Long id) { return CollUtils.convert(childIdMap.get(id), cache::get); } @@ -113,7 +112,7 @@ public class MhUnitCacheImpl implements MhUnitCache, InitializingBean { } @Override - public List getChildrenRecursion(Long id) { + public List getChildrenRecursion(Long id) { return CollUtils.convert(getChildrenIdsRecursion(id), cache::get); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java index 5343764..e398c7f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java @@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.hz.pm.api.common.util.StrUtils; import com.hz.pm.api.user.helper.MhUnitCache; -import com.hz.pm.api.user.model.dto.MhUnitDTO; +import com.hz.pm.api.user.model.dto.UnitDTO; import com.hz.pm.api.user.model.dto.MhUnitTreeDTO; import com.hz.pm.api.user.model.dto.MhUnitUserTreeDTO; import com.hz.pm.api.user.model.entity.MhUnit; @@ -44,7 +44,7 @@ public class MhUnitManage { private final IUserInfoService userInfoService; public List getMhUnitTree() { - List allUnits = mhUnitCache.all(); + List allUnits = mhUnitCache.all(); List nodes = BeanUtil.copyToList(allUnits, MhUnitTreeDTO.class); return TreeUtil.convertToTree(nodes, 0L); } @@ -86,7 +86,7 @@ public class MhUnitManage { } String rootId = UnitUserNodeType.UNIT + "#" + req.getId(); selectedUnitIds.forEach(w -> { - MhUnitDTO unit = mhUnitCache.getById(w); + UnitDTO unit = mhUnitCache.getById(w); if (unit != null) { selectedUnits.add(getMhUnitUserTree(unit)); } @@ -95,11 +95,11 @@ public class MhUnitManage { return TreeUtil.convertToTree(selectedUnits, rootId); } else { // 如果没有查询指定组织,那么直接查询第一级组织 - List childrenUnits = mhUnitCache.getChildren(0L); + List childrenUnits = mhUnitCache.getChildren(0L); if (childrenUnits.isEmpty()) { return Collections.emptyList(); } - for (MhUnitDTO unit : childrenUnits) { + for (UnitDTO unit : childrenUnits) { selectedUnits.add(getMhUnitUserTree(unit)); } selectedUnits.sort(selectedUnits.get(0).comparator()); @@ -107,7 +107,7 @@ public class MhUnitManage { } } - private MhUnitUserTreeDTO getMhUnitUserTree(MhUnitDTO unit) { + private MhUnitUserTreeDTO getMhUnitUserTree(UnitDTO unit) { MhUnitUserTreeDTO node = new MhUnitUserTreeDTO(); node.setSort(unit.getSort()); node.setName(unit.getName()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java index 27a2d5f..c111df6 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java @@ -19,6 +19,7 @@ import com.hz.pm.api.meta.helper.DictionaryCache; import com.hz.pm.api.meta.model.dto.DictionaryDTO; import com.hz.pm.api.meta.model.entity.ExpertDictionary; import com.hz.pm.api.meta.service.IExpertDictionaryService; +import com.hz.pm.api.user.helper.MhUnitCache; import com.hz.pm.api.user.model.entity.MhCompany; import com.hz.pm.api.user.model.entity.MhUnit; import com.hz.pm.api.user.model.entity.UserInfo; @@ -61,6 +62,7 @@ public class SyncMhUserOrgManage { private final IMhCompanyService mhCompanyService; private final DictionaryCache dictionaryCache; private final IExpertDictionaryService expertDictionaryService; + private final MhUnitCache mhUnitCache; public void syncUsers(LocalDateTime syncDateTime) { MhRetDTO> mhRet = mhApiClient.queryUsers(syncDateTime); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java index dd211ce..fa7f8a6 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java @@ -63,7 +63,7 @@ public class UserInfoManage { .eq(StrUtils.isNotBlank(req.getPhoneNo()), UserInfo::getMobile, req.getPhoneNo()) .like(StrUtils.isNotBlank(req.getName()), UserInfo::getRealName, req.getName()) .in(Objects.nonNull(userIdList), UserInfo::getId, userIdList) - .like(StrUtils.isNotBlank(req.getMhUnitName()), UserInfo::getMhUnitName, req.getMhUnitName()) + .like(StrUtils.isNotBlank(req.getOrgName()), UserInfo::getMhUnitName, req.getOrgName()) .eq(Objects.nonNull(req.getMhUnitId()), UserInfo::getMhUnitId, req.getMhUnitId()) .orderByDesc(UserInfo::getUpdateOn); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitDTO.java deleted file mode 100644 index 322c9ba..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitDTO.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.hz.pm.api.user.model.dto; - -import lombok.Data; - -/** - *

- * MhUnitDTO - *

- * - * @author WendyYang - * @since 15:29 2024/1/10 - */ -@Data -public class MhUnitDTO { - - private Long id; - - private String name; - - private Long parentId; - - private Short sort; - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/UnitDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/UnitDTO.java new file mode 100644 index 0000000..d63f55a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/UnitDTO.java @@ -0,0 +1,24 @@ +package com.hz.pm.api.user.model.dto; + +import lombok.Data; + +/** + *

+ * MhUnitDTO + *

+ * + * @author WendyYang + * @since 15:29 2024/1/10 + */ +@Data +public class UnitDTO { + + private Long id; + + private String name; + + private Long parentId; + + private Short sort; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/UserInfoListReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/UserInfoListReq.java index 07775bd..376524a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/UserInfoListReq.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/UserInfoListReq.java @@ -25,7 +25,7 @@ public class UserInfoListReq extends PagePo { private String phoneNo; @ApiModelProperty("所在单位") - private String mhUnitName; + private String orgName; @ApiModelProperty("所在单位Code") private Long mhUnitId; From ee46ce6d0c612451d810aa9cc48e2ff50b44222c Mon Sep 17 00:00:00 2001 From: WendyYang Date: Fri, 19 Jan 2024 22:36:02 +0800 Subject: [PATCH 31/44] =?UTF-8?q?=E5=8D=95=E4=BD=8D=E5=90=8D=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hz-pm-api/pom.xml | 15 - .../hz/pm/api/common/util/FreemarkerWordUtil.java | 6 +- .../api/dashboard/handle/ProjectStatusHandler.java | 14 +- .../pm/api/dashboard/helper/DashboardHelper.java | 4 - .../dashboard/manage/DashboardProjectManage.java | 124 ++++---- .../api/datascope/provider/DataScopeContext.java | 6 +- .../com/hz/pm/api/irs/manage/AppIrsManage.java | 2 - .../service/IProjectApplicationService.java | 11 +- .../projectlib/service/IProjectInstService.java | 12 +- .../pm/api/safety/model/vo/EqualProtectionVO.java | 1 - .../api/scheduler/listener/ProcessEndListener.java | 105 +++---- .../hz/pm/api/todocenter/manage/HandlerManage.java | 188 ++++++------ .../pm/api/todocenter/manage/TodoCenterManage.java | 35 +-- .../com/hz/pm/api/todocenter/utils/PdfUtil.java | 119 ++++++++ .../com/hz/pm/api/todocenter/utils/PdfUtils.java | 134 --------- .../com/hz/pm/api/todocenter/TodoCenterTest.java | 6 +- hz-pm-sync/pom.xml | 198 ------------- .../main/java/com/hz/pm/sync/SynDataTaskApp.java | 33 --- .../com/hz/pm/sync/common/constant/BizConst.java | 106 ------- .../com/hz/pm/sync/common/utils/CryptUtils.java | 85 ------ .../open/controller/ProjectReceiveController.java | 55 ---- .../open/enumeration/GovProjectStatusEnum.java | 59 ---- .../java/com/hz/pm/sync/open/manage/IrsManage.java | 56 ---- .../pm/sync/open/manage/ProjectReceiveManage.java | 317 --------------------- .../sync/scheduler/mapper/ProjectApplyMapper.java | 16 -- .../sync/scheduler/mapper/ProjectApplyMapper.xml | 5 - .../scheduler/mapper/ProjectApproveMapper.java | 16 -- .../sync/scheduler/mapper/ProjectApproveMapper.xml | 5 - .../scheduler/mapper/ProjectBaseInfoMapper.java | 16 -- .../scheduler/mapper/ProjectBaseInfoMapper.xml | 5 - .../scheduler/mapper/ProjectCimplementMapper.java | 16 -- .../scheduler/mapper/ProjectCimplementMapper.xml | 5 - .../scheduler/mapper/ProjectMimplementMapper.java | 16 -- .../scheduler/mapper/ProjectMimplementMapper.xml | 5 - .../scheduler/mapper/ProjectProcureMapper.java | 16 -- .../sync/scheduler/mapper/ProjectProcureMapper.xml | 5 - .../hz/pm/sync/scheduler/model/dto/ForwardDTO.java | 26 -- .../scheduler/model/dto/ProjectBaseInfoDTO.java | 100 ------- .../sync/scheduler/model/dto/ProjectSaveDTO.java | 34 --- .../sync/scheduler/model/entity/ProjectApply.java | 138 --------- .../scheduler/model/entity/ProjectApprove.java | 90 ------ .../scheduler/model/entity/ProjectBaseInfo.java | 105 ------- .../scheduler/model/entity/ProjectCimplement.java | 108 ------- .../scheduler/model/entity/ProjectMimplement.java | 96 ------- .../scheduler/model/entity/ProjectProcure.java | 96 ------- .../scheduler/service/IProjectApplyService.java | 16 -- .../scheduler/service/IProjectApproveService.java | 16 -- .../scheduler/service/IProjectBaseInfoService.java | 16 -- .../service/IProjectCimplementService.java | 16 -- .../service/IProjectMimplementService.java | 16 -- .../scheduler/service/IProjectProcureService.java | 16 -- .../impl/IProjectCimplementServiceImpl.java | 21 -- .../service/impl/ProjectApplyServiceImpl.java | 20 -- .../service/impl/ProjectApproveServiceImpl.java | 21 -- .../service/impl/ProjectBaseInfoServiceImpl.java | 21 -- .../service/impl/ProjectMimplementServiceImpl.java | 21 -- .../service/impl/ProjectProcureServiceImpl.java | 21 -- hz-pm-sync/src/main/resources/application-dev.yml | 79 ----- hz-pm-sync/src/main/resources/application-pre.yml | 77 ----- hz-pm-sync/src/main/resources/application.yml | 3 - hz-pm-sync/src/main/resources/logback-spring.xml | 68 ----- pom.xml | 6 +- 62 files changed, 361 insertions(+), 2703 deletions(-) create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/PdfUtil.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/PdfUtils.java delete mode 100644 hz-pm-sync/pom.xml delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/SynDataTaskApp.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/common/constant/BizConst.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/common/utils/CryptUtils.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/open/controller/ProjectReceiveController.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/open/enumeration/GovProjectStatusEnum.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/open/manage/IrsManage.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/open/manage/ProjectReceiveManage.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApplyMapper.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApplyMapper.xml delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApproveMapper.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApproveMapper.xml delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectBaseInfoMapper.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectBaseInfoMapper.xml delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectCimplementMapper.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectCimplementMapper.xml delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectMimplementMapper.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectMimplementMapper.xml delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectProcureMapper.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectProcureMapper.xml delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/dto/ForwardDTO.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/dto/ProjectBaseInfoDTO.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/dto/ProjectSaveDTO.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectApply.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectApprove.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectBaseInfo.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectCimplement.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectMimplement.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectProcure.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectApplyService.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectApproveService.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectBaseInfoService.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectCimplementService.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectMimplementService.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectProcureService.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/IProjectCimplementServiceImpl.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectApplyServiceImpl.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectApproveServiceImpl.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectBaseInfoServiceImpl.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectMimplementServiceImpl.java delete mode 100644 hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectProcureServiceImpl.java delete mode 100644 hz-pm-sync/src/main/resources/application-dev.yml delete mode 100644 hz-pm-sync/src/main/resources/application-pre.yml delete mode 100644 hz-pm-sync/src/main/resources/application.yml delete mode 100644 hz-pm-sync/src/main/resources/logback-spring.xml diff --git a/hz-pm-api/pom.xml b/hz-pm-api/pom.xml index c050354..df2e4fc 100644 --- a/hz-pm-api/pom.xml +++ b/hz-pm-api/pom.xml @@ -9,9 +9,6 @@ hz-pm-api 1.0.0 - - 0.11.5 - @@ -108,12 +105,6 @@ org.apache.poi poi-ooxml - - - com.aliyun.oss - aliyun-sdk-oss - 3.15.0 - junit junit @@ -128,12 +119,6 @@ org.springframework.boot spring-boot-starter-test - - - com.auth0 - java-jwt - 3.10.3 - org.springframework.boot spring-boot-configuration-processor diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/FreemarkerWordUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/FreemarkerWordUtil.java index f97097f..a58a087 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/FreemarkerWordUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/FreemarkerWordUtil.java @@ -66,10 +66,8 @@ public class FreemarkerWordUtil { //输出文件 File outFile = new File(filePath + File.separator + fileName); //如果输出目标文件夹不存在,则创建 - if (!outFile.getParentFile().exists()) { - if (outFile.getParentFile().mkdirs()) { - log.info("创建文件目录:{}", outFile.getParentFile().getAbsolutePath()); - } + if (!outFile.getParentFile().exists() && (outFile.getParentFile().mkdirs())) { + log.info("创建文件目录:{}", outFile.getParentFile().getAbsolutePath()); } //将模板和数据模型合并生成文件 Writer out = new BufferedWriter(new OutputStreamWriter(Files.newOutputStream(outFile.toPath()), StandardCharsets.UTF_8)); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/handle/ProjectStatusHandler.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/handle/ProjectStatusHandler.java index 8a688a4..344b4e5 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/handle/ProjectStatusHandler.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/handle/ProjectStatusHandler.java @@ -11,6 +11,8 @@ import com.hz.pm.api.performance.service.IPerformanceAppraisalProjectService; 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.entity.ProjectStatusChange; +import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.service.INdProjectStatusChangeService; import com.hz.pm.api.projectlib.service.IProjectInstService; import com.hz.pm.api.projectlib.service.IProjectService; @@ -51,7 +53,7 @@ public class ProjectStatusHandler { * @param project \ * @return \ */ - public ProtraitProjectStatusSituationVO generateApproveStatus(Project project, String statusName, Integer instType) { + public ProtraitProjectStatusSituationVO genApproveStatus(Project project, String statusName, InstTypeEnum instType) { ProtraitProjectStatusSituationVO vo = new ProtraitProjectStatusSituationVO(); if (Objects.isNull(project)) { return vo; @@ -65,7 +67,7 @@ public class ProjectStatusHandler { //查询 项目与实例关联表 ProjectInst unitInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) .in(ProjectInst::getProjectId, ids) - .eq(ProjectInst::getInstType, instType) + .eq(ProjectInst::getInstType, instType.getCode()) .last(BizConst.LIMIT_1)); if (Objects.isNull(unitInst)) { return vo; @@ -89,8 +91,8 @@ public class ProjectStatusHandler { * @param project \ * @return \ */ - public ProtraitProjectStatusSituationVO generateStatus(Project project, String statusName, - Integer currStatus, Integer nextStatus) { + public ProtraitProjectStatusSituationVO genStatus(Project project, String statusName, + ProjectStatusEnum currStatus, ProjectStatusEnum nextStatus) { ProtraitProjectStatusSituationVO vo = new ProtraitProjectStatusSituationVO(); if (Objects.isNull(project)) { return vo; @@ -101,9 +103,9 @@ public class ProjectStatusHandler { //查询 状态机流转的时间点 LambdaQueryWrapper pscQuery = Wrappers .lambdaQuery(ProjectStatusChange.class) - .eq(ProjectStatusChange::getBeforeStatus, currStatus) + .eq(ProjectStatusChange::getBeforeStatus, currStatus.getCode()) .eq(ProjectStatusChange::getProjectCode, projectCode) - .eq(ProjectStatusChange::getAfterStatus, nextStatus) + .eq(ProjectStatusChange::getAfterStatus, nextStatus.getCode()) .last(BizConst.LIMIT_1); ProjectStatusChange statusChange = statusChangeService.getOne(pscQuery); if (Objects.isNull(statusChange)) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardHelper.java index 113c0fa..e7f6c8c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardHelper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/helper/DashboardHelper.java @@ -1,10 +1,7 @@ package com.hz.pm.api.dashboard.helper; -import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hz.pm.api.dashboard.constant.AnalysisBasicConstant; -import com.hz.pm.api.dashboard.model.entity.CockpitStats; -import com.hz.pm.api.dashboard.model.vo.CockpitStatsVO; import com.hz.pm.api.sys.model.entity.Region; import com.hz.pm.api.sys.service.IRegionService; import lombok.RequiredArgsConstructor; @@ -13,7 +10,6 @@ import org.springframework.stereotype.Component; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.stream.Collectors; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/DashboardProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/DashboardProjectManage.java index de8b250..607207a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/DashboardProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/DashboardProjectManage.java @@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.dashboard.constant.ChartTypeEnum; -import com.hz.pm.api.dashboard.constant.DashboardConstant; +import com.hz.pm.api.dashboard.constant.DashboardConstant.Protrait; import com.hz.pm.api.dashboard.handle.ApplicationHandler; import com.hz.pm.api.dashboard.handle.ProjectStatusHandler; import com.hz.pm.api.dashboard.helper.DashboardChartAssembler; @@ -28,10 +28,10 @@ import com.hz.pm.api.gov.service.IGovOperationProjectBaseinfoService; import com.hz.pm.api.portrait.service.IProjectTagService; import com.hz.pm.api.projectdeclared.model.entity.Purchase; import com.hz.pm.api.projectdeclared.service.IPurchaseService; -import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.entity.ProjectDelayApply; +import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.service.INdProjectDelayApplyService; import com.hz.pm.api.projectlib.service.IProjectService; import lombok.RequiredArgsConstructor; @@ -194,15 +194,12 @@ public class DashboardProjectManage { return dashboardProjectSummaryVO; } - public DashboardProjectCntSummaryVO getProjectCntSummary(QueryYearPO queryYearPO) { + public DashboardProjectCntSummaryVO getProjectCntSummary(QueryYearPO req) { // 预算年度 - Integer year = queryYearPO.getYear(); - String regionCode = queryYearPO.getRegionCode(); + Integer year = req.getYear(); List allProjectList = iProjectService.list(Wrappers.lambdaQuery(Project.class) .eq(Project::getNewest, true) - .eq(Objects.nonNull(year), Project::getProjectYear, year) - .eq(StringUtils.isNotBlank(regionCode), Project::getAreaCode, regionCode) - ); + .eq(Objects.nonNull(year), Project::getProjectYear, year)); // 单位项目数量TOP5 List companyProjectCntTop5List = new ArrayList<>(); @@ -215,9 +212,7 @@ public class DashboardProjectManage { companyProjectCntBO.setProjectCnt(projectList.size()); companyProjectCntTop5List.add(companyProjectCntBO); } - companyProjectCntTop5List = companyProjectCntTop5List.stream() - .sorted(Comparator.comparing(CompanyProjectCntBO::getProjectCnt).reversed()) - .collect(Collectors.toList()); + companyProjectCntTop5List.sort(Comparator.comparing(CompanyProjectCntBO::getProjectCnt).reversed()); if (companyProjectCntTop5List.size() > 5) { companyProjectCntTop5List = companyProjectCntTop5List.subList(0, 5); } @@ -269,10 +264,10 @@ public class DashboardProjectManage { } - public DashboardInvestmentSummaryVO getInvestmentSummary(QueryYearPO queryYearPO) { + public DashboardInvestmentSummaryVO getInvestmentSummary(QueryYearPO req) { // 预算年度 - Integer year = queryYearPO.getYear(); - String regionCode = queryYearPO.getRegionCode(); + Integer year = req.getYear(); + String regionCode = req.getRegionCode(); List allProjectList = iProjectService.list(Wrappers.lambdaQuery(Project.class) .eq(Project::getNewest, true) .eq(Objects.nonNull(year), Project::getProjectYear, year) @@ -289,9 +284,7 @@ public class DashboardProjectManage { projectATIISBO.setApprovedTotalInvestmentIncrease(r.getApprovedTotalInvestmentIncrease()); return projectATIISBO; }).collect(Collectors.toList()); - projectATIISTop5List = projectATIISTop5List.stream() - .sorted(Comparator.comparing(ProjectATIISBO::getApprovedTotalInvestmentIncrease) - .reversed()).collect(Collectors.toList()); + projectATIISTop5List.sort(Comparator.comparing(ProjectATIISBO::getApprovedTotalInvestmentIncrease)); if (projectATIISTop5List.size() > 5) { projectATIISTop5List = projectATIISTop5List.subList(0, 5); } @@ -314,9 +307,7 @@ public class DashboardProjectManage { companyProjectCntBO.setApprovedTotalInvestmentIncreaseSum(approvedTotalInvestmentIncreaseSum); companyProjectATIISTop5List.add(companyProjectCntBO); } - companyProjectATIISTop5List = companyProjectATIISTop5List.stream() - .sorted(Comparator.comparing(CompanyProjectCntBO::getApprovedTotalInvestmentIncreaseSum).reversed()) - .collect(Collectors.toList()); + companyProjectATIISTop5List.sort(Comparator.comparing(CompanyProjectCntBO::getApprovedTotalInvestmentIncreaseSum).reversed()); if (companyProjectATIISTop5List.size() > 5) { companyProjectATIISTop5List = companyProjectATIISTop5List.subList(0, 5); } @@ -379,7 +370,7 @@ public class DashboardProjectManage { projectInfo.setSafetyInputRate(convertSafetyInputRate(project)); projectInfo.setStatus(Objects.nonNull(project.getStatus()) ? project.getStatus().toString() : null); //3.项目状态情况 - projectInfo.setStatusSituation(generateProjectStatus(project)); + projectInfo.setStatusSituation(genProjectStatus(project)); res.setProjectInfo(projectInfo); } else if (Objects.nonNull(baseInfo)) { ProtraitProjectInfoVO projectInfo = BeanUtil.copyProperties(baseInfo, ProtraitProjectInfoVO.class); @@ -388,7 +379,7 @@ public class DashboardProjectManage { if (Objects.nonNull(apply)) { try { projectInfo.setProjectYear(Integer.valueOf(apply.getBaseProjSetYear())); - } catch (Exception e) { + } catch (Exception ignored) { } projectInfo.setProjectIntroduction(apply.getBaseProjIntro()); projectInfo.setBuildCycle(apply.getBaseProjDuration()); @@ -399,7 +390,7 @@ public class DashboardProjectManage { projectInfo.setBuildOrgName(baseInfo.getBaseBuildDeprt()); projectInfo.setBuildOrgCode(baseInfo.getBaseBuildDeprtDing()); //3.项目状态情况 - projectInfo.setStatusSituation(generateProjectStatus(baseInfo)); + projectInfo.setStatusSituation(genProjectStatus(baseInfo)); projectInfo.setStatus(baseInfo.getBaseProjSetProg()); res.setProjectInfo(projectInfo); } else if (Objects.nonNull(operationBase)) { @@ -409,7 +400,7 @@ public class DashboardProjectManage { if (Objects.nonNull(apply)) { try { projectInfo.setProjectYear(Integer.valueOf(apply.getBaseProjSetYear())); - } catch (Exception e) { + } catch (Exception ignored) { } projectInfo.setProjectIntroduction(apply.getBaseProjIntro()); projectInfo.setBuildCycle(apply.getBaseProjDuration()); @@ -420,7 +411,7 @@ public class DashboardProjectManage { projectInfo.setBuildOrgName(operationBase.getBaseBuildDeprt()); projectInfo.setBuildOrgCode(operationBase.getBaseBuildDeprtDing()); //3.项目状态情况 - projectInfo.setStatusSituation(generateProjectStatus(operationBase)); + projectInfo.setStatusSituation(genProjectStatus(operationBase)); projectInfo.setStatus(operationBase.getBaseProjSetProg()); res.setProjectInfo(projectInfo); } @@ -449,7 +440,7 @@ public class DashboardProjectManage { final Double[] total = {0.0}; array.forEach(j -> { JSONObject json = JSON.parseObject(JSON.toJSONString(j)); - Double safetyInputAmount = json.getDouble(DashboardConstant.Protrait.FEILD_SAFETYMONEY); + Double safetyInputAmount = json.getDouble(Protrait.FEILD_SAFETYMONEY); if (Objects.nonNull(safetyInputAmount)) { total[0] += safetyInputAmount; } @@ -458,16 +449,16 @@ public class DashboardProjectManage { //申报金额 BigDecimal declareAmount = project.getDeclareAmount(); if (Objects.isNull(declareAmount) || declareAmount.compareTo(BigDecimal.ZERO) == 0) { - return DashboardConstant.Protrait.ZREO_PERCEN; + return Protrait.ZREO_PERCEN; } BigDecimal rate = BigDecimal.valueOf(totalAmount).multiply(BigDecimal.valueOf(100)) .divide(declareAmount, BigDecimal.ROUND_CEILING, RoundingMode.HALF_UP) .stripTrailingZeros(); return rate.toPlainString(); - } catch (Exception e) { + } catch (Exception ignored) { } } - return DashboardConstant.Protrait.ZREO_PERCEN; + return Protrait.ZREO_PERCEN; } /** @@ -476,7 +467,7 @@ public class DashboardProjectManage { * @param project * @return */ - private List generateProjectStatus(Project project) { + private List genProjectStatus(Project project) { final List res = Lists.newArrayList(); //1.计划(单位内部审核) res.add(new ProtraitProjectStatusSituationVO()); @@ -489,77 +480,70 @@ public class DashboardProjectManage { //5.验收(终验) res.add(new ProtraitProjectStatusSituationVO()); //6.运维(todo: 运维时间还没有) - res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.OPERATION).build()); + res.add(ProtraitProjectStatusSituationVO.builder().statusName(Protrait.OPERATION).build()); //7.绩效 res.add(new ProtraitProjectStatusSituationVO()); //8.注销(todo: 还没有注销功能) - res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.LOG_OFF).build()); + res.add(ProtraitProjectStatusSituationVO.builder().statusName(Protrait.LOG_OFF).build()); CompletableFuture.allOf( - CompletableFuture.runAsync(() -> { - res.set(0, statusHandler.generateApproveStatus(project, DashboardConstant.Protrait.PLAN, InstTypeEnum.UNIT_INNER_AUDIT.getCode())); - }, ForkJoinPool.commonPool()), - CompletableFuture.runAsync(() -> { - res.set(1, statusHandler.generateApproveStatus(project, DashboardConstant.Protrait.DECLARED, InstTypeEnum.PRELIMINARY_PREVIEW.getCode())); - }, ForkJoinPool.commonPool()), - CompletableFuture.runAsync(() -> { - res.set(2, statusHandler.generateApproveStatus(project, DashboardConstant.Protrait.APPROVE, InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode())); - }, ForkJoinPool.commonPool()), - CompletableFuture.runAsync(() -> { - res.set(3, statusHandler.generateStatus(project, DashboardConstant.Protrait.CONSTRUCTION, - ProjectStatusEnum.UNDER_CONSTRUCTION.getCode(), ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode())); - }, ForkJoinPool.commonPool()), - CompletableFuture.runAsync(() -> { - res.set(4, statusHandler.generateApproveStatus(project, DashboardConstant.Protrait.ACCEPT, InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode())); - }, ForkJoinPool.commonPool()), - CompletableFuture.runAsync(() -> { - res.set(6, statusHandler.generatePerformanceStatus(project)); - }, ForkJoinPool.commonPool()) + CompletableFuture.runAsync(() -> res.set(0, statusHandler.genApproveStatus(project, Protrait.PLAN, + InstTypeEnum.UNIT_INNER_AUDIT)), ForkJoinPool.commonPool()), + CompletableFuture.runAsync(() -> res.set(1, statusHandler.genApproveStatus(project, Protrait.DECLARED, + InstTypeEnum.PRELIMINARY_PREVIEW)), ForkJoinPool.commonPool()), + CompletableFuture.runAsync(() -> res.set(2, statusHandler.genApproveStatus(project, Protrait.APPROVE, + InstTypeEnum.CONSTRUCTION_PLAN_REVIEW)), ForkJoinPool.commonPool()), + CompletableFuture.runAsync(() -> res.set(3, statusHandler.genStatus(project, Protrait.CONSTRUCTION, + ProjectStatusEnum.UNDER_CONSTRUCTION, ProjectStatusEnum.TO_BE_FINALLY_INSPECTED)), ForkJoinPool.commonPool()), + CompletableFuture.runAsync(() -> res.set(4, statusHandler.genApproveStatus(project, Protrait.ACCEPT, + InstTypeEnum.PROJECT_FINAL_INSPECTION)), ForkJoinPool.commonPool()), + CompletableFuture.runAsync(() -> res.set(6, statusHandler.generatePerformanceStatus(project)), + ForkJoinPool.commonPool()) ).join(); return res; } - private List generateProjectStatus(GovBizProjectBaseinfo baseinfo) { + private List genProjectStatus(GovBizProjectBaseinfo baseinfo) { final List res = Lists.newArrayList(); //1.计划(单位内部审核) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.PLAN, null)); + res.add(new ProtraitProjectStatusSituationVO(Protrait.PLAN, null)); //2.申报(项目预审) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.DECLARED, null)); + res.add(new ProtraitProjectStatusSituationVO(Protrait.DECLARED, null)); //3.审批(建设方案审批) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.APPROVE, null)); + res.add(new ProtraitProjectStatusSituationVO(Protrait.APPROVE, null)); //4.建设(立项后的建设中) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.CONSTRUCTION, null)); + res.add(new ProtraitProjectStatusSituationVO(Protrait.CONSTRUCTION, null)); //5.验收(终验) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.ACCEPT, + res.add(new ProtraitProjectStatusSituationVO(Protrait.ACCEPT, Objects.nonNull(baseinfo.getBaseProjSetProg()) && "07".equals(baseinfo.getBaseProjSetProg()) ? baseinfo.getTongTime() : null)); //6.运维(todo: 运维时间还没有) - res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.OPERATION).build()); + res.add(ProtraitProjectStatusSituationVO.builder().statusName(Protrait.OPERATION).build()); //7.绩效 - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.ACCEPT, null)); + res.add(new ProtraitProjectStatusSituationVO(Protrait.ACCEPT, null)); //8.注销(todo: 还没有注销功能) - res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.LOG_OFF).build()); + res.add(ProtraitProjectStatusSituationVO.builder().statusName(Protrait.LOG_OFF).build()); return res; } - private List generateProjectStatus(GovOperationProjectBaseinfo baseinfo) { + private List genProjectStatus(GovOperationProjectBaseinfo baseinfo) { final List res = Lists.newArrayList(); //1.计划(单位内部审核) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.PLAN, null)); + res.add(new ProtraitProjectStatusSituationVO(Protrait.PLAN, null)); //2.申报(项目预审) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.DECLARED, null)); + res.add(new ProtraitProjectStatusSituationVO(Protrait.DECLARED, null)); //3.审批(建设方案审批) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.APPROVE, null)); + res.add(new ProtraitProjectStatusSituationVO(Protrait.APPROVE, null)); //4.建设(立项后的建设中) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.CONSTRUCTION, null)); + res.add(new ProtraitProjectStatusSituationVO(Protrait.CONSTRUCTION, null)); //5.验收(终验) - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.ACCEPT, + res.add(new ProtraitProjectStatusSituationVO(Protrait.ACCEPT, Objects.nonNull(baseinfo.getBaseProjSetProg()) && "07".equals(baseinfo.getBaseProjSetProg()) ? baseinfo.getTongTime() : null)); //6.运维(todo: 运维时间还没有) - res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.OPERATION).build()); + res.add(ProtraitProjectStatusSituationVO.builder().statusName(Protrait.OPERATION).build()); //7.绩效 - res.add(new ProtraitProjectStatusSituationVO(DashboardConstant.Protrait.ACCEPT, null)); + res.add(new ProtraitProjectStatusSituationVO(Protrait.ACCEPT, null)); //8.注销(todo: 还没有注销功能) - res.add(ProtraitProjectStatusSituationVO.builder().statusName(DashboardConstant.Protrait.LOG_OFF).build()); + res.add(ProtraitProjectStatusSituationVO.builder().statusName(Protrait.LOG_OFF).build()); return res; } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/DataScopeContext.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/DataScopeContext.java index 59e5a92..296a313 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/DataScopeContext.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/provider/DataScopeContext.java @@ -1,7 +1,7 @@ package com.hz.pm.api.datascope.provider; -import com.ningdatech.basic.util.SpringUtils; import com.hz.pm.api.datascope.model.DataScopeDTO; +import com.ningdatech.basic.util.SpringUtils; import lombok.RequiredArgsConstructor; import java.io.Serializable; @@ -19,7 +19,7 @@ import java.util.Optional; @RequiredArgsConstructor public class DataScopeContext implements Serializable { - private static final String WARN_MSG = "请先创建数据权限[%s]的实现类,使其实现 DataScopeProvider"; + private static final String WARN_MSG = "请先创建数据权限[%s]的实现类"; private static final Map DSP_MAP; @@ -35,7 +35,7 @@ public class DataScopeContext implements Serializable { return dataScopeProvider.findDataFieldProperty(); } - public static Optional getDataScopeHasUserId(String roleCode,Long userId) { + public static Optional getDataScopeHasUserId(String roleCode, Long userId) { DataScopeProvider dataScopeProvider = DSP_MAP.get(roleCode); if (dataScopeProvider == null) { throw new IllegalArgumentException(String.format(WARN_MSG, roleCode)); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/AppIrsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/AppIrsManage.java index d37efcd..49e355b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/AppIrsManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/irs/manage/AppIrsManage.java @@ -277,7 +277,6 @@ public class AppIrsManage { String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; String appKey = "A331101453557202109017383"; String method = "POST"; - String interfaceName = "5crv7i4727abLCv0"; String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, method); log.info("secret :{}", secret); String sign = MD5.create().digestHex(appKey + secret + timestamp); @@ -374,7 +373,6 @@ public class AppIrsManage { String appSecret = driAppSecret; String appKey = driAppKey; String method = HttpMethod.POST.name(); - String interfaceName = driInterfaceName; String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, method); log.info("secret : {}", secret); String sign = MD5.create().digestHex(appKey + secret + timestamp); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectApplicationService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectApplicationService.java index 605c937..c154028 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectApplicationService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectApplicationService.java @@ -1,5 +1,6 @@ package com.hz.pm.api.projectlib.service; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.entity.ProjectApplication; import com.baomidou.mybatisplus.extension.service.IService; @@ -8,7 +9,7 @@ import java.util.List; /** *

- * 服务类 + * 服务类 *

* * @author WendyYang @@ -18,5 +19,11 @@ public interface IProjectApplicationService extends IService List getApplicationsByProject(Project project); - void saveApplication(Project project,Project oldProject,Boolean isConstruct); + void saveApplication(Project project, Project oldProject, Boolean isConstruct); + + default List listByProjectId(Long projectId) { + return list(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectId, projectId)); + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectInstService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectInstService.java index 9d7b9f9..ba0ed70 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectInstService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectInstService.java @@ -1,11 +1,13 @@ package com.hz.pm.api.projectlib.service; -import com.hz.pm.api.projectlib.model.entity.ProjectInst; +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.ProjectInst; /** *

- * 服务类 + * 服务类 *

* * @author Poffy @@ -13,4 +15,10 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface IProjectInstService extends IService { + default ProjectInst getByInstCode(String instCode) { + return getOne(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getInstCode, instCode) + .last(BizConst.LIMIT_1)); + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/vo/EqualProtectionVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/vo/EqualProtectionVO.java index 5c87cad..e89c84b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/vo/EqualProtectionVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/safety/model/vo/EqualProtectionVO.java @@ -5,7 +5,6 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; -import java.time.LocalDateTime; /** *

diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java index 71dc2bd..b3a59ab 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/ProcessEndListener.java @@ -1,19 +1,12 @@ package com.hz.pm.api.scheduler.listener; import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.file.service.FileService; -import com.hz.pm.api.common.model.constant.BizConst; -import com.hz.pm.api.common.model.constant.ProjectDeclareConst; -import com.hz.pm.api.common.statemachine.util.StateMachineUtil; -import com.hz.pm.api.projectdeclared.converter.ApplicationConverter; -import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; +import cn.hutool.core.util.NumberUtil; +import com.google.common.collect.Sets; import com.hz.pm.api.projectlib.model.entity.Project; -import com.hz.pm.api.projectlib.model.entity.ProjectApplication; import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.service.IProjectApplicationService; import com.hz.pm.api.projectlib.service.IProjectInstService; import com.hz.pm.api.projectlib.service.IProjectService; @@ -22,6 +15,8 @@ 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.todocenter.manage.HandlerManage; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.file.service.FileService; import com.wflow.contants.HisProInsEndActId; import com.wflow.workflow.bean.process.ProgressNode; import com.wflow.workflow.bean.process.enums.NodeTypeEnum; @@ -39,10 +34,11 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.context.event.EventListener; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Objects; -import java.util.stream.Collectors; +import java.util.Set; import static com.hz.pm.api.todocenter.constant.WorkNoticeConstant.PASS_MSG_TEMPLATE; import static com.hz.pm.api.todocenter.constant.WorkNoticeConstant.PASS_MSG_TEMPLATE2; @@ -83,6 +79,7 @@ public class ProcessEndListener { @Async @EventListener + @Transactional(rollbackFor = Exception.class) public void onApplicationEvent(ProcessEndEvent event) { log.info("进入工作流结束的 事件监听!{}", event.getInstCode()); String instCode = event.getInstCode(); @@ -93,13 +90,11 @@ public class ProcessEndListener { try { Thread.sleep(3000); } catch (InterruptedException e) { - throw new BizException(e); + Thread.currentThread().interrupt(); } //1.去查找 项目实例关系表 - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getInstCode, instCode) - .last(BizConst.LIMIT_1)); + ProjectInst projectInst = projectInstService.getByInstCode(instCode); if (Objects.isNull(projectInst)) { return; @@ -129,51 +124,42 @@ public class ProcessEndListener { /** * 审核通过后 所处理的逻辑 * - * @param declaredProject \ - * @param instance \ + * @param project \ + * @param instance \ */ - public void afterPassTodo(Project declaredProject, HistoricProcessInstance instance) { - Long userId = 110L; + private void afterPassTodo(Project project, HistoricProcessInstance instance) { // 获取流程通过后的流程实例 HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() .processInstanceId(instance.getId()) .singleResult(); // 获取当前流程实例类型 String instanceId = newInstance.getId(); - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getInstCode, instanceId) - .last(BizConst.LIMIT_1)); + ProjectInst projectInst = projectInstService.getByInstCode(instanceId); Integer instType = projectInst.getInstType(); InstTypeEnum instTypeEnum = InstTypeEnum.getByCode(instType); if (Objects.isNull(instTypeEnum)) { - throw new BizException("当前审批流类型不存在,流程类型code:" + instType); + throw BizException.wrap("当前审批流类型不存在,流程类型code:" + instType); } // 获取流程通过后当前流程详情 - ProcessProgressVo newInstanceDetail = processInstanceService.getProgressInstanceDetail(null, instance.getId()); + ProcessProgressVo newInstDetail = processInstanceService.getProgressInstanceDetail(null, instance.getId()); // 获取流程通过后当前审核人信息,向其发送工作通知 // 会签/或签会有多个审核人 - List currentEmployeeCodeList = Lists.newArrayList(); - List newProgressInfo = newInstanceDetail.getProgressInfo(); - ProgressNode currentNode = newProgressInfo.get(newProgressInfo.size() - 1); + Set currUserIdList = Sets.newHashSet(); + List newProgressInfo = newInstDetail.getProgressInfo(); + ProgressNode currNode = newProgressInfo.get(newProgressInfo.size() - 1); // 说明当前节点是子流程节点 - if (currentNode.getNodeType().name().equals(NodeTypeEnum.SUB.name())) { - List children = currentNode.getChildren(); + if (currNode.getNodeType().name().equals(NodeTypeEnum.SUB.name())) { + List children = currNode.getChildren(); // 获取子流程当前审核人节点 - ProgressNode subCurrentNode = CollUtil.isEmpty(children) ? new ProgressNode() : children.get(children.size() - 1); + ProgressNode subCurrNode = CollUtil.isEmpty(children) ? new ProgressNode() : children.get(children.size() - 1); // 获取节点ID相同地审核节点 - List nodeList = children.stream() - .filter(c -> subCurrentNode.getNodeId().equals(c.getNodeId())) - .collect(Collectors.toList()); - List userIdList = nodeList.stream().map(ProgressNode::getUserId).collect(Collectors.toList()); - currentEmployeeCodeList.addAll(userIdList); + children.stream().filter(c -> subCurrNode.getNodeId().equals(c.getNodeId())) + .forEach(c -> currUserIdList.add(c.getUserId())); } else { - List nodeList = newProgressInfo.stream() - .filter(c -> currentNode.getNodeId().equals(c.getNodeId())) - .collect(Collectors.toList()); - List userIdList = nodeList.stream().map(ProgressNode::getUserId).collect(Collectors.toList()); - currentEmployeeCodeList.addAll(userIdList); + newProgressInfo.stream().filter(c -> currNode.getNodeId().equals(c.getNodeId())) + .forEach(c -> currUserIdList.add(c.getUserId())); } // 流程通过后,判断当前登录用户是不是最后一个审核人 @@ -181,55 +167,58 @@ public class ProcessEndListener { // 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 if (HisProInsEndActId.END.equals(newInstance.getEndActivityId())) { // 如果是申请延期和申请借阅审批流程,不走状态机 - if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) || InstTypeEnum.APPLY_BORROW.getCode().equals(instType)) { + if (InstTypeEnum.APPLY_DELAY.eq(instType) || InstTypeEnum.APPLY_BORROW.eq(instType)) { switch (instTypeEnum) { case APPLY_DELAY: // 保存延期申请记录,更新项目建设周期和计划验收时间 - handlerManage.updateProjectDelayApplyInfo(declaredProject, instanceId); + handlerManage.updateProjectDelayApplyInfo(project, instanceId); break; case APPLY_BORROW: // 更新申请借阅状态为成功 - handlerManage.updateProjectApplyBorrowInfo(declaredProject, instanceId); + handlerManage.updateProjectApplyBorrowInfo(project, instanceId); break; default: - throw new BizException("传入实例类型错误: " + instTypeEnum); + throw BizException.wrap("传入实例类型错误:%s ", instTypeEnum); } } else { - switch (Objects.requireNonNull(ProjectStatusEnum.match(declaredProject.getStatus()))) { + switch (Objects.requireNonNull(ProjectStatusEnum.match(project.getStatus()))) { // 当前项目状态是预审中 case PRE_APPLYING: //先修改项目状态 - handlerManage.updatePassProjectStatus(userId, declaredProject); + handlerManage.updatePassProjectStatus(0L, project); //然后入库暂存库 - projectStagingService.addByProject(declaredProject, "暂存入库 待提交部门联审"); + projectStagingService.addByProject(project, "暂存入库 待提交部门联审"); break; // 当前项目状态是单位内部审核中 case UNDER_INTERNAL_AUDIT: // 当前项目状态是部门联审中 case DEPARTMENT_JOINT_REVIEW: - // 当前项目状态是方案评审中 + // 当前项目状态是方案评审中 case SCHEME_UNDER_REVIEW: // 当前项目状态是终验审核中 case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: - handlerManage.updatePassProjectStatus(userId, declaredProject); + handlerManage.updatePassProjectStatus(0L, project); break; default: - throw new BizException("传入项目状态错误: " + declaredProject.getStatus()); + throw BizException.wrap("传入项目状态错误:%s", project.getStatus()); } } //发送消息 - noticeManage.sendNotice(userId, declaredProject, instance.getProcessDefinitionName(), PASS_MSG_TEMPLATE2, MsgTypeEnum.PROJECT_REVIEW_PASS); + noticeManage.sendNotice(Long.parseLong(instance.getStartUserId()), project, instance.getProcessDefinitionName(), + PASS_MSG_TEMPLATE2, MsgTypeEnum.PROJECT_REVIEW_PASS); } else { // 若有下一个审核人(当前节点的用户),会签/或签会有多个 // 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 // 获取发送浙政钉工作通知必要信息 - for (String currentEmployeeCode : currentEmployeeCodeList) { - if (Objects.isNull(currentEmployeeCode)) { - throw new BizException("审核人信息不存在!"); + for (String currUserId : currUserIdList) { + if (NumberUtil.isNumber(currUserId)) { + //发送消息 + noticeManage.sendNotice(Long.parseLong(currUserId), project, instance.getProcessDefinitionName(), + PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); + } else { + log.warn("无效的审核人用户Id:{}", currUserId); } - //发送消息 - noticeManage.sendNotice(userId, declaredProject, instance.getProcessDefinitionName(), - PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); + } } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java index 0a0a4ae..f4cf8e3 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java @@ -2,16 +2,17 @@ package com.hz.pm.api.todocenter.manage; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DatePattern; +import cn.hutool.core.util.NumberUtil; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; +import com.google.common.collect.Sets; import com.hz.pm.api.common.model.constant.BizConst; -import com.hz.pm.api.common.model.constant.ProjectDeclareConst; import com.hz.pm.api.common.statemachine.util.StateMachineUtil; import com.hz.pm.api.filemanage.model.entity.ProjectApplyBorrow; import com.hz.pm.api.filemanage.service.INdProjectApplyBorrowService; -import com.hz.pm.api.projectdeclared.converter.ApplicationConverter; import com.hz.pm.api.projectdeclared.manage.DeclaredProjectManage; import com.hz.pm.api.projectdeclared.model.dto.ProjectDraftSaveDTO; import com.hz.pm.api.projectdeclared.model.entity.ProjectConstructionSuggestions; @@ -55,14 +56,10 @@ import org.flowable.variable.api.history.HistoricVariableInstance; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; -import java.util.HashMap; -import java.util.List; -import java.util.Objects; -import java.util.Optional; +import java.util.*; import java.util.stream.Collectors; import static com.hz.pm.api.todocenter.constant.WorkNoticeConstant.*; @@ -104,10 +101,10 @@ public class HandlerManage { /** * 审核通过后 所处理的逻辑 * - * @param declaredProject - * @param instance + * @param project \ + * @param instance \ */ - public void afterPassTodo(Project declaredProject, HistoricProcessInstance instance) { + public void afterPassTodo(Project project, HistoricProcessInstance instance) { Long userId = LoginUserUtil.getUserId(); // 获取流程通过后的流程实例 HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() @@ -115,9 +112,7 @@ public class HandlerManage { .singleResult(); // 获取当前流程实例类型 String instanceId = newInstance.getId(); - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getInstCode, instanceId) - .last(BizConst.LIMIT_1)); + ProjectInst projectInst = projectInstService.getByInstCode(instanceId); Integer instType = projectInst.getInstType(); InstTypeEnum instTypeEnum = InstTypeEnum.getByCode(instType); if (Objects.isNull(instTypeEnum)) { @@ -125,30 +120,24 @@ public class HandlerManage { } // 获取流程通过后当前流程详情 - ProcessProgressVo newInstanceDetail = processInstanceService.getProgressInstanceDetail(null, instance.getId()); + ProcessProgressVo newInstDetail = processInstanceService.getProgressInstanceDetail(null, instance.getId()); // 获取流程通过后当前审核人信息,向其发送工作通知 // 会签/或签会有多个审核人 - List currentEmployeeCodeList = Lists.newArrayList(); - List newProgressInfo = newInstanceDetail.getProgressInfo(); - ProgressNode currentNode = newProgressInfo.get(newProgressInfo.size() - 1); + Set currUserIdList = Sets.newHashSet(); + List newProgressInfo = newInstDetail.getProgressInfo(); + ProgressNode currNode = newProgressInfo.get(newProgressInfo.size() - 1); // 说明当前节点是子流程节点 - if (currentNode.getNodeType().name().equals(NodeTypeEnum.SUB.name())) { - List children = currentNode.getChildren(); + if (currNode.getNodeType().name().equals(NodeTypeEnum.SUB.name())) { + List children = currNode.getChildren(); // 获取子流程当前审核人节点 - ProgressNode subCurrentNode = CollUtil.isEmpty(children) ? new ProgressNode() : children.get(children.size() - 1); + ProgressNode subCurrNode = CollUtil.isEmpty(children) ? new ProgressNode() : children.get(children.size() - 1); // 获取节点ID相同地审核节点 - List nodeList = children.stream() - .filter(c -> subCurrentNode.getNodeId().equals(c.getNodeId())) - .collect(Collectors.toList()); - List userIdList = nodeList.stream().map(ProgressNode::getUserId).collect(Collectors.toList()); - currentEmployeeCodeList.addAll(userIdList); + children.stream().filter(c -> subCurrNode.getNodeId().equals(c.getNodeId())) + .forEach(c -> currUserIdList.add(c.getUserId())); } else { - List nodeList = newProgressInfo.stream() - .filter(c -> currentNode.getNodeId().equals(c.getNodeId())) - .collect(Collectors.toList()); - List userIdList = nodeList.stream().map(ProgressNode::getUserId).collect(Collectors.toList()); - currentEmployeeCodeList.addAll(userIdList); + newProgressInfo.stream().filter(c -> currNode.getNodeId().equals(c.getNodeId())) + .forEach(w -> currUserIdList.add(w.getUserId())); } // 流程通过后,判断当前登录用户是不是最后一个审核人 @@ -160,54 +149,56 @@ public class HandlerManage { switch (instTypeEnum) { case APPLY_DELAY: // 保存延期申请记录,更新项目建设周期和计划验收时间 - updateProjectDelayApplyInfo(declaredProject, instanceId); + updateProjectDelayApplyInfo(project, instanceId); break; case APPLY_BORROW: // 更新申请借阅状态为成功 - updateProjectApplyBorrowInfo(declaredProject, instanceId); + updateProjectApplyBorrowInfo(project, instanceId); break; default: throw new BizException("传入实例类型错误: " + instTypeEnum); } } else { - switch (Objects.requireNonNull(ProjectStatusEnum.match(declaredProject.getStatus()))) { + switch (Objects.requireNonNull(ProjectStatusEnum.match(project.getStatus()))) { // 当前项目状态是预审中 case PRE_APPLYING: //先修改项目状态 - updatePassProjectStatus(userId, declaredProject); + updatePassProjectStatus(userId, project); //然后入库暂存库 - projectStagingService.addByProject(declaredProject, "暂存入库 待提交部门联审"); + projectStagingService.addByProject(project, "暂存入库 待提交部门联审"); break; // 当前项目状态是部门联审中 case DEPARTMENT_JOINT_REVIEW: case UNDER_INTERNAL_AUDIT: // 当前项目状态是方案评审中 case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: - updatePassProjectStatus(userId, declaredProject); + updatePassProjectStatus(userId, project); break; case SCHEME_UNDER_REVIEW: // 当前项目状态是终验审核中 - updatePassProjectStatus(userId, declaredProject); + updatePassProjectStatus(userId, project); // 判断是否 保存建设建议信息 - saveContructionSuggestionInfo(instance.getId(), declaredProject); + saveConstructionSuggestInfo(instance.getId(), project); break; default: - throw new BizException("传入项目状态错误: " + declaredProject.getStatus()); + throw new BizException("传入项目状态错误: " + project.getStatus()); } } //发送消息 - noticeManage.sendNotice(userId, declaredProject, instance.getProcessDefinitionName(), PASS_MSG_TEMPLATE2, MsgTypeEnum.PROJECT_REVIEW_PASS); + noticeManage.sendNotice(Long.parseLong(instance.getStartUserId()), project, + instance.getProcessDefinitionName(), PASS_MSG_TEMPLATE2, MsgTypeEnum.PROJECT_REVIEW_PASS); } else { // 若有下一个审核人(当前节点的用户),会签/或签会有多个 // 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 // 获取发送浙政钉工作通知必要信息 - for (String currentEmployeeCode : currentEmployeeCodeList) { - if (Objects.isNull(currentEmployeeCode)) { - throw new BizException("审核人信息不存在!"); + for (String currUserId : currUserIdList) { + if (!NumberUtil.isNumber(currUserId)) { + log.warn("审核人信息不存在:{}", currUserId); + } else { + //发送消息 + noticeManage.sendNotice(Long.parseLong(currUserId), project, instance.getProcessDefinitionName(), + PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); } - //发送消息 - noticeManage.sendNotice(userId, declaredProject, instance.getProcessDefinitionName(), - PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); } } } @@ -215,30 +206,29 @@ public class HandlerManage { /** * 去保存 建设建议信息 * - * @param instanceId - * @param project + * @param instanceId \ + * @param project \ */ - private void saveContructionSuggestionInfo(String instanceId, Project project) { - ProjectConstructionSuggestions pcs = constrctionSuggestionsService.getOne(Wrappers.lambdaQuery(ProjectConstructionSuggestions.class) + private void saveConstructionSuggestInfo(String instanceId, Project project) { + Wrapper query = Wrappers.lambdaQuery(ProjectConstructionSuggestions.class) .eq(ProjectConstructionSuggestions::getProjectCode, project.getProjectCode()) .eq(ProjectConstructionSuggestions::getInstanceId, instanceId) - .last(BizConst.LIMIT_1)); - if (Objects.isNull(pcs)) { - log.info("没有该流程的 建设 建议信息"); - return; + .last(BizConst.LIMIT_1); + ProjectConstructionSuggestions pcs = constrctionSuggestionsService.getOne(query); + if (Objects.nonNull(pcs)) { + project.setProposeTotalInvest(pcs.getProposeTotalInvest()); + project.setProposeAnnualBudget(pcs.getProposeAnnualBudget()); + project.setProposeAttachFiles(pcs.getProposeAttachFiles()); + projectService.updateById(project); } - - project.setProposeTotalInvest(pcs.getProposeTotalInvest()); - project.setProposeAnnualBudget(pcs.getProposeAnnualBudget()); - project.setProposeAttachFiles(pcs.getProposeAttachFiles()); - projectService.updateById(project); } - public void updateProjectApplyBorrowInfo(Project declaredProject, String instanceId) { + public void updateProjectApplyBorrowInfo(Project project, String instanceId) { // 获取申请借阅信息 - ProjectApplyBorrow projectApplyBorrow = projectApplyBorrowService.getOne(Wrappers.lambdaQuery(ProjectApplyBorrow.class) - .eq(ProjectApplyBorrow::getProjectId, declaredProject.getId()) - .eq(ProjectApplyBorrow::getInstanceId, instanceId)); + Wrapper query = Wrappers.lambdaQuery(ProjectApplyBorrow.class) + .eq(ProjectApplyBorrow::getProjectId, project.getId()) + .eq(ProjectApplyBorrow::getInstanceId, instanceId); + ProjectApplyBorrow projectApplyBorrow = projectApplyBorrowService.getOne(query); // 更新项目借阅信息为成功 projectApplyBorrow.setIsSuccess(Boolean.TRUE); projectApplyBorrow.setUpdateOn(LocalDateTime.now()); @@ -260,7 +250,7 @@ public class HandlerManage { // 重新计算建设周期、验收时间 String constructCycle = String.valueOf(Integer.parseInt(buildCycle) + delayApply.getDelayTime()); declaredProject.setBuildCycle(constructCycle); - Long constructMonth = Long.valueOf(constructCycle); + long constructMonth = Long.parseLong(constructCycle); String acceptTime = NdDateUtils.format(approvalDate.plusMonths(constructMonth), DatePattern.NORM_DATETIME_MINUTE_PATTERN); LocalDateTime time = LocalDateTime.parse(acceptTime, DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_MINUTE_PATTERN)); declaredProject.setPlanAcceptanceTime(time); @@ -277,23 +267,22 @@ public class HandlerManage { /** * 驳回后 所处理的逻辑 * - * @param declaredProject - * @param instance + * @param project \ + * @param instance \ */ - public void afterRejectTodo(Project declaredProject, HistoricProcessInstance instance) { + public void afterRejectTodo(Project project, HistoricProcessInstance instance) { Long userId = LoginUserUtil.getUserId(); // 获取当前流程实例类型 - String instanceId = declaredProject.getInstCode(); - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getInstCode, instanceId)); + String instanceId = project.getInstCode(); + ProjectInst projectInst = projectInstService.getByInstCode(instanceId); Integer instType = projectInst.getInstType(); // 审批流程不是申请延期和申请借阅,需调用状态机 - if (!InstTypeEnum.APPLY_DELAY.getCode().equals(instType) && !InstTypeEnum.APPLY_BORROW.getCode().equals(instType)) { + if (!InstTypeEnum.APPLY_DELAY.eq(instType) && !InstTypeEnum.APPLY_BORROW.eq(instType)) { // 更新项目状态和流程状态 - updateRejectProjectStatus(userId, declaredProject, instType); + updateRejectProjectStatus(userId, project, instType); } //发送消息 - noticeManage.sendNotice(userId, declaredProject, instance.getProcessDefinitionName(), + noticeManage.sendNotice(userId, project, instance.getProcessDefinitionName(), REJECT_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW_REJECT); } @@ -329,20 +318,21 @@ public class HandlerManage { } // 保存到草稿箱中 - private void saveToDraft(Project declaredProject) { + private void saveToDraft(Project req) { ProjectDraftSaveDTO draftSaveDto = new ProjectDraftSaveDTO(); ProjectDTO projectInfo = new ProjectDTO(); - BeanUtils.copyProperties(declaredProject, projectInfo); + BeanUtils.copyProperties(req, projectInfo); // 查询出项目关联的应用信息 - List applicationList = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectId, declaredProject.getId())); - List applicationDTOList = applicationList.stream().map(a -> { + List applications = projectApplicationService.listByProjectId(req.getId()); + List applicationDTOList = applications.stream().map(a -> { ProjectApplicationDTO applicationDTO = new ProjectApplicationDTO(); BeanUtils.copyProperties(a, applicationDTO); return applicationDTO; }).collect(Collectors.toList()); projectInfo.setApplicationList(applicationDTOList); - HashMap dynamicMap = JSON.parseObject(declaredProject.getDynamicForm(), HashMap.class); + Map dynamicMap = JSON.parseObject(req.getDynamicForm(), + new TypeReference>() { + }); projectInfo.setDynamicForm(dynamicMap); draftSaveDto.setProjectInfo(projectInfo); declaredProjectManage.saveToDraft(draftSaveDto); @@ -351,45 +341,45 @@ public class HandlerManage { /** * 删除项目的所有信息 * - * @param declaredProject + * @param project \ */ - public void deleteProjectRelated(Project declaredProject) { + private void deleteProjectRelated(Project project) { //删除项目库中该项目信息 - projectService.removeById(declaredProject); + projectService.removeById(project); //删除app信息 projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectId, declaredProject.getId())); + .eq(ProjectApplication::getProjectId, project.getId())); } /** * 退回审核后 所处理的逻辑 * - * @param declaredProject - * @param instance + * @param project \ + * @param instance \ */ - public void afterBackTodo(Project declaredProject, HistoricProcessInstance instance) { + public void afterBackTodo(Project project, HistoricProcessInstance instance) { Long userId = LoginUserUtil.getUserId(); // 获取当前流程实例类型 - String instanceId = declaredProject.getInstCode(); - ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getInstCode, instanceId)); + String instCode = project.getInstCode(); + ProjectInst projectInst = projectInstService.getByInstCode(instCode); Integer instType = projectInst.getInstType(); LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate(); // 如果是预审审批或建设方案退回,需要重新盖章,原来盖过章的文件要清空 - if (InstTypeEnum.PRELIMINARY_PREVIEW.getCode().equals(instType)) { + if (InstTypeEnum.PRELIMINARY_PREVIEW.eq(instType)) { updateWrapper.set(Project::getPretrialFileId, null) .set(Project::getPretrialFileName, null) - .eq(Project::getId, declaredProject.getId()); + .eq(Project::getId, project.getId()); projectService.update(updateWrapper); - } else if (InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(instType)) { + } else if (InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.eq(instType)) { updateWrapper.set(Project::getConstructFileId, null) .set(Project::getConstructFileName, null) - .eq(Project::getId, declaredProject.getId()); + .eq(Project::getId, project.getId()); projectService.update(updateWrapper); } // 给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被退回,请及时处理。 //发送消息 - noticeManage.sendNotice(userId, declaredProject, instance.getProcessDefinitionName(), BACK_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW_BACK); + noticeManage.sendNotice(userId, project, instance.getProcessDefinitionName(), + BACK_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW_BACK); } @@ -452,7 +442,6 @@ public class HandlerManage { * @author CMM * @since 2023/02/08 */ - @Transactional(rollbackFor = Exception.class) public void updateWithdrawProjectStatus(Long userId, Project project) { // 删除关联表信息 projectInstService.remove(Wrappers.lambdaQuery(ProjectInst.class) @@ -475,17 +464,12 @@ public class HandlerManage { && (ProcessHandlerEnum.BACK.equals(ProcessHandlerEnum.getEnumByName(String.valueOf(approve.getValue()))))) { runtimeService.removeVariable(approve.getProcessInstanceId(), approve.getVariableName()); - Comment comment; Optional first = taskService.getProcessInstanceComments(approve.getProcessInstanceId()) .stream() .filter(c -> c.getTaskId().equals(approve.getVariableName().replace("approve_", StringUtils.EMPTY))) .findFirst(); - if (first.isPresent()) { - comment = first.get(); - taskService.deleteComment(comment.getId()); - } + first.ifPresent(comment -> taskService.deleteComment(comment.getId())); break; - } } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java index 3d9f787..563f9cc 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java @@ -40,6 +40,7 @@ import com.hz.pm.api.signature.service.ICompanySignatureService; import com.hz.pm.api.sys.model.entity.Region; import com.hz.pm.api.sys.service.IRegionService; import com.hz.pm.api.todocenter.constant.TodoCenterConst; +import com.hz.pm.api.todocenter.constant.TodoCenterConst.SealTemplate; import com.hz.pm.api.todocenter.enumeration.IsAppendProjectEnum; import com.hz.pm.api.todocenter.enumeration.IsOrNotEnum; import com.hz.pm.api.todocenter.handle.PassHandle; @@ -56,7 +57,7 @@ import com.hz.pm.api.todocenter.model.vo.*; import com.hz.pm.api.todocenter.service.ITodoService; import com.hz.pm.api.todocenter.service.StatisticsService; import com.hz.pm.api.todocenter.utils.BuildUserUtils; -import com.hz.pm.api.todocenter.utils.PdfUtils; +import com.hz.pm.api.todocenter.utils.PdfUtil; 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; @@ -135,7 +136,6 @@ public class TodoCenterManage { private final UserInfoHelper userInfoHelper; private final BuildUserUtils buildUserUtils; private final IProjectInstService projectInstService; - private final PdfUtils pdfUtils; private final FileService fileService; private final ICompanySignatureService companySignatureService; private final StatisticsService statisticsService; @@ -327,6 +327,7 @@ public class TodoCenterManage { * @author CMM * @since 2023/02/01 */ + @Transactional(rollbackFor = Exception.class) public String handler(ReqProcessHandlerDTO param) { // 获取登录用户ID UserInfoDetails user = LoginUserUtil.loginUserDetail(); @@ -516,12 +517,12 @@ public class TodoCenterManage { FileResultVO resultVo = fileService.upload(multipartFile, "default"); // 将返回的文件ID更新到项目库中对应的项目下 // 根据模版名称判断是预审申请单还是建设方案申请单 - if (TodoCenterConst.SealTemplate.CITY_TEMPLATE.equals(templateName) || - TodoCenterConst.SealTemplate.COUNTRY_TEMPLATE.equals(templateName)) { + if (SealTemplate.CITY_TEMPLATE.equals(templateName) || + SealTemplate.COUNTRY_TEMPLATE.equals(templateName)) { //放到项目申报书字段 declaredProject.setProjectApplicationForm(BizUtils.buildFileJson(resultVo)); declaredProject.setUpdateOn(LocalDateTime.now()); - } else if (TodoCenterConst.SealTemplate.CONSTRUCT_TEMPLATE.equals(templateName)) { + } else if (SealTemplate.CONSTRUCT_TEMPLATE.equals(templateName)) { declaredProject.setConstructFileId(resultVo.getId()); declaredProject.setConstructFileName(resultVo.getOriginalFileName()); declaredProject.setUpdateOn(LocalDateTime.now()); @@ -1204,7 +1205,7 @@ public class TodoCenterManage { if (Boolean.TRUE.equals(getCityNotSealedInfoVO(pretrialFileId, notSealedInfoVo))) { return notSealedInfoVo; } - String cityTemplateName = TodoCenterConst.SealTemplate.CITY_TEMPLATE; + String cityTemplateName = SealTemplate.CITY_TEMPLATE; // 设置pdf模板参数 JSONObject cityParamsMap = assemblyPdfParams(project, cityTemplateName); // 盖章审核为主管单位审核 @@ -1228,7 +1229,7 @@ public class TodoCenterManage { return notSealedInfoVo; } // 设置pdf模板参数 - String constructTemplateName = TodoCenterConst.SealTemplate.CONSTRUCT_TEMPLATE; + String constructTemplateName = SealTemplate.CONSTRUCT_TEMPLATE; JSONObject constructParamsMap = assemblyPdfParams(project, constructTemplateName); // 审核为指定大数据局盖章 // 获取流程配置的指定单位信息 @@ -1276,10 +1277,10 @@ public class TodoCenterManage { } else { fileName = templateName; } - InputStream htmlInputStream = - this.getClass().getClassLoader().getResourceAsStream("template" + java.io.File.separator + templateName + ".html"); + InputStream htmlInputStream = this.getClass().getClassLoader() + .getResourceAsStream("template" + java.io.File.separator + templateName + ".html"); // 生成pdf字节数组 - byte[] pdf = pdfUtils.generatePdf(htmlInputStream, paramsMap); + byte[] pdf = PdfUtil.generatePdf(htmlInputStream, paramsMap); // 转换成MultipartFile MultipartFile multipartFile = new MockMultipartFile("file", fileName + ".pdf", "application/pdf", pdf); @@ -1293,12 +1294,12 @@ public class TodoCenterManage { String superOrgOpinion = paramsMap.getString("superOrgOpinion"); String higherOrgOpinion = paramsMap.getString("higherOrgOpinion"); if (StringUtils.isNotBlank(superOrgOpinion) || StringUtils.isNotBlank(higherOrgOpinion)) { - if (TodoCenterConst.SealTemplate.CITY_TEMPLATE.equals(templateName) || - TodoCenterConst.SealTemplate.COUNTRY_TEMPLATE.equals(templateName)) { + if (SealTemplate.CITY_TEMPLATE.equals(templateName) || + SealTemplate.COUNTRY_TEMPLATE.equals(templateName)) { //放到项目申报书字段 declaredProject.setProjectApplicationForm(BizUtils.buildFileJson(resultVo)); declaredProject.setUpdateOn(LocalDateTime.now()); - } else if (TodoCenterConst.SealTemplate.CONSTRUCT_TEMPLATE.equals(templateName)) { + } else if (SealTemplate.CONSTRUCT_TEMPLATE.equals(templateName)) { declaredProject.setConstructFileId(resultVo.getId()); declaredProject.setConstructFileName(resultVo.getOriginalFileName()); declaredProject.setUpdateOn(LocalDateTime.now()); @@ -1357,7 +1358,7 @@ public class TodoCenterManage { .eq(ProjectInst::getInstType, InstTypeEnum.PRELIMINARY_PREVIEW.getCode()) .orderByDesc(ProjectInst::getCreatOn) .last("limit 1")); - LocalDateTime time = null; + LocalDateTime time; if (Objects.nonNull(projectInst)) { time = projectInst.getCreatOn(); paramsMap.put("time", NdDateUtils.format(time, "yyyy-MM-dd HH:mm")); @@ -1476,11 +1477,11 @@ public class TodoCenterManage { switch (regionLevel) { // 市级预审(市本级) case RegionConst.RL_CITY: - String cityTemplateName = TodoCenterConst.SealTemplate.CITY_TEMPLATE; + String cityTemplateName = SealTemplate.CITY_TEMPLATE; return generateSealedPdf(req, declaredProject, cityTemplateName, notSealedFileId); // 区县预审 case RegionConst.RL_COUNTY: - String countryTemplateName = TodoCenterConst.SealTemplate.COUNTRY_TEMPLATE; + String countryTemplateName = SealTemplate.COUNTRY_TEMPLATE; return generateSealedPdf(req, declaredProject, countryTemplateName, notSealedFileId); default: throw new IllegalStateException("Unexpected value: " + regionLevel); @@ -1489,7 +1490,7 @@ public class TodoCenterManage { // 如果为建设方案申报审批 else if (InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode().equals(instType)) { // 设置pdf模板参数 - String constructTemplateName = TodoCenterConst.SealTemplate.CONSTRUCT_TEMPLATE; + String constructTemplateName = SealTemplate.CONSTRUCT_TEMPLATE; return generateSealedPdf(req, declaredProject, constructTemplateName, notSealedFileId); } return null; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/PdfUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/PdfUtil.java new file mode 100644 index 0000000..ca932ed --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/PdfUtil.java @@ -0,0 +1,119 @@ +package com.hz.pm.api.todocenter.utils; + + +import com.itextpdf.text.DocumentException; +import com.itextpdf.text.pdf.BaseFont; +import com.ningdatech.basic.exception.BizException; +import lombok.extern.slf4j.Slf4j; +import org.xhtmlrenderer.pdf.ITextFontResolver; +import org.xhtmlrenderer.pdf.ITextRenderer; + +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Map; +import java.util.Optional; +import java.util.UUID; + +/** + * pdf生成工具类 + * + * @author CMM + * @since 2023/03/13 17:01 + */ +@Slf4j +public class PdfUtil { + + private PdfUtil() { + } + + /** + * 生成PDF文件 + * + * @return int + * @author CMM + * @since 2023/03/13 17:07 + */ + public static byte[] generatePdf(InputStream templateHtmlInputStream, Map paramsMap) { + try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(templateHtmlInputStream, StandardCharsets.UTF_8))) { + // 字体格式 + String fontPath = "font" + File.separator + "simsun.ttc"; + StringBuilder stringBuilder = new StringBuilder(); + bufferedReader.lines().forEach(stringBuilder::append); + String htmlInfo = stringBuilder.toString(); + + // 替换参数、多个参数多次替换 + for (Map.Entry entry : paramsMap.entrySet()) { + String value = Optional.ofNullable(entry.getValue()) + .map(Object::toString) + .orElse(""); + htmlInfo = htmlInfo.replace("#" + entry.getKey() + "#", value); + } + + // 生成临时文件 + String htmlFileName = UUID.randomUUID().toString().replace("-", "") + ".html"; + String htmlFilePath = "fileout" + File.separator + htmlFileName; + File file = new File(htmlFilePath); + try (FileOutputStream fop = new FileOutputStream(file)) { + byte[] contentInBytes = htmlInfo.getBytes(); + fop.write(contentInBytes); + } catch (IOException e) { + throw BizException.wrap("生成html文件失败!" + e.getMessage()); + } + + // 生成pdf + String pdfFileName = UUID.randomUUID().toString().replace("-", "") + ".pdf"; + String pdfFilePath = "fileout" + File.separator + pdfFileName; + String url = new File(htmlFilePath).toURI().toURL().toString(); + try (OutputStream os = Files.newOutputStream(Paths.get(pdfFilePath))) { + ITextRenderer renderer = new ITextRenderer(); + renderer.setDocument(url); + ITextFontResolver fontResolver = renderer.getFontResolver(); + fontResolver.addFont(fontPath, BaseFont.IDENTITY_H, BaseFont.EMBEDDED); + renderer.layout(); + renderer.createPDF(os); + } catch (IOException | DocumentException e) { + throw BizException.wrap("生成pdf文件失败!" + e.getMessage()); + } + + // 返回生成的pdf文件字节数组 + try (FileInputStream inputStream = new FileInputStream(pdfFilePath)) { + return readBytes(inputStream); + } catch (IOException e) { + throw BizException.wrap("读取pdf文件失败!" + e.getMessage()); + } + } catch (IOException e) { + throw BizException.wrap("读取模板html文件失败!" + e.getMessage()); + } + } + + + /** + * 读取输入流到字节数组 + * + * @param in + * @return + * @throws IOException + */ + private static byte[] readBytes(InputStream in) throws IOException { + //读取字节的缓冲 + byte[] buffer = new byte[1024]; + //最终的数据 + byte[] result = new byte[0]; + int size; + while ((size = in.read(buffer)) != -1) { + int oldLen = result.length; + byte[] tmp = new byte[oldLen + size]; + if (oldLen > 0) { + //copy 旧字节 + System.arraycopy(result, 0, tmp, 0, oldLen); + } + //copy 新字节 + System.arraycopy(buffer, 0, tmp, oldLen, size); + result = tmp; + } + return result; + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/PdfUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/PdfUtils.java deleted file mode 100644 index 2b31778..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/utils/PdfUtils.java +++ /dev/null @@ -1,134 +0,0 @@ -package com.hz.pm.api.todocenter.utils; - - -import cn.hutool.core.io.IoUtil; -import com.itextpdf.text.DocumentException; -import com.itextpdf.text.pdf.BaseFont; -import com.ningdatech.basic.exception.BizException; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; -import org.xhtmlrenderer.pdf.ITextFontResolver; -import org.xhtmlrenderer.pdf.ITextRenderer; - -import java.io.*; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Map; -import java.util.UUID; - -/** - * pdf生成工具类 - * - * @author CMM - * @since 2023/03/13 17:01 - */ -@Slf4j -@Component -public class PdfUtils { - /** - * 生成PDF文件 - * - * @return int - * @author CMM - * @since 2023/03/13 17:07 - */ - public byte[] generatePdf(InputStream templateHtmlInputStream, Map paramsMap) { - FileInputStream inputStream = null; - - try (InputStreamReader isr = new InputStreamReader(templateHtmlInputStream, StandardCharsets.UTF_8); - BufferedReader bufferedReader = new BufferedReader(isr)) { - File directory = new File(""); - // 临时文件输出路径 - String filePath = directory.getAbsolutePath() + File.separator + "fileout"; - //字体格式 - String fontPath = directory.getAbsolutePath() + File.separator + "font" + File.separator + "simsun.ttc"; - if (!new File(filePath).exists()) { - new File(filePath).mkdir(); - } - StringBuilder stringBuilder = new StringBuilder(); - String line; - while ((line = bufferedReader.readLine()) != null) { - stringBuilder.append(line); - } - String htmlInfo = stringBuilder.toString(); - - //替换参数、多个参数多次替换 - for (String fieldName : paramsMap.keySet()) { - if (paramsMap.get(fieldName) == null) { - // 没有值的字段使用-覆盖 - htmlInfo = htmlInfo.replace("#" + fieldName + "#", ""); - } else { - // 设置占位字段 - htmlInfo = htmlInfo.replace("#" + fieldName + "#", paramsMap.get(fieldName).toString()); - } - } - - //生成临时文件 - String htmlFileName = UUID.randomUUID().toString().replace("-", "") + ".html"; - String htmlFilePath = filePath + File.separator + htmlFileName; - File file = new File(htmlFilePath); - FileOutputStream fop = new FileOutputStream(file); - if (!file.exists()) { - file.createNewFile(); - } - byte[] contentInBytes = htmlInfo.getBytes(); - fop.write(contentInBytes); - fop.flush(); - fop.close(); - - //生成pdf - String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf"; - String pdfFilePath = filePath + File.separator + fileName; - String url = new File(htmlFilePath).toURI().toURL().toString(); - OutputStream os = Files.newOutputStream(Paths.get(pdfFilePath)); - - ITextRenderer renderer = new ITextRenderer(); - renderer.setDocument(url); - ITextFontResolver fontResolver = renderer.getFontResolver(); - fontResolver.addFont(fontPath, BaseFont.IDENTITY_H, BaseFont.EMBEDDED); - renderer.layout(); - renderer.createPDF(os); - os.flush(); - os.close(); - - inputStream = new FileInputStream(pdfFilePath); - - // 返回生成的pdf文件字节数组 - return readBytes(inputStream); - } catch (IOException | DocumentException e) { - throw BizException.wrap("生成pdf文件失败!" + e.getMessage()); - } finally { - IoUtil.close(inputStream); - } - } - - - /** - * 读取输入流到字节数组 - * - * @param in - * @return - * @throws IOException - */ - private byte[] readBytes(InputStream in) throws IOException { - //读取字节的缓冲 - byte[] buffer = new byte[1024]; - //最终的数据 - byte[] result = new byte[0]; - int size = 0; - while ((size = in.read(buffer)) != -1) { - int oldLen = result.length; - byte[] tmp = new byte[oldLen + size]; - if (oldLen > 0) {//copy 旧字节 - System.arraycopy(result, 0, tmp, 0, oldLen); - } - //copy 新字节 - System.arraycopy(buffer, 0, tmp, oldLen, size); - - result = tmp; - } - return result; - } - -} diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/todocenter/TodoCenterTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/todocenter/TodoCenterTest.java index ea83b1a..4d3569e 100644 --- a/hz-pm-api/src/test/java/com/hz/pm/api/todocenter/TodoCenterTest.java +++ b/hz-pm-api/src/test/java/com/hz/pm/api/todocenter/TodoCenterTest.java @@ -17,7 +17,7 @@ import com.hz.pm.api.sys.manage.NoticeManage; import com.hz.pm.api.todocenter.bean.entity.WorkNoticeInfo; import com.hz.pm.api.todocenter.manage.TodoCenterManage; import com.hz.pm.api.todocenter.model.dto.PdfGenerateDTO; -import com.hz.pm.api.todocenter.utils.PdfUtils; +import com.hz.pm.api.todocenter.utils.PdfUtil; import com.hz.pm.api.user.service.IUserInfoService; import com.ningdatech.zwdd.client.ZwddClient; import com.wflow.contants.ProcessConstant; @@ -63,7 +63,7 @@ public class TodoCenterTest extends AppTests { @Autowired private IProjectService projectService; @Autowired - private PdfUtils pdfUtils; + private PdfUtil pdfUtil; @Autowired private TaskService taskService; @@ -169,7 +169,7 @@ public class TodoCenterTest extends AppTests { paramsMap.put("bigDataBureauName",null); // 生成pdf字节数组 - byte[] pdf = pdfUtils.generatePdf(htmlInputStream, paramsMap); + byte[] pdf = pdfUtil.generatePdf(htmlInputStream, paramsMap); // 转换成MultipartFile MultipartFile multipartFile = new MockMultipartFile("file", fileName + ".pdf", "application/pdf", pdf); diff --git a/hz-pm-sync/pom.xml b/hz-pm-sync/pom.xml deleted file mode 100644 index 0b9931b..0000000 --- a/hz-pm-sync/pom.xml +++ /dev/null @@ -1,198 +0,0 @@ - - - - hz-project-management - com.hz.pm - 1.0.0 - - 4.0.0 - - hz-pm-sync - - - 8 - 8 - - - - - com.google.guava - guava - - - cn.hutool - hutool-all - 5.8.5 - - - - mysql - mysql-connector-java - - - - org.projectlombok - lombok - - - - com.baomidou - mybatis-plus-boot-starter - - - org.apache.commons - commons-lang3 - - - com.alibaba - fastjson - - - org.apache.tomcat.embed - tomcat-embed-core - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-jdbc - - - - org.springframework.boot - spring-boot-devtools - true - true - - - org.springframework.boot - spring-boot-starter-aop - - - com.ningdatech - nd-swagger2-starter - - - org.slf4j - slf4j-log4j12 - - - - - com.ningdatech - nd-basic - - - org.slf4j - slf4j-log4j12 - - - spring-boot-starter-security - org.springframework.boot - - - spring-security-config - org.springframework.security - - - spring-security-web - org.springframework.security - - - spring-security-core - org.springframework.security - - - com.baomidou - mybatis-plus-boot-starter - - - - - - org.apache.httpcomponents - httpclient - 4.5.13 - - - - - - - - dev - - - dev - - - - test - - test - - - - pre - - pre - - - - prod - - prod - - - - - - - - src/main/resources - - **/* - - - - src/main/java - - **/*.xml - - - - src/main/lib - BOOT-INF/lib/ - - **/*.jar - - - - src/main/resources - BOOT-INF/classes/ - - - ${project.artifactId} - - - org.springframework.boot - spring-boot-maven-plugin - 2.6.8 - - true - - - - - repackage - - - - - - - \ No newline at end of file diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/SynDataTaskApp.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/SynDataTaskApp.java deleted file mode 100644 index b8ca6f0..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/SynDataTaskApp.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.hz.pm.sync; - - -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.scheduling.annotation.EnableAsync; -import org.springframework.scheduling.annotation.EnableScheduling; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -/** - *

- * SynDataTaskApp - *

- * - * @author WendyYang - * @since 10:44 2023/12/12 - */ -@SpringBootApplication -@EnableAsync -@MapperScan(SynDataTaskApp.MAPPER_PACKAGES) -@EnableScheduling -@EnableTransactionManagement -@EnableAspectJAutoProxy(exposeProxy = true) -public class SynDataTaskApp { - - protected static final String MAPPER_PACKAGES = "com.hz.pm.sync.**.mapper"; - - public static void main(String[] args) { - SpringApplication.run(SynDataTaskApp.class, args); - } -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/common/constant/BizConst.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/common/constant/BizConst.java deleted file mode 100644 index ed2f2dc..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/common/constant/BizConst.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.hz.pm.sync.common.constant; - -import com.ningdatech.basic.model.ApiResponse; - -import java.math.BigDecimal; - -/** - *

- * 业务常量 - *

- * - * @author WendyYang - * @since 13:42 2022/12/1 - */ -public interface BizConst { - - /** - * SQL查询一条 - */ - String LIMIT_1 = "limit 1"; - - String COOKIE_KEY = "ND_PROJECT_MANAGEMENT_JSESSION"; - - /** - * 一小时秒数 - **/ - BigDecimal SECONDS_BY_HOUR = new BigDecimal(60 * 60); - - /** - * 十分钟的毫秒数 - */ - long MILLS_10_MIN = 1000L * 60 * 10; - - /** - * 中国行政区划编码 - */ - long ROOT_REGION_CODE = 100000L; - - /** - * 一级行政区划数量 - */ - int NUM_PROVINCE = 34; - - /** - * 默认的父id - */ - long PARENT_ID = 0L; - - /** - * 默认树层级 - */ - int TREE_GRADE = 0; - - /** - * 默认的排序 - */ - int SORT_VALUE = 0; - - /** - * 浙江省的region_id - */ - long ZJ_REGION_CODE = 330000L; - String NINE_AREA_CODE_LAST = "000"; - - /** - * 省/直辖市 level - */ - int GOV_L1 = 1; - - /** - * 市 level - */ - int GOV_L2 = 2; - - /** - * 区/县 level - */ - int GOV_L3 = 3; - - /** - * 密码正则:长度8-20位且至少包含大写字母、小写字母、数字或特殊符号中的任意三种 - */ - String REGEX_PASS = "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\\W_]+$)(?![a-z0-9]+$)(?![a-z\\W_]+$)(?![0-9\\W_]+$)[a-zA-Z0-9\\W_]{8,20}$"; - - ApiResponse UNAUTHENTICATED = ApiResponse.of(401, "用户未登录", null); - - int MAX_EXPORT_COUNT = 5000; - - String RESPONSE_KEY_DATA = "data"; - String ORG_NAME = "organizationName"; - String ORG_CODE = "organizationCode"; - - String DEV = "dev"; - String PRE = "pre"; - String PROD = "prod"; - - String SAVE_SUCCESS = "保存成功"; - String OP_SUCCESS = "操作成功"; - String SAVE_FAIL = "保存失败"; - String NOT_EFFECTIVE = "1"; - - String OP_INSERT = "insert"; - String OP_UPDATE = "update"; - String OP_DELETE = "delete"; - String OP_FAIL = "操作失败"; -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/common/utils/CryptUtils.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/common/utils/CryptUtils.java deleted file mode 100644 index d7f2745..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/common/utils/CryptUtils.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.hz.pm.sync.common.utils; - -import org.apache.commons.codec.binary.Hex; - -import javax.crypto.Mac; -import javax.crypto.SecretKey; -import javax.crypto.spec.SecretKeySpec; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.security.InvalidKeyException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - -/** - * 加密工具 - * @author hank - */ -public class CryptUtils { - - /** - * 默认的算法 - */ - private static final String DE_KEY_MAC = "HmacMD5"; - - /** - * 默认的字符集 - */ - private static final Charset DE_CHARSET = StandardCharsets.UTF_8; - - - /** - * 使用默认的算法(HmacMD5) 得到hmac 16进制字符串 - * @param inputStr 需要加密的串 - * @param key key - * @return 16进制字符串 - * @throws Exception - */ - public static String encryptHMAC(String inputStr, String key) throws Exception { - return encryptHMAC(inputStr, key, DE_KEY_MAC); - } - /** - * 使用指定的算法得到hmac 16进制字符串 - * @param inputStr 需要加密的串 - * @param key key - * @param keyMac hmac算法 - * @return 16进制字符串 - * @throws Exception - */ - public static String encryptHMAC(String inputStr, String key, String keyMac) throws Exception { - return Hex.encodeHexString(encryptHMAC(inputStr.getBytes(DE_CHARSET), key, keyMac)); - } - - public static String MD5Encode(String origin) throws NoSuchAlgorithmException { - MessageDigest md = MessageDigest.getInstance("MD5"); - return Hex.encodeHexString(md.digest(origin.getBytes(DE_CHARSET))); - } - - private static byte[] encryptHMAC(byte[] data, String key, String keyMac) throws Exception { - - SecretKey secretKey = new SecretKeySpec(key.getBytes(DE_CHARSET), keyMac); - Mac mac = Mac.getInstance(secretKey.getAlgorithm()); - mac.init(secretKey); - return mac.doFinal(data); - } - - /** - * 生成HMAC-MD5值 - * @param data 消息数据 - * @param key 密钥 - * @return HMAC-MD5值 - * @throws NoSuchAlgorithmException - * @throws InvalidKeyException - */ - public static byte[] hmacMd5(byte[] data, byte[] key) - throws NoSuchAlgorithmException, InvalidKeyException { - SecretKeySpec signingKey = new SecretKeySpec(key, "HmacMD5"); - Mac mac = Mac.getInstance("HmacMD5"); - mac.init(signingKey); - return mac.doFinal(data); - } - - public static void main(String[] args) throws Exception{ - System.out.println("HMACStr:\n" + encryptHMAC("a", "hank")); - } -} \ No newline at end of file diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/open/controller/ProjectReceiveController.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/open/controller/ProjectReceiveController.java deleted file mode 100644 index d15a267..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/open/controller/ProjectReceiveController.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.hz.pm.sync.open.controller; - -import com.hz.pm.sync.open.manage.IrsManage; -import com.hz.pm.sync.open.manage.ProjectReceiveManage; -import com.hz.pm.sync.scheduler.model.dto.ForwardDTO; -import com.hz.pm.sync.scheduler.model.dto.ProjectBaseInfoDTO; -import com.hz.pm.sync.scheduler.model.dto.ProjectSaveDTO; -import com.ningdatech.basic.model.ApiResponse; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - -/** - * @Classname ProjectCollectionController - * @Description - * @Date 2023/6/25 9:11 - * @Author PoffyZhang - */ -@RestController -@RequiredArgsConstructor -@Api(tags = "项目归集控制器") -@RequestMapping("/open/api/v1/project-receive") -public class ProjectReceiveController { - - private final ProjectReceiveManage receiveManage; - - private final IrsManage irsManage; - - @PostMapping("/save") - @ApiOperation("项目归集接收") - public ApiResponse save(@Valid @RequestBody ProjectSaveDTO dto) { - return ApiResponse.ofSuccess(receiveManage.save(dto)); - } - - @PostMapping("/not-effective") - @ApiOperation("项目归集置为无效") - public ApiResponse notEffective(@Valid @RequestBody ProjectBaseInfoDTO baseinfo) { - return ApiResponse.ofSuccess(receiveManage.notEffective(baseinfo)); - } - - @PostMapping("/delete-all") - @ApiOperation("清空当前表数据") - public ApiResponse deleteAll() { - return ApiResponse.ofSuccess(receiveManage.deleteAll()); - } - - @ApiOperation(value = "转发IRS请求", notes = "转发IRS请求 用于") - @PostMapping("/forward") - public String forward(@Valid @RequestBody ForwardDTO dto) { - return irsManage.forward(dto); - } -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/open/enumeration/GovProjectStatusEnum.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/open/enumeration/GovProjectStatusEnum.java deleted file mode 100644 index be78df5..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/open/enumeration/GovProjectStatusEnum.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.hz.pm.sync.open.enumeration; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import org.apache.commons.lang3.StringUtils; - -import java.util.Objects; - -/** - * GovProjectStatusEnum - * - * @return - * @author ZPF - * @since 2023/10/24 16:27 - */ -@Getter -@AllArgsConstructor -@NoArgsConstructor -public enum GovProjectStatusEnum { - /** - * 项目归集 状态 - */ - APPROVAL("01", "评审中"), - PENDING("02", "待立项"), - REJECTED("03","已驳回"), - APPROVED("04","已立项"), - PURCHASED("05","已采购"), - HAS_PRE_INS("06","已初验"), - HAS_FINAL_INS("07","已终验"), - TERMINATED("00","已终止"); - - private String code; - private String desc; - - public static String getDescByCode(Integer code) { - if (Objects.isNull(code)) { - return StringUtils.EMPTY; - } - for (GovProjectStatusEnum t : GovProjectStatusEnum.values()) { - if (code.equals(t.getCode())) { - return t.desc; - } - } - return StringUtils.EMPTY; - } - - public static GovProjectStatusEnum match(String code) { - if (StringUtils.isBlank(code)) { - return null; - } - for (GovProjectStatusEnum t : GovProjectStatusEnum.values()) { - if (code.equals(t.getCode())) { - return t; - } - } - return null; - } -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/open/manage/IrsManage.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/open/manage/IrsManage.java deleted file mode 100644 index 9f75bec..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/open/manage/IrsManage.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.hz.pm.sync.open.manage; - -import com.google.common.base.Joiner; -import com.hz.pm.sync.scheduler.model.dto.ForwardDTO; -import com.hz.pm.sync.common.constant.BizConst; -import com.hz.pm.sync.common.utils.CryptUtils; -import lombok.extern.slf4j.Slf4j; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Component; -import org.springframework.web.client.RestTemplate; - -import java.util.Map; - -/** - * @Classname IrsManage - * @Description - * @Date 2023/9/1 15:15 - * @Author PoffyZhang - */ -@Component -@Slf4j -public class IrsManage { - - - /** - * 转发IRS请求 - * @param dto - * @return - */ - public String forward(ForwardDTO dto) { - try{ - String url = dto.getUrl(); - String appkey = dto.getAppKey(); - long timestamp = System.currentTimeMillis(); - String requestSecret = dto.getSecret(); - String sign = CryptUtils.MD5Encode(appkey + requestSecret + timestamp); - url = url + "?requestTime=" + timestamp + "&sign=" + sign + "&" + asUrlParams(dto.getData()); - log.info("url :{}",url); - RestTemplate restTemplate = new RestTemplate(); - ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); - log.info(forEntity.getBody()); - return forEntity.getBody(); - }catch (Exception e){ - log.error("e:" + e); - } - return BizConst.OP_FAIL; - } - - public static String asUrlParams(Map source){ - return Joiner.on("&") - // 用指定符号代替空值,key 或者value 为null都会被替换 - .useForNull("") - .withKeyValueSeparator("=") - .join(source); - } -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/open/manage/ProjectReceiveManage.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/open/manage/ProjectReceiveManage.java deleted file mode 100644 index ee9f70e..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/open/manage/ProjectReceiveManage.java +++ /dev/null @@ -1,317 +0,0 @@ -package com.hz.pm.sync.open.manage; - -import cn.hutool.core.bean.BeanUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.hz.pm.sync.scheduler.model.dto.ProjectBaseInfoDTO; -import com.hz.pm.sync.scheduler.model.dto.ProjectSaveDTO; -import com.hz.pm.sync.scheduler.model.entity.*; -import com.hz.pm.sync.scheduler.service.*; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.basic.util.StrPool; -import com.hz.pm.sync.common.constant.BizConst; -import com.hz.pm.sync.open.enumeration.GovProjectStatusEnum; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.Objects; - -/** - * @Classname ProjectReceiveManage - * @Description - * @Date 2023/8/25 9:11 - * @Author PoffyZhang - */ -@Component -@RequiredArgsConstructor -@Slf4j -public class ProjectReceiveManage { - - private final IProjectBaseInfoService baseInfoService; - - private final IProjectApplyService applyService; - - private final IProjectApproveService approveService; - - private final IProjectCimplementService cimplementService; - - private final IProjectMimplementService mimplementService; - - private final IProjectProcureService procureService; - - /** - * 接收保存 项目 - * - * @param dto - * @return - */ - public String save(ProjectSaveDTO dto) { - - //1.保存项目基本信息 - ProjectBaseInfo baseInfo = dto.getBaseinfo(); - String baseProjId = baseInfo.getBaseProjId(); - VUtils.isTrue(StringUtils.isBlank(baseProjId)) - .throwMessage("项目编号不能为空!"); - - ProjectBaseInfo oldBaseInfo = baseInfoService.getOne(Wrappers.lambdaQuery(ProjectBaseInfo.class) - .eq(ProjectBaseInfo::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - ProjectBaseInfo saveBase = BeanUtil.copyProperties(baseInfo, ProjectBaseInfo.class); - - //项目状态 - String baseProjSetProg = saveBase.getBaseProjSetProg(); - if (StringUtils.isBlank(baseProjSetProg)) { - return "无状态不保存"; - } - //评审中 基本信息和申报信息 - GovProjectStatusEnum match = GovProjectStatusEnum.match(baseProjSetProg); - if (Objects.isNull(match)) { - return "状态不对 不保存"; - } - switch (match) { - case APPROVAL: - log.info("评审中状态 保存基本信息和申报信息 :{}", baseProjId); - saveBase(oldBaseInfo, saveBase, baseInfo); - saveApply(dto, baseProjId); - break; - case PENDING: - case APPROVED: - log.info("待立项和已立项状态 保存基本信息,申报信息,评审信息 :{}", baseProjId); - saveBase(oldBaseInfo, saveBase, baseInfo); - saveApply(dto, baseProjId); - saveApprove(dto, baseProjId); - break; - case PURCHASED: - log.info("已采购状态 保存基本信息,申报信息,评审信息,采购信息 :{}", baseProjId); - saveBase(oldBaseInfo, saveBase, baseInfo); - saveApply(dto, baseProjId); - saveApprove(dto, baseProjId); - saveProcure(dto, baseProjId); - break; - case HAS_PRE_INS: - case HAS_FINAL_INS: - case TERMINATED: - log.info("初验 终验状态 终止 保存所有信息 :{}", baseProjId); - saveBase(oldBaseInfo, saveBase, baseInfo); - saveApply(dto, baseProjId); - saveApprove(dto, baseProjId); - saveProcure(dto, baseProjId); - saveCimplementOrMimplement(dto, baseProjId); - break; - case REJECTED: - log.info("驳回终止状态 啥都不保存 :{}", baseProjId); - break; - default: - log.info("没有匹配任何状态 保存失败 :{}", baseProjId); - } - - return BizConst.SAVE_SUCCESS; - } - - private void saveCimplementOrMimplement(ProjectSaveDTO dto, String baseProjId) { - // 4.保存 建设项目 实施信息 - ProjectCimplement cimplement = dto.getCimplement(); - if (Objects.nonNull(cimplement)) { - ProjectCimplement oldCimplement = cimplementService.getOne(Wrappers.lambdaQuery(ProjectCimplement.class) - .eq(ProjectCimplement::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - - ProjectCimplement saveCimplement = BeanUtil.copyProperties(cimplement, ProjectCimplement.class); - saveCimplement.setBaseProjId(baseProjId); - if (Objects.isNull(oldCimplement)) { - //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update - if (StringUtils.isNotBlank(cimplement.getOp()) && BizConst.OP_UPDATE.equals(cimplement.getOp())) { - saveCimplement.setOp(BizConst.OP_UPDATE); - } else { - saveCimplement.setOp(BizConst.OP_INSERT); - } - saveCimplement.setTongTime(LocalDateTime.now()); - } else { - saveCimplement.setOp(BizConst.OP_INSERT); - saveCimplement.setTongID(oldCimplement.getTongID()); - saveCimplement.setTongTime(LocalDateTime.now()); - } - saveCimplement.setBizTime(LocalDateTime.now()); - cimplementService.saveOrUpdate(saveCimplement); - } - - // 5.保存 运维项目 实施信息 - ProjectMimplement mimplement = dto.getMimplement(); - if (Objects.nonNull(mimplement)) { - ProjectMimplement oldMimplement = mimplementService.getOne(Wrappers.lambdaQuery(ProjectMimplement.class) - .eq(ProjectMimplement::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - - ProjectMimplement saveMimplement = BeanUtil.copyProperties(mimplement, ProjectMimplement.class); - saveMimplement.setBaseProjId(baseProjId); - if (Objects.isNull(oldMimplement)) { - //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update - if (StringUtils.isNotBlank(mimplement.getOp()) && BizConst.OP_UPDATE.equals(mimplement.getOp())) { - saveMimplement.setOp(BizConst.OP_UPDATE); - } else { - saveMimplement.setOp(BizConst.OP_INSERT); - } - saveMimplement.setTongTime(LocalDateTime.now()); - } else { - saveMimplement.setOp(BizConst.OP_INSERT); - saveMimplement.setTongID(oldMimplement.getTongID()); - saveMimplement.setTongTime(LocalDateTime.now()); - } - saveMimplement.setBizTime(LocalDateTime.now()); - mimplementService.saveOrUpdate(saveMimplement); - } - } - - private void saveProcure(ProjectSaveDTO dto, String baseProjId) { - // 6.保存 采购信息 - List procures = dto.getProcures(); - if (Objects.nonNull(procures)) { - List olds = procureService.list(Wrappers.lambdaQuery(ProjectProcure.class) - .eq(ProjectProcure::getBaseProjId, baseProjId) - .orderByAsc(ProjectProcure::getBaseBidCode)); - int index = 0; - for (ProjectProcure old : olds) { - if (StringUtils.isNotBlank(old.getBaseBidCode())) { - try { - String bidCode = old.getBaseBidCode().split(StrPool.DASH)[1]; - index = Integer.parseInt(bidCode); - } catch (Exception e) { - log.error(e.getMessage(),e); - } - } - //删除标记 - old.setOp(BizConst.OP_DELETE); - procureService.updateById(old); - } - index++; - for (ProjectProcure procure : procures) { - //添加标记 - ProjectProcure saveProcure = BeanUtil.copyProperties(procure, ProjectProcure.class); - saveProcure.setBaseProjId(baseProjId); - saveProcure.setBaseBidCode(baseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS, index)); - saveProcure.setTongID(null); - saveProcure.setTongTime(LocalDateTime.now()); - saveProcure.setBizTime(LocalDateTime.now()); - saveProcure.setOp(BizConst.OP_INSERT); - procureService.save(saveProcure); - index++; - } - } - } - - private void saveApprove(ProjectSaveDTO dto, String baseProjId) { - // 3.保存 审批信息 - ProjectApprove approve = dto.getApprove(); - - ProjectApprove oldApprove = approveService.getOne(Wrappers.lambdaQuery(ProjectApprove.class) - .eq(ProjectApprove::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - - ProjectApprove saveApprove = BeanUtil.copyProperties(approve, ProjectApprove.class); - saveApprove.setBaseProjId(baseProjId); - if (Objects.isNull(oldApprove)) { - //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update - if (StringUtils.isNotBlank(approve.getOp()) && BizConst.OP_UPDATE.equals(approve.getOp())) { - saveApprove.setOp(BizConst.OP_UPDATE); - } else { - saveApprove.setOp(BizConst.OP_INSERT); - } - saveApprove.setTongTime(LocalDateTime.now()); - } else { - saveApprove.setOp(BizConst.OP_INSERT); - saveApprove.setTongID(oldApprove.getTongID()); - saveApprove.setTongTime(LocalDateTime.now()); - } - saveApprove.setBizTime(LocalDateTime.now()); - approveService.saveOrUpdate(saveApprove); - } - - private void saveApply(ProjectSaveDTO dto, String baseProjId) { - // 2.保存 申报信息 - ProjectApply apply = dto.getApply(); - - ProjectApply oldApply = applyService.getOne(Wrappers.lambdaQuery(ProjectApply.class) - .eq(ProjectApply::getBaseProjId, baseProjId) - .last(BizConst.LIMIT_1)); - - ProjectApply saveApply = BeanUtil.copyProperties(apply, ProjectApply.class); - saveApply.setBaseProjId(baseProjId); - if (Objects.isNull(oldApply)) { - //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update - if (StringUtils.isNotBlank(apply.getOp()) && BizConst.OP_UPDATE.equals(apply.getOp())) { - saveApply.setOp(BizConst.OP_UPDATE); - } else { - saveApply.setOp(BizConst.OP_INSERT); - } - saveApply.setTongTime(LocalDateTime.now()); - } else { - saveApply.setOp(BizConst.OP_INSERT); - saveApply.setTongID(oldApply.getTongID()); - saveApply.setTongTime(LocalDateTime.now()); - } - - saveApply.setBizTime(LocalDateTime.now()); - applyService.saveOrUpdate(saveApply); - } - - //保存基本信息 - private void saveBase(ProjectBaseInfo oldBaseInfo, ProjectBaseInfo saveBase, ProjectBaseInfo baseInfo) { - if (Objects.isNull(oldBaseInfo)) { - //如果当前 数据不存在 但是我们平台操作是修改 说明之前数据被推送过了那么 可以置为修改update - if (StringUtils.isNotBlank(baseInfo.getOp()) && BizConst.OP_UPDATE.equals(baseInfo.getOp())) { - saveBase.setOp(BizConst.OP_UPDATE); - } else { - saveBase.setOp(BizConst.OP_INSERT); - } - saveBase.setTongTime(LocalDateTime.now()); - } else { - saveBase.setOp(BizConst.OP_INSERT); - saveBase.setTongID(oldBaseInfo.getTongID()); - saveBase.setTongTime(LocalDateTime.now()); - } - saveBase.setBizTime(LocalDateTime.now()); - baseInfoService.saveOrUpdate(saveBase); - } - - /** - * 置为无效 - * - * @param dto - * @return - */ - public String notEffective(ProjectBaseInfoDTO dto) { - ProjectBaseInfo oldBaseInfo = baseInfoService.getOne(Wrappers.lambdaQuery(ProjectBaseInfo.class) - .eq(ProjectBaseInfo::getBaseProjId, dto.getBaseProjId()) - .last(BizConst.LIMIT_1)); - - ProjectBaseInfo saveBaseinfo = BeanUtil.copyProperties(dto, ProjectBaseInfo.class); - saveBaseinfo.setIsEffective(BizConst.NOT_EFFECTIVE); - if (Objects.isNull(oldBaseInfo)) { - saveBaseinfo.setTongTime(LocalDateTime.now()); - } - saveBaseinfo.setBizTime(LocalDateTime.now()); - saveBaseinfo.setOp(BizConst.OP_UPDATE); - baseInfoService.saveOrUpdate(saveBaseinfo); - - return BizConst.OP_SUCCESS; - } - - /** - * 删除表里的所有数据 - * - * @return - */ - public String deleteAll() { - baseInfoService.remove(Wrappers.lambdaQuery(ProjectBaseInfo.class)); - applyService.remove(Wrappers.lambdaQuery(ProjectApply.class)); - approveService.remove(Wrappers.lambdaQuery(ProjectApprove.class)); - cimplementService.remove(Wrappers.lambdaQuery(ProjectCimplement.class)); - mimplementService.remove(Wrappers.lambdaQuery(ProjectMimplement.class)); - procureService.remove(Wrappers.lambdaQuery(ProjectProcure.class)); - log.info("删除所有前置表数据成功"); - return BizConst.OP_SUCCESS; - } -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApplyMapper.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApplyMapper.java deleted file mode 100644 index 5cb3e9a..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApplyMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hz.pm.sync.scheduler.mapper; - -import com.hz.pm.sync.scheduler.model.entity.ProjectApply; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * 项目申报信息 Mapper 接口 - *

- * - * @author CMM - * @since 2023-08-22 - */ -public interface ProjectApplyMapper extends BaseMapper { - -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApplyMapper.xml b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApplyMapper.xml deleted file mode 100644 index 13197ca..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApplyMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApproveMapper.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApproveMapper.java deleted file mode 100644 index a0dbf57..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApproveMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hz.pm.sync.scheduler.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hz.pm.sync.scheduler.model.entity.ProjectApprove; - -/** - *

- * 项目立项评审信息 Mapper 接口 - *

- * - * @author CMM - * @since 2023-08-22 - */ -public interface ProjectApproveMapper extends BaseMapper { - -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApproveMapper.xml b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApproveMapper.xml deleted file mode 100644 index 0ba621e..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectApproveMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectBaseInfoMapper.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectBaseInfoMapper.java deleted file mode 100644 index d9f414b..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectBaseInfoMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hz.pm.sync.scheduler.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hz.pm.sync.scheduler.model.entity.ProjectBaseInfo; - -/** - *

- * 项目基本信息 Mapper 接口 - *

- * - * @author CMM - * @since 2023-08-22 - */ -public interface ProjectBaseInfoMapper extends BaseMapper { - -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectBaseInfoMapper.xml b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectBaseInfoMapper.xml deleted file mode 100644 index 9d77aff..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectBaseInfoMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectCimplementMapper.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectCimplementMapper.java deleted file mode 100644 index ebd3d1b..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectCimplementMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hz.pm.sync.scheduler.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hz.pm.sync.scheduler.model.entity.ProjectCimplement; - -/** - *

- * 建设项目实施信息 Mapper 接口 - *

- * - * @author CMM - * @since 2023-08-22 - */ -public interface ProjectCimplementMapper extends BaseMapper { - -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectCimplementMapper.xml b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectCimplementMapper.xml deleted file mode 100644 index 4015338..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectCimplementMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectMimplementMapper.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectMimplementMapper.java deleted file mode 100644 index bdeb37c..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectMimplementMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hz.pm.sync.scheduler.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hz.pm.sync.scheduler.model.entity.ProjectMimplement; - -/** - *

- * 运维项目实施信息 Mapper 接口 - *

- * - * @author CMM - * @since 2023-08-22 - */ -public interface ProjectMimplementMapper extends BaseMapper { - -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectMimplementMapper.xml b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectMimplementMapper.xml deleted file mode 100644 index 1e96c07..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectMimplementMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectProcureMapper.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectProcureMapper.java deleted file mode 100644 index d9e4792..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectProcureMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hz.pm.sync.scheduler.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hz.pm.sync.scheduler.model.entity.ProjectProcure; - -/** - *

- * 项目采购信息 Mapper 接口 - *

- * - * @author CMM - * @since 2023-08-22 - */ -public interface ProjectProcureMapper extends BaseMapper { - -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectProcureMapper.xml b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectProcureMapper.xml deleted file mode 100644 index b0ed754..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/mapper/ProjectProcureMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/dto/ForwardDTO.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/dto/ForwardDTO.java deleted file mode 100644 index fee47b6..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/dto/ForwardDTO.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.hz.pm.sync.scheduler.model.dto; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.util.Map; - -/** - * @Classname ForwardDTO - * @Description - * @Date 2023/7/13 18:03 - * @Author PoffyZhang - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class ForwardDTO implements Serializable { - private static final long serialVersionUID = 1L; - - private String url; - private String secret; - private String appKey; - private Map data; -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/dto/ProjectBaseInfoDTO.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/dto/ProjectBaseInfoDTO.java deleted file mode 100644 index be8eab9..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/dto/ProjectBaseInfoDTO.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.hz.pm.sync.scheduler.model.dto; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - *

- * 项目基本信息 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Data -@ApiModel(value = "SzlsDaBiz331100ProjectBaseinfo对象", description = "项目基本信息") -public class ProjectBaseInfoDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目代码") - @NotBlank(message = "项目编号不能为空") - private String baseProjId; - - @ApiModelProperty("项目名称") - private String baseProjName; - - @ApiModelProperty("所属区划") - private String baseAreaName; - - @ApiModelProperty("所属区划编码") - private String baseAreaCode; - - @ApiModelProperty("是否涉密") - private String baseProjIsConfidentiality; - - @ApiModelProperty("项目类型") - private String baseProjType; - - @ApiModelProperty("内容类别") - private String baseConstructionType; - - @ApiModelProperty("项目状态") - private String baseProjSetProg; - - @ApiModelProperty("信息是否有效") - private String isEffective; - - @ApiModelProperty("上级主管单位") - private String baseProvManDeprt; - - @ApiModelProperty("上级主管单位浙政钉ID") - private String baseProvManDeprtDing; - - @ApiModelProperty("本级主管单位") - private String baseManDeprt; - - @ApiModelProperty("本级主管单位浙政钉ID") - private String baseManDeprtDing; - - @ApiModelProperty("本级主管单位统一社会信用代码") - private String baseManDepartUsci; - - @ApiModelProperty("建设单位(申报单位)") - private String baseBuildDeprt; - - @ApiModelProperty("建设单位浙政钉ID") - private String baseBuildDeprtDing; - - @ApiModelProperty("建设单位统一社会信用代码") - private String baseBuildDepartUsci; - - @ApiModelProperty("项目负责人") - private String baseProjPrincipal; - - @ApiModelProperty("项目负责人手机号") - private String baseProjPrincipalCall; - - @ApiModelProperty("项目联系人") - private String baseProjContacts; - - @ApiModelProperty("项目联系人手机号") - private String baseProjContactsCall; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("出生产库时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("数据入库时间") - private LocalDateTime tongTime; -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/dto/ProjectSaveDTO.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/dto/ProjectSaveDTO.java deleted file mode 100644 index 9f1027b..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/dto/ProjectSaveDTO.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.hz.pm.sync.scheduler.model.dto; - -import com.hz.pm.sync.scheduler.model.entity.*; -import io.swagger.annotations.ApiModel; -import lombok.Data; - -import javax.validation.constraints.NotNull; -import java.util.List; - -/** - * @Classname ProjectSaveDTO - * @Description - * @Date 2023/8/25 9:45 - * @Author PoffyZhang - */ -@Data -@ApiModel(value = "SProjectSaveDTO", description = "项目保存") -public class ProjectSaveDTO { - - @NotNull(message = "项目基本信息不能为空") - private ProjectBaseInfo baseinfo; - - @NotNull(message = "项目申报信息不能为空") - private ProjectApply apply; - - @NotNull(message = "项目审批信息不能为空") - private ProjectApprove approve; - - private ProjectCimplement cimplement; - - private ProjectMimplement mimplement; - - private List procures; -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectApply.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectApply.java deleted file mode 100644 index 63ad0f2..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectApply.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.hz.pm.sync.scheduler.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * 项目申报信息 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Data -@TableName("szls_da_biz_331100_project_apply") -@ApiModel(value = "SzlsDaBiz331100ProjectApply对象", description = "项目申报信息") -public class ProjectApply implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目代码") - private String baseProjId; - - @ApiModelProperty("项目名称") - private String baseProjName; - - @ApiModelProperty("发改项目代码") - private String baseDevelopCode; - - @ApiModelProperty("财政项目代码") - private String setProjCodeFinan; - - @ApiModelProperty("历年项目名称") - private String baseHistorProjName; - - @ApiModelProperty("历年项目代码") - private String baseHistorProjId; - - @ApiModelProperty("关联IRS应用名称") - private String baseProjSys; - - @ApiModelProperty("关联IRS应用编码") - private String baseProjSysCode; - - @ApiModelProperty("一本账重大应用名称") - private String baseAccountAppName; - - @ApiModelProperty("“领域大脑”一本账名称") - private String baseBrainName; - - @ApiModelProperty("单位核心业务名称") - private String baseCoreBusiness; - - @ApiModelProperty("单位核心业务编码") - private String baseCoreBusinessCode; - - @ApiModelProperty("项目起始时间") - private String baseProjStartTime; - - @ApiModelProperty("项目终止时间") - private String baseProjEndTime; - - @ApiModelProperty("项目期限") - private String baseProjDuration; - - @ApiModelProperty("预算年度") - private String baseProjSetYear; - - @ApiModelProperty("预算来源") - private String baseProjAmountOri; - - @ApiModelProperty("预算来源说明") - private String baseBasisAmountOri; - - @ApiModelProperty("项目总投资") - private String baseProjTotalAmount; - - @ApiModelProperty("申报年度预算") - private String baseProjDeclAmount; - - @ApiModelProperty("建设层级") - private String baseProjConsClass; - - @ApiModelProperty("贯通层级") - private String baseLowestLevel; - - @ApiModelProperty("立项依据") - private String baseProjBasis; - - @ApiModelProperty("立项依据说明") - private String baseBasisEstablish; - - @ApiModelProperty("立项依据证明材料") - private String baseProjBasisFile; - - @ApiModelProperty("项目概述") - private String baseProjIntro; - - @ApiModelProperty("项目内容与预期成效") - private String beseExpectedResults; - - @ApiModelProperty("可行性研究报告") - private String baseResearchReportFile; - - @ApiModelProperty("项目申报书") - private String baseProjApplyFile; - - @ApiModelProperty("运维方案") - private String baseOperatMaintenFile; - - @ApiModelProperty("其他附件") - private String baseProjOtherFile; - - @ApiModelProperty("备注") - private String baseProjRemark; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("出生产库时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("数据入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("发送端自增列") - @TableId(value = "tongID", type = IdType.AUTO) - private Integer tongID; -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectApprove.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectApprove.java deleted file mode 100644 index 1a7e3db..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectApprove.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.hz.pm.sync.scheduler.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * 项目立项评审信息 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Data -@TableName("szls_da_biz_331100_project_approve") -@ApiModel(value = "SzlsDaBiz331100ProjectApprove对象", description = "项目立项评审信息") -public class ProjectApprove implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目代码") - private String baseProjId; - - @ApiModelProperty("项目名称") - private String baseProjName; - - @ApiModelProperty("发改项目代码") - private String baseDevelopCode; - - @ApiModelProperty("财政项目代码") - private String setProjCodeFinan; - - @ApiModelProperty("评审结果") - private String baseReviewResults; - - @ApiModelProperty("评审意见") - private String baseReviewOpinion; - - @ApiModelProperty("评审意见附件") - private String baseReviewCommentsFile; - - @ApiModelProperty("建议总投资") - private String baseExpertTotalMoney; - - @ApiModelProperty("建议年度预算") - private String baseExpertYearMoney; - - @ApiModelProperty("立项批复文件") - private String approvalFile; - - @ApiModelProperty("建议批复总投资") - private String baseInitialReviewTotalMoney; - - @ApiModelProperty("建议批复年度预算") - private String baseProjReplyAmount; - - @ApiModelProperty("等保定级") - private String equalProtectionLevel; - - @ApiModelProperty("初步设计方案") - private String preliminaryDesignScheme; - - @ApiModelProperty("初步设计方案批复函") - private String preliminaryDesignFile; - - @ApiModelProperty("年度预算下达金额") - private String releaseYearMoney; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("出生产库时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("数据入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("发送端自增列") - @TableId(value = "tongID", type = IdType.AUTO) - private Integer tongID; -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectBaseInfo.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectBaseInfo.java deleted file mode 100644 index 5a9df05..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectBaseInfo.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.hz.pm.sync.scheduler.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * 项目基本信息 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Data -@TableName("szls_da_biz_331100_project_baseinfo") -@ApiModel(value = "SzlsDaBiz331100ProjectBaseinfo对象", description = "项目基本信息") -public class ProjectBaseInfo implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("项目代码") - private String baseProjId; - - @ApiModelProperty("项目名称") - private String baseProjName; - - @ApiModelProperty("所属区划") - private String baseAreaName; - - @ApiModelProperty("所属区划编码") - private String baseAreaCode; - - @ApiModelProperty("是否涉密") - private String baseProjIsConfidentiality; - - @ApiModelProperty("项目类型") - private String baseProjType; - - @ApiModelProperty("内容类别") - private String baseConstructionType; - - @ApiModelProperty("项目状态") - private String baseProjSetProg; - - @ApiModelProperty("信息是否有效") - private String isEffective; - - @ApiModelProperty("上级主管单位") - private String baseProvManDeprt; - - @ApiModelProperty("上级主管单位浙政钉ID") - private String baseProvManDeprtDing; - - @ApiModelProperty("本级主管单位") - private String baseManDeprt; - - @ApiModelProperty("本级主管单位浙政钉ID") - private String baseManDeprtDing; - - @ApiModelProperty("本级主管单位统一社会信用代码") - private String baseManDepartUsci; - - @ApiModelProperty("建设单位(申报单位)") - private String baseBuildDeprt; - - @ApiModelProperty("建设单位浙政钉ID") - private String baseBuildDeprtDing; - - @ApiModelProperty("建设单位统一社会信用代码") - private String baseBuildDepartUsci; - - @ApiModelProperty("项目负责人") - private String baseProjPrincipal; - - @ApiModelProperty("项目负责人手机号") - private String baseProjPrincipalCall; - - @ApiModelProperty("项目联系人") - private String baseProjContacts; - - @ApiModelProperty("项目联系人手机号") - private String baseProjContactsCall; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("出生产库时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("数据入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("发送端自增列") - @TableId(value = "tongID", type = IdType.AUTO) - private Integer tongID; -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectCimplement.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectCimplement.java deleted file mode 100644 index b626085..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectCimplement.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.hz.pm.sync.scheduler.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * 建设项目实施信息 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Data -@TableName("szls_da_biz_331100_project_cimplement") -@ApiModel(value = "SzlsDaBiz331100ProjectCimplement对象", description = "建设项目实施信息") -public class ProjectCimplement implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("标段代码") - private String baseBidCode; - - @ApiModelProperty("标段名称") - private String baseBidName; - - @ApiModelProperty("项目代码") - private String baseProjId; - - @ApiModelProperty("项目名称") - private String baseProjName; - - @ApiModelProperty("发改项目代码") - private String baseDevelopCode; - - @ApiModelProperty("关联IRS应用编码") - private String baseProjSysCode; - - @ApiModelProperty("初验意见") - private String baseInitialOpinionFile; - - @ApiModelProperty("信息安全等级保护测评报告") - private String baseInforLevelFile; - - @ApiModelProperty("商业密码应用评估报告") - private String basePasswAssessFile; - - @ApiModelProperty("第三方验收测试报告") - private String baseThirdAcceptFile; - - @ApiModelProperty("建设核查表") - private String baseCheckFile; - - @ApiModelProperty("财务审计报告") - private String baseFinanlAuditFile; - - @ApiModelProperty("用户使用报告") - private String baseUserConsFile; - - @ApiModelProperty("监理总结报告") - private String baseEstaSummFile; - - @ApiModelProperty("IRS应用试运行报告") - private String baseIrsTestRunFile; - - @ApiModelProperty("项目总结报告") - private String baseSummReportFile; - - @ApiModelProperty("是否完成日志数据归集") - private String baseLogAggregation; - - @ApiModelProperty("实际成效指标") - private String baseBusinessMetrics; - - @ApiModelProperty("终验意见") - private String baseFinalExpertOpinionFile; - - @ApiModelProperty("项目延期申请表") - private String baseEngineerPostpoFile; - - @ApiModelProperty("变更申请单") - private String baseChangeFormFile; - - @ApiModelProperty("变更批复文件") - private String baseChanFile; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("出生产库时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("数据入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("发送端自增列") - @TableId(value = "tongID", type = IdType.AUTO) - private Integer tongID; -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectMimplement.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectMimplement.java deleted file mode 100644 index 607898f..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectMimplement.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.hz.pm.sync.scheduler.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * 运维项目实施信息 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Data -@TableName("szls_da_biz_331100_project_mimplement") -@ApiModel(value = "SzlsDaBiz331100ProjectMimplement对象", description = "运维项目实施信息") -public class ProjectMimplement implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("标段代码") - private String baseBidCode; - - @ApiModelProperty("标段名称") - private String baseBidName; - - @ApiModelProperty("项目代码") - private String baseProjId; - - @ApiModelProperty("项目名称") - private String baseProjName; - - @ApiModelProperty("发改项目代码") - private String baseDevelopCode; - - @ApiModelProperty("关联IRS应用编码") - private String baseProjSysCode; - - @ApiModelProperty("信息安全等级保护测评报告") - private String baseInforLevelFile; - - @ApiModelProperty("商业密码应用评估报告") - private String basePasswAssessFile; - - @ApiModelProperty("第三方验收测试报告") - private String baseThirdAcceptFile; - - @ApiModelProperty("用户使用报告") - private String baseUserConsFile; - - @ApiModelProperty("监理总结报告") - private String baseEstaSummFile; - - @ApiModelProperty("运维总结报告") - private String baseOperatMaintenSummFile; - - @ApiModelProperty("是否完成日志数据归集") - private String baseLogAggregation; - - @ApiModelProperty("实际成效指标") - private String baseBusinessMetrics; - - @ApiModelProperty("终验意见") - private String baseFinalExpertOpinionFile; - - @ApiModelProperty("项目延期申请表") - private String baseEngineerPostpoFile; - - @ApiModelProperty("变更报告") - private String baseEngineerAlterFile; - - @ApiModelProperty("变更批复文件") - private String baseChanFile; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("出生产库时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("数据入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("发送端自增列") - @TableId(value = "tongID", type = IdType.AUTO) - private Integer tongID; -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectProcure.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectProcure.java deleted file mode 100644 index 4af08b2..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/model/entity/ProjectProcure.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.hz.pm.sync.scheduler.model.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - *

- * 项目采购信息 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Data -@TableName("szls_da_biz_331100_project_procure") -@ApiModel(value = "SzlsDaBiz331100ProjectProcure对象", description = "项目采购信息") -public class ProjectProcure implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("标段代码") - private String baseBidCode; - - @ApiModelProperty("标段名称") - private String baseBidName; - - @ApiModelProperty("项目代码") - private String baseProjId; - - @ApiModelProperty("项目名称") - private String baseProjName; - - @ApiModelProperty("财政项目代码") - private String setProjCodeFinan; - - @ApiModelProperty("采购方式") - private String baseProjPurchaseWay; - - @ApiModelProperty("预算执行确认书编号") - private String basePurchaseCode; - - @ApiModelProperty("招标(采购)文件") - private String purchaseFile; - - @ApiModelProperty("采购代理机构") - private String basePurchasingAgencies; - - @ApiModelProperty("采购代理机构统一社会信用代码") - private String baseUnifiedCreditCode; - - @ApiModelProperty("中标(成交)时间") - private String baseWinningBidTime; - - @ApiModelProperty("中标(成交)金额") - private String baseProjPurchaseAmount; - - @ApiModelProperty("中标(成交)通知书") - private String biddingFile; - - @ApiModelProperty("中标(成交)供应商名称") - private String baseConsDeprt; - - @ApiModelProperty("中标(成交)供应商统一社会信用代码") - private String baseConsDeprtUsci; - - @ApiModelProperty("采购合同") - private String purchaseContract; - - @ApiModelProperty("项目款支付时间") - private String basePaymentTime; - - @ApiModelProperty("项目款支付金额") - private String paymentProgress; - - @ApiModelProperty("数据来源") - private String areaCode; - - @ApiModelProperty("出生产库时间") - private LocalDateTime bizTime; - - @ApiModelProperty("操作标记") - private String op; - - @ApiModelProperty("数据入库时间") - private LocalDateTime tongTime; - - @ApiModelProperty("发送端自增列") - @TableId(value = "tongID", type = IdType.AUTO) - private Integer tongID; -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectApplyService.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectApplyService.java deleted file mode 100644 index 5fead1c..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectApplyService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hz.pm.sync.scheduler.service; - -import com.hz.pm.sync.scheduler.model.entity.ProjectApply; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - *

- * 项目申报信息 服务类 - *

- * - * @author CMM - * @since 2023-08-22 - */ -public interface IProjectApplyService extends IService { - -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectApproveService.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectApproveService.java deleted file mode 100644 index 59ef487..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectApproveService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hz.pm.sync.scheduler.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.hz.pm.sync.scheduler.model.entity.ProjectApprove; - -/** - *

- * 项目立项评审信息 服务类 - *

- * - * @author CMM - * @since 2023-08-22 - */ -public interface IProjectApproveService extends IService { - -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectBaseInfoService.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectBaseInfoService.java deleted file mode 100644 index 7ae12ef..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectBaseInfoService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hz.pm.sync.scheduler.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.hz.pm.sync.scheduler.model.entity.ProjectBaseInfo; - -/** - *

- * 项目基本信息 服务类 - *

- * - * @author CMM - * @since 2023-08-22 - */ -public interface IProjectBaseInfoService extends IService { - -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectCimplementService.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectCimplementService.java deleted file mode 100644 index bdc0f5e..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectCimplementService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hz.pm.sync.scheduler.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.hz.pm.sync.scheduler.model.entity.ProjectCimplement; - -/** - *

- * 建设项目实施信息 服务类 - *

- * - * @author CMM - * @since 2023-08-22 - */ -public interface IProjectCimplementService extends IService { - -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectMimplementService.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectMimplementService.java deleted file mode 100644 index 75b3eb0..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectMimplementService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hz.pm.sync.scheduler.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.hz.pm.sync.scheduler.model.entity.ProjectMimplement; - -/** - *

- * 运维项目实施信息 服务类 - *

- * - * @author CMM - * @since 2023-08-22 - */ -public interface IProjectMimplementService extends IService { - -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectProcureService.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectProcureService.java deleted file mode 100644 index ef0fdcc..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/IProjectProcureService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hz.pm.sync.scheduler.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.hz.pm.sync.scheduler.model.entity.ProjectProcure; - -/** - *

- * 项目采购信息 服务类 - *

- * - * @author CMM - * @since 2023-08-22 - */ -public interface IProjectProcureService extends IService { - -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/IProjectCimplementServiceImpl.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/IProjectCimplementServiceImpl.java deleted file mode 100644 index 1ee3a38..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/IProjectCimplementServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.hz.pm.sync.scheduler.service.impl; - -import com.hz.pm.sync.scheduler.mapper.ProjectCimplementMapper; -import com.hz.pm.sync.scheduler.model.entity.ProjectCimplement; -import com.hz.pm.sync.scheduler.service.IProjectCimplementService; -import org.springframework.stereotype.Service; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; - -/** - *

- * 建设项目实施信息 服务实现类 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Service -public class IProjectCimplementServiceImpl extends ServiceImpl implements IProjectCimplementService { - -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectApplyServiceImpl.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectApplyServiceImpl.java deleted file mode 100644 index 2cf1a89..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectApplyServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.hz.pm.sync.scheduler.service.impl; - -import com.hz.pm.sync.scheduler.mapper.ProjectApplyMapper; -import com.hz.pm.sync.scheduler.model.entity.ProjectApply; -import com.hz.pm.sync.scheduler.service.IProjectApplyService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 项目申报信息 服务实现类 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Service -public class ProjectApplyServiceImpl extends ServiceImpl implements IProjectApplyService { - -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectApproveServiceImpl.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectApproveServiceImpl.java deleted file mode 100644 index 2ae0e27..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectApproveServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.hz.pm.sync.scheduler.service.impl; - -import com.hz.pm.sync.scheduler.mapper.ProjectApproveMapper; -import com.hz.pm.sync.scheduler.model.entity.ProjectApprove; -import com.hz.pm.sync.scheduler.service.IProjectApproveService; -import org.springframework.stereotype.Service; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; - -/** - *

- * 项目立项评审信息 服务实现类 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Service -public class ProjectApproveServiceImpl extends ServiceImpl implements IProjectApproveService { - -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectBaseInfoServiceImpl.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectBaseInfoServiceImpl.java deleted file mode 100644 index 3efac91..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectBaseInfoServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.hz.pm.sync.scheduler.service.impl; - -import com.hz.pm.sync.scheduler.mapper.ProjectBaseInfoMapper; -import com.hz.pm.sync.scheduler.model.entity.ProjectBaseInfo; -import com.hz.pm.sync.scheduler.service.IProjectBaseInfoService; -import org.springframework.stereotype.Service; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; - -/** - *

- * 项目基本信息 服务实现类 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Service -public class ProjectBaseInfoServiceImpl extends ServiceImpl implements IProjectBaseInfoService { - -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectMimplementServiceImpl.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectMimplementServiceImpl.java deleted file mode 100644 index 6e912fa..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectMimplementServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.hz.pm.sync.scheduler.service.impl; - -import com.hz.pm.sync.scheduler.mapper.ProjectMimplementMapper; -import com.hz.pm.sync.scheduler.model.entity.ProjectMimplement; -import org.springframework.stereotype.Service; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.hz.pm.sync.scheduler.service.IProjectMimplementService; - -/** - *

- * 运维项目实施信息 服务实现类 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Service -public class ProjectMimplementServiceImpl extends ServiceImpl implements IProjectMimplementService { - -} diff --git a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectProcureServiceImpl.java b/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectProcureServiceImpl.java deleted file mode 100644 index 9ad8713..0000000 --- a/hz-pm-sync/src/main/java/com/hz/pm/sync/scheduler/service/impl/ProjectProcureServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.hz.pm.sync.scheduler.service.impl; - -import com.hz.pm.sync.scheduler.model.entity.ProjectProcure; -import org.springframework.stereotype.Service; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.hz.pm.sync.scheduler.mapper.ProjectProcureMapper; -import com.hz.pm.sync.scheduler.service.IProjectProcureService; - -/** - *

- * 项目采购信息 服务实现类 - *

- * - * @author CMM - * @since 2023-08-22 - */ -@Service -public class ProjectProcureServiceImpl extends ServiceImpl implements IProjectProcureService { - -} diff --git a/hz-pm-sync/src/main/resources/application-dev.yml b/hz-pm-sync/src/main/resources/application-dev.yml deleted file mode 100644 index 7019ec0..0000000 --- a/hz-pm-sync/src/main/resources/application-dev.yml +++ /dev/null @@ -1,79 +0,0 @@ -server: - port: 38088 -spring: - application: - name: syn-data-task - jackson: - default-property-inclusion: non_null - time-zone: GMT+8 - date-format: yyyy-MM-dd HH:mm:ss - jpa: - properties: - hibernate: - default_schema: PUBLIC - hbm2ddl: - auto: update - show_sql: true - show-sql: true - hibernate: - ddl-auto: update - datasource: - type: com.zaxxer.hikari.HikariDataSource - driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://47.98.125.47:3306/szls_da_lsxmss_sjgx?serverTimezone=Asia/Shanghai&characterEncoding=utf8&allowPublicKeyRetrieval=true&useSSL=false - username: root - password: NingdaKeji123! - # 数据源 - hikari: - # 是客户端等待连接池连接的最大毫秒数 - connection-timeout: 30000 - # 是允许连接在连接池中空闲的最长时间 - minimum-idle: 5 - # 配置最大池大小 - maximum-pool-size: 20 - # 是允许连接在连接池中空闲的最长时间(以毫秒为单位) - idle-timeout: 60000 - # 池中连接关闭后的最长生命周期(以毫秒为单位) - max-lifetime: 600000 - # 配置从池返回的连接的默认自动提交行为。默认值为true。 - auto-commit: true - # 开启连接监测泄露 - leak-detection-threshold: 5000 - # 测试连接数据库 - connection-test-query: SELECT 1 -mybatis-plus: - configuration: - log-impl: org.apache.ibatis.logging.stdout.StdOutImpl - global-config: - db-config: - logic-delete-value: true - logic-not-delete-value: false -logging: - config: classpath:logback-spring.xml - #日志配置 - level: - root: info - file: - path: logs -# 日志文件配置 -log: - path: ./logs - info: - file-size: 50MB - max-size: 5 - total-size: 200MB - error: - file-size: 10MB - max-size: 5 - total-size: 50MB - -swagger: - enabled: true - -task: - host: iZbp13nwyvib53j4j1p2xoZ - switch: - is-open: true #开关 - - - diff --git a/hz-pm-sync/src/main/resources/application-pre.yml b/hz-pm-sync/src/main/resources/application-pre.yml deleted file mode 100644 index db1bc9a..0000000 --- a/hz-pm-sync/src/main/resources/application-pre.yml +++ /dev/null @@ -1,77 +0,0 @@ -server: - port: 38088 -spring: - application: - name: syn-data-task - jackson: - default-property-inclusion: non_null - time-zone: GMT+8 - date-format: yyyy-MM-dd HH:mm:ss - jpa: - properties: - hibernate: - default_schema: PUBLIC - hbm2ddl: - auto: update - show_sql: true - show-sql: true - hibernate: - ddl-auto: update - datasource: - type: com.zaxxer.hikari.HikariDataSource - driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://10.53.129.228:63306/szls_da_lsxmss_sjgx?serverTimezone=Asia/Shanghai&characterEncoding=utf8&allowPublicKeyRetrieval=true&useSSL=false - username: szls_da_lsxmss - password: 1Lzo6XqF - # 数据源 - hikari: - # 是客户端等待连接池连接的最大毫秒数 - connection-timeout: 30000 - # 是允许连接在连接池中空闲的最长时间 - minimum-idle: 10 - # 配置最大池大小 - maximum-pool-size: 20 - # 是允许连接在连接池中空闲的最长时间(以毫秒为单位) - idle-timeout: 60000 - # 池中连接关闭后的最长生命周期(以毫秒为单位) - max-lifetime: 600000 - # 配置从池返回的连接的默认自动提交行为。默认值为true。 - auto-commit: true - # 开启连接监测泄露 - leak-detection-threshold: 5000 - # 测试连接数据库 - connection-test-query: SELECT 1 -mybatis-plus: - configuration: - log-impl: org.apache.ibatis.logging.stdout.StdOutImpl - global-config: - db-config: - logic-delete-value: true - logic-not-delete-value: false -logging: - config: classpath:logback-spring.xml - #日志配置 - level: - root: info - file: - path: logs -# 日志文件配置 -log: - path: ./logs - info: - file-size: 50MB - max-size: 5 - total-size: 200MB - error: - file-size: 10MB - max-size: 5 - total-size: 50MB - -swagger: - enabled: true - -task: - host: iZ6mx01asxnsmennpzoxooZ - switch: - is-open: true #开关 - diff --git a/hz-pm-sync/src/main/resources/application.yml b/hz-pm-sync/src/main/resources/application.yml deleted file mode 100644 index 3d7808a..0000000 --- a/hz-pm-sync/src/main/resources/application.yml +++ /dev/null @@ -1,3 +0,0 @@ -spring: - profiles: - active: dev diff --git a/hz-pm-sync/src/main/resources/logback-spring.xml b/hz-pm-sync/src/main/resources/logback-spring.xml deleted file mode 100644 index 75f5472..0000000 --- a/hz-pm-sync/src/main/resources/logback-spring.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - ${logPath}/info.log - - ${logPath}/info-%d{yyyyMMdd}-%i.log - - ${infoFileSize} - - ${infoMaxSize} - ${infoTotalSize} - - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%msg%n - - - UTF-8 - - - - - - ERROR - - ${logPath}/error.log - - ${logPath}/error-%d{yyyyMMdd}-%i.log - - ${errorFileSize} - - ${errorMaxSize} - ${errorTotalSize} - - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%msg%n - - - UTF-8 - - - - - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%msg%n - - UTF-8 - - - DEBUG - - - - - - - - - diff --git a/pom.xml b/pom.xml index 3bcfdbc..7dc74bf 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ pom 1.0.0 hz-project-management - 丽水项管二期项目 + 杭州市委办项管 true @@ -16,7 +16,6 @@ 2.6.11 1.8 1.8 - 3.7.0 3.5.1 3.0.0 3.0.3 @@ -157,7 +156,7 @@ cn.afterturn easypoi-base - 4.2.0 + 4.4.0
@@ -195,6 +194,5 @@ hz-pm-api - hz-pm-sync
From 77a5b78a9f9c649c57dc67556b62ba2323f8c16d Mon Sep 17 00:00:00 2001 From: WendyYang Date: Fri, 19 Jan 2024 22:46:15 +0800 Subject: [PATCH 32/44] =?UTF-8?q?=E5=8D=95=E4=BD=8D=E5=90=8D=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ConstructionPlanController.java | 6 ++-- .../manage/ConstructionPlanManage.java | 37 +++++++++------------- .../entity/ProjectConstructionSuggestions.java | 6 ++-- .../service/IConstrctionSuggestionsService.java | 16 ---------- .../service/IConstructionSuggestionsService.java | 16 ++++++++++ .../impl/ConstructionSuggestionsServiceImpl.java | 4 +-- .../hz/pm/api/todocenter/manage/HandlerManage.java | 14 +++----- 7 files changed, 43 insertions(+), 56 deletions(-) delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IConstrctionSuggestionsService.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IConstructionSuggestionsService.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ConstructionPlanController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ConstructionPlanController.java index c5206e0..5cea7fa 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ConstructionPlanController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/ConstructionPlanController.java @@ -1,13 +1,13 @@ package com.hz.pm.api.projectdeclared.controller; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; import com.hz.pm.api.common.util.ExcelDownUtil; import com.hz.pm.api.projectdeclared.manage.ConstructionPlanManage; import com.hz.pm.api.projectdeclared.model.dto.ContructionSuggestionsDTO; import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; import com.hz.pm.api.projectdeclared.model.req.ConstrctionPlanListReq; import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -27,7 +27,7 @@ import javax.servlet.http.HttpServletResponse; @Validated @RestController @RequestMapping("/api/v1/construction") -@Api(value = "ConstructionPlan", tags = "申报管理-建设方案申报") +@Api(tags = "申报管理-建设方案申报") @RequiredArgsConstructor public class ConstructionPlanController { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java index 6308418..4532afa 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionPlanManage.java @@ -7,7 +7,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.helper.RegionCacheHelper; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.model.constant.CommonConst; @@ -19,7 +18,7 @@ import com.hz.pm.api.projectdeclared.model.dto.ContructionSuggestionsDTO; import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; import com.hz.pm.api.projectdeclared.model.entity.ProjectConstructionSuggestions; import com.hz.pm.api.projectdeclared.model.req.ConstrctionPlanListReq; -import com.hz.pm.api.projectdeclared.service.IConstrctionSuggestionsService; +import com.hz.pm.api.projectdeclared.service.IConstructionSuggestionsService; 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; @@ -35,7 +34,7 @@ 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.todocenter.constant.WorkNoticeConstant; -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; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.function.VUtils; @@ -50,7 +49,6 @@ import com.wflow.workflow.service.ProcessModelService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.flowable.engine.HistoryService; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -70,8 +68,8 @@ import java.util.stream.Collectors; * @Date 2023/2/1 14:48 * @Author PoffyZhang */ -@Component @Slf4j +@Component @RequiredArgsConstructor public class ConstructionPlanManage { @@ -85,10 +83,7 @@ public class ConstructionPlanManage { private final DefaultDeclaredProjectManage declaredProjectManage; private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; private final NoticeManage noticeManage; - private final RegionCacheHelper regionCacheHelper; - private final HistoryService historyService; - - private final IConstrctionSuggestionsService constrctionSuggestionsService; + private final IConstructionSuggestionsService constructionSuggestionsService; /** * 建设方案 @@ -98,7 +93,7 @@ public class ConstructionPlanManage { */ @Transactional(rollbackFor = Exception.class) public String startTheProcess(DefaultDeclaredDTO dto) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); Long userId = user.getUserId(); ProjectDTO projectInfo = dto.getProjectInfo(); Long projectInfoId = projectInfo.getId(); @@ -107,8 +102,8 @@ public class ConstructionPlanManage { VUtils.isTrue(StringUtils.isBlank(projectInfo.getConstructionPlanFile())).throwMessage("提交失败,请提交建设方案!"); // 判断 项目当前状态 是不是 方案待申报 - VUtils.isTrue(!ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode().equals(oldProject.getStatus()) || - !ProjectStatusEnum.NOT_APPROVED.getCode().equals(oldProject.getStage())) + VUtils.isTrue(!ProjectStatusEnum.PLAN_TO_BE_DECLARED.eq(oldProject.getStatus()) || + !ProjectStatusEnum.NOT_APPROVED.eq(oldProject.getStage())) .throwMessage("提交失败 该项目不是 方案待申报状态或者未立项阶段"); projectInfo.setBuildOrgCode(user.getMhUnitIdStr()); @@ -139,7 +134,7 @@ public class ConstructionPlanManage { .last(BizConst.LIMIT_1)); if (Objects.isNull(model)) { - throw new BusinessException("找不到建设申报流程配置"); + throw BizException.wrap("找不到建设申报流程配置"); } //如果被禁用了的话 直接跳过 进入到下一个状态 @@ -261,9 +256,8 @@ public class ConstructionPlanManage { //项目阶段 状态 已定 方案待申报 req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); req.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); - //放入用户的单位 + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + // 放入用户的单位 req.setBuildOrgCode(user.getMhUnitIdStr()); return projectLibManage.projectLibList(req); } @@ -275,8 +269,7 @@ public class ConstructionPlanManage { //项目阶段 状态 已定 方案待申报 req.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); req.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); //放入用户的单位 req.setBuildOrgCode(user.getMhUnitIdStr()); req.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); @@ -307,14 +300,14 @@ public class ConstructionPlanManage { .sheet(fileName) .doWrite(collect); } catch (IOException e) { - throw new RuntimeException(e); + throw new BizException(e); } } /** * 专家建设方案建议 暂存 等流程成功后 保存到项目 * - * @param dto + * @param dto \ */ public void constructionSuggestions(ContructionSuggestionsDTO dto) { String instanceId = dto.getInstanceId(); @@ -336,7 +329,7 @@ public class ConstructionPlanManage { } ProjectConstructionSuggestions saveEntity = BeanUtil.copyProperties(dto, ProjectConstructionSuggestions.class); - ProjectConstructionSuggestions pcs = constrctionSuggestionsService.getOne(Wrappers.lambdaQuery(ProjectConstructionSuggestions.class) + ProjectConstructionSuggestions pcs = constructionSuggestionsService.getOne(Wrappers.lambdaQuery(ProjectConstructionSuggestions.class) .eq(ProjectConstructionSuggestions::getProjectCode, dto.getProjectCode()) .eq(ProjectConstructionSuggestions::getInstanceId, instanceId) .last(BizConst.LIMIT_1)); @@ -344,7 +337,7 @@ public class ConstructionPlanManage { saveEntity.setId(pcs.getId()); } saveEntity.setInstanceId(instanceId); - constrctionSuggestionsService.saveOrUpdate(saveEntity); + constructionSuggestionsService.saveOrUpdate(saveEntity); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/ProjectConstructionSuggestions.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/ProjectConstructionSuggestions.java index b4aeea5..f6cfc14 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/ProjectConstructionSuggestions.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/ProjectConstructionSuggestions.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; + import java.math.BigDecimal; /** @@ -16,11 +17,9 @@ import java.math.BigDecimal; */ @Data @TableName("nd_project_constrctiuon_suggestions") -@ApiModel(value = "专家建设建议", description = "") +@ApiModel(value = "专家建设建议") public class ProjectConstructionSuggestions { - private static final long serialVersionUID = 1L; - @ApiModelProperty("主键") @TableId(type = IdType.AUTO) private Long id; @@ -39,4 +38,5 @@ public class ProjectConstructionSuggestions { @ApiModelProperty("建议评审意见附件") private String proposeAttachFiles; + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IConstrctionSuggestionsService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IConstrctionSuggestionsService.java deleted file mode 100644 index 1f0787e..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IConstrctionSuggestionsService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hz.pm.api.projectdeclared.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.hz.pm.api.projectdeclared.model.entity.ProjectConstructionSuggestions; - -/** - *

- * 服务类 - *

- * - * @author zpf - * @since 2023-05-29 - */ -public interface IConstrctionSuggestionsService extends IService { - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IConstructionSuggestionsService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IConstructionSuggestionsService.java new file mode 100644 index 0000000..48315b0 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IConstructionSuggestionsService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectdeclared.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hz.pm.api.projectdeclared.model.entity.ProjectConstructionSuggestions; + +/** + *

+ * 服务类 + *

+ * + * @author zpf + * @since 2023-05-29 + */ +public interface IConstructionSuggestionsService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/ConstructionSuggestionsServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/ConstructionSuggestionsServiceImpl.java index be94bd2..f0e384b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/ConstructionSuggestionsServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/impl/ConstructionSuggestionsServiceImpl.java @@ -3,7 +3,7 @@ package com.hz.pm.api.projectdeclared.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hz.pm.api.projectdeclared.mapper.ConstructionSuggestionsMapper; import com.hz.pm.api.projectdeclared.model.entity.ProjectConstructionSuggestions; -import com.hz.pm.api.projectdeclared.service.IConstrctionSuggestionsService; +import com.hz.pm.api.projectdeclared.service.IConstructionSuggestionsService; import org.springframework.stereotype.Service; /** @@ -16,6 +16,6 @@ import org.springframework.stereotype.Service; */ @Service public class ConstructionSuggestionsServiceImpl extends ServiceImpl - implements IConstrctionSuggestionsService { + implements IConstructionSuggestionsService { } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java index f4cf8e3..fb6c9c5 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/HandlerManage.java @@ -16,7 +16,7 @@ import com.hz.pm.api.filemanage.service.INdProjectApplyBorrowService; import com.hz.pm.api.projectdeclared.manage.DeclaredProjectManage; import com.hz.pm.api.projectdeclared.model.dto.ProjectDraftSaveDTO; import com.hz.pm.api.projectdeclared.model.entity.ProjectConstructionSuggestions; -import com.hz.pm.api.projectdeclared.service.IConstrctionSuggestionsService; +import com.hz.pm.api.projectdeclared.service.IConstructionSuggestionsService; import com.hz.pm.api.projectlib.model.dto.ProjectApplicationDTO; import com.hz.pm.api.projectlib.model.dto.ProjectDTO; import com.hz.pm.api.projectlib.model.entity.Project; @@ -29,7 +29,6 @@ import com.hz.pm.api.projectlib.service.INdProjectDelayApplyService; import com.hz.pm.api.projectlib.service.IProjectApplicationService; import com.hz.pm.api.projectlib.service.IProjectInstService; import com.hz.pm.api.projectlib.service.IProjectService; -import com.hz.pm.api.provincial.service.IJoinReviewProvincialBureauService; import com.hz.pm.api.staging.enums.MsgTypeEnum; import com.hz.pm.api.staging.service.IProjectStagingService; import com.hz.pm.api.sys.manage.NoticeManage; @@ -37,7 +36,6 @@ import com.hz.pm.api.todocenter.constant.TodoCenterConst; import com.hz.pm.api.user.util.LoginUserUtil; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.util.NdDateUtils; -import com.ningdatech.file.service.FileService; import com.wflow.contants.HisProInsEndActId; import com.wflow.workflow.bean.process.ProgressNode; import com.wflow.workflow.bean.process.enums.NodeTypeEnum; @@ -70,13 +68,12 @@ import static com.hz.pm.api.todocenter.constant.WorkNoticeConstant.*; * @Date 2023/4/2 14:25 * @Author PoffyZhang */ +@Slf4j @Component @RequiredArgsConstructor -@Slf4j public class HandlerManage { private final RuntimeService runtimeService; - private final TaskService taskService; private final HistoryService historyService; private final IProjectService projectService; @@ -87,12 +84,9 @@ public class HandlerManage { private final IProjectInstService projectInstService; private final NoticeManage noticeManage; private final DeclaredProjectManage declaredProjectManage; - private final FileService fileService; - private final IJoinReviewProvincialBureauService joinReviewProvincialBureauService; private final INdProjectDelayApplyService projectDelayApplyService; private final INdProjectApplyBorrowService projectApplyBorrowService; - - private final IConstrctionSuggestionsService constrctionSuggestionsService; + private final IConstructionSuggestionsService constructionSuggestionsService; @Value("${spring.profiles.active}") private String active; @@ -214,7 +208,7 @@ public class HandlerManage { .eq(ProjectConstructionSuggestions::getProjectCode, project.getProjectCode()) .eq(ProjectConstructionSuggestions::getInstanceId, instanceId) .last(BizConst.LIMIT_1); - ProjectConstructionSuggestions pcs = constrctionSuggestionsService.getOne(query); + ProjectConstructionSuggestions pcs = constructionSuggestionsService.getOne(query); if (Objects.nonNull(pcs)) { project.setProposeTotalInvest(pcs.getProposeTotalInvest()); project.setProposeAnnualBudget(pcs.getProposeAnnualBudget()); From 851f4ff86dca7d4b0b7f5c0b58b5a737982dbf85 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Mon, 22 Jan 2024 16:50:12 +0800 Subject: [PATCH 33/44] =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/ProjectCostStatisticsManage.java | 71 ++++++++++++---------- .../controller/DeclaredProjectController.java | 2 - .../PrequalificationDeclaredProjectManage.java | 5 +- .../hz/pm/api/sys/service/IUserRoleService.java | 6 ++ .../com/hz/pm/api/user/manage/UserInfoManage.java | 65 ++++---------------- .../pm/api/user/model/po/ReqUserDetailEditPO.java | 3 - hz-pm-api/src/main/resources/application-prod.yml | 1 + 7 files changed, 60 insertions(+), 93 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/ProjectCostStatisticsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/ProjectCostStatisticsManage.java index a2d54ca..1513cb7 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/ProjectCostStatisticsManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/ProjectCostStatisticsManage.java @@ -1,6 +1,5 @@ package com.hz.pm.api.dashboard.manage; -import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; import com.hz.pm.api.common.model.entity.DataDTO; @@ -10,15 +9,15 @@ import com.hz.pm.api.meeting.entity.domain.Meeting; import com.hz.pm.api.meeting.entity.domain.MeetingExpert; import com.hz.pm.api.meeting.service.IMeetingExpertService; import com.hz.pm.api.meeting.service.IMeetingService; +import com.ningdatech.basic.util.CollUtils; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import java.math.BigDecimal; import java.math.RoundingMode; -import java.time.LocalDateTime; -import java.util.List; -import java.util.Objects; +import java.time.LocalDate; +import java.util.*; import java.util.stream.Collectors; /** @@ -36,22 +35,31 @@ public class ProjectCostStatisticsManage { private final IMeetingService meetingService; - List thisTwoYears = Lists.newArrayList(LocalDateTime.now().getYear() - 1 - ,LocalDateTime.now().getYear()); + //评审费 每人500 (0.05万) + private static final BigDecimal REVIEW_AMOUNT_EXPERT = DashboardConstant.Expert.REVIEW_AOUMT_EXPERT; + + private List getRecentTwoYears() { + int currYear = LocalDate.now().getYear(); + return Arrays.asList(currYear - 1, currYear); + } public CostStatisticsVO statistics() { CostStatisticsVO res = new CostStatisticsVO(); - List meetings = meetingService.list(Wrappers.lambdaQuery(Meeting.class)); - List meetingIds = meetings.stream().map(Meeting::getId) - .collect(Collectors.toList()); + List meetings = meetingService.list(Wrappers.lambdaQuery(Meeting.class) + .select(Meeting::getStartTime, Meeting::getId)); + //算出所有的 同意的专家 - List meetingExperts = meetingExpertService.listAgreedExperts(meetingIds); + List meetingExperts; - //评审费 每人500 (0.05万) - BigDecimal reviewAoumtExpert = DashboardConstant.Expert.REVIEW_AOUMT_EXPERT; + if (meetings.isEmpty()) { + meetingExperts = Collections.emptyList(); + } else { + List meetingIds = CollUtils.fieldList(meetings, Meeting::getId); + meetingExperts = meetingExpertService.listAgreedExperts(meetingIds); + } //计算累积 - res.setReviewAmount(reviewAoumtExpert.multiply(BigDecimal.valueOf(meetingExperts.size()))); + res.setReviewAmount(REVIEW_AMOUNT_EXPERT.multiply(BigDecimal.valueOf(meetingExperts.size()))); res.setPricingAmount(BigDecimal.ZERO); //近两年 @@ -64,30 +72,27 @@ public class ProjectCostStatisticsManage { DataDTO pricingAvg = new DataDTO(); pricingAvg.setName("核价费"); BigDecimal reviewTwoYearTotal = BigDecimal.ZERO; - for(Integer thisYear : thisTwoYears){ + + Map> meetingMapYear = CollUtils.group(meetings, w -> w.getStartTime().getYear()); + Map> expertMapMeetingId = CollUtils.group(meetingExperts, MeetingExpert::getMeetingId); + + for (Integer thisYear : getRecentTwoYears()) { //查出 年份的 会议数据 - List yearMeetings = meetings.stream().filter(m -> { - if(Objects.nonNull(m.getStartTime()) && - ( thisYear.equals(m.getStartTime().getYear()))){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()); - List yearMeetingIds = yearMeetings.stream().map(Meeting::getId) + List yearMeetings = meetingMapYear.getOrDefault(thisYear, Collections.emptyList()); + List yearMeetingExperts = yearMeetings.stream() + .map(w -> expertMapMeetingId.get(w.getId())) + .filter(Objects::nonNull) + .flatMap(Collection::stream) .collect(Collectors.toList()); //算出所有的 同意的专家 - List yearMeetingExperts = Lists.newArrayList(); - if(CollUtil.isNotEmpty(yearMeetingIds)){ - yearMeetingExperts = meetingExpertService.listAgreedExperts(yearMeetingIds); - } - twoYearsReviews.add(DataDTO.of(thisYear.toString(),reviewAoumtExpert.multiply(BigDecimal - .valueOf(yearMeetingExperts.size())))); - twoYearsPricing.add(DataDTO.of(thisYear.toString(),BigDecimal.ZERO)); - - reviewTwoYearTotal = reviewTwoYearTotal.add(reviewAoumtExpert.multiply(BigDecimal - .valueOf(yearMeetingExperts.size()))); + BigDecimal yearExpertCnt = BigDecimal.valueOf(yearMeetingExperts.size()); + BigDecimal yearExpertAmount = REVIEW_AMOUNT_EXPERT.multiply(yearExpertCnt); + twoYearsReviews.add(DataDTO.of(thisYear.toString(), yearExpertAmount)); + twoYearsPricing.add(DataDTO.of(thisYear.toString(), BigDecimal.ZERO)); + + reviewTwoYearTotal = reviewTwoYearTotal.add(yearExpertAmount); } - reviewAvg.setAmount(reviewTwoYearTotal.divide(BigDecimal.valueOf(2),BigDecimal.ROUND_CEILING, + reviewAvg.setAmount(reviewTwoYearTotal.divide(BigDecimal.valueOf(2), BigDecimal.ROUND_CEILING, RoundingMode.HALF_UP)); twoYearsAvg.add(reviewAvg); twoYearsAvg.add(pricingAvg); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java index 5e10f1c..d2c4527 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/controller/DeclaredProjectController.java @@ -40,8 +40,6 @@ public class DeclaredProjectController { private final ProjectAdjustmentManage projectAdjustmentManage; - private final GovProjectCollectionManage collectionManage; - @ApiOperation(value = "申报项目已申报列表", notes = "申报项目已申报列表") @GetMapping("/list") public PageVo list(@ModelAttribute ProjectListReq req) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java index 79364db..3abf0c4 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PrequalificationDeclaredProjectManage.java @@ -31,6 +31,7 @@ import com.hz.pm.api.sys.manage.NoticeManage; import com.hz.pm.api.todocenter.constant.TodoCenterConst; import com.hz.pm.api.todocenter.constant.WorkNoticeConstant; 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; import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; @@ -97,7 +98,7 @@ public class PrequalificationDeclaredProjectManage { */ @Transactional(rollbackFor = Exception.class) public String startTheProcess(DefaultDeclaredDTO dto) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); ProjectDTO projectDto = dto.getProjectInfo(); VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); Project projectInfo = projectService.getNewProject(projectDto.getId()); @@ -120,7 +121,7 @@ public class PrequalificationDeclaredProjectManage { projectInfo.setHigherLineSuperOrgReviewComments(projectDto.getHigherLineSuperOrgReviewComments()); } stateMachineUtil.pass(projectInfo); - String instanceId = null; + String instanceId; //如果是省级部门 需要联审的(申报金额大于1000万 并且是市级项目) if (ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS .getCode().equals(projectInfo.getStatus())) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IUserRoleService.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IUserRoleService.java index fe2b362..99964cd 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IUserRoleService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/service/IUserRoleService.java @@ -52,4 +52,10 @@ public interface IUserRoleService extends IService { return list(eq); } + default void removeByUserId(Long userId){ + LambdaQueryWrapper query = Wrappers.lambdaQuery(UserRole.class) + .eq(UserRole::getUserId, userId); + remove(query); + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java index fa7f8a6..2bbac27 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/UserInfoManage.java @@ -103,7 +103,7 @@ public class UserInfoManage { } List roleIds = CollUtils.fieldList(userRoles, UserRoleVO::getId); LambdaQueryWrapper urQuery = Wrappers.lambdaQuery(UserRole.class) - .select(UserRole::getUserId).in(UserRole::getRoleId,roleIds); + .select(UserRole::getUserId).in(UserRole::getRoleId, roleIds); return userRoleService.listUserIdByRoleIds(roleIds); } @@ -203,40 +203,29 @@ public class UserInfoManage { } @Transactional(rollbackFor = Exception.class) - public void userInfoDetailEdit(ReqUserDetailEditPO reqUserDetailEditPO) { - Long userId = reqUserDetailEditPO.getUserId(); - if (Objects.isNull(userId)) { - String employeeCode = reqUserDetailEditPO.getEmployeeCode(); - if (StringUtils.isBlank(employeeCode)) { - throw new IllegalArgumentException("employeeCode can't be null"); - } - userId = generateUserId(employeeCode); - } + public void userInfoDetailEdit(ReqUserDetailEditPO req) { + Long userId = req.getUserId(); UserInfo userInfo = userInfoService.getById(userId); - String oldUserStatus = userInfo.getAvailable(); - // 绑定用户手机号 - bandUserMobile(userInfo, reqUserDetailEditPO); - - userInfo.setAvailable(reqUserDetailEditPO.getStatus()); + String oldStatus = userInfo.getAvailable(); + userInfo.setAvailable(req.getStatus()); userInfo.setUpdateOn(LocalDateTime.now()); userInfo.setUpdateBy(LoginUserUtil.getUserId()); userInfoService.updateById(userInfo); - List userRoleInfoList = reqUserDetailEditPO.getUserRoleInfoList(); - userRoleService.remove(Wrappers.lambdaQuery(UserRole.class).eq(UserRole::getUserId, userId)); - if (CollUtil.isNotEmpty(userRoleInfoList)) { - Long finalUserId = userId; - List userRoleList = userRoleInfoList.stream().map(r -> { + List userRoles = req.getUserRoleInfoList(); + userRoleService.removeByUserId(userId); + if (CollUtil.isNotEmpty(userRoles)) { + List userRoleList = userRoles.stream().map(r -> { UserRole saveRecord = new UserRole(); saveRecord.setRoleId(r.getId()); - saveRecord.setUserId(finalUserId); + saveRecord.setUserId(userId); return saveRecord; }).collect(Collectors.toList()); userRoleService.saveBatch(userRoleList); } // 刷新用户权限 仅原状态为正常才需要刷新session - if ("ENABLE".equals(oldUserStatus)) { - if (oldUserStatus.equals(userInfo.getAvailable())) { + if ("ENABLE".equals(oldStatus)) { + if (oldStatus.equals(userInfo.getAvailable())) { userAuthManage.refreshSession(userId); } else { userAuthManage.kickOff(userId); @@ -244,36 +233,6 @@ public class UserInfoManage { } } - /** - * 绑定用户手机号 - * - * @param userInfo - * @param reqUserDetailEditPO - */ - @Transactional(rollbackFor = Exception.class) - public void bandUserMobile(UserInfo userInfo, ReqUserDetailEditPO reqUserDetailEditPO) { - String employeeCode = reqUserDetailEditPO.getEmployeeCode(); - Long userId = userInfo.getId(); - // 校验手机号是否重复 - UserInfo repeatMobileUserInfo = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) - .eq(UserInfo::getMobile, reqUserDetailEditPO.getPhoneNo()).ne(UserInfo::getId, userId)); - if (Objects.nonNull(repeatMobileUserInfo)) { - throw new BizException("该手机号码已被绑定,请问重复绑定"); - } - - String phoneNo = reqUserDetailEditPO.getPhoneNo(); - userInfo.setMobile(phoneNo); - // 更新浙政钉相关数据 - if (StringUtils.isNotBlank(phoneNo)) { - dingEmployeeInfoService - .update(Wrappers.lambdaUpdate(DingEmployeeInfo.class) - .eq(DingEmployeeInfo::getMainJob, "true") - .eq(DingEmployeeInfo::getEmployeeCode, employeeCode) - .set(DingEmployeeInfo::getBindUserMobile, phoneNo)); - userInfoService.updateById(userInfo); - } - } - @Transactional(rollbackFor = Exception.class) public Long generateUserId(String employeeCode) { UserInfo userInfo = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqUserDetailEditPO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqUserDetailEditPO.java index d6ec9c0..e694514 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqUserDetailEditPO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/po/ReqUserDetailEditPO.java @@ -21,9 +21,6 @@ public class ReqUserDetailEditPO { @ApiModelProperty("userId") private Long userId; - @ApiModelProperty("浙政钉 用户编码") - private String employeeCode; - @NotBlank(message = "用户手机号不能为空") @ApiModelProperty("手机号") private String phoneNo; diff --git a/hz-pm-api/src/main/resources/application-prod.yml b/hz-pm-api/src/main/resources/application-prod.yml index d654c9b..30512f8 100644 --- a/hz-pm-api/src/main/resources/application-prod.yml +++ b/hz-pm-api/src/main/resources/application-prod.yml @@ -136,6 +136,7 @@ flowable: enabled: false app: enabled: false + database-schema: HZ_PROJECT_MANAGEMENT wflow: file: From 0c68eeac76944ae7ef286e71bcb67cae121a9495 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Tue, 23 Jan 2024 16:52:43 +0800 Subject: [PATCH 34/44] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E4=BF=A1=E4=BA=A7?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hz/pm/api/external/MhApiClient.java | 8 ++ .../hz/pm/api/external/model/dto/MhProjectDTO.java | 46 +++++++++ .../model/dto/MhProjectSchemeTargetDTO.java | 91 ++++++++++++++++++ .../controller/GovProjectCollectionController.java | 12 +-- .../api/gov/manage/GovProjectCollectionManage.java | 97 +++++++++---------- .../hz/pm/api/gov/utils/ProjectConvertUtil.java | 103 +++++++++++---------- .../controller/ProjectLibController.java | 24 ++--- 7 files changed, 264 insertions(+), 117 deletions(-) create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhProjectDTO.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhProjectSchemeTargetDTO.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/MhApiClient.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/MhApiClient.java index ffd1c3d..9c0c548 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/external/MhApiClient.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/MhApiClient.java @@ -31,6 +31,7 @@ public class MhApiClient { private static final String USER_URL = "/sync/user"; private static final String EXPERT_URL = "/sync/expert"; private static final String COMPANY_URL = "/sync/company"; + private static final String PROJECT_URL = "/project_info/getProjectInfoList"; public MhRetDTO> queryUnits() { @@ -69,4 +70,11 @@ public class MhApiClient { }, false); } + public MhRetDTO> listProjects() { + String requestUrl = mhApiHost + PROJECT_URL; + String retBody = HttpUtil.get(requestUrl); + return JSONUtil.toBean(retBody, new TypeReference>>() { + }, false); + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhProjectDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhProjectDTO.java new file mode 100644 index 0000000..5ffa3da --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhProjectDTO.java @@ -0,0 +1,46 @@ +package com.hz.pm.api.external.model.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * ResponseData + *

+ * + * @author WendyYang + * @since 14:24 2024/1/23 + */ +@Data +public class MhProjectDTO { + + @ApiModelProperty("项目合规性检查附件") + private String fileId; + + @ApiModelProperty("项目复核附件") + private String fileIdThree; + + @ApiModelProperty("项目评审附件") + private String fileIdTwo; + + @ApiModelProperty("项目评审预算金额") + private BigDecimal money; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("关键指标对象") + private MhProjectSchemeTargetDTO schemeTargetData; + + @ApiModelProperty("项目总金额") + private BigDecimal totalMoney; + + @ApiModelProperty("单位ID") + private Long unitId; + + @ApiModelProperty("单位名称") + private String unitName; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhProjectSchemeTargetDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhProjectSchemeTargetDTO.java new file mode 100644 index 0000000..51bbe42 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhProjectSchemeTargetDTO.java @@ -0,0 +1,91 @@ +package com.hz.pm.api.external.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + *

+ * MhProjectSchemeTargetDTO + *

+ * + * @author WendyYang + * @since 14:26 2024/1/23 + */ +@Data +@ApiModel("关键指标对象") +public class MhProjectSchemeTargetDTO { + + @ApiModelProperty(value = "迁移上云信息系统数量") + private int cloudSystemNum; + + @ApiModelProperty(value = "创建时间") + private Date createTime; + + @ApiModelProperty(value = "创建单位") + private Long createUnit; + + @ApiModelProperty(value = "创建人") + private String createUser; + + @ApiModelProperty(value = "附件") + private String fileId; + + @ApiModelProperty(value = "本地部署非涉密信息系统数量") + private Integer fsmLocalSystemNum; + + @ApiModelProperty(value = "更新购置非涉密服务器数量") + private Integer fsmServerNum; + + @ApiModelProperty(value = "更新购置非涉密数据库数量") + private Integer fsmUpdateDbNum; + + @ApiModelProperty(value = "更新购置非涉密中间件数量") + private Integer fsmUpdateMiddleNum; + + @ApiModelProperty(value = "vCPU(核数)") + private Integer hostCpuNum; + + @ApiModelProperty(value = "内存(GB)") + private Integer hostMemoryNum; + + @ApiModelProperty(value = "信创云虚拟主机数量") + private Integer hostNum; + + @ApiModelProperty(value = "存储(GB)") + private Integer hostStoreNum; + + @ApiModelProperty(value = "ID") + private String id; + + @ApiModelProperty(value = "总投资预算金额(万元)") + private BigDecimal money; + + @ApiModelProperty(value = "本地部署涉密信息系统数量") + private Integer smLocalSystemNum; + + @ApiModelProperty(value = "更新购置涉密服务器数量") + private Integer smServerNum; + + @ApiModelProperty(value = "更新购置涉密数据库数量") + private Integer smUpdateDbNum; + + @ApiModelProperty(value = "更新购置涉密中间件数量") + private Integer smUpdateMiddleNum; + + @ApiModelProperty(value = "更新时间") + private Date updateTime; + + @ApiModelProperty(value = "更新人") + private String updateUser; + + @ApiModelProperty(value = "信创云数据库数量") + private Integer xcDbNum; + + @ApiModelProperty(value = "信创云中间件数量") + private Integer xcMiddleNum; + +} \ No newline at end of file diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/controller/GovProjectCollectionController.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/controller/GovProjectCollectionController.java index 4124452..772cc91 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/gov/controller/GovProjectCollectionController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/controller/GovProjectCollectionController.java @@ -78,15 +78,15 @@ public class GovProjectCollectionController { @PostMapping("/save") @ApiOperation("项目归集保存") @WebLog("项目归集保存") - public String save(@Valid @RequestBody GovBizProjectSaveDTO saveDTO) { - return collectionManage.save(saveDTO,null); + public String save(@Valid @RequestBody GovBizProjectSaveDTO req) { + return collectionManage.save(req); } @PostMapping("/operation/save") @ApiOperation("运维项目归集保存") @WebLog("运维项目归集保存") public String operationSave(@Valid @RequestBody GovOperationProjectSaveDTO saveDTO) { - return collectionManage.operationSave(saveDTO,null); + return collectionManage.operationSave(saveDTO, null); } @PostMapping("/remove/{projId}") @@ -131,14 +131,14 @@ public class GovProjectCollectionController { @ApiOperation("项目归集暂存草稿箱") @WebLog("项目归集暂存草稿箱") public String draft(@Valid @RequestBody GovBizProjectSaveDTO saveDTO) { - return collectionManage.draft(saveDTO,null); + return collectionManage.draft(saveDTO, null); } @PostMapping("/operation/draft") @ApiOperation("运维项目归集暂存草稿箱") @WebLog("运维项目归集暂存草稿箱") public String operationDraft(@Valid @RequestBody GovOperationProjectSaveDTO saveDTO) { - return collectionManage.operationDraft(saveDTO,null); + return collectionManage.operationDraft(saveDTO, null); } @PostMapping("/draft-remove/{draftId}") @@ -200,7 +200,7 @@ public class GovProjectCollectionController { @PostMapping("/remove-project") @ApiOperation("删除申报项目") @WebLog("删除申报项目") - public String removeProject(@RequestBody List projectCodes){ + public String removeProject(@RequestBody List projectCodes) { return collectionManage.removeProject(projectCodes); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java index 8f83303..4e06366 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/manage/GovProjectCollectionManage.java @@ -78,6 +78,8 @@ import java.time.temporal.Temporal; import java.util.*; import java.util.stream.Collectors; +import static com.hz.pm.api.gov.contants.BizProjectContant.ProjectCollection.*; + /** * @author zpf * @since 2023/8/21 下午2:27 @@ -341,11 +343,11 @@ public class GovProjectCollectionManage { UserInfoDetails user = LoginUserUtil.loginUserDetail(); Page page = req.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(GovOperationProjectDraft.class) - .like(StringUtils.isNotBlank(req.getProjectName()), GovOperationProjectDraft::getBaseProjName, req.getProjectName()) - .like(StringUtils.isNotBlank(req.getBuildOrg()), GovOperationProjectDraft::getBaseBuildDeprt, req.getBuildOrg()) + .like(StrUtil.isNotBlank(req.getProjectName()), GovOperationProjectDraft::getBaseProjName, req.getProjectName()) + .like(StrUtil.isNotBlank(req.getBuildOrg()), GovOperationProjectDraft::getBaseBuildDeprt, req.getBuildOrg()) .gt(Objects.nonNull(req.getCreateOnMin()), GovOperationProjectDraft::getTongTime, req.getCreateOnMin()) .le(Objects.nonNull(req.getCreateOnMax()), GovOperationProjectDraft::getTongTime, req.getCreateOnMax()) - .eq(StringUtils.isNotBlank(req.getProjectType()), GovOperationProjectDraft::getBaseProjType, req.getProjectType()) + .eq(StrUtil.isNotBlank(req.getProjectType()), GovOperationProjectDraft::getBaseProjType, req.getProjectType()) .eq(GovOperationProjectDraft::getDeleted, Boolean.FALSE) .eq(GovOperationProjectDraft::getCreateId, user.getUserId()) .orderByDesc(GovOperationProjectDraft::getBizTime); @@ -653,24 +655,23 @@ public class GovProjectCollectionManage { /** * 项目归集保存 * - * @param saveDTO - * @return + * @param req \ + * @return \ */ - @Transactional - public String save(GovBizProjectSaveDTO saveDTO, UserInfoDetails user) { - if (Objects.isNull(user)) { - user = LoginUserUtil.loginUserDetail(); - } + @Transactional(rollbackFor = Exception.class) + public String save(GovBizProjectSaveDTO req) { + LocalDateTime now = LocalDateTime.now(); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); - GovBizProjectBaseinfoDTO base = saveDTO.getBaseinfo(); - String baseProjId = saveDTO.getBaseProjId(); + GovBizProjectBaseinfoDTO base = req.getBaseinfo(); + String baseProjId = req.getBaseProjId(); String baseProjName = base.getBaseProjName(); //1.保存基本信息 - GovBizProjectBaseinfoDTO baseinfo = saveDTO.getBaseinfo(); + GovBizProjectBaseinfoDTO baseinfo = req.getBaseinfo(); baseinfo.setBaseProjId(baseProjId); baseinfo.setBaseProjName(baseProjName); - baseinfo.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); + baseinfo.setIsEffective(IS_EFFECTIVE); GovBizProjectBaseinfo oldBaseInfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) .eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId) .last(BizConst.LIMIT_1)); @@ -679,28 +680,28 @@ public class GovProjectCollectionManage { checkName(baseProjName, baseProjId); GovBizProjectBaseinfo saveBase = BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfo.class); saveBase.setBaseProjName(baseProjName); - saveBase.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); + saveBase.setIsEffective(IS_EFFECTIVE); if (Objects.nonNull(oldBaseInfo)) { saveBase.setId(oldBaseInfo.getId()); saveBase.setBaseAreaCode(null); } else { - saveBase.setTongTime(LocalDateTime.now()); + saveBase.setTongTime(now); } saveBase.setAreaCode(RegionConst.RC_HZ); - saveBase.setBizTime(LocalDateTime.now()); + saveBase.setBizTime(now); saveBase.setUpdateBy(user.getUsername()); - saveBase.setUpdateOn(LocalDateTime.now()); + saveBase.setUpdateOn(now); //如果是新增的话 要生成 项目编号 - if (StringUtils.isBlank(baseProjId) || BizProjectContant.ProjectCollection.DRAFT.equals(baseProjId)) { - baseProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); + if (StringUtils.isBlank(baseProjId) || DRAFT.equals(baseProjId)) { + baseProjId = generateProjectCodeUtil.generateProjectCode(req); saveBase.setBaseProjId(baseProjId); } baseinfoService.saveOrUpdate(saveBase); // 2.保存 申报信息 - GovBizProjectApplyDTO apply = saveDTO.getApply(); + GovBizProjectApplyDTO apply = req.getApply(); if (Objects.nonNull(apply)) { apply.setBaseProjId(baseProjId); apply.setBaseProjName(baseProjName); @@ -713,7 +714,7 @@ public class GovProjectCollectionManage { if (Objects.nonNull(oldApply)) { saveApply.setId(oldApply.getId()); } else { - saveApply.setTongTime(LocalDateTime.now()); + saveApply.setTongTime(now); } if (Objects.nonNull(saveApply.getBaseProjStartTime()) && Objects.nonNull(saveApply.getBaseProjEndTime())) { @@ -721,16 +722,16 @@ public class GovProjectCollectionManage { saveApply.getBaseProjEndTime())); } saveApply.setAreaCode(RegionConst.RC_HZ); - saveApply.setBizTime(LocalDateTime.now()); + saveApply.setBizTime(now); saveApply.setUpdateBy(user.getUsername()); - saveApply.setUpdateOn(LocalDateTime.now()); + saveApply.setUpdateOn(now); if (projectApplyService.saveOrUpdate(saveApply)) { threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssApply(apply, oldApply, saveApply)); } } // 3.保存 审批信息 - GovBizProjectApproveDTO approve = saveDTO.getApprove(); + GovBizProjectApproveDTO approve = req.getApprove(); if (Objects.nonNull(approve)) { approve.setBaseProjId(baseProjId); approve.setBaseProjName(baseProjName); @@ -755,7 +756,7 @@ public class GovProjectCollectionManage { } // 4.保存 建设项目 实施信息 - GovBizProjectCimplementDTO cimplement = saveDTO.getCimplement(); + GovBizProjectCimplementDTO cimplement = req.getCimplement(); if (Objects.nonNull(cimplement)) { cimplement.setBaseProjId(baseProjId); cimplement.setBaseProjName(baseProjName); @@ -772,19 +773,19 @@ public class GovProjectCollectionManage { if (Objects.nonNull(oldCimplement)) { saveCimplement.setId(oldCimplement.getId()); } else { - saveCimplement.setTongTime(LocalDateTime.now()); + saveCimplement.setTongTime(now); } saveCimplement.setAreaCode(RegionConst.RC_HZ); - saveCimplement.setBizTime(LocalDateTime.now()); + saveCimplement.setBizTime(now); saveCimplement.setUpdateBy(user.getUsername()); - saveCimplement.setUpdateOn(LocalDateTime.now()); + saveCimplement.setUpdateOn(now); if (cimplementService.saveOrUpdate(saveCimplement)) { threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssCimplement(cimplement, oldCimplement, saveCimplement)); } } // 5.保存 运维项目 实施信息 - GovBizProjectMimplementDTO mimplement = saveDTO.getMimplement(); + GovBizProjectMimplementDTO mimplement = req.getMimplement(); if (Objects.nonNull(mimplement)) { mimplement.setBaseProjId(baseProjId); mimplement.setBaseProjName(baseProjName); @@ -801,22 +802,22 @@ public class GovProjectCollectionManage { if (Objects.nonNull(oldMimplement)) { saveMimplement.setId(oldMimplement.getId()); } else { - saveMimplement.setTongTime(LocalDateTime.now()); + saveMimplement.setTongTime(now); } if (Objects.nonNull(saveBase.getAreaCode())) { saveMimplement.setAreaCode(saveBase.getAreaCode()); } saveMimplement.setAreaCode(RegionConst.RC_HZ); - saveMimplement.setBizTime(LocalDateTime.now()); + saveMimplement.setBizTime(now); saveMimplement.setUpdateBy(user.getUsername()); - saveMimplement.setUpdateOn(LocalDateTime.now()); + saveMimplement.setUpdateOn(now); if (mimplementService.saveOrUpdate(saveMimplement)) { threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssMimplement(mimplement, oldMimplement, saveMimplement)); } } // 6.保存 采购信息 - List procures = saveDTO.getProcures(); + List procures = req.getProcures(); if (Objects.nonNull(procures)) { procureService.remove(Wrappers.lambdaQuery(GovBizProjectProcure.class) @@ -831,10 +832,10 @@ public class GovProjectCollectionManage { saveProcure.setBaseProjId(baseProjId); saveProcure.setId(null); saveProcure.setAreaCode(RegionConst.RC_HZ); - saveProcure.setTongTime(LocalDateTime.now()); - saveProcure.setBizTime(LocalDateTime.now()); + saveProcure.setTongTime(now); + saveProcure.setBizTime(now); saveProcure.setUpdateBy(user.getUsername()); - saveProcure.setUpdateOn(LocalDateTime.now()); + saveProcure.setUpdateOn(now); if (procureService.save(saveProcure)) { threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssProcure(procure, null, saveProcure)); } @@ -843,8 +844,8 @@ public class GovProjectCollectionManage { } - if (Objects.nonNull(saveDTO.getDraftId())) { - draftService.removeById(saveDTO.getDraftId()); + if (Objects.nonNull(req.getDraftId())) { + draftService.removeById(req.getDraftId()); } return BizConst.SAVE_SUCCESS; @@ -871,7 +872,7 @@ public class GovProjectCollectionManage { GovOperationProjectBaseinfoDTO baseinfo = saveDTO.getBaseinfo(); baseinfo.setBaseProjId(baseProjId); baseinfo.setBaseProjName(baseProjName); - baseinfo.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); + baseinfo.setIsEffective(IS_EFFECTIVE); GovOperationProjectBaseinfo oldBaseInfo = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) .eq(GovOperationProjectBaseinfo::getBaseProjId, baseProjId) .last(BizConst.LIMIT_1)); @@ -880,7 +881,7 @@ public class GovProjectCollectionManage { checkNameOperation(baseProjName, baseProjId); GovOperationProjectBaseinfo saveBase = BeanUtil.copyProperties(baseinfo, GovOperationProjectBaseinfo.class); saveBase.setBaseProjName(baseProjName); - saveBase.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); + saveBase.setIsEffective(IS_EFFECTIVE); if (Objects.nonNull(oldBaseInfo)) { saveBase.setId(oldBaseInfo.getId()); saveBase.setBaseAreaCode(null); @@ -892,7 +893,7 @@ public class GovProjectCollectionManage { saveBase.setUpdateOn(LocalDateTime.now()); //如果是新增的话 要生成 项目编号 - if (StringUtils.isBlank(baseProjId) || BizProjectContant.ProjectCollection.DRAFT.equals(baseProjId)) { + if (StringUtils.isBlank(baseProjId) || DRAFT.equals(baseProjId)) { baseProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); saveBase.setBaseProjId(baseProjId); } @@ -1099,7 +1100,7 @@ public class GovProjectCollectionManage { String baseProjName = base.getBaseProjName(); //要生成 草稿的项目编号 if (StringUtils.isBlank(baseProjId)) { - baseProjId = BizProjectContant.ProjectCollection.DRAFT; + baseProjId = DRAFT; } // 2.保存 申报信息 @@ -1158,12 +1159,12 @@ public class GovProjectCollectionManage { .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); draft.setBaseProjId(baseProjId); draft.setBaseProjName(baseProjName); - draft.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); + draft.setIsEffective(IS_EFFECTIVE); draft.setAreaCode(RegionConst.RC_HZ); draft.setBizTime(LocalDateTime.now()); draft.setUpdateBy(user.getUsername()); draft.setUpdateOn(LocalDateTime.now()); - draft.setOp(BizProjectContant.ProjectCollection.OP_INSERT); + draft.setOp(OP_INSERT); draftService.saveOrUpdate(draft); @@ -1194,7 +1195,7 @@ public class GovProjectCollectionManage { String baseProjName = base.getBaseProjName(); //要生成 草稿的项目编号 if (StringUtils.isBlank(baseProjId)) { - baseProjId = BizProjectContant.ProjectCollection.DRAFT; + baseProjId = DRAFT; } // 2.保存 申报信息 @@ -1253,12 +1254,12 @@ public class GovProjectCollectionManage { .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); draft.setBaseProjId(baseProjId); draft.setBaseProjName(baseProjName); - draft.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); + draft.setIsEffective(IS_EFFECTIVE); draft.setAreaCode(RegionConst.RC_HZ); draft.setBizTime(LocalDateTime.now()); draft.setUpdateBy(user.getUsername()); draft.setUpdateOn(LocalDateTime.now()); - draft.setOp(BizProjectContant.ProjectCollection.OP_INSERT); + draft.setOp(OP_INSERT); operationProjectDraftService.saveOrUpdate(draft); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/gov/utils/ProjectConvertUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/gov/utils/ProjectConvertUtil.java index 6c058ed..bfcba48 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/gov/utils/ProjectConvertUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/gov/utils/ProjectConvertUtil.java @@ -21,6 +21,7 @@ import com.hz.pm.api.projectlib.model.vo.ProjectApplicationVO; import com.hz.pm.api.projectlib.model.vo.ProjectDetailVO; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; + import java.math.BigDecimal; import java.util.Collections; import java.util.List; @@ -38,12 +39,13 @@ public class ProjectConvertUtil { /** * 申报项目 转为 项目归集 + * * @param project * @return */ - public static GovBizProjectDetailVO declaredToCollection(ProjectDetailVO project, FileService fileService){ + public static GovBizProjectDetailVO declaredToCollection(ProjectDetailVO project, FileService fileService) { GovBizProjectDetailVO projectCollection = new GovBizProjectDetailVO(); - if(Objects.isNull(project)){ + if (Objects.isNull(project)) { return projectCollection; } String projectCode = project.getProjectCode(); @@ -52,11 +54,11 @@ public class ProjectConvertUtil { projectCollection.setBaseProjName(projectName); projectCollection.setBaseinfo(buildBaseinfo(project)); projectCollection.setApply(buildApply(project)); - projectCollection.setApprove(buildApprove(project,fileService)); + projectCollection.setApprove(buildApprove(project, fileService)); String projectType = project.getProjectType(); ProjectTypeNewEnum match = ProjectTypeNewEnum.match(projectType); - if(Objects.nonNull(match)){ - switch (match){ + if (Objects.nonNull(match)) { + switch (match) { case SJ_BUILD: case FIRST_BUILD: case SZ_BUILD: @@ -98,10 +100,8 @@ public class ProjectConvertUtil { baseinfo.setBaseProvManDepartDing(project.getHigherSuperOrgCode()); baseinfo.setBaseProvManDeprtType(project.getBaseProvManDeprtType()); ProjectStatusEnum match = ProjectStatusEnum.match(project.getStatus()); - if(Objects.nonNull(match)){ - if(Objects.nonNull(match.getCollectionStatus())){ - baseinfo.setBaseProjSetProg(match.getCollectionStatus().getCode()); - } + if (Objects.nonNull(match) && (Objects.nonNull(match.getCollectionStatus()))) { + baseinfo.setBaseProjSetProg(match.getCollectionStatus().getCode()); } baseinfo.setBaseProjType(project.getProjectType()); baseinfo.setDeleted(Boolean.FALSE); @@ -117,7 +117,7 @@ public class ProjectConvertUtil { apply.setBaseHistorProjId(project.getBaseHistorProjId()); apply.setBaseBasisEstablish(project.getBaseBasisEstablish()); List projectApplications = project.getProjectApplications(); - if(CollUtil.isNotEmpty(projectApplications)){ + if (CollUtil.isNotEmpty(projectApplications)) { String appName = projectApplications.stream().map(app -> { if (StringUtils.isNotBlank(app.getRelatedExistsApplication())) { return app.getRelatedExistsApplication(); @@ -140,8 +140,8 @@ public class ProjectConvertUtil { } apply.setBaseBasisAmountOri(project.getBaseBasisAmountOri()); String coreBusiness = project.getCoreBusiness(); - if(StringUtils.isNotBlank(coreBusiness)){ - try{ + if (StringUtils.isNotBlank(coreBusiness)) { + try { JSONArray coreJson = JSON.parseArray(coreBusiness); String matters = coreJson.stream().map(j -> { JSONObject matterJson = JSON.parseObject(JSON.toJSONString(j)); @@ -155,8 +155,8 @@ public class ProjectConvertUtil { .collect(Collectors.joining(StrPool.SEMICOLON_CHINA)); apply.setBaseCoreBusiness(matters); apply.setBaseCoreBusinessCode(matterCodes); - }catch (Exception e){ - log.error("项目转化失败",e); + } catch (Exception e) { + log.error("项目转化失败", e); } } apply.setBaseDevelopCode(project.getDevelopCode()); @@ -166,14 +166,14 @@ public class ProjectConvertUtil { apply.setBaseProjApplyFile(project.getProjectApplicationForm()); String beginTime = project.getBeginTime(); String endTime = project.getEndTime(); - if(StringUtils.isNotBlank(beginTime)){ + if (StringUtils.isNotBlank(beginTime)) { apply.setBaseProjStartTime(BizUtils.convertLocalDateTime(beginTime)); } - if(StringUtils.isNotBlank(endTime)){ + if (StringUtils.isNotBlank(endTime)) { apply.setBaseProjEndTime(BizUtils.convertLocalDateTime(endTime)); } - if(StringUtils.isNotBlank(beginTime) && StringUtils.isNotBlank(endTime)){ - try{ + if (StringUtils.isNotBlank(beginTime) && StringUtils.isNotBlank(endTime)) { + try { String yearEnd = endTime.split(StrPool.DASH)[0]; String yearStart = beginTime.split(StrPool.DASH)[0]; String monthEnd = endTime.split(StrPool.DASH)[1]; @@ -181,8 +181,8 @@ public class ProjectConvertUtil { Integer duration = Integer.parseInt(monthEnd) - Integer.parseInt(monthStart) + (Integer.parseInt(yearEnd) - Integer.parseInt(yearStart)) * 12; apply.setBaseProjDuration(String.valueOf(duration)); - }catch (Exception e){ - log.error("日期转换失败:",e); + } catch (Exception e) { + log.error("日期转换失败:", e); } } apply.setBaseProjConsClass(project.getBuildLevel()); @@ -203,12 +203,12 @@ public class ProjectConvertUtil { } //转化审批信息 - private static GovBizProjectApproveVO buildApprove(ProjectDetailVO project,FileService fileService) { + private static GovBizProjectApproveVO buildApprove(ProjectDetailVO project, FileService fileService) { GovBizProjectApproveVO approve = new GovBizProjectApproveVO(); // approve.setBaseProjId(project.getProjectCode()); approve.setBaseProjName(project.getProjectName()); File file = fileService.getById(project.getApprovedFile()); - if(Objects.nonNull(file)){ + if (Objects.nonNull(file)) { approve.setApprovalFile(JSON.toJSONString(Lists.newArrayList(file))); } approve.setAreaCode(RegionConst.RC_HZ); @@ -220,24 +220,24 @@ public class ProjectConvertUtil { approve.setBaseProjReplyAmount(project.getApprovalBudget()); approve.setBaseReviewCommentsFile(project.getProposeAttachFiles()); List projectApplications = project.getProjectApplications(); - if(CollUtil.isNotEmpty(projectApplications)){ + if (CollUtil.isNotEmpty(projectApplications)) { Integer max = 0; - for(ProjectApplicationVO app : projectApplications){ - max = Math.max(app.getSecrecyGrade(),max); + for (ProjectApplicationVO app : projectApplications) { + max = Math.max(app.getSecrecyGrade(), max); } - if(max > 0){ - approve.setEqualProtectionLevel(String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS,max)); + if (max > 0) { + approve.setEqualProtectionLevel(String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS, max)); } } approve.setPreliminaryDesignScheme(project.getPreliminaryPlanFile()); approve.setPreliminaryDesignFile(project.getPreliminaryInspectionMaterials()); approve.setBaseReviewOpinion(project.getProposeAttach()); - if(Objects.nonNull(project.getBaseReviewResults())){ + if (Objects.nonNull(project.getBaseReviewResults())) { approve.setBaseReviewResults(String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS, project.getBaseReviewResults())); } List purchases = project.getPurchases(); - if(CollUtil.isNotEmpty(purchases)){ + if (CollUtil.isNotEmpty(purchases)) { purchases.stream().map(PurchaseVO::getTransactionAmount) .filter(Objects::nonNull).reduce(BigDecimal::add) .ifPresent(approve::setReleaseYearMoney); @@ -256,15 +256,15 @@ public class ProjectConvertUtil { cim.setDeleted(Boolean.FALSE); cim.setBaseDevelopCode(project.getDevelopCode()); //总结报告 - cim.setBaseSummReportFile(searchReportFile(project,5,2)); + cim.setBaseSummReportFile(searchReportFile(project, 5, 2)); //监理总结报告 - cim.setBaseEstaSummFile(searchReportFile(project,5,3)); + cim.setBaseEstaSummFile(searchReportFile(project, 5, 3)); //建设核查表 - cim.setBaseCheckFile(searchReportFile(project,3,2)); - cim.setBaseThirdAcceptFile(searchReportFile(project,5,4)); - cim.setBaseInitialOpinionFile(searchReportFile(project,5,5)); + cim.setBaseCheckFile(searchReportFile(project, 3, 2)); + cim.setBaseThirdAcceptFile(searchReportFile(project, 5, 4)); + cim.setBaseInitialOpinionFile(searchReportFile(project, 5, 5)); List projectApplications = project.getProjectApplications(); - if(CollUtil.isNotEmpty(projectApplications)){ + if (CollUtil.isNotEmpty(projectApplications)) { String appCode = projectApplications.stream().map(app -> { if (StringUtils.isNotBlank(app.getRelatedExistsApplication())) { return app.getRelatedExistsApplicationCode(); @@ -286,13 +286,13 @@ public class ProjectConvertUtil { mim.setDeleted(Boolean.FALSE); mim.setBaseDevelopCode(project.getDevelopCode()); //监理总结报告 - mim.setBaseEstaSummFile(searchReportFile(project,5,3)); + mim.setBaseEstaSummFile(searchReportFile(project, 5, 3)); //建设核查表 // mim.setBaseCheckFile(searchReportFile(project,3,2)); - mim.setBaseThirdAcceptFile(searchReportFile(project,5,4)); + mim.setBaseThirdAcceptFile(searchReportFile(project, 5, 4)); // mim.setBaseInitialOpinionFile(searchReportFile(project,5,5)); List projectApplications = project.getProjectApplications(); - if(CollUtil.isNotEmpty(projectApplications)){ + if (CollUtil.isNotEmpty(projectApplications)) { String appCode = projectApplications.stream().map(app -> { if (StringUtils.isNotBlank(app.getRelatedExistsApplication())) { return app.getRelatedExistsApplicationCode(); @@ -309,13 +309,13 @@ public class ProjectConvertUtil { List purchases = project.getPurchases(); ContractVO contract = project.getContract(); final BigDecimal[] paymentTotal = {BigDecimal.ZERO}; - if(Objects.nonNull(contract)){ + if (Objects.nonNull(contract)) { List payments = contract.getPayments(); payments.stream().map(PaymentPlanVO::getPaymentAmount) .reduce(BigDecimal::add) .ifPresent(b -> paymentTotal[0] = b); } - if(CollUtil.isNotEmpty(purchases)){ + if (CollUtil.isNotEmpty(purchases)) { return purchases.stream().map(p -> { GovBizProjectProcureVO purchase = new GovBizProjectProcureVO(); purchase.setBaseProjName(project.getProjectName()); @@ -333,7 +333,7 @@ public class ProjectConvertUtil { purchase.setBaseWinningBidTime(p.getTransactionTime()); purchase.setBiddingFile(p.getAcceptanceLetter()); purchase.setPaymentProgress(paymentTotal[0]); - if(Objects.nonNull(contract)){ + if (Objects.nonNull(contract)) { purchase.setPurchaseContract(contract.getAttachment()); } purchase.setSetProjCodeFinan(project.getFinancialCode()); @@ -346,31 +346,32 @@ public class ProjectConvertUtil { /** * 查询项目 初验终验的 报告 + * * @param project * @return */ - private static String searchReportFile(ProjectDetailVO project,Integer firstIndex,Integer secondIndex) { - if(Objects.isNull(project)){ + private static String searchReportFile(ProjectDetailVO project, Integer firstIndex, Integer secondIndex) { + if (Objects.isNull(project)) { return null; } - if(StringUtils.isNotBlank(project.getFinalAcceptanceMaterials())){ - return searchReportFileInner(project.getFinalAcceptanceMaterials(),firstIndex,secondIndex); - }else if(StringUtils.isNotBlank(project.getPreliminaryInspectionMaterials())){ - return searchReportFileInner(project.getFinalAcceptanceMaterials(),firstIndex,secondIndex); + if (StringUtils.isNotBlank(project.getFinalAcceptanceMaterials())) { + return searchReportFileInner(project.getFinalAcceptanceMaterials(), firstIndex, secondIndex); + } else if (StringUtils.isNotBlank(project.getPreliminaryInspectionMaterials())) { + return searchReportFileInner(project.getFinalAcceptanceMaterials(), firstIndex, secondIndex); } return null; } - private static String searchReportFileInner(String fileStr,Integer firstIndex,Integer secondIndex) { - try{ + private static String searchReportFileInner(String fileStr, Integer firstIndex, Integer secondIndex) { + try { JSONArray jsonArray = JSON.parseArray(fileStr); JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(jsonArray.get(firstIndex - 1))); JSONArray data = jsonObject.getJSONArray("data"); JSONObject wangong = JSON.parseObject(JSON.toJSONString(data.get(secondIndex - 1))); JSONArray files = wangong.getJSONArray("files"); return JSON.toJSONString(files); - }catch (Exception e){ - log.error("解析文件失败:",e); + } catch (Exception e) { + log.error("解析文件失败:", e); } return null; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectLibController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectLibController.java index 10bee52..a63f686 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectLibController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/ProjectLibController.java @@ -1,8 +1,6 @@ package com.hz.pm.api.projectlib.controller; import com.alibaba.fastjson.JSONObject; -import com.ningdatech.basic.model.PageVo; -import com.ningdatech.log.annotation.WebLog; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.gov.model.vo.GovBizProjectDetailVO; import com.hz.pm.api.projectlib.manage.ProjectLibManage; @@ -13,6 +11,8 @@ import com.hz.pm.api.projectlib.model.vo.ProjectDetailVO; import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; import com.hz.pm.api.user.security.model.UserFullInfoDTO; import com.hz.pm.api.user.util.LoginUserUtil; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; import com.wflow.workflow.bean.vo.ProcessDetailVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -45,21 +45,21 @@ public class ProjectLibController { @ApiOperation("项目库列表") public PageVo projectLibList(ProjectListReq req) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - return projectLibManage.projectLibListWithPermission(req,user); + return projectLibManage.projectLibListWithPermission(req, user); } @GetMapping("/all-list") @ApiOperation("包含申报项目列表和项目归集列表") public PageVo projectAllList(ProjectListReq req) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - return projectLibManage.projectAllListWithPermission(req,user); + return projectLibManage.projectAllListWithPermission(req, user); } @GetMapping("/lib-list") @ApiOperation("包含申报项目列表和项目归集(运维项目)列表") public PageVo libList(ProjectListReq req) { UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - return projectLibManage.libListWithPermission(req,user); + return projectLibManage.libListWithPermission(req, user); } @GetMapping("/history-list/{id}") @@ -82,38 +82,38 @@ public class ProjectLibController { @GetMapping("/prePlan/{id}") @ApiOperation("获取项目初步方案详情") - public ProjectDetailVO constructDetail (@PathVariable Long id){ + public ProjectDetailVO constructDetail(@PathVariable Long id) { return projectLibManage.getPrePlanProjectDetail(id); } @GetMapping("/{id}") @ApiOperation("获取项目详情") - public ProjectDetailVO detail (@PathVariable Long id){ + public ProjectDetailVO detail(@PathVariable Long id) { return projectLibManage.getProjectDetail(id); } @GetMapping("/convert-to-collection/{projectCode}") @ApiOperation("申报项目转化为项目归集") - public GovBizProjectDetailVO convertToCollection(@PathVariable String projectCode){ + public GovBizProjectDetailVO convertToCollection(@PathVariable String projectCode) { return projectLibManage.convertToCollection(projectCode); } @GetMapping("/detail/{projectCode}") @ApiOperation("获取项目详情(编号)") - public ProjectDetailVO detailProjectCode (@PathVariable String projectCode){ + public ProjectDetailVO detailProjectCode(@PathVariable String projectCode) { return projectLibManage.detailProjectCode(projectCode); } @GetMapping("/processSchedule/{projectId}") @ApiOperation("项目库申报项目当前进度详情") - public List processScheduleDetail(@PathVariable("projectId") Long projectId){ + public List processScheduleDetail(@PathVariable("projectId") Long projectId) { return projectLibManage.processScheduleDetail(projectId); } @PostMapping("/exportList") @ApiOperation("项目库列表导出") @WebLog("项目库列表导出") - public void exportList(@Valid @RequestBody ProjectListReq param, HttpServletResponse response){ - projectLibManage.exportList(param,response); + public void exportList(@Valid @RequestBody ProjectListReq param, HttpServletResponse response) { + projectLibManage.exportList(param, response); } } From 52a00b824399bc735d587b534c3eab0c09611d16 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Wed, 24 Jan 2024 16:46:12 +0800 Subject: [PATCH 35/44] =?UTF-8?q?=E9=A2=84=E8=AD=A6=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../expert/service/impl/ExpertInfoServiceImpl.java | 74 ++++++++++------------ .../api/meeting/helper/MeetingCallOrMsgHelper.java | 12 ++-- .../pm/api/meeting/helper/YxtCallOrSmsHelper.java | 47 -------------- .../hz/pm/api/meeting/helper/YxtClientHelper.java | 47 ++++++++++++++ .../hz/pm/api/sys/manage/EarlyWarningManage.java | 26 +++++--- 5 files changed, 103 insertions(+), 103 deletions(-) delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/YxtCallOrSmsHelper.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/YxtClientHelper.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertInfoServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertInfoServiceImpl.java index 2267e24..daa8693 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertInfoServiceImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/expert/service/impl/ExpertInfoServiceImpl.java @@ -24,7 +24,7 @@ import com.hz.pm.api.expert.model.cmd.*; import com.hz.pm.api.expert.model.dto.*; import com.hz.pm.api.expert.service.*; import com.hz.pm.api.expert.utils.SensitiveModifySegmentUtils; -import com.hz.pm.api.meeting.helper.YxtCallOrSmsHelper; +import com.hz.pm.api.meeting.helper.YxtClientHelper; import com.hz.pm.api.meta.constant.ExpertDictTypeEnum; import com.hz.pm.api.meta.model.ExpertRegionInfo; import com.hz.pm.api.meta.model.entity.ExpertDictionary; @@ -78,7 +78,7 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { private final IUserRoleService userRoleService; private final IExpertSensitiveInfoModifyDetailRecordService iExpertSensitiveInfoModifyDetailRecordService; private final IUserInfoService userInfoService; - private final YxtCallOrSmsHelper yxtCallOrSmsHelper; + private final YxtClientHelper yxtClientHelper; private final IExpertGovBusinessStripService expertGovBusinessStripService; @Value("${login.url:}") @@ -101,7 +101,7 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(userId); - ExpertUserFullInfo saveExpertUserFullInfo = buildSaveExpertUserFullInfo(expertUserInfoDTO); + ExpertUserFullInfo saveExpertUserFullInfo = buildExpertUserFullInfo(expertUserInfoDTO); if (Objects.nonNull(expertUserFullInfo)) { // 专家信息审核通过之前,所有信息无需备份 iExpertUserFullInfoService.removeById(expertUserFullInfo.getId()); @@ -129,7 +129,7 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { iExpertTagService.saveBatch(saveExpertTagList); } // 保存所有专家字典字段 - List saveExpertDictionaryList = buildSaveExpertDictionaryList(userId, expertDictionaryList); + List saveExpertDictionaryList = buildExpertDicts(userId, expertDictionaryList); if (CollectionUtils.isNotEmpty(saveExpertDictionaryList)) { iExpertDictionaryService.saveBatch(saveExpertDictionaryList); } @@ -141,14 +141,14 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { iExpertMetaApplyService.saveBatch(saveExpertIntentionWorkRegionApplyList); } // 保存所有专家回避单位 - List saveExpertAvoidCompanyList = buildSaveExpertAvoidCompanyList(userId, expertAvoidCompanyList); + List saveExpertAvoidCompanyList = buildExpertAvoidCompany(userId, expertAvoidCompanyList); if (CollectionUtils.isNotEmpty(saveExpertAvoidCompanyList)) { iExpertAvoidCompanyService.saveBatch(saveExpertAvoidCompanyList); } } - private ExpertUserFullInfo buildSaveExpertUserFullInfo(ExpertUserFullInfoDTO expertUserInfoDTO) { + private ExpertUserFullInfo buildExpertUserFullInfo(ExpertUserFullInfoDTO expertUserInfoDTO) { ExpertUserFullInfo expertUserFullInfo = new ExpertUserFullInfo(); if (Objects.nonNull(expertUserInfoDTO.getIsDingUser())) { expertUserFullInfo.setIsDingUser(expertUserInfoDTO.getIsDingUser()); @@ -197,33 +197,35 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { }).collect(Collectors.toList()); } - private List buildSaveExpertDictionaryList(Long userId, List expertDictionaryList) { - if (CollectionUtils.isEmpty(expertDictionaryList)) { - return new ArrayList<>(); - } - return expertDictionaryList.stream().map(r -> { - ExpertDictionary expertDictionary = new ExpertDictionary(); - expertDictionary.setUserId(userId); - expertDictionary.setExpertInfoField(r.getExpertInfoField()); - expertDictionary.setDictionaryCode(r.getDictionaryCode()); - expertDictionary.setUpdateOn(LocalDateTime.now()); - expertDictionary.setCreateOn(LocalDateTime.now()); - return expertDictionary; + private List buildExpertDicts(Long userId, List exertDicts) { + if (CollectionUtils.isEmpty(exertDicts)) { + return Collections.emptyList(); + } + LocalDateTime now = LocalDateTime.now(); + return exertDicts.stream().map(r -> { + ExpertDictionary expertDict = new ExpertDictionary(); + expertDict.setUserId(userId); + expertDict.setExpertInfoField(r.getExpertInfoField()); + expertDict.setDictionaryCode(r.getDictionaryCode()); + expertDict.setUpdateOn(now); + expertDict.setCreateOn(now); + return expertDict; }).collect(Collectors.toList()); } - private List buildSaveExpertAvoidCompanyList(Long userId, List expertAvoidCompanyList) { - if (CollectionUtils.isEmpty(expertAvoidCompanyList)) { - return new ArrayList<>(); + private List buildExpertAvoidCompany(Long userId, List avoidCompanies) { + if (CollectionUtils.isEmpty(avoidCompanies)) { + return Collections.emptyList(); } - return expertAvoidCompanyList.stream().map(r -> { + LocalDateTime now = LocalDateTime.now(); + return avoidCompanies.stream().map(r -> { ExpertAvoidCompany expertAvoidCompany = new ExpertAvoidCompany(); expertAvoidCompany.setCompanyName(r.getCompanyName()); expertAvoidCompany.setUserId(userId); expertAvoidCompany.setCompanyUniqCode(r.getCompanyUniqCode()); - expertAvoidCompany.setCreateOn(LocalDateTime.now()); - expertAvoidCompany.setUpdateOn(LocalDateTime.now()); + expertAvoidCompany.setCreateOn(now); + expertAvoidCompany.setUpdateOn(now); return expertAvoidCompany; }).collect(Collectors.toList()); } @@ -239,15 +241,7 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { List recommendedWayList = cmd.getRecommendedWay(); if (CollectionUtils.isNotEmpty(recommendedWayList)) { - List saveExpertDictionaryList = recommendedWayList.stream().map(r -> { - ExpertDictionary expertDictionary = new ExpertDictionary(); - expertDictionary.setUserId(userId); - expertDictionary.setExpertInfoField(r.getExpertInfoField()); - expertDictionary.setDictionaryCode(r.getDictionaryCode()); - expertDictionary.setUpdateOn(LocalDateTime.now()); - expertDictionary.setCreateOn(LocalDateTime.now()); - return expertDictionary; - }).collect(Collectors.toList()); + List saveExpertDictionaryList = buildExpertDicts(userId, recommendedWayList); iExpertDictionaryService.saveBatch(saveExpertDictionaryList); } @@ -325,7 +319,7 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { Integer expertRegionLevel = cmd.getExpertRegionLevel(); Long expertUserId = cmd.getExpertUserId(); - if (applyResult) { + if (Boolean.TRUE.equals(applyResult)) { switch (applyTypeEnum) { case EXPERT_INTENTION_JOIN: { // 新增履职意向地 @@ -372,7 +366,7 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { ExpertUserFullInfo expertInfo = iExpertUserFullInfoService.getByUserId(expertUserId); UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); String content; - if (cmd.getApplyResult()) { + if (Boolean.TRUE.equals(cmd.getApplyResult())) { // 修改专家状态为可用 // 账号启用 LambdaUpdateWrapper userInfoUpdate = Wrappers.lambdaUpdate(UserInfo.class) @@ -387,7 +381,7 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { List expertType = cmd.getExpertType(); if (CollUtil.isNotEmpty(expertType)) { expertType.forEach(r -> r.setExpertInfoField(ExpertDictTypeEnum.EXPERT_TYPE.getKey())); - List saveExpertDictList = buildSaveExpertDictionaryList(expertUserId, expertType); + List saveExpertDictList = buildExpertDicts(expertUserId, expertType); iExpertDictionaryService.saveBatch(saveExpertDictList); } // 补充专家 专家角色 @@ -410,7 +404,7 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { SendSmsContext smsCtx = new SendSmsContext(); smsCtx.setContent(content); smsCtx.setReceiveNumber(expertInfo.getPhoneNo()); - yxtCallOrSmsHelper.sendSms(smsCtx); + yxtClientHelper.sendSms(smsCtx); } } @@ -464,7 +458,7 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { List applyIdList = new ArrayList<>(); ExpertUserFullInfo originalExpertUserFullInfo = iExpertUserFullInfoService.getByUserId(userId); - ExpertUserFullInfo saveExpertUserFullInfo = buildSaveExpertUserFullInfo(expertUserInfoDTO); + ExpertUserFullInfo saveExpertUserFullInfo = buildExpertUserFullInfo(expertUserInfoDTO); if (Objects.nonNull(originalExpertUserFullInfo)) { saveExpertUserFullInfo.setId(originalExpertUserFullInfo.getId()); // 删除所有专家字典字段(需审核敏感字段不删除) @@ -497,7 +491,7 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { iExpertUserFullInfoService.saveOrUpdate(saveExpertUserFullInfo); // 保存所有专家字典字段 - List saveExpertDictionaryList = buildSaveExpertDictionaryList(userId, expertDictionaryList); + List saveExpertDictionaryList = buildExpertDicts(userId, expertDictionaryList); saveExpertDictionaryList = saveExpertDictionaryList .stream().filter(r -> !ExpertUserInfoSensitiveFieldEnum.getSensitiveDictionaryList().contains(r.getExpertInfoField())) .collect(Collectors.toList()); @@ -506,7 +500,7 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { } // 保存所有专家回避单位 - List saveExpertAvoidCompanyList = buildSaveExpertAvoidCompanyList(userId, expertAvoidCompanyList); + List saveExpertAvoidCompanyList = buildExpertAvoidCompany(userId, expertAvoidCompanyList); if (CollectionUtils.isNotEmpty(saveExpertAvoidCompanyList)) { // 删除回避单位 LambdaQueryWrapper expertAvoidCompanyRemove = Wrappers.lambdaQuery(ExpertAvoidCompany.class) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingCallOrMsgHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingCallOrMsgHelper.java index 380c950..9387640 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingCallOrMsgHelper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingCallOrMsgHelper.java @@ -48,7 +48,7 @@ import java.util.stream.Collectors; public class MeetingCallOrMsgHelper { private final IUserInfoService userInfoService; - private final YxtCallOrSmsHelper yxtCallOrSmsHelper; + private final YxtClientHelper yxtClientHelper; private final INdWorkNoticeStagingService workNoticeStagingService; private final IDingEmployeeInfoService dingEmployeeInfoService; private final IDingOrganizationService dingOrganizationService; @@ -102,7 +102,7 @@ public class MeetingCallOrMsgHelper { SendSmsContext yxtContent = new SendSmsContext(); yxtContent.setContent(msgContent); yxtContent.setReceiveNumber(info.getMobile()); - yxtCallOrSmsHelper.sendSms(yxtContent); + yxtClientHelper.sendSms(yxtContent); // 发送工作通知 if (info.getAccountId() != null) { WorkNoticeInfo swn = getSendWorkNoticeInfo(info.getAccountId()); @@ -148,7 +148,7 @@ public class MeetingCallOrMsgHelper { } }); notifyService.saveBatch(notifies); - yxtCallOrSmsHelper.sendSms(yxtContents); + yxtClientHelper.sendSms(yxtContents); workNoticeStagingService.addByWorkNotice(workingNotices, MsgTypeEnum.EXPERT_REVIEW); } @@ -164,7 +164,7 @@ public class MeetingCallOrMsgHelper { context.setContent(content); return context; }).collect(Collectors.toList()); - yxtCallOrSmsHelper.sendSms(contexts); + yxtClientHelper.sendSms(contexts); } /** @@ -184,7 +184,7 @@ public class MeetingCallOrMsgHelper { context.setReceiveNumber(w.getMobile()); return context; }); - String submitKey = yxtCallOrSmsHelper.submitCallTask(callContexts); + String submitKey = yxtClientHelper.submitCallTask(callContexts); experts.forEach(w -> w.setSubmitKey(submitKey)); } @@ -200,7 +200,7 @@ public class MeetingCallOrMsgHelper { SendSmsContext yxtContent = new SendSmsContext(); yxtContent.setContent(msgContent); yxtContent.setReceiveNumber(info.getMobile()); - yxtCallOrSmsHelper.sendSms(yxtContent); + yxtClientHelper.sendSms(yxtContent); // 发送工作通知 if (info.getAccountId() != null) { WorkNoticeInfo swn = getSendWorkNoticeInfo(info.getAccountId()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/YxtCallOrSmsHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/YxtCallOrSmsHelper.java deleted file mode 100644 index f8df961..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/YxtCallOrSmsHelper.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.hz.pm.api.meeting.helper; - -import com.ningdatech.yxt.client.YxtClient; -import com.ningdatech.yxt.constants.YxtSmsSignEnum; -import com.ningdatech.yxt.model.cmd.SendSmsCmd; -import com.ningdatech.yxt.model.cmd.SendSmsCmd.SendSmsContext; -import com.ningdatech.yxt.model.cmd.SubmitTaskCallResponse; -import lombok.AllArgsConstructor; -import org.springframework.stereotype.Component; - -import java.util.Collections; -import java.util.List; - -import static com.ningdatech.yxt.model.cmd.SubmitTaskCallCmd.SubmitTaskCallContext; -import static com.ningdatech.yxt.model.cmd.SubmitTaskCallCmd.of; - -/** - *

- * YxtCallOrSmsHelper - *

- * - * @author WendyYang - * @since 23:59 2022/8/31 - */ -@Component -@AllArgsConstructor -public class YxtCallOrSmsHelper { - - private final YxtClient yxtClient; - - public String submitCallTask(List callContexts) { - SubmitTaskCallResponse callResponse = yxtClient.submitTaskCall(of(callContexts)); - return callResponse.getSubmitKey(); - } - - public void sendSms(List smsList) { - SendSmsCmd cmd = new SendSmsCmd(); - cmd.setContextList(smsList); - cmd.setSmsSignEnum(YxtSmsSignEnum.LS_BIG_DATA_BUREAU); - yxtClient.submitSmsTask(cmd); - } - - public void sendSms(SendSmsContext sms) { - sendSms(Collections.singletonList(sms)); - } - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/YxtClientHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/YxtClientHelper.java new file mode 100644 index 0000000..9140730 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/YxtClientHelper.java @@ -0,0 +1,47 @@ +package com.hz.pm.api.meeting.helper; + +import com.ningdatech.yxt.client.YxtClient; +import com.ningdatech.yxt.constants.YxtSmsSignEnum; +import com.ningdatech.yxt.model.cmd.SendSmsCmd; +import com.ningdatech.yxt.model.cmd.SendSmsCmd.SendSmsContext; +import com.ningdatech.yxt.model.cmd.SubmitTaskCallResponse; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.Collections; +import java.util.List; + +import static com.ningdatech.yxt.model.cmd.SubmitTaskCallCmd.SubmitTaskCallContext; +import static com.ningdatech.yxt.model.cmd.SubmitTaskCallCmd.of; + +/** + *

+ * YxtCallOrSmsHelper + *

+ * + * @author WendyYang + * @since 23:59 2022/8/31 + */ +@Component +@AllArgsConstructor +public class YxtClientHelper { + + private final YxtClient yxtClient; + + public String submitCallTask(List callContexts) { + SubmitTaskCallResponse callResponse = yxtClient.submitTaskCall(of(callContexts)); + return callResponse.getSubmitKey(); + } + + public void sendSms(List smsList) { + SendSmsCmd cmd = new SendSmsCmd(); + cmd.setContextList(smsList); + cmd.setSmsSignEnum(YxtSmsSignEnum.LS_BIG_DATA_BUREAU); + yxtClient.submitSmsTask(cmd); + } + + public void sendSms(SendSmsContext sms) { + sendSms(Collections.singletonList(sms)); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java index 04652e8..56a150a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/EarlyWarningManage.java @@ -2,7 +2,7 @@ package com.hz.pm.api.sys.manage; import com.hz.pm.api.common.enumeration.CommonEnum; import com.hz.pm.api.common.helper.UserInfoHelper; -import com.hz.pm.api.meeting.helper.YxtCallOrSmsHelper; +import com.hz.pm.api.meeting.helper.YxtClientHelper; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; import com.hz.pm.api.projectlib.model.enumeration.WarningFlowTypeEnum; @@ -20,6 +20,7 @@ import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; import java.util.Objects; @@ -41,7 +42,7 @@ public class EarlyWarningManage { private final IEarlyWarningRecordsService earlyWarningRecordsService; - private final YxtCallOrSmsHelper yxtCallOrSmsHelper; + private final YxtClientHelper yxtClientHelper; private final INotifyService notifyService; @@ -152,30 +153,32 @@ public class EarlyWarningManage { SendSmsContext context = new SendSmsContext(); context.setReceiveNumber(user.getMobile()); context.setContent(content); - yxtCallOrSmsHelper.sendSms(context); + yxtClientHelper.sendSms(context); } } /** * 催办 * - * @param noticeMethod - * @param noticeContent - * @param adventTimeout - * @param userId - * @param project + * @param noticeMethod \ + * @param noticeContent \ + * @param adventTimeout \ + * @param userId \ + * @param project \ */ + @Transactional(rollbackFor = Exception.class) public void urging(String noticeMethod, String noticeContent, Integer adventTimeout, Integer overTimeout, Integer biz, LocalDateTime startTime, Long userId, Project project, Integer ruleType, Integer noticeType, String path, String batchEmployees, String nodeId) { //1.存入 预警记录 UserFullInfoDTO user = userInfoHelper.getUserFullInfo(userId); - WflowEarlyWarningRecords records = new WflowEarlyWarningRecords(); + WflowEarlyWarningRecords records; String content; switch (WarningRuleTypeEnum.checkByCode(ruleType)) { case PROCESS_WARNING: + records = new WflowEarlyWarningRecords(); if (Objects.isNull(noticeType)) { content = convertContent(noticeContent, project.getProjectName(), InstTypeEnum.getByCode(biz), overTimeout); @@ -189,6 +192,7 @@ public class EarlyWarningManage { records.setRuleType(WarningRuleTypeEnum.PROCESS_WARNING.getCode()); break; case DECLARED_WARNING: + records = new WflowEarlyWarningRecords(); if (Objects.isNull(noticeType)) { content = convertContent(noticeContent, project.getProjectName(), WarningFlowTypeEnum.getByCode(biz), overTimeout); @@ -202,6 +206,7 @@ public class EarlyWarningManage { records.setRuleType(WarningRuleTypeEnum.DECLARED_WARNING.getCode()); break; case OPERATION_WARNING: + records = new WflowEarlyWarningRecords(); if (Objects.isNull(noticeType)) { content = convertContent(noticeContent, project.getProjectName(), WarningOperationTypeEnum.getByCode(biz), overTimeout); @@ -215,6 +220,7 @@ public class EarlyWarningManage { records.setRuleType(WarningRuleTypeEnum.OPERATION_WARNING.getCode()); break; case RENEWAL_FUND: + records = new WflowEarlyWarningRecords(); if (Objects.isNull(noticeType)) { content = convertContent(noticeContent, project.getProjectName(), overTimeout); } else if (noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { @@ -262,7 +268,7 @@ public class EarlyWarningManage { SendSmsContext context = new SendSmsContext(); context.setReceiveNumber(user.getMobile()); context.setContent(content); - yxtCallOrSmsHelper.sendSms(context); + yxtClientHelper.sendSms(context); } } From 141f9f9a65f1b2764e9b0ab7095313c201723029 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 25 Jan 2024 10:09:41 +0800 Subject: [PATCH 36/44] =?UTF-8?q?=E4=BF=A1=E4=BA=A7=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hz/pm/api/external/model/dto/MhUnitDTO.java | 25 +++++- .../external/model/enumeration/MhUnitTypeEnum.java | 90 ++++++++++++++++++++++ .../java/com/hz/pm/api/user/entity/MhUnit.java | 9 +++ .../hz/pm/api/user/manage/SyncMhUserOrgManage.java | 8 +- 4 files changed, 125 insertions(+), 7 deletions(-) create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/external/model/enumeration/MhUnitTypeEnum.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhUnitDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhUnitDTO.java index 66d2426..304b7f8 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhUnitDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhUnitDTO.java @@ -4,7 +4,7 @@ import lombok.Data; /** *

- * OrgDTO-信创组织同步实体 + * 信产组织同步实体 *

* * @author WendyYang @@ -13,12 +13,29 @@ import lombok.Data; @Data public class MhUnitDTO { + /** + * 单位排序号 + */ private String sortNum; - + /** + * 单位ID + */ private Long unitId; - + /** + * 单位名称 + */ private String unitName; - + /** + * 父级单位ID + */ private Long unitPid; + /** + * 单位类型 + */ + private String type; + /** + * 统一社会信用代码 + */ + private String unifiedSocialCreditCode; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/model/enumeration/MhUnitTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/model/enumeration/MhUnitTypeEnum.java new file mode 100644 index 0000000..ddfe5d8 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/model/enumeration/MhUnitTypeEnum.java @@ -0,0 +1,90 @@ +package com.hz.pm.api.external.model.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** + *

+ * MhUnitTypeEnum + *

+ * + * @author WendyYang + * @since 09:11 2024/1/25 + */ +@Getter +@AllArgsConstructor +public enum MhUnitTypeEnum { + + REGION("A", "区域"), + NODE("N", "节点"), + UNIT("U", "单位"), + PFPI("Y", "公益一类事业单位"), + PSPI("S", "公益二类事业单位"), + DEPT("D", "部门"), + OFFICE("O", "科室"), + SASAC("G", "国资委"), + TWO_GOV_COMPANY("C", "一级国企"), + ONE_GOV_COMPANY("E", "二级国企"), + KEY_INDUSTRY("K", "重点行业"), + INDUSTRY_MANAGE_DEPT("Z", "行业主管部门"), + INDUSTRY_COMPANY_UNIT("Q", "行业企事业单位"); + + private final String code; + private final String val; + + //================================================================================================================== + + public static Optional getByCode(String code) { + return Arrays.stream(values()).filter(w -> w.getCode().equals(code)).findFirst(); + } + + private static final List INDUSTRIES; + private static final List GOV_COMPANIES; + + static { + // 行业 + INDUSTRIES = new ArrayList<>(); + INDUSTRIES.add(KEY_INDUSTRY); + INDUSTRIES.add(INDUSTRY_MANAGE_DEPT); + INDUSTRIES.add(INDUSTRY_COMPANY_UNIT); + + // 国资委 + GOV_COMPANIES = new ArrayList<>(); + GOV_COMPANIES.add(SASAC); + GOV_COMPANIES.add(ONE_GOV_COMPANY); + GOV_COMPANIES.add(TWO_GOV_COMPANY); + } + + /** + * 是否是国企 + * + * @return \ + */ + public boolean isGovCompany() { + return GOV_COMPANIES.contains(this); + } + + /** + * 是否是行业 + * + * @return \ + */ + public boolean isIndustry() { + return INDUSTRIES.contains(this); + } + + /** + * 是否是党政 + * + * @return \ + */ + public boolean isPartyOrGov() { + return !isGovCompany() && !isIndustry(); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhUnit.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhUnit.java index ef09dad..0a03057 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhUnit.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/entity/MhUnit.java @@ -33,6 +33,15 @@ public class MhUnit implements Serializable { private Short sort; + /** + * 单位类型 + */ + private String type; + /** + * 统一社会信用代码 + */ + private String unifiedSocialCreditCode; + private LocalDateTime createOn; private LocalDateTime updateOn; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java index b565e8e..afbac6c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java @@ -116,16 +116,18 @@ public class SyncMhUserOrgManage { log.info("未获取到组织信息"); return; } - List updateList = new ArrayList<>(); + List updateUnits = new ArrayList<>(); for (MhUnitDTO org : mhUnits) { MhUnit unit = new MhUnit(); unit.setSort((short) Double.parseDouble(org.getSortNum())); unit.setName(org.getUnitName()); unit.setParentId(org.getUnitPid()); unit.setId(org.getUnitId()); - updateList.add(unit); + unit.setType(org.getType()); + unit.setUnifiedSocialCreditCode(org.getUnifiedSocialCreditCode()); + updateUnits.add(unit); } - mhUnitService.saveOrUpdateBatch(updateList); + mhUnitService.saveOrUpdateBatch(updateUnits); } else { log.error("同步组织信息失败:{}", JSONUtil.toJsonStr(mhRet)); } From f12da29718175f2e61ab8298410d75ef33e7e496 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 25 Jan 2024 10:57:18 +0800 Subject: [PATCH 37/44] =?UTF-8?q?=E5=8D=95=E4=BD=8D=E6=A0=91=E3=80=81?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E7=B1=BB=E5=9E=8B=E3=80=81?= =?UTF-8?q?=E6=9D=A1=E7=BA=BF=E7=AD=89=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/enumeration/MhUnitStripEnum.java | 26 ++++++++++++++++++++++ .../external/model/enumeration/MhUnitTypeEnum.java | 10 +++++++++ .../pm/api/user/helper/impl/MhUnitCacheImpl.java | 14 +++++++++--- .../com/hz/pm/api/user/manage/MhUnitManage.java | 21 ++++++++++++++--- .../hz/pm/api/user/model/dto/MhUnitTreeDTO.java | 6 +++++ .../java/com/hz/pm/api/user/model/dto/UnitDTO.java | 5 +++++ .../com/hz/pm/api/user/model/vo/MhUnitListVO.java | 17 ++++++++++++++ 7 files changed, 93 insertions(+), 6 deletions(-) create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/external/model/enumeration/MhUnitStripEnum.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/model/enumeration/MhUnitStripEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/model/enumeration/MhUnitStripEnum.java new file mode 100644 index 0000000..f753833 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/model/enumeration/MhUnitStripEnum.java @@ -0,0 +1,26 @@ +package com.hz.pm.api.external.model.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + *

+ * MhUnitStripEnum + *

+ * + * @author WendyYang + * @since 10:26 2024/1/25 + */ +@Getter +@AllArgsConstructor +public enum MhUnitStripEnum { + + GOV_COMPANY("国企"), + + PARTY_GOV("党政"), + + INDUSTRY("行业"); + + private final String name; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/model/enumeration/MhUnitTypeEnum.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/model/enumeration/MhUnitTypeEnum.java index ddfe5d8..f3367ef 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/external/model/enumeration/MhUnitTypeEnum.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/model/enumeration/MhUnitTypeEnum.java @@ -87,4 +87,14 @@ public enum MhUnitTypeEnum { return !isGovCompany() && !isIndustry(); } + public MhUnitStripEnum getStrip() { + if (isIndustry()) { + return MhUnitStripEnum.INDUSTRY; + } else if (isGovCompany()) { + return MhUnitStripEnum.GOV_COMPANY; + } else { + return MhUnitStripEnum.PARTY_GOV; + } + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java index 7e7b929..c18d941 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java @@ -7,6 +7,7 @@ import com.github.benmanes.caffeine.cache.CacheLoader; import com.github.benmanes.caffeine.cache.Caffeine; import com.github.benmanes.caffeine.cache.LoadingCache; import com.google.common.collect.Lists; +import com.hz.pm.api.external.model.enumeration.MhUnitTypeEnum; import com.hz.pm.api.user.helper.MhUnitCache; import com.hz.pm.api.user.model.dto.UnitDTO; import com.hz.pm.api.user.model.entity.MhUnit; @@ -18,7 +19,10 @@ import org.checkerframework.checker.nullness.qual.NonNull; import org.springframework.beans.factory.InitializingBean; import org.springframework.stereotype.Component; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; @@ -65,7 +69,9 @@ public class MhUnitCacheImpl implements MhUnitCache, InitializingBean { return null; } putToChildIdMap(unit.getId(), unit.getParentId()); - return BeanUtil.copyProperties(unit, UnitDTO.class); + UnitDTO unitTmp = BeanUtil.copyProperties(unit, UnitDTO.class); + unitTmp.setType(MhUnitTypeEnum.getByCode(unit.getType()).orElse(null)); + return unitTmp; } @Override @@ -83,7 +89,9 @@ public class MhUnitCacheImpl implements MhUnitCache, InitializingBean { } return CollUtils.listToMap(allUnits, MhUnit::getId, w -> { putToChildIdMap(w.getId(), w.getParentId()); - return BeanUtil.copyProperties(w, UnitDTO.class); + UnitDTO unit = BeanUtil.copyProperties(w, UnitDTO.class); + unit.setType(MhUnitTypeEnum.getByCode(w.getType()).orElse(null)); + return unit; }); } }); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java index e398c7f..1c72106 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java @@ -5,10 +5,11 @@ 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.hz.pm.api.common.util.StrUtils; +import com.hz.pm.api.external.model.enumeration.MhUnitTypeEnum; import com.hz.pm.api.user.helper.MhUnitCache; -import com.hz.pm.api.user.model.dto.UnitDTO; import com.hz.pm.api.user.model.dto.MhUnitTreeDTO; import com.hz.pm.api.user.model.dto.MhUnitUserTreeDTO; +import com.hz.pm.api.user.model.dto.UnitDTO; import com.hz.pm.api.user.model.entity.MhUnit; import com.hz.pm.api.user.model.entity.UserInfo; import com.hz.pm.api.user.model.enumeration.UnitUserNodeType; @@ -26,6 +27,7 @@ import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.stream.Collectors; /** *

@@ -45,7 +47,11 @@ public class MhUnitManage { public List getMhUnitTree() { List allUnits = mhUnitCache.all(); - List nodes = BeanUtil.copyToList(allUnits, MhUnitTreeDTO.class); + List nodes = allUnits.stream().map(w -> { + MhUnitTreeDTO node = BeanUtil.copyProperties(w, MhUnitTreeDTO.class); + node.setStrip(node.getStrip()); + return node; + }).collect(Collectors.toList()); return TreeUtil.convertToTree(nodes, 0L); } @@ -56,7 +62,16 @@ public class MhUnitManage { if (page.getTotal() == 0) { return PageVo.empty(); } - List records = BeanUtil.copyToList(page.getRecords(), MhUnitListVO.class); + List records = page.getRecords().stream().map(w -> { + MhUnitListVO unit = BeanUtil.copyProperties(w, MhUnitListVO.class, "type"); + MhUnitTypeEnum.getByCode(w.getType()).ifPresent(type -> { + unit.setType(type); + unit.setStrip(type.getStrip()); + unit.setTypeName(type.getVal()); + unit.setStripName(type.getStrip().getName()); + }); + return unit; + }).collect(Collectors.toList()); return PageVo.of(records, page.getTotal()); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitTreeDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitTreeDTO.java index e838bc6..9d57bd5 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitTreeDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/MhUnitTreeDTO.java @@ -1,5 +1,7 @@ package com.hz.pm.api.user.model.dto; +import com.hz.pm.api.external.model.enumeration.MhUnitStripEnum; +import com.hz.pm.api.external.model.enumeration.MhUnitTypeEnum; import com.ningdatech.basic.model.ITree; import lombok.Data; @@ -21,6 +23,10 @@ public class MhUnitTreeDTO implements ITree { private String name; + private MhUnitTypeEnum type; + + private MhUnitStripEnum strip; + private Long parentId; private Short sort; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/UnitDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/UnitDTO.java index d63f55a..065fbcd 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/UnitDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/dto/UnitDTO.java @@ -1,5 +1,6 @@ package com.hz.pm.api.user.model.dto; +import com.hz.pm.api.external.model.enumeration.MhUnitTypeEnum; import lombok.Data; /** @@ -21,4 +22,8 @@ public class UnitDTO { private Short sort; + private MhUnitTypeEnum type; + + private String unifiedSocialCreditCode; + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/MhUnitListVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/MhUnitListVO.java index beb331f..aff892d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/MhUnitListVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/model/vo/MhUnitListVO.java @@ -1,5 +1,7 @@ package com.hz.pm.api.user.model.vo; +import com.hz.pm.api.external.model.enumeration.MhUnitStripEnum; +import com.hz.pm.api.external.model.enumeration.MhUnitTypeEnum; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -26,4 +28,19 @@ public class MhUnitListVO { @ApiModelProperty("排序号") private Short sort; + @ApiModelProperty("条线") + private MhUnitStripEnum strip; + + @ApiModelProperty("条线名称") + private String stripName; + + @ApiModelProperty("单位类型") + private MhUnitTypeEnum type; + + @ApiModelProperty("单位类型名称") + private String typeName; + + @ApiModelProperty("统一社会信用代码") + private String unifiedSocialCreditCode; + } From f347b749ea94a8f26b35a73afc9018b749792425 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 25 Jan 2024 11:24:24 +0800 Subject: [PATCH 38/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java index c18d941..629a2ad 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/helper/impl/MhUnitCacheImpl.java @@ -69,7 +69,7 @@ public class MhUnitCacheImpl implements MhUnitCache, InitializingBean { return null; } putToChildIdMap(unit.getId(), unit.getParentId()); - UnitDTO unitTmp = BeanUtil.copyProperties(unit, UnitDTO.class); + UnitDTO unitTmp = BeanUtil.copyProperties(unit, UnitDTO.class, "type"); unitTmp.setType(MhUnitTypeEnum.getByCode(unit.getType()).orElse(null)); return unitTmp; } @@ -89,7 +89,7 @@ public class MhUnitCacheImpl implements MhUnitCache, InitializingBean { } return CollUtils.listToMap(allUnits, MhUnit::getId, w -> { putToChildIdMap(w.getId(), w.getParentId()); - UnitDTO unit = BeanUtil.copyProperties(w, UnitDTO.class); + UnitDTO unit = BeanUtil.copyProperties(w, UnitDTO.class, "type"); unit.setType(MhUnitTypeEnum.getByCode(w.getType()).orElse(null)); return unit; }); From 2623055f8e33f1cc776c3a3ea807c313d1695b5d Mon Sep 17 00:00:00 2001 From: WendyYang Date: Fri, 26 Jan 2024 10:34:48 +0800 Subject: [PATCH 39/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BF=A1=E4=BA=A7?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hz-pm-api/src/main/resources/application-dev.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hz-pm-api/src/main/resources/application-dev.yml b/hz-pm-api/src/main/resources/application-dev.yml index 9df7157..9c57ce8 100644 --- a/hz-pm-api/src/main/resources/application-dev.yml +++ b/hz-pm-api/src/main/resources/application-dev.yml @@ -247,10 +247,10 @@ sync-mh-user: sync-mh-company: open: false mh: -# sso: -# client-id: ningda-74a5e5da-3bc3-414a-b9e6-004b7d87e310 -# client-secret: ningda-df746ce4-0c79-4242-b3c7-90ff8630c9742c6727cd-3ae7-48ae-87ad-2b39188ebabd -# api-host: http://10.54.38.13:8081/mh-gateway/auth-single + sso: + client-id: ningda-74a5e5da-3bc3-414a-b9e6-004b7d87e310 + client-secret: ningda-df746ce4-0c79-4242-b3c7-90ff8630c9742c6727cd-3ae7-48ae-87ad-2b39188ebabd + api-host: https://hzszxc.hzswb.cn:8443/test/mh-gateway/auth-single expert-qr-code-url: https://jiema.wwei.cn/uploads/2023/12/28/658d7a3f15f06.jpg file: down-url: https://weixin.hzszxc.hzswb.cn:8443/mh-gateway/oss/oss/previewFileLogin From b4bb2f9aa3599eec61da277215c506b4cd127a77 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Fri, 26 Jan 2024 17:19:44 +0800 Subject: [PATCH 40/44] =?UTF-8?q?=E7=BB=A9=E6=95=88=E8=AF=84=E4=BB=B7?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=8B=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hz/pm/api/common/util/BizUtils.java | 13 --- .../hz/pm/api/datascope/utils/DataScopeUtil.java | 5 +- .../hz/pm/api/external/sms/SmsServiceClient.java | 1 - .../api/performance/manage/AppAppraisalManage.java | 112 ++++++++++----------- .../com/hz/pm/api/portrait/model/vo/TagVO.java | 1 - .../manage/ReviewChecklistManage.java | 13 +-- .../api/projectlib/manage/ApplicationManage.java | 13 ++- .../api/projectlib/model/vo/ProjectDetailVO.java | 4 +- .../api/provincial/controller/TestController.java | 1 - .../hz/pm/api/scheduler/contants/TaskContant.java | 24 +---- .../api/staging/utils/WorkNoticeFlowMapUtil.java | 3 - .../api/sys/controller/SysProcDefController.java | 1 - .../hz/pm/api/user/manage/SyncMhUserOrgManage.java | 1 - .../api/user/security/model/UserInfoDetails.java | 7 ++ 14 files changed, 83 insertions(+), 116 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/BizUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/BizUtils.java index ed70185..0e0686a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/BizUtils.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/BizUtils.java @@ -66,19 +66,6 @@ public class BizUtils { } } - public static boolean getJSONType(String str) { - boolean result = false; - if (StringUtils.isNotBlank(str)) { - str = str.trim(); - if (str.startsWith("{") && str.endsWith("}")) { - result = true; - } else if (str.startsWith("[") && str.endsWith("]")) { - result = true; - } - } - return result; - } - public static String uuid32() { return UUID.randomUUID().toString().replace("-", ""); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/utils/DataScopeUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/utils/DataScopeUtil.java index ac73970..86884a4 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/datascope/utils/DataScopeUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/datascope/utils/DataScopeUtil.java @@ -17,6 +17,9 @@ import java.util.Optional; */ public class DataScopeUtil { + private DataScopeUtil() { + } + public static Optional getCurrentUserDataScope(UserFullInfoDTO user) { if (Objects.isNull(user) || Objects.isNull(user.getRoleCode())) { return Optional.empty(); @@ -28,7 +31,7 @@ public class DataScopeUtil { if (Objects.isNull(user) || Objects.isNull(user.getRoleCode())) { return Optional.empty(); } - return DataScopeContext.getDataScopeHasUserId(user.getRoleCode().name(),user.getUserId()); + return DataScopeContext.getDataScopeHasUserId(user.getRoleCode().name(), user.getUserId()); } public static Optional getCurrentUserDataScope() { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/sms/SmsServiceClient.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/sms/SmsServiceClient.java index d8135d5..6d72074 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/external/sms/SmsServiceClient.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/sms/SmsServiceClient.java @@ -72,7 +72,6 @@ public class SmsServiceClient { * @return */ public SmsReceipt smsReceipt(String result) { - SmsReceipt smsReceipt = null; String refreshUrl = smsUrl + SMS_RECEIPT; HashMap map = new HashMap<>(); map.put("result",result); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/AppAppraisalManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/AppAppraisalManage.java index 8212c95..d34d3af 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/AppAppraisalManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/performance/manage/AppAppraisalManage.java @@ -4,10 +4,11 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.map.MapUtil; +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.plugins.pagination.Page; -import com.google.common.collect.Lists; +import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.performance.constant.ProjectBizConst; import com.hz.pm.api.performance.enumration.AppIndexTypeEnum; import com.hz.pm.api.performance.model.dto.AppAppraisalInfoDTO; @@ -25,11 +26,13 @@ import com.hz.pm.api.user.util.LoginUserUtil; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; import java.time.LocalDateTime; @@ -68,26 +71,25 @@ public class AppAppraisalManage { public PageVo list(PerformanceAppraisalListReq req) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); // 获取当前登录用户的角色列表,只有绩效复评人员才能查看该列表 - List userRoleList = user.getUserRoleList(); - List roleIdList = userRoleList.stream().map(Role::getId).collect(Collectors.toList()); + List roleIdList = user.getRoleIds(); + if (roleIdList.isEmpty()) { + return PageVo.empty(); + } Role role = roleService.getOne(Wrappers.lambdaQuery(Role.class) .eq(Role::getName, ProjectBizConst.REAPPRAISAL_ROLE)); - if (Objects.isNull(role)) { - throw new BizException("登录用户没有复评员角色!"); - } - - // 登录用户不是复评员,不能查看复评计划列表 - if (!roleIdList.contains(role.getId())) { + if (Objects.isNull(role) || !roleIdList.contains(role.getId())) { return PageVo.empty(); } // 获取所有已添加到评价计划中的应用信息 - List paas = performanceAppraisalApplicationService.list(); + Wrapper query = Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) + .select(PerformanceAppraisalApplication::getAppraisalId); + List paas = performanceAppraisalApplicationService.list(query); // 没有包含应用的评价计划 - if (CollUtil.isEmpty(paas)) { + if (paas.isEmpty()) { return PageVo.empty(); } - Set paIds = paas.stream().map(PerformanceAppraisalApplication::getAppraisalId).collect(Collectors.toSet()); + Set paIds = CollUtils.fieldSet(paas, PerformanceAppraisalApplication::getAppraisalId); Page page = req.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) .in(PerformanceAppraisal::getId, paIds) @@ -102,40 +104,42 @@ public class AppAppraisalManage { public PageVo unEvaluateList(Long planId, PerformanceAppraisalListReq req) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); - String employeeCode = user.getEmployeeCode(); + String userIdStr = user.getUserIdStr(); PerformanceAppraisal plan = performanceAppraisalService.getById(planId); VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!"); // 获取分组所在评价计划添加的未完成评价的应用信息 - List paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) + Wrapper query = Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) + .select(PerformanceAppraisalApplication::getApplicationId) .eq(PerformanceAppraisalApplication::getAppraisalId, planId) - .eq(PerformanceAppraisalApplication::getIsCompleteAppraisal, Boolean.FALSE)); + .eq(PerformanceAppraisalApplication::getIsCompleteAppraisal, Boolean.FALSE); + List paas = performanceAppraisalApplicationService.list(query); // 没有当前用户待评价的应用信息 if (CollUtil.isEmpty(paas)) { return PageVo.empty(); } - List ids = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); + List ids = CollUtils.fieldList(paas, PerformanceAppraisalApplication::getApplicationId); // 从绩效评价打分信息表中获取上述绩效评价计划应用的打分信息 - List appraisalScoreInfos = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) - .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, planId)); - List appIds; + Wrapper paaiQuery = Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) + .select(PerformanceAppraisalAppScoreInfo::getApplicationId, PerformanceAppraisalAppScoreInfo::getAppraisalEmployeeCode) + .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, planId); + List appraisalScoreInfos = performanceAppraisalAppScoreInfoService.list(paaiQuery); if (CollUtil.isNotEmpty(appraisalScoreInfos)) { // 筛选出当前登录用户已进行打分的应用信息 - List scoredAppIds = appraisalScoreInfos.stream() - .filter(a -> employeeCode.equals(a.getAppraisalEmployeeCode())) - .map(PerformanceAppraisalAppScoreInfo::getApplicationId) - .collect(Collectors.toList()); - ids.removeAll(scoredAppIds); + appraisalScoreInfos.forEach(w -> { + if (userIdStr.equals(w.getAppraisalEmployeeCode())) { + ids.remove(w.getApplicationId()); + } + }); } - appIds = ids; // 没有当前用户待评价的应用信息 - if (CollUtil.isEmpty(appIds)) { + if (CollUtil.isEmpty(ids)) { return PageVo.empty(); } Page page = req.page(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectApplication.class) - .in(ProjectApplication::getId, appIds) + .in(ProjectApplication::getId, ids) .like(StringUtils.isNotBlank(req.getApplicationName()), ProjectApplication::getApplicationName, req.getApplicationName()); projectApplicationService.page(page, wrapper); @@ -146,12 +150,11 @@ public class AppAppraisalManage { List res = page.getRecords().stream() .map(p -> { PerformanceAppraisalAppVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalAppVO.class); - vo.setCanAppraisal(checkCanAppraisal(employeeCode, p.getId(), planId)); + vo.setCanAppraisal(checkCanAppraisal(userIdStr, p.getId(), planId)); vo.setApplicationName(StringUtils.isNotBlank(p.getApplicationName()) ? p.getApplicationName() : p.getRelatedExistsApplication()); vo.setAppraisalId(planId); return vo; - }) - .collect(Collectors.toList()); + }).collect(Collectors.toList()); return PageVo.of(res, page.getTotal()); } @@ -174,14 +177,15 @@ public class AppAppraisalManage { // 从绩效评价打分信息表中获取上述绩效评价计划应用的打分信息 List appraisalScoreInfos = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, planId)); - List appIds = Lists.newArrayList(); - if (CollUtil.isNotEmpty(appraisalScoreInfos)) { - // 筛选出当前登录用户已进行打分的应用信息 - appIds = appraisalScoreInfos.stream() - .filter(a -> employeeCode.equals(a.getAppraisalEmployeeCode())) - .map(PerformanceAppraisalAppScoreInfo::getApplicationId) - .collect(Collectors.toList()); + + if (CollUtil.isEmpty(appraisalScoreInfos)) { + return PageVo.empty(); } + // 筛选出当前登录用户已进行打分的应用信息 + List appIds = appraisalScoreInfos.stream() + .filter(a -> employeeCode.equals(a.getAppraisalEmployeeCode())) + .map(PerformanceAppraisalAppScoreInfo::getApplicationId) + .collect(Collectors.toList()); // 没有当前用户已评价的应用信息 if (CollUtil.isEmpty(appIds)) { @@ -219,17 +223,16 @@ public class AppAppraisalManage { * @param appraisalId * @return */ - private Boolean checkCanAppraisal(String employeeCode, Long appId, Long appraisalId) { + private boolean checkCanAppraisal(String employeeCode, Long appId, Long appraisalId) { // 从绩效评价应用打分信息表中查询打分人员为当前登录复评用户的打分信息 // 如果没有相关的打分信息,说明是当前登录复评用户是首次评价 - List scoreInfos = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) + Wrapper query = Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) .eq(PerformanceAppraisalAppScoreInfo::getApplicationId, appId) .eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, appraisalId) - .eq(PerformanceAppraisalAppScoreInfo::getAppraisalEmployeeCode, employeeCode)); - if (CollUtil.isEmpty(scoreInfos)) { - return true; - } - return Boolean.FALSE; + .eq(PerformanceAppraisalAppScoreInfo::getAppraisalEmployeeCode, employeeCode) + .last(BizConst.LIMIT_1); + long scoreInfoNum = performanceAppraisalAppScoreInfoService.count(query); + return scoreInfoNum == 0; } @@ -319,9 +322,10 @@ public class AppAppraisalManage { return resVo; } + @Transactional(rollbackFor = Exception.class) public String saveAppraisal(ProjectAppraisalDTO param) { UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); - String employeeCode = userDetail.getEmployeeCode(); + String userIdStr = userDetail.getUserIdStr(); String username = userDetail.getUsername(); Long applicationId = param.getApplicationId(); @@ -344,38 +348,34 @@ public class AppAppraisalManage { // 查出通用、辅助应用指标分数信息 Map indexMap = MapUtil.newHashMap(); if (CollUtil.isNotEmpty(indexIds)) { - List indexList = performanceAppraisalAppIndicatorService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppIndicator.class) - .in(PerformanceAppraisalAppIndicator::getId, indexIds)); + List indexList = performanceAppraisalAppIndicatorService.listByIds(indexIds); if (CollUtil.isEmpty(indexList)) { throw new BizException("通用/辅助评价指标不存在!"); } - indexMap = indexList.stream().collect(Collectors.toMap(PerformanceAppraisalAppIndicator::getId, d -> d)); + indexList.forEach(w -> indexMap.put(w.getId(), w)); } // 查出应用业务指标分数信息 Map businessIndexMap = MapUtil.newHashMap(); if (CollUtil.isNotEmpty(businessIndexIds)) { - List businessIndexList = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) - .in(ProjectCoreBusinessIndicators::getId, businessIndexIds)); + List businessIndexList = projectCoreBusinessIndicatorsService.listByIds(businessIndexIds); if (CollUtil.isEmpty(businessIndexList)) { throw new BizException("核心业务评价指标不存在!"); } - businessIndexMap = businessIndexList.stream().collect(Collectors.toMap(ProjectCoreBusinessIndicators::getId, d -> d)); + businessIndexList.forEach(w -> businessIndexMap.put(w.getId(), w)); } - Map finalIndexMap = indexMap; - Map finalBusinessIndexMap = businessIndexMap; List scoreInfos = appAppraisalInfoList.stream().map(a -> { if (AppIndexTypeEnum.COMMON.getCode().equals(a.getIndexType()) || AppIndexTypeEnum.AUX.getCode().equals(a.getIndexType())) { - PerformanceAppraisalAppIndicator appIndicator = finalIndexMap.get(a.getIndexId()); + PerformanceAppraisalAppIndicator appIndicator = indexMap.get(a.getIndexId()); BigDecimal score = a.getScore(); BigDecimal indexScore = appIndicator.getIndexScore(); if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0) { throw new BizException("评价得分必须大于等于0且小于等于指标分值!"); } } else if (AppIndexTypeEnum.BUSINESS.getCode().equals(a.getIndexType())) { - ProjectCoreBusinessIndicators coreBusinessIndicators = finalBusinessIndexMap.get(a.getIndexId()); + ProjectCoreBusinessIndicators coreBusinessIndicators = businessIndexMap.get(a.getIndexId()); BigDecimal score = a.getScore(); BigDecimal indexScore = coreBusinessIndicators.getScore(); if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0) { @@ -386,7 +386,7 @@ public class AppAppraisalManage { PerformanceAppraisalAppScoreInfo scoreInfo = new PerformanceAppraisalAppScoreInfo(); scoreInfo.setAppraisalScore(a.getScore()); scoreInfo.setAppraisalId(appraisalId); - scoreInfo.setAppraisalEmployeeCode(employeeCode); + scoreInfo.setAppraisalEmployeeCode(userIdStr); scoreInfo.setAppraisalEmployeeName(username); scoreInfo.setApplicationId(applicationId); scoreInfo.setIndexId(a.getIndexId()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/vo/TagVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/vo/TagVO.java index 2b83c93..6f1b652 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/vo/TagVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/portrait/model/vo/TagVO.java @@ -4,7 +4,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.io.Serializable; import java.time.LocalDateTime; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java index 5cd58cc..ed3e245 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ReviewChecklistManage.java @@ -5,23 +5,23 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.NumberUtil; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Assert; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; import com.google.common.collect.Sets; -import com.hz.pm.api.common.model.constant.BizConst; -import com.hz.pm.api.common.model.constant.RegionConst; import com.hz.pm.api.common.helper.RegionCacheHelper; import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.datascope.model.DataScopeDTO; import com.hz.pm.api.datascope.utils.DataScopeUtil; import com.hz.pm.api.projectdeclared.contants.DeclaredProjectConst; import com.hz.pm.api.projectdeclared.model.dto.ReviewChecklistApproveDTO; import com.hz.pm.api.projectdeclared.model.entity.ReviewChecklistApprove; import com.hz.pm.api.projectdeclared.service.IReviewChecklistApproveService; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.helper.ProjectHelper; import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.model.req.ProjectListReq; import com.hz.pm.api.projectlib.model.vo.ProjectReviewCheckListItemVO; import com.hz.pm.api.projectlib.service.IProjectService; @@ -61,8 +61,6 @@ public class ReviewChecklistManage { private final IProjectService projectService; - private final RegionCacheHelper regionCacheHelper; - private final IReviewChecklistApproveService reviewChecklistApproveService; private final UserInfoHelper userInfoHelper; @@ -302,9 +300,8 @@ public class ReviewChecklistManage { public String summary(String projectCode) { // 修改到 项目里去 Project project = projectService.getProjectByCode(projectCode); - VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在"); - VUtils.isTrue(Objects.nonNull(project.getReviewCheckFinish()) && project.getReviewCheckFinish()) - .throwMessage("项目的审查清单已经合并过了!"); + Assert.notNull(project, "项目不存在"); + Assert.isFalse(Boolean.TRUE.equals(project.getReviewCheckFinish()), "项目的审查清单已经合并过了!"); List approves = reviewChecklistApproveService.list(Wrappers.lambdaQuery(ReviewChecklistApprove.class) .eq(ReviewChecklistApprove::getProjectCode, projectCode) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ApplicationManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ApplicationManage.java index 530d916..a935129 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ApplicationManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ApplicationManage.java @@ -8,16 +8,12 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.function.VUtils; -import com.ningdatech.basic.model.ApiResponse; -import com.ningdatech.basic.model.PageVo; import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.util.HmacAuthUtil; -import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.model.dto.ApplicationAppCodeSaveDTO; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.entity.ProjectApplication; +import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; import com.hz.pm.api.projectlib.model.req.ProjectListReq; import com.hz.pm.api.projectlib.model.vo.ProjectApplicationVO; import com.hz.pm.api.projectlib.model.vo.ProjectDetailVO; @@ -25,6 +21,9 @@ import com.hz.pm.api.projectlib.service.IProjectApplicationService; import com.hz.pm.api.projectlib.service.IProjectService; import com.hz.pm.api.user.security.model.UserInfoDetails; import com.hz.pm.api.user.util.LoginUserUtil; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.basic.model.ApiResponse; +import com.ningdatech.basic.model.PageVo; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -109,8 +108,8 @@ public class ApplicationManage { RestTemplate restTemplate = new RestTemplate(); ResponseEntity forEntity = restTemplate.exchange(appUrl, HttpMethod.GET, formEntity, ApiResponse.class); - log.info("forEntity:", JSON.toJSONString(forEntity)); - log.info("body:", forEntity.getBody()); + log.info("forEntity:{}", JSON.toJSONString(forEntity)); + log.info("body:{}", forEntity.getBody()); ApiResponse body = forEntity.getBody(); if (!body.getCode().equals(HttpStatus.OK.value())) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectDetailVO.java index af087fa..09b244e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectDetailVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectDetailVO.java @@ -1,5 +1,7 @@ package com.hz.pm.api.projectlib.model.vo; +import cn.hutool.json.JSONNull; +import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.annotation.JSONField; import com.ningdatech.basic.util.NdDateUtils; @@ -472,7 +474,7 @@ public class ProjectDetailVO { } public void buildDynamicForm(String dynamicFormStr) { - if (StringUtils.isNotBlank(dynamicFormStr) && BizUtils.getJSONType(dynamicFormStr)) { + if (JSONUtil.isTypeJSON(dynamicFormStr)) { this.dynamicForm = JSON.parseObject(dynamicFormStr, Map.class); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/controller/TestController.java b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/controller/TestController.java index 78645e4..4a0d75c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/provincial/controller/TestController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/provincial/controller/TestController.java @@ -8,7 +8,6 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/contants/TaskContant.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/contants/TaskContant.java index 1602eb8..8f44ff0 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/contants/TaskContant.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/contants/TaskContant.java @@ -10,28 +10,7 @@ import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; */ public interface TaskContant { - class Host { - public static final String HOST_ZPF = "LAPTOP-NQGEQP03"; - public static final String HOST_CMM2 = "DESKTOP-KN1L6HL"; - public static final String HOST_CMM = "LAPTOP-PCISPN2O"; - - public static final String HOST_207 = "iZbp13nwyvib53j4j1p2xoZ"; - } - class Wflow { - public static final String DEFAULT_FORM_NAME = "丽水申报项目表单"; - - public static final String[] DEFAULT_PROCESS_LIST = {"单位内部审批流程","项目预审审批流程","部门联合审批流程","建设方案审批流程","验收申报审批流程"}; - - public static final Integer[] DEFAULT_PROCESS_TYPE_LIST = { - ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode(), - ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode(), - ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode(), - ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode(), - ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode(), - ProjectProcessStageEnum.APPLY_DELAY.getCode(), - ProjectProcessStageEnum.APPLY_BORROW.getCode() - }; public static final Integer[] APPLY_PROCESS_TYPE_LIST = { ProjectProcessStageEnum.APPLY_DELAY.getCode(), @@ -39,9 +18,10 @@ public interface TaskContant { }; } - class ProvinceReview{ + class ProvinceReview { public static final String END_NODE_ID = "结束"; public static final String END_STEP = "流程结束"; } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/WorkNoticeFlowMapUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/WorkNoticeFlowMapUtil.java index 0cd33a8..f9e41cb 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/WorkNoticeFlowMapUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/staging/utils/WorkNoticeFlowMapUtil.java @@ -1,9 +1,6 @@ package com.hz.pm.api.staging.utils; import com.google.common.collect.Maps; -import io.swagger.models.auth.In; -import lombok.AllArgsConstructor; -import org.springframework.stereotype.Component; import java.util.Map; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/SysProcDefController.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/SysProcDefController.java index 622ff05..796241b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/SysProcDefController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/controller/SysProcDefController.java @@ -1,6 +1,5 @@ package com.hz.pm.api.sys.controller; -import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.model.constant.RegionConst; import com.ningdatech.basic.model.PageVo; import com.ningdatech.log.annotation.WebLog; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java index c7423a6..c4151d6 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/SyncMhUserOrgManage.java @@ -62,7 +62,6 @@ public class SyncMhUserOrgManage { private final IMhCompanyService mhCompanyService; private final DictionaryCache dictionaryCache; private final IExpertDictionaryService expertDictionaryService; - private final MhUnitCache mhUnitCache; public void syncUsers(LocalDateTime syncDateTime) { MhRetDTO> mhRet = mhApiClient.queryUsers(syncDateTime); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java index 7dd62a9..d4f620a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/model/UserInfoDetails.java @@ -149,4 +149,11 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails { return Boolean.FALSE; } + public List getRoleIds(){ + if (this.userRoleList != null && !this.userRoleList.isEmpty()) { + return this.userRoleList.stream().map(Role::getId).collect(Collectors.toList()); + } + return Collections.emptyList(); + } + } From 64bafbfe56370583cad28bab6d4eb665b1749939 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Tue, 30 Jan 2024 17:23:45 +0800 Subject: [PATCH 41/44] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E4=BC=A0=E5=8F=82=E9=94=99=E8=AF=AF=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/EarlyWarningStatisticsManage.java | 127 ++++++++++----------- .../api/meeting/helper/MeetingCallOrMsgHelper.java | 2 +- .../projectlib/controller/MhProjectController.java | 18 +++ .../pm/api/projectlib/manage/ProjectLibManage.java | 8 +- .../pm/api/projectlib/mapper/MhProjectMapper.java | 16 +++ .../pm/api/projectlib/mapper/MhProjectMapper.xml | 5 + .../mapper/MhProjectSchemaTargetDataMapper.java | 16 +++ .../mapper/MhProjectSchemaTargetDataMapper.xml | 5 + .../pm/api/projectlib/model/entity/MhProject.java | 56 +++++++++ .../model/entity/MhProjectSchemaTargetData.java | 107 +++++++++++++++++ .../service/IMhProjectSchemaTargetDataService.java | 16 +++ .../api/projectlib/service/IMhProjectService.java | 16 +++ .../impl/MhProjectSchemaTargetDataServiceImpl.java | 20 ++++ .../service/impl/MhProjectServiceImpl.java | 20 ++++ .../pm/api/sms/constant/VoiceSmsTemplateConst.java | 16 ++- .../sms/controller/VerificationCodeController.java | 6 +- .../java/com/hz/pm/api/sms/manage/SmsManage.java | 108 ------------------ .../pm/api/sms/manage/VerificationCodeManage.java | 107 +++++++++++++++++ .../com/hz/pm/api/sys/manage/NoticeManage.java | 4 +- .../com/hz/pm/api/sys/utils/EarlyWarningUtil.java | 8 +- .../pm/api/workbench/manage/WorkbenchManage.java | 77 +++++++------ hz-pm-api/src/test/resources/application-dev.yml | 4 +- .../main/java/com/hz/pm/gen/config/CodeGen.java | 4 +- 23 files changed, 528 insertions(+), 238 deletions(-) create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhProjectController.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/MhProjectMapper.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/MhProjectMapper.xml create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/MhProjectSchemaTargetDataMapper.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/MhProjectSchemaTargetDataMapper.xml create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/MhProject.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/MhProjectSchemaTargetData.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IMhProjectSchemaTargetDataService.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IMhProjectService.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/MhProjectSchemaTargetDataServiceImpl.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/MhProjectServiceImpl.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/sms/manage/SmsManage.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/sms/manage/VerificationCodeManage.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/EarlyWarningStatisticsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/EarlyWarningStatisticsManage.java index 122eac8..635b48f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/EarlyWarningStatisticsManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/dashboard/manage/EarlyWarningStatisticsManage.java @@ -60,127 +60,126 @@ public class EarlyWarningStatisticsManage { private final TaskService taskService; private static final List threeYears = Lists.newArrayList(LocalDateTime.now().getYear() - 2, - LocalDateTime.now().getYear() - 1,LocalDateTime.now().getYear()); + LocalDateTime.now().getYear() - 1, LocalDateTime.now().getYear()); public EarlyWarningStatisticsVO statistics(Integer year) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); //项目 List projects = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getNewest, Boolean.TRUE)); + .eq(Project::getNewest, Boolean.TRUE)); EarlyWarningStatisticsVO res = new EarlyWarningStatisticsVO(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(WflowEarlyWarningRecords.class); - EarlyWarningUtil.buildPermissionWrapper(wrapper,user); + EarlyWarningUtil.buildPermissionWrapper(wrapper, user); List records = earlyWarningRecordsService.list(wrapper); //累积总告警数 res.setAccumulatedAlarmsTotal(records.size()); - res.setAccumulatedAlarmsFlow(records.stream().filter(a -> { + res.setAccumulatedAlarmsFlow((int) records.stream().filter(a -> { if (Objects.nonNull(a.getRuleType()) && a.getRuleType().equals(WarningRuleTypeEnum.PROCESS_WARNING.getCode())) { return Boolean.TRUE; } return Boolean.FALSE; - }).collect(Collectors.toList()).size()); - res.setAccumulatedAlarmsFilling(records.stream().filter(a -> { + }).count()); + res.setAccumulatedAlarmsFilling((int) records.stream().filter(a -> { if (Objects.nonNull(a.getRuleType()) && a.getRuleType().equals(WarningRuleTypeEnum.DECLARED_WARNING.getCode())) { return Boolean.TRUE; } return Boolean.FALSE; - }).collect(Collectors.toList()).size()); + }).count()); //近三年 List threeYearsAlarms = Lists.newArrayList(); - for(Integer thisYear : threeYears){ + for (Integer thisYear : threeYears) { DataDTO yearData = new DataDTO(); yearData.setName(thisYear.toString()); - yearData.setNum(records.stream().filter(r -> { - if(Objects.nonNull(r.getWarningTime()) && - thisYear.equals(r.getWarningTime().getYear())){ + yearData.setNum((int) records.stream().filter(r -> { + if (Objects.nonNull(r.getWarningTime()) && + thisYear.equals(r.getWarningTime().getYear())) { return Boolean.TRUE; } return Boolean.FALSE; - }).collect(Collectors.toList()).size()); + }).count()); threeYearsAlarms.add(yearData); } res.setThreeYearsAlarms(threeYearsAlarms); //当前各流程报警数 List alarmsFlowsNow = Lists.newArrayList(); - for(ProjectProcessStageEnum stageEnum : ProjectProcessStageEnum.values()){ + for (ProjectProcessStageEnum stageEnum : ProjectProcessStageEnum.values()) { String processName = stageEnum.getDesc(); Integer processType = stageEnum.getCode(); - alarmsFlowsNow.add(DataDTO.of(processName,computeFlowWarningNow(processType,records))); + alarmsFlowsNow.add(DataDTO.of(processName, computeFlowWarningNow(processType, records))); } res.setAlarmsFlowsNow(alarmsFlowsNow); //当前各填报报警数 List alarmsFillingNow = Lists.newArrayList(); - for(WarningFlowTypeEnum fillingEnum : WarningFlowTypeEnum.values()){ + for (WarningFlowTypeEnum fillingEnum : WarningFlowTypeEnum.values()) { String processName = fillingEnum.getDesc(); - Integer projectStutas = fillingEnum.getProjectStutas(); - alarmsFillingNow.add(DataDTO.of(processName,computeFillingNow(projectStutas,records,projects))); + Integer projectStatus = fillingEnum.getProjectStutas(); + alarmsFillingNow.add(DataDTO.of(processName, computeFillingNow(projectStatus, records, projects))); } res.setAlarmsFillingNow(alarmsFillingNow); //实施预警 List alarmsConstruction = Lists.newArrayList(); - for(WarningNoticeTypeEnum noticeTypeEnum : WarningNoticeTypeEnum.values()){ + for (WarningNoticeTypeEnum noticeTypeEnum : WarningNoticeTypeEnum.values()) { String name = noticeTypeEnum.getDesc(); Integer noticeType = noticeTypeEnum.getCode(); - alarmsConstruction.add(DataDTO.of(name,computeConstruction(noticeType,records,projects))); + alarmsConstruction.add(DataDTO.of(name, computeConstruction(noticeType, records, projects))); } res.setConstructionAlarms(alarmsConstruction); //安全监测 List safetyMonitoring = Lists.newArrayList(); //--1 安全设计 - safetyMonitoring.add(DataDTO.of("安全设计",0)); + safetyMonitoring.add(DataDTO.of("安全设计", 0)); //--2 安全投入低于5% - safetyMonitoring.add(DataDTO.of("安全投入低于5%",computeSafeLessFive(projects))); + safetyMonitoring.add(DataDTO.of("安全投入低于5%", computeSafeLessFive(projects))); //--3 非信创 - safetyMonitoring.add(DataDTO.of("非信创",computeNotXinChuang(projects))); + safetyMonitoring.add(DataDTO.of("非信创", computeNotXinChuang(projects))); //--4 等保未做 - safetyMonitoring.add(DataDTO.of("等保未做",0)); + safetyMonitoring.add(DataDTO.of("等保未做", 0)); //--5 密评未做 - safetyMonitoring.add(DataDTO.of("密评未做",0)); + safetyMonitoring.add(DataDTO.of("密评未做", 0)); res.setSafetyMonitoring(safetyMonitoring); return res; } //计算非信创 private Integer computeNotXinChuang(List projects) { - return projects.stream().filter(p -> StringUtils.isNotBlank(p.getCloudType()) && - !p.getCloudType().contains("2")) - .collect(Collectors.toList()).size(); + return (int) projects.stream().filter(p -> StringUtils.isNotBlank(p.getCloudType()) && + !p.getCloudType().contains("2")).count(); } //计算安全投入低于5% private Integer computeSafeLessFive(List projects) { - return projects.stream().filter(p -> { + return (int) projects.stream().filter(p -> { //计算出 安全投入 BigDecimal rate = new BigDecimal(DashboardProjectManage.convertSafetyInputRate(p)); if (rate.compareTo(new BigDecimal(5)) < 0) { return Boolean.TRUE; } return Boolean.FALSE; - }).collect(Collectors.toList()).size(); + }).count(); } private Integer computeConstruction(Integer noticeType, List records, List projects) { //终验告警 List constructionRecords = records.stream().filter(r -> { - if (Objects.nonNull(r.getRuleType()) && - WarningRuleTypeEnum.OPERATION_WARNING.getCode().equals(r.getRuleType())) { - return Boolean.TRUE; - } - return Boolean.FALSE; - }).filter(r -> Objects.nonNull(r.getNoticeType()) && r.getNoticeType().equals(noticeType) && + if (Objects.nonNull(r.getRuleType()) && + WarningRuleTypeEnum.OPERATION_WARNING.getCode().equals(r.getRuleType())) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).filter(r -> Objects.nonNull(r.getNoticeType()) && r.getNoticeType().equals(noticeType) && WarningOperationTypeEnum.ZHONGYAN.getCode().equals(r.getBiz())) .collect(Collectors.toList()); - if(CollUtil.isEmpty(constructionRecords)){ + if (CollUtil.isEmpty(constructionRecords)) { return 0; } Map> recordsMap = constructionRecords.stream().collect(Collectors.groupingBy( @@ -188,21 +187,21 @@ public class EarlyWarningStatisticsManage { //待终验的项目 List tobeFinalProjects = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && - p.getStatus().equals(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode())){ - return Boolean.TRUE; - } - return Boolean.FALSE; - }).collect(Collectors.toList()); + if (Objects.nonNull(p.getStatus()) && + p.getStatus().equals(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode())) { + return Boolean.TRUE; + } + return Boolean.FALSE; + }).collect(Collectors.toList()); - return tobeFinalProjects.stream().filter(p -> { - if(recordsMap.containsKey(p.getProjectCode())){ + return (int) tobeFinalProjects.stream().filter(p -> { + if (recordsMap.containsKey(p.getProjectCode())) { List warningRecords = recordsMap.get(p.getProjectCode()); //如果是临期的 不能包含有超期的 - if(noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())){ - for(WflowEarlyWarningRecords warningRecord : warningRecords){ - if(Objects.isNull(warningRecord.getNoticeType()) || warningRecord.getNoticeType() - .equals(WarningNoticeTypeEnum.OVER.getCode())){ + if (noticeType.equals(WarningNoticeTypeEnum.ADVENT.getCode())) { + for (WflowEarlyWarningRecords warningRecord : warningRecords) { + if (Objects.isNull(warningRecord.getNoticeType()) || warningRecord.getNoticeType() + .equals(WarningNoticeTypeEnum.OVER.getCode())) { return Boolean.FALSE; } } @@ -211,7 +210,7 @@ public class EarlyWarningStatisticsManage { return Boolean.TRUE; } return Boolean.FALSE; - }).collect(Collectors.toList()).size(); + }).count(); } private Integer computeFillingNow(Integer projectStutas, List records, @@ -223,30 +222,30 @@ public class EarlyWarningStatisticsManage { } return Boolean.FALSE; }).filter(r -> Objects.nonNull(r.getNodeId())).collect(Collectors.toList()); - if(CollUtil.isEmpty(fillingRecords)){ + if (CollUtil.isEmpty(fillingRecords)) { return 0; } Map> warningMap = fillingRecords.stream() .collect(Collectors.groupingBy(WflowEarlyWarningRecords::getProjectCode)); List thisStatusProjects = projects.stream().filter(p -> { - if(Objects.nonNull(p.getStatus()) && p.getStatus().equals(projectStutas)){ + if (Objects.nonNull(p.getStatus()) && p.getStatus().equals(projectStutas)) { return Boolean.TRUE; } return Boolean.FALSE; }).collect(Collectors.toList()); - return thisStatusProjects.stream().filter(p -> { - if(warningMap.containsKey(p.getProjectCode())){ + return (int) thisStatusProjects.stream().filter(p -> { + if (warningMap.containsKey(p.getProjectCode())) { //这个状态有告警 并且 这个项目也是这个类型 return Boolean.TRUE; } return Boolean.FALSE; - }).collect(Collectors.toList()).size(); + }).count(); } //计算某个流程当前正在告警的数量 - private Integer computeFlowWarningNow(Integer processType,List records) { + private Integer computeFlowWarningNow(Integer processType, List records) { List processRecords = records.stream().filter(r -> { if (Objects.nonNull(r.getRuleType()) && WarningRuleTypeEnum.PROCESS_WARNING.getCode().equals(r.getRuleType())) { @@ -254,7 +253,7 @@ public class EarlyWarningStatisticsManage { } return Boolean.FALSE; }).filter(r -> Objects.nonNull(r.getNodeId())).collect(Collectors.toList()); - if(CollUtil.isEmpty(processRecords)){ + if (CollUtil.isEmpty(processRecords)) { return 0; } Map> warningMap = processRecords.stream() @@ -263,7 +262,7 @@ public class EarlyWarningStatisticsManage { //1.先查出 所育 这个类型的 流程 List proInsts = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) .eq(ProjectInst::getInstType, processType)); - if(CollUtil.isEmpty(proInsts)){ + if (CollUtil.isEmpty(proInsts)) { return 0; } //2.再筛选一下 选出 正在审核 未完成的 @@ -275,28 +274,28 @@ public class EarlyWarningStatisticsManage { .orderByProcessInstanceStartTime() .asc() .list(); - if(CollUtil.isEmpty(processes)){ + if (CollUtil.isEmpty(processes)) { return 0; } //查出所有正在执行的工作流任务 List tasks = taskService.createTaskQuery() .list(); - if(CollUtil.isEmpty(tasks)){ + if (CollUtil.isEmpty(tasks)) { return 0; } Map> taskMap = tasks.stream() .collect(Collectors.groupingBy(Task::getProcessInstanceId)); - return processes.stream().filter(p -> { - if(taskMap.containsKey(p.getId())){ + return (int) processes.stream().filter(p -> { + if (taskMap.containsKey(p.getId())) { List tasksThis = taskMap.get(p.getId()); - for(Task taskThis : tasksThis){ + for (Task taskThis : tasksThis) { //说明 当前有告警 - if(warningMap.containsKey(taskThis.getTaskDefinitionKey())){ + if (warningMap.containsKey(taskThis.getTaskDefinitionKey())) { return Boolean.TRUE; } } } return Boolean.FALSE; - }).collect(Collectors.toList()).size(); + }).count(); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingCallOrMsgHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingCallOrMsgHelper.java index 9387640..6ac4826 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingCallOrMsgHelper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingCallOrMsgHelper.java @@ -175,7 +175,7 @@ public class MeetingCallOrMsgHelper { * @author WendyYang **/ public void callExpertByMeeting(Meeting meeting, List experts) { - String voiceContent = String.format(VoiceSmsTemplateConst.OFFLINE_TEMPLATE, + String voiceContent = String.format(VoiceSmsTemplateConst.EXPERT_INVITE, meeting.getHoldOrg(), meeting.getName(), officialTime(meeting.getStartTime()), meeting.getMeetingAddress()); List callContexts = CollUtils.convert(experts, w -> { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhProjectController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhProjectController.java new file mode 100644 index 0000000..7f95f17 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhProjectController.java @@ -0,0 +1,18 @@ +package com.hz.pm.api.projectlib.controller; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.stereotype.Controller; + +/** + *

+ * 前端控制器 + *

+ * + * @author WendyYang + * @since 2024-01-30 + */ +@Controller +@RequestMapping("/api.projectlib/mhProject") +public class MhProjectController { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java index 37bd0d0..55c70ae 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java @@ -542,7 +542,7 @@ public class ProjectLibManage { item.setApproveUsers(buildApproveUsers(w.getInstCode(), map, userMap)); if (user.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.eq(item.getStatus()) && StringUtils.isNotBlank(w.getSuperOrgCode()) - && w.getSuperOrgCode().equals(user.getMhUserId())) { + && w.getSuperOrgCode().equals(user.getMhUnitIdStr())) { item.setCanPreDeclared(Boolean.TRUE); } item.setApprovedAmount(w.getApprovalAmount()); @@ -685,8 +685,7 @@ public class ProjectLibManage { .eq(PaymentPlan::getProjectCode, projectInfo.getProjectCode()) .orderByAsc(PaymentPlan::getPaymentTime)); if (Objects.nonNull(contractVO)) { - contractVO.setPayments(convertPayments(payments, - contractVO.getTotalAmount())); + contractVO.setPayments(convertPayments(payments, contractVO.getTotalAmount())); } //查询实施信息 @@ -775,8 +774,7 @@ public class ProjectLibManage { * @param instanceId * @return */ - public Project saveProjectInDeclared(ProjectDTO projectDto, String instanceId, - Long userId) { + public Project saveProjectInDeclared(ProjectDTO projectDto, String instanceId, Long userId) { Project project = saveProjectNewVersion(projectDto, instanceId, userId, Boolean.FALSE); //保存项目和实例的关系 ProjectInst projectInst = new ProjectInst(); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/MhProjectMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/MhProjectMapper.java new file mode 100644 index 0000000..1c9ca70 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/MhProjectMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectlib.mapper; + +import com.hz.pm.api.projectlib.model.entity.MhProject; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author WendyYang + * @since 2024-01-30 + */ +public interface MhProjectMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/MhProjectMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/MhProjectMapper.xml new file mode 100644 index 0000000..507eaba --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/MhProjectMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/MhProjectSchemaTargetDataMapper.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/MhProjectSchemaTargetDataMapper.java new file mode 100644 index 0000000..b531ad6 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/MhProjectSchemaTargetDataMapper.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectlib.mapper; + +import com.hz.pm.api.projectlib.model.entity.MhProjectSchemaTargetData; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author WendyYang + * @since 2024-01-30 + */ +public interface MhProjectSchemaTargetDataMapper extends BaseMapper { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/MhProjectSchemaTargetDataMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/MhProjectSchemaTargetDataMapper.xml new file mode 100644 index 0000000..d96a70e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/MhProjectSchemaTargetDataMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/MhProject.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/MhProject.java new file mode 100644 index 0000000..bdd955e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/MhProject.java @@ -0,0 +1,56 @@ +package com.hz.pm.api.projectlib.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.math.BigDecimal; + +import com.hz.pm.api.external.model.dto.MhProjectSchemeTargetDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * 信产项目信息 + *

+ * + * @author WendyYang + * @since 2024-01-30 + */ +@Data +@TableName("MH_PROJECT") +@ApiModel(value = "MhProject对象") +public class MhProject implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "ID", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目合规性检查附件") + private String fileId; + + @ApiModelProperty("项目复核附件") + private String fileIdThree; + + @ApiModelProperty("项目评审附件") + private String fileIdTwo; + + @ApiModelProperty("项目评审预算金额") + private BigDecimal money; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("项目总金额") + private BigDecimal totalMoney; + + @ApiModelProperty("单位ID") + private Long unitId; + + @ApiModelProperty("单位名称") + private String unitName; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/MhProjectSchemaTargetData.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/MhProjectSchemaTargetData.java new file mode 100644 index 0000000..f98c7e4 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/MhProjectSchemaTargetData.java @@ -0,0 +1,107 @@ +package com.hz.pm.api.projectlib.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.Date; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.Getter; + +/** + *

+ * 项目关键指标信息 + *

+ * + * @author WendyYang + * @since 2024-01-30 + */ +@Data +@TableName("MH_PROJECT_SCHEMA_TARGET_DATA") +@ApiModel(value = "MhProjectSchemaTargetData对象") +public class MhProjectSchemaTargetData implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.INPUT) + @ApiModelProperty(value = "ID") + private String id; + + /** + * 信产项目ID{@link MhProject#getId()} + */ + private Long mhProjectId; + + @ApiModelProperty(value = "迁移上云信息系统数量") + private int cloudSystemNum; + + @ApiModelProperty(value = "创建时间") + private Date createTime; + + @ApiModelProperty(value = "创建单位") + private Long createUnit; + + @ApiModelProperty(value = "创建人") + private String createUser; + + @ApiModelProperty(value = "附件") + private String fileId; + + @ApiModelProperty(value = "本地部署非涉密信息系统数量") + private Integer fsmLocalSystemNum; + + @ApiModelProperty(value = "更新购置非涉密服务器数量") + private Integer fsmServerNum; + + @ApiModelProperty(value = "更新购置非涉密数据库数量") + private Integer fsmUpdateDbNum; + + @ApiModelProperty(value = "更新购置非涉密中间件数量") + private Integer fsmUpdateMiddleNum; + + @ApiModelProperty(value = "vCPU(核数)") + private Integer hostCpuNum; + + @ApiModelProperty(value = "内存(GB)") + private Integer hostMemoryNum; + + @ApiModelProperty(value = "信创云虚拟主机数量") + private Integer hostNum; + + @ApiModelProperty(value = "存储(GB)") + private Integer hostStoreNum; + + @ApiModelProperty(value = "总投资预算金额(万元)") + private BigDecimal money; + + @ApiModelProperty(value = "本地部署涉密信息系统数量") + private Integer smLocalSystemNum; + + @ApiModelProperty(value = "更新购置涉密服务器数量") + private Integer smServerNum; + + @ApiModelProperty(value = "更新购置涉密数据库数量") + private Integer smUpdateDbNum; + + @ApiModelProperty(value = "更新购置涉密中间件数量") + private Integer smUpdateMiddleNum; + + @ApiModelProperty(value = "更新时间") + private Date updateTime; + + @ApiModelProperty(value = "更新人") + private String updateUser; + + @ApiModelProperty(value = "信创云数据库数量") + private Integer xcDbNum; + + @ApiModelProperty(value = "信创云中间件数量") + private Integer xcMiddleNum; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IMhProjectSchemaTargetDataService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IMhProjectSchemaTargetDataService.java new file mode 100644 index 0000000..204451b --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IMhProjectSchemaTargetDataService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectlib.service; + +import com.hz.pm.api.projectlib.model.entity.MhProjectSchemaTargetData; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author WendyYang + * @since 2024-01-30 + */ +public interface IMhProjectSchemaTargetDataService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IMhProjectService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IMhProjectService.java new file mode 100644 index 0000000..d0aeb3e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IMhProjectService.java @@ -0,0 +1,16 @@ +package com.hz.pm.api.projectlib.service; + +import com.hz.pm.api.projectlib.model.entity.MhProject; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author WendyYang + * @since 2024-01-30 + */ +public interface IMhProjectService extends IService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/MhProjectSchemaTargetDataServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/MhProjectSchemaTargetDataServiceImpl.java new file mode 100644 index 0000000..86946fc --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/MhProjectSchemaTargetDataServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.projectlib.service.impl; + +import com.hz.pm.api.projectlib.model.entity.MhProjectSchemaTargetData; +import com.hz.pm.api.projectlib.mapper.MhProjectSchemaTargetDataMapper; +import com.hz.pm.api.projectlib.service.IMhProjectSchemaTargetDataService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author WendyYang + * @since 2024-01-30 + */ +@Service +public class MhProjectSchemaTargetDataServiceImpl extends ServiceImpl implements IMhProjectSchemaTargetDataService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/MhProjectServiceImpl.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/MhProjectServiceImpl.java new file mode 100644 index 0000000..2cfabd5 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/impl/MhProjectServiceImpl.java @@ -0,0 +1,20 @@ +package com.hz.pm.api.projectlib.service.impl; + +import com.hz.pm.api.projectlib.model.entity.MhProject; +import com.hz.pm.api.projectlib.mapper.MhProjectMapper; +import com.hz.pm.api.projectlib.service.IMhProjectService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author WendyYang + * @since 2024-01-30 + */ +@Service +public class MhProjectServiceImpl extends ServiceImpl implements IMhProjectService { + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sms/constant/VoiceSmsTemplateConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/sms/constant/VoiceSmsTemplateConst.java index cb10245..4ed12e1 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sms/constant/VoiceSmsTemplateConst.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sms/constant/VoiceSmsTemplateConst.java @@ -8,26 +8,24 @@ package com.hz.pm.api.sms.constant; * @author WendyYang * @since 15:10 2023/3/30 */ -public interface VoiceSmsTemplateConst { +public class VoiceSmsTemplateConst { + + private VoiceSmsTemplateConst() { + } /** * 短信登陆验证码 */ - String SMS_COMMON_TEMPLATE = "验证码:%s(有效期为%s分钟),请勿泄露给他人,如非本人操作,请忽略此信息。"; + public static final String SMS_VERIFY_CODE = "验证码:%s(有效期为%s分钟),请勿泄露给他人,如非本人操作,请忽略此信息。"; /** * 社会专家报名 */ - String EXPERT_REGISTER = "专家报名验证码:%s(有效期为%s分钟),请勿泄露给他人,如非本人操作,请忽略此信息。"; + public static final String EXPERT_REGISTER = "专家报名验证码:%s(有效期为%s分钟),请勿泄露给他人,如非本人操作,请忽略此信息。"; /** * 专家电话通知语音模版 */ - String OFFLINE_TEMPLATE = "尊敬的专家您好,%s现邀请您作为专家参加%s会议,会议时间:%s,会议地点:%s。 确认参加请按 1,拒绝参加请按 2。请您选择"; - - /** - * 专家同意参加短信通知模板 - */ - String EXPERT_AGREE_ATTEND_TEMPLATE = ""; + public static final String EXPERT_INVITE = "尊敬的专家您好,%s现邀请您作为专家参加%s会议,会议时间:%s,会议地点:%s。 确认参加请按 1,拒绝参加请按 2。请您选择"; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sms/controller/VerificationCodeController.java b/hz-pm-api/src/main/java/com/hz/pm/api/sms/controller/VerificationCodeController.java index c9f691d..01a0439 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sms/controller/VerificationCodeController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sms/controller/VerificationCodeController.java @@ -2,7 +2,7 @@ package com.hz.pm.api.sms.controller; import com.ningdatech.log.annotation.WebLog; import com.hz.pm.api.sms.constant.VerificationCodeType; -import com.hz.pm.api.sms.manage.SmsManage; +import com.hz.pm.api.sms.manage.VerificationCodeManage; import com.hz.pm.api.sms.model.po.ReqVerificationCodePO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.RestController; public class VerificationCodeController { - private final SmsManage smsManage; + private final VerificationCodeManage verificationCodeManage; /** * 通用的发送验证码功能 @@ -37,7 +37,7 @@ public class VerificationCodeController { @PostMapping(value = "/send") @WebLog("发送验证码") public void send(@Validated @RequestBody ReqVerificationCodePO request) { - smsManage.sendVerificationCode(request); + verificationCodeManage.sendVerificationCode(request); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sms/manage/SmsManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sms/manage/SmsManage.java deleted file mode 100644 index 51eeedc..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sms/manage/SmsManage.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.hz.pm.api.sms.manage; - -import cn.hutool.core.util.PhoneUtil; -import cn.hutool.core.util.RandomUtil; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.cache.model.cache.CacheKey; -import com.ningdatech.cache.repository.CachePlusOps; -import com.hz.pm.api.sms.constant.VerificationCodeType; -import com.hz.pm.api.sms.constant.VoiceSmsTemplateConst; -import com.hz.pm.api.sms.model.dto.VerifyCodeCacheDTO; -import com.hz.pm.api.sms.model.po.ReqVerificationCodePO; -import com.hz.pm.api.sms.utils.DateUtil; -import com.hz.pm.api.sms.utils.SmsRedisKeyUtils; -import com.ningdatech.yxt.client.YxtClient; -import com.ningdatech.yxt.constants.YxtSmsSignEnum; -import com.ningdatech.yxt.model.cmd.SendSmsCmd; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Component; -import org.springframework.util.Assert; - -import java.time.Duration; -import java.time.LocalDateTime; -import java.util.Collections; -import java.util.Objects; - -/** - * @author liuxinxin - * @date 2023/2/16 下午4:42 - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class SmsManage { - - private final YxtClient yxtClient; - private final CachePlusOps cachePlusOps; - - public void sendVerificationCode(ReqVerificationCodePO request) { - Assert.isTrue(PhoneUtil.isMobile(request.getMobile()), "手机号码格式不正确"); - String verificationType = request.getVerificationType(); - VerificationCodeType verificationCodeTypeEnum = VerificationCodeType.of(verificationType); - - // 验证是否被锁定 - String lockKey = SmsRedisKeyUtils.smsSendLockKey(verificationCodeTypeEnum, request.getMobile()); - if (StringUtils.isNotBlank(cachePlusOps.get(lockKey))) { - throw BizException.wrap("今日" + verificationCodeTypeEnum.getDesc() + "的验证码发送次数过多,已被锁定"); - } - // 验证发送间隔 - String cacheKey = SmsRedisKeyUtils.smsCodeVerifyKey(verificationCodeTypeEnum, request.getMobile()); - VerifyCodeCacheDTO preCache = (VerifyCodeCacheDTO) cachePlusOps.get(cacheKey); - if (preCache != null) { - if (LocalDateTime.now().minusMinutes(verificationCodeTypeEnum.getSendInterval()) - .isBefore(preCache.getSendTime())) { - throw BizException.wrap(verificationCodeTypeEnum.getSendInterval() + "分钟之内已发送过验证码,请稍后重试"); - } - } - String code = RandomUtil.randomNumbers(6); - VerifyCodeCacheDTO cache = VerifyCodeCacheDTO.builder() - .code(code) - .sendTime(LocalDateTime.now()) - .mobile(request.getMobile()) - .build(); - - // 创建短信内容 - SendSmsCmd sendSmsCmd = new SendSmsCmd(); - switch (verificationCodeTypeEnum) { - case LOGIN: { - SendSmsCmd.SendSmsContext sendSmsContext = new SendSmsCmd.SendSmsContext(); - sendSmsContext.setReceiveNumber(request.getMobile()); - sendSmsContext.setContent(String.format(VoiceSmsTemplateConst.SMS_COMMON_TEMPLATE, code, verificationCodeTypeEnum.getExpireTime())); - sendSmsCmd.setContextList(Collections.singletonList(sendSmsContext)); - sendSmsCmd.setSmsSignEnum(YxtSmsSignEnum.LS_BIG_DATA_BUREAU); - } - break; - case EXPERT_REGISTER: { - SendSmsCmd.SendSmsContext sendSmsContext = new SendSmsCmd.SendSmsContext(); - sendSmsContext.setReceiveNumber(request.getMobile()); - sendSmsContext.setContent(String.format(VoiceSmsTemplateConst.EXPERT_REGISTER, code, verificationCodeTypeEnum.getExpireTime())); - sendSmsCmd.setContextList(Collections.singletonList(sendSmsContext)); - sendSmsCmd.setSmsSignEnum(YxtSmsSignEnum.LS_BIG_DATA_BUREAU); - } - break; - default: - throw new IllegalArgumentException("非法的短信发送类型"); - } - - // 发送 短信 - yxtClient.submitSmsTask(sendSmsCmd); - log.info("send verificationCode mobile = {},code = {}", request.getMobile(), code); - - cachePlusOps.set(new CacheKey(cacheKey, Duration.ofMinutes(verificationCodeTypeEnum.getExpireTime())), cache); - String limitKey = SmsRedisKeyUtils.smsSendLimitKey(verificationCodeTypeEnum, request.getMobile()); - if (Objects.nonNull(cachePlusOps.get(limitKey))) { - Integer limitCount = cachePlusOps.get(limitKey); - cachePlusOps.set(new CacheKey(limitKey, Duration.ofSeconds(DateUtil.restSecondsFromNowToNoon())), limitCount++); - // 超出单日发送次数之后直接锁定 - if (limitCount >= verificationCodeTypeEnum.getSendTimesByDay().longValue()) { - cachePlusOps.set(new CacheKey(lockKey, Duration.ofSeconds(DateUtil.restSecondsFromNowToNoon())), request.getMobile()); - } - } else { - cachePlusOps.set(new CacheKey(limitKey, Duration.ofSeconds(DateUtil.restSecondsFromNowToNoon())), 1); - } - } - - -} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sms/manage/VerificationCodeManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sms/manage/VerificationCodeManage.java new file mode 100644 index 0000000..f4b046d --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sms/manage/VerificationCodeManage.java @@ -0,0 +1,107 @@ +package com.hz.pm.api.sms.manage; + +import cn.hutool.core.util.PhoneUtil; +import cn.hutool.core.util.RandomUtil; +import com.ningdatech.basic.exception.BizException; +import com.ningdatech.cache.model.cache.CacheKey; +import com.ningdatech.cache.repository.CachePlusOps; +import com.hz.pm.api.sms.constant.VerificationCodeType; +import com.hz.pm.api.sms.constant.VoiceSmsTemplateConst; +import com.hz.pm.api.sms.model.dto.VerifyCodeCacheDTO; +import com.hz.pm.api.sms.model.po.ReqVerificationCodePO; +import com.hz.pm.api.sms.utils.DateUtil; +import com.hz.pm.api.sms.utils.SmsRedisKeyUtils; +import com.ningdatech.yxt.client.YxtClient; +import com.ningdatech.yxt.constants.YxtSmsSignEnum; +import com.ningdatech.yxt.model.cmd.SendSmsCmd; +import com.ningdatech.yxt.model.cmd.SendSmsCmd.SendSmsContext; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; +import org.springframework.util.Assert; + +import java.time.Duration; +import java.time.LocalDateTime; +import java.util.Collections; +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2023/2/16 下午4:42 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class VerificationCodeManage { + + private final YxtClient yxtClient; + private final CachePlusOps cachePlusOps; + + public void sendVerificationCode(ReqVerificationCodePO req) { + Assert.isTrue(PhoneUtil.isMobile(req.getMobile()), "手机号码格式不正确"); + String verificationType = req.getVerificationType(); + VerificationCodeType codeType = VerificationCodeType.of(verificationType); + + // 验证是否被锁定 + String lockKey = SmsRedisKeyUtils.smsSendLockKey(codeType, req.getMobile()); + if (StringUtils.isNotBlank(cachePlusOps.get(lockKey))) { + throw BizException.wrap("今日" + codeType.getDesc() + "的验证码发送次数过多,已被锁定"); + } + // 验证发送间隔 + String cacheKey = SmsRedisKeyUtils.smsCodeVerifyKey(codeType, req.getMobile()); + VerifyCodeCacheDTO preCache = cachePlusOps.get(cacheKey); + if (preCache != null && (LocalDateTime.now().minusMinutes(codeType.getSendInterval()) + .isBefore(preCache.getSendTime()))) { + throw BizException.wrap(codeType.getSendInterval() + "分钟之内已发送过验证码,请稍后重试"); + } + String code = RandomUtil.randomNumbers(6); + VerifyCodeCacheDTO cache = VerifyCodeCacheDTO.builder() + .code(code) + .sendTime(LocalDateTime.now()) + .mobile(req.getMobile()) + .build(); + + // 创建短信内容 + SendSmsCmd sendSmsCmd = new SendSmsCmd(); + switch (codeType) { + case LOGIN: { + SendSmsContext sendSmsCtx = new SendSmsContext(); + sendSmsCtx.setReceiveNumber(req.getMobile()); + sendSmsCtx.setContent(String.format(VoiceSmsTemplateConst.SMS_VERIFY_CODE, code, codeType.getExpireTime())); + sendSmsCmd.setContextList(Collections.singletonList(sendSmsCtx)); + sendSmsCmd.setSmsSignEnum(YxtSmsSignEnum.LS_BIG_DATA_BUREAU); + } + break; + case EXPERT_REGISTER: { + SendSmsContext sendSmsCtx = new SendSmsContext(); + sendSmsCtx.setReceiveNumber(req.getMobile()); + sendSmsCtx.setContent(String.format(VoiceSmsTemplateConst.EXPERT_REGISTER, code, codeType.getExpireTime())); + sendSmsCmd.setContextList(Collections.singletonList(sendSmsCtx)); + sendSmsCmd.setSmsSignEnum(YxtSmsSignEnum.LS_BIG_DATA_BUREAU); + } + break; + default: + throw new IllegalArgumentException("非法的短信发送类型"); + } + + // 发送 短信 + yxtClient.submitSmsTask(sendSmsCmd); + log.info("发送短信验证码:{} -> {}", req.getMobile(), code); + + cachePlusOps.set(new CacheKey(cacheKey, Duration.ofMinutes(codeType.getExpireTime())), cache); + String limitKey = SmsRedisKeyUtils.smsSendLimitKey(codeType, req.getMobile()); + if (Objects.nonNull(cachePlusOps.get(limitKey))) { + Integer limitCount = cachePlusOps.get(limitKey); + cachePlusOps.set(new CacheKey(limitKey, Duration.ofSeconds(DateUtil.restSecondsFromNowToNoon())), limitCount++); + // 超出单日发送次数之后直接锁定 + if (limitCount >= codeType.getSendTimesByDay().longValue()) { + cachePlusOps.set(new CacheKey(lockKey, Duration.ofSeconds(DateUtil.restSecondsFromNowToNoon())), req.getMobile()); + } + } else { + cachePlusOps.set(new CacheKey(limitKey, Duration.ofSeconds(DateUtil.restSecondsFromNowToNoon())), 1); + } + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java index 358de99..b35b385 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/manage/NoticeManage.java @@ -345,7 +345,7 @@ public class NoticeManage { wrapper.and(q3 -> q3.eq(Notice::getPermissions, NoticePermissionsEnum.SUPER.getCode()) .or(q1 -> q1.eq(Notice::getPermissions, NoticePermissionsEnum.REGION.getCode())) .or(q2 -> q2.eq(Notice::getPermissions, NoticePermissionsEnum.ORG.getCode()) - .eq(Notice::getPermissionsValue, user.getMhUnitId()))); + .eq(Notice::getPermissionsValue, user.getMhUnitIdStr()))); } private void permissionsWrapperByEdit(LambdaQueryWrapper wrapper, UserFullInfoDTO user) { @@ -354,7 +354,7 @@ public class NoticeManage { log.info(user.getUsername() + ",超管可以看所有"); } else if (user.getIsOrgAdmin()) { wrapper.eq(Notice::getPermissions, NoticePermissionsEnum.ORG.getCode()) - .eq(Notice::getPermissionsValue, user.getMhUnitId()); + .eq(Notice::getPermissionsValue, user.getMhUnitIdStr()); } else { wrapper.eq(Notice::getCreateOn, user.getUserId()); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sys/utils/EarlyWarningUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/sys/utils/EarlyWarningUtil.java index 1ac5ae8..911bd5f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sys/utils/EarlyWarningUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sys/utils/EarlyWarningUtil.java @@ -23,10 +23,10 @@ public class EarlyWarningUtil { if (user.getSuperAdmin() || user.getRegionAdmin()) { // 可以看所有 } else if (user.getIsOrgAdmin()) { - wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode, user.getMhUnitId()); + wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode, user.getMhUnitIdStr()); } else { //否则都只能看自己单位的 - wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode, user.getMhUnitId()); + wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode, user.getMhUnitIdStr()); } } @@ -36,10 +36,10 @@ public class EarlyWarningUtil { if (user.getSuperAdmin() || user.getRegionAdmin()) { // 可以看所有 } else if (user.getIsOrgAdmin()) { - wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode, user.getMhUnitId()); + wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode, user.getMhUnitIdStr()); } else { //否则都只能看自己单位的 - wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode, user.getMhUnitId()); + wrapper.eq(WflowEarlyWarningRecords::getBuildOrgCode, user.getMhUnitIdStr()); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java index 334923c..e4d114a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java @@ -31,6 +31,7 @@ import com.hz.pm.api.user.security.model.UserFullInfoDTO; import com.hz.pm.api.user.util.LoginUserUtil; import com.hz.pm.api.workbench.converter.WorkbenchConverter; import com.hz.pm.api.workbench.model.vo.WorkbenchVO; +import com.hz.pm.api.workbench.model.vo.WorkbenchVO.WarningStatistics; import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.StrPool; @@ -106,11 +107,11 @@ public class WorkbenchManage { stopWatch.start(); //2.项目统计数据 - res.setOrgDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage - .declaredProjectOrgStatistics(year, user), defaultDeclaredProjectManage.declaredProjectOrgStatistics(year - 1, user))); + res.setOrgDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectOrgStatistics(year, user), + defaultDeclaredProjectManage.declaredProjectOrgStatistics(year - 1, user))); if (userInfoHelper.isSuperOrRegionAdmin(user.getUserId())) { - res.setRegionDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage - .declaredProjectRegionStatistics(year, user), defaultDeclaredProjectManage.declaredProjectRegionStatistics(year - 1, user))); + res.setRegionDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectRegionStatistics(year, user), + defaultDeclaredProjectManage.declaredProjectRegionStatistics(year - 1, user))); } else { res.setRegionDeclared(new WorkbenchVO.DeclaredStatistics()); } @@ -165,7 +166,7 @@ public class WorkbenchManage { //4.1 //累积预警统计 - WorkbenchVO.WarningStatistics accumulate = new WorkbenchVO.WarningStatistics(); + WarningStatistics accumulate = new WarningStatistics(); LambdaQueryWrapper overWrapper = Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) .eq(WflowEarlyWarningRecords::getNoticeType, WarningNoticeTypeEnum.OVER.getCode()) .or(q2 -> q2.isNull(WflowEarlyWarningRecords::getNoticeType)); @@ -195,17 +196,17 @@ public class WorkbenchManage { projectEarlyWarningService.page(adventPage, adventPewWrapper); LambdaQueryWrapper normalWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class) .eq(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.NORMAL.name()) - .eq((user.getIsOrgAdmin() && !user.getSuperAdmin()) || user.notAdmin(), ProjectEarlyWarning::getBuildOrgCode, user.getMhUnitId()); + .eq((user.getIsOrgAdmin() && !user.getSuperAdmin()) || user.notAdmin(), ProjectEarlyWarning::getBuildOrgCode, user.getMhUnitIdStr()); projectEarlyWarningService.page(normalPage, normalWrapper); - WorkbenchVO.WarningStatistics cuurent = new WorkbenchVO.WarningStatistics(); + WarningStatistics current = new WarningStatistics(); long overTotal = overPage.getTotal(); long adventTotal = adventPage.getTotal(); long normalTotal = normalPage.getTotal(); - cuurent.setAdvent((int) adventTotal); - cuurent.setOver((int) overTotal); - cuurent.setNormal((int) normalTotal); - projectEarlyWarning.setCurrent(cuurent); + current.setAdvent((int) adventTotal); + current.setOver((int) overTotal); + current.setNormal((int) normalTotal); + projectEarlyWarning.setCurrent(current); List warningRecords = earlyWarningRecordsService.list(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) .eq((user.getIsOrgAdmin() && !user.getSuperAdmin()) || user.notAdmin(), WflowEarlyWarningRecords::getBuildOrgCode, user.getMhUnitId()) @@ -221,15 +222,15 @@ public class WorkbenchManage { ProjectEarlyWarningVO vo = BeanUtil.copyProperties(o, ProjectEarlyWarningVO.class); //取最新一条预警信息 if (warningMap.containsKey(vo.getProjectCode())) { - WflowEarlyWarningRecords record = warningMap.get(vo.getProjectCode()); - vo.setWarningTime(record.getWarningTime()); - vo.setInstStart(record.getInstStart()); - vo.setWarningUserId(record.getWarningUserId()); - vo.setNoticeMethod(record.getNoticeMethod()); - vo.setNoticeContent(record.getNoticeContent()); - vo.setPath(record.getPath()); - vo.setBatchUserIds(record.getBatchUserIds()); - vo.setRecordId(record.getId()); + WflowEarlyWarningRecords currRecord = warningMap.get(vo.getProjectCode()); + vo.setWarningTime(currRecord.getWarningTime()); + vo.setInstStart(currRecord.getInstStart()); + vo.setWarningUserId(currRecord.getWarningUserId()); + vo.setNoticeMethod(currRecord.getNoticeMethod()); + vo.setNoticeContent(currRecord.getNoticeContent()); + vo.setPath(currRecord.getPath()); + vo.setBatchUserIds(currRecord.getBatchUserIds()); + vo.setRecordId(currRecord.getId()); } else { vo.setWarningTime(now); } @@ -248,15 +249,15 @@ public class WorkbenchManage { ProjectEarlyWarningVO vo = BeanUtil.copyProperties(o, ProjectEarlyWarningVO.class); //取最新一条预警信息 if (warningMap.containsKey(vo.getProjectCode())) { - WflowEarlyWarningRecords record = warningMap.get(vo.getProjectCode()); - vo.setWarningTime(record.getWarningTime()); - vo.setInstStart(record.getInstStart()); - vo.setWarningUserId(record.getWarningUserId()); - vo.setNoticeMethod(record.getNoticeMethod()); - vo.setNoticeContent(record.getNoticeContent()); - vo.setPath(record.getPath()); - vo.setBatchUserIds(record.getBatchUserIds()); - vo.setRecordId(record.getId()); + WflowEarlyWarningRecords currRecord = warningMap.get(vo.getProjectCode()); + vo.setWarningTime(currRecord.getWarningTime()); + vo.setInstStart(currRecord.getInstStart()); + vo.setWarningUserId(currRecord.getWarningUserId()); + vo.setNoticeMethod(currRecord.getNoticeMethod()); + vo.setNoticeContent(currRecord.getNoticeContent()); + vo.setPath(currRecord.getPath()); + vo.setBatchUserIds(currRecord.getBatchUserIds()); + vo.setRecordId(currRecord.getId()); } else { vo.setWarningTime(now); } @@ -274,15 +275,15 @@ public class WorkbenchManage { ProjectEarlyWarningVO vo = BeanUtil.copyProperties(o, ProjectEarlyWarningVO.class); //取最新一条预警信息 if (warningMap.containsKey(vo.getProjectCode())) { - WflowEarlyWarningRecords record = warningMap.get(vo.getProjectCode()); - vo.setWarningTime(record.getWarningTime()); - vo.setInstStart(record.getInstStart()); - vo.setWarningUserId(record.getWarningUserId()); - vo.setNoticeMethod(record.getNoticeMethod()); - vo.setNoticeContent(record.getNoticeContent()); - vo.setPath(record.getPath()); - vo.setBatchUserIds(record.getBatchUserIds()); - vo.setRecordId(record.getId()); + WflowEarlyWarningRecords currRecord = warningMap.get(vo.getProjectCode()); + vo.setWarningTime(currRecord.getWarningTime()); + vo.setInstStart(currRecord.getInstStart()); + vo.setWarningUserId(currRecord.getWarningUserId()); + vo.setNoticeMethod(currRecord.getNoticeMethod()); + vo.setNoticeContent(currRecord.getNoticeContent()); + vo.setPath(currRecord.getPath()); + vo.setBatchUserIds(currRecord.getBatchUserIds()); + vo.setRecordId(currRecord.getId()); } vo.setProjectName(projectNameMap.get(o.getProjectCode())); return vo; diff --git a/hz-pm-api/src/test/resources/application-dev.yml b/hz-pm-api/src/test/resources/application-dev.yml index ff2b36b..2ed50c3 100644 --- a/hz-pm-api/src/test/resources/application-dev.yml +++ b/hz-pm-api/src/test/resources/application-dev.yml @@ -23,7 +23,7 @@ spring: max-active: 200 max-idle: 500 min-idle: 8 - max-wait: 10000 + max-wait: 60000 application: name: hzpm jackson: @@ -61,7 +61,7 @@ spring: # 配置从池返回的连接的默认自动提交行为。默认值为true。 auto-commit: true # 开启连接监测泄露 - leak-detection-threshold: 5000 + leak-detection-threshold: 30000 # 测试连接数据库 connection-test-query: SELECT 1 #设置上传 单个文件的大小 diff --git a/hz-pm-gen/src/main/java/com/hz/pm/gen/config/CodeGen.java b/hz-pm-gen/src/main/java/com/hz/pm/gen/config/CodeGen.java index 02f815e..272bc4a 100644 --- a/hz-pm-gen/src/main/java/com/hz/pm/gen/config/CodeGen.java +++ b/hz-pm-gen/src/main/java/com/hz/pm/gen/config/CodeGen.java @@ -18,7 +18,7 @@ public class CodeGen { private static final String PATH_YYD = "/Users/wendy/coding/java/hz-project-management/hz-pm-api/src/main/java"; - private static final String URL = "jdbc:dm://47.98.125.47:5236/HZ_PROJECT_MANAGEMENT?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8"; + private static final String URL = "jdbc:dm://47.98.125.47:5236/HZ_PROJECT_MANAGEMENT1?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8"; private static final String USER_NAME = "SYSDBA"; private static final String PASSWORD = "SYSDBA"; @@ -55,7 +55,7 @@ public class CodeGen { } public static void main(String[] args) { - generate("WendyYang", "meeting", PATH_YYD, "meeting_settings"); + generate("WendyYang", "projectlib", PATH_YYD, "mh_project_schema_target_data"); } } From ba84c5cf33c131013257d849257962e74403a499 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Tue, 30 Jan 2024 20:15:04 +0800 Subject: [PATCH 42/44] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=AB=8B=E9=A1=B9?= =?UTF-8?q?=E5=A4=87=E6=A1=88=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../projectlib/controller/MhProjectController.java | 26 +++++- .../pm/api/projectlib/manage/MhProjectManage.java | 96 ++++++++++++++++++++++ .../pm/api/projectlib/model/entity/MhProject.java | 6 ++ .../model/req/DeclaredProjectListReq.java | 32 ++++++++ .../projectlib/model/vo/DeclaredProjectListVO.java | 47 +++++++++++ .../pm/api/projectlib/service/IProjectService.java | 10 +++ 6 files changed, 214 insertions(+), 3 deletions(-) create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/MhProjectManage.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/DeclaredProjectListReq.java create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/DeclaredProjectListVO.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhProjectController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhProjectController.java index 7f95f17..7f565d9 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhProjectController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhProjectController.java @@ -1,18 +1,38 @@ package com.hz.pm.api.projectlib.controller; +import com.hz.pm.api.projectlib.manage.MhProjectManage; +import com.hz.pm.api.projectlib.model.req.DeclaredProjectListReq; +import com.hz.pm.api.projectlib.model.vo.DeclaredProjectListVO; +import com.ningdatech.basic.model.PageVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RestController; /** *

- * 前端控制器 + * 前端控制器 *

* * @author WendyYang * @since 2024-01-30 */ -@Controller -@RequestMapping("/api.projectlib/mhProject") +@Api(tags = "信产项目(立项备案)列表") +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/v1/mh/project") public class MhProjectController { + private final MhProjectManage mhProjectManage; + + @ApiOperation("立项备案列表") + @GetMapping("/pageDeclaredProject") + public PageVo pageDeclaredProject(DeclaredProjectListReq req) { + return mhProjectManage.pageDeclaredProject(req); + } + + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/MhProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/MhProjectManage.java new file mode 100644 index 0000000..e31d27a --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/MhProjectManage.java @@ -0,0 +1,96 @@ +package com.hz.pm.api.projectlib.manage; + +import cn.hutool.core.util.StrUtil; +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.hz.pm.api.projectlib.model.entity.MhProject; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.req.DeclaredProjectListReq; +import com.hz.pm.api.projectlib.model.vo.DeclaredProjectListVO; +import com.hz.pm.api.projectlib.service.IMhProjectService; +import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.user.security.model.UserInfoDetails; +import com.hz.pm.api.user.util.LoginUserUtil; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + *

+ * MhProjectManage + *

+ * + * @author WendyYang + * @since 19:06 2024/1/30 + */ +@Component +@RequiredArgsConstructor +public class MhProjectManage { + + private final IMhProjectService mhProjectService; + private final IProjectService projectService; + + private LambdaQueryWrapper buildQuery(DeclaredProjectListReq req) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(MhProject.class) + .like(StrUtil.isNotBlank(req.getProjectName()), MhProject::getProjectName, req.getProjectName()) + .like(StrUtil.isNotBlank(req.getDeclaredUnit()), MhProject::getUnitName, req.getDeclaredUnit()); + if (req.getBudgetYear() != null) { + LocalDateTime startTime = LocalDate.of(req.getBudgetYear(), 1, 1).atStartOfDay(); + LocalDateTime endTime = startTime.plusYears(1); + query.ge(MhProject::getCreateTime, startTime); + query.lt(MhProject::getCreateTime, endTime); + } + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + if (!user.getSuperAdmin() && !user.getRegionAdmin()) { + query.eq(MhProject::getUnitId, user.getMhUnitId()); + } + return query; + } + + public PageVo pageDeclaredProject(DeclaredProjectListReq req) { + LambdaQueryWrapper query = buildQuery(req); + Page page = mhProjectService.page(req.page(), query); + if (page.getTotal() == 0) { + return PageVo.empty(); + } + List records = page.getRecords(); + List projectCodes = CollUtils.fieldList(records, MhProject::getProjectCode); + Map projectMap; + if (!projectCodes.isEmpty()) { + List projects = projectService.listNewestByProjectCodes(projectCodes); + projectMap = CollUtils.listToMap(projects, Project::getProjectCode); + } else { + projectMap = Collections.emptyMap(); + } + List data = records.stream().map(w -> { + DeclaredProjectListVO item = new DeclaredProjectListVO(); + item.setMhProjectId(w.getId()); + Project project = projectMap.get(w.getProjectCode()); + if (project == null) { + item.setStatus(null); + item.setStage(null); + } else { + item.setStatus(project.getStatus()); + item.setStage(project.getStage()); + item.setBizDomain(project.getBizDomain()); + } + item.setProjectCode(w.getProjectCode()); + item.setProjectName(w.getProjectName()); + item.setDeclaredAmount(w.getTotalMoney()); + item.setCreateTime(w.getCreateTime()); + return item; + }).collect(Collectors.toList()); + return PageVo.of(data, page.getTotal()); + } + + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/MhProject.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/MhProject.java index bdd955e..790672d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/MhProject.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/MhProject.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import java.io.Serializable; import java.math.BigDecimal; +import java.time.LocalDateTime; import com.hz.pm.api.external.model.dto.MhProjectSchemeTargetDTO; import io.swagger.annotations.ApiModel; @@ -53,4 +54,9 @@ public class MhProject implements Serializable { @ApiModelProperty("单位名称") private String unitName; + @ApiModelProperty("项目编码") + private String projectCode; + + private LocalDateTime createTime; + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/DeclaredProjectListReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/DeclaredProjectListReq.java new file mode 100644 index 0000000..ab5d047 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/DeclaredProjectListReq.java @@ -0,0 +1,32 @@ +package com.hz.pm.api.projectlib.model.req; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * DeclaredProjectListReq + *

+ * + * @author WendyYang + * @since 19:13 2024/1/30 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DeclaredProjectListReq extends PagePo { + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("申报单位") + private String declaredUnit; + + @ApiModelProperty("项目类型") + private String projectType; + + @ApiModelProperty("预算年度") + private Integer budgetYear; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/DeclaredProjectListVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/DeclaredProjectListVO.java new file mode 100644 index 0000000..cece008 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/DeclaredProjectListVO.java @@ -0,0 +1,47 @@ +package com.hz.pm.api.projectlib.model.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * DeclaredProjectList + *

+ * + * @author WendyYang + * @since 19:07 2024/1/30 + */ +@Data +public class DeclaredProjectListVO { + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("申报单位") + private String declaredUnit; + + @ApiModelProperty("领域") + private Integer bizDomain; + + @ApiModelProperty("项目申报金额(万元)") + private BigDecimal declaredAmount; + + @ApiModelProperty("项目阶段") + private Integer stage; + + @ApiModelProperty("项目状态") + private Integer status; + + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + @ApiModelProperty("项目名称") + private String projectCode; + + @ApiModelProperty("ID") + private Long mhProjectId; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectService.java index cd4758d..560fa06 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IProjectService.java @@ -1,5 +1,7 @@ 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.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -8,6 +10,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.hz.pm.api.projectlib.model.po.ProjectPO; import com.hz.pm.api.projectlib.model.req.ProjectListReq; +import java.util.Collection; import java.util.List; /** @@ -43,4 +46,11 @@ public interface IProjectService extends IService { update(wrapper); } + default List listNewestByProjectCodes(Collection projectCode){ + Wrapper query = Wrappers.lambdaQuery(Project.class) + .eq(Project::getNewest, Boolean.TRUE) + .in(Project::getProjectCode, projectCode); + return list(query); + } + } From 6fb0bc9bcf02910cdda8d8efcfc01548aaea753a Mon Sep 17 00:00:00 2001 From: WendyYang Date: Wed, 31 Jan 2024 09:14:29 +0800 Subject: [PATCH 43/44] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BF=A1=E4=BA=A7?= =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../projectlib/controller/MhProjectController.java | 9 ++++- .../pm/api/projectlib/manage/MhProjectManage.java | 31 ++++++++++++++++ .../projectlib/model/vo/MhProjectBaseInfoVO.java | 43 ++++++++++++++++++++++ .../service/IMhProjectSchemaTargetDataService.java | 11 ++++++ 4 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/MhProjectBaseInfoVO.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhProjectController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhProjectController.java index 7f565d9..ce4aa67 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhProjectController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/MhProjectController.java @@ -3,13 +3,14 @@ package com.hz.pm.api.projectlib.controller; import com.hz.pm.api.projectlib.manage.MhProjectManage; 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.ningdatech.basic.model.PageVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RestController; /** @@ -34,5 +35,11 @@ public class MhProjectController { return mhProjectManage.pageDeclaredProject(req); } + @ApiOperation("信产项目基本信息") + @GetMapping("/baseInfo/{mhProjectId}") + public MhProjectBaseInfoVO projectBaseInfo(@PathVariable Long mhProjectId) { + return mhProjectManage.getProjectBaseInfo(mhProjectId); + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/MhProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/MhProjectManage.java index e31d27a..7da64a7 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/MhProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/MhProjectManage.java @@ -5,13 +5,19 @@ 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.hz.pm.api.projectlib.model.entity.MhProject; +import com.hz.pm.api.projectlib.model.entity.MhProjectSchemaTargetData; import com.hz.pm.api.projectlib.model.entity.Project; 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.IMhProjectSchemaTargetDataService; import com.hz.pm.api.projectlib.service.IMhProjectService; import com.hz.pm.api.projectlib.service.IProjectService; +import com.hz.pm.api.user.helper.MhUnitCache; +import com.hz.pm.api.user.model.dto.UnitDTO; import com.hz.pm.api.user.security.model.UserInfoDetails; import com.hz.pm.api.user.util.LoginUserUtil; +import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; import lombok.RequiredArgsConstructor; @@ -37,7 +43,9 @@ import java.util.stream.Collectors; public class MhProjectManage { private final IMhProjectService mhProjectService; + private final IMhProjectSchemaTargetDataService mhProjectSchemaTargetDataService; private final IProjectService projectService; + private final MhUnitCache mhUnitCache; private LambdaQueryWrapper buildQuery(DeclaredProjectListReq req) { LambdaQueryWrapper query = Wrappers.lambdaQuery(MhProject.class) @@ -92,5 +100,28 @@ public class MhProjectManage { return PageVo.of(data, page.getTotal()); } + public MhProjectBaseInfoVO getProjectBaseInfo(Long mhProjectId) { + MhProject mhProject = mhProjectService.getById(mhProjectId); + if (mhProject == null) { + throw BizException.wrap("项目不存在"); + } + MhProjectBaseInfoVO detail = new MhProjectBaseInfoVO(); + detail.setMhProjectId(mhProject.getId()); + detail.setProjectName(mhProject.getProjectName()); + detail.setDeclaredUnit(mhProject.getUnitName()); + detail.setDeclaredUnitId(mhProject.getUnitId()); + detail.setTotalInvestAmount(mhProject.getTotalMoney()); + detail.setReviewInvestAmount(mhProject.getMoney()); + MhProjectSchemaTargetData schemaTargetData = mhProjectSchemaTargetDataService.getByMhProjectId(mhProjectId); + if (schemaTargetData != null) { + detail.setTotalInvestBudgetAmount(schemaTargetData.getMoney()); + } + UnitDTO unit = mhUnitCache.getById(mhProject.getId()); + if (unit != null) { + detail.setDeclaredUnitUnifiedSocialCreditCode(unit.getUnifiedSocialCreditCode()); + } + return detail; + } + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/MhProjectBaseInfoVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/MhProjectBaseInfoVO.java new file mode 100644 index 0000000..f40d771 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/MhProjectBaseInfoVO.java @@ -0,0 +1,43 @@ +package com.hz.pm.api.projectlib.model.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + *

+ * MhProjectDetailVO + *

+ * + * @author WendyYang + * @since 00:39 2024/1/31 + */ +@Data +public class MhProjectBaseInfoVO { + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("申报单位") + private String declaredUnit; + + @ApiModelProperty("申报单位ID") + private Long declaredUnitId; + + @ApiModelProperty("申报单位社会信用代码") + private String declaredUnitUnifiedSocialCreditCode; + + @ApiModelProperty("总投资") + private BigDecimal totalInvestAmount; + + @ApiModelProperty("总投资预算金额") + private BigDecimal totalInvestBudgetAmount; + + @ApiModelProperty("评审预算金额") + private BigDecimal reviewInvestAmount; + + @ApiModelProperty("id") + private Long mhProjectId; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IMhProjectSchemaTargetDataService.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IMhProjectSchemaTargetDataService.java index 204451b..d77410b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IMhProjectSchemaTargetDataService.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/service/IMhProjectSchemaTargetDataService.java @@ -1,5 +1,9 @@ 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.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.projectlib.model.entity.MhProjectSchemaTargetData; import com.baomidou.mybatisplus.extension.service.IService; @@ -13,4 +17,11 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface IMhProjectSchemaTargetDataService extends IService { + default MhProjectSchemaTargetData getByMhProjectId(Long mhProjectId){ + Wrapper query = Wrappers.lambdaQuery(MhProjectSchemaTargetData.class) + .eq(MhProjectSchemaTargetData::getMhProjectId,mhProjectId) + .last(BizConst.LIMIT_1); + return getOne(query); + } + } From ef5d830f76ff15b892e8a8ae4c4685323806f3fa Mon Sep 17 00:00:00 2001 From: WendyYang Date: Wed, 31 Jan 2024 09:32:13 +0800 Subject: [PATCH 44/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=AB=8B=E9=A1=B9?= =?UTF-8?q?=E5=A4=87=E6=A1=88=E6=9F=A5=E8=AF=A2=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hz/pm/api/projectlib/manage/MhProjectManage.java | 13 +++++-------- .../pm/api/projectlib/model/req/DeclaredProjectListReq.java | 10 ++++++---- .../pm/api/projectlib/model/vo/DeclaredProjectListVO.java | 3 --- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/MhProjectManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/MhProjectManage.java index 7da64a7..5f93fed 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/MhProjectManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/MhProjectManage.java @@ -23,8 +23,6 @@ import com.ningdatech.basic.util.CollUtils; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; -import java.time.LocalDate; -import java.time.LocalDateTime; import java.util.Collections; import java.util.List; import java.util.Map; @@ -51,11 +49,11 @@ public class MhProjectManage { LambdaQueryWrapper query = Wrappers.lambdaQuery(MhProject.class) .like(StrUtil.isNotBlank(req.getProjectName()), MhProject::getProjectName, req.getProjectName()) .like(StrUtil.isNotBlank(req.getDeclaredUnit()), MhProject::getUnitName, req.getDeclaredUnit()); - if (req.getBudgetYear() != null) { - LocalDateTime startTime = LocalDate.of(req.getBudgetYear(), 1, 1).atStartOfDay(); - LocalDateTime endTime = startTime.plusYears(1); - query.ge(MhProject::getCreateTime, startTime); - query.lt(MhProject::getCreateTime, endTime); + if (req.getCreateDateMin() != null) { + query.ge(MhProject::getCreateTime, req.getCreateDateMin()); + } + if (req.getCreateDateMax() != null) { + query.lt(MhProject::getCreateTime, req.getCreateDateMax().minusDays(1)); } UserInfoDetails user = LoginUserUtil.loginUserDetail(); if (!user.getSuperAdmin() && !user.getRegionAdmin()) { @@ -89,7 +87,6 @@ public class MhProjectManage { } else { item.setStatus(project.getStatus()); item.setStage(project.getStage()); - item.setBizDomain(project.getBizDomain()); } item.setProjectCode(w.getProjectCode()); item.setProjectName(w.getProjectName()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/DeclaredProjectListReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/DeclaredProjectListReq.java index ab5d047..b65c41c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/DeclaredProjectListReq.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/req/DeclaredProjectListReq.java @@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; +import java.time.LocalDate; + /** *

* DeclaredProjectListReq @@ -23,10 +25,10 @@ public class DeclaredProjectListReq extends PagePo { @ApiModelProperty("申报单位") private String declaredUnit; - @ApiModelProperty("项目类型") - private String projectType; + @ApiModelProperty("创建时间(开始)") + private LocalDate createDateMin; - @ApiModelProperty("预算年度") - private Integer budgetYear; + @ApiModelProperty("创建时间(结束)") + private LocalDate createDateMax; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/DeclaredProjectListVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/DeclaredProjectListVO.java index cece008..a35368f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/DeclaredProjectListVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/DeclaredProjectListVO.java @@ -23,9 +23,6 @@ public class DeclaredProjectListVO { @ApiModelProperty("申报单位") private String declaredUnit; - @ApiModelProperty("领域") - private Integer bizDomain; - @ApiModelProperty("项目申报金额(万元)") private BigDecimal declaredAmount;