mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
新增内网ip判断,内网返回所属地为"未知"
This commit is contained in:
+12
-1
@@ -1,6 +1,7 @@
|
||||
package com.cf.imes.module.system.convert.auth;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.ip.core.service.dto.IPQueryDataRespDTO;
|
||||
import com.cf.imes.module.system.api.sms.dto.code.SmsCodeSendReqDTO;
|
||||
@@ -36,11 +37,21 @@ public interface AuthConvert {
|
||||
|
||||
default AuthPermissionInfoRespVO convert(AdminUserDO user, OrganizationDO organizationDO, IPQueryDataRespDTO ipQueryDataRespDTO, List<RoleDO> roleList, List<MenuDO> menuList) {
|
||||
boolean ipQuerySuccess = ObjectUtil.isNotNull(ipQueryDataRespDTO);
|
||||
String region = null;
|
||||
if (ipQuerySuccess) {
|
||||
String prov = ipQueryDataRespDTO.getProv();
|
||||
if (CharSequenceUtil.contains(prov, "未知")) {
|
||||
region = prov;
|
||||
} else {
|
||||
region = StringUtils.join(List.of(prov, ipQueryDataRespDTO.getCity(), ipQueryDataRespDTO.getArea()), "/");
|
||||
}
|
||||
}
|
||||
|
||||
return AuthPermissionInfoRespVO.builder()
|
||||
.user(AuthPermissionInfoRespVO.UserVO.builder()
|
||||
.id(user.getId()).nickname(user.getNickname()).avatar(user.getAvatar()).organId(user.getOrganId()).needSetPwd(StringUtils.isEmpty(user.getPassword()))
|
||||
.expireTime(organizationDO.getExpireTime()).ip(ipQuerySuccess ? ipQueryDataRespDTO.getIp() : "")
|
||||
.region(ipQuerySuccess ? ipQueryDataRespDTO.getProv() + "/" + ipQueryDataRespDTO.getCity() + "/" + ipQueryDataRespDTO.getArea() : "")
|
||||
.region(region)
|
||||
.build())
|
||||
.roles(convertSet(roleList, RoleDO::getCode))
|
||||
// 权限标识信息
|
||||
|
||||
Reference in New Issue
Block a user