小功能修改

dev
zhangdaiscott 2 years ago
parent cfeb81ee1e
commit 69287a772b

2
.gitignore vendored

@ -10,3 +10,5 @@ rebel.xml
## front ## front
**/*.lock **/*.lock
os_del.cmd os_del.cmd
os_del_doc.cmd
.svn

@ -117,14 +117,17 @@ public interface CommonAPI {
*/ */
Map<String, List<DictModel>> translateManyDict(String dictCodes, String keys); Map<String, List<DictModel>> translateManyDict(String dictCodes, String keys);
//update-begin---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
/** /**
* 15 * 15
* @param table * @param table
* @param text * @param text
* @param code * @param code
* @param keys * @param keys
* @param dataSource
* @return * @return
*/ */
List<DictModel> translateDictFromTableByKeys(String table, String text, String code, String keys); List<DictModel> translateDictFromTableByKeys(String table, String text, String code, String keys, String dataSource);
//update-end---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
} }

@ -140,11 +140,15 @@ public class DictAspect {
String code = field.getAnnotation(Dict.class).dicCode(); String code = field.getAnnotation(Dict.class).dicCode();
String text = field.getAnnotation(Dict.class).dicText(); String text = field.getAnnotation(Dict.class).dicText();
String table = field.getAnnotation(Dict.class).dictTable(); String table = field.getAnnotation(Dict.class).dictTable();
//update-begin---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
String dataSource = field.getAnnotation(Dict.class).ds();
//update-end---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
List<String> dataList; List<String> dataList;
String dictCode = code; String dictCode = code;
if (!StringUtils.isEmpty(table)) { if (!StringUtils.isEmpty(table)) {
dictCode = String.format("%s,%s,%s", table, text, code); //update-begin---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
dictCode = String.format("%s,%s,%s,%s", table, text, code, dataSource);
//update-end---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
} }
dataList = dataListMap.computeIfAbsent(dictCode, k -> new ArrayList<>()); dataList = dataListMap.computeIfAbsent(dictCode, k -> new ArrayList<>());
this.listAddAllDeduplicate(dataList, Arrays.asList(value.split(","))); this.listAddAllDeduplicate(dataList, Arrays.asList(value.split(",")));
@ -169,10 +173,15 @@ public class DictAspect {
String code = field.getAnnotation(Dict.class).dicCode(); String code = field.getAnnotation(Dict.class).dicCode();
String text = field.getAnnotation(Dict.class).dicText(); String text = field.getAnnotation(Dict.class).dicText();
String table = field.getAnnotation(Dict.class).dictTable(); String table = field.getAnnotation(Dict.class).dictTable();
//update-begin---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
// 自定义的字典表数据源
String dataSource = field.getAnnotation(Dict.class).ds();
//update-end---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
String fieldDictCode = code; String fieldDictCode = code;
if (!StringUtils.isEmpty(table)) { if (!StringUtils.isEmpty(table)) {
fieldDictCode = String.format("%s,%s,%s", table, text, code); //update-begin---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
fieldDictCode = String.format("%s,%s,%s,%s", table, text, code, dataSource);
//update-end---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
} }
String value = record.getString(field.getName()); String value = record.getString(field.getName());
@ -274,9 +283,18 @@ public class DictAspect {
String[] arr = dictCode.split(","); String[] arr = dictCode.split(",");
String table = arr[0], text = arr[1], code = arr[2]; String table = arr[0], text = arr[1], code = arr[2];
String values = String.join(",", needTranslDataTable); String values = String.join(",", needTranslDataTable);
//update-begin---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
// 自定义的数据源
String dataSource = null;
if (arr.length > 3) {
dataSource = arr[3];
}
//update-end---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
log.debug("translateDictFromTableByKeys.dictCode:" + dictCode); log.debug("translateDictFromTableByKeys.dictCode:" + dictCode);
log.debug("translateDictFromTableByKeys.values:" + values); log.debug("translateDictFromTableByKeys.values:" + values);
List<DictModel> texts = commonApi.translateDictFromTableByKeys(table, text, code, values); //update-begin---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
List<DictModel> texts = commonApi.translateDictFromTableByKeys(table, text, code, values, dataSource);
//update-end---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
log.debug("translateDictFromTableByKeys.result:" + texts); log.debug("translateDictFromTableByKeys.result:" + texts);
List<DictModel> list = translText.computeIfAbsent(dictCode, k -> new ArrayList<>()); List<DictModel> list = translText.computeIfAbsent(dictCode, k -> new ArrayList<>());
list.addAll(texts); list.addAll(texts);

@ -39,4 +39,16 @@ public @interface Dict {
* @return String * @return String
*/ */
String dictTable() default ""; String dictTable() default "";
//update-begin---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
/**
* :
* chenrui
* 20231220-4:58
*
* @return String
*/
String ds() default "";
//update-end---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
} }

@ -69,6 +69,8 @@ public interface CommonConstant {
/** {@code 500 Server Error} (HTTP/1.0 - RFC 1945) */ /** {@code 500 Server Error} (HTTP/1.0 - RFC 1945) */
Integer SC_INTERNAL_SERVER_ERROR_500 = 500; Integer SC_INTERNAL_SERVER_ERROR_500 = 500;
/** {@code 404 Not Found} (HTTP/1.0 - RFC 1945) */
Integer SC_INTERNAL_NOT_FOUND_404 = 404;
/** {@code 200 OK} (HTTP/1.0 - RFC 1945) */ /** {@code 200 OK} (HTTP/1.0 - RFC 1945) */
Integer SC_OK_200 = 200; Integer SC_OK_200 = 200;

@ -18,6 +18,9 @@ public interface DataBaseConstant {
/**postgreSQL达梦数据库*/ /**postgreSQL达梦数据库*/
public static final String DB_TYPE_POSTGRESQL = "POSTGRESQL"; public static final String DB_TYPE_POSTGRESQL = "POSTGRESQL";
/**人大金仓数据库*/
public static final String DB_TYPE_KINGBASEES = "KINGBASEES";
/**sqlserver数据库*/ /**sqlserver数据库*/
public static final String DB_TYPE_SQLSERVER = "SQLSERVER"; public static final String DB_TYPE_SQLSERVER = "SQLSERVER";

@ -1,5 +1,7 @@
package org.jeecg.common.exception; package org.jeecg.common.exception;
import org.jeecg.common.constant.CommonConstant;
/** /**
* @Description: jeecg-boot * @Description: jeecg-boot
* @author: jeecg-boot * @author: jeecg-boot
@ -7,10 +9,24 @@ package org.jeecg.common.exception;
public class JeecgBootException extends RuntimeException { public class JeecgBootException extends RuntimeException {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**
* code
*/
private int errCode = CommonConstant.SC_INTERNAL_SERVER_ERROR_500;
public JeecgBootException(String message){ public JeecgBootException(String message){
super(message); super(message);
} }
public JeecgBootException(String message, int errCode){
super(message);
this.errCode = errCode;
}
public int getErrCode() {
return errCode;
}
public JeecgBootException(Throwable cause) public JeecgBootException(Throwable cause)
{ {
super(cause); super(cause);

@ -33,7 +33,7 @@ public class JeecgBootExceptionHandler {
@ExceptionHandler(JeecgBootException.class) @ExceptionHandler(JeecgBootException.class)
public Result<?> handleJeecgBootException(JeecgBootException e){ public Result<?> handleJeecgBootException(JeecgBootException e){
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
return Result.error(e.getMessage()); return Result.error(e.getErrCode(), e.getMessage());
} }
/** /**

@ -302,7 +302,7 @@ public class CommonUtils {
DB_TYPE = DataBaseConstant.DB_TYPE_ORACLE; DB_TYPE = DataBaseConstant.DB_TYPE_ORACLE;
}else if(dbType.indexOf(DataBaseConstant.DB_TYPE_SQLSERVER)>=0||dbType.indexOf(sqlserver)>=0) { }else if(dbType.indexOf(DataBaseConstant.DB_TYPE_SQLSERVER)>=0||dbType.indexOf(sqlserver)>=0) {
DB_TYPE = DataBaseConstant.DB_TYPE_SQLSERVER; DB_TYPE = DataBaseConstant.DB_TYPE_SQLSERVER;
}else if(dbType.indexOf(DataBaseConstant.DB_TYPE_POSTGRESQL)>=0) { }else if(dbType.indexOf(DataBaseConstant.DB_TYPE_POSTGRESQL)>=0 || dbType.indexOf(DataBaseConstant.DB_TYPE_KINGBASEES)>=0) {
DB_TYPE = DataBaseConstant.DB_TYPE_POSTGRESQL; DB_TYPE = DataBaseConstant.DB_TYPE_POSTGRESQL;
}else if(dbType.indexOf(DataBaseConstant.DB_TYPE_MARIADB)>=0) { }else if(dbType.indexOf(DataBaseConstant.DB_TYPE_MARIADB)>=0) {
DB_TYPE = DataBaseConstant.DB_TYPE_MARIADB; DB_TYPE = DataBaseConstant.DB_TYPE_MARIADB;

@ -29,6 +29,17 @@ public class SqlInjectionUtil {
* sql * sql
*/ */
private static String specialDictSqlXssStr = "exec |peformance_schema|information_schema|extractvalue|updatexml|geohash|gtid_subset|gtid_subtract|insert |select |delete |update |drop |count |chr |mid |master |truncate |char |declare |;|+|--"; private static String specialDictSqlXssStr = "exec |peformance_schema|information_schema|extractvalue|updatexml|geohash|gtid_subset|gtid_subtract|insert |select |delete |update |drop |count |chr |mid |master |truncate |char |declare |;|+|--";
/**
* key
*/
private static List<String> FULL_MATCHING_KEYWRODS = new ArrayList<>();
static {
FULL_MATCHING_KEYWRODS.add(";");
FULL_MATCHING_KEYWRODS.add("+");
FULL_MATCHING_KEYWRODS.add("--");
}
/** /**
* sql * sql
* *
@ -50,6 +61,8 @@ public class SqlInjectionUtil {
* sql * sql
*/ */
private final static Pattern SQL_ANNOTATION = Pattern.compile("/\\*[\\s\\S]*\\*/"); private final static Pattern SQL_ANNOTATION = Pattern.compile("/\\*[\\s\\S]*\\*/");
private final static String SQL_ANNOTATION2 = "--";
/** /**
* sql * sql
*/ */
@ -128,7 +141,13 @@ public class SqlInjectionUtil {
if (sql.startsWith(keyword.trim())) { if (sql.startsWith(keyword.trim())) {
return true; return true;
} else if (sql.contains(keyword)) { } else if (sql.contains(keyword)) {
if (sql.contains(" " + keyword)) { // 需要匹配的sql注入关键词
String matchingText = " " + keyword;
if(FULL_MATCHING_KEYWRODS.contains(keyword)){
matchingText = keyword;
}
if (sql.contains(matchingText)) {
return true; return true;
} else { } else {
String regularStr = "\\s+\\S+" + keyword; String regularStr = "\\s+\\S+" + keyword;
@ -244,6 +263,13 @@ public class SqlInjectionUtil {
* @return * @return
*/ */
public static void checkSqlAnnotation(String str){ public static void checkSqlAnnotation(String str){
if(str.contains(SQL_ANNOTATION2)){
String error = "请注意SQL中不允许含注释有安全风险";
log.error(error);
throw new RuntimeException(error);
}
Matcher matcher = SQL_ANNOTATION.matcher(str); Matcher matcher = SQL_ANNOTATION.matcher(str);
if(matcher.find()){ if(matcher.find()){
String error = "请注意值可能存在SQL注入风险---> \\*.*\\"; String error = "请注意值可能存在SQL注入风险---> \\*.*\\";
@ -260,7 +286,7 @@ public class SqlInjectionUtil {
* *
* @param table * @param table
*/ */
private static Pattern tableNamePattern = Pattern.compile("^[a-zA-Z][a-zA-Z0-9_]{0,63}$"); private static Pattern tableNamePattern = Pattern.compile("^[a-zA-Z][a-zA-Z0-9_\\$]{0,63}$");
public static String getSqlInjectTableName(String table) { public static String getSqlInjectTableName(String table) {
if(oConvertUtils.isEmpty(table)){ if(oConvertUtils.isEmpty(table)){
return table; return table;

@ -61,6 +61,10 @@ public class SsrfFileTypeFilter {
FILE_TYPE_WHITE_LIST.add("7z"); FILE_TYPE_WHITE_LIST.add("7z");
FILE_TYPE_WHITE_LIST.add("tar"); FILE_TYPE_WHITE_LIST.add("tar");
//app文件后缀
FILE_TYPE_WHITE_LIST.add("apk");
FILE_TYPE_WHITE_LIST.add("wgt");
//设置禁止文件的头部标记 //设置禁止文件的头部标记
FILE_TYPE_MAP.put("3c25402070616765206c", "jsp"); FILE_TYPE_MAP.put("3c25402070616765206c", "jsp");
FILE_TYPE_MAP.put("3c3f7068700a0a2f2a2a0a202a205048", "php"); FILE_TYPE_MAP.put("3c3f7068700a0a2f2a2a0a202a205048", "php");

@ -31,7 +31,7 @@ public class WebSocketConfig {
FilterRegistrationBean bean = new FilterRegistrationBean(); FilterRegistrationBean bean = new FilterRegistrationBean();
bean.setFilter(websocketFilter()); bean.setFilter(websocketFilter());
//TODO 临时注释掉测试下线上socket总断的问题 //TODO 临时注释掉测试下线上socket总断的问题
bean.addUrlPatterns("/websocket/*","/eoaSocket/*","/eoaNewChatSocket/*", "/newsWebsocket/*", "/vxeSocket/*"); bean.addUrlPatterns("/taskCountSocket/*", "/websocket/*","/eoaSocket/*","/eoaNewChatSocket/*", "/newsWebsocket/*", "/vxeSocket/*");
return bean; return bean;
} }

@ -17,12 +17,12 @@ import org.jeecg.config.shiro.filters.CustomShiroFilterFactoryBean;
import org.jeecg.config.shiro.filters.JwtFilter; import org.jeecg.config.shiro.filters.JwtFilter;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator; import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn; import org.springframework.context.annotation.DependsOn;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import redis.clients.jedis.HostAndPort; import redis.clients.jedis.HostAndPort;
@ -31,7 +31,6 @@ import redis.clients.jedis.JedisCluster;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.Filter; import javax.servlet.Filter;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* @author: Scott * @author: Scott
@ -76,6 +75,7 @@ public class ShiroConfig {
} }
} }
} }
// 配置不会被拦截的链接 顺序判断 // 配置不会被拦截的链接 顺序判断
filterChainDefinitionMap.put("/sys/cas/client/validateLogin", "anon"); //cas验证登录 filterChainDefinitionMap.put("/sys/cas/client/validateLogin", "anon"); //cas验证登录
filterChainDefinitionMap.put("/sys/randomImage/**", "anon"); //登录验证码接口排除 filterChainDefinitionMap.put("/sys/randomImage/**", "anon"); //登录验证码接口排除
@ -94,6 +94,9 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/auth/2step-code", "anon");//登录验证码 filterChainDefinitionMap.put("/auth/2step-code", "anon");//登录验证码
filterChainDefinitionMap.put("/sys/common/static/**", "anon");//图片预览 &下载文件不限制token filterChainDefinitionMap.put("/sys/common/static/**", "anon");//图片预览 &下载文件不限制token
filterChainDefinitionMap.put("/sys/common/pdf/**", "anon");//pdf预览 filterChainDefinitionMap.put("/sys/common/pdf/**", "anon");//pdf预览
//filterChainDefinitionMap.put("/sys/common/view/**", "anon");//图片预览不限制token
//filterChainDefinitionMap.put("/sys/common/download/**", "anon");//文件下载不限制token
filterChainDefinitionMap.put("/generic/**", "anon");//pdf预览需要文件 filterChainDefinitionMap.put("/generic/**", "anon");//pdf预览需要文件
filterChainDefinitionMap.put("/sys/getLoginQrcode/**", "anon"); //登录二维码 filterChainDefinitionMap.put("/sys/getLoginQrcode/**", "anon"); //登录二维码
@ -101,6 +104,7 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/sys/checkAuth", "anon"); //授权接口排除 filterChainDefinitionMap.put("/sys/checkAuth", "anon"); //授权接口排除
//update-begin--Author:scott Date:20221116 for排除静态资源后缀
filterChainDefinitionMap.put("/", "anon"); filterChainDefinitionMap.put("/", "anon");
filterChainDefinitionMap.put("/doc.html", "anon"); filterChainDefinitionMap.put("/doc.html", "anon");
filterChainDefinitionMap.put("/**/*.js", "anon"); filterChainDefinitionMap.put("/**/*.js", "anon");
@ -115,16 +119,17 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/**/*.ttf", "anon"); filterChainDefinitionMap.put("/**/*.ttf", "anon");
filterChainDefinitionMap.put("/**/*.woff", "anon"); filterChainDefinitionMap.put("/**/*.woff", "anon");
filterChainDefinitionMap.put("/**/*.woff2", "anon"); filterChainDefinitionMap.put("/**/*.woff2", "anon");
//update-end--Author:scott Date:20221116 for排除静态资源后缀
filterChainDefinitionMap.put("/druid/**", "anon"); filterChainDefinitionMap.put("/druid/**", "anon");
filterChainDefinitionMap.put("/swagger-ui.html", "anon"); filterChainDefinitionMap.put("/swagger-ui.html", "anon");
filterChainDefinitionMap.put("/swagger**/**", "anon"); filterChainDefinitionMap.put("/swagger**/**", "anon");
filterChainDefinitionMap.put("/webjars/**", "anon"); filterChainDefinitionMap.put("/webjars/**", "anon");
filterChainDefinitionMap.put("/v2/**", "anon"); filterChainDefinitionMap.put("/v2/**", "anon");
// 企业微信证书排除
filterChainDefinitionMap.put("/WW_verify*", "anon");
// update-begin--Author:sunjianlei Date:20210510 for排除消息通告查看详情页面用于第三方APP
filterChainDefinitionMap.put("/sys/annountCement/show/**", "anon"); filterChainDefinitionMap.put("/sys/annountCement/show/**", "anon");
// update-end--Author:sunjianlei Date:20210510 for排除消息通告查看详情页面用于第三方APP
//积木报表排除 //积木报表排除
filterChainDefinitionMap.put("/jmreport/**", "anon"); filterChainDefinitionMap.put("/jmreport/**", "anon");
@ -155,10 +160,10 @@ public class ShiroConfig {
//测试模块排除 //测试模块排除
filterChainDefinitionMap.put("/test/seata/**", "anon"); filterChainDefinitionMap.put("/test/seata/**", "anon");
// update-begin--author:liusq Date:20230522 for[issues/4829]访问不存在的url时会提示Token失效请重新登录呢
//错误路径排除 //错误路径排除
filterChainDefinitionMap.put("/error", "anon"); filterChainDefinitionMap.put("/error", "anon");
// update-end--author:liusq Date:20230522 for[issues/4829]访问不存在的url时会提示Token失效请重新登录呢 // 企业微信证书排除
filterChainDefinitionMap.put("/WW_verify*", "anon");
// 添加自己的过滤器并且取名为jwt // 添加自己的过滤器并且取名为jwt
Map<String, Filter> filterMap = new HashMap<String, Filter>(1); Map<String, Filter> filterMap = new HashMap<String, Filter>(1);
@ -253,8 +258,7 @@ public class ShiroConfig {
public IRedisManager redisManager() { public IRedisManager redisManager() {
log.info("===============(2)创建RedisManager,连接Redis.."); log.info("===============(2)创建RedisManager,连接Redis..");
IRedisManager manager; IRedisManager manager;
// sentinel cluster redis【issues/5569】shiro集成 redis 不支持 sentinel 方式部署的redis集群 #5569
// sentinel cluster redis
if (Objects.nonNull(redisProperties) if (Objects.nonNull(redisProperties)
&& Objects.nonNull(redisProperties.getSentinel()) && Objects.nonNull(redisProperties.getSentinel())
&& !CollectionUtils.isEmpty(redisProperties.getSentinel().getNodes())) { && !CollectionUtils.isEmpty(redisProperties.getSentinel().getNodes())) {
@ -266,6 +270,7 @@ public class ShiroConfig {
return sentinelManager; return sentinelManager;
} }
// redis 单机支持,在集群为空,或者集群无机器时候使用 add by jzyadmin@163.com // redis 单机支持,在集群为空,或者集群无机器时候使用 add by jzyadmin@163.com
if (lettuceConnectionFactory.getClusterConfiguration() == null || lettuceConnectionFactory.getClusterConfiguration().getClusterNodes().isEmpty()) { if (lettuceConnectionFactory.getClusterConfiguration() == null || lettuceConnectionFactory.getClusterConfiguration().getClusterNodes().isEmpty()) {
RedisManager redisManager = new RedisManager(); RedisManager redisManager = new RedisManager();

@ -35,4 +35,5 @@ public class Firewall {
public void setLowCodeMode(String lowCodeMode) { public void setLowCodeMode(String lowCodeMode) {
this.lowCodeMode = lowCodeMode; this.lowCodeMode = lowCodeMode;
} }
} }

@ -56,7 +56,7 @@
</div> </div>
<div style="width: 600px; margin: 0 auto; margin-top: 50px; font-size: 12px; -webkit-font-smoothing: subpixel-antialiased; text-size-adjust: 100%;"> <div style="width: 600px; margin: 0 auto; margin-top: 50px; font-size: 12px; -webkit-font-smoothing: subpixel-antialiased; text-size-adjust: 100%;">
<p style="text-align: center; line-height: 20.4px; text-size-adjust: 100%; font-family: 'Microsoft YaHei'!important; padding: 0px !important; margin: 0px !important; color: #7e8890 !important;"> <p style="text-align: center; line-height: 20.4px; text-size-adjust: 100%; font-family: 'Microsoft YaHei'!important; padding: 0px !important; margin: 0px !important; color: #7e8890 !important;">
<span class="appleLinks">Copyright © 2023-2024 北京国炬科技股份有限公司. 保留所有权利。</span> <span class="appleLinks">Copyright © 2023-2024 北京国炬信息技术有限公司. 保留所有权利。</span>
</p> </p>
<p style="text-align: center;line-height: 20.4px; text-size-adjust: 100%; font-family: 'Microsoft YaHei'!important; padding: 0px !important; margin: 0px; color: #7e8890 !important; margin-top: 10px;"> <p style="text-align: center;line-height: 20.4px; text-size-adjust: 100%; font-family: 'Microsoft YaHei'!important; padding: 0px !important; margin: 0px; color: #7e8890 !important; margin-top: 10px;">
<span class="appleLinks">邮件由系统自动发送,请勿直接回复本邮件!</span> <span class="appleLinks">邮件由系统自动发送,请勿直接回复本邮件!</span>

@ -6,7 +6,10 @@
<body> <body>
<div class="box-content"> <div class="box-content">
<div class="info-top"> <div class="info-top">
<img src="https://jeecgdev.oss-cn-beijing.aliyuncs.com/temp/logo(1)_1697180761742.png" style="float: left; margin: 0 10px 0 0; width: 32px;height:32px" /><div style="color:#fff"><strong>【重要】新数据提醒</strong></div> <img src="https://qiaoqiaoyun.oss-cn-beijing.aliyuncs.com/site/qqyunemaillogo.png" style="width: 35px;height:35px; background: #5e8ee5; border-radius: 5px;" />
<div style="color:#fff;">
<strong>【重要】新数据提醒</strong>
</div>
</div> </div>
<div class="info-wrap"> <div class="info-wrap">
<div class="tips" style="padding:15px;"> <div class="tips" style="padding:15px;">
@ -23,12 +26,12 @@
<a style="color: #006eff;" href="${moreLink}" target="_blank" rel="noopener">[查看所有数据]</a> <a style="color: #006eff;" href="${moreLink}" target="_blank" rel="noopener">[查看所有数据]</a>
</p> </p>
</div> </div>
<div class="footer">北京国炬平台</div> <div class="footer">敲敲云平台</div>
<div class="footer" id="currentTime"></div> <div class="footer" id="currentTime"></div>
</div> </div>
<div style="width: 600px; margin: 0 auto; margin-top: 50px; font-size: 12px; -webkit-font-smoothing: subpixel-antialiased; text-size-adjust: 100%;"> <div style="width: 600px; margin: 0 auto; margin-top: 50px; font-size: 12px; -webkit-font-smoothing: subpixel-antialiased; text-size-adjust: 100%;">
<p style="text-align: center; line-height: 20.4px; text-size-adjust: 100%; font-family: 'Microsoft YaHei'!important; padding: 0px !important; margin: 0px !important; color: #7e8890 !important;"> <p style="text-align: center; line-height: 20.4px; text-size-adjust: 100%; font-family: 'Microsoft YaHei'!important; padding: 0px !important; margin: 0px !important; color: #7e8890 !important;">
<span class="appleLinks">Copyright © 2023-2024 北京国炬科技股份有限公司. 保留所有权利。</span> <span class="appleLinks">Copyright © 2023-2024 北京敲敲云科技有限公司. 保留所有权利。</span>
</p> </p>
<p style="text-align: center;line-height: 20.4px; text-size-adjust: 100%; font-family: 'Microsoft YaHei'!important; padding: 0px !important; margin: 0px; color: #7e8890 !important; margin-top: 10px;"> <p style="text-align: center;line-height: 20.4px; text-size-adjust: 100%; font-family: 'Microsoft YaHei'!important; padding: 0px !important; margin: 0px; color: #7e8890 !important; margin-top: 10px;">
<span class="appleLinks">邮件由系统自动发送,请勿直接回复本邮件!</span> <span class="appleLinks">邮件由系统自动发送,请勿直接回复本邮件!</span>
@ -46,6 +49,8 @@
} }
.info-top{ .info-top{
display: flex;
align-items: center;
padding: 15px 25px; padding: 15px 25px;
border-top-left-radius: 10px; border-top-left-radius: 10px;
border-top-right-radius: 10px; border-top-right-radius: 10px;

@ -24,7 +24,7 @@ public class JcloudDemoProviderController {
private JcloudDemoService jcloudDemoService; private JcloudDemoService jcloudDemoService;
@GetMapping("/getMessage") @GetMapping("/getMessage")
public String getMessage(@RequestParam String name) { public String getMessage(@RequestParam(name = "name") String name) {
String msg = jcloudDemoService.getMessage(name); String msg = jcloudDemoService.getMessage(name);
log.info(" 微服务被调用:{} ",msg); log.info(" 微服务被调用:{} ",msg);
return msg; return msg;

@ -45,11 +45,11 @@ public class JeecgDemo extends JeecgEntity implements Serializable {
private java.util.Date punchTime; private java.util.Date punchTime;
/** 工资 */ /** 工资 */
@ApiModelProperty(value = "工资",example = "0") @ApiModelProperty(value = "工资",example = "0")
@Excel(name="工资",width=15) @Excel(name="工资",type = 4,width=15)
private java.math.BigDecimal salaryMoney; private java.math.BigDecimal salaryMoney;
/** 奖金 */ /** 奖金 */
@ApiModelProperty(value = "奖金",example = "0") @ApiModelProperty(value = "奖金",example = "0")
@Excel(name="奖金",width=15) @Excel(name="奖金",type = 4,width=15)
private java.lang.Double bonusMoney; private java.lang.Double bonusMoney;
/** 性别 {男:1,女:2} */ /** 性别 {男:1,女:2} */
@ApiModelProperty(value = "性别") @ApiModelProperty(value = "性别")
@ -57,7 +57,7 @@ public class JeecgDemo extends JeecgEntity implements Serializable {
private java.lang.String sex; private java.lang.String sex;
/** 年龄 */ /** 年龄 */
@ApiModelProperty(value = "年龄",example = "0") @ApiModelProperty(value = "年龄",example = "0")
@Excel(name="年龄",width=15) @Excel(name="年龄",type = 4,width=15)
private java.lang.Integer age; private java.lang.Integer age;
/** 生日 */ /** 生日 */
@ApiModelProperty(value = "生日") @ApiModelProperty(value = "生日")

@ -94,6 +94,22 @@ public interface ISysBaseAPI extends CommonAPI {
@GetMapping("/sys/api/getDepartIdsByUsername") @GetMapping("/sys/api/getDepartIdsByUsername")
List<String> getDepartIdsByUsername(@RequestParam("username") String username); List<String> getDepartIdsByUsername(@RequestParam("username") String username);
/**
* 8.2 ID
* @param username
* @return parentIds
*/
@GetMapping("/sys/api/getDepartParentIdsByUsername")
Set<String> getDepartParentIdsByUsername(@RequestParam("username")String username);
/**
* 8.3 ID
* @param depIds
* @return parentIds
*/
@GetMapping("/sys/api/getDepartParentIdsByDepIds")
Set<String> getDepartParentIdsByDepIds(@RequestParam("depIds") Set depIds);
/** /**
* 9 name * 9 name
* @param username * @param username
@ -481,6 +497,14 @@ public interface ISysBaseAPI extends CommonAPI {
@GetMapping("/sys/api/loadCategoryDictItem") @GetMapping("/sys/api/loadCategoryDictItem")
List<String> loadCategoryDictItem(@RequestParam("ids") String ids); List<String> loadCategoryDictItem(@RequestParam("ids") String ids);
/**
* 44
*
* @param names
*/
@GetMapping("/sys/api/loadCategoryDictItemByNames")
List<String> loadCategoryDictItemByNames(@RequestParam("names") String names, @RequestParam("delNotExist") boolean delNotExist);
/** /**
* 43 codetext * 43 codetext
* *
@ -551,17 +575,20 @@ public interface ISysBaseAPI extends CommonAPI {
@GetMapping("/sys/api/translateManyDict") @GetMapping("/sys/api/translateManyDict")
Map<String, List<DictModel>> translateManyDict(@RequestParam("dictCodes") String dictCodes, @RequestParam("keys") String keys); Map<String, List<DictModel>> translateManyDict(@RequestParam("dictCodes") String dictCodes, @RequestParam("keys") String keys);
//update-begin---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
/** /**
* 49 * 49
* @param table * @param table
* @param text * @param text
* @param code * @param code
* @param keys * @param keys
* @param ds
* @return * @return
*/ */
@Override @Override
@GetMapping("/sys/api/translateDictFromTableByKeys") @GetMapping("/sys/api/translateDictFromTableByKeys")
List<DictModel> translateDictFromTableByKeys(@RequestParam("table") String table, @RequestParam("text") String text, @RequestParam("code") String code, @RequestParam("keys") String keys); List<DictModel> translateDictFromTableByKeys(@RequestParam("table") String table, @RequestParam("text") String text, @RequestParam("code") String code, @RequestParam("keys") String keys, @RequestParam("ds") String ds);
//update-end---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
/** /**
* *

@ -65,6 +65,16 @@ public class SysBaseAPIFallback implements ISysBaseAPI {
return null; return null;
} }
@Override
public Set<String> getDepartParentIdsByUsername(String username) {
return null;
}
@Override
public Set<String> getDepartParentIdsByDepIds(Set depIds) {
return null;
}
@Override @Override
public List<String> getDepartNamesByUsername(String username) { public List<String> getDepartNamesByUsername(String username) {
return null; return null;
@ -275,10 +285,12 @@ public class SysBaseAPIFallback implements ISysBaseAPI {
return null; return null;
} }
//update-begin---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
@Override @Override
public List<DictModel> translateDictFromTableByKeys(String table, String text, String code, String keys) { public List<DictModel> translateDictFromTableByKeys(String table, String text, String code, String keys, String dataSource) {
return null; return null;
} }
//update-end---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
@Override @Override
public void sendTemplateMessage(MessageDTO message) { public void sendTemplateMessage(MessageDTO message) {
@ -319,6 +331,11 @@ public class SysBaseAPIFallback implements ISysBaseAPI {
return null; return null;
} }
@Override
public List<String> loadCategoryDictItemByNames(String names, boolean delNotExist) {
return null;
}
@Override @Override
public List<String> loadDictItem(String dictCode, String keys) { public List<String> loadDictItem(String dictCode, String keys) {
return null; return null;

@ -89,6 +89,20 @@ public interface ISysBaseAPI extends CommonAPI {
*/ */
List<String> getDepartIdsByUsername(String username); List<String> getDepartIdsByUsername(String username);
/**
* 8.2 ID
* @param username
* @return parentIds
*/
Set<String> getDepartParentIdsByUsername(String username);
/**
* 8.2 ID
* @param depIds
* @return parentIds
*/
Set<String> getDepartParentIdsByDepIds(Set depIds);
/** /**
* 9 name * 9 name
* @param username * @param username
@ -373,6 +387,13 @@ public interface ISysBaseAPI extends CommonAPI {
*/ */
List<String> loadCategoryDictItem(String ids); List<String> loadCategoryDictItem(String ids);
/**
*
*
* @param names
*/
List<String> loadCategoryDictItemByNames(String names, boolean delNotExist);
/** /**
* codetext * codetext
* *

@ -140,6 +140,26 @@ public class SystemApiController {
return sysBaseApi.getDepartIdsByUsername(username); return sysBaseApi.getDepartIdsByUsername(username);
} }
/**
* ID
* @param username
* @return id
*/
@GetMapping("/getDepartParentIdsByUsername")
Set<String> getDepartParentIdsByUsername(@RequestParam("username") String username){
return sysBaseApi.getDepartParentIdsByUsername(username);
}
/**
* ID
* @param depIds
* @return id
*/
@GetMapping("/getDepartParentIdsByDepIds")
Set<String> getDepartParentIdsByDepIds(@RequestParam("depIds") Set depIds){
return sysBaseApi.getDepartParentIdsByDepIds(depIds);
}
/** /**
* name * name
* @param username * @param username
@ -527,6 +547,17 @@ public class SystemApiController {
return sysBaseApi.loadCategoryDictItem(ids); return sysBaseApi.loadCategoryDictItem(ids);
} }
/**
*
*
* @param names
* @return
*/
@GetMapping("/loadCategoryDictItemByNames")
List<String> loadCategoryDictItemByNames(@RequestParam("names") String names, @RequestParam("delNotExist") boolean delNotExist) {
return sysBaseApi.loadCategoryDictItemByNames(names, delNotExist);
}
/** /**
* codetext * codetext
* *
@ -655,6 +686,7 @@ public class SystemApiController {
} }
//update-begin---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
/** /**
* *
* 49 * 49
@ -663,12 +695,14 @@ public class SystemApiController {
* @param text * @param text
* @param code * @param code
* @param keys * @param keys
* @param ds
* @return * @return
*/ */
@GetMapping("/translateDictFromTableByKeys") @GetMapping("/translateDictFromTableByKeys")
public List<DictModel> translateDictFromTableByKeys(@RequestParam("table") String table, @RequestParam("text") String text, @RequestParam("code") String code, @RequestParam("keys") String keys) { public List<DictModel> translateDictFromTableByKeys(@RequestParam("table") String table, @RequestParam("text") String text, @RequestParam("code") String code, @RequestParam("keys") String keys, @RequestParam("ds") String ds) {
return this.sysBaseApi.translateDictFromTableByKeys(table, text, code, keys); return this.sysBaseApi.translateDictFromTableByKeys(table, text, code, keys, ds);
} }
//update-end---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
/** /**
* *

@ -25,6 +25,7 @@ import org.jeecg.modules.system.model.SysDepartTreeModel;
import org.jeecg.modules.system.service.ISysDepartService; import org.jeecg.modules.system.service.ISysDepartService;
import org.jeecg.modules.system.service.ISysUserDepartService; import org.jeecg.modules.system.service.ISysUserDepartService;
import org.jeecg.modules.system.service.ISysUserService; import org.jeecg.modules.system.service.ISysUserService;
import org.jeecg.modules.system.vo.SysDepartExportVo;
import org.jeecg.modules.system.vo.lowapp.ExportDepartVo; import org.jeecg.modules.system.vo.lowapp.ExportDepartVo;
import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.def.NormalExcelConstants;
@ -350,25 +351,34 @@ public class SysDepartController {
} }
//------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------
// Step.1 组装查询条件 //update-begin---author:wangshuai---date:2023-10-19---for:【QQYUN-5482】系统的部门导入导出也可以改成敲敲云模式的部门路径---
QueryWrapper<SysDepart> queryWrapper = QueryGenerator.initQueryWrapper(sysDepart, request.getParameterMap()); //// Step.1 组装查询条件
//Step.2 AutoPoi 导出Excel //QueryWrapper<SysDepart> queryWrapper = QueryGenerator.initQueryWrapper(sysDepart, request.getParameterMap());
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); //Step.1 AutoPoi 导出Excel
List<SysDepart> pageList = sysDepartService.list(queryWrapper); ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
//List<SysDepart> pageList = sysDepartService.list(queryWrapper);
//按字典排序 //按字典排序
Collections.sort(pageList, new Comparator<SysDepart>() { //Collections.sort(pageList, new Comparator<SysDepart>() {
@Override //@Override
public int compare(SysDepart arg0, SysDepart arg1) { //public int compare(SysDepart arg0, SysDepart arg1) {
return arg0.getOrgCode().compareTo(arg1.getOrgCode()); //return arg0.getOrgCode().compareTo(arg1.getOrgCode());
} //}
}); //});
//step.2 组装导出数据
List<SysDepartExportVo> sysDepartExportVos = sysDepartService.getExportDepart(sysDepart.getTenantId());
//导出文件名称 //导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "部门列表"); mv.addObject(NormalExcelConstants.FILE_NAME, "部门列表");
mv.addObject(NormalExcelConstants.CLASS, SysDepart.class); mv.addObject(NormalExcelConstants.CLASS, SysDepartExportVo.class);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("部门列表数据", "导出人:"+user.getRealname(), "导出信息")); mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("导入规则:\n" +
mv.addObject(NormalExcelConstants.DATA_LIST, pageList); "1、标题为第三行部门路径和部门名称的标题不允许修改否则会匹配失败第四行为数据填写范围;\n" +
return mv; "2、部门路径用英文字符/分割,部门名称为部门路径的最后一位;\n" +
"3、部门从一级名称开始创建如果有同级就需要多添加一行如研发部/研发一部;研发部/研发二部;\n" +
"4、自定义的部门编码需要满足规则才能导入。如一级部门编码为A01,那么子部门为A01A01,同级子部门为A01A02,编码固定为三位首字母为A-Z,后两位为数字0-99依次递增;", "导出人:"+user.getRealname(), "导出信息"));
mv.addObject(NormalExcelConstants.DATA_LIST, sysDepartExportVos);
//update-end---author:wangshuai---date:2023-10-19---for:【QQYUN-5482】系统的部门导入导出也可以改成敲敲云模式的部门路径---
return mv;
} }
/** /**
@ -386,7 +396,8 @@ public class SysDepartController {
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
List<String> errorMessageList = new ArrayList<>(); List<String> errorMessageList = new ArrayList<>();
List<SysDepart> listSysDeparts = null; //List<SysDepart> listSysDeparts = null;
List<SysDepartExportVo> listSysDeparts = null;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
// 获取上传文件对象 // 获取上传文件对象
@ -396,51 +407,59 @@ public class SysDepartController {
params.setHeadRows(1); params.setHeadRows(1);
params.setNeedSave(true); params.setNeedSave(true);
try { try {
// orgCode编码长度 //update-begin---author:wangshuai---date:2023-10-20---for: 注释掉原来的导入部门的逻辑---
int codeLength = YouBianCodeUtil.ZHANWEI_LENGTH; // // orgCode编码长度
listSysDeparts = ExcelImportUtil.importExcel(file.getInputStream(), SysDepart.class, params); // int codeLength = YouBianCodeUtil.ZHANWEI_LENGTH;
//按长度排序 // listSysDeparts = ExcelImportUtil.importExcel(file.getInputStream(), SysDepart.class, params);
Collections.sort(listSysDeparts, new Comparator<SysDepart>() { // //按长度排序
@Override // Collections.sort(listSysDeparts, new Comparator<SysDepart>() {
public int compare(SysDepart arg0, SysDepart arg1) { // @Override
return arg0.getOrgCode().length() - arg1.getOrgCode().length(); // public int compare(SysDepart arg0, SysDepart arg1) {
} // return arg0.getOrgCode().length() - arg1.getOrgCode().length();
}); // }
// });
int num = 0; //
for (SysDepart sysDepart : listSysDeparts) { // int num = 0;
String orgCode = sysDepart.getOrgCode(); // for (SysDepart sysDepart : listSysDeparts) {
if(orgCode.length() > codeLength) { // String orgCode = sysDepart.getOrgCode();
String parentCode = orgCode.substring(0, orgCode.length()-codeLength); // if(orgCode.length() > codeLength) {
QueryWrapper<SysDepart> queryWrapper = new QueryWrapper<SysDepart>(); // String parentCode = orgCode.substring(0, orgCode.length()-codeLength);
queryWrapper.eq("org_code", parentCode); // QueryWrapper<SysDepart> queryWrapper = new QueryWrapper<SysDepart>();
try { // queryWrapper.eq("org_code", parentCode);
SysDepart parentDept = sysDepartService.getOne(queryWrapper); // try {
if(!parentDept.equals(null)) { // SysDepart parentDept = sysDepartService.getOne(queryWrapper);
sysDepart.setParentId(parentDept.getId()); // if(!parentDept.equals(null)) {
//更新父级部门不是叶子结点 // sysDepart.setParentId(parentDept.getId());
sysDepartService.updateIzLeaf(parentDept.getId(),CommonConstant.NOT_LEAF); // //更新父级部门不是叶子结点
} else { // sysDepartService.updateIzLeaf(parentDept.getId(),CommonConstant.NOT_LEAF);
sysDepart.setParentId(""); // } else {
} // sysDepart.setParentId("");
}catch (Exception e) { // }
//没有查找到parentDept // }catch (Exception e) {
} // //没有查找到parentDept
}else{ // }
sysDepart.setParentId(""); // }else{
} // sysDepart.setParentId("");
//update-begin---author:liusq Date:20210223 for批量导入部门以后不能追加下一级部门 #2245------------ // }
sysDepart.setOrgType(sysDepart.getOrgCode().length()/codeLength+""); // //update-begin---author:liusq Date:20210223 for批量导入部门以后不能追加下一级部门 #2245------------
//update-end---author:liusq Date:20210223 for批量导入部门以后不能追加下一级部门 #2245------------ // sysDepart.setOrgType(sysDepart.getOrgCode().length()/codeLength+"");
sysDepart.setDelFlag(CommonConstant.DEL_FLAG_0.toString()); // //update-end---author:liusq Date:20210223 for批量导入部门以后不能追加下一级部门 #2245------------
//update-begin---author:wangshuai ---date:20220105 for[JTC-363]部门导入 机构类别没有时导入失败,赋默认值------------ // sysDepart.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
if(oConvertUtils.isEmpty(sysDepart.getOrgCategory())){ // //update-begin---author:wangshuai ---date:20220105 for[JTC-363]部门导入 机构类别没有时导入失败,赋默认值------------
sysDepart.setOrgCategory("1"); // if(oConvertUtils.isEmpty(sysDepart.getOrgCategory())){
} // sysDepart.setOrgCategory("1");
//update-end---author:wangshuai ---date:20220105 for[JTC-363]部门导入 机构类别没有时导入失败,赋默认值------------ // }
ImportExcelUtil.importDateSaveOne(sysDepart, ISysDepartService.class, errorMessageList, num, CommonConstant.SQL_INDEX_UNIQ_DEPART_ORG_CODE); // //update-end---author:wangshuai ---date:20220105 for[JTC-363]部门导入 机构类别没有时导入失败,赋默认值------------
num++; // ImportExcelUtil.importDateSaveOne(sysDepart, ISysDepartService.class, errorMessageList, num, CommonConstant.SQL_INDEX_UNIQ_DEPART_ORG_CODE);
} // num++;
// }
//update-end---author:wangshuai---date:2023-10-20---for: 注释掉原来的导入部门的逻辑---
//update-begin---author:wangshuai---date:2023-10-19---for:【QQYUN-5482】系统的部门导入导出也可以改成敲敲云模式的部门路径---
listSysDeparts = ExcelImportUtil.importExcel(file.getInputStream(), SysDepartExportVo.class, params);
sysDepartService.importSysDepart(listSysDeparts,errorMessageList);
//update-end---author:wangshuai---date:2023-10-19---for:【QQYUN-5482】系统的部门导入导出也可以改成敲敲云模式的部门路径---
//清空部门缓存 //清空部门缓存
Set keys3 = redisTemplate.keys(CacheConstant.SYS_DEPARTS_CACHE + "*"); Set keys3 = redisTemplate.keys(CacheConstant.SYS_DEPARTS_CACHE + "*");
Set keys4 = redisTemplate.keys(CacheConstant.SYS_DEPART_IDS_CACHE + "*"); Set keys4 = redisTemplate.keys(CacheConstant.SYS_DEPART_IDS_CACHE + "*");
@ -544,7 +563,7 @@ public class SysDepartController {
* @return * @return
*/ */
@RequestMapping(value = "/queryByIds", method = RequestMethod.GET) @RequestMapping(value = "/queryByIds", method = RequestMethod.GET)
public Result<Collection<SysDepart>> queryByIds(@RequestParam String deptIds) { public Result<Collection<SysDepart>> queryByIds(@RequestParam(name = "deptIds") String deptIds) {
Result<Collection<SysDepart>> result = new Result<>(); Result<Collection<SysDepart>> result = new Result<>();
String[] ids = deptIds.split(","); String[] ids = deptIds.split(",");
Collection<String> idList = Arrays.asList(ids); Collection<String> idList = Arrays.asList(ids);

@ -79,8 +79,8 @@ public class SysDepartRoleController extends JeecgController<SysDepartRole, ISys
HttpServletRequest req) { HttpServletRequest req) {
QueryWrapper<SysDepartRole> queryWrapper = QueryGenerator.initQueryWrapper(sysDepartRole, req.getParameterMap()); QueryWrapper<SysDepartRole> queryWrapper = QueryGenerator.initQueryWrapper(sysDepartRole, req.getParameterMap());
Page<SysDepartRole> page = new Page<SysDepartRole>(pageNo, pageSize); Page<SysDepartRole> page = new Page<SysDepartRole>(pageNo, pageSize);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); // LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> deptIds = null; // List<String> deptIds = null;
// if(oConvertUtils.isEmpty(deptId)){ // if(oConvertUtils.isEmpty(deptId)){
// if(oConvertUtils.isNotEmpty(user.getUserIdentity()) && user.getUserIdentity().equals(CommonConstant.USER_IDENTITY_2) ){ // if(oConvertUtils.isNotEmpty(user.getUserIdentity()) && user.getUserIdentity().equals(CommonConstant.USER_IDENTITY_2) ){
// deptIds = sysDepartService.getMySubDepIdsByDepId(user.getDepartIds()); // deptIds = sysDepartService.getMySubDepIdsByDepId(user.getDepartIds());
@ -93,7 +93,10 @@ public class SysDepartRoleController extends JeecgController<SysDepartRole, ISys
// queryWrapper.in("depart_id",deptIds); // queryWrapper.in("depart_id",deptIds);
//我的部门,选中部门只能看当前部门下的角色 //我的部门,选中部门只能看当前部门下的角色
queryWrapper.eq("depart_id",deptId); if(oConvertUtils.isNotEmpty(deptId)){
queryWrapper.eq("depart_id",deptId);
}
IPage<SysDepartRole> pageList = sysDepartRoleService.page(page, queryWrapper); IPage<SysDepartRole> pageList = sysDepartRoleService.page(page, queryWrapper);
return Result.ok(pageList); return Result.ok(pageList);
} }

@ -123,9 +123,13 @@ public class SysRoleController {
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) { HttpServletRequest req) {
Result<IPage<SysRole>> result = new Result<IPage<SysRole>>(); Result<IPage<SysRole>> result = new Result<IPage<SysRole>>();
//------------------------------------------------------------------------------------------------
//此接口必须通过租户来隔离查询 //update-begin---author:wangshuai---date:2023-11-20---for:【QQYUN-7089】低代码模式 选择组织角色没有数据 在租户角色中添加数据后,列表也无数据展示---
role.setTenantId(oConvertUtils.getInt(!"0".equals(TenantContext.getTenant()) ? TenantContext.getTenant() : "", -1)); 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】低代码模式 选择组织角色没有数据 在租户角色中添加数据后,列表也无数据展示---
QueryWrapper<SysRole> queryWrapper = QueryGenerator.initQueryWrapper(role, req.getParameterMap()); QueryWrapper<SysRole> queryWrapper = QueryGenerator.initQueryWrapper(role, req.getParameterMap());
Page<SysRole> page = new Page<SysRole>(pageNo, pageSize); Page<SysRole> page = new Page<SysRole>(pageNo, pageSize);
@ -527,7 +531,6 @@ public class SysRoleController {
} }
/** /**
* TODO
* *
* @return * @return
*/ */

@ -858,16 +858,19 @@ public class SysTenantController {
@GetMapping("/getTenantCount") @GetMapping("/getTenantCount")
public Result<Map<String,Long>> getTenantCount(HttpServletRequest request){ public Result<Map<String,Long>> getTenantCount(HttpServletRequest request){
Map<String,Long> map = new HashMap<>(); Map<String,Long> map = new HashMap<>();
Integer tenantId = oConvertUtils.getInt(TokenUtils.getTenantIdByRequest(request),0); //update-begin---author:wangshuai---date:2023-11-24---for:【QQYUN-7177】用户数量显示不正确---
LambdaQueryWrapper<SysUserTenant> userTenantQuery = new LambdaQueryWrapper<>(); if(oConvertUtils.isEmpty(TokenUtils.getTenantIdByRequest(request))){
userTenantQuery.eq(SysUserTenant::getTenantId,tenantId); return Result.error("当前租户为空,禁止访问!");
userTenantQuery.eq(SysUserTenant::getStatus,CommonConstant.USER_TENANT_NORMAL); }
long userCount = relationService.count(userTenantQuery); Integer tenantId = oConvertUtils.getInt(TokenUtils.getTenantIdByRequest(request));
Long userCount = relationService.getUserCount(tenantId,CommonConstant.USER_TENANT_NORMAL);
//update-end---author:wangshuai---date:2023-11-24---for:【QQYUN-7177】用户数量显示不正确---
map.put("userCount",userCount); map.put("userCount",userCount);
LambdaQueryWrapper<SysDepart> departQuery = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SysDepart> departQuery = new LambdaQueryWrapper<>();
departQuery.eq(SysDepart::getDelFlag,String.valueOf(CommonConstant.DEL_FLAG_0)); departQuery.eq(SysDepart::getDelFlag,String.valueOf(CommonConstant.DEL_FLAG_0));
departQuery.eq(SysDepart::getTenantId,tenantId); departQuery.eq(SysDepart::getTenantId,tenantId);
departQuery.eq(SysDepart::getStatus,CommonConstant.STATUS_1); //部门状态暂时没用,先注释掉
//departQuery.eq(SysDepart::getStatus,CommonConstant.STATUS_1);
long departCount = sysDepartService.count(departQuery); long departCount = sysDepartService.count(departQuery);
map.put("departCount",departCount); map.put("departCount",departCount);
return Result.ok(map); return Result.ok(map);

@ -437,12 +437,13 @@ public class SysUserController {
@RequestParam(name = "departId", required = false) String departId, @RequestParam(name = "departId", required = false) String departId,
@RequestParam(name="realname",required=false) String realname, @RequestParam(name="realname",required=false) String realname,
@RequestParam(name="username",required=false) String username, @RequestParam(name="username",required=false) String username,
@RequestParam(name="isMultiTranslate",required=false) String isMultiTranslate,
@RequestParam(name="id",required = false) String id) { @RequestParam(name="id",required = false) String id) {
//update-begin-author:taoyan date:2022-7-14 for: VUEN-1702【禁止问题】sql注入漏洞 //update-begin-author:taoyan date:2022-7-14 for: VUEN-1702【禁止问题】sql注入漏洞
String[] arr = new String[]{departId, realname, username, id}; String[] arr = new String[]{departId, realname, username, id};
SqlInjectionUtil.filterContent(arr, SymbolConstant.SINGLE_QUOTATION_MARK); SqlInjectionUtil.filterContent(arr, SymbolConstant.SINGLE_QUOTATION_MARK);
//update-end-author:taoyan date:2022-7-14 for: VUEN-1702【禁止问题】sql注入漏洞 //update-end-author:taoyan date:2022-7-14 for: VUEN-1702【禁止问题】sql注入漏洞
IPage<SysUser> pageList = sysUserDepartService.queryDepartUserPageList(departId, username, realname, pageSize, pageNo,id); IPage<SysUser> pageList = sysUserDepartService.queryDepartUserPageList(departId, username, realname, pageSize, pageNo,id,isMultiTranslate);
return Result.OK(pageList); return Result.OK(pageList);
} }
@ -568,7 +569,7 @@ public class SysUserController {
* @return * @return
*/ */
@RequestMapping(value = "/queryByIds", method = RequestMethod.GET) @RequestMapping(value = "/queryByIds", method = RequestMethod.GET)
public Result<Collection<SysUser>> queryByIds(@RequestParam String userIds) { public Result<Collection<SysUser>> queryByIds(@RequestParam(name = "userIds") String userIds) {
Result<Collection<SysUser>> result = new Result<>(); Result<Collection<SysUser>> result = new Result<>();
String[] userId = userIds.split(","); String[] userId = userIds.split(",");
Collection<String> idList = Arrays.asList(userId); Collection<String> idList = Arrays.asList(userId);
@ -585,7 +586,7 @@ public class SysUserController {
* @return * @return
*/ */
@RequestMapping(value = "/queryByNames", method = RequestMethod.GET) @RequestMapping(value = "/queryByNames", method = RequestMethod.GET)
public Result<Collection<SysUser>> queryByNames(@RequestParam String userNames) { public Result<Collection<SysUser>> queryByNames(@RequestParam(name = "userNames") String userNames) {
Result<Collection<SysUser>> result = new Result<>(); Result<Collection<SysUser>> result = new Result<>();
String[] names = userNames.split(","); String[] names = userNames.split(",");
QueryWrapper<SysUser> queryWrapper=new QueryWrapper(); QueryWrapper<SysUser> queryWrapper=new QueryWrapper();

@ -424,10 +424,6 @@ public class ThirdAppController {
@GetMapping("/getThirdConfigByTenantId") @GetMapping("/getThirdConfigByTenantId")
public Result<SysThirdAppConfig> getThirdAppByTenantId(@RequestParam(name = "tenantId", required = false) Integer tenantId, public Result<SysThirdAppConfig> getThirdAppByTenantId(@RequestParam(name = "tenantId", required = false) Integer tenantId,
@RequestParam(name = "thirdType") String thirdType) { @RequestParam(name = "thirdType") String thirdType) {
Result<SysThirdAppConfig> result = new Result<>();
LambdaQueryWrapper<SysThirdAppConfig> query = new LambdaQueryWrapper<>();
query.eq(SysThirdAppConfig::getThirdType,thirdType);
if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) { if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) {
if (tenantId == null) { if (tenantId == null) {
return Result.error("开启多租户模式租户ID参数不允许为空"); return Result.error("开启多租户模式租户ID参数不允许为空");
@ -438,7 +434,9 @@ public class ThirdAppController {
tenantId = oConvertUtils.getInt(TenantContext.getTenant(), 0); tenantId = oConvertUtils.getInt(TenantContext.getTenant(), 0);
} }
} }
Result<SysThirdAppConfig> result = new Result<>();
LambdaQueryWrapper<SysThirdAppConfig> query = new LambdaQueryWrapper<>();
query.eq(SysThirdAppConfig::getThirdType,thirdType);
query.eq(SysThirdAppConfig::getTenantId,tenantId); query.eq(SysThirdAppConfig::getTenantId,tenantId);
SysThirdAppConfig sysThirdAppConfig = appConfigService.getOne(query); SysThirdAppConfig sysThirdAppConfig = appConfigService.getOne(query);
result.setSuccess(true); result.setSuccess(true);

@ -1,11 +1,12 @@
package org.jeecg.modules.system.controller; package org.jeecg.modules.system.controller;
import javax.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter; import java.io.PrintWriter;
/** /**

@ -68,7 +68,7 @@ public class SysTenantPackUser implements Serializable {
private transient String packCode; private transient String packCode;
/** /**
* (1 2 3 4 5 ) * (0 1)
*/ */
private Integer status; private Integer status;

@ -48,6 +48,4 @@ public class SysUserRole implements Serializable {
this.roleId = roleId; this.roleId = roleId;
} }
} }

@ -9,6 +9,7 @@ import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.model.SysDepartTreeModel; import org.jeecg.modules.system.model.SysDepartTreeModel;
import org.jeecg.modules.system.model.TreeModel; import org.jeecg.modules.system.model.TreeModel;
import org.jeecg.modules.system.vo.SysDepartExportVo;
import org.jeecg.modules.system.vo.SysUserDepVo; import org.jeecg.modules.system.vo.SysUserDepVo;
import org.jeecg.modules.system.vo.lowapp.ExportDepartVo; import org.jeecg.modules.system.vo.lowapp.ExportDepartVo;
import org.springframework.data.repository.query.Param; import org.springframework.data.repository.query.Param;
@ -161,4 +162,12 @@ public interface SysDepartMapper extends BaseMapper<SysDepart> {
* @return * @return
*/ */
List<SysDepart> getDepartPageByName(@Param("page") Page<SysDepart> page, @Param("departName") String departName, @Param("tenantId") Integer tenantId, @Param("parentId") String parentId); List<SysDepart> getDepartPageByName(@Param("page") Page<SysDepart> page, @Param("departName") String departName, @Param("tenantId") Integer tenantId, @Param("parentId") String parentId);
/**
* idid
* @param tenantId
* @param parentId
* @return
*/
List<SysDepartExportVo> getSysDepartList(@Param("parentId") String parentId,@Param("tenantId") Integer tenantId);
} }

@ -120,4 +120,11 @@ public interface SysTenantMapper extends BaseMapper<SysTenant> {
*/ */
Long getApplySuperAdminCount(@Param("userId") String userId, @Param("tenantId") Integer tenantId); Long getApplySuperAdminCount(@Param("userId") String userId, @Param("tenantId") Integer tenantId);
/**
*
* @param tenantId
* @return
*/
@Select("select count(1) from sys_tenant where id = #{tenantId} and del_flag = 0")
Long tenantIzExist(@Param("tenantId") Integer tenantId);
} }

@ -25,4 +25,11 @@ public interface SysTenantPackUserMapper extends BaseMapper<SysTenantPackUser> {
@InterceptorIgnore(tenantLine = "true") @InterceptorIgnore(tenantLine = "true")
List<String> queryTenantPackUserNameList(@Param("tenantId") Integer tenantId, @Param("packCodeList") List<String> packCodeList); List<String> queryTenantPackUserNameList(@Param("tenantId") Integer tenantId, @Param("packCodeList") List<String> packCodeList);
/**
*
* @param userId
* @param tenantId
* @return
*/
Long izHaveBuyAuth(@Param("userId") String userId, @Param("tenantId") String tenantId);
} }

@ -3,6 +3,7 @@ package org.jeecg.modules.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.system.entity.SysThirdAccount; import org.jeecg.modules.system.entity.SysThirdAccount;
import org.jeecg.modules.system.vo.thirdapp.JwUserDepartVo;
import java.util.List; import java.util.List;
@ -23,4 +24,11 @@ public interface SysThirdAccountMapper extends BaseMapper<SysThirdAccount> {
*/ */
List<SysThirdAccount> selectThirdIdsByUsername(@Param("sysUsernameArr") String[] sysUsernameArr, @Param("thirdType") String thirdType, @Param("tenantId") Integer tenantId); List<SysThirdAccount> selectThirdIdsByUsername(@Param("sysUsernameArr") String[] sysUsernameArr, @Param("thirdType") String thirdType, @Param("tenantId") Integer tenantId);
/**
*
* @param tenantId
* @param thirdType
* @return
*/
List<JwUserDepartVo> getThirdUserBindByWechat(@Param("tenantId") int tenantId, @Param("thirdType") String thirdType);
} }

@ -1,17 +1,17 @@
package org.jeecg.modules.system.mapper; package org.jeecg.modules.system.mapper;
import java.util.List;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.entity.SysUserPosition; import org.jeecg.modules.system.entity.SysUserPosition;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.system.vo.SysUserPositionVo; import org.jeecg.modules.system.vo.SysUserPositionVo;
import java.util.List;
/** /**
* @Description: * @Description:
* @Author: jeecg-boot * @Author: jeecg-boot
@ -66,7 +66,7 @@ public interface SysUserPositionMapper extends BaseMapper<SysUserPosition> {
* @return * @return
*/ */
@InterceptorIgnore(tenantLine = "true") @InterceptorIgnore(tenantLine = "true")
List<String> getPositionIdByUserTenantId(@Param("userId") String userId, @Param("tenantId") Integer tenantId); List<String> getPositionIdByUserTenantId(@Param("userId")String userId, @Param("tenantId")Integer tenantId);
/** /**
* id * id

@ -12,6 +12,7 @@ import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.entity.SysUserTenant; import org.jeecg.modules.system.entity.SysUserTenant;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.system.vo.SysUserTenantVo; import org.jeecg.modules.system.vo.SysUserTenantVo;
import org.jeecg.modules.system.vo.thirdapp.JwUserDepartVo;
/** /**
* @Description: sys_user_tenant_relation * @Description: sys_user_tenant_relation
@ -149,4 +150,20 @@ public interface SysUserTenantMapper extends BaseMapper<SysUserTenant> {
* @param tenantIds * @param tenantIds
*/ */
void deleteUserByTenantId(@Param("tenantIds") List<Integer> tenantIds); void deleteUserByTenantId(@Param("tenantIds") List<Integer> tenantIds);
/**
*
*
* @param tenantId
* @param tenantStatus
* @return
*/
Long getUserCount(Integer tenantId, String tenantStatus);
/**
* id
* @param tenantId
* @return
*/
List<JwUserDepartVo> getUsersByTenantIdAndName(@Param("tenantId") Integer tenantId);
} }

@ -33,7 +33,7 @@
<select id="querySysCementListByUserId" parameterType="String" resultMap="SysAnnouncement"> <select id="querySysCementListByUserId" parameterType="String" resultMap="SysAnnouncement">
select * from sys_announcement select id,titile,create_time,priority,bus_id,open_type,open_page,sender,send_time,msg_content from sys_announcement
where send_status = '1' where send_status = '1'
and del_flag = '0' and del_flag = '0'
and msg_category = #{msgCategory} and msg_category = #{msgCategory}

@ -114,7 +114,9 @@
SELECT id,depart_name,org_code,parent_id FROM sys_depart SELECT id,depart_name,org_code,parent_id FROM sys_depart
where where
depart_name = #{departName} depart_name = #{departName}
and tenant_id = #{tenantId} <if test="null != tenantId and 0 != tenantId">
and tenant_id = #{tenantId}
</if>
<if test="parentId != null and parentId != ''"> <if test="parentId != null and parentId != ''">
and parent_id = #{parentId} and parent_id = #{parentId}
</if> </if>
@ -154,4 +156,24 @@
</foreach> </foreach>
) )
</select> </select>
<!--系统后台导出根据父级id和租户id查询部门数据-->
<select id="getSysDepartList" resultType="org.jeecg.modules.system.vo.SysDepartExportVo">
SELECT id,depart_name,parent_id,depart_name_en,depart_order,description,org_category,org_code,mobile,fax,address,memo FROM sys_depart
WHERE
1=1
<if test="null != tenantId and 0 != tenantId">
AND tenant_id = #{tenantId}
</if>
AND
<choose>
<when test="parentId != null and parentId != ''">
parent_id = #{parentId}
</when>
<otherwise>
parent_id IS NULL OR parent_id=''
</otherwise>
</choose>
ORDER BY depart_order DESC
</select>
</mapper> </mapper>

@ -43,6 +43,7 @@
<select id="queryTenantPackUserCount" resultType="org.jeecg.modules.system.vo.tenant.TenantPackUserCount"> <select id="queryTenantPackUserCount" resultType="org.jeecg.modules.system.vo.tenant.TenantPackUserCount">
SELECT pack_code, count(*) as user_count FROM sys_tenant_pack a SELECT pack_code, count(*) as user_count FROM sys_tenant_pack a
join sys_tenant_pack_user b on a.id = b.pack_id join sys_tenant_pack_user b on a.id = b.pack_id
join sys_user_tenant sut on a.tenant_id = sut.tenant_id and b.user_id = sut.user_id and sut.status = 1
where a.tenant_id = #{tenantId} where a.tenant_id = #{tenantId}
and a.pack_code in ('superAdmin', 'accountAdmin', 'appAdmin') and a.pack_code in ('superAdmin', 'accountAdmin', 'appAdmin')
and b.status = 1 and b.status = 1
@ -74,6 +75,7 @@
SELECT c.id, c.username, c.realname, c.phone, c.avatar, a.pack_name, a.id as pack_id FROM sys_user c SELECT c.id, c.username, c.realname, c.phone, c.avatar, a.pack_name, a.id as pack_id FROM sys_user c
join sys_tenant_pack_user b on c.id = b.user_id join sys_tenant_pack_user b on c.id = b.user_id
join sys_tenant_pack a on a.id = b.pack_id join sys_tenant_pack a on a.id = b.pack_id
join sys_user_tenant sut on a.tenant_id = sut.tenant_id and b.user_id = sut.user_id and sut.status = 1
where c.status = 1 where c.status = 1
and c.del_flag = 0 and c.del_flag = 0
and b.status = #{packUserStatus} and b.status = #{packUserStatus}

@ -15,4 +15,12 @@
) )
</select> </select>
<!-- 判断当前用户在该租户下是否拥有管理员的权限 -->
<select id="izHaveBuyAuth" resultType="java.lang.Long">
SELECT count(1) from sys_tenant_pack_user stpu
left join sys_tenant_pack stp on stpu.pack_id = stp.id
WHERE stpu.tenant_id = #{tenantId}
and stpu.user_id = #{userId}
and stp.pack_code in('superAdmin','accountAdmin')
</select>
</mapper> </mapper>

@ -15,4 +15,13 @@
<foreach collection="sysUsernameArr" item="item" open=" sys_user.username IN (" close=")" separator=",">#{item}</foreach> <foreach collection="sysUsernameArr" item="item" open=" sys_user.username IN (" close=")" separator=",">#{item}</foreach>
</select> </select>
<!--查询被绑定的用户-->
<select id="getThirdUserBindByWechat" resultType="org.jeecg.modules.system.vo.thirdapp.JwUserDepartVo">
SELECT su.id userId, su.realname, su.avatar, sta.realname as wechatRealName, sta.third_user_id as wechatUserId, sta.id as thirdId
FROM sys_third_account sta
LEFT JOIN sys_user su on sta.sys_user_id = su.id
WHERE sta.tenant_id = #{tenantId}
AND sta.third_type = #{thirdType}
</select>
</mapper> </mapper>

@ -39,9 +39,10 @@
<!--通过用户id获取租户列表--> <!--通过用户id获取租户列表-->
<select id="getTenantListByUserId" resultType="org.jeecg.modules.system.vo.SysUserTenantVo"> <select id="getTenantListByUserId" resultType="org.jeecg.modules.system.vo.SysUserTenantVo">
SELECT st.id as tenantUserId,st.name,st.trade,st.house_number,st.create_by,sut.status as userTenantStatus SELECT st.id as tenantUserId,st.name,st.trade,st.house_number,st.create_by,sut.status as userTenantStatus,svm.member_type,sut.user_id as id
FROM sys_user_tenant sut FROM sys_user_tenant sut
JOIN sys_tenant st ON sut.tenant_id = st.id LEFT JOIN sys_tenant st ON sut.tenant_id = st.id
LEFT JOIN sys_vip_membership svm ON sut.tenant_id = svm.tenant_id
WHERE st.status = 1 WHERE st.status = 1
AND st.del_flag = 0 AND st.del_flag = 0
AND sut.user_id = #{userId} AND sut.user_id = #{userId}
@ -164,4 +165,22 @@
#{tenantId} #{tenantId}
</foreach> </foreach>
</delete> </delete>
<!-- 获取租户下的成员数量 -->
<select id="getUserCount" resultType="java.lang.Long">
SELECT count(1) FROM sys_user_tenant sut JOIN sys_user su on sut.user_id = su.id and su.del_flag = 0 and su.status = 1
WHERE sut.status = #{tenantStatus}
AND tenant_id = #{tenantId}
</select>
<!--根据租户id和名称获取用户数据-->
<select id="getUsersByTenantIdAndName" resultType="org.jeecg.modules.system.vo.thirdapp.JwUserDepartVo">
SELECT su.id userId,su.realname,su.avatar
FROM sys_user_tenant sut
JOIN sys_tenant st ON sut.tenant_id = st.id and st.status = 1 and st.del_flag = 0
JOIN sys_user su ON sut.user_id = su.id and su.status = 1 and su.del_flag = 0
WHERE
sut.status = 1
AND sut.tenant_id = #{tenantId}
</select>
</mapper> </mapper>

@ -89,4 +89,13 @@ public interface ISysCategoryService extends IService<SysCategory> {
*/ */
List<String> loadDictItem(String ids, boolean delNotExist); List<String> loadDictItem(String ids, boolean delNotExist);
/**
* 使
*
* @param names
* @param delNotExist falsekeykey
* @return
*/
List<String> loadDictItemByNames(String names, boolean delNotExist);
} }

@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.system.entity.SysDepart; import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.entity.SysUserDepart;
import org.jeecg.modules.system.model.DepartIdModel; import org.jeecg.modules.system.model.DepartIdModel;
import org.jeecg.modules.system.model.SysDepartTreeModel; import org.jeecg.modules.system.model.SysDepartTreeModel;
import org.jeecg.modules.system.vo.SysDepartExportVo;
import org.jeecg.modules.system.vo.lowapp.ExportDepartVo; import org.jeecg.modules.system.vo.lowapp.ExportDepartVo;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@ -216,4 +218,17 @@ public interface ISysDepartService extends IService<SysDepart>{
void importExcel(List<ExportDepartVo> listSysDeparts, List<String> errorMessageList); void importExcel(List<ExportDepartVo> listSysDeparts, List<String> errorMessageList);
/**
* id
* @param tenantId
* @return
*/
List<SysDepartExportVo> getExportDepart(int tenantId);
/**
* excel
* @param listSysDeparts
* @param errorMessageList
*/
void importSysDepart(List<SysDepartExportVo> listSysDeparts, List<String> errorMessageList);
} }

@ -107,6 +107,7 @@ public interface ISysDictService extends IService<SysDict> {
@Deprecated @Deprecated
String queryTableDictTextByKey(String table, String text, String code, String key); String queryTableDictTextByKey(String table, String text, String code, String key);
//update-begin---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
/** /**
* table text code key * table text code key
* *
@ -114,9 +115,11 @@ public interface ISysDictService extends IService<SysDict> {
* @param text * @param text
* @param code * @param code
* @param keys * @param keys
* @param dataSource
* @return * @return
*/ */
List<DictModel> queryTableDictTextByKeys(String table, String text, String code, List<String> keys); List<DictModel> queryTableDictTextByKeys(String table, String text, String code, List<String> keys, String dataSource);
//update-end---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
/** /**
* table text code key value * table text code key value

@ -75,7 +75,8 @@ public interface ISysThirdAccountService extends IService<SysThirdAccount> {
* @param unionid * @param unionid
* @param thirdType * @param thirdType
* @param tenantId * @param tenantId
* @param thirdUserId
* @return * @return
*/ */
SysThirdAccount getOneByUuidAndThirdType(String unionid, String thirdType,Integer tenantId); SysThirdAccount getOneByUuidAndThirdType(String unionid, String thirdType,Integer tenantId,String thirdUserId);
} }

@ -51,9 +51,10 @@ public interface ISysUserDepartService extends IService<SysUserDepart> {
* @param pageNo * @param pageNo
* @param realname * @param realname
* @param id * @param id
* @param isMultiTranslate
* @return * @return
*/ */
IPage<SysUser> queryDepartUserPageList(String departId, String username, String realname, int pageSize, int pageNo,String id); IPage<SysUser> queryDepartUserPageList(String departId, String username, String realname, int pageSize, int pageNo,String id,String isMultiTranslate);
/** /**
* *

@ -120,4 +120,12 @@ public interface ISysUserTenantService extends IService<SysUserTenant> {
* @return * @return
*/ */
SysUserTenant getUserTenantByTenantId(String userId, Integer tenantId); SysUserTenant getUserTenantByTenantId(String userId, Integer tenantId);
/**
*
* @param tenantId
* @param tenantStatus
* @return
*/
Long getUserCount(Integer tenantId, String tenantStatus);
} }

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.system.vo.LoginUser;
@ -61,7 +62,12 @@ public class SysAnnouncementServiceImpl extends ServiceImpl<SysAnnouncementMappe
sysAnnouncementMapper.insert(sysAnnouncement); sysAnnouncementMapper.insert(sysAnnouncement);
// 2.插入用户通告阅读标记表记录 // 2.插入用户通告阅读标记表记录
String userId = sysAnnouncement.getUserIds(); String userId = sysAnnouncement.getUserIds();
String[] userIds = userId.substring(0, (userId.length()-1)).split(","); //update-begin-author:liusq---date:2023-10-31--for:[issues/5503]【公告】通知无法接收
if(StringUtils.isNotBlank(userId) && userId.endsWith(",")){
userId = userId.substring(0, (userId.length()-1));
}
String[] userIds = userId.split(",");
//update-end-author:liusq---date:2023-10-31--for:[issues/5503]【公告】通知无法接收
String anntId = sysAnnouncement.getId(); String anntId = sysAnnouncement.getId();
Date refDate = new Date(); Date refDate = new Date();
for(int i=0;i<userIds.length;i++) { for(int i=0;i<userIds.length;i++) {

@ -34,7 +34,8 @@ import org.jeecg.common.system.query.QueryCondition;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.query.QueryRuleEnum; import org.jeecg.common.system.query.QueryRuleEnum;
import org.jeecg.common.system.vo.*; import org.jeecg.common.system.vo.*;
import org.jeecg.common.util.*; import org.jeecg.common.util.HTMLUtils;
import org.jeecg.common.util.YouBianCodeUtil;
import org.jeecg.common.util.dynamic.db.FreemarkerParseFactory; import org.jeecg.common.util.dynamic.db.FreemarkerParseFactory;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.util.oConvertUtils;
import org.jeecg.config.firewall.SqlInjection.IDictTableWhiteListHandler; import org.jeecg.config.firewall.SqlInjection.IDictTableWhiteListHandler;
@ -57,6 +58,7 @@ import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.ui.freemarker.FreeMarkerTemplateUtils; import org.springframework.ui.freemarker.FreeMarkerTemplateUtils;
import org.springframework.util.AntPathMatcher; import org.springframework.util.AntPathMatcher;
import org.springframework.util.CollectionUtils;
import org.springframework.util.PathMatcher; import org.springframework.util.PathMatcher;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -323,6 +325,30 @@ public class SysBaseApiImpl implements ISysBaseAPI {
return result; return result;
} }
@Override
public Set<String> getDepartParentIdsByUsername(String username) {
List<SysDepart> list = sysDepartService.queryDepartsByUsername(username);
Set<String> result = new HashSet<>(list.size());
for (SysDepart depart : list) {
result.add(depart.getParentId());
}
return result;
}
@Override
public Set<String> getDepartParentIdsByDepIds(Set depIds) {
LambdaQueryWrapper<SysDepart> departQuery = new LambdaQueryWrapper<SysDepart>().in(SysDepart::getId, depIds);
List<SysDepart> departList = departMapper.selectList(departQuery);
if(CollectionUtils.isEmpty(departList)){
return null;
}
Set<String> parentIds = departList.stream()
.map(SysDepart::getParentId)
.collect(Collectors.toSet());
return parentIds;
}
@Override @Override
public List<String> getDepartNamesByUsername(String username) { public List<String> getDepartNamesByUsername(String username) {
List<SysDepart> list = sysDepartService.queryDepartsByUsername(username); List<SysDepart> list = sysDepartService.queryDepartsByUsername(username);
@ -1388,6 +1414,11 @@ public class SysBaseApiImpl implements ISysBaseAPI {
return sysCategoryService.loadDictItem(ids, false); return sysCategoryService.loadDictItem(ids, false);
} }
@Override
public List<String> loadCategoryDictItemByNames(String names, boolean delNotExist) {
return sysCategoryService.loadDictItemByNames(names, delNotExist);
}
/** /**
* codetext * codetext
* *
@ -1461,13 +1492,17 @@ public class SysBaseApiImpl implements ISysBaseAPI {
public Map<String, List<DictModel>> translateManyDict(String dictCodes, String keys) { public Map<String, List<DictModel>> translateManyDict(String dictCodes, String keys) {
List<String> dictCodeList = Arrays.asList(dictCodes.split(",")); List<String> dictCodeList = Arrays.asList(dictCodes.split(","));
List<String> values = Arrays.asList(keys.split(",")); List<String> values = Arrays.asList(keys.split(","));
//update-begin---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
return sysDictService.queryManyDictByKeys(dictCodeList, values); return sysDictService.queryManyDictByKeys(dictCodeList, values);
//update-end---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
} }
//update-begin---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
@Override @Override
public List<DictModel> translateDictFromTableByKeys(String table, String text, String code, String keys) { public List<DictModel> translateDictFromTableByKeys(String table, String text, String code, String keys, String dataSource) {
return sysDictService.queryTableDictTextByKeys(table, text, code, Arrays.asList(keys.split(","))); return sysDictService.queryTableDictTextByKeys(table, text, code, Arrays.asList(keys.split(",")), dataSource);
} }
//update-end---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
//-------------------------------------流程节点发送模板消息----------------------------------------------- //-------------------------------------流程节点发送模板消息-----------------------------------------------
@Autowired @Autowired

@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.FillRuleConstant; import org.jeecg.common.constant.FillRuleConstant;
import org.jeecg.common.constant.SymbolConstant; import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.exception.JeecgBootException;
@ -18,10 +17,7 @@ import org.jeecg.modules.system.service.ISysCategoryService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -235,4 +231,22 @@ public class SysCategoryServiceImpl extends ServiceImpl<SysCategoryMapper, SysCa
return textList; return textList;
} }
@Override
public List<String> loadDictItemByNames(String names, boolean delNotExist) {
List<String> nameList = Arrays.asList(names.split(SymbolConstant.COMMA));
LambdaQueryWrapper<SysCategory> query = new LambdaQueryWrapper<>();
query.select(SysCategory::getId, SysCategory::getName);
query.in(SysCategory::getName, nameList);
// 查询数据
List<SysCategory> list = super.list(query);
// 取出id并返回
return nameList.stream().map(name -> {
SysCategory res = list.stream().filter(i -> name.equals(i.getName())).findFirst().orElse(null);
if (res == null) {
return delNotExist ? null : name;
}
return res.getId();
}).filter(Objects::nonNull).collect(Collectors.toList());
}
} }

@ -1,6 +1,7 @@
package org.jeecg.modules.system.service.impl; package org.jeecg.modules.system.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ArrayUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -28,9 +29,9 @@ import org.jeecg.modules.system.model.DepartIdModel;
import org.jeecg.modules.system.model.SysDepartTreeModel; import org.jeecg.modules.system.model.SysDepartTreeModel;
import org.jeecg.modules.system.service.ISysDepartService; import org.jeecg.modules.system.service.ISysDepartService;
import org.jeecg.modules.system.util.FindsDepartsChildrenUtil; import org.jeecg.modules.system.util.FindsDepartsChildrenUtil;
import org.jeecg.modules.system.vo.SysDepartExportVo;
import org.jeecg.modules.system.vo.lowapp.ExportDepartVo; import org.jeecg.modules.system.vo.lowapp.ExportDepartVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -69,6 +70,11 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
//根据部门id获取所负责部门 //根据部门id获取所负责部门
LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>(); LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>();
String[] codeArr = this.getMyDeptParentOrgCode(departIds); String[] codeArr = this.getMyDeptParentOrgCode(departIds);
//update-begin---author:wangshuai---date:2023-12-01---for:【QQYUN-7320】查询部门没数据导致报错空指针---
if(ArrayUtil.isEmpty(codeArr)){
return null;
}
//update-end---author:wangshuai---date:2023-12-01---for:【QQYUN-7320】查询部门没数据导致报错空指针---
for(int i=0;i<codeArr.length;i++){ for(int i=0;i<codeArr.length;i++){
query.or().likeRight(SysDepart::getOrgCode,codeArr[i]); query.or().likeRight(SysDepart::getOrgCode,codeArr[i]);
} }
@ -197,6 +203,14 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
sysDepart.setDelFlag(CommonConstant.DEL_FLAG_0.toString()); sysDepart.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
//新添加的部门是叶子节点 //新添加的部门是叶子节点
sysDepart.setIzLeaf(CommonConstant.IS_LEAF); sysDepart.setIzLeaf(CommonConstant.IS_LEAF);
// 【QQYUN-7172】数据库默认值兼容
if (oConvertUtils.isEmpty(sysDepart.getOrgCategory())) {
if (oConvertUtils.isEmpty(sysDepart.getParentId())) {
sysDepart.setOrgCategory("1");
} else {
sysDepart.setOrgCategory("2");
}
}
this.save(sysDepart); this.save(sysDepart);
//update-begin---author:wangshuai ---date:20220307 for[JTC-119]在部门管理菜单下设置部门负责人 创建用户的时候不需要处理 //update-begin---author:wangshuai ---date:20220307 for[JTC-119]在部门管理菜单下设置部门负责人 创建用户的时候不需要处理
//新增部门的时候新增负责部门 //新增部门的时候新增负责部门
@ -485,7 +499,10 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
//根据部门id查询所负责部门 //根据部门id查询所负责部门
LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>(); LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>();
query.eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString()); query.eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString());
query.in(SysDepart::getId, Arrays.asList(departIds.split(","))); if(oConvertUtils.isNotEmpty(departIds)){
query.in(SysDepart::getId, Arrays.asList(departIds.split(",")));
}
//------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------
//是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】 //是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){ if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
@ -1195,4 +1212,169 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
} }
} }
} }
//========================begin 系统下部门与人员导入 ==================================================================
/**
*
* @param tenantId
* @return
*/
@Override
public List<SysDepartExportVo> getExportDepart(int tenantId) {
//获取父级部门
List<SysDepartExportVo> parentDepart = departMapper.getSysDepartList("", tenantId);
//子部门
List<SysDepartExportVo> childrenDepart = new ArrayList<>();
//把一级部门名称放在里面
List<SysDepartExportVo> exportDepartVoList = new ArrayList<>();
//存放部门一级id避免重复
List<String> departIdList = new ArrayList<>();
for (SysDepartExportVo sysDepart : parentDepart) {
//step 1.添加第一级部门
departIdList.add(sysDepart.getId());
sysDepart.setDepartNameUrl(sysDepart.getDepartName());
exportDepartVoList.add(sysDepart);
//step 2.添加自己部门路径,用/分离
//创建路径
List<String> path = new ArrayList<>();
path.add(sysDepart.getDepartName());
//创建子部门路径
findSysDepartPath(sysDepart, path, tenantId, childrenDepart, departIdList);
path.clear();
}
exportDepartVoList.addAll(childrenDepart);
childrenDepart.clear();
departIdList.clear();
return exportDepartVoList;
}
/**
*
* @param listSysDeparts
* @param errorMessageList
*/
@Override
public void importSysDepart(List<SysDepartExportVo> listSysDeparts, List<String> errorMessageList) {
int num = 0;
int tenantId = 0;
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) {
tenantId = oConvertUtils.getInt(TenantContext.getTenant(), 0);
}
//部门路径排序
Collections.sort(listSysDeparts, new Comparator<SysDepartExportVo>() {
@Override
public int compare(SysDepartExportVo o1, SysDepartExportVo o2) {
if(oConvertUtils.isNotEmpty(o1.getDepartNameUrl()) && oConvertUtils.isNotEmpty(o2.getDepartNameUrl())){
int oldLength = o1.getDepartNameUrl().split(SymbolConstant.SINGLE_SLASH).length;
int newLength = o2.getDepartNameUrl().split(SymbolConstant.SINGLE_SLASH).length;
return oldLength - newLength;
}else{
return 0;
}
}
});
//存放部门数据的map
Map<String,SysDepart> departMap = new HashMap<>();
// orgCode编码长度
int codeLength = YouBianCodeUtil.ZHANWEI_LENGTH;
//循环第二遍导入数据
for (SysDepartExportVo departExportVo : listSysDeparts) {
SysDepart sysDepart = new SysDepart();
boolean izExport = false;
try {
izExport = this.addDepartByName(departExportVo.getDepartNameUrl(),departExportVo.getDepartName(),sysDepart,errorMessageList,tenantId,departMap,num);
} catch (Exception e) {
//没有查找到parentDept
}
//没有错误的时候才会导入数据
if(izExport){
if(oConvertUtils.isNotEmpty(departExportVo.getOrgCode())){
SysDepart depart = this.baseMapper.queryCompByOrgCode(departExportVo.getOrgCode());
if(null != depart){
if(oConvertUtils.isNotEmpty(sysDepart.getParentId())){
//更新上级部门为叶子节点
this.updateIzLeaf(sysDepart.getParentId(),CommonConstant.IS_LEAF);
}
//部门名称已存在
errorMessageList.add("第 " + num + " 行:记录部门名称“"+departExportVo.getDepartName()+"”部门编码重复,请检查!");
continue;
}
String departNameUrl = departExportVo.getDepartNameUrl();
//包含/说明是多级
if(departNameUrl.contains(SymbolConstant.SINGLE_SLASH)){
//判断添加部门的规则是否和生成的一致
if(!sysDepart.getOrgCode().equals(departExportVo.getOrgCode())){
if(oConvertUtils.isNotEmpty(sysDepart.getParentId())){
//更新上级部门为叶子节点
this.updateIzLeaf(sysDepart.getParentId(),CommonConstant.IS_LEAF);
}
//部门名称已存在
errorMessageList.add("第 " + num + " 行:记录部门名称“"+departExportVo.getDepartName()+"”部门编码规则不匹配,请检查!");
continue;
}
}
sysDepart.setOrgCode(departExportVo.getOrgCode());
if(oConvertUtils.isNotEmpty(sysDepart.getParentId())){
//上级
sysDepart.setOrgType("2");
}else{
//下级
sysDepart.setOrgType("1");
}
}else{
sysDepart.setOrgType(sysDepart.getOrgCode().length()/codeLength+"");
}
sysDepart.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
sysDepart.setDepartNameEn(departExportVo.getDepartNameEn());
sysDepart.setDepartOrder(departExportVo.getDepartOrder());
sysDepart.setOrgCategory(oConvertUtils.getString(departExportVo.getOrgCategory(),"1"));
sysDepart.setMobile(departExportVo.getMobile());
sysDepart.setFax(departExportVo.getFax());
sysDepart.setAddress(departExportVo.getAddress());
sysDepart.setMemo(departExportVo.getMemo());
ImportExcelUtil.importDateSaveOne(sysDepart, ISysDepartService.class, errorMessageList, num, CommonConstant.SQL_INDEX_UNIQ_DEPART_ORG_CODE);
departMap.put(departExportVo.getDepartNameUrl(),sysDepart);
}
num++;
}
}
/**
*
*
* @param departVo vo
* @param path
* @param tenantId id
* @param childrenDepart
* @param departIdList id
*/
private void findSysDepartPath(SysDepartExportVo departVo, List<String> path, Integer tenantId, List<SysDepartExportVo> childrenDepart, List<String> departIdList) {
//step 1.查询子部门的数据
//获取租户id和部门父id获取的部门数据
List<SysDepartExportVo> departList = departMapper.getSysDepartList(departVo.getId(), tenantId);
//部门为空判断
if (departList == null || departList.size() <= 0) {
//判断最后一个子部门是否已拼接
if (!departIdList.contains(departVo.getId())) {
departVo.setDepartNameUrl(String.join(SymbolConstant.SINGLE_SLASH, path));
childrenDepart.add(departVo);
}
return;
}
for (SysDepartExportVo exportDepartVo : departList) {
//存放子级路径
List<String> cPath = new ArrayList<>(path);
cPath.add(exportDepartVo.getDepartName());
//step 2.拼接子部门路径
if (!departIdList.contains(departVo.getId())) {
departIdList.add(departVo.getId());
departVo.setDepartNameUrl(String.join(SymbolConstant.SINGLE_SLASH, path));
childrenDepart.add(departVo);
}
//step 3.递归查询子路径,直到找不到为止
findSysDepartPath(exportDepartVo, cPath, tenantId, childrenDepart, departIdList);
}
}
//========================end 系统下部门与人员导入 ==================================================================
} }

@ -1,6 +1,7 @@
package org.jeecg.modules.system.service.impl; package org.jeecg.modules.system.service.impl;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -326,15 +327,22 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
} }
@Override @Override
public List<DictModel> queryTableDictTextByKeys(String table, String text, String code, List<String> codeValues) { public List<DictModel> queryTableDictTextByKeys(String table, String text, String code, List<String> codeValues, String dataSource) {
String str = table+","+text+","+code; String str = table+","+text+","+code;
// 【QQYUN-6533】表字典白名单check //update-begin---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
sysBaseAPI.dictTableWhiteListCheckByDict(table, text, code); // 是否自定义数据源
// 1.表字典黑名单check boolean isCustomDataSource = oConvertUtils.isNotEmpty(dataSource);
if(!dictQueryBlackListHandler.isPass(str)){ // 如果是自定义数据源就不检查表字典白名单
log.error(dictQueryBlackListHandler.getError()); if (!isCustomDataSource) {
return null; // 【QQYUN-6533】表字典白名单check
sysBaseAPI.dictTableWhiteListCheckByDict(table, text, code);
// 1.表字典黑名单check
if (!dictQueryBlackListHandler.isPass(str)) {
log.error(dictQueryBlackListHandler.getError());
return null;
}
} }
//update-end---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
// 2.分割SQL获取表名和条件 // 2.分割SQL获取表名和条件
String filterSql = null; String filterSql = null;
@ -353,7 +361,18 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
text = SqlInjectionUtil.getSqlInjectField(text); text = SqlInjectionUtil.getSqlInjectField(text);
code = SqlInjectionUtil.getSqlInjectField(code); code = SqlInjectionUtil.getSqlInjectField(code);
return sysDictMapper.queryTableDictByKeysAndFilterSql(table, text, code, filterSql, codeValues); //update-begin---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
// 切换为字典表的数据源
if (isCustomDataSource) {
DynamicDataSourceContextHolder.push(dataSource);
}
List<DictModel> restData = sysDictMapper.queryTableDictByKeysAndFilterSql(table, text, code, filterSql, codeValues);
// 清理自定义的数据源
if (isCustomDataSource) {
DynamicDataSourceContextHolder.clear();
}
return restData;
//update-end---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
//update-end-author:taoyan date:20220113 for: @dict注解支持 dicttable 设置where条件 //update-end-author:taoyan date:20220113 for: @dict注解支持 dicttable 设置where条件
} }

@ -143,8 +143,19 @@ public class SysUserDepartServiceImpl extends ServiceImpl<SysUserDepartMapper, S
} }
/**
*
* @param departId
* @param username
* @param realname
* @param pageSize
* @param pageNo
* @param id
* @param isMultiTranslate
* @return
*/
@Override @Override
public IPage<SysUser> queryDepartUserPageList(String departId, String username, String realname, int pageSize, int pageNo,String id) { public IPage<SysUser> queryDepartUserPageList(String departId, String username, String realname, int pageSize, int pageNo,String id,String isMultiTranslate) {
IPage<SysUser> pageList = null; IPage<SysUser> pageList = null;
// 部门ID不存在 直接查询用户表即可 // 部门ID不存在 直接查询用户表即可
Page<SysUser> page = new Page<SysUser>(pageNo, pageSize); Page<SysUser> page = new Page<SysUser>(pageNo, pageSize);
@ -153,9 +164,17 @@ public class SysUserDepartServiceImpl extends ServiceImpl<SysUserDepartMapper, S
//update-begin---author:wangshuai ---date:20220104 for[JTC-297]已冻结用户仍可设置为代理人------------ //update-begin---author:wangshuai ---date:20220104 for[JTC-297]已冻结用户仍可设置为代理人------------
query.eq(SysUser::getStatus,Integer.parseInt(CommonConstant.STATUS_1)); query.eq(SysUser::getStatus,Integer.parseInt(CommonConstant.STATUS_1));
//update-end---author:wangshuai ---date:20220104 for[JTC-297]已冻结用户仍可设置为代理人------------ //update-end---author:wangshuai ---date:20220104 for[JTC-297]已冻结用户仍可设置为代理人------------
//update-begin---author:liusq ---date:20231215 for逗号分割多个用户翻译问题------------
if(oConvertUtils.isNotEmpty(username)){ if(oConvertUtils.isNotEmpty(username)){
query.like(SysUser::getUsername, username); String COMMA = ",";
if(oConvertUtils.isNotEmpty(isMultiTranslate) && username.contains(COMMA)){
String[] usernameArr = username.split(COMMA);
query.in(SysUser::getUsername,usernameArr);
}else {
query.like(SysUser::getUsername, username);
}
} }
//update-end---author:liusq ---date:20231215 for逗号分割多个用户翻译问题------------
//update-begin---author:wangshuai ---date:20220608 for[VUEN-1238]邮箱回复时发送到显示的为用户id------------ //update-begin---author:wangshuai ---date:20220608 for[VUEN-1238]邮箱回复时发送到显示的为用户id------------
if(oConvertUtils.isNotEmpty(id)){ if(oConvertUtils.isNotEmpty(id)){
query.eq(SysUser::getId, id); query.eq(SysUser::getId, id);

@ -26,6 +26,7 @@ import org.jeecg.common.constant.enums.MessageTypeEnum;
import org.jeecg.common.constant.enums.RoleIndexConfigEnum; import org.jeecg.common.constant.enums.RoleIndexConfigEnum;
import org.jeecg.common.desensitization.annotation.SensitiveEncode; import org.jeecg.common.desensitization.annotation.SensitiveEncode;
import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.system.vo.SysUserCacheInfo; import org.jeecg.common.system.vo.SysUserCacheInfo;
import org.jeecg.common.util.*; import org.jeecg.common.util.*;
@ -40,9 +41,9 @@ import org.jeecg.modules.system.service.ISysUserService;
import org.jeecg.modules.system.vo.SysUserDepVo; import org.jeecg.modules.system.vo.SysUserDepVo;
import org.jeecg.modules.system.vo.SysUserPositionVo; import org.jeecg.modules.system.vo.SysUserPositionVo;
import org.jeecg.modules.system.vo.UserAvatar; import org.jeecg.modules.system.vo.UserAvatar;
import org.jeecg.modules.system.vo.lowapp.AppExportUserVo;
import org.jeecg.modules.system.vo.lowapp.DepartAndUserInfo; import org.jeecg.modules.system.vo.lowapp.DepartAndUserInfo;
import org.jeecg.modules.system.vo.lowapp.DepartInfo; import org.jeecg.modules.system.vo.lowapp.DepartInfo;
import org.jeecg.modules.system.vo.lowapp.AppExportUserVo;
import org.jeecg.modules.system.vo.lowapp.UpdateDepartInfo; import org.jeecg.modules.system.vo.lowapp.UpdateDepartInfo;
import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.def.NormalExcelConstants;
@ -100,13 +101,13 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
@Autowired @Autowired
private SysThirdAccountMapper sysThirdAccountMapper; private SysThirdAccountMapper sysThirdAccountMapper;
@Autowired @Autowired
ThirdAppWechatEnterpriseServiceImpl wechatEnterpriseService; ThirdAppWechatEnterpriseServiceImpl wechatEnterpriseService;
@Autowired @Autowired
ThirdAppDingtalkServiceImpl dingtalkService; ThirdAppDingtalkServiceImpl dingtalkService;
@Autowired @Autowired
SysRoleIndexMapper sysRoleIndexMapper; SysRoleIndexMapper sysRoleIndexMapper;
@Autowired @Autowired
SysTenantMapper sysTenantMapper; SysTenantMapper sysTenantMapper;
@Autowired @Autowired
private SysUserTenantMapper relationMapper; private SysUserTenantMapper relationMapper;
@Autowired @Autowired
@ -117,6 +118,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
private SysPositionMapper sysPositionMapper; private SysPositionMapper sysPositionMapper;
@Autowired @Autowired
private SystemSendMsgHandle systemSendMsgHandle; private SystemSendMsgHandle systemSendMsgHandle;
@Autowired @Autowired
private ISysThirdAccountService sysThirdAccountService; private ISysThirdAccountService sysThirdAccountService;
@ -831,6 +833,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
SysUserTenant userTenant = new SysUserTenant(); SysUserTenant userTenant = new SysUserTenant();
userTenant.setStatus(CommonConstant.USER_TENANT_QUIT); userTenant.setStatus(CommonConstant.USER_TENANT_QUIT);
userTenantMapper.update(userTenant,query); userTenantMapper.update(userTenant,query);
//update-end---author:wangshuai ---date:20230111 for[QQYUN-3951]租户用户离职重构------------
} }
@Override @Override

@ -15,6 +15,7 @@ import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.system.entity.SysTenant; import org.jeecg.modules.system.entity.SysTenant;
import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.entity.SysUserTenant; import org.jeecg.modules.system.entity.SysUserTenant;
import org.jeecg.modules.system.mapper.SysTenantPackUserMapper;
import org.jeecg.modules.system.mapper.SysUserMapper; import org.jeecg.modules.system.mapper.SysUserMapper;
import org.jeecg.modules.system.mapper.SysUserPositionMapper; import org.jeecg.modules.system.mapper.SysUserPositionMapper;
import org.jeecg.modules.system.mapper.SysUserTenantMapper; import org.jeecg.modules.system.mapper.SysUserTenantMapper;
@ -53,6 +54,9 @@ public class SysUserTenantServiceImpl extends ServiceImpl<SysUserTenantMapper, S
@Autowired @Autowired
private SysUserPositionMapper userPositionMapper; private SysUserPositionMapper userPositionMapper;
@Autowired
private SysTenantPackUserMapper packUserMapper;
@Override @Override
public Page<SysUser> getPageUserList(Page<SysUser> page, Integer userTenantId, SysUser user) { public Page<SysUser> getPageUserList(Page<SysUser> page, Integer userTenantId, SysUser user) {
return page.setRecords(userTenantMapper.getPageUserList(page,userTenantId,user)); return page.setRecords(userTenantMapper.getPageUserList(page,userTenantId,user));
@ -162,7 +166,6 @@ public class SysUserTenantServiceImpl extends ServiceImpl<SysUserTenantMapper, S
return userTenantMapper.userTenantIzExist(userId,tenantId); return userTenantMapper.userTenantIzExist(userId,tenantId);
} }
@Override @Override
public IPage<SysTenant> getTenantPageListByUserId(Page<SysTenant> page, String userId, List<String> userTenantStatus,SysUserTenantVo sysUserTenantVo) { public IPage<SysTenant> getTenantPageListByUserId(Page<SysTenant> page, String userId, List<String> userTenantStatus,SysUserTenantVo sysUserTenantVo) {
return page.setRecords(userTenantMapper.getTenantPageListByUserId(page,userId,userTenantStatus,sysUserTenantVo)); return page.setRecords(userTenantMapper.getTenantPageListByUserId(page,userId,userTenantStatus,sysUserTenantVo));
@ -183,4 +186,9 @@ public class SysUserTenantServiceImpl extends ServiceImpl<SysUserTenantMapper, S
public SysUserTenant getUserTenantByTenantId(String userId, Integer tenantId) { public SysUserTenant getUserTenantByTenantId(String userId, Integer tenantId) {
return userTenantMapper.getUserTenantByTenantId(userId,tenantId); return userTenantMapper.getUserTenantByTenantId(userId,tenantId);
} }
@Override
public Long getUserCount(Integer tenantId, String tenantStatus) {
return userTenantMapper.getUserCount(tenantId,tenantStatus);
}
} }

@ -0,0 +1,46 @@
package org.jeecg.modules.system.vo;
import lombok.Data;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
@Data
public class SysDepartExportVo {
/**部门路径*/
@Excel(name="部门路径",width=50)
private String departNameUrl;
/**机构/部门名称*/
@Excel(name="部门名称",width=50)
private String departName;
/**id*/
private String id;
/**父级id*/
private String parentId;
/**英文名*/
@Excel(name="英文名",width=15)
private String departNameEn;
/**排序*/
@Excel(name="排序",width=15)
private Integer departOrder;
/**描述*/
@Excel(name="描述",width=15)
private String description;
/**机构类别 1=公司2=组织机构3=岗位*/
@Excel(name="机构类别",width=15,dicCode="org_category")
private String orgCategory;
/**机构编码*/
@Excel(name="机构编码",width=15)
private String orgCode;
/**手机号*/
@Excel(name="手机号",width=15)
private String mobile;
/**传真*/
@Excel(name="传真",width=15)
private String fax;
/**地址*/
@Excel(name="地址",width=15)
private String address;
/**备注*/
@Excel(name="备注",width=15)
private String memo;
}

@ -102,4 +102,14 @@ public class SysUserTenantVo {
* *
*/ */
private String houseNumber; private String houseNumber;
/**
*
*/
private String memberType;
/**
*
*/
private Boolean tenantAdmin = false;
} }

@ -24,6 +24,24 @@
<artifactId>jeecg-module-demo</artifactId> <artifactId>jeecg-module-demo</artifactId>
<version>${jeecgboot.version}</version> <version>${jeecgboot.version}</version>
</dependency> </dependency>
<!--人大金仓-->
<dependency>
<groupId>org.jeecgframework</groupId>
<artifactId>kingbase8</artifactId>
<version>9.0.0</version>
<scope>runtime</scope>
</dependency>
<!--达梦数据库 -->
<dependency>
<groupId>com.dameng</groupId>
<artifactId>Dm8JdbcDriver18</artifactId>
<version>${dm8.version}</version>
</dependency>
<dependency>
<groupId>com.dameng</groupId>
<artifactId>DmDialect-for-hibernate5.0</artifactId>
<version>${dm8.version}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

@ -4,6 +4,7 @@ import org.jeecgframework.codegenerate.window.CodeWindow;
/** /**
* @Title: * @Title:
* GUI使Online
* @Author * @Author
* @site www.jeecg.com * @site www.jeecg.com
* @Version:V1.0.1 * @Version:V1.0.1

@ -9,6 +9,8 @@ import org.jeecgframework.codegenerate.generate.pojo.onetomany.SubTableVo;
/** /**
* *
*
* GUI使Online
* @Author * @Author
* @site www.jeecg.com * @site www.jeecg.com
* *

@ -26,7 +26,7 @@ spring:
max-request-size: 10MB max-request-size: 10MB
mail: mail:
host: smtp.163.com host: smtp.163.com
username: ?? username: jeecgos@163.com
password: ?? password: ??
properties: properties:
mail: mail:
@ -191,7 +191,7 @@ jeecg:
#webapp文件路径 #webapp文件路径
webapp: /opt/jeecg-boot/webapp webapp: /opt/jeecg-boot/webapp
shiro: shiro:
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/jmreport/bigscreen2/**,/api/getUserInfo excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/bigscreen/category/**,/bigscreen/visual/**,/bigscreen/map/**,/jmreport/bigscreen2/**,/api/getUserInfo
#阿里云oss存储和大鱼短信秘钥配置 #阿里云oss存储和大鱼短信秘钥配置
oss: oss:
accessKey: ?? accessKey: ??

@ -191,7 +191,7 @@ jeecg:
#webapp文件路径 #webapp文件路径
webapp: D://opt//webapp webapp: D://opt//webapp
shiro: shiro:
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/jmreport/bigscreen2/** excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/bigscreen/category/**,/bigscreen/visual/**,/bigscreen/map/**,/jmreport/bigscreen2/**
#阿里云oss存储和大鱼短信秘钥配置 #阿里云oss存储和大鱼短信秘钥配置
oss: oss:
accessKey: ?? accessKey: ??

@ -45,4 +45,11 @@ public class TestStr {
System.out.println("值: " + StringUtils.join(valArray, ",")); System.out.println("值: " + StringUtils.join(valArray, ","));
} }
@Test
public void testSql() {
String sql = "select * from sys_user where sex = ${sex}";
sql = sql.replaceAll("'?\\$\\{sex}'?","1");
System.out.println(sql);
}
} }

@ -4,7 +4,7 @@
<artifactId>jeecg-boot-parent</artifactId> <artifactId>jeecg-boot-parent</artifactId>
<version>3.6.1</version> <version>3.6.1</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>JEECG BOOT ${project.version} </name> <name>JEECG BOOT ${project.version}</name>
<developers> <developers>
<developer> <developer>
@ -48,6 +48,8 @@
<sqljdbc4.version>4.0</sqljdbc4.version> <sqljdbc4.version>4.0</sqljdbc4.version>
<mysql-connector-java.version>8.0.27</mysql-connector-java.version> <mysql-connector-java.version>8.0.27</mysql-connector-java.version>
<hutool.version>5.8.23</hutool.version> <hutool.version>5.8.23</hutool.version>
<!-- 国产数据库驱动 -->
<dm8.version>8.1.1.49</dm8.version>
<!-- 持久层 --> <!-- 持久层 -->
<mybatis-plus.version>3.5.3.1</mybatis-plus.version> <mybatis-plus.version>3.5.3.1</mybatis-plus.version>
@ -161,7 +163,6 @@
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.seata</groupId> <groupId>io.seata</groupId>
<artifactId>seata-spring-boot-starter</artifactId> <artifactId>seata-spring-boot-starter</artifactId>
@ -399,8 +400,8 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<configuration> <configuration>
<source>1.8</source> <source>${java.version}</source>
<target>1.8</target> <target>${java.version}</target>
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
</configuration> </configuration>
</plugin> </plugin>

Loading…
Cancel
Save