1:修改证书策略中的crl字段的默认值为null

2:将redis存放文件时key的前缀提取到配置文件中方便后期修改
This commit is contained in:
renkaige
2018-10-10 17:28:50 +08:00
parent a57913f158
commit 5b0259fa5d
4 changed files with 79 additions and 48 deletions

View File

@@ -13,14 +13,15 @@ import com.nis.restful.ServiceRuntimeException;
import redis.clients.jedis.Transaction;
public class File2Redis {
private static String fileProtocol = Configurations.getStringProperty("fileProtocol", "minio://");
public static String file2Redis(String url, Transaction transaction) {
try {
byte[] fileByte = downLoadFromUrl(url);
String md5 = MD5Utils.getMd5ByIS(new ByteArrayInputStream(fileByte));
String key = "redis://_FILE_" + md5;
String key = "__FILE_" + md5;
transaction.set(key.getBytes(), fileByte);
return key;
return fileProtocol + key;
} catch (Exception e) {
throw new ServiceRuntimeException("保存文件到redis发生了异常:" + e.getMessage(),
RestBusinessCode.SaveFileToRedisError.getValue());
@@ -46,5 +47,4 @@ public class File2Redis {
return baosOutputStream.toByteArray();
}
}