Commit 7a8de886 by 陶光胜

Merge branch 'developer' into 'master'

加日志

See merge request !44
parents d051950e f63f53aa
...@@ -73,7 +73,7 @@ public class LoginController { ...@@ -73,7 +73,7 @@ public class LoginController {
} }
}); });
RedisUtil.setCache(key, userVo, 5l, TimeUnit.MINUTES); RedisUtil.setCache(key, userVo, 5l, TimeUnit.MINUTES);
RedisUtil.setCache("userEnterpriseList:"+userVo.getUserId(), enterpriseDTOList); //RedisUtil.setCache("userEnterpriseList:"+userVo.getUserId(), enterpriseDTOList);
return RestResponse.success(enterpriseId); return RestResponse.success(enterpriseId);
}else { }else {
return RestResponse.failure(ErrorCode.SYSTEMERROR.getCode(), smsSendResult.getMessage()); return RestResponse.failure(ErrorCode.SYSTEMERROR.getCode(), smsSendResult.getMessage());
...@@ -101,10 +101,15 @@ public class LoginController { ...@@ -101,10 +101,15 @@ public class LoginController {
@RequestMapping("all-enterprise") @RequestMapping("all-enterprise")
public RestResponse allEnterprise(Integer userId){ public RestResponse allEnterprise(Integer userId){
Object cache = RedisUtil.getCache("userEnterpriseList:" + userId);
UserDTO userDTO = this.userApiService.getUser(userId).getResult(); UserDTO userDTO = this.userApiService.getUser(userId).getResult();
if(userDTO == null){
return RestResponse.success();
}
List<UserDTO> userDTOList = this.userApiService.listUserByPhone(userDTO.getNationCode(), userDTO.getPhone()).getResult(); List<UserDTO> userDTOList = this.userApiService.listUserByPhone(userDTO.getNationCode(), userDTO.getPhone()).getResult();
List<EnterpriseDTO> enterpriseDTOList = (List<EnterpriseDTO>) cache; log.info("userDTOList:{}", JSON.toJSONString(userDTOList));
if(CollectionUtils.isNotEmpty(userDTOList)){
List<Integer> enterpriseIdList = userDTOList.stream().map(user -> user.getEnterpriseId()).collect(Collectors.toList());
List<EnterpriseDTO> enterpriseDTOList = this.enterpriseApiService.listEnterpriseByIds(enterpriseIdList).getResult();
List<EnterpriseVo> result = new ArrayList<>(); List<EnterpriseVo> result = new ArrayList<>();
if(CollectionUtils.isNotEmpty(enterpriseDTOList)){ if(CollectionUtils.isNotEmpty(enterpriseDTOList)){
result = enterpriseDTOList.stream().map(enterpriseDTO -> { result = enterpriseDTOList.stream().map(enterpriseDTO -> {
...@@ -124,6 +129,8 @@ public class LoginController { ...@@ -124,6 +129,8 @@ public class LoginController {
} }
return RestResponse.success(result); return RestResponse.success(result);
} }
return RestResponse.success();
}
@RequestMapping("nation-code") @RequestMapping("nation-code")
public RestResponse getNationcode(){ public RestResponse getNationcode(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment