| | |
| | | package com.panzhihua.sangeshenbian.api; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.panzhihua.common.controller.BaseController; |
| | |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo; |
| | | import com.panzhihua.common.service.auth.TokenService; |
| | | import com.panzhihua.common.utlis.HttpClientUtil; |
| | | import com.panzhihua.common.utlis.ServletUtils; |
| | | import com.panzhihua.sangeshenbian.model.entity.SystemMenu; |
| | | import com.panzhihua.sangeshenbian.model.entity.SystemRoleMenu; |
| | | import com.panzhihua.sangeshenbian.model.entity.SystemUser; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.IOException; |
| | | import java.text.MessageFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | |
| | | List<RegionVO> list = systemUserService.getRegionTree(loginUserInfo); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | } |
| | | |
| | | // private String ACCESS_TOKEN_URL = "GET https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential"; |
| | | // |
| | | // public String getAppAccessToken(String appId, String appSecret) throws Exception { |
| | | // String accessToken = "0"; |
| | | // try { |
| | | // log.info("获取微信token参数:appid=" + appId + ",appSecret=" + appSecret); |
| | | // String accessTokenUrl = ACCESS_TOKEN_URL + "&appid=" + appId + "&secret=" + appSecret; |
| | | // String result = HttpClientUtil.httpGet(accessTokenUrl, null, null); |
| | | // Map<String, Object> resultMap = JSON.parseObject(result, Map.class); |
| | | // StringRedisTemplate redisTemplate = wxXCXTempSend.stringRedisTemplate; |
| | | // if (resultMap.containsKey("access_token")) { |
| | | // accessToken = resultMap.get("access_token").toString(); |
| | | // redisTemplate.opsForValue().set("access_token:access_token:" + appId, accessToken); |
| | | // } |
| | | // HttpServletRequest request = ServletUtils.getRequest(); |
| | | // String requestURI = request.getRequestURI(); |
| | | // //加上时间戳 |
| | | // String datetime = new SimpleDateFormat("yyyyMMdd").format(new Date()); |
| | | // //这里是 Redis key的前缀,如: sys:tabieId:表名 如果不需要去掉表名也可以 |
| | | // String key = MessageFormat.format("{0}:{1}:{2}", "access_token_request_incr",datetime,requestURI); |
| | | // //查询 key 是否存在, 不存在返回 1 ,存在的话则自增加1 |
| | | // redisTemplate.opsForValue().increment(key, 1); |
| | | // |
| | | // } catch (IOException ioe) { |
| | | // log.error("小程序http请求异常"); |
| | | // ioe.printStackTrace(); |
| | | // } |
| | | // return accessToken; |
| | | // } |
| | | } |