//import cn.hutool.core.util.StrUtil;
//import com.alibaba.fastjson.JSON;
//import com.aliyun.dingtalkoauth2_1_0.Client;
//import com.aliyun.dingtalkoauth2_1_0.models.GetCorpAccessTokenRequest;
//import com.aliyun.dingtalkoauth2_1_0.models.GetCorpAccessTokenResponseBody;
//import com.aliyun.tea.TeaException;
//import com.aliyun.teaopenapi.models.Config;
//import com.fjhx.admin.BytesailingApplication;
//import com.fjhx.area.service.CustomizeAreaService;
//import com.fjhx.dingding.constant.Constant;
//import com.fjhx.dingding.service.DingService;
//import com.ruoyi.common.annotation.TenantIgnore;
//import com.ruoyi.common.exception.ServiceException;
//import com.ruoyi.framework.mybatis.holder.TenantHolder;
//import lombok.extern.slf4j.Slf4j;
//import org.junit.Test;
//import org.junit.runner.RunWith;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.test.context.SpringBootTest;
//import org.springframework.test.context.junit4.SpringRunner;
//
//
//@RunWith(SpringRunner.class)
//@SpringBootTest(classes = BytesailingApplication.class)
//@Slf4j
//public class DingDingTest {
//
//
//    @Autowired
//    private DingService dingService;
//
//    @Autowired
//    private CustomizeAreaService customizeAreaService;
//
//    @TenantIgnore
//    @Test
//    public void test1() {
//
//        TenantHolder.setIgnore(true);
//
//        String a = "{ \"bizData\":[\n" +
//                "        {\n" +
//                "            \"gmt_create\":1683798054000,\n" +
//                "            \"biz_type\":4,\n" +
//                "            \"open_cursor\":0,\n" +
//                "            \"subscribe_id\":\"30319001_0\",\n" +
//                "            \"id\":19960,\n" +
//                "            \"gmt_modified\":1683798054000,\n" +
//                "            \"biz_id\":\"30319001\",\n" +
//                "            \"biz_data\":\"{\\\"auth_user_info\\\":{\\\"userId\\\":\\\"manager2795\\\"},\\\"eventId\\\":\\\"e18758c115604987bb7ba2b4621ab34e\\\",\\\"auth_corp_info\\\":{\\\"corp_type\\\":0,\\\"corpid\\\":\\\"dingc265ea6f59c8a65524f2f5cc6abecb85\\\",\\\"auth_level\\\":0,\\\"corp_city\\\":\\\"吉隆坡\\\",\\\"auth_channel\\\":\\\"4\\\",\\\"industry\\\":\\\"影音视频\\\",\\\"full_corp_name\\\":\\\"宏星钉测\\\",\\\"corp_name\\\":\\\"宏星钉测\\\",\\\"corp_province\\\":\\\"吉隆坡\\\",\\\"is_ecological_corp\\\":false,\\\"invite_url\\\":\\\"https://wx-in-i.dingtalk.com/invite-page/weixin.html?bizSource=____source____&amp;corpId=dingc265ea6f59c8a65524f2f5cc6abecb85&amp;inviteCode=LWeFQxRHOfULrKM\\\",\\\"auth_channel_type\\\":\\\"\\\",\\\"corp_type_v2\\\":0,\\\"invite_code\\\":\\\"\\\",\\\"is_authenticated\\\":false,\\\"license_code\\\":\\\"\\\",\\\"corp_logo_url\\\":\\\"\\\"},\\\"syncAction\\\":\\\"org_suite_auth\\\",\\\"auth_scope\\\":{\\\"errcode\\\":0,\\\"condition_field\\\":[],\\\"auth_user_field\\\":[\\\"jobnumber\\\",\\\"isLeader\\\",\\\"name\\\",\\\"isAdmin\\\",\\\"avatar\\\",\\\"position\\\",\\\"department\\\",\\\"userid\\\",\\\"deviceId\\\",\\\"isHide\\\"],\\\"auth_org_scopes\\\":{\\\"authed_user\\\":[],\\\"authed_dept\\\":[1]},\\\"errmsg\\\":\\\"ok\\\"},\\\"auth_info\\\":{\\\"agent\\\":[{\\\"agentid\\\":2581464649,\\\"agent_name\\\":\\\"byteSailing_test\\\",\\\"logo_url\\\":\\\"https://static-legacy.dingtalk.com/media/lALPDfJ6cdfiyqfNAZDNAZA_400_400.png\\\",\\\"appid\\\":131175,\\\"use_app_role\\\":false,\\\"admin_list\\\":[\\\"manager2795\\\",\\\"231344025724080775\\\",\\\"1244061748905460\\\"]}]},\\\"permanent_code\\\":\\\"MGUG4eSzQWXajGqyCKlVxeZDly-fIhvIsg-Oe_9RiDAuVZselpxX3utY7KBYJLNx\\\",\\\"syncSeq\\\":\\\"8C4DD3DFE04AAE2FB1E6B2AEF7\\\"}\",\n" +
//                "            \"corp_id\":\"dingc265ea6f59c8a65524f2f5cc6abecb85\",\n" +
//                "            \"status\":0\n" +
//                "        },\n" +
//                "        {\n" +
//                "            \"gmt_create\":1683798959000,\n" +
//                "            \"biz_type\":4,\n" +
//                "            \"open_cursor\":0,\n" +
//                "            \"subscribe_id\":\"30319001_0\",\n" +
//                "            \"id\":19966,\n" +
//                "            \"gmt_modified\":1683798959000,\n" +
//                "            \"biz_id\":\"30319001\",\n" +
//                "            \"biz_data\":\"{\\\"auth_user_info\\\":{\\\"userId\\\":\\\"0146512911051043578\\\"},\\\"eventId\\\":\\\"04a9b05f50334f9fa51293892e20ed95\\\",\\\"auth_corp_info\\\":{\\\"corp_type\\\":0,\\\"corpid\\\":\\\"ding53d823e205604918a39a90f97fcb1e09\\\",\\\"auth_level\\\":1,\\\"corp_city\\\":\\\"福州\\\",\\\"auth_channel\\\":\\\"4\\\",\\\"industry\\\":\\\"计算机软件\\\",\\\"full_corp_name\\\":\\\"福建数字云帆科技有限公司\\\",\\\"corp_name\\\":\\\"福建数字云帆科技有限公司\\\",\\\"corp_province\\\":\\\"福建\\\",\\\"is_ecological_corp\\\":false,\\\"invite_url\\\":\\\"https://wx-in-i.dingtalk.com/invite-page/weixin.html?bizSource=____source____&amp;corpId=ding53d823e205604918a39a90f97fcb1e09&amp;inviteCode=NxLoVevdvDloXGi\\\",\\\"auth_channel_type\\\":\\\"\\\",\\\"corp_type_v2\\\":0,\\\"invite_code\\\":\\\"\\\",\\\"is_authenticated\\\":true,\\\"license_code\\\":\\\"\\\",\\\"corp_logo_url\\\":\\\"\\\"},\\\"syncAction\\\":\\\"org_suite_auth\\\",\\\"auth_scope\\\":{\\\"errcode\\\":0,\\\"condition_field\\\":[],\\\"auth_user_field\\\":[\\\"jobnumber\\\",\\\"isLeader\\\",\\\"name\\\",\\\"isAdmin\\\",\\\"avatar\\\",\\\"position\\\",\\\"department\\\",\\\"userid\\\",\\\"deviceId\\\",\\\"isHide\\\"],\\\"auth_org_scopes\\\":{\\\"authed_user\\\":[],\\\"authed_dept\\\":[1]},\\\"errmsg\\\":\\\"ok\\\"},\\\"auth_info\\\":{\\\"agent\\\":[{\\\"agentid\\\":2581336572,\\\"agent_name\\\":\\\"byteSailing_test\\\",\\\"logo_url\\\":\\\"https://static-legacy.dingtalk.com/media/lALPDfJ6cdfiyqfNAZDNAZA_400_400.png\\\",\\\"appid\\\":131175,\\\"use_app_role\\\":false,\\\"admin_list\\\":[\\\"01392913111186905\\\",\\\"0146512911051043578\\\"]}]},\\\"permanent_code\\\":\\\"-icZLdi8NmOL2Rte7Sh3CqdbBcIOGf6eZtJhFNMRBkBugTISTm7zbP21uspckibW\\\",\\\"syncSeq\\\":\\\"844DD3DFE04AAE2FB1E6B2AEA0\\\"}\",\n" +
//                "            \"corp_id\":\"ding53d823e205604918a39a90f97fcb1e09\",\n" +
//                "            \"status\":0\n" +
//                "        },\n" +
//                "        {\n" +
//                "            \"gmt_create\":1683799205000,\n" +
//                "            \"biz_type\":4,\n" +
//                "            \"open_cursor\":0,\n" +
//                "            \"subscribe_id\":\"30319001_0\",\n" +
//                "            \"id\":19970,\n" +
//                "            \"gmt_modified\":1683799205000,\n" +
//                "            \"biz_id\":\"30319001\",\n" +
//                "            \"biz_data\":\"{\\\"auth_user_info\\\":{\\\"userId\\\":\\\"manager6338\\\"},\\\"eventId\\\":\\\"025ca5fb30c9472c8a7ea8211adf78ef\\\",\\\"auth_corp_info\\\":{\\\"corp_type\\\":0,\\\"corpid\\\":\\\"dingb543e6dc430497bbee0f45d8e4f7c288\\\",\\\"auth_level\\\":0,\\\"auth_channel\\\":\\\"4\\\",\\\"industry\\\":\\\"\\\",\\\"full_corp_name\\\":\\\"hffff 测试\\\",\\\"corp_name\\\":\\\"hffff 测试\\\",\\\"is_ecological_corp\\\":false,\\\"invite_url\\\":\\\"https://wx-in-i.dingtalk.com/invite-page/weixin.html?bizSource=____source____&amp;corpId=dingb543e6dc430497bbee0f45d8e4f7c288&amp;inviteCode=DVwNu9mv9AowRNZ\\\",\\\"auth_channel_type\\\":\\\"\\\",\\\"corp_type_v2\\\":0,\\\"invite_code\\\":\\\"\\\",\\\"is_authenticated\\\":false,\\\"license_code\\\":\\\"\\\",\\\"corp_logo_url\\\":\\\"\\\"},\\\"syncAction\\\":\\\"org_suite_auth\\\",\\\"auth_scope\\\":{\\\"errcode\\\":0,\\\"condition_field\\\":[],\\\"auth_user_field\\\":[\\\"jobnumber\\\",\\\"isLeader\\\",\\\"name\\\",\\\"isAdmin\\\",\\\"avatar\\\",\\\"position\\\",\\\"department\\\",\\\"userid\\\",\\\"deviceId\\\",\\\"isHide\\\"],\\\"auth_org_scopes\\\":{\\\"authed_user\\\":[],\\\"authed_dept\\\":[1]},\\\"errmsg\\\":\\\"ok\\\"},\\\"auth_info\\\":{\\\"agent\\\":[{\\\"agentid\\\":2581242807,\\\"agent_name\\\":\\\"byteSailing_test\\\",\\\"logo_url\\\":\\\"https://static-legacy.dingtalk.com/media/lALPDfJ6cdfiyqfNAZDNAZA_400_400.png\\\",\\\"appid\\\":131175,\\\"use_app_role\\\":false,\\\"admin_list\\\":[\\\"manager6338\\\"]}]},\\\"permanent_code\\\":\\\"oVS5wid1S_B5JPXGZtiNH_gu0N0Diev6SLWHSaEpvHvClNEua_eIINRMOw2JIUC4\\\",\\\"syncSeq\\\":\\\"874DD3DFE04AA32FA1E6B2AEA5\\\"}\",\n" +
//                "            \"corp_id\":\"dingb543e6dc430497bbee0f45d8e4f7c288\",\n" +
//                "            \"status\":0\n" +
//                "        },\n" +
//                "        {\n" +
//                "            \"gmt_create\":1683810014000,\n" +
//                "            \"biz_type\":4,\n" +
//                "            \"open_cursor\":0,\n" +
//                "            \"subscribe_id\":\"30319001_0\",\n" +
//                "            \"id\":19981,\n" +
//                "            \"gmt_modified\":1683810014000,\n" +
//                "            \"biz_id\":\"30319001\",\n" +
//                "            \"biz_data\":\"{\\\"auth_user_info\\\":{\\\"userId\\\":\\\"manager8063\\\"},\\\"eventId\\\":\\\"9cee61dc4e3e4226a424b0f07c593a0e\\\",\\\"auth_corp_info\\\":{\\\"corp_type\\\":0,\\\"corpid\\\":\\\"ding379d86d92b0c876eee0f45d8e4f7c288\\\",\\\"auth_level\\\":0,\\\"auth_channel\\\":\\\"4\\\",\\\"industry\\\":\\\"\\\",\\\"full_corp_name\\\":\\\"中星华宸\\\",\\\"corp_name\\\":\\\"中星华宸\\\",\\\"is_ecological_corp\\\":false,\\\"invite_url\\\":\\\"https://wx-in-i.dingtalk.com/invite-page/weixin.html?bizSource=____source____&amp;corpId=ding379d86d92b0c876eee0f45d8e4f7c288&amp;inviteCode=r1zJSofuiKs5eDA\\\",\\\"auth_channel_type\\\":\\\"\\\",\\\"corp_type_v2\\\":0,\\\"invite_code\\\":\\\"\\\",\\\"is_authenticated\\\":false,\\\"license_code\\\":\\\"\\\",\\\"corp_logo_url\\\":\\\"\\\"},\\\"syncAction\\\":\\\"org_suite_auth\\\",\\\"auth_scope\\\":{\\\"errcode\\\":0,\\\"condition_field\\\":[],\\\"auth_user_field\\\":[\\\"jobnumber\\\",\\\"isLeader\\\",\\\"name\\\",\\\"isAdmin\\\",\\\"avatar\\\",\\\"position\\\",\\\"department\\\",\\\"userid\\\",\\\"deviceId\\\",\\\"isHide\\\"],\\\"auth_org_scopes\\\":{\\\"authed_user\\\":[],\\\"authed_dept\\\":[1]},\\\"errmsg\\\":\\\"ok\\\"},\\\"auth_info\\\":{\\\"agent\\\":[{\\\"agentid\\\":2581402962,\\\"agent_name\\\":\\\"byteSailing_test\\\",\\\"logo_url\\\":\\\"https://static-legacy.dingtalk.com/media/lALPDfJ6cdfiyqfNAZDNAZA_400_400.png\\\",\\\"appid\\\":131175,\\\"use_app_role\\\":false,\\\"admin_list\\\":[\\\"manager8063\\\"]}]},\\\"permanent_code\\\":\\\"jZa3L6vaNTyEhmg5ZmAT2Ym9-NUrUjTIp8wSNek2SO8O3bZPGzn9pfDUE0N5E82k\\\",\\\"syncSeq\\\":\\\"804DD3DFE04AAF2F01E6B2AE67\\\"}\",\n" +
//                "            \"corp_id\":\"ding379d86d92b0c876eee0f45d8e4f7c288\",\n" +
//                "            \"status\":0\n" +
//                "        },\n" +
//                "        {\n" +
//                "            \"gmt_create\":1683854166000,\n" +
//                "            \"biz_type\":4,\n" +
//                "            \"open_cursor\":0,\n" +
//                "            \"subscribe_id\":\"30319001_0\",\n" +
//                "            \"id\":19993,\n" +
//                "            \"gmt_modified\":1683854166000,\n" +
//                "            \"biz_id\":\"30319001\",\n" +
//                "            \"biz_data\":\"{\\\"auth_user_info\\\":{\\\"userId\\\":\\\"manager7560\\\"},\\\"eventId\\\":\\\"8f508ef39eab4a37b643c0195e8ec862\\\",\\\"auth_corp_info\\\":{\\\"corp_type\\\":0,\\\"corpid\\\":\\\"ding3f327504d104ac1cf2c783f7214b6d69\\\",\\\"auth_level\\\":0,\\\"corp_city\\\":\\\"福州\\\",\\\"auth_channel\\\":\\\"4\\\",\\\"industry\\\":\\\"计算机软件\\\",\\\"full_corp_name\\\":\\\"hf测试\\\",\\\"corp_name\\\":\\\"hf测试\\\",\\\"corp_province\\\":\\\"福建\\\",\\\"is_ecological_corp\\\":false,\\\"invite_url\\\":\\\"https://wx-in-i.dingtalk.com/invite-page/weixin.html?bizSource=____source____&amp;corpId=ding3f327504d104ac1cf2c783f7214b6d69&amp;inviteCode=i8yWYDEytZJIkIa\\\",\\\"auth_channel_type\\\":\\\"\\\",\\\"corp_type_v2\\\":0,\\\"invite_code\\\":\\\"\\\",\\\"is_authenticated\\\":false,\\\"license_code\\\":\\\"\\\",\\\"corp_logo_url\\\":\\\"\\\"},\\\"syncAction\\\":\\\"org_suite_auth\\\",\\\"auth_scope\\\":{\\\"errcode\\\":0,\\\"condition_field\\\":[],\\\"auth_user_field\\\":[\\\"jobnumber\\\",\\\"isLeader\\\",\\\"name\\\",\\\"isAdmin\\\",\\\"avatar\\\",\\\"position\\\",\\\"department\\\",\\\"userid\\\",\\\"deviceId\\\",\\\"isHide\\\"],\\\"auth_org_scopes\\\":{\\\"authed_user\\\":[],\\\"authed_dept\\\":[1]},\\\"errmsg\\\":\\\"ok\\\"},\\\"auth_info\\\":{\\\"agent\\\":[{\\\"agentid\\\":2581273014,\\\"agent_name\\\":\\\"byteSailing_test\\\",\\\"logo_url\\\":\\\"https://static-legacy.dingtalk.com/media/lALPDfJ6cdfiyqfNAZDNAZA_400_400.png\\\",\\\"appid\\\":131175,\\\"use_app_role\\\":false,\\\"admin_list\\\":[\\\"manager7560\\\"]}]},\\\"permanent_code\\\":\\\"caY2fuNclujXwRXlDOuctE-4HlOY6hWfgBTnMDbOaCPGQ-yzWQBxE6-axKq9XSJy\\\",\\\"syncSeq\\\":\\\"844DD3DFE04AAD2F91E6B2AEE5\\\"}\",\n" +
//                "            \"corp_id\":\"ding3f327504d104ac1cf2c783f7214b6d69\",\n" +
//                "            \"status\":0\n" +
//                "        },\n" +
//                "        {\n" +
//                "            \"gmt_create\":1683854404000,\n" +
//                "            \"biz_type\":2,\n" +
//                "            \"open_cursor\":0,\n" +
//                "            \"subscribe_id\":\"30319001_0\",\n" +
//                "            \"id\":19994,\n" +
//                "            \"gmt_modified\":1683854404000,\n" +
//                "            \"biz_id\":\"30319001\",\n" +
//                "            \"biz_data\":\"{\\\"eventId\\\":\\\"e50ed7cdf209448fa567e523bfc52b83\\\",\\\"syncAction\\\":\\\"suite_ticket\\\",\\\"suiteTicket\\\":\\\"2SwvImnFmDGqrCpEdmHeOjwBpBBj0o30nJmsqzMGUD3HJ2zMqckkTwlzM40GycbsjBKE0h2wUQHb3AQMrRtzCl\\\",\\\"syncSeq\\\":\\\"2AEA5DA284BB85DEE8CA8D33A9\\\"}\",\n" +
//                "            \"corp_id\":\"ding53d823e205604918a39a90f97fcb1e09\",\n" +
//                "            \"status\":0\n" +
//                "        }\n" +
//                "    ]}";
//
//
//        dingService.pushHigh(JSON.parseObject(a));
//
//        System.out.println();
//
//    }
//
//    public static void main(String[] args) {
//        String a = "{ \"bizData\":[        {\n" +
//                "            \"gmt_create\":1683854404000,\n" +
//                "            \"biz_type\":2,\n" +
//                "            \"open_cursor\":0,\n" +
//                "            \"subscribe_id\":\"30319001_0\",\n" +
//                "            \"id\":19994,\n" +
//                "            \"gmt_modified\":1683854404000,\n" +
//                "            \"biz_id\":\"30319001\",\n" +
//                "            \"biz_data\":\"{\\\"eventId\\\":\\\"e50ed7cdf209448fa567e523bfc52b83\\\",\\\"syncAction\\\":\\\"suite_ticket\\\",\\\"suiteTicket\\\":\\\"2SwvImnFmDGqrCpEdmHeOjwBpBBj0o30nJmsqzMGUD3HJ2zMqckkTwlzM40GycbsjBKE0h2wUQHb3AQMrRtzCl\\\",\\\"syncSeq\\\":\\\"2AEA5DA284BB85DEE8CA8D33A9\\\"}\",\n" +
//                "            \"corp_id\":\"ding53d823e205604918a39a90f97fcb1e09\",\n" +
//                "            \"status\":0\n" +
//                "        }]}";
//        System.out.println(JSON.parse(a));
//    }
//
//
//    private static String test1(String corpId) {
//        GetCorpAccessTokenRequest getCorpAccessTokenRequest = new GetCorpAccessTokenRequest()
//                .setSuiteKey(Constant.SUITE_KEY)
//                .setSuiteSecret(Constant.SUITE_SECRET)
//                .setAuthCorpId(corpId)
//                .setSuiteTicket("2SwvImnFmDGqrCpEdmHeOjwBpBBj0o30nJmsqzMGUD3HJ2zMqckkTwlzM40GycbsjBKE0h2wUQHb3AQMrRtzCl");
//
//        try {
//            Client client = getClient2();
//            GetCorpAccessTokenResponseBody body = client.getCorpAccessToken(getCorpAccessTokenRequest).getBody();
//            return body.getAccessToken();
//        } catch (Exception e) {
//
//            TeaException teaException;
//
//            if (e instanceof TeaException) {
//                teaException = (TeaException) e;
//            } else {
//                teaException = new TeaException(e.getMessage(), e);
//            }
//
//            String errCode = teaException.getCode();
//            String errMsg = teaException.getMessage();
//
//            if (StrUtil.isAllNotBlank(errCode, errMsg)) {
//                log.error("钉钉授权认证失败： code：{}，message：{}", errCode, errMsg);
//                throw new ServiceException(errMsg);
//            } else {
//                log.error("钉钉授权认证失败", teaException);
//                throw new ServiceException("发生未知异常，钉钉授权认证失败");
//            }
//
//        }
//    }
//
//
//    private static com.aliyun.dingtalkoauth2_1_0.Client getClient2() throws Exception {
//        Config config = new Config();
//        config.protocol = "https";
//        config.regionId = "central";
//        return new com.aliyun.dingtalkoauth2_1_0.Client(config);
//    }
//
//}
