Browse Source

temp

master
yinzuomei 3 years ago
parent
commit
c26b2dc7f0
  1. 15
      epmet-auth/src/main/java/com/epmet/dto/result/ResiDingAppLoginResDTO.java
  2. 18
      epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java

15
epmet-auth/src/main/java/com/epmet/dto/result/ResiDingAppLoginResDTO.java

@ -13,10 +13,23 @@ public class ResiDingAppLoginResDTO {
private String customerId;
private String gridId;
/**
*
* 网格名
*/
private String gridName;
/**
* 网格所属的组织id
*/
private String agencyId;
/**
* 居民端用户id
*/
private String epmetUserId;
/**
* 5.获取用户手机号使用用户个人access_token调用获取用户通讯录个人信息接口获取
* 返参信息
* 接口文档https://open.dingtalk.com/document/isvapp-server/dingtalk-retrieve-user-information
*/
private String extInfo;
}

18
epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java

@ -10,6 +10,7 @@ import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.rocketmq.messages.LoginMQMsg;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.enums.EnvEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ExceptionUtils;
@ -722,6 +723,14 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol
ResiDingAppLoginResDTO resDTO= null;
try {
resDTO = new ResiDingAppLoginResDTO();
EnvEnum currentEnv = EnvEnum.getCurrentEnv();
if (EnvEnum.PROD.getCode().equals(currentEnv.getCode())) {
//烟台的客户id
resDTO.setCustomerId("1535072605621841922");
}else{
//其余统一走开发环境
resDTO.setCustomerId("45687aa479955f9d06204d415238f7cc");
}
Map<String,String> miniInfo = new HashMap<>();
miniInfo.put("suitew6ccvkquinmrghqy","TooAxiegdsE5BPP6xo1AxK1LdmaUoMpPMyomOcGcBSXtnsxRc8dEfyOlG56oSmEB");
@ -729,8 +738,7 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol
miniInfo.put("suite5yxliro6wawv514w","aQxiPi7DwJSUa9HlbUU_L7Q4wGCLEDmgf__Ffx75cTn3jZwuHy9vdl-9Iv5FeyJU");
miniInfo.put("suitemcestnonr6y0xigc","kKCNCkfDhmLoVnl_wuAiScyDG4776mkTevuSBuiYhHg-Bvz1-vhb_4IA-Km7nK2I");
//获取用户手机号
log.info("authCode:"+formDTO.getAuthCode());
//todo 调用一下接口
String clientId = formDTO.getClientId();
com.aliyun.dingtalk.module.Result<AccessTokenResult> userAccessToken = dingTalkClientToken.getUserAccessToken(formDTO.getAuthCode(), clientId, miniInfo.get(clientId));
@ -741,7 +749,7 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol
resDTO.setExtInfo(JSON.toJSONString(me.getData()));
}
resDTO.setCustomerId("45687aa479955f9d06204d415238f7cc");
// //todo 调用一下接口 调用userfeign接口,拿到用户id以及注册网格id
resDTO.setGridId("763d6e09b9081d63195d53da84b3ae3a");
resDTO.setEpmetUserId("f838614e67cf8ae0edaefe562b6660e5");
//生成token串
@ -755,12 +763,14 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol
//4.存放Redis
this.saveTokenDtoDing(AppClientConstant.APP_RESI,AppClientConstant.MINI_DING, resDTO.getEpmetUserId(), token, resDTO.getCustomerId());
} catch (ApiException e) {
throw new EpmetException(e.getErrMsg());
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), e.getErrMsg(), EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getMsg());
}
return resDTO;
}
private String saveTokenDtoDing(String app,String client, String userId, String token, String customerId) {
int expire = jwtTokenProperties.getExpire();
TokenDto tokenDto = new TokenDto();
tokenDto.setCustomerId(customerId);

Loading…
Cancel
Save