Browse Source

Merge remote-tracking branch 'origin/dev_thirdplatform' into dev

master
zxc 5 years ago
parent
commit
777df11183
  1. 5
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java
  2. 2
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java
  3. 2
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java
  4. 7
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxLoginServiceImpl.java

5
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java

@ -64,11 +64,10 @@ public interface AuthorizationInfoDao extends BaseDao<AuthorizationInfoEntity> {
/**
* @Description 逻辑删除授权信息
* @param customerId
* @param clientType
* @param authAppId
* @author zxc
*/
void updateOldAuthorizationInfo(@Param("customerId")String customerId,@Param("clientType")String clientType);
void updateOldAuthorizationInfo(@Param("authAppId")String authAppId);
/**
* @Description 查询即将过期的 authorizer_access_token

2
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java

@ -122,7 +122,7 @@ public class RedisThird {
*/
public void setAuthInfo(AuthorizationInfoResultDTO authInfo,String customerId,String clientType){
Map<String, Object> map = BeanUtil.beanToMap(authInfo, false, true);
String key = ThirdRedisKeyConstant.AUTHORIZER_REFRESH_TOKEN_REDIS_KEY + customerId+ThirdRedisKeyConstant.COLON + clientType;
String key = ThirdRedisKeyConstant.AUTH_INFO_REDIS_KEY + customerId+ThirdRedisKeyConstant.COLON + clientType;
redisUtils.hMSet(key, map,NOT_EXPIRE);
}

2
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java

@ -280,7 +280,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
authInfoDTO.setCustomerId(customerId);
authInfoDTO.setClientType(clientType);
//先逻辑删除,在插入
authorizationInfoDao.updateOldAuthorizationInfo(customerId,clientType);
authorizationInfoDao.updateOldAuthorizationInfo(authAppId);
authorizationInfoDao.insertAuthorizationInfo(authInfoDTO);
// 2. 权限列表
log.info(START_INSERT_FUNC_INFO);

7
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxLoginServiceImpl.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.constant.ThirdRedisKeyConstant;
import com.epmet.dto.UserWechatDTO;
import com.epmet.wxapi.constant.WxLoginConstant;
import com.epmet.wxapi.service.WxLoginService;
@ -45,7 +46,7 @@ public class WxLoginServiceImpl implements WxLoginService {
map.put("js_code", wxCode);
map.put("grant_type", "authorization_code");
map.put("component_appid", componentAppId);
String componentAccessToken = (String) redisUtils.get("epmet:wechartthird:componentaccesstoken");
String componentAccessToken = (String) redisUtils.get(ThirdRedisKeyConstant.ACCESS_TOKEN_REDIS_KEY);
map.put("component_access_token", componentAccessToken);
String resultStr = HttpClientManager.getInstance().sendGet(WxLoginConstant.WXCODE_BY_OPENID, map).getData();
HashMap<String, String> hashMap = JSON.parseObject(resultStr, HashMap.class);
@ -58,9 +59,9 @@ public class WxLoginServiceImpl implements WxLoginService {
//2.换取用户基本信息
//小程序access_token
String access_token = (String) redisUtils.get("epmet:wechartthird:authinfo" + ":" + customerId + ":" + clientType);
Map<String, Object> accessMap = redisUtils.hGetAll(ThirdRedisKeyConstant.AUTH_INFO_REDIS_KEY + ":" + customerId + ":" + clientType);
Map<String, Object> hash = new HashMap<>();
hash.put("access_token", access_token);
hash.put("access_token", accessMap.get("authorizer_access_token"));
hash.put("openid", openid);
hash.put("lang", "zh_CN");
String getStr = HttpClientManager.getInstance().sendGet(WxLoginConstant.OPENID_TO_INFORMATION, map).getData();

Loading…
Cancel
Save