|
|
@ -2,15 +2,19 @@ package com.ibeetl.jlw.web;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
|
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
|
|
|
|
|
|
import cn.jlw.Interceptor.ResponseControllerAdvice;
|
|
|
|
import cn.jlw.Interceptor.SCoreUser;
|
|
|
|
import cn.jlw.Interceptor.SCoreUser;
|
|
|
|
import cn.jlw.token.TokenService;
|
|
|
|
import cn.jlw.token.TokenService;
|
|
|
|
import cn.jlw.webSocket.WebSocketServer;
|
|
|
|
import cn.jlw.webSocket.WebSocketServer;
|
|
|
|
import com.ibeetl.admin.core.conf.WxMpConfig;
|
|
|
|
import com.ibeetl.admin.core.conf.WxMpConfig;
|
|
|
|
|
|
|
|
import com.ibeetl.admin.core.dao.CoreUserDao;
|
|
|
|
import com.ibeetl.admin.core.entity.CoreUser;
|
|
|
|
import com.ibeetl.admin.core.entity.CoreUser;
|
|
|
|
|
|
|
|
import com.ibeetl.admin.core.service.CoreUserService;
|
|
|
|
import com.ibeetl.admin.core.util.map.MapUtil;
|
|
|
|
import com.ibeetl.admin.core.util.map.MapUtil;
|
|
|
|
import com.ibeetl.admin.core.web.JsonResult;
|
|
|
|
import com.ibeetl.admin.core.web.JsonResult;
|
|
|
|
import com.ibeetl.jlw.entity.CoreUserWx;
|
|
|
|
import com.ibeetl.jlw.entity.CoreUserWx;
|
|
|
|
import com.ibeetl.jlw.entity.Student;
|
|
|
|
import com.ibeetl.jlw.entity.Student;
|
|
|
|
|
|
|
|
import com.ibeetl.jlw.entity.SysLog;
|
|
|
|
import com.ibeetl.jlw.service.CoreUserWxService;
|
|
|
|
import com.ibeetl.jlw.service.CoreUserWxService;
|
|
|
|
import com.ibeetl.jlw.service.MsgHandler;
|
|
|
|
import com.ibeetl.jlw.service.MsgHandler;
|
|
|
|
import com.ibeetl.jlw.service.StudentService;
|
|
|
|
import com.ibeetl.jlw.service.StudentService;
|
|
|
@ -25,16 +29,14 @@ import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
|
|
|
|
import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket;
|
|
|
|
import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket;
|
|
|
|
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
|
|
|
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
|
|
|
import org.apache.commons.httpclient.URIException;
|
|
|
|
import org.apache.commons.httpclient.URIException;
|
|
|
|
|
|
|
|
import org.beetl.sql.core.query.Query;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.OutputStream;
|
|
|
|
import java.io.OutputStream;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 微信登录相关接口
|
|
|
|
* 微信登录相关接口
|
|
|
@ -62,6 +64,9 @@ public class WeiXinController {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private TokenService tokenService;
|
|
|
|
private TokenService tokenService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private CoreUserDao coreUserDao;
|
|
|
|
|
|
|
|
|
|
|
|
//region 公众号
|
|
|
|
//region 公众号
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping(produces = "text/plain;charset=utf-8")
|
|
|
|
@GetMapping(produces = "text/plain;charset=utf-8")
|
|
|
@ -123,6 +128,33 @@ public class WeiXinController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 获取公众号二维码 -学校端、超级管理员端
|
|
|
|
|
|
|
|
* @param id 登录用户绑定
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
* @throws WxErrorException
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@GetMapping("/api/getQrCodeAdmin")
|
|
|
|
|
|
|
|
public JsonResult<?> getQrCodeAdmin(Long id) throws WxErrorException {
|
|
|
|
|
|
|
|
if (Objects.isNull(id)){
|
|
|
|
|
|
|
|
return JsonResult.failMessage("请登录后再操作");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
CoreUser coreUser = coreUserDao.getSQLManager().lambdaQuery(CoreUser.class)
|
|
|
|
|
|
|
|
.andEq(CoreUser::getId, id).single();
|
|
|
|
|
|
|
|
if (Objects.isNull(coreUser)){
|
|
|
|
|
|
|
|
return JsonResult.success("查询不到用户");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WxMpQrcodeService qrcodeService = weixinService.getQrcodeService();
|
|
|
|
|
|
|
|
WxMpQrCodeTicket wxMpQrCodeTicket = qrcodeService.qrCodeCreateTmpTicket(coreUser.getId() + "", 2592000);
|
|
|
|
|
|
|
|
String imgUrl = qrcodeService.qrCodePictureUrl(wxMpQrCodeTicket.getTicket());
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
|
|
|
map.put("imgUrl", imgUrl);
|
|
|
|
|
|
|
|
map.put("userId", coreUser.getId());
|
|
|
|
|
|
|
|
return JsonResult.success(map);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 接收微信公众号推送
|
|
|
|
* 接收微信公众号推送
|
|
|
|