From 3d37261cbde8207d17148da20b603ddbba4fd0e9 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Mon, 24 Jul 2023 15:41:23 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ding/controller/DingInfoPullController.java | 29 ++++-------------- .../pmapi/organization/manage/ProcDefManage.java | 34 ++++++++++++++++++++++ 2 files changed, 40 insertions(+), 23 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java b/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java index f07e985..2107e02 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java @@ -1,36 +1,13 @@ package com.ningdatech.pmapi.ding.controller; -import cn.hutool.crypto.digest.MD5; -import com.alibaba.fastjson.JSON; -import com.ningdatech.pmapi.common.util.CryptUtils; -import com.ningdatech.pmapi.common.util.HttpUtil; -import com.ningdatech.pmapi.common.util.Md5Utils; -import com.ningdatech.pmapi.common.util.RefreshKeyUtil; import com.ningdatech.pmapi.ding.task.EmployeeBatchGetTask; import com.ningdatech.pmapi.ding.task.GovBusinessStripsTask; import com.ningdatech.pmapi.ding.task.OrganizationBatchGetTask; -import com.ningdatech.pmapi.irs.utils.RefreshTokenUtil; import com.ningdatech.pmapi.organization.manage.ProcDefManage; import io.swagger.annotations.ApiOperation; -import liquibase.util.MD5Util; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.apache.http.conn.ssl.NoopHostnameVerifier; -import org.apache.http.conn.ssl.SSLConnectionSocketFactory; -import org.apache.http.conn.ssl.TrustStrategy; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.ssl.SSLContexts; -import org.springframework.http.ResponseEntity; -import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.web.bind.annotation.*; -import org.springframework.web.client.RestTemplate; - -import javax.net.ssl.SSLContext; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.security.NoSuchAlgorithmException; /** *

@@ -103,4 +80,10 @@ public class DingInfoPullController { public String init() { return procDefManage.init(); } + + @ApiOperation(value = "系统流程配置初始化按区域", notes = "系统流程配置初始化按区域") + @GetMapping("/init/{areaCode}") + public String initByArea(@PathVariable String areaCode) { + return procDefManage.initByArea(areaCode); + } } 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 index 24c6ad1..df538d6 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/ProcDefManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/ProcDefManage.java @@ -101,4 +101,38 @@ public class ProcDefManage { defaultHistory.setVersion(0); orgProcdefHistoryService.save(defaultHistory); } + + public String initByArea(String areaCode) { + List orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getTypeCode, DingOrganizationContant.UNIT_TYPE) + .eq(DingOrganization::getDivisionCode,areaCode)); + + log.info("{}地区 需要处理初始化单位配置的企业 数量为{}",areaCode,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 "初始化成功"; + } } From 6f0a523838b6af311ef8275e214d5fabf4dd2324 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Mon, 24 Jul 2023 16:00:34 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ningdatech/pmapi/ding/constants/DingOrganizationContant.java | 2 +- .../com/ningdatech/pmapi/organization/manage/ProcDefManage.java | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) 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 index 496b75f..e8ffb0d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/constants/DingOrganizationContant.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/ding/constants/DingOrganizationContant.java @@ -9,6 +9,6 @@ package com.ningdatech.pmapi.ding.constants; public interface DingOrganizationContant { String UNIT_TYPE = "GOV_UNIT"; - + String GOV_TEMPORARY = "GOV_TEMPORARY"; String HOLLOW = "GOV_HOLLOW_DIVISION_NODE"; } 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 index df538d6..60acd33 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/ProcDefManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/ProcDefManage.java @@ -3,6 +3,7 @@ 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.google.common.collect.Lists; import com.ningdatech.basic.util.StrPool; import com.ningdatech.pmapi.ding.constants.DingOrganizationContant; import com.ningdatech.pmapi.organization.model.entity.DingOrganization; @@ -43,7 +44,9 @@ public class ProcDefManage { */ public String init() { List orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getTypeCode, DingOrganizationContant.UNIT_TYPE)); + .in(DingOrganization::getTypeCode, Lists.newArrayList( + DingOrganizationContant.UNIT_TYPE,DingOrganizationContant.GOV_TEMPORARY + ))); log.info("需要处理初始化单位配置的企业 数量为{}",orgs.size()); @@ -104,7 +107,9 @@ public class ProcDefManage { public String initByArea(String areaCode) { List orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getTypeCode, DingOrganizationContant.UNIT_TYPE) + .in(DingOrganization::getTypeCode, Lists.newArrayList( + DingOrganizationContant.UNIT_TYPE,DingOrganizationContant.GOV_TEMPORARY + )) .eq(DingOrganization::getDivisionCode,areaCode)); log.info("{}地区 需要处理初始化单位配置的企业 数量为{}",areaCode,orgs.size()); From 1375097e58a4c43b2ab42613c53ad986f5482b2b Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Mon, 24 Jul 2023 16:01:40 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ningdatech/pmapi/scheduler/task/BatchUpdateEmployeeTask.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 fee27da..84e5941 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.google.common.collect.Lists; import com.ningdatech.pmapi.ding.constants.DingOrganizationContant; import com.ningdatech.pmapi.ding.task.EmployeeBatchGetTask; import com.ningdatech.pmapi.organization.model.entity.DingOrganization; @@ -42,7 +43,9 @@ public class BatchUpdateEmployeeTask { stopWatch.start(); // 1.查出浙政钉 所有单位 List units = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .eq(DingOrganization::getTypeCode, DingOrganizationContant.UNIT_TYPE)); + .in(DingOrganization::getTypeCode, Lists.newArrayList( + DingOrganizationContant.UNIT_TYPE,DingOrganizationContant.GOV_TEMPORARY + ))); log.info("需要更新的 单位数量为 {}",units.size());