Java tutorial
package me.ywork.ticket.suite.controller; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.redisson.cache.CacheableService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.heyi.framework.messagebus.kafka.KafkaProducer; import com.heyi.utils.IdGenerator; import me.ywork.message.topic.KafkaTopics; import me.ywork.ticket.DingTicketConfigure; import me.ywork.ticket.aes.DingTalkEncryptor; import me.ywork.ticket.constants.DingConstants; import me.ywork.ticket.message.DingOrgModifyMessage; import me.ywork.ticket.suite.entity.DingSuiteMain; import me.ywork.ticket.suite.entity.DingSuiteThirdApp; import me.ywork.ticket.suite.entity.DingSuiteThirdMain; import me.ywork.ticket.suite.model.QySuiteAgent; import me.ywork.ticket.suite.model.QySuiteAuthApp; import me.ywork.ticket.suite.model.QySuitePermanentCode; import me.ywork.ticket.suite.repository.DingSuiteThirdAppRepositroy; import me.ywork.ticket.suite.repository.DingSuiteThirdMainRepositroy; import me.ywork.ticket.suite.service.DingSuiteMainService; import me.ywork.ticket.suite.service.DingSuiteThirdAppService; import me.ywork.ticket.suite.service.DingSuiteThirdMainService; import me.ywork.ticket.suite.service.IAccessTokenService; import me.ywork.ticket.suite.service.IDingApiService; import me.ywork.ticket.util.DingAPIHttpUtil; @Controller @RequestMapping("**/alid/dingservice") public class DingServiceController { private static Logger logger = LoggerFactory.getLogger(DingServiceController.class); @Autowired private IDingApiService dingApiService; @Autowired private IAccessTokenService accessTokenService; @Autowired private DingSuiteMainService dingSuiteMainService; @Autowired private DingSuiteThirdMainService dingSuiteThirdMainService; @Autowired private DingSuiteThirdMainRepositroy dingSuiteThirdRepositroy; @Autowired private DingSuiteThirdAppRepositroy dingSuiteThirdappRepositroy; @Autowired private DingSuiteThirdAppService dingSuiteThirdappService; @Autowired private CacheableService cacheableService; private Map<String, DingTalkEncryptor> dmap = new HashMap<String, DingTalkEncryptor>(); @RequestMapping(value = "/index/testorg", method = RequestMethod.GET) public void testorg(@RequestParam("suiteid") String sid, @RequestParam("corpId") String corpId, HttpServletRequest request, HttpServletResponse response) { //?? DingOrgModifyMessage orgModifyMessage = new DingOrgModifyMessage(); orgModifyMessage.setEventType("sync_org"); orgModifyMessage.setSuiteId(sid); orgModifyMessage.setCorpId(corpId); orgModifyMessage.setChannel(KafkaTopics.DING_ORG_MANAGER_REAL.getTopic()); KafkaProducer.getInstance().sendMessage(KafkaTopics.DING_ORG_MANAGER_REAL.getTopic(), orgModifyMessage); logger.info(JSONObject.toJSONString(orgModifyMessage)); } /** * URL * 1.1 ?URL * 1.2 ?Ticket * 1.3 ?ISV??? * 1.4 ?ISV???? * 1.5"?" * 1.6"?" * 1.7"??" */ @RequestMapping(value = "/index/{suiteid}", method = RequestMethod.POST) public void isvReceive(@PathVariable("suiteid") String sid, HttpServletRequest request, HttpServletResponse response) { String msgSignature = request.getParameter("signature"); String timeStamp = request.getParameter("timestamp"); String nonce = request.getParameter("nonce"); try { // ?DingTalk?POST? InputStream inputStream = request.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); JSONObject jsonEncrypt = DingAPIHttpUtil.getBody(br); br.close(); inputStream.close(); // ?JSONencrypt String encryptStr = jsonEncrypt.getString("encrypt"); // ?ID:suiteIdID if (StringUtils.isEmpty(sid)) { sid = "suite4xxxxxxxxxxxxxxx"; } else if (sid.indexOf("?") > 0) { sid = sid.substring(0, sid.indexOf("?")); } // ???? DingTalkEncryptor dingTalkEncryptor = null; DingSuiteMain suite = dingSuiteMainService.getDingSuiteFromCache(sid); if (suite == null) { dingTalkEncryptor = dmap.get(DingTicketConfigure.defaultSuiteKey); if (dingTalkEncryptor == null) { dingTalkEncryptor = new DingTalkEncryptor(DingTicketConfigure.defaultToken, DingTicketConfigure.defaultAESKey, DingTicketConfigure.defaultSuiteKey); dmap.put(DingTicketConfigure.defaultSuiteKey, dingTalkEncryptor); } } else { dingTalkEncryptor = dmap.get(suite.getSuiteId()); if (dingTalkEncryptor == null) { dingTalkEncryptor = new DingTalkEncryptor(suite.getToken(), suite.getEncodingAESKey(), suite.getSuiteId()); dmap.put(suite.getSuiteId(), dingTalkEncryptor); } } // encrypt String plainText = dingTalkEncryptor.getDecryptMsg(msgSignature, timeStamp, nonce, encryptStr); // encrypt????eventType???? JSONObject plainTextJson = JSONObject.parseObject(plainText); String eventType = plainTextJson.getString("EventType"); logger.info("({})?{}", sid, eventType); switch (eventType) { case "suite_ticket": // (??)?Ticket doSuccessResponse(dingTalkEncryptor, response, "success", msgSignature, timeStamp, nonce); doSuiteTicket(sid, plainTextJson); break; case "tmp_auth_code": // ??? doSuccessResponse(dingTalkEncryptor, response, "success", msgSignature, timeStamp, nonce); doTmpAuthCode(sid, plainTextJson); break; case "change_auth": // ???? doSuccessResponse(dingTalkEncryptor, response, "success", msgSignature, timeStamp, nonce); doChangeAuth(sid, plainTextJson); break; case "check_create_suite_url": // ?URL doSuccessResponse(dingTalkEncryptor, response, plainTextJson.getString("Random"), msgSignature, timeStamp, nonce); break; case "check_update_suite_url": // "?"API doSuccessResponse(dingTalkEncryptor, response, plainTextJson.getString("Random"), msgSignature, timeStamp, nonce); break; case "suite_relieve": // "?" doSuccessResponse(dingTalkEncryptor, response, "success", msgSignature, timeStamp, nonce); doSuiteRelieve(sid, plainTextJson); break; case "check_suite_license_code": // "??""success",?? ??? boolean isValid = doCheckSuiteLicenseCode(plainTextJson); if (isValid) { doSuccessResponse(dingTalkEncryptor, response, "success", msgSignature, timeStamp, nonce); } break; default: break; } } catch (Exception e) { logger.error("?{}", e); } } /** * ?URL?? */ @RequestMapping(value = "/orgchange/{suiteid}", method = RequestMethod.POST) public void orgchange(@PathVariable("suiteid") String sid, HttpServletRequest request, HttpServletResponse response) { // ? String msgSignature = request.getParameter("signature"); String timeStamp = request.getParameter("timestamp"); String nonce = request.getParameter("nonce"); if (StringUtils.isEmpty(sid)) { logger.error( "??IDding_suite_main??"); return; } else if (sid.indexOf("?") > 0) { sid = sid.substring(0, sid.indexOf("?")); } // POST? try { InputStream inputStream = request.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); String buffer = null; StringBuffer sb = new StringBuffer(); while ((buffer = br.readLine()) != null) { sb.append(buffer + "\n"); } br.close(); inputStream.close(); JSONObject json = JSON.parseObject(sb.toString()); String encryptStr = json.getString("encrypt"); DingSuiteMain suite = dingSuiteMainService.getDingSuiteFromCache(sid); DingTalkEncryptor dingTalkEncryptor = dmap.get(suite.getSuiteId()); if (dingTalkEncryptor == null) { dingTalkEncryptor = new DingTalkEncryptor(suite.getToken(), suite.getEncodingAESKey(), suite.getSuiteId()); dmap.put(suite.getSuiteId(), dingTalkEncryptor); } // ?????,SUCCESS doSuccessResponse(dingTalkEncryptor, response, "success", msgSignature, timeStamp, nonce); // encrypt String plainText = null; plainText = dingTalkEncryptor.getDecryptMsg(msgSignature, timeStamp, nonce, encryptStr); logger.info("???{}", plainText); // ?json JSONObject plainTextJson = JSONObject.parseObject(plainText); String eventType = plainTextJson.getString("EventType"); if (eventType.equals("check_url")) { // url, return; } // ??? String corpId = plainTextJson.getString("CorpId"); JSONArray userIds = plainTextJson.getJSONArray("UserId"); String[] userIdArray = null; if (userIds != null && userIds.size() > 0) { userIdArray = new String[userIds.size()]; for (int i = 0; i < userIds.size(); i++) { userIdArray[i] = userIds.getString(i); } } JSONArray deptIds = plainTextJson.getJSONArray("DeptId"); String[] deptIdArray = null; if (deptIds != null && deptIds.size() > 0) { deptIdArray = new String[deptIds.size()]; for (int i = 0; i < deptIds.size(); i++) { deptIdArray[i] = deptIds.getString(i); } } //org? DingOrgModifyMessage orgModifyMessage = new DingOrgModifyMessage(); orgModifyMessage.setEventType(eventType); orgModifyMessage.setSuiteId(sid); orgModifyMessage.setCorpId(corpId); orgModifyMessage.setDeptId(deptIdArray); orgModifyMessage.setUserId(userIdArray); orgModifyMessage.setChannel(KafkaTopics.DING_ORG_MANAGER_REAL.getTopic()); KafkaProducer.getInstance().sendMessage(KafkaTopics.DING_ORG_MANAGER_REAL.getTopic(), orgModifyMessage); } catch (Exception ex) { logger.error("?", ex); } } /** * ? ?? * @param suiteid * @param request * @param response * @throws IOException * @throws ServletException */ @RequestMapping(value = { "/orgregister/{suiteid}" }, method = RequestMethod.GET) public void orgregister(@PathVariable("suiteid") String suiteid, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (StringUtils.isEmpty(suiteid)) { suiteid = "test01"; // TODO } else { // suiteid = suiteid.substring(0,suiteid.indexOf("?")); } DingSuiteMain suite = dingSuiteMainService.getDingSuiteFromCache(suiteid); String corpid = request.getParameter("corpid"); if (StringUtils.isNotBlank(corpid)) { //? DingSuiteThirdMain dingSuiteThird = dingSuiteThirdMainService.findDingSuiteThirdByCorpId(corpid, suiteid); if (dingSuiteThird == null) { logger.error("===" + corpid + "===" + suiteid + "===no auth"); return; } registerCallBack(suite, dingSuiteThird); } else { //? int pageNo = 1; int pageSize = 300; int startPage = 0; boolean ef = true; do { startPage = pageNo <= 1 ? 0 : (pageNo - 1) * pageSize; List<DingSuiteThirdMain> pageList = dingSuiteThirdMainService.findByPage(suiteid, startPage, pageSize); if (pageList != null && pageList.size() > 0) { for (DingSuiteThirdMain dingSuiteThird : pageList) { try { registerCallBack(suite, dingSuiteThird); } catch (Exception e) { e.printStackTrace(); } } pageNo++; logger.info("==========================================================================page:" + pageNo); } else { ef = false; } } while (ef); } } /** * ?Ticket */ private void doSuiteTicket(String sid, JSONObject json) { String ticket = json.getString("SuiteTicket"); Object cache = cacheableService.getRawObjectFromCache(sid + DingConstants.SUITE_TICKET_KEY); if (cache != null) { cacheableService.deleteRawObjectInCache(sid + DingConstants.SUITE_TICKET_KEY); } cacheableService.setRawObjectInCache(sid + DingConstants.SUITE_TICKET_KEY, ticket, 30, TimeUnit.MINUTES); logger.info("??Ticket({})", ticket); } /** * ?ISV??? ??? ?? db */ private boolean doTmpAuthCode(String sid, JSONObject json) { // ??suiteKey String tmpAuthCode = json.getString("AuthCode"); String suiteKey = json.getString("SuiteKey"); if (StringUtils.isEmpty(tmpAuthCode) || StringUtils.isEmpty(suiteKey)) { logger.error("???AuthCodeSuiteKey"); return false; } // redis??Ticket String suiteTicket = this.getSuiteTicket(sid); if (StringUtils.isEmpty(suiteTicket)) { logger.error("????({})Ticket,??{}", sid, tmpAuthCode); return false; } DingSuiteMain suite = dingSuiteMainService.getDingSuiteFromCache(sid); // ?Access Token String suiteAccessToken = this.getSuiteAccessToken(suite); if (StringUtils.isEmpty(suiteAccessToken)) { logger.error("????({})AccessToken", sid); return false; } // ??????(???)??? QySuitePermanentCode codeResModel = null; String permanentCode = null; String corpId = null; String corpName = null; try { codeResModel = dingApiService.getPermanentCode(suite, tmpAuthCode, suiteTicket); if (codeResModel == null) { logger.error( "???({})??({})????Null", sid, tmpAuthCode); return false; } if (codeResModel.getErrcode() != 0) { logger.error("({})??????errcode={}, errmsg={}", sid, codeResModel.getErrcode(), codeResModel.getErrmsg()); return false; } } catch (Exception ex) { logger.error("({})??({})????{}", sid, tmpAuthCode, ex); return false; } // ?? permanentCode = codeResModel.getPermanentCode(); corpId = codeResModel.getAuthCorpInfo().getCorpId(); corpName = codeResModel.getAuthCorpInfo().getCorpName(); logger.info("({})??({})??({})??({})?", sid, tmpAuthCode, corpId + " " + corpName, permanentCode); int errCode = -1; // try { errCode = dingApiService.activateSuite(corpId, suiteKey, permanentCode, suiteAccessToken); if (errCode != 0) { logger.warn( "??????({})({})?{}", corpId + " " + corpName, sid, errCode); //? errCode = dingApiService.activateSuite(corpId, suiteKey, permanentCode, suiteAccessToken); } else { logger.info( "??????({})({})?", corpId + " " + corpName, sid); } if (errCode != 0) { logger.error( "??????({})({})?{}", corpId + " " + corpName, sid, errCode); } else { logger.info( "??????({})({})?", corpId + " " + corpName, sid); } } catch (Exception ex) { logger.error( "??????({})({})", ex); } if (errCode != 0) { return false; } boolean isNew = false; DingSuiteThirdMain suiteThirdMain = dingSuiteThirdMainService.findDingSuiteThirdByCorpId(corpId, sid); if (suiteThirdMain == null) { isNew = true; suiteThirdMain = new DingSuiteThirdMain(); suiteThirdMain.setId(IdGenerator.newId()); suiteThirdMain.setSuiteId(sid); suiteThirdMain.setCorpId(corpId); suiteThirdMain.setCreateDate(new Date()); } else { suiteThirdMain.setModifiedDate(new Date()); } suiteThirdMain.setPermanentCode(permanentCode); suiteThirdMain.setCorpName(corpName); suiteThirdMain.setEnabled((short) 1); if (isNew) { try { dingSuiteThirdRepositroy.insert(suiteThirdMain); logger.info( "??????({})??", corpId + " " + corpName); } catch (Exception ex) { logger.error( "??????({})?{}", corpId + " " + corpName, ex); return false; } } else { try { dingSuiteThirdRepositroy.update(suiteThirdMain); logger.info( "??????({})??", corpId + " " + corpName); } catch (Exception ex) { logger.error( "??????({})?{}", corpId + " " + corpName, ex); return false; } } // registerCallBack(suite, suiteThirdMain); // ??? JSONObject changeAuthJson = JSON .parseObject("{'SuiteKey':'" + suiteKey + "','AuthCorpId':'" + corpId + "'}"); doChangeAuth(sid, changeAuthJson); //?? DingOrgModifyMessage orgModifyMessage = new DingOrgModifyMessage(); orgModifyMessage.setEventType("sync_org"); orgModifyMessage.setSuiteId(sid); orgModifyMessage.setCorpId(corpId); orgModifyMessage.setChannel(KafkaTopics.DING_ORG_MANAGER_REAL.getTopic()); KafkaProducer.getInstance().sendMessage(KafkaTopics.DING_ORG_MANAGER_REAL.getTopic(), orgModifyMessage); return true; } /** * ?ISV???? */ private void doChangeAuth(String sid, JSONObject json) { // ????? String suiteKey = json.getString("SuiteKey"); String authCorpId = json.getString("AuthCorpId"); // DingSuiteMain suite = dingSuiteMainService.getDingSuiteFromCache(sid); // ?AccessToken String suiteAccessToken = this.getSuiteAccessToken(suite); if (StringUtils.isEmpty(suiteAccessToken)) { logger.error("?????({})AccessToken", sid); return; } // ???? DingSuiteThirdMain suiteThird = dingSuiteThirdMainService.findDingSuiteThirdByCorpId(authCorpId, sid); if (suiteThird == null) { logger.error( "??????({})??({})??", sid, authCorpId); return; } String permanentCode = suiteThird.getPermanentCode(); // API??? QySuitePermanentCode authInfoModel = null; try { authInfoModel = dingApiService.getAuthInfo(suite, authCorpId, permanentCode, suiteKey); } catch (Exception ex) { logger.error( "?????({})API??({})??{}", sid, authCorpId, ex); } if (authInfoModel == null) { logger.error( "????? ({})API??({})????", sid, authCorpId); return; } if (authInfoModel.getErrcode() != 0) { logger.error( "????? ({})API??({})??{}", sid, authCorpId, authInfoModel.getErrmsg()); return; } // ????DB short isSuiteEnabled = 2; // 2?? Date now = new Date(); List<QySuiteAgent> agents = authInfoModel.getAuthInfo().getQySuiteAgents(); List<DingSuiteThirdApp> thirdApps = dingSuiteThirdappService.findBySuiteThirdId(suiteThird.getId()); Map<String, DingSuiteThirdApp> map = null; if (thirdApps != null && thirdApps.size() > 0) { map = new HashMap<String, DingSuiteThirdApp>(); for (DingSuiteThirdApp thirdApp : thirdApps) { map.put(suiteThird.getId() + thirdApp.getAppId(), thirdApp); } } for (QySuiteAgent agent : agents) { QySuiteAuthApp resMode = null; try { resMode = dingApiService.getAgent(suite, authCorpId, permanentCode, agent.getAgentId(), suiteKey); } catch (Exception ex) { logger.error( "????????{}", ex); } if (resMode == null) { logger.error( "????????"); break; } boolean isEnabled = resMode.getClose() == 1 ? true : false; if (isEnabled) { // ????enabled1 isSuiteEnabled = (short) 1; } DingSuiteThirdApp tapp = map == null ? null : map.get(suiteThird.getId() + agent.getAppid()); boolean isNew = false; if (tapp == null) { tapp = new DingSuiteThirdApp(); tapp.setId(IdGenerator.newId()); tapp.setCreateDate(new Date()); isNew = true; } tapp.setAgentId(agent.getAgentId()); tapp.setAgentName(agent.getName()); tapp.setLogoUrl(agent.getLogoUrl()); tapp.setAppId(agent.getAppid()); tapp.setModifiedDate(new Date()); tapp.setEnabled(isEnabled); tapp.setThirdId(suiteThird.getId()); if (isNew) { dingSuiteThirdappRepositroy.insert(tapp); logger.info( "???????({})?({})?({})?", authCorpId, agent.getAgentId() + " " + agent.getName(), isEnabled); } else { dingSuiteThirdappRepositroy.update(tapp); logger.info( "???????({})?({})?({})?", authCorpId, agent.getAgentId() + " " + agent.getName(), isEnabled); } } // ?DBop_platform_suite_third suiteThird.setModifiedDate(now); suiteThird.setEnabled(isSuiteEnabled); dingSuiteThirdRepositroy.update(suiteThird); logger.info( "???????({})?({})?", authCorpId, isSuiteEnabled); } /** * "?":???;??? */ private void doSuiteRelieve(String suiteId, JSONObject json) { logger.debug("???"); String authCorpId = json.getString("AuthCorpId"); DingSuiteThirdMain suiteThird = dingSuiteThirdMainService.findDingSuiteThirdByCorpId(authCorpId, suiteId); if (suiteThird != null) { suiteThird.setModifiedDate(new Date()); suiteThird.setEnabled((short) 0); // ??agentIdsnull?? dingSuiteThirdappService.updateAgentStatus(authCorpId, suiteId, null); // ??token DingSuiteMain suite = dingSuiteMainService.getDingSuiteFromCache(suiteId); String tokenKey = suiteThird.getCorpId() + suite.getId() + "token_redis"; String jsapiKey = suiteThird.getCorpId() + suite.getId() + "jsapi_ticket"; Object cacheToken = cacheableService.getRawObjectFromCache(tokenKey); if (cacheToken != null) { cacheableService.deleteRawObjectInCache(tokenKey); } Object cacheJsapiTiekct = cacheableService.getRawObjectFromCache(jsapiKey); if (cacheJsapiTiekct != null) { cacheableService.deleteRawObjectInCache(jsapiKey); } logger.debug( "???????({})?({})??", suiteId, authCorpId); } else { logger.error( "????????({})??({})?", suiteId, authCorpId); } } /** * "??" ???"??"??,LicenseCode??,?"success" * ?LicenseCode?? */ private boolean doCheckSuiteLicenseCode(JSONObject json) { String suiteKey = json.getString("SuiteKey"); String authCorpId = json.getString("AuthCorpId"); String licenseCode = json.getString("LicenseCode"); if (licenseCode.equals(DingTicketConfigure.verificationCode)) { logger.debug("???"); // lanCorpId String cacheId = authCorpId + suiteKey + DingConstants.CORP_SUITE_SSN; Object cache = cacheableService.getRawObjectFromCache(cacheId); if (cache != null) { cacheableService.deleteRawObjectInCache(cacheId); } //cacheableService.setRawObjectInCache(cacheId, yworkCorpId, 1, TimeUnit.DAYS); return true; } return false; } /** * ?ID?Ticket */ private String getSuiteTicket(String suiteId) { String suiteTicket = null; Object cache = cacheableService.getRawObjectFromCache(suiteId + DingConstants.SUITE_TICKET_KEY); if (cache != null) { suiteTicket = (String) cache; } return suiteTicket; } /** * ??AccessToken */ private String getSuiteAccessToken(DingSuiteMain suite) { String suiteAccessToken = null; String suiteTicket = this.getSuiteTicket(suite.getId()); if (StringUtils.isEmpty(suiteTicket)) { return null; } suiteAccessToken = accessTokenService.getSuiteToken(suite, suiteTicket); return suiteAccessToken; } /** * ?? */ private static void doSuccessResponse(DingTalkEncryptor dingTalkEncryptor, HttpServletResponse response, String encryptStr, String msgSignature, String timeStamp, String nonceStr) { try { Long longTime = Long.parseLong(timeStamp); Map<String, String> jsonMap = dingTalkEncryptor.getEncryptedMap(encryptStr, longTime, nonceStr); PrintWriter printWriter = response.getWriter(); printWriter.print(JSONObject.toJSONString(jsonMap)); printWriter.close(); printWriter = null; } catch (Exception e) { logger.error("doSuccessResponse", e); } } private List<String> registerType = null; /** * */ private void registerCallBack(DingSuiteMain suite, DingSuiteThirdMain suiteThird) { JSONObject registerDataJson = new JSONObject(); if (registerType == null) { registerType = new ArrayList<String>(); registerType.add("user_add_org"); registerType.add("user_modify_org"); registerType.add("user_leave_org"); registerType.add("org_admin_add"); registerType.add("org_admin_remove"); registerType.add("org_dept_create"); registerType.add("org_dept_modify"); registerType.add("org_dept_remove"); registerType.add("org_remove"); } //chat?? registerDataJson.put("call_back_tag", registerType); registerDataJson.put("token", suite.getToken()); registerDataJson.put("aes_key", suite.getEncodingAESKey()); registerDataJson.put("url", suite.getAuthBackUrl()); int errCode = dingApiService.registerCallBack(registerDataJson, suiteThird); if (errCode == 71006) { //logger.info("???"); errCode = dingApiService.updateCallBack(registerDataJson, suiteThird); } if (errCode == 0) { logger.info("---------------success,,?:" + suiteThird.getCorpName()); } } }