1、钉钉通讯录事件订阅

2、@Value配置修改
2024年8月28日11:13:13
This commit is contained in:
xiang2lin 2024-08-28 11:13:39 +08:00
parent 4637728035
commit 529a3a9764
3 changed files with 14 additions and 18 deletions

View File

@ -3,6 +3,7 @@ package com.hzya.frame.plugin.kjs.service;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapBuilder;
import cn.hutool.core.util.IdUtil;
import cn.hutool.http.HttpRequest;
import com.dingtalk.api.response.OapiV2DepartmentGetResponse;
import com.dingtalk.api.response.OapiV2UserGetResponse;
import com.dingtalk.open.app.api.message.GenericOpenDingTalkEvent;
@ -44,7 +45,6 @@ public class GenericEventConsumer {
logger.info("事件唯一id{},事件类型:{},参数:{}",eventId,eventType,JSONObject.toJSONString(bizData));
OrgEventEnum orgEventEnum = OrgEventEnum.getByCode(eventType);
String apiCode = "";
JSONObject mdmObj = new JSONObject();
String type = "";
switch (orgEventEnum){
//新增到主数据
@ -99,7 +99,8 @@ public class GenericEventConsumer {
.put("secretKey","ctMIYyauwoKSFeU4tg5gH1aWC/3OJK6HsKJrSR0oyDmdmdvRNgdoTzX0C1OQ+whrj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//钉钉应用
.put("appId","800004")//中台应用
.build();
//String body = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterfaceToESB").addHeaders(headerMap).body(com.alibaba.fastjson.JSONObject.toJSONString(mdmObj)).timeout(60000).execute().body();
String body = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface").addHeaders(headerMap).body(com.alibaba.fastjson.JSONObject.toJSONString(mdmMap)).timeout(60000).execute().body();
System.out.println(body);
}
}else if ("dept".equals(type)){
JSONArray deptIdArr = bizData.getJSONArray("deptId");
@ -113,6 +114,15 @@ public class GenericEventConsumer {
deptMap.put("name",deptInfo.getName());
deptMap.put("parent_id",deptInfo.getParentId());
mdmMap.put("mdm_dd_dept",deptMap);
//保存部门到主数据
Map<String, String> headerMap = MapBuilder.<String, String>create(true)
.put("apiCode", apiCode)//中台接口
.put("publicKey","ZJYAn/EBWEhLUMezDLU4iZ1vTO9kc6pM6XrYLajnqnK60Q9Ce7eDIk+3zDUT+v578prj")//钉钉应用
.put("secretKey","ctMIYyauwoKSFeU4tg5gH1aWC/3OJK6HsKJrSR0oyDmdmdvRNgdoTzX0C1OQ+whrj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//钉钉应用
.put("appId","800004")//中台应用
.build();
String body = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface").addHeaders(headerMap).body(com.alibaba.fastjson.JSONObject.toJSONString(mdmMap)).timeout(60000).execute().body();
System.out.println(body);
}
}
}

View File

@ -12,27 +12,13 @@ spring:
dynamic:
datasource:
master:
url: jdbc:mysql://ufidahz.com.cn:9014/businesscenter_kjs?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
url: jdbc:mysql://ufidahz.com.cn:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
username: root
password: 62e4295b615a30dbf3b8ee96f41c820b
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
savefile:
# 文件保存路径
path: /Users/xiangerlin/work/app/logs/kjs
cbs8:
appId: 1P4AGrpz
appSecret: 2c2369ae5dc04382844bbe3a5abf39e1bea9cd3a
url: https://cbs8-openapi-reprd.csuat.cmburl.cn
# 测试用这个 这个是银行给的,和下面的公钥不是一对密钥
ya_private_key: 83BA7EC821D35F4CB31FF9A51C1EFA520FC52AF828C2337F88E91CF119B07F44
# 这个私钥到时候上传到cbs和下面到是同一对
#ya_private_key: e1eacfdee9b8d4184437d5a2071e17ce31befc3d93395f9f05709ed562e8dc46
ya_public_key: 044fa399d2223760f17b81b863cb482b009294c4516f8a605dea1475ec09e720eaa98468715e5ad509a592a0b426061551c5a3df236966c23253a7d894eac0dcde
cbs_public_key: 0469146F06BF3B01236E84632441E826F3067A6B93BC3839C836A06007869CD351FBBE388B51F742859388BBC1DE089923AAFBC69E448F15141DDF30EE6CE90185
#电子回单下载临时存放位置
elec_path: /Users/xiangerlin/Downloads/
OA:
data_source_code: yc-test
dingtalk:
appKey: dingbltm9wszcl7hoxyg
appSecret: ex3a9qwdTXWf_VKJEddAg8YE7x98kIl3Nsy_7g0NdwvK3w3nXdUhJ3XQP4lUYs2d

View File

@ -39,7 +39,7 @@ public class CbsLogServiceImpl extends BaseService<CbsLogEntity,String> implemen
Logger log = LoggerFactory.getLogger(getClass());
private ICbsLogDao cbsLogDao;
@Value("${OA.data_source_code}")
@Value("${OA.data_source_code:}")
private String oa_data_source_code;
@Autowired
public void setCbsLogDao(ICbsLogDao cbsLogDao) {