byd扫描漏洞。
This commit is contained in:
-10
@@ -110,16 +110,6 @@ public interface CommonAPI {
|
||||
*/
|
||||
Map<String, List<DictModel>> translateManyDict(String dictCodes, String keys);
|
||||
|
||||
/**
|
||||
* 15 字典表的 翻译,可批量
|
||||
* @param table
|
||||
* @param text
|
||||
* @param code
|
||||
* @param keys 多个用逗号分割
|
||||
* @return
|
||||
*/
|
||||
List<DictModel> translateDictFromTableByKeys(String table, String text, String code, String keys);
|
||||
|
||||
/**
|
||||
* 14获取全部字典
|
||||
* @author lqt
|
||||
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
package com.jero.common.constant.enums;
|
||||
|
||||
/**
|
||||
* 中英文切换标识
|
||||
* @description
|
||||
* @date 2022/1/21 15:22
|
||||
* @auth zhn
|
||||
*/
|
||||
public enum IsMustEnum {
|
||||
YES("是","1"),
|
||||
NO("否","0");
|
||||
|
||||
|
||||
String name;
|
||||
String value;
|
||||
|
||||
private IsMustEnum(String name, String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
package com.jero.common.constant.enums;
|
||||
|
||||
public enum MessageType2Enum {
|
||||
|
||||
|
||||
SUBSCRIPTION_NOTIFICATION("Subscription Notification","订阅通知"),
|
||||
SHARE_FORWARD("Share Forward","转发推送"),
|
||||
REGULATION_EARLY_WARNING("Regulation Early Warning","法规预警"),
|
||||
REGULATION_LIST_CONFIRMATION("Regulation List Confirmation","法规清单确认"),
|
||||
REGULATION_TASK_CONFIRMATION("Regulation Task Confirmation","法规任务确认"),
|
||||
DESIGN_COMPLIANCE_CONFIRMATION("Design Compliance Confirmation","设计符合性确认"),
|
||||
PRE_HOMO_CONFIRMATION("Pre-Homo Confirmation","Pre-Homo确认"),
|
||||
VALIDATION_COMPLIANCE_CONFIRMATION("Validation Compliance Confirmation","验证符合性确认"),
|
||||
REGULATION_OPINION_COLLECTION("Regulation Opinion Collection","法规意见收集"),
|
||||
REGULATION_TECHNICAL_ASSESSMENT("Regulation Technical Assessment","法规技术评估"),
|
||||
HOMO_PARAMETER_COLLECTION("Homo Parameter Collection","认证参数收集"),
|
||||
CERTIFICATION_LIST_CONFIRMATION("Certification List Confirmation","认证清单确认");
|
||||
|
||||
String en;
|
||||
String cn;
|
||||
|
||||
MessageType2Enum(String en, String cn) {
|
||||
this.en = en;
|
||||
this.cn = cn;
|
||||
}
|
||||
|
||||
public String getEn() {
|
||||
return en;
|
||||
}
|
||||
|
||||
public void setEn(String en) {
|
||||
this.en = en;
|
||||
}
|
||||
|
||||
public String getCn() {
|
||||
return cn;
|
||||
}
|
||||
|
||||
public void setCn(String cn) {
|
||||
this.cn = cn;
|
||||
}
|
||||
}
|
||||
-65
@@ -1,65 +0,0 @@
|
||||
package com.jero.common.constant.enums;
|
||||
|
||||
/**
|
||||
* @description
|
||||
* @date 2022/1/21 15:22
|
||||
* @auth zhn
|
||||
*/
|
||||
public enum MessageTypeEnum {
|
||||
READ("Subscription Notification","订阅通知","1"),
|
||||
WARN("Regulation Early Warning","法规预警","2"),
|
||||
PUSH("Share / Forward","转发推送","3"),
|
||||
HOMO_TASK("Homo Parameter Task","","4"),
|
||||
TASK("Regulation Compliance Task","", "5"),
|
||||
//REGULATION_LIST_CONFIRMATION_TASK("Regulation List Confirmation Task", "6"), // 清单确认任务
|
||||
//REGULATION_LIST_CONFIRMATION_NOTIFICATION("Regulation List Confirmation Notification", "7"), // 清单确认通知
|
||||
//REGULATION_TASK_CONFIRMATION_TASK("Regulation Task Confirmation", "8"), // 任务确认任务
|
||||
//REGULATION_TASK_CONFIRMATION_NOTIFICATION("Regulation Task Confirmation Notification", "15"), // 任务确认通知
|
||||
//DESIGN_COMPLIANCE_TASK("Design Compliance Task", "9"), // 设计符合性任务
|
||||
//PRE_HOMO_TASK("Pre-Homo Task", "10"), // Pre-Homo任务
|
||||
//VALIDATION_TASK("Validation Compliance Task", "11"), // 验证符合性任务
|
||||
//DESIGN_COMPLIANCE_NOTIFICATION("Design Compliance Notification", "12"), // 设计符合性通知
|
||||
//PRE_HOMO_NOTIFICATION("Pre-Homo Notification", "13"), // Pre-Homo通知
|
||||
//VALIDATION_COMPLIANCE_NOTIFICATION("Validation Compliance Notification", "14"), // 验证符合性通知
|
||||
SYSTEMATIC_NOTIFICATION("Systematic Notification","系统通知", "15"), // 系统通知
|
||||
LIST_CONFIRMATION("List Confirmation", "","17"), // 清单确认
|
||||
TASK_CONFIRMATION("Task Confirmation", "","18"), // 任务确认
|
||||
COMPLIANCE_CONFIRMATION("Compliance Confirmation","", "19"), // 符合性确认
|
||||
COLLECTION_OF_LEGISLATIVE_COMMENTS("Collection of Legislative Comments","", "20"), // 法规意见收集
|
||||
REGULATORY_AND_TECHNICAL_ASSESSMENT("Regulatory and technical assessment", "","21"), // 法规技术评估
|
||||
;
|
||||
|
||||
String name;
|
||||
String nameCn;
|
||||
String value;
|
||||
|
||||
private MessageTypeEnum(String name,String nameCn, String value) {
|
||||
this.name = name;
|
||||
this.nameCn = nameCn;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getNameCn() {
|
||||
return nameCn;
|
||||
}
|
||||
|
||||
public void setNameCn(String nameCn) {
|
||||
this.nameCn = nameCn;
|
||||
}
|
||||
}
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
package com.jero.common.constant.enums;
|
||||
|
||||
public enum MsgColorEnum {
|
||||
|
||||
GREEN("其他","green"),
|
||||
RED("任务被拒绝","red"),
|
||||
YELLOW("任务逾期","yellow");
|
||||
|
||||
String label;
|
||||
String value;
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
MsgColorEnum(String label, String value) {
|
||||
this.label = label;
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
-302
@@ -1,302 +0,0 @@
|
||||
package com.jero.common.util.dynamic.db;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.vo.DynamicDataSourceModel;
|
||||
import com.jero.common.util.ReflectHelper;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Spring JDBC 实时数据库访问
|
||||
*
|
||||
* @author chenguobin
|
||||
* @version 1.0
|
||||
* @date 2014-09-05
|
||||
*/
|
||||
@Slf4j
|
||||
public class DynamicDBUtil {
|
||||
|
||||
private DynamicDBUtil(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据源【最底层方法,不要随便调用】
|
||||
*
|
||||
* @param dbSource
|
||||
* @return
|
||||
*/
|
||||
private static DruidDataSource getJdbcDataSource(final DynamicDataSourceModel dbSource) {
|
||||
DruidDataSource dataSource = new DruidDataSource();
|
||||
|
||||
String driverClassName = dbSource.getDbDriver();
|
||||
String url = dbSource.getDbUrl();
|
||||
String dbUser = dbSource.getDbUsername();
|
||||
String dbPassword = dbSource.getDbPassword();
|
||||
dataSource.setDriverClassName(driverClassName);
|
||||
dataSource.setUrl(url);
|
||||
dataSource.setTestWhileIdle(true);
|
||||
dataSource.setTestOnBorrow(false);
|
||||
dataSource.setTestOnReturn(false);
|
||||
dataSource.setBreakAfterAcquireFailure(true);
|
||||
dataSource.setConnectionErrorRetryAttempts(0);
|
||||
dataSource.setUsername(dbUser);
|
||||
dataSource.setMaxWait(30000);
|
||||
dataSource.setPassword(dbPassword);
|
||||
|
||||
log.info("******************************************");
|
||||
log.info("* *");
|
||||
log.info("*====【"+dbSource.getCode()+"】=====Druid连接池已启用 ====*");
|
||||
log.info("* *");
|
||||
log.info("******************************************");
|
||||
return dataSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 dbKey ,获取数据源
|
||||
*
|
||||
* @param dbKey
|
||||
* @return
|
||||
*/
|
||||
public static DruidDataSource getDbSourceByDbKey(final String dbKey) {
|
||||
//获取多数据源配置
|
||||
DynamicDataSourceModel dbSource = DataSourceCachePool.getCacheDynamicDataSourceModel(dbKey);
|
||||
//先判断缓存中是否存在数据库链接
|
||||
DruidDataSource cacheDbSource = DataSourceCachePool.getCacheBasicDataSource(dbKey);
|
||||
if (cacheDbSource != null && !cacheDbSource.isClosed()) {
|
||||
log.debug("--------getDbSourceBydbKey------------------从缓存中获取DB连接-------------------");
|
||||
return cacheDbSource;
|
||||
} else {
|
||||
DruidDataSource dataSource = getJdbcDataSource(dbSource);
|
||||
if(dataSource.isEnable()){
|
||||
DataSourceCachePool.putCacheBasicDataSource(dbKey, dataSource);
|
||||
}else{
|
||||
throw new JeroBootException("动态数据源连接失败,dbKey:"+dbKey);
|
||||
}
|
||||
log.info("--------getDbSourceBydbKey------------------创建DB数据库连接-------------------");
|
||||
return dataSource;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭数据库连接池
|
||||
*
|
||||
* @param dbKey
|
||||
* @return
|
||||
*/
|
||||
public static void closeDbKey(final String dbKey) {
|
||||
DruidDataSource dataSource = getDbSourceByDbKey(dbKey);
|
||||
try {
|
||||
if (dataSource != null && !dataSource.isClosed()) {
|
||||
dataSource.getConnection().commit();
|
||||
dataSource.getConnection().close();
|
||||
dataSource.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static JdbcTemplate getJdbcTemplate(String dbKey) {
|
||||
DruidDataSource dataSource = getDbSourceByDbKey(dbKey);
|
||||
return new JdbcTemplate(dataSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the SQL statement in this <code>PreparedStatement</code> object,
|
||||
* which must be an SQL Data Manipulation Language (DML) statement, such as <code>INSERT</code>, <code>UPDATE</code> or
|
||||
* <code>DELETE</code>; or an SQL statement that returns nothing,
|
||||
* such as a DDL statement.
|
||||
*/
|
||||
public static int update(final String dbKey, String sql, Object... param) {
|
||||
int effectCount;
|
||||
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
|
||||
if (ArrayUtils.isEmpty(param)) {
|
||||
effectCount = jdbcTemplate.update(sql);
|
||||
} else {
|
||||
effectCount = jdbcTemplate.update(sql, param);
|
||||
}
|
||||
return effectCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 支持miniDao语法操作的Update
|
||||
*
|
||||
* @param dbKey 数据源标识
|
||||
* @param sql 执行sql语句,sql支持minidao语法逻辑
|
||||
* @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
|
||||
* @return
|
||||
*/
|
||||
public static int updateByHash(final String dbKey, String sql, Map<String, Object> data) {
|
||||
int effectCount;
|
||||
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
|
||||
//根据模板获取sql
|
||||
sql = FreemarkerParseFactory.parseTemplateContent(sql, data);
|
||||
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(Objects.requireNonNull(jdbcTemplate.getDataSource()));
|
||||
effectCount = namedParameterJdbcTemplate.update(sql, data);
|
||||
return effectCount;
|
||||
}
|
||||
|
||||
public static Object findOne(final String dbKey, String sql, Object... param) {
|
||||
List<Map<String, Object>> list;
|
||||
list = findList(dbKey, sql, param);
|
||||
if (oConvertUtils.listIsEmpty(list)) {
|
||||
log.error("Except one, but not find actually");
|
||||
return null;
|
||||
}
|
||||
if (list.size() > 1) {
|
||||
log.error("Except one, but more than one actually");
|
||||
}
|
||||
return list.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 支持miniDao语法操作的查询 返回HashMap
|
||||
*
|
||||
* @param dbKey 数据源标识
|
||||
* @param sql 执行sql语句,sql支持minidao语法逻辑
|
||||
* @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
|
||||
* @return
|
||||
*/
|
||||
public static Object findOneByHash(final String dbKey, String sql, Map<String, Object> data) {
|
||||
List<Map<String, Object>> list;
|
||||
list = findListByHash(dbKey, sql, data);
|
||||
if (oConvertUtils.listIsEmpty(list)) {
|
||||
log.error("Except one, but not find actually");
|
||||
}
|
||||
if (list.size() > 1) {
|
||||
log.error("Except one, but more than one actually");
|
||||
}
|
||||
return list.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 直接sql查询 根据clazz返回单个实例
|
||||
*
|
||||
* @param dbKey 数据源标识
|
||||
* @param sql 执行sql语句
|
||||
* @param clazz 返回实例的Class
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> Object findOne(final String dbKey, String sql, Class<T> clazz, Object... param) {
|
||||
Map<String, Object> map = (Map<String, Object>) findOne(dbKey, sql, param);
|
||||
return ReflectHelper.setAll(clazz, map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 支持miniDao语法操作的查询 返回单个实例
|
||||
*
|
||||
* @param dbKey 数据源标识
|
||||
* @param sql 执行sql语句,sql支持minidao语法逻辑
|
||||
* @param clazz 返回实例的Class
|
||||
* @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> Object findOneByHash(final String dbKey, String sql, Class<T> clazz, Map<String, Object> data) {
|
||||
Map<String, Object> map = (Map<String, Object>) findOneByHash(dbKey, sql, data);
|
||||
return ReflectHelper.setAll(clazz, map);
|
||||
}
|
||||
|
||||
public static List<Map<String, Object>> findList(final String dbKey, String sql, Object... param) {
|
||||
List<Map<String, Object>> list;
|
||||
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
|
||||
|
||||
if (ArrayUtils.isEmpty(param)) {
|
||||
list = jdbcTemplate.queryForList(sql);
|
||||
} else {
|
||||
list = jdbcTemplate.queryForList(sql, param);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 支持miniDao语法操作的查询
|
||||
*
|
||||
* @param dbKey 数据源标识
|
||||
* @param sql 执行sql语句,sql支持minidao语法逻辑
|
||||
* @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
|
||||
* @return
|
||||
*/
|
||||
public static List<Map<String, Object>> findListByHash(final String dbKey, String sql, Map<String, Object> data) {
|
||||
List<Map<String, Object>> list;
|
||||
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
|
||||
//根据模板获取sql
|
||||
sql = FreemarkerParseFactory.parseTemplateContent(sql, data);
|
||||
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(Objects.requireNonNull(jdbcTemplate.getDataSource()));
|
||||
list = namedParameterJdbcTemplate.queryForList(sql, data);
|
||||
return list;
|
||||
}
|
||||
|
||||
//此方法只能返回单列,不能返回实体类
|
||||
public static <T> List<T> findList(final String dbKey, String sql, Class<T> clazz, Object... param) {
|
||||
List<T> list;
|
||||
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
|
||||
|
||||
if (ArrayUtils.isEmpty(param)) {
|
||||
list = jdbcTemplate.queryForList(sql, clazz);
|
||||
} else {
|
||||
list = jdbcTemplate.queryForList(sql, clazz, param);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 支持miniDao语法操作的查询 返回单列数据list
|
||||
*
|
||||
* @param dbKey 数据源标识
|
||||
* @param sql 执行sql语句,sql支持minidao语法逻辑
|
||||
* @param clazz 类型Long、String等
|
||||
* @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
|
||||
* @return
|
||||
*/
|
||||
public static <T> List<T> findListByHash(final String dbKey, String sql, Class<T> clazz, Map<String, Object> data) {
|
||||
List<T> list;
|
||||
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
|
||||
//根据模板获取sql
|
||||
sql = FreemarkerParseFactory.parseTemplateContent(sql, data);
|
||||
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(Objects.requireNonNull(jdbcTemplate.getDataSource()));
|
||||
list = namedParameterJdbcTemplate.queryForList(sql, data, clazz);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 直接sql查询 返回实体类列表
|
||||
*
|
||||
* @param dbKey 数据源标识
|
||||
* @param sql 执行sql语句,sql支持 minidao 语法逻辑
|
||||
* @param clazz 返回实体类列表的class
|
||||
* @param param sql拼接注入中需要的数据
|
||||
* @return
|
||||
*/
|
||||
public static <T> List<T> findListEntities(final String dbKey, String sql, Class<T> clazz, Object... param) {
|
||||
List<Map<String, Object>> queryList = findList(dbKey, sql, param);
|
||||
return ReflectHelper.transList2Entrys(queryList, clazz);
|
||||
}
|
||||
|
||||
/**
|
||||
* 支持miniDao语法操作的查询 返回实体类列表
|
||||
*
|
||||
* @param dbKey 数据源标识
|
||||
* @param sql 执行sql语句,sql支持minidao语法逻辑
|
||||
* @param clazz 返回实体类列表的class
|
||||
* @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
|
||||
* @return
|
||||
*/
|
||||
public static <T> List<T> findListEntitiesByHash(final String dbKey, String sql, Class<T> clazz, Map<String, Object> data) {
|
||||
List<Map<String, Object>> queryList = findListByHash(dbKey, sql, data);
|
||||
return ReflectHelper.transList2Entrys(queryList, clazz);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user