| | |
| | | import com.fzzy.appwx.constant.WeChatConst; |
| | | import com.fzzy.appwx.manager.WeChatManager; |
| | | import com.fzzy.appwx.param.WeChatBaseParam; |
| | | import com.fzzy.group.manager.GroupManager; |
| | | import com.fzzy.igds.data.ConfigData; |
| | | import com.fzzy.igds.data.PageResponse; |
| | | import com.fzzy.igds.domain.Dept; |
| | | import com.fzzy.igds.domain.SnapReply; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.net.URLEncoder; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | | @Controller |
| | |
| | | private ConfigData configData; |
| | | @Resource |
| | | private WeChatManager weChatManager; |
| | | @Resource |
| | | private GroupManager groupManager; |
| | | |
| | | |
| | | /** |
| | |
| | | tag = "home"; |
| | | } |
| | | |
| | | String newUrl = WeChatConst.USER_AUTH_UPR |
| | | .replace("APPID", configData.getWxAppId()) |
| | | .replace("REDIRECT_URI", URLEncoder.encode(url, "UTF-8")) |
| | | .replace("STATE", tag); |
| | | |
| | | return "redirect:" + newUrl; |
| | | // return "redirect:" + url + "?state=" + tag; |
| | | // String newUrl = WeChatConst.USER_AUTH_UPR |
| | | // .replace("APPID", configData.getWxAppId()) |
| | | // .replace("REDIRECT_URI", URLEncoder.encode(url, "UTF-8")) |
| | | // .replace("STATE", tag); |
| | | // |
| | | // return "redirect:" + newUrl; |
| | | return "redirect:" + url + "?state=" + tag; |
| | | } |
| | | |
| | | |
| | |
| | | mv.addObject("userName", userName); |
| | | } |
| | | mv.setViewName("/wx/" + state); |
| | | //验证码类型 |
| | | if("bind".equals( state) || "unbind".equals( state)){ |
| | | mv.addObject("captchaType", "math"); |
| | | } |
| | | |
| | | //// //测试代码开启 |
| | | // String openid = "testOpenId"; |
| | | // mv.addObject("openid", openid); |
| | | // SysUser user = weChatManager.getUser(openid); |
| | | // if (StringUtils.isEmpty(userName)) { |
| | | // if (user != null) { |
| | | // userName = user.getUserName(); |
| | | // } |
| | | // } |
| | | // |
| | | // if (StringUtils.isNotEmpty(userName)) { |
| | | // mv.addObject("userName", userName); |
| | | // } |
| | | //// //测试代码结束 |
| | | |
| | | //查询库区信息 |
| | | List<Dept> deptList = groupManager.getDeptList(); |
| | | mv.addObject("deptList", deptList); |
| | | |
| | | |
| | | // //测试代码开启 |
| | | String openid = "testOpenId"; |
| | | mv.addObject("openid", openid); |
| | | SysUser user = weChatManager.getUser(openid); |
| | | if (StringUtils.isEmpty(userName)) { |
| | | if (user != null) { |
| | | userName = user.getUserName(); |
| | | } |
| | | } |
| | | |
| | | if (StringUtils.isNotEmpty(userName)) { |
| | | mv.addObject("userName", userName); |
| | | } |
| | | // //测试代码结束 |
| | | |
| | | return mv; |
| | | } |
| | |
| | | */ |
| | | @PostMapping(value = "/bandOpenId") |
| | | @ResponseBody |
| | | public PageResponse<String> bandOpenId( @RequestBody WeChatBaseParam param) { |
| | | return weChatManager.bandOpenId(param); |
| | | public PageResponse<String> bandOpenId(HttpServletRequest httpRequest, @RequestBody WeChatBaseParam param) { |
| | | return weChatManager.bandOpenId(httpRequest,param); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping(value = "/unBandOpenId") |
| | | @ResponseBody |
| | | public PageResponse<String> unBandOpenId( @RequestBody WeChatBaseParam param) { |
| | | return weChatManager.unBandOpenId(param); |
| | | public PageResponse<String> unBandOpenId( HttpServletRequest httpRequest, @RequestBody WeChatBaseParam param) { |
| | | //在这里调用验证码校验 |
| | | |
| | | return weChatManager.unBandOpenId(httpRequest,param); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取出入库告警批复分页数据 |
| | | * |