From a234edef01943ab863a8454876467111b81ea970 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Tue, 11 Jul 2023 10:16:14 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BD=92=E9=9B=86=20?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2debug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ding/constants/DingOrganizationContant.java | 13 +++ .../pmapi/ding/task/EmployeeBatchGetTask.java | 5 +- .../organization/constants/ProcDefContant.java | 13 +++ .../organization/controller/ProcDefController.java | 10 ++ .../pmapi/organization/manage/ProcDefManage.java | 103 +++++++++++++++++++++ .../projectlib/manage/ProjectCollectionManage.java | 2 +- .../scheduler/task/BatchUpdateEmployeeTask.java | 3 +- .../pmapi/sys/controller/SysProcDefController.java | 9 +- .../pmapi/user/manage/UserInfoManage.java | 3 +- 9 files changed, 148 insertions(+), 13 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/ding/constants/DingOrganizationContant.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/organization/constants/ProcDefContant.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/ProcDefManage.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/ding/constants/DingOrganizationContant.java b/pmapi/src/main/java/com/ningdatech/pmapi/ding/constants/DingOrganizationContant.java new file mode 100644 index 0000000..cfc755d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/ding/constants/DingOrganizationContant.java @@ -0,0 +1,13 @@ +package com.ningdatech.pmapi.ding.constants; + +/** + * @Classname DingOrganizationContant + * @Description + * @Date 2023/7/10 17:58 + * @Author PoffyZhang + */ +public interface DingOrganizationContant { + + public static final String UNIT_TYPE = "GOV_UNIT"; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java index 017829a..c8a1eb8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java @@ -8,6 +8,7 @@ import com.google.common.collect.Lists; import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.GenericResult; import com.ningdatech.pmapi.common.constant.BizConst; +import com.ningdatech.pmapi.ding.constants.DingOrganizationContant; import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; import com.ningdatech.pmapi.organization.model.entity.DingOrganization; import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; @@ -72,7 +73,7 @@ public class EmployeeBatchGetTask { public void batchGetEmployeeTask() { // 获取所有的组织列表用户获取组织下的 用户信息(暂时 只查 单位的类型) List dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getTypeCode,"GOV_UNIT")); + .eq(DingOrganization::getTypeCode, DingOrganizationContant.UNIT_TYPE)); log.info("所有待更新员工的单位数:{}",dingOrganizationList.size()); if (CollUtil.isNotEmpty(dingOrganizationList)) { //记录任务 单位数 @@ -271,7 +272,7 @@ public class EmployeeBatchGetTask { */ public void batchGetEmployeeTaskByRegionCode(String regionCode) { List units = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getTypeCode, "GOV_UNIT") + .eq(DingOrganization::getTypeCode, DingOrganizationContant.UNIT_TYPE) .eq(DingOrganization::getDivisionCode, regionCode)); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/constants/ProcDefContant.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/constants/ProcDefContant.java new file mode 100644 index 0000000..8372439 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/constants/ProcDefContant.java @@ -0,0 +1,13 @@ +package com.ningdatech.pmapi.organization.constants; + +/** + * @Classname ProcDefContant + * @Description + * @Date 2023/7/11 9:35 + * @Author PoffyZhang + */ +public interface ProcDefContant { + + public final static String MODELS_ID_PREFIX = "pd"; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/ProcDefController.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/ProcDefController.java index abe55a3..cfd33c0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/ProcDefController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/ProcDefController.java @@ -2,6 +2,7 @@ package com.ningdatech.pmapi.organization.controller; import com.ningdatech.basic.model.PageVo; import com.ningdatech.log.annotation.WebLog; +import com.ningdatech.pmapi.organization.manage.ProcDefManage; import com.wflow.bean.dto.WflowOrgProcdefDto; import com.wflow.bean.vo.OrgProcdefVo; import com.wflow.service.OrgProcdefService; @@ -31,6 +32,8 @@ public class ProcDefController { private final OrgProcessModelService orgProcessModelService; + private final ProcDefManage procDefManage; + @ApiOperation(value = "单位流程配置列表", notes = "单位流程配置列表") @GetMapping("/list") public PageVo list(@RequestParam String orgCode, @RequestParam(defaultValue = "1") Integer pageNumber, @@ -80,4 +83,11 @@ public class ProcDefController { public Boolean delete(@PathVariable String processDefId) { return orgProcessModelService.delProcess(processDefId); } + + @ApiOperation(value = "系统流程配置初始化", notes = "系统流程配置初始化") + @PostMapping("/init") + @WebLog("初始化系统配置") + public String init() { + return procDefManage.init(); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/ProcDefManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/ProcDefManage.java new file mode 100644 index 0000000..39749fd --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/ProcDefManage.java @@ -0,0 +1,103 @@ +package com.ningdatech.pmapi.organization.manage; + +import cn.hutool.core.util.IdUtil; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.pmapi.ding.constants.DingOrganizationContant; +import com.ningdatech.pmapi.organization.model.entity.DingOrganization; +import com.ningdatech.pmapi.organization.service.IDingOrganizationService; +import com.ningdatech.pmapi.organization.constants.ProcDefContant; +import com.wflow.bean.entity.WflowOrgModelHistorys; +import com.wflow.bean.entity.WflowOrgModels; +import com.wflow.enums.ProcessDefTypeEnum; +import com.wflow.service.OrgProcdefHistoryService; +import com.wflow.service.OrgProcdefService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @Classname ProcDefManage + * @Description + * @Date 2023/7/10 17:48 + * @Author PoffyZhang + */ +@Component +@Slf4j +@AllArgsConstructor +public class ProcDefManage { + private final IDingOrganizationService organizationService; + + private final OrgProcdefService orgProcdefService; + + private final OrgProcdefHistoryService orgProcdefHistoryService; + + /** + * 初始化 单位配置 + * @return + */ + public String init() { + List orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getTypeCode, DingOrganizationContant.UNIT_TYPE)); + + log.info("需要处理初始化单位配置的企业 数量为{}",orgs.size()); + + for(DingOrganization org : orgs){ + log.info("当前是 {}",org.getOrganizationName()); + String orgCode = org.getOrganizationCode(); + + List models = orgProcdefService.list(Wrappers.lambdaQuery(WflowOrgModels.class) + .eq(WflowOrgModels::getOrgCode, orgCode)); + + log.info("已经有的单位流程 {}", JSON.toJSONString(models)); + + List types = models.stream().map(WflowOrgModels::getType).collect(Collectors.toList()); + //默认流程 + if(!types.contains(ProcessDefTypeEnum.DEFAULT.name())){ + saveDef(org,ProcessDefTypeEnum.DEFAULT); + } + //盖章流程 + if(!types.contains(ProcessDefTypeEnum.SEAL.name())){ + saveDef(org,ProcessDefTypeEnum.SEAL); + } + //联审流程 + if(!types.contains(ProcessDefTypeEnum.JOINT_REVIEW.name())){ + saveDef(org,ProcessDefTypeEnum.JOINT_REVIEW); + } + } + + return "初始化成功"; + } + + private void saveDef(DingOrganization org,ProcessDefTypeEnum defTypeEnum){ + WflowOrgModels defaultModel = new WflowOrgModels(); + defaultModel.setProcessDefId(ProcDefContant.MODELS_ID_PREFIX + IdUtil.objectId()); + defaultModel.setIsStop(Boolean.FALSE); + defaultModel.setProcess(StrPool.BRACE); + defaultModel.setCreated(LocalDateTime.now()); + defaultModel.setIsDelete(Boolean.FALSE); + defaultModel.setOrgCode(org.getOrganizationCode()); + defaultModel.setOrgName(org.getOrganizationName()); + defaultModel.setProcessDefName(defTypeEnum.getDesc()); + defaultModel.setType(defTypeEnum.name()); + defaultModel.setSort(1); + defaultModel.setVersion(1); + orgProcdefService.save(defaultModel); + + WflowOrgModelHistorys defaultHistory = new WflowOrgModelHistorys(); + defaultHistory.setProcessDefId(ProcDefContant.MODELS_ID_PREFIX + IdUtil.objectId()); + defaultHistory.setProcess(StrPool.BRACE); + defaultHistory.setCreated(LocalDateTime.now()); + defaultHistory.setOrgCode(org.getOrganizationCode()); + defaultHistory.setOrgName(org.getOrganizationName()); + defaultHistory.setProcessDefName(defTypeEnum.getDesc()); + defaultHistory.setType(defTypeEnum.name()); + defaultHistory.setVersion(0); + orgProcdefHistoryService.save(defaultHistory); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectCollectionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectCollectionManage.java index d6728fa..7014b88 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectCollectionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectCollectionManage.java @@ -61,7 +61,7 @@ public class ProjectCollectionManage { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(ProjectCollection.class) .like(StringUtils.isNotBlank(req.getProjectName()), ProjectCollection::getProjectName, req.getProjectName()) - .like(StringUtils.isNotBlank(req.getBuildOrgName()), ProjectCollection::getBuildOrg, req.getBuildOrgName()) + .like(StringUtils.isNotBlank(req.getBuildOrg()), ProjectCollection::getBuildOrg, req.getBuildOrg()) .eq(Objects.nonNull(buildOrgCode), ProjectCollection::getBuildOrgCode, buildOrgCode); //处理 行政区域 if(StringUtils.isNotBlank(req.getRegionCode())){ diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/BatchUpdateEmployeeTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/BatchUpdateEmployeeTask.java index 0aa9954..fee27da 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/BatchUpdateEmployeeTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/BatchUpdateEmployeeTask.java @@ -2,6 +2,7 @@ package com.ningdatech.pmapi.scheduler.task; import cn.hutool.core.date.StopWatch; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.pmapi.ding.constants.DingOrganizationContant; import com.ningdatech.pmapi.ding.task.EmployeeBatchGetTask; import com.ningdatech.pmapi.organization.model.entity.DingOrganization; import com.ningdatech.pmapi.organization.service.IDingOrganizationService; @@ -41,7 +42,7 @@ public class BatchUpdateEmployeeTask { stopWatch.start(); // 1.查出浙政钉 所有单位 List units = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getTypeCode, "GOV_UNIT")); + .eq(DingOrganization::getTypeCode, DingOrganizationContant.UNIT_TYPE)); log.info("需要更新的 单位数量为 {}",units.size()); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcDefController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcDefController.java index e6b077b..3ea353b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcDefController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcDefController.java @@ -2,8 +2,6 @@ package com.ningdatech.pmapi.sys.controller; import com.ningdatech.basic.model.PageVo; import com.ningdatech.log.annotation.WebLog; -import com.ningdatech.pmapi.projectdeclared.manage.DefaultDeclaredProjectManage; -import com.ningdatech.pmapi.sys.manage.MenuManage; import com.wflow.bean.dto.WflowModelHistorysDto; import com.wflow.bean.vo.WflowModelVo; import com.wflow.service.ModelGroupService; @@ -15,8 +13,6 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import java.util.Map; - /** * @Classname SysProcdefController * @Description @@ -35,9 +31,6 @@ public class SysProcDefController { private final ProcessModelService processModelService; - private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; - private final MenuManage menuManage; - @ApiOperation(value = "系统流程配置列表", notes = "系统流程配置列表") @GetMapping("/list") public PageVo list(@RequestParam String regionCode, @RequestParam(defaultValue = "1") Integer pageNumber, @@ -70,6 +63,6 @@ public class SysProcDefController { @PostMapping("/deploy/{formId}") @WebLog("系统流程配置发布") public String deploy(@Validated @PathVariable String formId) { - return processModelService.deployProcess(formId,null); + return processModelService.deployProcess(formId, null); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java index 611dcc6..41a96f8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java @@ -12,6 +12,7 @@ import com.ningdatech.pmapi.common.constant.RegionConst; import com.ningdatech.pmapi.common.helper.RegionCacheHelper; import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.common.util.BizUtils; +import com.ningdatech.pmapi.ding.constants.DingOrganizationContant; import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; import com.ningdatech.pmapi.organization.model.entity.DingOrganization; import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; @@ -139,7 +140,7 @@ public class UserInfoManage { if (StringUtils.isNotBlank(orgName)) { List dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) .like(DingOrganization::getOrganizationName, orgName) - .eq(DingOrganization::getTypeCode, "GOV_UNIT") + .eq(DingOrganization::getTypeCode, DingOrganizationContant.UNIT_TYPE) ); List compliantOrgNameCodeList = dingOrganizationList.stream()