【fix sonar】SysBaseApiImpl文件
This commit is contained in:
+27
-23
@@ -5,14 +5,9 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.base.Joiner;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import com.jero.common.api.dto.OnlineAuthDTO;
|
||||
import com.jero.common.api.dto.message.*;
|
||||
import com.jero.common.aspect.UrlMatchEnum;
|
||||
@@ -35,7 +30,10 @@ import com.jero.modules.system.entity.*;
|
||||
import com.jero.modules.system.mapper.*;
|
||||
import com.jero.modules.system.service.*;
|
||||
import com.jero.modules.system.util.SecurityUtil;
|
||||
import org.checkerframework.checker.units.qual.K;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
@@ -128,7 +126,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
|
||||
@Override
|
||||
public List<SysPermissionDataRuleModel> queryPermissionDataRule(String component, String requestPath, String username) {
|
||||
List<SysPermission> currentSyspermission = null;
|
||||
List<SysPermission> currentSyspermission;
|
||||
if(oConvertUtils.isNotEmpty(component)) {
|
||||
//1.通过注解属性pageComponent 获取菜单
|
||||
LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<>();
|
||||
@@ -176,7 +174,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
}
|
||||
return dataRules;
|
||||
}
|
||||
return null;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -477,7 +475,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
if(announcement != null){
|
||||
LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
|
||||
String userId = sysUser.getId();
|
||||
LambdaUpdateWrapper<SysAnnouncementSend> updateWrapper = new UpdateWrapper().lambda();
|
||||
LambdaUpdateWrapper<SysAnnouncementSend> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.set(SysAnnouncementSend::getReadFlag, CommonConstant.HAS_READ_FLAG);
|
||||
updateWrapper.set(SysAnnouncementSend::getReadTime, new Date());
|
||||
updateWrapper.last("where annt_id ='"+announcement.getId()+"' and user_id ='"+userId+"'");
|
||||
@@ -743,19 +741,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
List<SysUserDepart> userDepartList = sysUserDepartService.list(new QueryWrapper<SysUserDepart>().eq("user_id",userId));
|
||||
if(userDepartList != null){
|
||||
//查找所属公司
|
||||
String orgCodes = "";
|
||||
for(SysUserDepart userDepart : userDepartList){
|
||||
//查询所属公司编码
|
||||
SysDepart depart = sysDepartService.getById(userDepart.getDepId());
|
||||
int length = YouBianCodeUtil.ZHANWEI_LENGTH;
|
||||
String compyOrgCode = "";
|
||||
if(depart != null && depart.getOrgCode() != null){
|
||||
compyOrgCode = depart.getOrgCode().substring(0,length);
|
||||
if(orgCodes.indexOf(compyOrgCode) == -1){
|
||||
orgCodes = orgCodes + "," + compyOrgCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
String orgCodes = getOrgCodes(userDepartList);
|
||||
if(oConvertUtils.isNotEmpty(orgCodes)){
|
||||
orgCodes = orgCodes.substring(1);
|
||||
List<String> listIds = departMapper.getSubDepIdsByOrgCodes(orgCodes.split(","));
|
||||
@@ -770,6 +756,24 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
return userIds;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String getOrgCodes(List<SysUserDepart> userDepartList) {
|
||||
String orgCodes = "";
|
||||
for(SysUserDepart userDepart : userDepartList){
|
||||
//查询所属公司编码
|
||||
SysDepart depart = sysDepartService.getById(userDepart.getDepId());
|
||||
int length = YouBianCodeUtil.ZHANWEI_LENGTH;
|
||||
String compyOrgCode = "";
|
||||
if(depart != null && depart.getOrgCode() != null){
|
||||
compyOrgCode = depart.getOrgCode().substring(0,length);
|
||||
if(!orgCodes.contains(compyOrgCode)){
|
||||
orgCodes = orgCodes + "," + compyOrgCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
return orgCodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户拥有的角色集合
|
||||
* @param username
|
||||
@@ -1067,7 +1071,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
}
|
||||
return list;
|
||||
}
|
||||
return null;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
/**
|
||||
* 查询分类字典翻译
|
||||
|
||||
Reference in New Issue
Block a user