yumeng 4 năm trước cách đây
mục cha
commit
9d67a4d55c

+ 17 - 15
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -9,12 +9,12 @@ import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.kuaishou.modules.report.mapper.EtlKuaishouAccountMaterialReportDailyMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyImageService;
+import cn.com.ctop.oa.modules.service.IAppchatCreateService;
 import cn.com.ctop.oa.modules.service.IWechatNoListService;
 import cn.com.ctop.toutiao.modules.link.service.IETLReportBytedanceVideoService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceCampaignService;
 import cn.com.ctop.toutiao.modules.report.service.*;
-import com.csvreader.CsvReader;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.RedisUtil;
@@ -26,10 +26,7 @@ import org.springframework.test.context.ActiveProfiles;
 import org.springframework.test.context.junit4.SpringRunner;
 
 import javax.annotation.Resource;
-import java.io.IOException;
-import java.nio.charset.Charset;
 import java.text.ParseException;
-import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -52,13 +49,18 @@ public class SampleTest {
     private IKuaishouInterfaceService kuaishouInterfaceService;
     @Autowired
     private RedisUtil redisUtil;
+    @Autowired
+    private IAppchatCreateService appchatCreateService;
+
 
     @Test
     public void loadKuaishouCookie() throws ParseException {
 
-        redisUtil.set("11sdfhgjksdhfjksdhfjksdhfkjsjkfhkjsddhfjksdhfkjhsjkfhjkshfjksdhfjksdhfjkshdjkfhsjkdfhkjsd1","hahahaha",5);
+        // appchatCreateService.createAppChat(null, null, null);
+        appchatCreateService.getChatInfo(null);
+       /* redisUtil.set("11sdfhgjksdhfjksdhfjksdhfkjsjkfhkjsddhfjksdhfkjhsjkfhjkshfjksdhfjksdhfjkshdjkfhsjkdfhkjsd1","hahahaha",5);
         Object o = redisUtil.get("11sdfhgjksdhfjksdhfjksdhfkjsjkfhkjsddhfjksdhfkjhsjkfhjkshfjksdhfjksdhfjkshdjkfhsjkdfhkjsd1");
-        System.err.println(o);
+        System.err.println(o);*/
 
 
         /*try {
@@ -222,7 +224,7 @@ public class SampleTest {
     private IEtlBytedanceReportVideoDailyService etlBytedanceReportVideoDailyService;
 
     @Test
-    public void etlBytedanceVideoReportInfo()throws Exception{
+    public void etlBytedanceVideoReportInfo() throws Exception {
         etlBytedanceReportVideoDailyService.etlBytedanceVideo();
     }
 
@@ -230,7 +232,7 @@ public class SampleTest {
     private IReportService reportService;
 
     @Test
-    public void loadBytedanceAccountReport(){
+    public void loadBytedanceAccountReport() {
         /**
          * 1692555408132110
          * 1692555631713287
@@ -238,19 +240,19 @@ public class SampleTest {
          * 1696734333251598
          */
         CtopOauthToken token1 = tokenService.getTokenByAccountId(1692555408132110L);
-        reportService.getAdvertiserReport(token1, DateUtils.parseDate("2021-05-01","yyyy-MM-dd"), DateUtils.parseDate("2021-05-12","yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        reportService.getAdvertiserReport(token1, DateUtils.parseDate("2021-05-01", "yyyy-MM-dd"), DateUtils.parseDate("2021-05-12", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
         CtopOauthToken token2 = tokenService.getTokenByAccountId(1692555631713287L);
-        reportService.getAdvertiserReport(token2, DateUtils.parseDate("2021-05-01","yyyy-MM-dd"), DateUtils.parseDate("2021-05-12","yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        reportService.getAdvertiserReport(token2, DateUtils.parseDate("2021-05-01", "yyyy-MM-dd"), DateUtils.parseDate("2021-05-12", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
         CtopOauthToken token3 = tokenService.getTokenByAccountId(1696734332089352L);
-        reportService.getAdvertiserReport(token3, DateUtils.parseDate("2021-05-01","yyyy-MM-dd"), DateUtils.parseDate("2021-05-12","yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        reportService.getAdvertiserReport(token3, DateUtils.parseDate("2021-05-01", "yyyy-MM-dd"), DateUtils.parseDate("2021-05-12", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
         CtopOauthToken token4 = tokenService.getTokenByAccountId(1696734333251598L);
-        reportService.getAdvertiserReport(token4, DateUtils.parseDate("2021-05-01","yyyy-MM-dd"), DateUtils.parseDate("2021-05-12","yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        reportService.getAdvertiserReport(token4, DateUtils.parseDate("2021-05-01", "yyyy-MM-dd"), DateUtils.parseDate("2021-05-12", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
 
         CtopOauthToken token5 = tokenService.getTokenByAccountId(10129666L);
-        kuaishouInterfaceService.getAdvertiserReportDaily(token5, DateUtils.parseDate("2021-05-07","yyyy-MM-dd"), DateUtils.parseDate("2021-05-11","yyyy-MM-dd"), null);
+        kuaishouInterfaceService.getAdvertiserReportDaily(token5, DateUtils.parseDate("2021-05-07", "yyyy-MM-dd"), DateUtils.parseDate("2021-05-11", "yyyy-MM-dd"), null);
         CtopOauthToken token6 = tokenService.getTokenByAccountId(10097961L);
-        kuaishouInterfaceService.getAdvertiserReportDaily(token6, DateUtils.parseDate("2021-05-07","yyyy-MM-dd"), DateUtils.parseDate("2021-05-11","yyyy-MM-dd"), null);
+        kuaishouInterfaceService.getAdvertiserReportDaily(token6, DateUtils.parseDate("2021-05-07", "yyyy-MM-dd"), DateUtils.parseDate("2021-05-11", "yyyy-MM-dd"), null);
         CtopOauthToken token7 = tokenService.getTokenByAccountId(10098039L);
-        kuaishouInterfaceService.getAdvertiserReportDaily(token7, DateUtils.parseDate("2021-05-07","yyyy-MM-dd"), DateUtils.parseDate("2021-05-11","yyyy-MM-dd"), null);
+        kuaishouInterfaceService.getAdvertiserReportDaily(token7, DateUtils.parseDate("2021-05-07", "yyyy-MM-dd"), DateUtils.parseDate("2021-05-11", "yyyy-MM-dd"), null);
     }
 }

+ 2 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/constant/QYWxConstant.java

@@ -19,6 +19,8 @@ public class QYWxConstant {
     public static final String QYWX_CHECKIN_DATA = "https://qyapi.weixin.qq.com/cgi-bin/checkin/getcheckindata";  //获取部门下员工简单信息
     public static final String APP_ROVAL_INFO = "https://qyapi.weixin.qq.com/cgi-bin/oa/getapprovalinfo";  //批量获取审批单号
     public static final String APP_ROVAL_DETAIL = "https://qyapi.weixin.qq.com/cgi-bin/oa/getapprovaldetail";  //获取审批申请详情
+    public static final String APPCHAT_CREATE = "https://qyapi.weixin.qq.com/cgi-bin/appchat/create";  //创建群聊
+    public static final String APPCHAT_GET = "https://qyapi.weixin.qq.com/cgi-bin/appchat/get";  //创建群聊
 
     /**
      * 天津优容智汇 企业微信信息

+ 9 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/service/IAppchatCreateService.java

@@ -0,0 +1,9 @@
+package cn.com.ctop.oa.modules.service;
+
+import com.alibaba.fastjson.JSONArray;
+
+public interface IAppchatCreateService {
+    void createAppChat(String name, String owner, JSONArray userlist);
+
+    void getChatInfo(String chatid);
+}

+ 67 - 0
module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/AppchatCreateServiceImpl.java

@@ -0,0 +1,67 @@
+package cn.com.ctop.oa.modules.service.impl;
+
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.oa.modules.constant.QYWxConstant;
+import cn.com.ctop.oa.modules.service.IAppchatCreateService;
+import cn.com.ctop.oa.modules.service.IWechatTokenService;
+import cn.com.ctop.oa.modules.service.IWechatUserListService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import static org.jeecg.common.constant.GeneralConstant.ACCESS_TOKEN;
+import static org.jeecg.common.constant.GeneralConstant.CODE;
+
+@Service
+@Slf4j
+public class AppchatCreateServiceImpl implements IAppchatCreateService {
+    @Autowired
+    private IWechatTokenService tokenService;
+    @Autowired
+    private IWechatUserListService userListService;
+
+
+    @Override
+    public void createAppChat(String name, String owner, JSONArray userlist) {
+        try {
+            Map<String, Object> qywxAccessToken = tokenService.getQYWXAccessToken();
+            if ((Integer) qywxAccessToken.get(CODE) != 0) {
+                throw new Exception("获取token失败");
+            }
+            System.err.println(qywxAccessToken);
+
+
+            JSONObject params = new JSONObject();
+            params.put("name", "易车时报发送");
+            params.put("owner", "qy01338f036d3ce902287758b529");
+            JSONArray userList = new JSONArray();
+            userList.add("qy01338f036d3ce902287758b529");
+            userList.add("qy01ae8f626d56e90128175730d2");
+            userList.add("YuMeng");
+            params.put("userlist", userList);
+            String resultStr = HttpUtils.httpPostRequestTest(QYWxConstant.APPCHAT_CREATE + "?access_token=" + qywxAccessToken.get(ACCESS_TOKEN), params.toJSONString(), null);
+            System.err.println(resultStr);
+        } catch (Exception e) {
+            log.error("员工考勤入库异常,", e);
+        }
+    }
+
+    @Override
+    public void getChatInfo(String chatid) {
+
+        Map<String, Object> qywxAccessToken = tokenService.getQYWXAccessToken();
+        System.err.println(qywxAccessToken);
+
+        TreeMap params = new TreeMap();
+
+        params.put("chatid", "wrSHhWEAAAhWApP92IL0nAuA9pQZ1W7w");
+        params.put("access_token", qywxAccessToken.get(ACCESS_TOKEN));
+        String resultStr = HttpUtils.httpGetRequest(QYWxConstant.APPCHAT_GET, null, params);
+        System.err.println(resultStr);
+    }
+}