Commit 73d48d9f by guojuxing

过滤没有观云台应用的商户

parent f3a8318c
......@@ -65,8 +65,15 @@ public class LoginController {
String code = "1234";
List<UserDTO> userDTOList = this.userApiService.listUserByPhoneNumber(phoneNumber, "+" + areaCode).getResult();
if(CollectionUtils.isNotEmpty(userDTOList)){
List<Integer> enterpriseIdList = userDTOList.stream().map(userDTO -> userDTO.getEnterpriseId()).collect(Collectors.toList());
//过滤没有观云台应用的用户
userDTOList = userDTOList.stream().filter(userDTO -> checkCloudAppExist(userDTO.getEnterpriseId())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(userDTOList)) {
return RestResponse.failure(ErrorCode.ACCOUNTNOTEXISTS.getCode(), "观云台账号不存在");
}
List<Integer> enterpriseIdList = userDTOList.stream()
.map(userDTO -> userDTO.getEnterpriseId()).collect(Collectors.toList());
List<EnterpriseDTO> enterpriseDTOList = this.enterpriseApiService.listEnterpriseByIds(enterpriseIdList).getResult();
//随机取一个用户
Integer enterpriseId = userDTOList.get(0).getEnterpriseId();
ServiceResponse<Void> smsSendResult = ServiceResponse.success();
if(!tsPhone.equals(phoneNumber)){
......@@ -130,7 +137,9 @@ public class LoginController {
List<UserDTO> userDTOList = this.userApiService.listUserByPhoneNumber(userDTO.getPhoneNumber(), userDTO.getPhoneAreaCode()).getResult();
log.info("userDTOList:{}", JSON.toJSONString(userDTOList));
if(CollectionUtils.isNotEmpty(userDTOList)){
List<Integer> enterpriseIdList = userDTOList.stream().map(user -> user.getEnterpriseId()).collect(Collectors.toList());
List<Integer> enterpriseIdList = userDTOList.stream()
.filter(user -> checkCloudAppExist(user.getEnterpriseId()))
.map(user -> user.getEnterpriseId()).collect(Collectors.toList());
List<EnterpriseDTO> enterpriseDTOList = this.enterpriseApiService.listEnterpriseByIds(enterpriseIdList).getResult();
List<EnterpriseVo> result = new ArrayList<>();
if(CollectionUtils.isNotEmpty(enterpriseDTOList)){
......@@ -170,4 +179,13 @@ public class LoginController {
.getServeInfo(enterpriseId, "cloud-data");
return ResultControllerUtils.commonResultOne(info, CloudDataServiceInfoVO.class);
}
private boolean checkCloudAppExist(Integer enterpriseId) {
ServiceResponse<EnterpriseServeInfoDTO> info = enterpriseLicenseApiService
.getServeInfo(enterpriseId, "cloud-data");
if (info.isSuccess() && info.getResult() != null && info.getResult().getServeStatus() != 1) {
return true;
}
return false;
}
}
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