小功能修改

pull/5734/head
zhangdaiscott 2023-12-29 19:41:44 +08:00
parent cfeb81ee1e
commit 69287a772b
66 changed files with 910 additions and 172 deletions

4
.gitignore vendored
View File

@ -9,4 +9,6 @@ rebel.xml
## front
**/*.lock
os_del.cmd
os_del.cmd
os_del_doc.cmd
.svn

View File

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

View File

@ -140,11 +140,15 @@ public class DictAspect {
String code = field.getAnnotation(Dict.class).dicCode();
String text = field.getAnnotation(Dict.class).dicText();
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;
String dictCode = code;
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<>());
this.listAddAllDeduplicate(dataList, Arrays.asList(value.split(",")));
@ -169,10 +173,15 @@ public class DictAspect {
String code = field.getAnnotation(Dict.class).dicCode();
String text = field.getAnnotation(Dict.class).dicText();
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;
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());
@ -274,9 +283,18 @@ public class DictAspect {
String[] arr = dictCode.split(",");
String table = arr[0], text = arr[1], code = arr[2];
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.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);
List<DictModel> list = translText.computeIfAbsent(dictCode, k -> new ArrayList<>());
list.addAll(texts);

View File

@ -39,4 +39,16 @@ public @interface Dict {
* @return String
*/
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]解决分布式下表字典跨库无法查询问题------------
}

View File

@ -69,6 +69,8 @@ public interface CommonConstant {
/** {@code 500 Server Error} (HTTP/1.0 - RFC 1945) */
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) */
Integer SC_OK_200 = 200;

View File

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

View File

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

View File

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

View File

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

View File

