|
|
@@ -1,101 +0,0 @@
|
|
|
-package com.management.platform.controller;
|
|
|
-
|
|
|
-
|
|
|
-import com.alibaba.fastjson.JSONArray;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.management.platform.entity.User;
|
|
|
-import com.management.platform.entity.WxCorpInfo;
|
|
|
-import com.management.platform.mapper.UserMapper;
|
|
|
-import com.management.platform.service.WxCorpInfoService;
|
|
|
-import com.management.platform.task.TimingTask;
|
|
|
-import com.management.platform.util.HttpRespMsg;
|
|
|
-import com.management.platform.util.ListUtil;
|
|
|
-import org.springframework.http.HttpRequest;
|
|
|
-import org.springframework.util.StringUtils;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-
|
|
|
-import javax.annotation.Resource;
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
-/**
|
|
|
- * <p>
|
|
|
- * 前端控制器
|
|
|
- * </p>
|
|
|
- *
|
|
|
- * @author Seyason
|
|
|
- * @since 2021-07-14
|
|
|
- */
|
|
|
-@RestController
|
|
|
-@RequestMapping("/wx-corp-info")
|
|
|
-public class WxCorpInfoController {
|
|
|
-
|
|
|
- @Resource
|
|
|
- WxCorpInfoService wxCorpInfoService;
|
|
|
- @Resource
|
|
|
- UserMapper userMapper;
|
|
|
- @Resource
|
|
|
- private TimingTask timingTask;
|
|
|
-
|
|
|
- @RequestMapping("/testDownload")
|
|
|
- public HttpRespMsg testDownload() {
|
|
|
- HttpRespMsg msg = new HttpRespMsg();
|
|
|
- msg.data = wxCorpInfoService.testDownloadFile();
|
|
|
- return msg;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping("/saveContactSecret")
|
|
|
- public HttpRespMsg saveContactSecret(WxCorpInfo info) {
|
|
|
- HttpRespMsg msg = new HttpRespMsg();
|
|
|
- msg.data = wxCorpInfoService.updateById(info);
|
|
|
- return msg;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping("/get")
|
|
|
- public HttpRespMsg get(Integer companyId) {
|
|
|
- HttpRespMsg msg = new HttpRespMsg();
|
|
|
- msg.data = wxCorpInfoService.getOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
- return msg;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping("/testSendTemplateMsg")
|
|
|
- public HttpRespMsg testSendTemplateMsg(String userId) {
|
|
|
- int companyId=7;
|
|
|
- WxCorpInfo corpInfo = wxCorpInfoService.getOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
- String corpwxuserIds = "woy9TkCAAAPD6149u46N_Yi5ARSA4VFw";
|
|
|
- System.out.println("发送给:"+corpwxuserIds);
|
|
|
- //推送到企业微信
|
|
|
-// String corpUid = user.getCorpwxUserid();
|
|
|
- JSONObject json=new JSONObject();
|
|
|
- JSONArray dataJson=new JSONArray();
|
|
|
- JSONObject item=new JSONObject();
|
|
|
- item.put("key","审核人");
|
|
|
- item.put("value","$userName=woy9TkCAAAPD6149u46N_Yi5ARSA4VFw$");
|
|
|
- dataJson.add(item);
|
|
|
- json.put("template_id","tty9TkCAAANpvEtLrkPUGeOEd1-U7W2w");
|
|
|
- JSONObject item2=new JSONObject();
|
|
|
- item2.put("key","日期");
|
|
|
- item2.put("value","2021-07-14");
|
|
|
- dataJson.add(item2);
|
|
|
- json.put("url","https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww4e237fd6abb635af&redirect_uri=http://worktime.ttkuaiban.com/api/corpWXAuth&response_type=code&scope=snsapi_base&state=0#wechat_redirect");
|
|
|
- json.put("content_item",dataJson);
|
|
|
- wxCorpInfoService.sendWXCorpTemplateMsg(corpInfo,corpwxuserIds,json);
|
|
|
- return new HttpRespMsg();
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping("/wxLeaveTest")
|
|
|
- public void wxLeaveTest() throws Exception {
|
|
|
- timingTask.synWxLeave();
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping("/batchTransferLicense")
|
|
|
- public HttpRespMsg batchTransferLicense(HttpServletRequest request,String handoverId,String takeoverId) throws Exception {
|
|
|
- return wxCorpInfoService.batchTransferLicense(request,handoverId,takeoverId);
|
|
|
- }
|
|
|
-}
|
|
|
-
|