Commit a365b652 by 徐高华

企微托管

parent d3fee1b2
package com.gic.haoban.manage.web.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.gic.authcenter.commons.util.IgnoreLogin;
import com.gic.haoban.manage.api.enums.QwOpenStepEnum;
......@@ -15,10 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
@Controller
public class QywxCallbackController extends WebBaseController {
......@@ -39,8 +37,9 @@ public class QywxCallbackController extends WebBaseController {
JSONObject jsonObject = JSONObject.parseObject(body) ;
int type = jsonObject.getIntValue("type") ;
String uuid = jsonObject.getString("uuid") ;
long qwStaffId = jsonObject.getLong("vid") ;
JSONObject json = jsonObject.getJSONObject("json") ;
this.post(type,uuid,json);
this.post(type,uuid,json , qwStaffId);
Map<String,String> map = new HashMap<>() ;
map.put("errcode","0") ;
map.put("errmsg","ok") ;
......@@ -51,8 +50,11 @@ public class QywxCallbackController extends WebBaseController {
return "ok" ;
}
private void post(int type , String uuid , JSONObject json) {
private void post(int type , String uuid , JSONObject json , Long qwStaffId) {
switch (type) {
case 116002:
this.addFriend(json , qwStaffId) ;
break;
case 102000:
this.chat(uuid,json) ;
break;
......@@ -85,6 +87,22 @@ public class QywxCallbackController extends WebBaseController {
}
}
// 加好友
private void addFriend(JSONObject json, Long qwStaffId) {
logger.info("加好友、删好友");
JSONArray array = json.getJSONArray("list") ;
List<Long> list = new ArrayList<>() ;
for(int i=0;i<array.size();i++) {
JSONObject jsonObject = array.getJSONObject(i) ;
int status = jsonObject.getIntValue("status") ;
if(status == 2057 || status == 9) {
Long qwUserId = jsonObject.getLong("user_id") ;
list.add(qwUserId);
}
}
this.openQwApiService.addFriendSuccessNotice(qwStaffId,list);
}
private void chat(String uuid, JSONObject json) {
int msgtype = json.getIntValue("msgtype") ;
// 群发任务
......
......@@ -144,7 +144,7 @@ public class QywxOpenTaskController {
}
/**
* 加好友任务-添加明细列表
* 加好友任务-添加明细列表-导出
*/
@RequestMapping("add-task-member-excel")
public RestResponse<String> addTaskMemberExcel(@RequestBody AddTaskMemberPageQO qo) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment