| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -11,6 +11,7 @@ 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.exception.EpmetErrorCode; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.exception.EpmetException; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.exception.ExceptionUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.exception.RenException; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.feign.ResultDataResolver; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -32,7 +33,11 @@ import com.epmet.jwt.JwtTokenProperties; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.jwt.JwtTokenUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.redis.CaptchaRedis; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.service.ThirdLoginService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.taobao.api.ApiException; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.taobao.dingtalk.client.DingTalkClientToken; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.taobao.dingtalk.client.DingTalkClientUser; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.taobao.dingtalk.vo.result.AccessTokenResult; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.taobao.dingtalk.vo.result.UserBaseInfo; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import lombok.extern.slf4j.Slf4j; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.apache.commons.lang3.StringUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.slf4j.Logger; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -76,6 +81,8 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private LoginUserUtil loginUserUtil; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private DingTalkClientToken dingTalkClientToken; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private DingTalkClientUser dingTalkClientUser; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param formDTO | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -709,12 +716,28 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public ResiDingAppLoginResDTO resiLoginDing(ResiDingAppLoginFormDTO formDTO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ResiDingAppLoginResDTO resDTO= null; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            resDTO = new ResiDingAppLoginResDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Map<String,String> miniInfo = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            miniInfo.put("suitew6ccvkquinmrghqy","TooAxiegdsE5BPP6xo1AxK1LdmaUoMpPMyomOcGcBSXtnsxRc8dEfyOlG56oSmEB"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            miniInfo.put("suitezhyj12glsrp8em0f","-z5Q_lvMP6l7fTzlArEzUT8D_-5pvqBQaJMuTGHoXnz0nuiqGQMZ8aeya_cxTsN-"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            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)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            log.info("resiLoginDing userAccessToken:{}",JSON.toJSONString(userAccessToken)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (userAccessToken.success() && userAccessToken.getData() != null){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                com.aliyun.dingtalk.module.Result<UserBaseInfo> me = dingTalkClientUser.getUserInfo("me", userAccessToken.getData().getAccessToken()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                log.info("resiLoginDing me:{}",JSON.toJSONString(me)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                resDTO.setExtInfo(JSON.toJSONString(me.getData())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ResiDingAppLoginResDTO resDTO=new ResiDingAppLoginResDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            resDTO.setCustomerId("45687aa479955f9d06204d415238f7cc"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            resDTO.setGridId("763d6e09b9081d63195d53da84b3ae3a"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            resDTO.setEpmetUserId("f838614e67cf8ae0edaefe562b6660e5"); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -725,6 +748,9 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            map.put("userId", resDTO.getEpmetUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String token = jwtTokenUtils.createToken(map); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            resDTO.setAuthorization(token); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } catch (ApiException e) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            throw new EpmetException(e.getErrMsg()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return resDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
					 | 
				
				 | 
				
					
  |