1:修改证书策略中的crl字段的默认值为null
2:将redis存放文件时key的前缀提取到配置文件中方便后期修改
This commit is contained in:
@@ -13,14 +13,15 @@ import com.nis.restful.ServiceRuntimeException;
|
|||||||
import redis.clients.jedis.Transaction;
|
import redis.clients.jedis.Transaction;
|
||||||
|
|
||||||
public class File2Redis {
|
public class File2Redis {
|
||||||
|
private static String fileProtocol = Configurations.getStringProperty("fileProtocol", "minio://");
|
||||||
|
|
||||||
public static String file2Redis(String url, Transaction transaction) {
|
public static String file2Redis(String url, Transaction transaction) {
|
||||||
try {
|
try {
|
||||||
byte[] fileByte = downLoadFromUrl(url);
|
byte[] fileByte = downLoadFromUrl(url);
|
||||||
String md5 = MD5Utils.getMd5ByIS(new ByteArrayInputStream(fileByte));
|
String md5 = MD5Utils.getMd5ByIS(new ByteArrayInputStream(fileByte));
|
||||||
String key = "redis://_FILE_" + md5;
|
String key = "__FILE_" + md5;
|
||||||
transaction.set(key.getBytes(), fileByte);
|
transaction.set(key.getBytes(), fileByte);
|
||||||
return key;
|
return fileProtocol + key;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ServiceRuntimeException("保存文件到redis发生了异常:" + e.getMessage(),
|
throw new ServiceRuntimeException("保存文件到redis发生了异常:" + e.getMessage(),
|
||||||
RestBusinessCode.SaveFileToRedisError.getValue());
|
RestBusinessCode.SaveFileToRedisError.getValue());
|
||||||
@@ -46,5 +47,4 @@ public class File2Redis {
|
|||||||
return baosOutputStream.toByteArray();
|
return baosOutputStream.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,8 +113,10 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
if (valStr.contains("redisFile_")) {
|
if (valStr.contains("redisFile_")) {
|
||||||
String key = File2Redis.file2Redis(map.get(valStr), transaction);
|
String key = File2Redis.file2Redis(map.get(valStr),
|
||||||
logger.info("向{}号redis数据库添加了一条文件配置,key是{}",redisDBIndex,key);
|
transaction);
|
||||||
|
logger.info("向{}号redis数据库添加了一条文件配置,key是{}", redisDBIndex,
|
||||||
|
key);
|
||||||
valBF.append(key);
|
valBF.append(key);
|
||||||
// valBF.append("\t");
|
// valBF.append("\t");
|
||||||
} else {
|
} else {
|
||||||
@@ -287,6 +289,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
* 单独找一个redis-db记录配置信息,方便实时统计程序获取所有配置的分类性质,标签等内容,(为什么实时统计不从配置库redisdb获取呢,
|
* 单独找一个redis-db记录配置信息,方便实时统计程序获取所有配置的分类性质,标签等内容,(为什么实时统计不从配置库redisdb获取呢,
|
||||||
* 因为配置有多分发的情况,会发送到不同的redisdb,每个redisdb的配置条数不一定相同,有的配置所有的redisdb都有,有的只在某一个redisdb中有,实时统计程序不好获取配置这些配置内容,
|
* 因为配置有多分发的情况,会发送到不同的redisdb,每个redisdb的配置条数不一定相同,有的配置所有的redisdb都有,有的只在某一个redisdb中有,实时统计程序不好获取配置这些配置内容,
|
||||||
* 最重要的是,前端机不需要这些属性,所以在配置库有可能不带分类性质,标签等属性,maat.xml如果配置了则有,没有配置则就没有这些属性.所以单独找一个reidsdb存放带分类性质,标签等属性的配置)
|
* 最重要的是,前端机不需要这些属性,所以在配置库有可能不带分类性质,标签等属性,maat.xml如果配置了则有,没有配置则就没有这些属性.所以单独找一个reidsdb存放带分类性质,标签等属性的配置)
|
||||||
|
*
|
||||||
* @param configMap
|
* @param configMap
|
||||||
*/
|
*/
|
||||||
private void addStatisticsReal(Map<Integer, List<MaatConfig>> configMap, Transaction transaction) {
|
private void addStatisticsReal(Map<Integer, List<MaatConfig>> configMap, Transaction transaction) {
|
||||||
@@ -406,6 +409,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 封装组id与域id对应关系并添加到对象中
|
* 封装组id与域id对应关系并添加到对象中
|
||||||
|
*
|
||||||
* @param regionMapList
|
* @param regionMapList
|
||||||
* @param compileAndGroupRelations
|
* @param compileAndGroupRelations
|
||||||
*/
|
*/
|
||||||
@@ -544,6 +548,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 将编译,分组,域等配置拆开分别添加到redis中
|
* 将编译,分组,域等配置拆开分别添加到redis中
|
||||||
|
*
|
||||||
* @param maatConfig
|
* @param maatConfig
|
||||||
* @param maatXmlConfig
|
* @param maatXmlConfig
|
||||||
* @param maatVersion
|
* @param maatVersion
|
||||||
@@ -587,6 +592,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 将整理好的数据添加到redis中,如果是分组复用时,则去临时库将对应的域找到复制过来,如果当前库存在则不复制了(在复制就重复了)
|
* 将整理好的数据添加到redis中,如果是分组复用时,则去临时库将对应的域找到复制过来,如果当前库存在则不复制了(在复制就重复了)
|
||||||
|
*
|
||||||
* @param maatXmlConfig
|
* @param maatXmlConfig
|
||||||
* @param map
|
* @param map
|
||||||
* @param type
|
* @param type
|
||||||
@@ -595,7 +601,8 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
* @param redisTemplate
|
* @param redisTemplate
|
||||||
* @param redisDBIndex
|
* @param redisDBIndex
|
||||||
* @param compileId
|
* @param compileId
|
||||||
* @param isReuse 是否是分组复用
|
* @param isReuse
|
||||||
|
* 是否是分组复用
|
||||||
*/
|
*/
|
||||||
private void setCommonConfig(MaatXmlConfig maatXmlConfig, Map<String, String> map, int type, Double maatVersion,
|
private void setCommonConfig(MaatXmlConfig maatXmlConfig, Map<String, String> map, int type, Double maatVersion,
|
||||||
int service, Transaction transaction, Integer redisDBIndex, String compileId, boolean isReuse) {
|
int service, Transaction transaction, Integer redisDBIndex, String compileId, boolean isReuse) {
|
||||||
@@ -779,8 +786,8 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
for (Integer service : serviceConfigMap.keySet()) {
|
for (Integer service : serviceConfigMap.keySet()) {
|
||||||
List<Long> compileIdList = serviceConfigMap.get(service);
|
List<Long> compileIdList = serviceConfigMap.get(service);
|
||||||
if (compileIdList != null && compileIdList.size() > 0) {
|
if (compileIdList != null && compileIdList.size() > 0) {
|
||||||
for (Long id : compileIdList) {
|
|
||||||
MaatXmlConfig maatXmlConfig = ReadMaatXmlUtil.getMaatConfigByService(service);
|
MaatXmlConfig maatXmlConfig = ReadMaatXmlUtil.getMaatConfigByService(service);
|
||||||
|
for (Long id : compileIdList) {
|
||||||
if (maatXmlConfig != null) {
|
if (maatXmlConfig != null) {
|
||||||
List<MaatXmlExpr> expressionList = maatXmlConfig.getExpressionList();
|
List<MaatXmlExpr> expressionList = maatXmlConfig.getExpressionList();
|
||||||
String maatKey = null;
|
String maatKey = null;
|
||||||
@@ -1038,6 +1045,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取关联关系中每个关系中的-前部分
|
* 获取关联关系中每个关系中的-前部分
|
||||||
|
*
|
||||||
* @param compileStrVal
|
* @param compileStrVal
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -1051,12 +1059,18 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除maat类配置
|
* 删除maat类配置
|
||||||
* @param id 配置id
|
*
|
||||||
* @param maatXmlConfig maat.xml中关于当前业务类型的key和value写法的对象
|
* @param id
|
||||||
* @param maatVersion 版本号
|
* 配置id
|
||||||
* @param service 业务类型
|
* @param maatXmlConfig
|
||||||
|
* maat.xml中关于当前业务类型的key和value写法的对象
|
||||||
|
* @param maatVersion
|
||||||
|
* 版本号
|
||||||
|
* @param service
|
||||||
|
* 业务类型
|
||||||
* @param redisTemplate
|
* @param redisTemplate
|
||||||
* @param maatRelation id对应关系对象
|
* @param maatRelation
|
||||||
|
* id对应关系对象
|
||||||
*/
|
*/
|
||||||
private void removeConfig(Long id, MaatXmlConfig maatXmlConfig, Double maatVersion, int service,
|
private void removeConfig(Long id, MaatXmlConfig maatXmlConfig, Double maatVersion, int service,
|
||||||
Transaction transaction, int redisDBIndex, int idRelaRedisDBIndex) {
|
Transaction transaction, int redisDBIndex, int idRelaRedisDBIndex) {
|
||||||
@@ -1133,6 +1147,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除maat配置时,对redis进行相关操作,主要是重命名key和记录相关状态
|
* 删除maat配置时,对redis进行相关操作,主要是重命名key和记录相关状态
|
||||||
|
*
|
||||||
* @param maatXmlConfig
|
* @param maatXmlConfig
|
||||||
* @param idList
|
* @param idList
|
||||||
* @param type
|
* @param type
|
||||||
@@ -1200,6 +1215,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除域配置,重名key,记录相关信息MAAT_UPDATE_STATUS,MAAT_RULE_TIMER等
|
* 删除域配置,重名key,记录相关信息MAAT_UPDATE_STATUS,MAAT_RULE_TIMER等
|
||||||
|
*
|
||||||
* @param maatXmlConfig
|
* @param maatXmlConfig
|
||||||
* @param regionArr
|
* @param regionArr
|
||||||
* @param maatVersion
|
* @param maatVersion
|
||||||
@@ -1236,8 +1252,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编译配置用于实时统计
|
* 编译配置用于实时统计 取消分类性质,标签等信息
|
||||||
* 取消分类性质,标签等信息
|
|
||||||
*/
|
*/
|
||||||
private boolean removeStatisticsReal(Map<Integer, List<Long>> map, Transaction transaction) {
|
private boolean removeStatisticsReal(Map<Integer, List<Long>> map, Transaction transaction) {
|
||||||
if (map != null && map.size() > 0) {
|
if (map != null && map.size() > 0) {
|
||||||
@@ -1300,6 +1315,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除配置成功后,需要更新编译,组,域等配置id的对应关系
|
* 删除配置成功后,需要更新编译,组,域等配置id的对应关系
|
||||||
|
*
|
||||||
* @param idMap
|
* @param idMap
|
||||||
*/
|
*/
|
||||||
private boolean removeMaatRelation(Map<Integer, List<Long>> map, Transaction transaction) {
|
private boolean removeMaatRelation(Map<Integer, List<Long>> map, Transaction transaction) {
|
||||||
@@ -1593,6 +1609,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加分组和域的关联关系
|
* 添加分组和域的关联关系
|
||||||
|
*
|
||||||
* @param maatConfig
|
* @param maatConfig
|
||||||
* @param transaction
|
* @param transaction
|
||||||
* @param redisDBIndex
|
* @param redisDBIndex
|
||||||
@@ -1636,13 +1653,21 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存域配置信息,供分组复用单独添加域和普通maat配置添加域
|
* 保存域配置信息,供分组复用单独添加域和普通maat配置添加域
|
||||||
* @param maatConfig 配置信息
|
*
|
||||||
* @param maatXmlConfig 配置的表达式
|
* @param maatConfig
|
||||||
* @param maatVersion 版本号
|
* 配置信息
|
||||||
* @param service 业务类型
|
* @param maatXmlConfig
|
||||||
* @param transaction redis连接
|
* 配置的表达式
|
||||||
* @param redisDBIndex redis编号
|
* @param maatVersion
|
||||||
* @param isReuseSaveRegion 是否是分组复用单独添加域配置
|
* 版本号
|
||||||
|
* @param service
|
||||||
|
* 业务类型
|
||||||
|
* @param transaction
|
||||||
|
* redis连接
|
||||||
|
* @param redisDBIndex
|
||||||
|
* redis编号
|
||||||
|
* @param isReuseSaveRegion
|
||||||
|
* 是否是分组复用单独添加域配置
|
||||||
*/
|
*/
|
||||||
private Integer addRegion(MaatConfig maatConfig, MaatXmlConfig maatXmlConfig, Double maatVersion, int service,
|
private Integer addRegion(MaatConfig maatConfig, MaatXmlConfig maatXmlConfig, Double maatVersion, int service,
|
||||||
Transaction transaction, Integer redisDBIndex, boolean isReuseSaveRegion) {
|
Transaction transaction, Integer redisDBIndex, boolean isReuseSaveRegion) {
|
||||||
@@ -1716,6 +1741,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 从临时库删除分组复用域配置,如果该域被引用了,则去对应的redisdb中删除,并将关联库中记录的信息删除
|
* 从临时库删除分组复用域配置,如果该域被引用了,则去对应的redisdb中删除,并将关联库中记录的信息删除
|
||||||
|
*
|
||||||
* @param groupId
|
* @param groupId
|
||||||
* @param regionList
|
* @param regionList
|
||||||
* @param transaction
|
* @param transaction
|
||||||
@@ -1845,6 +1871,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加和删除时更新MAAT_*状态信息
|
* 添加和删除时更新MAAT_*状态信息
|
||||||
|
*
|
||||||
* @param list
|
* @param list
|
||||||
* @param maatKey
|
* @param maatKey
|
||||||
* @param transaction
|
* @param transaction
|
||||||
|
|||||||
@@ -146,7 +146,7 @@
|
|||||||
<t:field fieldType="String" srcName="publicKeyFile" dstName="public_key_file" isRequired="true"/>
|
<t:field fieldType="String" srcName="publicKeyFile" dstName="public_key_file" isRequired="true"/>
|
||||||
<t:field fieldType="String" srcName="expireAfter" dstName="expire_after" defaultVal="30" isRequired="true"/>
|
<t:field fieldType="String" srcName="expireAfter" dstName="expire_after" defaultVal="30" isRequired="true"/>
|
||||||
<t:field fieldType="String" srcName="publicKeyAlgo" dstName="public_key_algo" isRequired="true"/>
|
<t:field fieldType="String" srcName="publicKeyAlgo" dstName="public_key_algo" isRequired="true"/>
|
||||||
<t:field fieldType="String" srcName="crl" dstName="crl" defaultVal=""/>
|
<t:field fieldType="String" srcName="crl" dstName="crl" />
|
||||||
<t:field fieldType="Number" srcName="isValid" dstName="is_valid" isRequired="true" regexp="[1]"/>
|
<t:field fieldType="Number" srcName="isValid" dstName="is_valid" isRequired="true" regexp="[1]"/>
|
||||||
<t:field fieldType="Date" srcName="opTime" dstName="op_time" isRequired="true"/>
|
<t:field fieldType="Date" srcName="opTime" dstName="op_time" isRequired="true"/>
|
||||||
<t:field fieldType="String" srcName="privateKeyFile" dstName="redisFile_private_key_file" isRequired="true"/>
|
<t:field fieldType="String" srcName="privateKeyFile" dstName="redisFile_private_key_file" isRequired="true"/>
|
||||||
|
|||||||
@@ -205,3 +205,7 @@ mmSampleDstPath=/home/mesasoft/{tableType}/full/{fileName}
|
|||||||
syncRedisToClusterCron=0/10 * * * * ?
|
syncRedisToClusterCron=0/10 * * * * ?
|
||||||
#文件服务器是否使用Minio
|
#文件服务器是否使用Minio
|
||||||
isUseMinio=true
|
isUseMinio=true
|
||||||
|
|
||||||
|
|
||||||
|
##存储到redis中的文件类型(拼接的前缀)
|
||||||
|
fileProtocol=redis://
|
||||||
|
|||||||
Reference in New Issue
Block a user