diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java index 655158c..9095702 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java @@ -1,167 +1,171 @@ -//package com.ningdatech.pmapi.ding.task; -// -//import com.alibaba.fastjson.JSONObject; -//import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; -//import com.google.common.collect.Lists; -//import com.ningdatech.basic.model.GenericResult; -//import com.ningdatech.pmapi.ding.model.DingOrgInfoTreeDTO; -//import com.ningdatech.pmapi.organization.entity.DingOrganization; -//import com.ningdatech.pmapi.organization.service.IDingOrganizationService; -//import com.ningdatech.zwdd.client.ZwddAuthClient; -//import com.ningdatech.zwdd.client.ZwddClient; -//import com.ningdatech.zwdd.model.dto.DingOrgInfoDTO; -//import com.ningdatech.zwdd.model.dto.DingScopesV2DTO; -//import com.ningdatech.zwdd.model.dto.PageSubOrganizationCodeDTO; -//import lombok.extern.slf4j.Slf4j; -//import org.springframework.beans.factory.annotation.Autowired; -//import org.springframework.stereotype.Component; -//import org.springframework.transaction.annotation.Transactional; -// -//import java.util.ArrayList; -//import java.util.List; -//import java.util.Objects; -//import java.util.stream.Collectors; -// -///** -// * @author liuxinxin -// * @date 2023/2/7 上午10:15 -// */ -// -//@Slf4j -//@Component -//public class OrganizationBatchGetTask { -// -// @Autowired -// private ZwddClient zwddClient; -// -// @Autowired -// private ZwddAuthClient zwddAuthClient; -// -// private static final Integer GROUP_SIZE = 100; -// -// @Autowired -// private IDingOrganizationService iDingOrganizationService; -// -// /** -// * 获取浙政钉组织架构 -// */ -// @Transactional(rollbackFor = Exception.class) -// public void OrganizationBatchGetTask() { -//// List allList = iDingOrganizationService.list(); -//// List currentAllOrganizationCodeList = allList.stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toList()); -// // 全量删除 -// // iDingOrganizationService.remove(Wrappers.lambdaQuery(DingOrganization.class).isNotNull(DingOrganization::getId)); -// // 获取顶级组织code -// GenericResult scopesV2Result = zwddClient.getScopesV2(); -// DingScopesV2DTO scopesV2 = scopesV2Result.getData(); -// -// if (Objects.nonNull(scopesV2)) { -// // 顶级组织code -// List deptVisibleScopes = scopesV2.getDeptVisibleScopes(); -// log.info("顶级组织code: size = " + deptVisibleScopes.size() + "列表:" + JSONObject.toJSONString(deptVisibleScopes)); -// // 获取顶级节点信息 -// GenericResult> listGenericResult = zwddClient.listOrganizationsByCodes(deptVisibleScopes); -// List dingOrgInfoDtos = listGenericResult.getData(); -// for (String orgCode : deptVisibleScopes) { -//// if (currentAllOrganizationCodeList.contains(orgCode)) { -//// log.info("已存在组织架构---{}", orgCode); -//// continue; -//// } -// List treeDTOList = new ArrayList<>(); -// -// DingOrgInfoTreeDTO childDingOrgInfoTreeDTO = new DingOrgInfoTreeDTO(); -// //设置节点详情 -// if (dingOrgInfoDtos != null && !dingOrgInfoDtos.isEmpty()) { -// for (DingOrgInfoDTO orgInfo : dingOrgInfoDtos) { -// if (orgInfo.getOrganizationCode().equals(orgCode)) { -// childDingOrgInfoTreeDTO.setDingOrgInfoDTO(orgInfo); -// } -// } + +package com.ningdatech.pmapi.ding.task; + +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.google.common.collect.Lists; +import com.ningdatech.basic.model.GenericResult; +import com.ningdatech.pmapi.ding.model.DingOrgInfoTreeDTO; +import com.ningdatech.pmapi.organization.entity.DingOrganization; +import com.ningdatech.pmapi.organization.service.IDingOrganizationService; +import com.ningdatech.zwdd.client.ZwddAuthClient; +import com.ningdatech.zwdd.client.ZwddClient; +import com.ningdatech.zwdd.model.dto.DingOrgInfoDTO; +import com.ningdatech.zwdd.model.dto.DingScopesV2DTO; +import com.ningdatech.zwdd.model.dto.PageSubOrganizationCodeDTO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2023/2/7 上午10:15 + */ + +@Slf4j +@Component +public class OrganizationBatchGetTask { + + @Autowired + private ZwddClient zwddClient; + + @Autowired + private ZwddAuthClient zwddAuthClient; + + private static final Integer GROUP_SIZE = 100; + + @Autowired + private IDingOrganizationService iDingOrganizationService; + + /** + * 获取浙政钉组织架构 + */ + @Transactional(rollbackFor = Exception.class) + public void batchGetOrganizationTask() { +// List allList = iDingOrganizationService.list(); +// List currentAllOrganizationCodeList = allList.stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toList()); + // 全量删除 + // iDingOrganizationService.remove(Wrappers.lambdaQuery(DingOrganization.class).isNotNull(DingOrganization::getId)); + // 获取顶级组织code + GenericResult scopesV2Result = zwddClient.getScopesV2(); + DingScopesV2DTO scopesV2 = scopesV2Result.getData(); + + if (Objects.nonNull(scopesV2)) { + // 顶级组织code + List deptVisibleScopes = scopesV2.getDeptVisibleScopes(); + log.info("顶级组织code: size = " + deptVisibleScopes.size() + "列表:" + JSONObject.toJSONString(deptVisibleScopes)); + // 获取顶级节点信息 + GenericResult> listGenericResult = zwddClient.listOrganizationsByCodes(deptVisibleScopes); + List dingOrgInfoDtos = listGenericResult.getData(); + for (String orgCode : deptVisibleScopes) { +// if (currentAllOrganizationCodeList.contains(orgCode)) { +// log.info("已存在组织架构---{}", orgCode); +// continue; // } -// childDingOrgInfoTreeDTO.setCode(orgCode); -// childDingOrgInfoTreeDTO.setChildCodes(new ArrayList<>()); -// getDingOrgChild(childDingOrgInfoTreeDTO); -// treeDTOList.add(childDingOrgInfoTreeDTO); -// -// if (CollectionUtils.isNotEmpty(treeDTOList)) { -// List saveRecordList = new ArrayList<>(); -// buildSaveRecordList(treeDTOList, saveRecordList); -// -// // 批量保存 -// if (saveRecordList.size() <= GROUP_SIZE) { -// iDingOrganizationService.saveBatch(saveRecordList); -// } else { -// List> split = Lists.partition(saveRecordList, GROUP_SIZE); -// for (List segment : split) { -// iDingOrganizationService.saveBatch(segment); -// } -// } -// } -// log.info("----拉取浙政钉组织结构结束---,顶级code:" + orgCode); -// } -// } -// } -// -// private void buildSaveRecordList(List treeDTOList, List saveRecordList) { -// if (CollectionUtils.isEmpty(treeDTOList)) { -// return; -// } -// for (DingOrgInfoTreeDTO dingOrgInfoTreeDTO : treeDTOList) { -// DingOrganization saveRecord = new DingOrganization(); -// DingOrgInfoDTO dingOrgInfoDTO = dingOrgInfoTreeDTO.getDingOrgInfoDTO(); -// List childCodes = dingOrgInfoTreeDTO.getChildCodes(); -// saveRecord.setDisplayOrder(dingOrgInfoDTO.getDisplayOrder()); -//// saveRecord.setEnabled("1"); -// saveRecord.setParentCode(dingOrgInfoDTO.getParentCode()); -// saveRecord.setOrganizationCode(dingOrgInfoDTO.getOrganizationCode()); -//// saveRecord.setSubCount((long) dingOrgInfoTreeDTO.getChildCodes().size()); -// saveRecord.setOrganizationName(dingOrgInfoDTO.getOrganizationName()); -// saveRecordList.add(saveRecord); -// if (CollectionUtils.isNotEmpty(childCodes)) { -// buildSaveRecordList(childCodes, saveRecordList); -// } -// } -// -// } -// -// private void getDingOrgChild(DingOrgInfoTreeDTO parentDingOrgInfoTreeDTO) { -// String parentOrgCode = parentDingOrgInfoTreeDTO.getCode(); -// DingOrgInfoDTO orgInfoDTO = parentDingOrgInfoTreeDTO.getDingOrgInfoDTO(); -// boolean leaf = orgInfoDTO.getLeaf(); -// if (!leaf) { -// int currentPage = 1; -// int pageSize = 100; -// GenericResult pageSubOrganizationCodeDTOGenericResult = zwddClient.pageSubOrganizationCodes(currentPage++, pageSize, parentOrgCode); -// PageSubOrganizationCodeDTO pageSubOrganizationCodeDTO = pageSubOrganizationCodeDTOGenericResult.getData(); -// -// List subOrganizationCodeList = new ArrayList<>(pageSubOrganizationCodeDTO.getSubOrganizationCodeList()); -// Long totalSize = pageSubOrganizationCodeDTO.getTotalSize(); -// -// while (totalSize > (long) currentPage * pageSize) { -// GenericResult subPageSubOrganizationCodeDTOGenericResult = zwddClient -// .pageSubOrganizationCodes(currentPage++, pageSize, parentOrgCode); -// PageSubOrganizationCodeDTO subOrganizationCodeDTO = subPageSubOrganizationCodeDTOGenericResult.getData(); -// if (CollectionUtils.isNotEmpty(subOrganizationCodeDTO.getSubOrganizationCodeList())) { -// subOrganizationCodeList.addAll(subOrganizationCodeDTO.getSubOrganizationCodeList()); -// } -// } -// -// if (CollectionUtils.isNotEmpty(subOrganizationCodeList)) { -// GenericResult> listGenericResult = zwddClient -// .listOrganizationsByCodes(subOrganizationCodeList); -// List dingOrgInfoDtos = listGenericResult.getData(); -// List dingOrgInfoTreeDTOList = dingOrgInfoDtos.stream().map(r -> { -// DingOrgInfoTreeDTO dingOrgInfoTreeDTO = new DingOrgInfoTreeDTO(); -// dingOrgInfoTreeDTO.setCode(r.getOrganizationCode()); -// dingOrgInfoTreeDTO.setDingOrgInfoDTO(r); -// dingOrgInfoTreeDTO.setChildCodes(new ArrayList<>()); -// getDingOrgChild(dingOrgInfoTreeDTO); -// return dingOrgInfoTreeDTO; -// }).collect(Collectors.toList()); -// parentDingOrgInfoTreeDTO.setChildCodes(dingOrgInfoTreeDTOList); -// } -// -// } -// } -// -//} + List treeDTOList = new ArrayList<>(); + + DingOrgInfoTreeDTO childDingOrgInfoTreeDTO = new DingOrgInfoTreeDTO(); + //设置节点详情 + if (dingOrgInfoDtos != null && !dingOrgInfoDtos.isEmpty()) { + for (DingOrgInfoDTO orgInfo : dingOrgInfoDtos) { + if (orgInfo.getOrganizationCode().equals(orgCode)) { + childDingOrgInfoTreeDTO.setDingOrgInfoDTO(orgInfo); + } + } + } + childDingOrgInfoTreeDTO.setCode(orgCode); + childDingOrgInfoTreeDTO.setChildCodes(new ArrayList<>()); + getDingOrgChild(childDingOrgInfoTreeDTO); + treeDTOList.add(childDingOrgInfoTreeDTO); + + if (CollectionUtils.isNotEmpty(treeDTOList)) { + List saveRecordList = new ArrayList<>(); + buildSaveRecordList(treeDTOList, saveRecordList); + + // 批量保存 + if (saveRecordList.size() <= GROUP_SIZE) { + iDingOrganizationService.saveBatch(saveRecordList); + } else { + List> split = Lists.partition(saveRecordList, GROUP_SIZE); + for (List segment : split) { + iDingOrganizationService.saveBatch(segment); + } + } + } + log.info("----拉取浙政钉组织结构结束---,顶级code:" + orgCode); + } + } + } + + private void buildSaveRecordList(List treeDTOList, List saveRecordList) { + if (CollectionUtils.isEmpty(treeDTOList)) { + return; + } + for (DingOrgInfoTreeDTO dingOrgInfoTreeDTO : treeDTOList) { + DingOrganization saveRecord = new DingOrganization(); + DingOrgInfoDTO dingOrgInfoDTO = dingOrgInfoTreeDTO.getDingOrgInfoDTO(); + List childCodes = dingOrgInfoTreeDTO.getChildCodes(); + saveRecord.setDisplayOrder(dingOrgInfoDTO.getDisplayOrder()); +// saveRecord.setEnabled("1"); + saveRecord.setParentCode(dingOrgInfoDTO.getParentCode()); + saveRecord.setOrganizationCode(dingOrgInfoDTO.getOrganizationCode()); +// saveRecord.setSubCount((long) dingOrgInfoTreeDTO.getChildCodes().size()); + saveRecord.setOrganizationName(dingOrgInfoDTO.getOrganizationName()); + saveRecordList.add(saveRecord); + if (CollectionUtils.isNotEmpty(childCodes)) { + buildSaveRecordList(childCodes, saveRecordList); + } + } + + } + + private void getDingOrgChild(DingOrgInfoTreeDTO parentDingOrgInfoTreeDTO) { + String parentOrgCode = parentDingOrgInfoTreeDTO.getCode(); + DingOrgInfoDTO orgInfoDTO = parentDingOrgInfoTreeDTO.getDingOrgInfoDTO(); + boolean leaf = orgInfoDTO.getLeaf(); + if (!leaf) { + int currentPage = 1; + int pageSize = 100; + GenericResult pageSubOrganizationCodeDTOGenericResult = zwddClient.pageSubOrganizationCodes(currentPage++, pageSize, parentOrgCode); + PageSubOrganizationCodeDTO pageSubOrganizationCodeDTO = pageSubOrganizationCodeDTOGenericResult.getData(); + + if (CollUtil.isNotEmpty(pageSubOrganizationCodeDTO.getSubOrganizationCodeList())) { + List subOrganizationCodeList = new ArrayList<>(pageSubOrganizationCodeDTO.getSubOrganizationCodeList()); + Long totalSize = pageSubOrganizationCodeDTO.getTotalSize(); + + while (totalSize > (long) currentPage * pageSize) { + GenericResult subPageSubOrganizationCodeDTOGenericResult = zwddClient + .pageSubOrganizationCodes(currentPage++, pageSize, parentOrgCode); + PageSubOrganizationCodeDTO subOrganizationCodeDTO = subPageSubOrganizationCodeDTOGenericResult.getData(); + if (CollectionUtils.isNotEmpty(subOrganizationCodeDTO.getSubOrganizationCodeList())) { + subOrganizationCodeList.addAll(subOrganizationCodeDTO.getSubOrganizationCodeList()); + } + } + + if (CollectionUtils.isNotEmpty(subOrganizationCodeList)) { + GenericResult> listGenericResult = zwddClient + .listOrganizationsByCodes(subOrganizationCodeList); + List dingOrgInfoDtos = listGenericResult.getData(); + List dingOrgInfoTreeDTOList = dingOrgInfoDtos.stream().map(r -> { + DingOrgInfoTreeDTO dingOrgInfoTreeDTO = new DingOrgInfoTreeDTO(); + dingOrgInfoTreeDTO.setCode(r.getOrganizationCode()); + dingOrgInfoTreeDTO.setDingOrgInfoDTO(r); + dingOrgInfoTreeDTO.setChildCodes(new ArrayList<>()); + getDingOrgChild(dingOrgInfoTreeDTO); + return dingOrgInfoTreeDTO; + }).collect(Collectors.toList()); + parentDingOrgInfoTreeDTO.setChildCodes(dingOrgInfoTreeDTOList); + } + } + } + } + +} + diff --git a/pmapi/src/main/resources/integration/zwdd-dev.yml b/pmapi/src/main/resources/integration/zwdd-dev.yml index 0073994..2acb0d9 100644 --- a/pmapi/src/main/resources/integration/zwdd-dev.yml +++ b/pmapi/src/main/resources/integration/zwdd-dev.yml @@ -1,11 +1,20 @@ #专有钉钉 -ding: - #扫码 - app-auth-key: expert-base_dingoa-c5nnefYVnie - app-auth-secret: nm8qtST8uK431HYrjr7srcE23sT4889QgMcYFM3L - # #免登/获取信息 - app-key: file-manage-4Mjx9358wuxjyYFjY3 - app-secret: hE41938wqyQ5LOpc1QDRA9e7gb5YugoClWD3nY4O - #专有钉钉在开发管理工作台,右键查看网页源码realmId: '31141',浙政钉固定196729 - tenantId: 31141 - domain: openplatform.dg-work.cn \ No newline at end of file +integration: + zzd: + #扫码 + app-auth-key: expert-base_dingoa-c5nnefYVnie + app-auth-secret: nm8qtST8uK431HYrjr7srcE23sT4889QgMcYFM3L + # #免登/获取信息 + # app-key: file-manage-4Mjx9358wuxjyYFjY3 + # app-secret: hE41938wqyQ5LOpc1QDRA9e7gb5YugoClWD3nY4O + app-key: ls_rebuild-10c8n5X0707yFV7jURr + app-secret: gN8J3WazyXLMWKDuFmx6C4yaH5lFUY41x8rYLLo6 + #专有钉钉在开发管理工作台,右键查看网页源码realmId: '31141',浙政钉固定196729 + tenantId: 31141 + domain: openplatform.dg-work.cn + +# integration.zzd.enabled=true +# #扫码 +# integration.zzd.app-auth-key=file-manage_dingoa-zte2LbiAfIj +# integration.zzd.app-auth-secret=H794aFZf271QbfUr50pbBpBTlXSrWIP71q9RTR34 +# integration.zzd.domain=openplatform.dg-work.cn \ No newline at end of file diff --git a/pmapi/src/main/resources/integration/zwdd-prod.yml b/pmapi/src/main/resources/integration/zwdd-prod.yml new file mode 100644 index 0000000..0073994 --- /dev/null +++ b/pmapi/src/main/resources/integration/zwdd-prod.yml @@ -0,0 +1,11 @@ +#专有钉钉 +ding: + #扫码 + app-auth-key: expert-base_dingoa-c5nnefYVnie + app-auth-secret: nm8qtST8uK431HYrjr7srcE23sT4889QgMcYFM3L + # #免登/获取信息 + app-key: file-manage-4Mjx9358wuxjyYFjY3 + app-secret: hE41938wqyQ5LOpc1QDRA9e7gb5YugoClWD3nY4O + #专有钉钉在开发管理工作台,右键查看网页源码realmId: '31141',浙政钉固定196729 + tenantId: 31141 + domain: openplatform.dg-work.cn \ No newline at end of file diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/organization/OrganizationTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/organization/OrganizationTest.java index 1f08428..0fd3585 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/organization/OrganizationTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/organization/OrganizationTest.java @@ -4,6 +4,7 @@ import com.ningdatech.pmapi.AppTests; import com.ningdatech.pmapi.ding.task.OrganizationBatchGetTask; import com.ningdatech.zwdd.client.ZwddAuthClient; import com.ningdatech.zwdd.client.ZwddClient; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; /** @@ -11,7 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired; * @date 2023/2/9 下午3:54 */ -public class OrganizationTest extends AppTests { +class OrganizationTest extends AppTests { @Autowired private ZwddClient zwddClient; @@ -22,9 +23,9 @@ public class OrganizationTest extends AppTests { @Autowired private OrganizationBatchGetTask organizationBatchGetTask; + @Test public void testBatchGetOrganization() { - - + organizationBatchGetTask.batchGetOrganizationTask(); } } diff --git a/pmapi/src/test/resources/application-dev.yml b/pmapi/src/test/resources/application-dev.yml new file mode 100644 index 0000000..7727198 --- /dev/null +++ b/pmapi/src/test/resources/application-dev.yml @@ -0,0 +1,168 @@ +server: + port: 28888 + servlet: + context-path: /pm + +spring: + mvc: + pathmatch: + matching-strategy: ant_path_matcher + session: + store-type: redis + redis: + namespace: "spring:session" + redis: + timeout: 5000 + host: 47.98.125.47 + port: 26379 + database: 0 + password: Ndkj1234 + jedis: + pool: + max-active: 200 + max-idle: 500 + min-idle: 8 + max-wait: 10000 + application: + name: pm + 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.alibaba.druid.pool.DruidDataSource + driverClassName: com.kingbase8.Driver + # 数据源 + druid: + url: jdbc:kingbase8://120.26.44.207:54321/nd_project_management?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8 + username: SYSTEM + password: Ndkj1234 + # 初始连接数 + initialSize: 5 + # 最小连接池数量 + minIdle: 10 + # 最大连接池数量 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + # 配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 900000 + # 配置检测连接是否有效 + #mysql使用:SELECT 1 FROM DUAL + validationQuery: SELECT 1 + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + webStatFilter: + enabled: true + statViewServlet: + enabled: true + # 设置白名单,不填则允许所有访问 + allow: + url-pattern: /druid/* + # 控制台管理用户名和密码 + login-username: admin + login-password: admin + filter: + stat: + enabled: true + # 慢SQL记录 + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: true +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: + log: + enabled: true + type: DB +# 日志文件配置 +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 + +flowable: + async-executor-activate: true + #关闭一些不需要的功能服务 + rest-api-enabled: false + idm: + enabled: false + common: + enabled: false + dmn: + enabled: false + form: + enabled: false + app: + enabled: false + +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 + +#专有钉钉 +ding: + #扫码 + app-auth-key: expert-base_dingoa-c5nnefYVnie + app-auth-secret: nm8qtST8uK431HYrjr7srcE23sT4889QgMcYFM3L + # #免登/获取信息 + app-key: file-manage-4Mjx9358wuxjyYFjY3 + app-secret: hE41938wqyQ5LOpc1QDRA9e7gb5YugoClWD3nY4O + #专有钉钉在开发管理工作台,右键查看网页源码realmId: '31141',浙政钉固定196729 + tenantId: 31141 + domain: openplatform.dg-work.cn \ No newline at end of file diff --git a/pmapi/src/test/resources/application-prod.yml b/pmapi/src/test/resources/application-prod.yml new file mode 100644 index 0000000..e69de29 diff --git a/pmapi/src/test/resources/application.yml b/pmapi/src/test/resources/application.yml new file mode 100644 index 0000000..3d7808a --- /dev/null +++ b/pmapi/src/test/resources/application.yml @@ -0,0 +1,3 @@ +spring: + profiles: + active: dev diff --git a/pmapi/src/test/resources/integration/zwdd-dev.yml b/pmapi/src/test/resources/integration/zwdd-dev.yml new file mode 100644 index 0000000..b2bbff9 --- /dev/null +++ b/pmapi/src/test/resources/integration/zwdd-dev.yml @@ -0,0 +1,14 @@ +#专有钉钉 +integration: + zwdd: + #扫码 + app-auth-key: expert-base_dingoa-c5nnefYVnie + app-auth-secret: nm8qtST8uK431HYrjr7srcE23sT4889QgMcYFM3L + # #免登/获取信息 +# app-key: file-manage-4Mjx9358wuxjyYFjY3 +# app-secret: hE41938wqyQ5LOpc1QDRA9e7gb5YugoClWD3nY4O + app-key: ls_rebuild-10c8n5X0707yFV7jURr + app-secret: gN8J3WazyXLMWKDuFmx6C4yaH5lFUY41x8rYLLo6 + #专有钉钉在开发管理工作台,右键查看网页源码realmId: '31141',浙政钉固定196729 + tenantId: 31141 + domain: openplatform.dg-work.cn \ No newline at end of file diff --git a/pmapi/src/test/resources/integration/zwdd-prod.yml b/pmapi/src/test/resources/integration/zwdd-prod.yml new file mode 100644 index 0000000..0073994 --- /dev/null +++ b/pmapi/src/test/resources/integration/zwdd-prod.yml @@ -0,0 +1,11 @@ +#专有钉钉 +ding: + #扫码 + app-auth-key: expert-base_dingoa-c5nnefYVnie + app-auth-secret: nm8qtST8uK431HYrjr7srcE23sT4889QgMcYFM3L + # #免登/获取信息 + app-key: file-manage-4Mjx9358wuxjyYFjY3 + app-secret: hE41938wqyQ5LOpc1QDRA9e7gb5YugoClWD3nY4O + #专有钉钉在开发管理工作台,右键查看网页源码realmId: '31141',浙政钉固定196729 + tenantId: 31141 + domain: openplatform.dg-work.cn \ No newline at end of file diff --git a/pmapi/src/test/resources/logback-spring.xml b/pmapi/src/test/resources/logback-spring.xml new file mode 100644 index 0000000..75f5472 --- /dev/null +++ b/pmapi/src/test/resources/logback-spring.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + ${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/pmapi/src/test/resources/security/auth-dev.yml b/pmapi/src/test/resources/security/auth-dev.yml new file mode 100644 index 0000000..448ffa2 --- /dev/null +++ b/pmapi/src/test/resources/security/auth-dev.yml @@ -0,0 +1,52 @@ +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/password + logout-url: /api/v1/user/auth/logout + 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/** + - /doc.html + - /ok.html + - /open/api/** + - /oa/** + - /wflow/** + - /sys/** + 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/** + 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 diff --git a/pmapi/src/test/resources/security/auth-prod.yml b/pmapi/src/test/resources/security/auth-prod.yml new file mode 100644 index 0000000..37e3281 --- /dev/null +++ b/pmapi/src/test/resources/security/auth-prod.yml @@ -0,0 +1,41 @@ +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/password + logout-url: /api/v1/user/auth/logout + ignore-auth-urls: + - /v2/api-docs + - /swagger-ui.html + - /webjars/** + - /swagger-resources/** + - /webjars/ + - /api/v1/user/auth/register + - /api/v1/user/auth/login/password + - /api/v1/user/auth/forget-password + - /doc.html + - /ok.html + 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/** + role-map: + "engineer": + "project_manager": + "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