|
@ -3,6 +3,8 @@ package com.epmet.service.impl; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
import com.epmet.commons.tools.redis.RedisKeys; |
|
|
import com.epmet.commons.tools.redis.RedisKeys; |
|
|
import com.epmet.commons.tools.redis.RedisUtils; |
|
|
import com.epmet.commons.tools.redis.RedisUtils; |
|
|
import com.epmet.commons.tools.utils.HttpClientManager; |
|
|
import com.epmet.commons.tools.utils.HttpClientManager; |
|
@ -10,6 +12,8 @@ import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.dao.SdtAppInfoDao; |
|
|
import com.epmet.dao.SdtAppInfoDao; |
|
|
import com.epmet.entity.SdtAppInfoEntity; |
|
|
import com.epmet.entity.SdtAppInfoEntity; |
|
|
import com.epmet.sdt.SdtGetAccessTokenResult; |
|
|
import com.epmet.sdt.SdtGetAccessTokenResult; |
|
|
|
|
|
import com.epmet.sdt.SdtStaffDetailResult; |
|
|
|
|
|
import com.epmet.sdt.SdtStaffInfoResult; |
|
|
import com.epmet.service.SdtService; |
|
|
import com.epmet.service.SdtService; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
@ -153,4 +157,48 @@ public class SdtServiceImpl implements SdtService { |
|
|
return redisUtils.getString(key); |
|
|
return redisUtils.getString(key); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public SdtStaffInfoResult getUserInfoByCode(String authCode, String customerId) { |
|
|
|
|
|
HashMap<String, Object> params = new HashMap<>(); |
|
|
|
|
|
params.put("access_token", getCachedAccessToken(customerId)); |
|
|
|
|
|
params.put("code", authCode); |
|
|
|
|
|
Result<String> sdtResult = HttpClientManager.getInstance().sendGet("/cgi-bin/user/getuserinfo", params); |
|
|
|
|
|
if (!sdtResult.success()) { |
|
|
|
|
|
// http状态判断
|
|
|
|
|
|
log.error("【山东通登录】查询用户编码-http错误:{}", sdtResult.getMsg()); |
|
|
|
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "调用山东通查询用户编码失败", null); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
SdtStaffInfoResult staffInfoResult = JSON.parseObject(sdtResult.getData(), SdtStaffInfoResult.class); |
|
|
|
|
|
if (!staffInfoResult.success()) { |
|
|
|
|
|
// 山东通业务返回状态判断
|
|
|
|
|
|
log.error("【山东通登录】查询用户编码失败,错误信息:{}", staffInfoResult.getErrmsg()); |
|
|
|
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "调用山东通查询用户编码失败", null); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return staffInfoResult; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public SdtStaffDetailResult getUserDetailByUserId(String userId, String customerId) { |
|
|
|
|
|
HashMap<String, Object> userDetailParams = new HashMap<>(); |
|
|
|
|
|
userDetailParams.put("access_token", getCachedAccessToken(customerId)); |
|
|
|
|
|
userDetailParams.put("userid", userId); |
|
|
|
|
|
Result<String> userDetailResult = HttpClientManager.getInstance().sendGet("/cgi-bin/user/get", userDetailParams); |
|
|
|
|
|
if (!userDetailResult.success()) { |
|
|
|
|
|
// http状态判断
|
|
|
|
|
|
log.error("【山东通登录】查询用户详细信息-http错误:{}", userDetailResult.getMsg()); |
|
|
|
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "调用山东通查询用户详细信息失败", null); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
SdtStaffDetailResult staffDetailResult = JSON.parseObject(userDetailResult.getData(), SdtStaffDetailResult.class); |
|
|
|
|
|
if (!staffDetailResult.success()) { |
|
|
|
|
|
// 山东通业务返回状态判断
|
|
|
|
|
|
log.error("【山东通登录】查询用户详细信息失败,错误信息:{}", staffDetailResult.getErrmsg()); |
|
|
|
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "调用山东通查询用户详细信息失败", null); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return staffDetailResult; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|