【3.6.3版本发布】代码修复

pull/5955/head^2
zhangdaiscott 9 months ago
parent e15e9d80c4
commit f3f70e8549

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -17,6 +17,8 @@ public class DataLogDTO {
private String type;
private String createName;
public DataLogDTO(){
}

@ -30,6 +30,13 @@ public class OnlineAuthDTO implements Serializable {
*/
private String onlineFormUrl;
//update-begin---author:chenrui ---date:20240123 for[QQYUN-7992]【online】工单申请下的online表单未配置online表单开发菜单操作报错无权限------------
/**
* online
*/
private String onlineWorkOrderUrl;
//update-end---author:chenrui ---date:20240123 for[QQYUN-7992]【online】工单申请下的online表单未配置online表单开发菜单操作报错无权限------------
public OnlineAuthDTO(){
}

@ -28,7 +28,9 @@ import java.io.InputStream;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -467,4 +469,19 @@ public class CommonUtils {
}
return false;
}
/**
* info
*
* @param msg
* @param objects
*/
public static void logInfo(String msg, Object... objects) {
try {
log.info(msg, objects);
} catch (Exception e) {
log.warn("{} —— {}", msg, e.getMessage());
}
}
}

@ -62,8 +62,8 @@ public class DySmsHelper {
//update-begin-authortaoyan date:20200811 for:配置类数据获取
StaticConfig staticConfig = SpringContextUtils.getBean(StaticConfig.class);
logger.info("阿里大鱼短信秘钥 accessKeyId" + staticConfig.getAccessKeyId());
logger.info("阿里大鱼短信秘钥 accessKeySecret"+ staticConfig.getAccessKeySecret());
//logger.info("阿里大鱼短信秘钥 accessKeyId" + staticConfig.getAccessKeyId());
//logger.info("阿里大鱼短信秘钥 accessKeySecret"+ staticConfig.getAccessKeySecret());
setAccessKeyId(staticConfig.getAccessKeyId());
setAccessKeySecret(staticConfig.getAccessKeySecret());
//update-end-authortaoyan date:20200811 for:配置类数据获取

@ -172,7 +172,11 @@ public class HttpUtils {
String[] params = param.split("&");
for (String s : params) {
int index = s.indexOf("=");
result.put(s.substring(0, index), s.substring(index + 1));
//update-begin---author:chenrui ---date:20240222 for[issues/5879]数据查询传ds=“”造成的异常------------
if (index != -1) {
result.put(s.substring(0, index), s.substring(index + 1));
}
//update-end---author:chenrui ---date:20240222 for[issues/5879]数据查询传ds=“”造成的异常------------
}
return result;
}
@ -196,7 +200,11 @@ public class HttpUtils {
String[] params = param.split("&");
for (String s : params) {
int index = s.indexOf("=");
result.put(s.substring(0, index), s.substring(index + 1));
//update-begin---author:chenrui ---date:20240222 for[issues/5879]数据查询传ds=“”造成的异常------------
if (index != -1) {
result.put(s.substring(0, index), s.substring(index + 1));
}
//update-end---author:chenrui ---date:20240222 for[issues/5879]数据查询传ds=“”造成的异常------------
}
return result;
}

@ -9,8 +9,6 @@ import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.CommonUtils;
import org.jeecg.common.util.filter.SsrfFileTypeFilter;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.system.service.ISysFilesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.AntPathMatcher;
import org.springframework.util.FileCopyUtils;

@ -76,28 +76,20 @@ public class LoginController {
Result<JSONObject> result = new Result<JSONObject>();
String username = sysLoginModel.getUsername();
String password = sysLoginModel.getPassword();
//update-begin-author:taoyan date:2022-11-7 for: issues/4109 平台用户登录失败锁定用户
if(isLoginFailOvertimes(username)){
return result.error500("该用户登录失败次数过多请于10分钟后再次登录");
}
//update-end-author:taoyan date:2022-11-7 for: issues/4109 平台用户登录失败锁定用户
//update-begin--Author:scott Date:20190805 for暂时注释掉密码加密逻辑有点问题
//前端密码加密,后端进行密码解密
//password = AesEncryptUtil.desEncrypt(sysLoginModel.getPassword().replaceAll("%2B", "\\+")).trim();//密码解密
//update-begin--Author:scott Date:20190805 for暂时注释掉密码加密逻辑有点问题
//update-begin-author:taoyan date:20190828 for:校验验证码
// step.1 验证码check
String captcha = sysLoginModel.getCaptcha();
if(captcha==null){
result.error500("验证码无效");
return result;
}
String lowerCaseCaptcha = captcha.toLowerCase();
//update-begin-author:taoyan date:2022-9-13 for: VUEN-2245 【漏洞】发现新漏洞待处理20220906
// 加入密钥作为混淆,避免简单的拼接,被外部利用,用户自定义该密钥即可
String origin = lowerCaseCaptcha+sysLoginModel.getCheckKey()+jeecgBaseConfig.getSignatureSecret();
String realKey = Md5Util.md5Encode(origin, "utf-8");
//update-end-author:taoyan date:2022-9-13 for: VUEN-2245 【漏洞】发现新漏洞待处理20220906
Object checkCode = redisUtil.get(realKey);
//当进入登录页时,有一定几率出现验证码错误 #1714
if(checkCode==null || !checkCode.toString().equals(lowerCaseCaptcha)) {
@ -107,40 +99,36 @@ public class LoginController {
result.setCode(HttpStatus.PRECONDITION_FAILED.value());
return result;
}
//update-end-author:taoyan date:20190828 for:校验验证码
//1. 校验用户是否有效
//update-begin-author:wangshuai date:20200601 for: 登录代码验证用户是否注销bugif条件永远为false
// step.2 校验用户是否存在且有效
LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SysUser::getUsername,username);
SysUser sysUser = sysUserService.getOne(queryWrapper);
//update-end-author:wangshuai date:20200601 for: 登录代码验证用户是否注销bugif条件永远为false
result = sysUserService.checkUserIsEffective(sysUser);
if(!result.isSuccess()) {
return result;
}
//2. 校验用户名或密码是否正确
// step.3 校验用户名或密码是否正确
String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt());
String syspassword = sysUser.getPassword();
if (!syspassword.equals(userpassword)) {
//update-begin-author:taoyan date:2022-11-7 for: issues/4109 平台用户登录失败锁定用户
addLoginFailOvertimes(username);
//update-end-author:taoyan date:2022-11-7 for: issues/4109 平台用户登录失败锁定用户
result.error500("用户名或密码错误");
return result;
}
//用户登录信息
// step.4 登录成功获取用户信息
userInfo(sysUser, result, request);
//update-begin--Author:liusq Date:20210126 for登录成功删除redis中的验证码
// step.5 登录成功删除验证码
redisUtil.del(realKey);
//update-begin--Author:liusq Date:20210126 for登录成功删除redis中的验证码
redisUtil.del(CommonConstant.LOGIN_FAIL + username);
// step.6 记录用户登录日志
LoginUser loginUser = new LoginUser();
BeanUtils.copyProperties(sysUser, loginUser);
baseCommonService.addLog("用户名: " + username + ",登录成功!", CommonConstant.LOG_TYPE_1, null,loginUser);
//update-end--Author:wangshuai Date:20200714 for登录日志没有记录人员
return result;
}
@ -150,12 +138,14 @@ public class LoginController {
*/
@GetMapping("/user/getUserInfo")
public Result<JSONObject> getUserInfo(HttpServletRequest request){
long start = System.currentTimeMillis();
Result<JSONObject> result = new Result<JSONObject>();
String username = JwtUtil.getUserNameByToken(request);
if(oConvertUtils.isNotEmpty(username)) {
// 根据用户名查询用户信息
SysUser sysUser = sysUserService.getUserByName(username);
JSONObject obj=new JSONObject();
log.info("1 获取用户信息耗时(用户基础信息)" + (System.currentTimeMillis() - start) + "毫秒");
//update-begin---author:scott ---date:2022-06-20 forvue3前端支持自定义首页-----------
String vue3Version = request.getHeader(CommonConstant.VERSION);
@ -170,13 +160,16 @@ public class LoginController {
}
//update-begin---author:liusq ---date:2022-06-29 for接口返回值修改同步修改这里的判断逻辑-----------
//update-end---author:scott ---date::2022-06-20 forvue3前端支持自定义首页--------------
log.info("2 获取用户信息耗时 (首页面配置)" + (System.currentTimeMillis() - start) + "毫秒");
obj.put("userInfo",sysUser);
obj.put("sysAllDictItems", sysDictService.queryAllDictItems());
log.info("3 获取用户信息耗时 (字典数据)" + (System.currentTimeMillis() - start) + "毫秒");
result.setResult(obj);
result.success("");
}
log.info("end 获取用户信息耗时 " + (System.currentTimeMillis() - start) + "毫秒");
return result;
}
@ -424,8 +417,7 @@ public class LoginController {
//update-begin-author:taoyan date:2022-11-7 for: issues/4109 平台用户登录失败锁定用户
addLoginFailOvertimes(phone);
//update-end-author:taoyan date:2022-11-7 for: issues/4109 平台用户登录失败锁定用户
result.setMessage("手机验证码错误");
return result;
return Result.error("手机验证码错误");
}
//用户信息
userInfo(sysUser, result, request);
@ -552,7 +544,7 @@ public class LoginController {
@RequiresRoles({"admin"})
@GetMapping(value = "/switchVue3Menu")
public Result<String> switchVue3Menu(HttpServletResponse response) {
Result<String> res = new Result<String>();
Result<String> res = new Result<String>();
sysPermissionService.switchVue3Menu();
return res;
}
@ -597,10 +589,12 @@ public class LoginController {
String orgCode = sysUser.getOrgCode();
if(oConvertUtils.isEmpty(orgCode)) {
//如果当前用户无选择部门 查看部门关联信息
List<SysDepart> departs = sysDepartService.queryUserDeparts(sysUser.getId());
//update-begin-author:taoyan date:20220117 for: JTC-1068【app】新建用户没有设置部门及角色点击登录提示暂未归属部一直在登录页面 使用手机号登录 可正常
if (departs == null || departs.size() == 0) {
/*result.error500("用户暂未归属部门,不可登录!");
return result;*/
}else{
orgCode = departs.get(0).getOrgCode();
@ -736,8 +730,8 @@ public class LoginController {
if(failTime!=null){
val = Integer.parseInt(failTime.toString());
}
// 10分钟
redisUtil.set(key, ++val, 10);
// 10分钟一分钟为60s
redisUtil.set(key, ++val, 600);
}
}

@ -333,6 +333,7 @@ public class SysAnnouncementController {
*/
@RequestMapping(value = "/listByUser", method = RequestMethod.GET)
public Result<Map<String, Object>> listByUser(@RequestParam(required = false, defaultValue = "5") Integer pageSize) {
long start = System.currentTimeMillis();
Result<Map<String,Object>> result = new Result<Map<String,Object>>();
Map<String,Object> sysMsgMap = new HashMap(5);
LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
@ -349,12 +350,16 @@ public class SysAnnouncementController {
anntMsgList = sysAnnouncementService.querySysCementPageByUserId(anntMsgList,userId,"1");
sysMsgMap.put("anntMsgList", anntMsgList.getRecords());
sysMsgMap.put("anntMsgTotal", anntMsgList.getTotal());
log.info("begin 获取用户系统公告 (通知)" + (System.currentTimeMillis() - start) + "毫秒");
//系统消息
Page<SysAnnouncement> sysMsgList = new Page<SysAnnouncement>(0, pageSize);
sysMsgList = sysAnnouncementService.querySysCementPageByUserId(sysMsgList,userId,"2");
sysMsgMap.put("sysMsgList", sysMsgList.getRecords());
sysMsgMap.put("sysMsgTotal", sysMsgList.getTotal());
log.info("end 获取用户系统公告 (系统消息)" + (System.currentTimeMillis() - start) + "毫秒");
result.setSuccess(true);
result.setResult(sysMsgMap);

@ -600,9 +600,10 @@ public class SysDictController {
* @return
*/
@RequestMapping(value = "/deleteList", method = RequestMethod.GET)
public Result<List<SysDict>> deleteList() {
public Result<List<SysDict>> deleteList(HttpServletRequest request) {
Result<List<SysDict>> result = new Result<List<SysDict>>();
List<SysDict> list = this.sysDictService.queryDeleteList();
String tenantId = TokenUtils.getTenantIdByRequest(request);
List<SysDict> list = this.sysDictService.queryDeleteList(tenantId);
result.setSuccess(true);
result.setResult(list);
return result;

@ -1,152 +0,0 @@
package org.jeecg.modules.system.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.system.entity.SysFiles;
import org.jeecg.modules.system.service.ISysFilesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
/**
* @Description: -
* @Author: jeecg-boot
* @Date: 2022-07-21
* @Version: V1.0
*/
@Slf4j
@Api(tags = "知识库-文档管理")
@RestController
@RequestMapping("/sys/files")
public class SysFilesController extends JeecgController<SysFiles, ISysFilesService> {
@Autowired
private ISysFilesService sysFilesService;
/**
*
*
* @param sysFiles
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "知识库-文档管理-分页列表查询")
@ApiOperation(value = "知识库-文档管理-分页列表查询", notes = "知识库-文档管理-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(SysFiles sysFiles,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<SysFiles> queryWrapper = QueryGenerator.initQueryWrapper(sysFiles, req.getParameterMap());
Page<SysFiles> page = new Page<SysFiles>(pageNo, pageSize);
IPage<SysFiles> pageList = sysFilesService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
*
*
* @param sysFiles
* @return
*/
@AutoLog(value = "知识库-文档管理-添加")
@ApiOperation(value = "知识库-文档管理-添加", notes = "知识库-文档管理-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody SysFiles sysFiles) {
sysFilesService.save(sysFiles);
return Result.OK("添加成功!");
}
/**
*
*
* @param sysFiles
* @return
*/
@AutoLog(value = "知识库-文档管理-编辑")
@ApiOperation(value = "知识库-文档管理-编辑", notes = "知识库-文档管理-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<?> edit(@RequestBody SysFiles sysFiles) {
sysFilesService.updateById(sysFiles);
return Result.OK("编辑成功!");
}
/**
* id
*
* @param id
* @return
*/
@AutoLog(value = "知识库-文档管理-通过id删除")
@ApiOperation(value = "知识库-文档管理-通过id删除", notes = "知识库-文档管理-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
sysFilesService.removeById(id);
return Result.OK("删除成功!");
}
/**
*
*
* @param ids
* @return
*/
@AutoLog(value = "知识库-文档管理-批量删除")
@ApiOperation(value = "知识库-文档管理-批量删除", notes = "知识库-文档管理-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.sysFilesService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* id
*
* @param id
* @return
*/
@AutoLog(value = "知识库-文档管理-通过id查询")
@ApiOperation(value = "知识库-文档管理-通过id查询", notes = "知识库-文档管理-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
SysFiles sysFiles = sysFilesService.getById(id);
return Result.OK(sysFiles);
}
/**
* excel
*
* @param request
* @param sysFiles
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, SysFiles sysFiles) {
return super.exportXls(request, sysFiles, SysFiles.class, "知识库-文档管理");
}
/**
* excel
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, SysFiles.class);
}
}

@ -1,15 +1,12 @@
package org.jeecg.modules.system.controller;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.SymbolConstant;
@ -19,6 +16,7 @@ import org.jeecg.common.util.Md5Util;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.config.JeecgBaseConfig;
import org.jeecg.modules.base.service.BaseCommonService;
import org.jeecg.modules.system.constant.DefIndexConst;
import org.jeecg.modules.system.entity.*;
import org.jeecg.modules.system.model.SysPermissionTree;
import org.jeecg.modules.system.model.TreeModel;
@ -246,38 +244,66 @@ public class SysPermissionController {
if (oConvertUtils.isEmpty(loginUser)) {
return Result.error("请登录系统!");
}
List<SysPermission> metaList = sysPermissionService.queryByUser(loginUser.getUsername());
List<SysPermission> metaList = sysPermissionService.queryByUser(loginUser.getId());
//添加首页路由
//update-begin-author:taoyan date:20200211 for: TASK #3368 【路由缓存】首页的缓存设置有问题,需要根据后台的路由配置来实现是否缓存
if(!PermissionDataUtil.hasIndexPage(metaList)){
SysPermission indexMenu = sysPermissionService.list(new LambdaQueryWrapper<SysPermission>().eq(SysPermission::getName,"首页")).get(0);
metaList.add(0,indexMenu);
}
//update-end-author:taoyan date:20200211 for: TASK #3368 【路由缓存】首页的缓存设置有问题,需要根据后台的路由配置来实现是否缓存
//update-begin--Author:zyf Date:20220425 for:自定义首页地址 LOWCOD-1578
String version = request.getHeader(CommonConstant.VERSION);
//update-begin---author:liusq ---date:2022-06-29 for接口返回值修改同步修改这里的判断逻辑-----------
SysRoleIndex roleIndex= sysUserService.getDynamicIndexByUserRole(loginUser.getUsername(),version);
//update-end---author:liusq ---date:2022-06-29 for接口返回值修改同步修改这里的判断逻辑-----------
SysRoleIndex defIndexCfg = sysUserService.getDynamicIndexByUserRole(loginUser.getUsername(), version);
if (defIndexCfg == null) {
defIndexCfg = sysRoleIndexService.initDefaultIndex();
}
//update-end--Author:zyf Date:20220425 for自定义首页地址 LOWCOD-1578
if(roleIndex!=null){
List<SysPermission> menus = metaList.stream().filter(sysPermission -> "首页".equals(sysPermission.getName())).collect(Collectors.toList());
//update-begin---author:liusq ---date:2022-06-29 for设置自定义首页地址和组件----------
String component = roleIndex.getComponent();
String routeUrl = roleIndex.getUrl();
boolean route = roleIndex.isRoute();
if(oConvertUtils.isNotEmpty(routeUrl)){
// 如果没有授权角色首页,则自动添加首页路由
if (!PermissionDataUtil.hasIndexPage(metaList, defIndexCfg)) {
LambdaQueryWrapper<SysPermission> indexQueryWrapper = new LambdaQueryWrapper<>();
indexQueryWrapper.eq(SysPermission::getUrl, defIndexCfg.getUrl());
SysPermission indexMenu = sysPermissionService.getOne(indexQueryWrapper);
if (indexMenu == null) {
indexMenu = new SysPermission();
indexMenu.setUrl(defIndexCfg.getUrl());
indexMenu.setComponent(defIndexCfg.getComponent());
indexMenu.setRoute(defIndexCfg.isRoute());
indexMenu.setName(DefIndexConst.DEF_INDEX_NAME);
indexMenu.setMenuType(0);
}
// 如果没有授权一级菜单,则自身变为一级菜单
if (indexMenu.getParentId() != null && !PermissionDataUtil.hasMenuById(metaList, indexMenu.getParentId())) {
indexMenu.setMenuType(0);
indexMenu.setParentId(null);
}
if (oConvertUtils.isEmpty(indexMenu.getIcon())) {
indexMenu.setIcon("ant-design:home");
}
metaList.add(0, indexMenu);
}
//update-end-author:taoyan date:20200211 for: TASK #3368 【路由缓存】首页的缓存设置有问题,需要根据后台的路由配置来实现是否缓存
/* TODO
List<SysPermission> menus = metaList.stream().filter(sysPermission -> {
if (defIndexCfg.getUrl().equals(sysPermission.getUrl())) {
return true;
}
return defIndexCfg.getUrl().equals(sysPermission.getUrl());
}).collect(Collectors.toList());
//update-begin---author:liusq ---date:2022-06-29 for设置自定义首页地址和组件----------
if (menus.size() == 1) {
String component = defIndexCfg.getComponent();
String routeUrl = defIndexCfg.getUrl();
boolean route = defIndexCfg.isRoute();
if (oConvertUtils.isNotEmpty(routeUrl)) {
menus.get(0).setComponent(component);
menus.get(0).setRoute(route);
menus.get(0).setUrl(routeUrl);
}else{
} else {
menus.get(0).setComponent(component);
}
//update-end---author:liusq ---date:2022-06-29 for设置自定义首页地址和组件-----------
}
//update-end---author:liusq ---date:2022-06-29 for设置自定义首页地址和组件-----------
*/
JSONObject json = new JSONObject();
JSONArray menujsonArray = new JSONArray();
this.getPermissionJsonArray(menujsonArray, metaList, null);
@ -287,7 +313,7 @@ public class SysPermissionController {
JSONArray authjsonArray = new JSONArray();
this.getAuthJsonArray(authjsonArray, metaList);
//查询所有的权限
LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<SysPermission>();
LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<SysPermission>().select( SysPermission::getName, SysPermission::getPermsType, SysPermission::getPerms, SysPermission::getStatus);
query.eq(SysPermission::getDelFlag, CommonConstant.DEL_FLAG_0);
query.eq(SysPermission::getMenuType, CommonConstant.MENU_TYPE_2);
//query.eq(SysPermission::getStatus, "1");
@ -298,6 +324,12 @@ public class SysPermissionController {
json.put("menu", menujsonArray);
//按钮权限(用户拥有的权限集合)
json.put("auth", authjsonArray);
// 按钮权限(用户拥有的权限集合)
List<String> codeList = metaList.stream()
.filter((permission) -> CommonConstant.MENU_TYPE_2.equals(permission.getMenuType()) && CommonConstant.STATUS_1.equals(permission.getStatus()))
.collect(ArrayList::new, (list, permission) -> list.add(permission.getPerms()), ArrayList::addAll);
// 所拥有的权限编码(vue3专用)
json.put("codeList", codeList);
//全部权限配置集合(按钮权限,访问权限)
json.put("allAuth", allauthjsonArray);
//数据源安全模式
@ -325,7 +357,7 @@ public class SysPermissionController {
return Result.error("请登录系统!");
}
// 获取当前用户的权限集合
List<SysPermission> metaList = sysPermissionService.queryByUser(loginUser.getUsername());
List<SysPermission> metaList = sysPermissionService.queryByUser(loginUser.getId());
// 按钮权限(用户拥有的权限集合)
List<String> codeList = metaList.stream()
.filter((permission) -> CommonConstant.MENU_TYPE_2.equals(permission.getMenuType()) && CommonConstant.STATUS_1.equals(permission.getStatus()))
@ -334,7 +366,7 @@ public class SysPermissionController {
JSONArray authArray = new JSONArray();
this.getAuthJsonArray(authArray, metaList);
// 查询所有的权限
LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<>();
LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<SysPermission>().select( SysPermission::getName, SysPermission::getPermsType, SysPermission::getPerms, SysPermission::getStatus);
query.eq(SysPermission::getDelFlag, CommonConstant.DEL_FLAG_0);
query.eq(SysPermission::getMenuType, CommonConstant.MENU_TYPE_2);
List<SysPermission> allAuthList = sysPermissionService.list(query);

@ -123,13 +123,8 @@ public class SysRoleController {
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<SysRole>> result = new Result<IPage<SysRole>>();
//update-begin---author:wangshuai---date:2023-11-20---for:【QQYUN-7089】低代码模式 选择组织角色没有数据 在租户角色中添加数据后,列表也无数据展示---
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
//此接口必须通过租户来隔离查询
role.setTenantId(oConvertUtils.getInt(!"0".equals(TenantContext.getTenant()) ? TenantContext.getTenant() : "", -1));
}
//update-end---author:wangshuai---date:2023-11-20---for:【QQYUN-7089】低代码模式 选择组织角色没有数据 在租户角色中添加数据后,列表也无数据展示---
//此接口必须通过租户来隔离查询
role.setTenantId(oConvertUtils.getInt(!"0".equals(TenantContext.getTenant()) ? TenantContext.getTenant() : "", -1));
QueryWrapper<SysRole> queryWrapper = QueryGenerator.initQueryWrapper(role, req.getParameterMap());
Page<SysRole> page = new Page<SysRole>(pageNo, pageSize);
@ -220,6 +215,12 @@ public class SysRoleController {
return Result.error("删除角色失败,当前角色不在此租户中。");
}
}
//update-begin---author:wangshuai---date:2024-01-16---for:【QQYUN-7974】禁止删除 admin 角色---
//是否存在admin角色
sysRoleService.checkAdminRoleRejectDel(id);
//update-end---author:wangshuai---date:2024-01-16---for:【QQYUN-7974】禁止删除 admin 角色---
sysRoleService.deleteRole(id);
return Result.ok("删除角色成功");
}
@ -252,6 +253,8 @@ public class SysRoleController {
}
}
}
//验证是否为admin角色
sysRoleService.checkAdminRoleRejectDel(ids);
sysRoleService.deleteBatchRole(ids.split(","));
result.success("删除角色成功!");
}

@ -244,6 +244,7 @@ public class SysUserController {
Result<SysUser> result = new Result<SysUser>();
try {
String ids = jsonObject.getString("ids");
sysUserService.checkUserAdminRejectDel(ids);
String status = jsonObject.getString("status");
String[] arr = ids.split(",");
for (String id : arr) {
@ -1549,7 +1550,8 @@ public class SysUserController {
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
@RequestParam(name = "departId", required = false) String departId,
@RequestParam(name = "roleId", required = false) String roleId,
@RequestParam(name="keyword",required=false) String keyword) {
@RequestParam(name="keyword",required=false) String keyword,
@RequestParam(name="excludeUserIdList",required = false) String excludeUserIdList) {
//------------------------------------------------------------------------------------------------
Integer tenantId = null;
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
@ -1560,7 +1562,7 @@ public class SysUserController {
}
}
//------------------------------------------------------------------------------------------------
IPage<SysUser> pageList = sysUserDepartService.getUserInformation(tenantId, departId,roleId, keyword, pageSize, pageNo);
IPage<SysUser> pageList = sysUserDepartService.getUserInformation(tenantId, departId,roleId, keyword, pageSize, pageNo,excludeUserIdList);
return Result.OK(pageList);
}

@ -61,7 +61,7 @@ public class SysUserOnlineController {
online.setToken(token);
//TODO 改成一次性查询
LoginUser loginUser = sysBaseApi.getUserByName(JwtUtil.getUsername(token));
if (loginUser != null) {
if (loginUser != null && !"_reserve_user_external".equals(loginUser.getUsername())) {
//update-begin---author:wangshuai ---date:20220104 for[JTC-382]在线用户查询无效------------
//验证用户名是否与传过来的用户名相同
boolean isMatchUsername=true;

@ -1,142 +0,0 @@
package org.jeecg.modules.system.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @Description: -
* @Author: jeecg-boot
* @Date: 2022-07-21
* @Version: V1.0
*/
@Data
@TableName("sys_files")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="sys_files对象", description="知识库-文档管理")
public class SysFiles {
/**主键id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键id")
private String id;
/**文件名称*/
@Excel(name = "文件名称", width = 15)
@ApiModelProperty(value = "文件名称")
private String fileName;
/**文件地址*/
@Excel(name = "文件地址", width = 15)
@ApiModelProperty(value = "文件地址")
private String url;
/**创建人登录名称*/
@Excel(name = "创建人登录名称", width = 15)
@Dict(dicCode = "username",dicText = "realname",dictTable = "sys_user")
@ApiModelProperty(value = "创建人登录名称")
private String createBy;
/**创建日期*/
@Excel(name = "创建日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private Date createTime;
/**更新人登录名称*/
@Excel(name = "更新人登录名称", width = 15)
@ApiModelProperty(value = "更新人登录名称")
private String updateBy;
/**更新日期*/
@Excel(name = "更新日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private Date updateTime;
/**文档类型folder:文件夹 excel:excel doc:word pp:ppt image:图片 archive:其他文档 video:视频)*/
@Excel(name = "文档类型folder:文件夹 excel:excel doc:word pp:ppt image:图片 archive:其他文档 video:视频)", width = 15)
@ApiModelProperty(value = "文档类型folder:文件夹 excel:excel doc:word pp:ppt image:图片 archive:其他文档 video:视频)")
private String fileType;
/**文件上传类型(temp/本地上传(临时文件) manage/知识库 comment)*/
@Excel(name = "文件上传类型(temp/本地上传(临时文件) manage/知识库 common(通用上传))", width = 15)
@ApiModelProperty(value = "文件上传类型(temp/本地上传(临时文件) manage/知识库)")
private String storeType;
/**父级id*/
@Excel(name = "父级id", width = 15)
@ApiModelProperty(value = "父级id")
private String parentId;
/**租户id*/
@Excel(name = "租户id", width = 15)
@ApiModelProperty(value = "租户id")
private String tenantId;
/**文件大小kb*/
@Excel(name = "文件大小kb", width = 15)
@ApiModelProperty(value = "文件大小kb")
private Double fileSize;
/**是否文件夹(1是 0否)*/
@Excel(name = "是否文件夹(1是 0否)", width = 15)
@ApiModelProperty(value = "是否文件夹(1是 0否)")
private String izFolder;
/**是否为1级文件夹允许为空 (1是 )*/
@Excel(name = "是否为1级文件夹允许为空 (1是 )", width = 15)
@ApiModelProperty(value = "是否为1级文件夹允许为空 (1是 )")
private String izRootFolder;
/**是否标星(1是 0否)*/
@Excel(name = "是否标星(1是 0否)", width = 15)
@ApiModelProperty(value = "是否标星(1是 0否)")
private String izStar;
/**下载次数*/
@Excel(name = "下载次数", width = 15)
@ApiModelProperty(value = "下载次数")
private Integer downCount;
/**阅读次数*/
@Excel(name = "阅读次数", width = 15)
@ApiModelProperty(value = "阅读次数")
private Integer readCount;
/**分享链接*/
@Excel(name = "分享链接", width = 15)
@ApiModelProperty(value = "分享链接")
private String shareUrl;
/**分享权限(1.关闭分享 2.允许所有联系人查看 3.允许任何人查看)*/
@Excel(name = "分享权限(1.关闭分享 2.允许所有联系人查看 3.允许任何人查看)", width = 15)
@ApiModelProperty(value = "分享权限(1.关闭分享 2.允许所有联系人查看 3.允许任何人查看)")
private String sharePerms;
/**是否允许下载(1是 0否)*/
@Excel(name = "是否允许下载(1是 0否)", width = 15)
@ApiModelProperty(value = "是否允许下载(1是 0否)")
private String enableDown;
/**是否允许修改(1是 0否)*/
@Excel(name = "是否允许修改(1是 0否)", width = 15)
@ApiModelProperty(value = "是否允许修改(1是 0否)")
private String enableUpdat;
/**删除状态(0-正常,1-删除至回收站)*/
@Excel(name = "删除状态(0-正常,1-删除至回收站)", width = 15)
@ApiModelProperty(value = "删除状态(0-正常,1-删除至回收站)")
private String delFlag;
/**
*
*/
@TableField(exist=false)
private String userData;
/**
*
*/
@TableField(exist=false)
private String realname;
/**
*
*/
@TableField(exist=false)
private String zipName;
}

@ -9,7 +9,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.modules.system.constant.DefIndexConst;
/**
* <p>
@ -166,11 +166,11 @@ public class SysPermission implements Serializable {
}
public SysPermission(boolean index) {
if(index) {
this.id = "9502685863ab87f0ad1134142788a385";
this.name="首页";
this.component="dashboard/Analysis";
this.componentName="dashboard-analysis";
this.url="/dashboard/analysis";
this.id = "9502685863ab87f0ad1134142788a385";
this.name = DefIndexConst.DEF_INDEX_NAME;
this.component = DefIndexConst.DEF_INDEX_COMPONENT;
this.componentName = "dashboard-analysis";
this.url = DefIndexConst.DEF_INDEX_URL;
this.icon="home";
this.menuType=0;
this.sortNo=0.0;

@ -82,6 +82,12 @@ public interface SysDictMapper extends BaseMapper<SysDict> {
*/
List<DictModelMany> queryManyDictByKeys(@Param("dictCodeList") List<String> dictCodeList, @Param("keys") List<String> keys);
/**
*
* @return
*/
public List<DictModelMany> queryAllDictItems(List<Integer> tenantIdList);
/**
* id -->value,departName -->text
* @return
@ -187,4 +193,11 @@ public interface SysDictMapper extends BaseMapper<SysDict> {
*/
@InterceptorIgnore(tenantLine = "true")
List<SysDict> getDictListByLowAppId(@Param("lowAppId") String lowAppId, @Param("tenantId") Integer tenantId);
/**
* id
* @return
*/
@Select("select * from sys_dict where del_flag = 1 and tenant_id = #{tenantId}")
List<SysDict> queryDeleteListBtTenantId(@Param("tenantId") Integer tenantId);
}

@ -1,14 +0,0 @@
package org.jeecg.modules.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.system.entity.SysFiles;
/**
* @Description: -
* @Author: jeecg-boot
* @Date: 2022-07-21
* @Version: V1.0
*/
public interface SysFilesMapper extends BaseMapper<SysFiles> {
}

@ -29,10 +29,10 @@ public interface SysPermissionMapper extends BaseMapper<SysPermission> {
/**
*
* @param username
* @param userId ID
* @return List<SysPermission>
*/
public List<SysPermission> queryByUser(@Param("username") String username);
public List<SysPermission> queryByUser(@Param("userId") String userId);
/**
*

@ -57,7 +57,7 @@ public interface SysUserDepartMapper extends BaseMapper<SysUserDepart>{
* @param keyword
* @return
*/
IPage<SysUser> getProcessUserList(Page<SysUser> page, @Param("orgCode") String orgCode, @Param("keyword") String keyword, @Param("tenantId") Integer tenantId);
IPage<SysUser> getProcessUserList(Page<SysUser> page, @Param("orgCode") String orgCode, @Param("keyword") String keyword, @Param("tenantId") Integer tenantId, @Param("excludeUserIdList") List<String> excludeUserIdList);
/**
* id

@ -171,9 +171,10 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
* @param page
* @param roleId
* @param keyword
* @param userIdList
* @return
*/
IPage<SysUser> selectUserListByRoleId(Page<SysUser> page, @Param("roleId") String roleId, @Param("keyword") String keyword, @Param("tenantId") Integer tenantId);
IPage<SysUser> selectUserListByRoleId(Page<SysUser> page, @Param("roleId") String roleId, @Param("keyword") String keyword, @Param("tenantId") Integer tenantId, @Param("excludeUserIdList") List<String> excludeUserIdList);
/**
*

@ -74,6 +74,13 @@
select user_id from sys_user_tenant where tenant_id = #{tenantId} and status = '1'
)
</if>
<!--【QQYUN-8239】用户角色添加用户 返回2页数据实际只显示一页 需要将不符合的用户id排除-->
<if test="excludeUserIdList!=null and excludeUserIdList.size()>0">
and a.id not in
<foreach collection="excludeUserIdList" item="userId" open="(" close=")" separator=",">
#{userId}
</foreach>
</if>
</select>
<!--获取租户下的部门-通过前台传过来的部门id-->

@ -219,6 +219,14 @@
select user_id from sys_user_tenant where tenant_id = #{tenantId} and status = '1'
)
</if>
<!--【QQYUN-8239】用户角色添加用户 返回2页数据实际只显示一页 需要将不符合的用户id排除-->
<if test="excludeUserIdList!=null and excludeUserIdList.size()>0">
and a.id not in
<foreach collection="excludeUserIdList" item="userId" open="(" close=")" separator=",">
#{userId}
</foreach>
</if>
</select>
<!--获取租户下的用户离职列表信息-->

@ -238,7 +238,7 @@ public interface ISysDictService extends IService<SysDict> {
*
* @return
*/
public List<SysDict> queryDeleteList();
public List<SysDict> queryDeleteList(String tenantId);
/**
*

@ -1,14 +0,0 @@
package org.jeecg.modules.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.system.entity.SysFiles;
/**
* @Description: -
* @Author: jeecg-boot
* @Date: 2022-07-21
* @Version: V1.0
*/
public interface ISysFilesService extends IService<SysFiles> {
}

@ -67,4 +67,11 @@ public interface ISysRoleService extends IService<SysRole> {
* @return
*/
Long getRoleCountByTenantId(String id, Integer tenantId);
/**
* admin
*
* @param ids
*/
void checkAdminRoleRejectDel(String ids);
}

@ -77,7 +77,7 @@ public interface ISysUserDepartService extends IService<SysUserDepart> {
* @param pageNo
* @return
*/
IPage<SysUser> getUserInformation(Integer tenantId,String departId,String roleId, String keyword, Integer pageSize, Integer pageNo);
IPage<SysUser> getUserInformation(Integer tenantId,String departId,String roleId, String keyword, Integer pageSize, Integer pageNo, String excludeUserIdList);
/**
* idid

@ -190,10 +190,10 @@ public interface ISysUserService extends IService<SysUser> {
/**
*
*
* @param username
* @param userId id
* @return
*/
Set<String> getUserPermissionsSet(String username);
Set<String> getUserPermissionsSet(String userId);
/**
* ID
@ -411,4 +411,10 @@ public interface ISysUserService extends IService<SysUser> {
* @return
*/
Result<?> importAppUser(HttpServletRequest request);
/**
*
* @param ids
*/
void checkUserAdminRejectDel(String ids);
}

@ -35,7 +35,7 @@ public interface ISysUserTenantService extends IService<SysUserTenant> {
List<SysUser> setUserTenantIds(List<SysUser> records);
/**
* idid
* idids
* @param tenantId
* @return
*/

@ -22,7 +22,6 @@ import org.jeecg.common.api.dto.DataLogDTO;
import org.jeecg.common.api.dto.OnlineAuthDTO;
import org.jeecg.common.api.dto.message.*;
import org.jeecg.common.aspect.UrlMatchEnum;
import org.jeecg.common.config.TenantContext;
import org.jeecg.common.constant.*;
import org.jeecg.common.constant.enums.EmailTemplateEnum;
import org.jeecg.common.constant.enums.MessageTypeEnum;
@ -125,8 +124,6 @@ public class SysBaseApiImpl implements ISysBaseAPI {
@Autowired
private ISysDataLogService sysDataLogService;
@Autowired
private ISysFilesService sysFilesService;
@Autowired
private ISysRoleService sysRoleService;
@Autowired
private ISysUserTenantService sysUserTenantService;
@ -336,7 +333,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
}
@Override
public Set<String> getDepartParentIdsByDepIds(Set depIds) {
public Set<String> getDepartParentIdsByDepIds(Set<String> depIds) {
LambdaQueryWrapper<SysDepart> departQuery = new LambdaQueryWrapper<SysDepart>().in(SysDepart::getId, depIds);
List<SysDepart> departList = departMapper.selectList(departQuery);
@ -1098,13 +1095,13 @@ public class SysBaseApiImpl implements ISysBaseAPI {
/**
*
* @param username
* @param userId
* @return
*/
@Override
public Set<String> getUserPermissionSet(String username) {
public Set<String> getUserPermissionSet(String userId) {
Set<String> permissionSet = new HashSet<>();
List<SysPermission> permissionList = sysPermissionMapper.queryByUser(username);
List<SysPermission> permissionList = sysPermissionMapper.queryByUser(userId);
//================= begin 开启租户的时候 如果没有test角色默认加入test角色================
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
if (permissionList == null) {
@ -1123,7 +1120,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
permissionSet.add(po.getPerms());
}
}
log.info("-------通过数据库读取用户拥有的权限Perms------username "+ username+",Perms size: "+ (permissionSet==null?0:permissionSet.size()) );
log.info("-------通过数据库读取用户拥有的权限Perms------userId "+ userId+",Perms size: "+ (permissionSet==null?0:permissionSet.size()) );
return permissionSet;
}
@ -1148,7 +1145,13 @@ public class SysBaseApiImpl implements ISysBaseAPI {
sysPermission.setUrl(onlineFormUrl);
int count = sysPermissionMapper.queryCountByUsername(username, sysPermission);
if(count<=0){
return false;
//update-begin---author:chenrui ---date:20240123 for[QQYUN-7992]【online】工单申请下的online表单未配置online表单开发菜单操作报错无权限------------
sysPermission.setUrl(onlineAuthDTO.getOnlineWorkOrderUrl());
count = sysPermissionMapper.queryCountByUsername(username, sysPermission);
if(count<=0) {
return false;
}
//update-end---author:chenrui ---date:20240123 for[QQYUN-7992]【online】工单申请下的online表单未配置online表单开发菜单操作报错无权限------------
}
} else {
//找到菜单了
@ -1174,12 +1177,12 @@ public class SysBaseApiImpl implements ISysBaseAPI {
/**
* common api
* @param username
* @param userId
* @return
*/
@Override
public Set<String> queryUserAuths(String username) {
return getUserPermissionSet(username);
public Set<String> queryUserAuths(String userId) {
return getUserPermissionSet(userId);
}
/**
@ -1591,30 +1594,14 @@ public class SysBaseApiImpl implements ISysBaseAPI {
entity.setDataContent(dataLogDto.getContent());
entity.setType(dataLogDto.getType());
entity.setDataVersion("1");
entity.autoSetCreateName();
if (oConvertUtils.isNotEmpty(dataLogDto.getCreateName())) {
entity.setCreateBy(dataLogDto.getCreateName());
} else {
entity.autoSetCreateName();
}
sysDataLogService.save(entity);
}
@Override
public void addSysFiles(SysFilesModel sysFilesModel) {
SysFiles sysFiles = new SysFiles();
BeanUtils.copyProperties(sysFilesModel,sysFiles);
String defaultValue = "0";
sysFiles.setIzStar(defaultValue);
sysFiles.setIzFolder(defaultValue);
sysFiles.setIzRootFolder(defaultValue);
sysFiles.setDelFlag(defaultValue);
String tenantId = oConvertUtils.getString(TenantContext.getTenant());
sysFiles.setTenantId(tenantId);
sysFilesService.save(sysFiles);
}
@Override
public String getFileUrl(String fileId) {
SysFiles sysFiles = sysFilesService.getById(fileId);
return sysFiles.getUrl();
}
@Override
public void updateAvatar(LoginUser loginUser) {
SysUser sysUser = new SysUser();

@ -12,14 +12,13 @@ import org.jeecg.common.constant.enums.FileTypeEnum;
import org.jeecg.common.constant.enums.MessageTypeEnum;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.system.vo.SysFilesModel;
import org.jeecg.common.util.CommonUtils;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.system.entity.SysComment;
import org.jeecg.modules.system.entity.SysFiles;
import org.jeecg.modules.system.entity.SysFormFile;
import org.jeecg.modules.system.mapper.SysCommentMapper;
import org.jeecg.modules.system.mapper.SysFilesMapper;
import org.jeecg.modules.system.mapper.SysFormFileMapper;
import org.jeecg.modules.system.service.ISysCommentService;
import org.jeecg.modules.system.vo.SysCommentFileVo;
@ -55,8 +54,8 @@ public class SysCommentServiceImpl extends ServiceImpl<SysCommentMapper, SysComm
@Autowired
private SysFormFileMapper sysFormFileMapper;
@Autowired
private SysFilesMapper sysFilesMapper;
// @Autowired
// private IEasyOaBaseApi easyOaBseApi;
@Autowired
private RedisUtil redisUtil;
@ -158,7 +157,7 @@ public class SysCommentServiceImpl extends ServiceImpl<SysCommentMapper, SysComm
FileTypeEnum fileType = FileTypeEnum.getByType(type);
//保存至 SysFiles
SysFiles sysFiles = new SysFiles();
SysFilesModel sysFiles = new SysFilesModel();
sysFiles.setFileName(orgName);
sysFiles.setUrl(savePath);
sysFiles.setFileType(fileType.getValue());
@ -166,16 +165,13 @@ public class SysCommentServiceImpl extends ServiceImpl<SysCommentMapper, SysComm
if (size > 0) {
sysFiles.setFileSize(Double.parseDouble(String.valueOf(size)));
}
String defaultValue = "0";
sysFiles.setIzStar(defaultValue);
sysFiles.setIzFolder(defaultValue);
sysFiles.setIzRootFolder(defaultValue);
sysFiles.setDelFlag(defaultValue);
String fileId = String.valueOf(IdWorker.getId());
sysFiles.setId(fileId);
String tenantId = oConvertUtils.getString(TenantContext.getTenant());
sysFiles.setTenantId(tenantId);
sysFilesMapper.insert(sysFiles);
// //update-begin---author:wangshuai---date:2024-01-04---for:【QQYUN-7821】知识库后端迁移---
// easyOaBseApi.addSysFiles(sysFiles);
// //update-end---author:wangshuai---date:2024-01-04---for:【QQYUN-7821】知识库后端迁移---
//保存至 SysFormFile
String tableName = SYS_FORM_FILE_TABLE_NAME;
@ -188,18 +184,20 @@ public class SysCommentServiceImpl extends ServiceImpl<SysCommentMapper, SysComm
sysFormFileMapper.insert(sysFormFile);
}else{
SysFiles sysFiles = sysFilesMapper.selectById(existFileId);
if(sysFiles!=null){
// //update-begin---author:wangshuai---date:2024-01-04---for:【QQYUN-7821】知识库后端迁移---
// SysFilesModel sysFiles = easyOaBseApi.getFileById(existFileId);
// //update-end---author:wangshuai---date:2024-01-04---for:【QQYUN-7821】知识库后端迁移---
// if(sysFiles!=null){
//保存至 SysFormFile
String tableName = SYS_FORM_FILE_TABLE_NAME;
String tableDataId = request.getParameter("commentId");
SysFormFile sysFormFile = new SysFormFile();
sysFormFile.setTableName(tableName);
sysFormFile.setFileType(sysFiles.getFileType());
sysFormFile.setFileType("");
sysFormFile.setTableDataId(tableDataId);
sysFormFile.setFileId(existFileId);
sysFormFileMapper.insert(sysFormFile);
}
// }
}
//update-end-author:taoyan date:2023-6-12 for: QQYUN-4310【文件】从文件库选择文件功能未做
}
@ -224,7 +222,7 @@ public class SysCommentServiceImpl extends ServiceImpl<SysCommentMapper, SysComm
FileTypeEnum fileType = FileTypeEnum.getByType(type);
//保存至 SysFiles
SysFiles sysFiles = new SysFiles();
SysFilesModel sysFiles = new SysFilesModel();
sysFiles.setFileName(orgName);
sysFiles.setUrl(savePath);
sysFiles.setFileType(fileType.getValue());
@ -233,16 +231,13 @@ public class SysCommentServiceImpl extends ServiceImpl<SysCommentMapper, SysComm
sysFiles.setFileSize(Double.parseDouble(String.valueOf(size)));
}
String defaultValue = "0";
sysFiles.setIzStar(defaultValue);
sysFiles.setIzFolder(defaultValue);
sysFiles.setIzRootFolder(defaultValue);
sysFiles.setDelFlag(defaultValue);
String fileId = String.valueOf(IdWorker.getId());
sysFiles.setId(fileId);
String tenantId = oConvertUtils.getString(TenantContext.getTenant());
sysFiles.setTenantId(tenantId);
sysFilesMapper.insert(sysFiles);
// //update-begin---author:wangshuai---date:2024-01-04---for:【QQYUN-7821】知识库后端迁移---
// easyOaBseApi.addSysFiles(sysFiles);
// //update-end---author:wangshuai---date:2024-01-04---for:【QQYUN-7821】知识库后端迁移---
//保存至 SysFormFile
String tableName = SYS_FORM_FILE_TABLE_NAME;
String tableDataId = request.getParameter("commentId");

@ -152,37 +152,36 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
@Override
public Map<String, List<DictModel>> queryAllDictItems() {
Map<String, List<DictModel>> res = new HashMap(5);
LambdaQueryWrapper<SysDict> sysDictQueryWrapper = new LambdaQueryWrapper<SysDict>();
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
long start = System.currentTimeMillis();
Map<String, List<DictModel>> sysAllDictItems = new HashMap(5);
List<Integer> tenantIds = null;
//------------------------------------------------------------------------------------------------
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
sysDictQueryWrapper.eq(SysDict::getTenantId, oConvertUtils.getInt(TenantContext.getTenant(), 0))
.or().eq(SysDict::getTenantId,0);
if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) {
tenantIds = new ArrayList<>();
tenantIds.add(0);
if (TenantContext.getTenant() != null) {
tenantIds.add(oConvertUtils.getInt(TenantContext.getTenant()));
}
}
//------------------------------------------------------------------------------------------------
List<SysDict> ls = sysDictMapper.selectList(sysDictQueryWrapper);
LambdaQueryWrapper<SysDictItem> queryWrapper = new LambdaQueryWrapper<SysDictItem>();
queryWrapper.eq(SysDictItem::getStatus, 1);
queryWrapper.orderByAsc(SysDictItem::getSortOrder);
List<SysDictItem> sysDictItemList = sysDictItemMapper.selectList(queryWrapper);
for (SysDict d : ls) {
List<DictModel> dictModelList = sysDictItemList.stream().filter(s -> d.getId().equals(s.getDictId())).map(item -> {
DictModel dictModel = new DictModel();
dictModel.setText(item.getItemText());
dictModel.setValue(item.getItemValue());
return dictModel;
}).collect(Collectors.toList());
res.put(d.getDictCode(), dictModelList);
}
//update-begin-author:taoyan date:2022-7-8 for: 系统字典数据应该包括自定义的java类-枚举
List<DictModelMany> sysDictItemList = sysDictMapper.queryAllDictItems(tenantIds);
// 使用groupingBy根据dictCode分组
sysAllDictItems = sysDictItemList.stream()
.collect(Collectors.groupingBy(DictModelMany::getDictCode,
Collectors.mapping(d -> new DictModel(d.getValue(), d.getText(), d.getColor()), Collectors.toList())));
log.info(" >>> 1 获取系统字典项耗时SQL" + (System.currentTimeMillis() - start) + "毫秒");
Map<String, List<DictModel>> enumRes = ResourceUtil.getEnumDictData();
res.putAll(enumRes);
//update-end-author:taoyan date:2022-7-8 for: 系统字典数据应该包括自定义的java类-枚举
log.debug("-------登录加载系统字典-----" + res.toString());
return res;
sysAllDictItems.putAll(enumRes);
log.info(" >>> 2 获取系统字典项耗时Enum" + (System.currentTimeMillis() - start) + "毫秒");
log.info(" >>> end 获取系统字典库总耗时:" + (System.currentTimeMillis() - start) + "毫秒");
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
//log.info("-------登录加载系统字典-----" + sysAllDictItems.toString());
return sysAllDictItems;
}
/**
@ -531,10 +530,12 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
String filterSql = "";
String keywordSql = null;
String sqlWhere = "where ";
String sqlAnd = " and ";
//【JTC-631】判断如果 table 携带了 where 条件,那么就使用 and 查询,防止报错
if (tableSql.toLowerCase().contains(sqlWhere)) {
sqlWhere = CommonUtils.getFilterSqlByTableSql(tableSql) + " and ";
boolean tableHasWhere = tableSql.toLowerCase().contains(sqlWhere);
if (tableHasWhere) {
sqlWhere = CommonUtils.getFilterSqlByTableSql(tableSql);
}
// 下拉搜索组件 支持传入排序信息 查询排序
@ -565,11 +566,13 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
//下拉搜索组件 支持传入排序信息 查询排序
if(oConvertUtils.isNotEmpty(condition) && oConvertUtils.isNotEmpty(keywordSql)){
filterSql+= sqlWhere + condition + " and " + keywordSql;
filterSql += sqlWhere + sqlAnd + condition + sqlAnd + keywordSql;
}else if(oConvertUtils.isNotEmpty(condition)){
filterSql+= sqlWhere + condition;
filterSql += sqlWhere + sqlAnd + condition;
}else if(oConvertUtils.isNotEmpty(keywordSql)){
filterSql+= sqlWhere + keywordSql;
filterSql += sqlWhere + sqlAnd + keywordSql;
} else if (tableHasWhere){
filterSql += sqlWhere;
}
// 增加排序逻辑
@ -652,7 +655,15 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
}
@Override
public List<SysDict> queryDeleteList() {
public List<SysDict> queryDeleteList(String tenantId) {
//update-begin---author:wangshuai---date:2024-02-27---for:【QQYUN-8340】回收站查找软删除记录时没有判断是否启用多租户造成可以查找并回收其他租户的数据 #5907---
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
if(oConvertUtils.isEmpty(tenantId)){
return new ArrayList<>();
}
return baseMapper.queryDeleteListBtTenantId(oConvertUtils.getInt(tenantId));
}
//update-end---author:wangshuai---date:2024-02-27---for:【QQYUN-8340】回收站查找软删除记录时没有判断是否启用多租户造成可以查找并回收其他租户的数据 #5907---
return baseMapper.queryDeleteList();
}

@ -1,19 +0,0 @@
package org.jeecg.modules.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.system.entity.SysFiles;
import org.jeecg.modules.system.mapper.SysFilesMapper;
import org.jeecg.modules.system.service.ISysFilesService;
import org.springframework.stereotype.Service;
/**
* @Description: -
* @Author: jeecg-boot
* @Date: 2022-07-21
* @Version: V1.0
*/
@Service
public class SysFilesServiceImpl extends ServiceImpl<SysFilesMapper, SysFiles> implements ISysFilesService {
}

@ -1,9 +1,8 @@
package org.jeecg.modules.system.service.impl;
import java.util.*;
import javax.annotation.Resource;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.constant.CacheConstant;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.exception.JeecgBootException;
@ -11,6 +10,7 @@ import org.jeecg.common.util.oConvertUtils;
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
import org.jeecg.modules.system.entity.SysPermission;
import org.jeecg.modules.system.entity.SysPermissionDataRule;
import org.jeecg.modules.system.entity.SysRoleIndex;
import org.jeecg.modules.system.mapper.SysDepartPermissionMapper;
import org.jeecg.modules.system.mapper.SysDepartRolePermissionMapper;
import org.jeecg.modules.system.mapper.SysPermissionMapper;
@ -18,14 +18,15 @@ import org.jeecg.modules.system.mapper.SysRolePermissionMapper;
import org.jeecg.modules.system.model.TreeModel;
import org.jeecg.modules.system.service.ISysPermissionDataRuleService;
import org.jeecg.modules.system.service.ISysPermissionService;
import org.jeecg.modules.system.service.ISysRoleIndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import javax.annotation.Resource;
import java.util.*;
/**
* <p>
@ -53,6 +54,9 @@ public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, S
@Resource
private SysDepartRolePermissionMapper sysDepartRolePermissionMapper;
@Autowired
private ISysRoleIndexService roleIndexService;
@Override
public void switchVue3Menu() {
sysPermissionMapper.backupVue2Menu();
@ -217,13 +221,21 @@ public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, S
}
}
// 同步更改默认菜单
SysRoleIndex defIndexCfg = this.roleIndexService.queryDefaultIndex();
boolean isDefIndex = defIndexCfg.getUrl().equals(p.getUrl());
if (isDefIndex) {
this.roleIndexService.updateDefaultIndex(sysPermission.getUrl(), sysPermission.getComponent(), sysPermission.isRoute());
}
}
}
@Override
public List<SysPermission> queryByUser(String username) {
List<SysPermission> permissionList = this.sysPermissionMapper.queryByUser(username);
public List<SysPermission> queryByUser(String userId) {
List<SysPermission> permissionList = this.sysPermissionMapper.queryByUser(userId);
//================= begin 开启租户的时候 如果没有test角色默认加入test角色================
if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) {
if (permissionList == null) {

@ -1,19 +1,91 @@
package org.jeecg.modules.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.system.constant.DefIndexConst;
import org.jeecg.modules.system.entity.SysRoleIndex;
import org.jeecg.modules.system.mapper.SysRoleIndexMapper;
import org.jeecg.modules.system.service.ISysRoleIndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description:
* @Author: jeecg-boot
* @Date: 2022-03-25
* @Date: 2022-03-25
* @Version: V1.0
*/
@Service
@Service("sysRoleIndexServiceImpl")
public class SysRoleIndexServiceImpl extends ServiceImpl<SysRoleIndexMapper, SysRoleIndex> implements ISysRoleIndexService {
@Autowired
private RedisUtil redisUtil;
@Override
@Cacheable(cacheNames = DefIndexConst.CACHE_KEY, key = "'" + DefIndexConst.DEF_INDEX_ALL + "'")
public SysRoleIndex queryDefaultIndex() {
LambdaQueryWrapper<SysRoleIndex> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SysRoleIndex::getRoleCode, DefIndexConst.DEF_INDEX_ALL);
SysRoleIndex entity = super.getOne(queryWrapper);
// 保证不为空
if (entity == null) {
entity = this.initDefaultIndex();
}
return entity;
}
@Override
public boolean updateDefaultIndex(String url, String component, boolean isRoute) {
// 1. 先查询出配置信息
LambdaQueryWrapper<SysRoleIndex> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SysRoleIndex::getRoleCode, DefIndexConst.DEF_INDEX_ALL);
SysRoleIndex entity = super.getOne(queryWrapper);
boolean success = false;
// 2. 如果不存在则新增
if (entity == null) {
entity = this.newDefIndexConfig(url, component, isRoute);
success = super.save(entity);
} else {
// 3. 如果存在则更新
entity.setUrl(url);
entity.setComponent(component);
entity.setRoute(isRoute);
success = super.updateById(entity);
}
// 4. 清理缓存
if (success) {
this.cleanDefaultIndexCache();
}
return success;
}
@Override
public SysRoleIndex initDefaultIndex() {
return this.newDefIndexConfig(DefIndexConst.DEF_INDEX_URL, DefIndexConst.DEF_INDEX_COMPONENT, true);
}
/**
*
*
* @param indexComponent
* @return
*/
private SysRoleIndex newDefIndexConfig(String indexUrl, String indexComponent, boolean isRoute) {
SysRoleIndex entity = new SysRoleIndex();
entity.setRoleCode(DefIndexConst.DEF_INDEX_ALL);
entity.setUrl(indexUrl);
entity.setComponent(indexComponent);
entity.setRoute(isRoute);
entity.setStatus(CommonConstant.STATUS_1);
return entity;
}
@Override
public void cleanDefaultIndexCache() {
redisUtil.del(DefIndexConst.CACHE_KEY + "::" + DefIndexConst.DEF_INDEX_ALL);
}
}

@ -1,9 +1,12 @@
package org.jeecg.modules.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.ImportExcelUtil;
import org.jeecg.modules.system.entity.SysRole;
import org.jeecg.modules.system.mapper.SysRoleMapper;
@ -102,4 +105,15 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
public Long getRoleCountByTenantId(String id, Integer tenantId) {
return sysRoleMapper.getRoleCountByTenantId(id,tenantId);
}
@Override
public void checkAdminRoleRejectDel(String ids) {
LambdaQueryWrapper<SysRole> query = new LambdaQueryWrapper<>();
query.in(SysRole::getId,Arrays.asList(ids.split(SymbolConstant.COMMA)));
query.eq(SysRole::getRoleCode,"admin");
Long adminRoleCount = sysRoleMapper.selectCount(query);
if(adminRoleCount>0){
throw new JeecgBootException("admin角色不允许删除");
}
}
}

@ -128,11 +128,13 @@ public class SysTenantPackServiceImpl extends ServiceImpl<SysTenantPackMapper, S
@Override
public void addDefaultTenantPack(Integer tenantId) {
ISysTenantPackService currentService = SpringContextUtils.getApplicationContext().getBean(ISysTenantPackService.class);
// 创建租户超级管理员
SysTenantPack superAdminPack = new SysTenantPack(tenantId, "超级管理员", TenantConstant.SUPER_ADMIN);
//step.1 创建租户套餐包(超级管理员)
LambdaQueryWrapper<SysTenantPack> query = new LambdaQueryWrapper<>();
query.eq(SysTenantPack::getTenantId,tenantId);
// 创建超级管理员
SysTenantPack superAdminPack = new SysTenantPack(tenantId, "超级管理员", TenantConstant.SUPER_ADMIN);
ISysTenantPackService currentService = SpringContextUtils.getApplicationContext().getBean(ISysTenantPackService.class);
query.eq(SysTenantPack::getPackCode, TenantConstant.SUPER_ADMIN);
SysTenantPack sysTenantPackSuperAdmin = currentService.getOne(query);
String packId = "";
@ -141,13 +143,15 @@ public class SysTenantPackServiceImpl extends ServiceImpl<SysTenantPackMapper, S
}else{
packId = sysTenantPackSuperAdmin.getId();
}
//step.1.2 补充人员与套餐包的关系数据
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
SysTenantPackUser packUser = new SysTenantPackUser(tenantId, packId, sysUser.getId());
packUser.setRealname(sysUser.getRealname());
packUser.setPackName(superAdminPack.getPackName());
//添加人员和管理员的关系数据
currentService.savePackUser(packUser);
//step.2 创建租户套餐包(组织账户管理员)和 添加人员关系数据
query.eq(SysTenantPack::getTenantId,tenantId);
query.eq(SysTenantPack::getPackCode, TenantConstant.ACCOUNT_ADMIN);
SysTenantPack sysTenantPackAccountAdmin = currentService.getOne(query);
if(null == sysTenantPackAccountAdmin){
@ -155,10 +159,11 @@ public class SysTenantPackServiceImpl extends ServiceImpl<SysTenantPackMapper, S
SysTenantPack accountAdminPack = new SysTenantPack(tenantId, "组织账户管理员", TenantConstant.ACCOUNT_ADMIN);
currentService.saveOne(accountAdminPack);
}
//step.3 创建租户套餐包(组织应用管理员)
query.eq(SysTenantPack::getTenantId,tenantId);
query.eq(SysTenantPack::getPackCode, TenantConstant.APP_ADMIN);
SysTenantPack sysTenantPackAppAdmin = currentService.getOne(query);
if(null == sysTenantPackAppAdmin){
// 创建超级管理员
SysTenantPack appAdminPack = new SysTenantPack(tenantId, "组织应用管理员", TenantConstant.APP_ADMIN);

@ -27,10 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -262,24 +259,38 @@ public class SysUserDepartServiceImpl extends ServiceImpl<SysUserDepartMapper, S
}
@Override
public IPage<SysUser> getUserInformation(Integer tenantId, String departId,String roleId, String keyword, Integer pageSize, Integer pageNo) {
public IPage<SysUser> getUserInformation(Integer tenantId, String departId,String roleId, String keyword, Integer pageSize, Integer pageNo, String excludeUserIdList) {
IPage<SysUser> pageList = null;
// 部门ID不存在 直接查询用户表即可
Page<SysUser> page = new Page<>(pageNo, pageSize);
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> userIdList = new ArrayList<>();
if(oConvertUtils.isNotEmpty(excludeUserIdList)){
userIdList = Arrays.asList(excludeUserIdList.split(SymbolConstant.COMMA));
}
if(oConvertUtils.isNotEmpty(departId)){
// 有部门ID 需要走自定义sql
SysDepart sysDepart = sysDepartService.getById(departId);
//update-begin-author:taoyan date:2023-1-3 for: 用户选择组件 加载用户需要根据租户ID过滤
pageList = this.baseMapper.getProcessUserList(page, sysDepart.getOrgCode(), keyword, tenantId);
//update-begin---author:wangshuai---date:2024-02-02---for:【QQYUN-8239】用户角色添加用户 返回2页数据实际只显示一页---
//update-begin---author:wangshuai---date:2024-02-02---for:【QQYUN-8239】用户角色添加用户 返回2页数据实际只显示一页---
pageList = this.baseMapper.getProcessUserList(page, sysDepart.getOrgCode(), keyword, tenantId, userIdList);
//update-end---author:wangshuai---date:2024-02-02---for:【QQYUN-8239】用户角色添加用户 返回2页数据实际只显示一页---
} else if (oConvertUtils.isNotEmpty(roleId)) {
pageList = this.sysUserMapper.selectUserListByRoleId(page, roleId, keyword, tenantId);
//update-begin---author:wangshuai---date:2024-02-02---for:【QQYUN-8239】用户角色添加用户 返回2页数据实际只显示一页---
pageList = this.sysUserMapper.selectUserListByRoleId(page, roleId, keyword, tenantId,userIdList);
//update-end---author:wangshuai---date:2024-02-02---for:【QQYUN-8239】用户角色添加用户 返回2页数据实际只显示一页---
//update-end-author:taoyan date:2023-1-3 for: 用户选择组件 加载用户需要根据租户ID过滤
} else{
LambdaQueryWrapper<SysUser> query = new LambdaQueryWrapper<>();
query.eq(SysUser::getStatus,Integer.parseInt(CommonConstant.STATUS_1));
query.ne(SysUser::getUsername,"_reserve_user_external");
//update-begin---author:wangshuai---date:2024-02-02---for:【QQYUN-8239】用户角色添加用户 返回2页数据实际只显示一页---
if(oConvertUtils.isNotEmpty(excludeUserIdList)){
query.notIn(SysUser::getId,Arrays.asList(excludeUserIdList.split(SymbolConstant.COMMA)));
}
//update-end---author:wangshuai---date:2024-02-02---for:【QQYUN-8239】用户角色添加用户 返回2页数据实际只显示一页---
// 支持租户隔离
if (tenantId != null) {
List<String> userIds = userTenantMapper.getUserIdsByTenantId(tenantId);

@ -1,11 +1,13 @@
package org.jeecg.modules.system.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.RandomUtil;
import com.alibaba.fastjson.JSONArray;
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.core.toolkit.CollectionUtils;
@ -1384,7 +1386,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
*
*
* @param userId
* @param postIds
* @param positionIds
*/
private void saveUserPosition(String userId, String positionIds) {
if (oConvertUtils.isNotEmpty(positionIds)) {
@ -1802,5 +1804,15 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
//update-end---author:wangshuai ---date:20230710 for【QQYUN-5731】导入用户时没有提醒------------
}
//======================================= end 用户与部门 用户列表导入 =========================================
@Override
public void checkUserAdminRejectDel(String userIds) {
LambdaQueryWrapper<SysUser> query = new LambdaQueryWrapper<>();
query.in(SysUser::getId,Arrays.asList(userIds.split(SymbolConstant.COMMA)));
query.eq(SysUser::getUsername,"admin");
Long adminRoleCount = this.baseMapper.selectCount(query);
//大于0说明存在管理员用户不允许删除
if(adminRoleCount>0){
throw new JeecgBootException("admin用户不允许删除");
}
}
}

@ -1,11 +1,14 @@
package org.jeecg.modules.system.util;
import java.util.List;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.system.entity.SysPermission;
import org.jeecg.modules.system.entity.SysRoleIndex;
import org.jeecg.modules.system.service.ISysRoleIndexService;
import java.util.List;
/**
* @Author: scott
@ -82,8 +85,9 @@ public class PermissionDataUtil {
*/
public static void addIndexPage(List<SysPermission> metaList) {
boolean hasIndexMenu = false;
SysRoleIndex defIndexCfg = PermissionDataUtil.getDefIndexConfig();
for (SysPermission sysPermission : metaList) {
if("首页".equals(sysPermission.getName())) {
if(defIndexCfg.getUrl().equals(sysPermission.getUrl())) {
hasIndexMenu = true;
break;
}
@ -98,15 +102,38 @@ public class PermissionDataUtil {
* @param metaList
* @return
*/
public static boolean hasIndexPage(List<SysPermission> metaList){
public static boolean hasIndexPage(List<SysPermission> metaList, SysRoleIndex defIndexCfg){
boolean hasIndexMenu = false;
for (SysPermission sysPermission : metaList) {
if("首页".equals(sysPermission.getName())) {
if(defIndexCfg.getUrl().equals(sysPermission.getUrl())) {
hasIndexMenu = true;
break;
}
}
return hasIndexMenu;
}
/**
* id
*
* @param metaList
* @return
*/
public static boolean hasMenuById(List<SysPermission> metaList, String id) {
for (SysPermission sysPermission : metaList) {
if (id.equals(sysPermission.getId())) {
return true;
}
}
return false;
}
/**
*
*/
public static SysRoleIndex getDefIndexConfig() {
ISysRoleIndexService sysRoleIndexService = SpringContextUtils.getBean(ISysRoleIndexService.class);
return sysRoleIndexService.queryDefaultIndex();
}
}

@ -1,57 +0,0 @@
package org.jeecg.modules.system.vo;
import lombok.Data;
/**
* @Description:
* @author: wangshuai
* @date: 20220927 20:56
*/
@Data
public class SysFileLogVo {
/**
* id
*/
private String fileId;
/**
* id
*/
private String userId;
/**
*
*/
private String dataContent;
/**
*
*/
private String realname;
/**
*
*/
private String avatar;
/**
*
*/
private String createTime;
/**
*
*/
private String phone;
/**
*
*/
private String fileName;
/**
*
*/
private String url;
/**
*
*/
private String izFolder;
}

@ -1,142 +0,0 @@
package org.jeecg.modules.system.vo;
import lombok.Data;
/**
* @Description:
* @author: wangshuai
* @date: 20220921 17:27
*/
@Data
public class SysFilesVo {
/**
* id
*/
private String fileId;
/**
* id
*/
private String copyToFileId;
/**
* id
*/
private String userId;
/**
* id
*/
private String msgTo;
/**
*
*/
private String authority;
/**
*
*/
private String fileName;
/**
*
*/
private String delFlag;
/**
*
*/
private Double fileSize;
/**
*
*/
private String fileUrl;
/**
*
*/
private String description;
/**
*
*/
private String createBy;
/**
*
*/
private String createTime;
/**
*
*/
private String updateTime;
/**
*
*/
private String downCount;
/**
*
*/
private String readCount;
/**
* id
*/
private String parentId;
/**
*
*/
private String shareUrl;
/**
* (1 0)
*/
private String enableDown;
/**
* (1. 2. 3.)
*/
private String sharePerms;
/**
* (1 0)
*/
private String enableUpdat;
/**
*
*/
private String avatar;
/**
*
*/
private String realname;
/**
* (enableDown:,enableUpdat:,sharePerms:,reduction:,rename:,newFile:)
*/
private String type;
/**
* id
*/
private String rootId;
/**
* (0 1)
*/
private String izFolder;
/**
* (0 1)
*/
private String izRootFolder;
}

@ -1,4 +1,18 @@
# 命名规范
V[年月日]_[序号]__[模块名缩写]_[操作类型]_[业务描述].sql
# SQL文件命名规则
`V[年月日]_[序号]__[模块名缩写]_[操作类型]_[业务描述].sql`
例如:
```
V20240104_1__easyoa_add_field_attendance.sql
R__202402_drag_update_template.sql
```
### SQL命名规则说明
- 1.仅需要执行一次的以大写“V”开头
- 2.需要执行多次的以大写“R”开头命名如R__clean.sqlR的脚本只要改变了就会执行
- 3.V开头的比R开头的优先级要高。
### 命名规则示例
参考博客:
https://blog.csdn.net/Jiao1225/article/details/129590660

@ -18,6 +18,7 @@ database_name=jeecg-boot
#username=postgres
#password=postgres
#database_name=jeecg
#schemaName=public
#SQLServer2005\u4ee5\u4e0a
#diver_name=org.hibernate.dialect.SQLServerDialect

@ -10,7 +10,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.10</version>
<version>2.7.18</version>
<relativePath/>
</parent>

Loading…
Cancel
Save