@ -29,6 +29,17 @@ public class SqlInjectionUtil {
* 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 |;|+|--";
/**
* key
*/
private static List<String> FULL_MATCHING_KEYWRODS = new ArrayList<>();
static {
FULL_MATCHING_KEYWRODS.add(";");
FULL_MATCHING_KEYWRODS.add("+");
FULL_MATCHING_KEYWRODS.add("--");
}
/**
* sql
*
@ -50,6 +61,8 @@ public class SqlInjectionUtil {
* sql
*/
private final static Pattern SQL_ANNOTATION = Pattern.compile("/\\*[\\s\\S]*\\*/");
private final static String SQL_ANNOTATION2 = "--";
/**
* sql
*/
@ -128,7 +141,13 @@ public class SqlInjectionUtil {
if (sql.startsWith(keyword.trim())) {
return true;
} 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;
} else {
String regularStr = "\\s+\\S+" + keyword;
@ -244,6 +263,13 @@ public class SqlInjectionUtil {
* @return
*/
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);
if(matcher.find()){
String error = "请注意值可能存在SQL注入风险---> \\*.*\\";
@ -260,7 +286,7 @@ public class SqlInjectionUtil {
*
* @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) {
if(oConvertUtils.isEmpty(table)){
return table;

View File

@ -61,6 +61,10 @@ public class SsrfFileTypeFilter {
FILE_TYPE_WHITE_LIST.add("7z");
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("3c3f7068700a0a2f2a2a0a202a205048", "php");

View File

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

View File

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

View File

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

View File

@ -56,7 +56,7 @@
</div>
<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;">
<span class="appleLinks">Copyright © 2023-2024 北京国炬科技股份有限公司. 保留所有权利。</span>
<span class="appleLinks">Copyright © 2023-2024 北京国炬信息技术有限公司. 保留所有权利。</span>
</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;">
<span class="appleLinks">邮件由系统自动发送,请勿直接回复本邮件!</span>

View File

@ -6,7 +6,10 @@
<body>
<div class="box-content">
<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 class="info-wrap">
<div class="tips" style="padding:15px;">
@ -23,12 +26,12 @@
<a style="color: #006eff;" href="${moreLink}" target="_blank" rel="noopener">[查看所有数据]</a>
</p>
</div>
<div class="footer">北京国炬平台</div>
<div class="footer">敲敲云平台</div>
<div class="footer" id="currentTime"></div>
</div>
<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;">
<span class="appleLinks">Copyright © 2023-2024 北京国炬科技股份有限公司. 保留所有权利。</span>
<span class="appleLinks">Copyright © 2023-2024 北京敲敲云科技有限公司. 保留所有权利。</span>
</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;">
<span class="appleLinks">邮件由系统自动发送,请勿直接回复本邮件!</span>
@ -46,6 +49,8 @@
}
.info-top{
display: flex;
align-items: center;
padding: 15px 25px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;

View File

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

View File

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

View File

@ -94,6 +94,22 @@ public interface ISysBaseAPI extends CommonAPI {
@GetMapping("/sys/api/getDepartIdsByUsername")
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
* @param username
@ -481,6 +497,14 @@ public interface ISysBaseAPI extends CommonAPI {
@GetMapping("/sys/api/loadCategoryDictItem")
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
*
@ -551,17 +575,20 @@ public interface ISysBaseAPI extends CommonAPI {
@GetMapping("/sys/api/translateManyDict")
Map<String, List<DictModel>> translateManyDict(@RequestParam("dictCodes") String dictCodes, @RequestParam("keys") String keys);
//update-begin---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
/**
* 49
* @param table
* @param text
* @param code
* @param keys
* @param ds
* @return
*/
@Override
@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]解决分布式下表字典跨库无法查询问题------------
/**
*

View File

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

View File

@ -89,6 +89,20 @@ public interface ISysBaseAPI extends CommonAPI {
*/
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
* @param username
@ -373,6 +387,13 @@ public interface ISysBaseAPI extends CommonAPI {
*/
List<String> loadCategoryDictItem(String ids);
/**
*
*
* @param names
*/
List<String> loadCategoryDictItemByNames(String names, boolean delNotExist);
/**
* codetext
*

View File

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

View File

@ -25,6 +25,7 @@ import org.jeecg.modules.system.model.SysDepartTreeModel;
import org.jeecg.modules.system.service.ISysDepartService;
import org.jeecg.modules.system.service.ISysUserDepartService;
import org.jeecg.modules.system.service.ISysUserService;
import org.jeecg.modules.system.vo.SysDepartExportVo;
import org.jeecg.modules.system.vo.lowapp.ExportDepartVo;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
@ -350,25 +351,34 @@ public class SysDepartController {
}
//------------------------------------------------------------------------------------------------
// Step.1 组装查询条件
QueryWrapper<SysDepart> queryWrapper = QueryGenerator.initQueryWrapper(sysDepart, request.getParameterMap());
//Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
List<SysDepart> pageList = sysDepartService.list(queryWrapper);
//update-begin---author:wangshuai---date:2023-10-19---for:【QQYUN-5482】系统的部门导入导出也可以改成敲敲云模式的部门路径---
//// Step.1 组装查询条件
//QueryWrapper<SysDepart> queryWrapper = QueryGenerator.initQueryWrapper(sysDepart, request.getParameterMap());
//Step.1 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
//List<SysDepart> pageList = sysDepartService.list(queryWrapper);
//按字典排序
Collections.sort(pageList, new Comparator<SysDepart>() {
@Override
public int compare(SysDepart arg0, SysDepart arg1) {
return arg0.getOrgCode().compareTo(arg1.getOrgCode());
}
});
//Collections.sort(pageList, new Comparator<SysDepart>() {
//@Override
//public int compare(SysDepart arg0, SysDepart arg1) {
//return arg0.getOrgCode().compareTo(arg1.getOrgCode());
//}
//});
//step.2 组装导出数据
List<SysDepartExportVo> sysDepartExportVos = sysDepartService.getExportDepart(sysDepart.getTenantId());
//导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "部门列表");
mv.addObject(NormalExcelConstants.CLASS, SysDepart.class);
mv.addObject(NormalExcelConstants.CLASS, SysDepartExportVo.class);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("部门列表数据", "导出人:"+user.getRealname(), "导出信息"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv;
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("导入规则:\n" +
"1、标题为第三行部门路径和部门名称的标题不允许修改否则会匹配失败第四行为数据填写范围;\n" +
"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) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
List<String> errorMessageList = new ArrayList<>();
List<SysDepart> listSysDeparts = null;
//List<SysDepart> listSysDeparts = null;
List<SysDepartExportVo> listSysDeparts = null;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
// 获取上传文件对象
@ -396,51 +407,59 @@ public class SysDepartController {
params.setHeadRows(1);
params.setNeedSave(true);
try {
// orgCode编码长度
int codeLength = YouBianCodeUtil.ZHANWEI_LENGTH;
listSysDeparts = ExcelImportUtil.importExcel(file.getInputStream(), SysDepart.class, params);
//按长度排序
Collections.sort(listSysDeparts, new Comparator<SysDepart>() {
@Override
public int compare(SysDepart arg0, SysDepart arg1) {
return arg0.getOrgCode().length() - arg1.getOrgCode().length();
}
});
int num = 0;
for (SysDepart sysDepart : listSysDeparts) {
String orgCode = sysDepart.getOrgCode();
if(orgCode.length() > codeLength) {
String parentCode = orgCode.substring(0, orgCode.length()-codeLength);
QueryWrapper<SysDepart> queryWrapper = new QueryWrapper<SysDepart>();
queryWrapper.eq("org_code", parentCode);
try {
SysDepart parentDept = sysDepartService.getOne(queryWrapper);
if(!parentDept.equals(null)) {
sysDepart.setParentId(parentDept.getId());
//更新父级部门不是叶子结点
sysDepartService.updateIzLeaf(parentDept.getId(),CommonConstant.NOT_LEAF);
} else {
sysDepart.setParentId("");
}
}catch (Exception e) {
//没有查找到parentDept
}
}else{
sysDepart.setParentId("");
}
//update-begin---author:liusq Date:20210223 for批量导入部门以后不能追加下一级部门 #2245------------
sysDepart.setOrgType(sysDepart.getOrgCode().length()/codeLength+"");
//update-end---author:liusq Date:20210223 for批量导入部门以后不能追加下一级部门 #2245------------
sysDepart.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
//update-begin---author:wangshuai ---date:20220105 for[JTC-363]部门导入 机构类别没有时导入失败,赋默认值------------
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);
num++;
}
//update-begin---author:wangshuai---date:2023-10-20---for: 注释掉原来的导入部门的逻辑---
// // orgCode编码长度
// int codeLength = YouBianCodeUtil.ZHANWEI_LENGTH;
// listSysDeparts = ExcelImportUtil.importExcel(file.getInputStream(), SysDepart.class, params);
// //按长度排序
// Collections.sort(listSysDeparts, new Comparator<SysDepart>() {
// @Override
// public int compare(SysDepart arg0, SysDepart arg1) {
// return arg0.getOrgCode().length() - arg1.getOrgCode().length();
// }
// });
//
// int num = 0;
// for (SysDepart sysDepart : listSysDeparts) {
// String orgCode = sysDepart.getOrgCode();
// if(orgCode.length() > codeLength) {
// String parentCode = orgCode.substring(0, orgCode.length()-codeLength);
// QueryWrapper<SysDepart> queryWrapper = new QueryWrapper<SysDepart>();
// queryWrapper.eq("org_code", parentCode);
// try {
// SysDepart parentDept = sysDepartService.getOne(queryWrapper);
// if(!parentDept.equals(null)) {
// sysDepart.setParentId(parentDept.getId());
// //更新父级部门不是叶子结点
// sysDepartService.updateIzLeaf(parentDept.getId(),CommonConstant.NOT_LEAF);
// } else {
// sysDepart.setParentId("");
// }
// }catch (Exception e) {
// //没有查找到parentDept
// }
// }else{
// sysDepart.setParentId("");
// }
// //update-begin---author:liusq Date:20210223 for批量导入部门以后不能追加下一级部门 #2245------------
// sysDepart.setOrgType(sysDepart.getOrgCode().length()/codeLength+"");
// //update-end---author:liusq Date:20210223 for批量导入部门以后不能追加下一级部门 #2245------------
// sysDepart.setDelFlag(CommonConstant.DEL_FLAG_0.toString());
// //update-begin---author:wangshuai ---date:20220105 for[JTC-363]部门导入 机构类别没有时导入失败,赋默认值------------
// 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);
// 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 keys4 = redisTemplate.keys(CacheConstant.SYS_DEPART_IDS_CACHE + "*");
@ -544,7 +563,7 @@ public class SysDepartController {
* @return
*/
@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<>();
String[] ids = deptIds.split(",");
Collection<String> idList = Arrays.asList(ids);

View File

@ -79,8 +79,8 @@ public class SysDepartRoleController extends JeecgController<SysDepartRole, ISys
HttpServletRequest req) {
QueryWrapper<SysDepartRole> queryWrapper = QueryGenerator.initQueryWrapper(sysDepartRole, req.getParameterMap());
Page<SysDepartRole> page = new Page<SysDepartRole>(pageNo, pageSize);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> deptIds = null;
// LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
// List<String> deptIds = null;
// if(oConvertUtils.isEmpty(deptId)){
// if(oConvertUtils.isNotEmpty(user.getUserIdentity()) && user.getUserIdentity().equals(CommonConstant.USER_IDENTITY_2) ){
// deptIds = sysDepartService.getMySubDepIdsByDepId(user.getDepartIds());
@ -93,7 +93,10 @@ public class SysDepartRoleController extends JeecgController<SysDepartRole, ISys
// 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);
return Result.ok(pageList);
}

View File

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

View File

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

View File

@ -437,12 +437,13 @@ public class SysUserController {
@RequestParam(name = "departId", required = false) String departId,
@RequestParam(name="realname",required=false) String realname,
@RequestParam(name="username",required=false) String username,
@RequestParam(name="isMultiTranslate",required=false) String isMultiTranslate,
@RequestParam(name="id",required = false) String id) {
//update-begin-author:taoyan date:2022-7-14 for: VUEN-1702【禁止问题】sql注入漏洞
String[] arr = new String[]{departId, realname, username, id};
SqlInjectionUtil.filterContent(arr, SymbolConstant.SINGLE_QUOTATION_MARK);
//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);
}
@ -568,7 +569,7 @@ public class SysUserController {
* @return
*/
@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<>();
String[] userId = userIds.split(",");
Collection<String> idList = Arrays.asList(userId);
@ -585,7 +586,7 @@ public class SysUserController {
* @return
*/
@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<>();
String[] names = userNames.split(",");
QueryWrapper<SysUser> queryWrapper=new QueryWrapper();

View File

@ -424,10 +424,6 @@ public class ThirdAppController {
@GetMapping("/getThirdConfigByTenantId")
public Result<SysThirdAppConfig> getThirdAppByTenantId(@RequestParam(name = "tenantId", required = false) Integer tenantId,
@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 (tenantId == null) {
return Result.error("开启多租户模式租户ID参数不允许为空");
@ -438,7 +434,9 @@ public class ThirdAppController {
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);
SysThirdAppConfig sysThirdAppConfig = appConfigService.getOne(query);
result.setSuccess(true);

View File

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

View File

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

View File

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

View File

@ -9,6 +9,7 @@ import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.model.SysDepartTreeModel;
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.lowapp.ExportDepartVo;
import org.springframework.data.repository.query.Param;
@ -161,4 +162,12 @@ public interface SysDepartMapper extends BaseMapper<SysDepart> {
* @return
*/
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);
}

View File

@ -119,5 +119,12 @@ public interface SysTenantMapper extends BaseMapper<SysTenant> {
* @return
*/
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);
}

View File

@ -25,4 +25,11 @@ public interface SysTenantPackUserMapper extends BaseMapper<SysTenantPackUser> {
@InterceptorIgnore(tenantLine = "true")
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);
}

View File

@ -3,6 +3,7 @@ package org.jeecg.modules.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.system.entity.SysThirdAccount;
import org.jeecg.modules.system.vo.thirdapp.JwUserDepartVo;
import java.util.List;
@ -22,5 +23,12 @@ public interface SysThirdAccountMapper extends BaseMapper<SysThirdAccount> {
* @return
*/
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);
}

View File

@ -1,17 +1,17 @@
package org.jeecg.modules.system.mapper;
import java.util.List;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.system.entity.SysUser;
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 java.util.List;
/**
* @Description:
* @Author: jeecg-boot
@ -66,7 +66,7 @@ public interface SysUserPositionMapper extends BaseMapper<SysUserPosition> {
* @return
*/
@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

View File

@ -12,6 +12,7 @@ import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.entity.SysUserTenant;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.system.vo.SysUserTenantVo;
import org.jeecg.modules.system.vo.thirdapp.JwUserDepartVo;
/**
* @Description: sys_user_tenant_relation
@ -149,4 +150,20 @@ public interface SysUserTenantMapper extends BaseMapper<SysUserTenant> {
* @param 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);
}

View File

@ -33,7 +33,7 @@
<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'
and del_flag = '0'
and msg_category = #{msgCategory}

View File

@ -114,7 +114,9 @@
SELECT id,depart_name,org_code,parent_id FROM sys_depart
where
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 != ''">
and parent_id = #{parentId}
</if>
@ -154,4 +156,24 @@
</foreach>
)
</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>

View File

@ -43,6 +43,7 @@
<select id="queryTenantPackUserCount" resultType="org.jeecg.modules.system.vo.tenant.TenantPackUserCount">
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_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}
and a.pack_code in ('superAdmin', 'accountAdmin', 'appAdmin')
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
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_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
and c.del_flag = 0
and b.status = #{packUserStatus}

View File

@ -15,4 +15,12 @@
)
</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>

View File

@ -14,5 +14,14 @@
<!-- TODO in 查询数据量大的时候可能会报错 -->
<foreach collection="sysUsernameArr" item="item" open=" sys_user.username IN (" close=")" separator=",">#{item}</foreach>
</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>

View File

@ -39,9 +39,10 @@
<!--通过用户id获取租户列表-->
<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
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
AND st.del_flag = 0
AND sut.user_id = #{userId}
@ -164,4 +165,22 @@
#{tenantId}
</foreach>
</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>

View File

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

View File

@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
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.SysDepartTreeModel;
import org.jeecg.modules.system.vo.SysDepartExportVo;
import org.jeecg.modules.system.vo.lowapp.ExportDepartVo;
import javax.servlet.http.HttpServletRequest;
@ -215,5 +217,18 @@ public interface ISysDepartService extends IService<SysDepart>{
List<ExportDepartVo> getExcelDepart(int tenantId);
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);
}

View File

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

View File

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

View File

@ -51,9 +51,10 @@ public interface ISysUserDepartService extends IService<SysUserDepart> {
* @param pageNo
* @param realname
* @param id
* @param isMultiTranslate
* @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);
/**
*

View File

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

View File

@ -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.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.vo.LoginUser;
@ -61,7 +62,12 @@ public class SysAnnouncementServiceImpl extends ServiceImpl<SysAnnouncementMappe
sysAnnouncementMapper.insert(sysAnnouncement);
// 2.插入用户通告阅读标记表记录
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();
Date refDate = new Date();
for(int i=0;i<userIds.length;i++) {

View File

@ -34,7 +34,8 @@ import org.jeecg.common.system.query.QueryCondition;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.query.QueryRuleEnum;
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.oConvertUtils;
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.ui.freemarker.FreeMarkerTemplateUtils;
import org.springframework.util.AntPathMatcher;
import org.springframework.util.CollectionUtils;
import org.springframework.util.PathMatcher;
import javax.annotation.Resource;
@ -323,6 +325,30 @@ public class SysBaseApiImpl implements ISysBaseAPI {
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
public List<String> getDepartNamesByUsername(String username) {
List<SysDepart> list = sysDepartService.queryDepartsByUsername(username);
@ -1388,6 +1414,11 @@ public class SysBaseApiImpl implements ISysBaseAPI {
return sysCategoryService.loadDictItem(ids, false);
}
@Override
public List<String> loadCategoryDictItemByNames(String names, boolean delNotExist) {
return sysCategoryService.loadDictItemByNames(names, delNotExist);
}
/**
* codetext
*
@ -1461,13 +1492,17 @@ public class SysBaseApiImpl implements ISysBaseAPI {
public Map<String, List<DictModel>> translateManyDict(String dictCodes, String keys) {
List<String> dictCodeList = Arrays.asList(dictCodes.split(","));
List<String> values = Arrays.asList(keys.split(","));
//update-begin---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
return sysDictService.queryManyDictByKeys(dictCodeList, values);
//update-end---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
}
//update-begin---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
@Override
public List<DictModel> translateDictFromTableByKeys(String table, String text, String code, String keys) {
return sysDictService.queryTableDictTextByKeys(table, text, code, Arrays.asList(keys.split(",")));
public List<DictModel> translateDictFromTableByKeys(String table, String text, String code, String keys, String dataSource) {
return sysDictService.queryTableDictTextByKeys(table, text, code, Arrays.asList(keys.split(",")), dataSource);
}
//update-end---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
//-------------------------------------流程节点发送模板消息-----------------------------------------------
@Autowired

View File

@ -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.UpdateWrapper;
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.SymbolConstant;
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.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -235,4 +231,22 @@ public class SysCategoryServiceImpl extends ServiceImpl<SysCategoryMapper, SysCa
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());
}
}

View File

@ -1,6 +1,7 @@
package org.jeecg.modules.system.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ArrayUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.service.ISysDepartService;
import org.jeecg.modules.system.util.FindsDepartsChildrenUtil;
import org.jeecg.modules.system.vo.SysDepartExportVo;
import org.jeecg.modules.system.vo.lowapp.ExportDepartVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -69,6 +70,11 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
//根据部门id获取所负责部门
LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>();
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++){
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.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);
//update-begin---author:wangshuai ---date:20220307 for[JTC-119]在部门管理菜单下设置部门负责人 创建用户的时候不需要处理
//新增部门的时候新增负责部门
@ -485,7 +499,10 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
//根据部门id查询所负责部门
LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>();
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多租户模式】
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 系统下部门与人员导入 ==================================================================
}

View File

@ -1,6 +1,7 @@
package org.jeecg.modules.system.service.impl;
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.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -326,15 +327,22 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
}
@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;
// 【QQYUN-6533】表字典白名单check
sysBaseAPI.dictTableWhiteListCheckByDict(table, text, code);
// 1.表字典黑名单check
if(!dictQueryBlackListHandler.isPass(str)){
log.error(dictQueryBlackListHandler.getError());
return null;
//update-begin---author:chenrui ---date:20231221 for[issues/#5643]解决分布式下表字典跨库无法查询问题------------
// 是否自定义数据源
boolean isCustomDataSource = oConvertUtils.isNotEmpty(dataSource);
// 如果是自定义数据源就不检查表字典白名单
if (!isCustomDataSource) {
// 【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获取表名和条件
String filterSql = null;
@ -352,8 +360,19 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
table = SqlInjectionUtil.getSqlInjectTableName(table);
text = SqlInjectionUtil.getSqlInjectField(text);
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条件
}

View File

@ -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
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;
// 部门ID不存在 直接查询用户表即可
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]已冻结用户仍可设置为代理人------------
query.eq(SysUser::getStatus,Integer.parseInt(CommonConstant.STATUS_1));
//update-end---author:wangshuai ---date:20220104 for[JTC-297]已冻结用户仍可设置为代理人------------
//update-begin---author:liusq ---date:20231215 for逗号分割多个用户翻译问题------------
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------------
if(oConvertUtils.isNotEmpty(id)){
query.eq(SysUser::getId, id);

View File

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

View File

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

View File

@ -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;
}

View File

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

View File

@ -24,6 +24,24 @@
<artifactId>jeecg-module-demo</artifactId>
<version>${jeecgboot.version}</version>
</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>
<build>

View File

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

View File

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

View File

@ -26,7 +26,7 @@ spring:
max-request-size: 10MB
mail:
host: smtp.163.com
username: ??
username: jeecgos@163.com
password: ??
properties:
mail:
@ -191,7 +191,7 @@ jeecg:
#webapp文件路径
webapp: /opt/jeecg-boot/webapp
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:
accessKey: ??

View File

@ -191,7 +191,7 @@ jeecg:
#webapp文件路径
webapp: D://opt//webapp
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:
accessKey: ??

View File

@ -44,5 +44,12 @@ public class TestStr {
valArray.add("qwe");
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);
}
}

11
pom.xml
View File

@ -4,7 +4,7 @@
<artifactId>jeecg-boot-parent</artifactId>
<version>3.6.1</version>
<packaging>pom</packaging>
<name>JEECG BOOT ${project.version} </name>
<name>JEECG BOOT ${project.version}</name>
<developers>
<developer>
@ -48,7 +48,9 @@
<sqljdbc4.version>4.0</sqljdbc4.version>
<mysql-connector-java.version>8.0.27</mysql-connector-java.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>
<dynamic-datasource-spring-boot-starter.version>4.1.3</dynamic-datasource-spring-boot-starter.version>
@ -161,7 +163,6 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-spring-boot-starter</artifactId>
@ -399,8 +400,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>