|
@@ -117,20 +117,34 @@ public class DingDingController {
|
|
|
//企业授权变更,包含授权、解除授权、授权变更。
|
|
|
JSONObject biz_data = JSONObject.parseObject(bizItem.getString("biz_data"));
|
|
|
String syncAction = biz_data.getString("syncAction");
|
|
|
- if ("org_suite_auth".equals(syncAction)) {
|
|
|
+ if ("org_suite_auth".equals(syncAction) || "org_suite_change".equals(syncAction)) {
|
|
|
//开通授权应用
|
|
|
- System.out.println("==Push 推送事件 开通授权应用===");
|
|
|
JSONObject authCorpInfo = biz_data.getJSONObject("auth_corp_info");
|
|
|
String corp_name = authCorpInfo.getString("corp_name");
|
|
|
- String corpid = authCorpInfo.getString("corpid");
|
|
|
- String authUserId = biz_data.getJSONObject("auth_user_info").getString("userId");
|
|
|
- try {
|
|
|
- dingDingService.corpAuth(corpid, corp_name, authUserId);
|
|
|
- } catch (ApiException e) {
|
|
|
- e.printStackTrace();
|
|
|
+ boolean isAuthenticated = authCorpInfo.getBooleanValue("is_authenticated");
|
|
|
+
|
|
|
+ if ("org_suite_auth".equals(syncAction)) {
|
|
|
+ System.out.println("==Push 推送事件 开通授权应用===" + corp_name);
|
|
|
+ //此处在授权开通时强制赋值
|
|
|
+ isAuthenticated = true;
|
|
|
+ } else {
|
|
|
+ System.out.println("==Push 推送事件 授权变更==="+ corp_name+"=="+(isAuthenticated?"启用":"停用"));
|
|
|
}
|
|
|
- } else if ("org_suite_change".equals(syncAction)) {
|
|
|
- System.out.println("==Push 推送事件 org_suite_change===");
|
|
|
+ if (isAuthenticated) {
|
|
|
+ String corpid = authCorpInfo.getString("corpid");
|
|
|
+ String authUserId = biz_data.getJSONObject("auth_user_info").getString("userId");
|
|
|
+ try {
|
|
|
+ dingDingService.corpAuth(corpid, corp_name, authUserId);
|
|
|
+ } catch (ApiException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ System.out.println("===未授权启用===");
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ System.out.println("==Push 推送授权类型 ==="+syncAction);
|
|
|
+
|
|
|
}
|
|
|
} else if (bizType == 7) {
|
|
|
JSONObject biz_data = JSONObject.parseObject(bizItem.getString("biz_data"));
|
|
@@ -164,6 +178,7 @@ public class DingDingController {
|
|
|
@RequestMapping("/syncCorpMembs")
|
|
|
public HttpRespMsg syncCorpMembs(String corpid) {
|
|
|
try {
|
|
|
+ System.out.println("===========手动调用syncCorpMembs请求接口===========");
|
|
|
String rest = dingDingService.syncCorpMembs(corpid);
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
msg.data = rest;
|