Browse Source

重新初始化 code

tags/24080901
PoffyZhang 1 year ago
parent
commit
3d37261cbd
2 changed files with 40 additions and 23 deletions
  1. +6
    -23
      pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java
  2. +34
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/ProcDefManage.java

+ 6
- 23
pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java View File

@@ -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;

/**
* <p>
@@ -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);
}
}

+ 34
- 0
pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/ProcDefManage.java View File

@@ -101,4 +101,38 @@ public class ProcDefManage {
defaultHistory.setVersion(0);
orgProcdefHistoryService.save(defaultHistory);
}

public String initByArea(String areaCode) {
List<DingOrganization> 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<WflowOrgModels> models = orgProcdefService.list(Wrappers.lambdaQuery(WflowOrgModels.class)
.eq(WflowOrgModels::getOrgCode, orgCode));

log.info("已经有的单位流程 {}", JSON.toJSONString(models));

List<String> 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 "初始化成功";
}
}

Loading…
Cancel
Save