1:添加对区域ip管控类域配置的支持
2:优化对数据的判断抛出相应的异常
This commit is contained in:
@@ -50,7 +50,7 @@ public class MaatConfig implements Serializable {
|
|||||||
private List<Map<String, String>> fileLikeRegionMapList;
|
private List<Map<String, String>> fileLikeRegionMapList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* 区域ip域配置
|
||||||
*/
|
*/
|
||||||
private List<Map<String, String>> ipClientRangeMapList;
|
private List<Map<String, String>> ipClientRangeMapList;
|
||||||
/**
|
/**
|
||||||
@@ -126,8 +126,7 @@ public class MaatConfig implements Serializable {
|
|||||||
return ipClientRangeMapList;
|
return ipClientRangeMapList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIpClientRangeMapList(
|
public void setIpClientRangeMapList(List<Map<String, String>> ipClientRangeMapList) {
|
||||||
List<Map<String, String>> ipClientRangeMapList) {
|
|
||||||
this.ipClientRangeMapList = ipClientRangeMapList;
|
this.ipClientRangeMapList = ipClientRangeMapList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -127,6 +127,8 @@ public class ReadMaatXmlUtil {
|
|||||||
maatXmlExpr.setType(16);
|
maatXmlExpr.setType(16);
|
||||||
} else if (ele.getTextTrim().contains("file_like_table_name")) {
|
} else if (ele.getTextTrim().contains("file_like_table_name")) {
|
||||||
maatXmlExpr.setType(17);
|
maatXmlExpr.setType(17);
|
||||||
|
} else if (ele.getTextTrim().contains("ip_client_range_table_name")) {
|
||||||
|
maatXmlExpr.setType(18);
|
||||||
} else {
|
} else {
|
||||||
maatXmlExpr.setType(0);
|
maatXmlExpr.setType(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -313,14 +313,14 @@ public class ConfigSourcesController extends BaseRestController {
|
|||||||
checkOpAction(thread, System.currentTimeMillis() - start, opAction, 2);
|
checkOpAction(thread, System.currentTimeMillis() - start, opAction, 2);
|
||||||
String msg = "";
|
String msg = "";
|
||||||
ConfigCompile compile = configSource.getConfigCompileList().get(0);
|
ConfigCompile compile = configSource.getConfigCompileList().get(0);
|
||||||
//zdx 20180528改为调用rkg接口取消配置
|
// zdx 20180528改为调用rkg接口取消配置
|
||||||
msg = configSourcesService.updateConfigSources(thread, start, configSource.getConfigCompileList(),
|
msg = configSourcesService.updateConfigSources(thread, start, configSource.getConfigCompileList(),
|
||||||
configSource.getOpTime(), sb);
|
configSource.getOpTime(), sb);
|
||||||
|
|
||||||
if (msg.equals("error")) {
|
if (msg.equals("error")) {
|
||||||
Exception exception = ConfigSourcesService.getMsgList().get(0);
|
Exception exception = ConfigSourcesService.getMsgList().get(0);
|
||||||
throw new RestServiceException(thread, System.currentTimeMillis() - start,
|
throw new RestServiceException(thread, System.currentTimeMillis() - start,
|
||||||
"修改编译配置状态时出现异常"+exception.getMessage(), RestBusinessCode.unknow_error.getValue());
|
"修改编译配置状态时出现异常" + exception.getMessage(), RestBusinessCode.unknow_error.getValue());
|
||||||
}
|
}
|
||||||
// configSourcesService.updateConfigSource(thread, start,
|
// configSourcesService.updateConfigSource(thread, start,
|
||||||
// configSource.getConfigCompileList(),
|
// configSource.getConfigCompileList(),
|
||||||
@@ -362,11 +362,12 @@ public class ConfigSourcesController extends BaseRestController {
|
|||||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "编译配置id不能为空",
|
throw new RestServiceException(thread, System.currentTimeMillis() - start, "编译配置id不能为空",
|
||||||
RestBusinessCode.missing_args.getValue());
|
RestBusinessCode.missing_args.getValue());
|
||||||
}
|
}
|
||||||
// if ((configCompile.getActiveSys() != null) || (configCompile.getEffectiveRange() != null
|
// if ((configCompile.getActiveSys() != null) ||
|
||||||
// && !configCompile.getEffectiveRange().equals(""))) {
|
// (configCompile.getEffectiveRange() != null
|
||||||
// count++;
|
// && !configCompile.getEffectiveRange().equals(""))) {
|
||||||
// configSourcesService.setCompileInvalid(configCompile);
|
// count++;
|
||||||
// }
|
// configSourcesService.setCompileInvalid(configCompile);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
Thread.sleep(14000);
|
Thread.sleep(14000);
|
||||||
@@ -394,33 +395,34 @@ public class ConfigSourcesController extends BaseRestController {
|
|||||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "编译配置id不能为空",
|
throw new RestServiceException(thread, System.currentTimeMillis() - start, "编译配置id不能为空",
|
||||||
RestBusinessCode.missing_args.getValue());
|
RestBusinessCode.missing_args.getValue());
|
||||||
}
|
}
|
||||||
// if ((configCompile.getActiveSys() != null) || (configCompile.getEffectiveRange() != null
|
// if ((configCompile.getActiveSys() != null) ||
|
||||||
// && !configCompile.getEffectiveRange().equals(""))) {
|
// (configCompile.getEffectiveRange() != null
|
||||||
// try {
|
// && !configCompile.getEffectiveRange().equals(""))) {
|
||||||
// configSourcesService.setCompileValid(configCompile);
|
// try {
|
||||||
// } catch (Exception e1) {
|
// configSourcesService.setCompileValid(configCompile);
|
||||||
// String errorCode = "";
|
// } catch (Exception e1) {
|
||||||
// String message = e.getMessage();
|
// String errorCode = "";
|
||||||
// if (null != message && message.length() > 0) {
|
// String message = e.getMessage();
|
||||||
// int index = message.toUpperCase().indexOf("ORA-");
|
// if (null != message && message.length() > 0) {
|
||||||
// if (index != -1) {
|
// int index = message.toUpperCase().indexOf("ORA-");
|
||||||
// errorCode = message.substring(index + 4, index + 9);
|
// if (index != -1) {
|
||||||
//
|
// errorCode = message.substring(index + 4, index + 9);
|
||||||
// }
|
//
|
||||||
// }
|
// }
|
||||||
// Map<Integer, String> throwExceptionInfo = OracleErrorCodeUtil
|
// }
|
||||||
// .throwExceptionInfo(errorCode);
|
// Map<Integer, String> throwExceptionInfo = OracleErrorCodeUtil
|
||||||
// for (int errorNum : throwExceptionInfo.keySet()) {
|
// .throwExceptionInfo(errorCode);
|
||||||
// if (errorNum == 998) {
|
// for (int errorNum : throwExceptionInfo.keySet()) {
|
||||||
// thread.setExceptionInfo(e.toString());
|
// if (errorNum == 998) {
|
||||||
// } else {
|
// thread.setExceptionInfo(e.toString());
|
||||||
// thread.setExceptionInfo(throwExceptionInfo.get(errorNum));
|
// } else {
|
||||||
// }
|
// thread.setExceptionInfo(throwExceptionInfo.get(errorNum));
|
||||||
// throw new RestServiceException(thread, System.currentTimeMillis() - start,
|
// }
|
||||||
// throwExceptionInfo.get(errorNum), errorNum);
|
// throw new RestServiceException(thread, System.currentTimeMillis() - start,
|
||||||
// }
|
// throwExceptionInfo.get(errorNum), errorNum);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,23 +499,25 @@ public class ConfigSourcesController extends BaseRestController {
|
|||||||
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "配置数据插入成功",
|
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "配置数据插入成功",
|
||||||
Constants.IS_DEBUG ? jsonString : null);
|
Constants.IS_DEBUG ? jsonString : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/cfg/v1/commonSources", method = RequestMethod.PUT)
|
@RequestMapping(value = "/cfg/v1/commonSources", method = RequestMethod.PUT)
|
||||||
@ApiOperation(value = "回调配置状态修改", httpMethod = "PUT", response = Map.class, notes = "回调配置状态修改服务")
|
@ApiOperation(value = "回调配置状态修改", httpMethod = "PUT", response = Map.class, notes = "回调配置状态修改服务")
|
||||||
@ApiParam(value = "回调配置状态修改", name = "updateStatConfigSource", required = true)
|
@ApiParam(value = "回调配置状态修改", name = "updateStatConfigSource", required = true)
|
||||||
public Map updateCommonConfigSource(@RequestBody UpdateStatConfigSource updateStatConfigSource, HttpServletRequest request,
|
public Map updateCommonConfigSource(@RequestBody UpdateStatConfigSource updateStatConfigSource,
|
||||||
HttpServletResponse response) {
|
HttpServletRequest request, HttpServletResponse response) {
|
||||||
ConfigSourcesService.setMsgList(new ArrayList<Exception>());// 清除上次记录的日志信息
|
ConfigSourcesService.setMsgList(new ArrayList<Exception>());// 清除上次记录的日志信息
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_PUT, request,updateStatConfigSource);
|
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_PUT, request,
|
||||||
|
updateStatConfigSource);
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
|
|
||||||
configSourcesService.updateCommonSources(thread, start, updateStatConfigSource.getUpdateStatCfgList(), new Date(),sb);
|
|
||||||
|
|
||||||
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response,
|
configSourcesService.updateCommonSources(thread, start, updateStatConfigSource.getUpdateStatCfgList(),
|
||||||
"配置状态修改成功" , Constants.IS_DEBUG ? updateStatConfigSource : null);
|
new Date(), sb);
|
||||||
|
|
||||||
|
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "配置状态修改成功",
|
||||||
|
Constants.IS_DEBUG ? updateStatConfigSource : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/cfg/v1/fileUploadSources", method = RequestMethod.POST)
|
@RequestMapping(value = "/cfg/v1/fileUploadSources", method = RequestMethod.POST)
|
||||||
@ApiOperation(value = "样例文件上传服务", httpMethod = "POST", response = Map.class, notes = "样例文件上传服务")
|
@ApiOperation(value = "样例文件上传服务", httpMethod = "POST", response = Map.class, notes = "样例文件上传服务")
|
||||||
@ApiParam(value = "样例文件上传服务", name = "MultipartFile", required = true)
|
@ApiParam(value = "样例文件上传服务", name = "MultipartFile", required = true)
|
||||||
@@ -521,33 +525,37 @@ public class ConfigSourcesController extends BaseRestController {
|
|||||||
HttpServletResponse response) {
|
HttpServletResponse response) {
|
||||||
ConfigSourcesService.setMsgList(new ArrayList<Exception>());// 清除上次记录的日志信息
|
ConfigSourcesService.setMsgList(new ArrayList<Exception>());// 清除上次记录的日志信息
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request,null);
|
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request,
|
||||||
String filePath ="";
|
null);
|
||||||
|
String filePath = "";
|
||||||
try {
|
try {
|
||||||
FileDesc fileDesc = (FileDesc) JSONObject.toBean(JSONObject.fromObject(request.getHeader("File-Desc")),FileDesc.class);
|
FileDesc fileDesc = (FileDesc) JSONObject.toBean(JSONObject.fromObject(request.getHeader("File-Desc")),
|
||||||
if(null==file){
|
FileDesc.class);
|
||||||
|
if (null == file) {
|
||||||
thread.setExceptionInfo("请选择上传文件到file参数");
|
thread.setExceptionInfo("请选择上传文件到file参数");
|
||||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "请选择上传文件到file参数",
|
throw new RestServiceException(thread, System.currentTimeMillis() - start, "请选择上传文件到file参数",
|
||||||
RestBusinessCode.missing_args.getValue());
|
RestBusinessCode.missing_args.getValue());
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!StringUtil.isEmpty(fileDesc.getChecksum())) {
|
if (!StringUtil.isEmpty(fileDesc.getChecksum())) {
|
||||||
//验证Md5
|
// 验证Md5
|
||||||
String md5 = DigestUtils.md5Hex(file.getBytes());
|
String md5 = DigestUtils.md5Hex(file.getInputStream());
|
||||||
System.out.println("----------------------------MD5:'"+md5+"'==='"+fileDesc.getChecksum()+"'");
|
//String md5 = DigestUtils.md5Hex(file.getBytes());
|
||||||
|
System.out.println("----------------------------MD5:'" + md5 + "'==='" + fileDesc.getChecksum() + "'");
|
||||||
if (!md5.equals(fileDesc.getChecksum())) {
|
if (!md5.equals(fileDesc.getChecksum())) {
|
||||||
thread.setExceptionInfo("checksum与文件MD5值不一致");
|
thread.setExceptionInfo("checksum与文件MD5值不一致");
|
||||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "checksum与文件MD5值不一致",
|
throw new RestServiceException(thread, System.currentTimeMillis() - start, "checksum与文件MD5值不一致",
|
||||||
RestBusinessCode.config_integrity_error.getValue());
|
RestBusinessCode.config_integrity_error.getValue());
|
||||||
}
|
}
|
||||||
String ext = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1);
|
String ext = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1);
|
||||||
FastDFSFile fdsfile = new FastDFSFile(file.getBytes(),file.getOriginalFilename(), ext);
|
FastDFSFile fdsfile = new FastDFSFile(file.getBytes(), file.getOriginalFilename(), ext);
|
||||||
// NameValuePair[] meta_list = new NameValuePair[5];
|
// NameValuePair[] meta_list = new NameValuePair[5];
|
||||||
// meta_list[0] = new NameValuePair("fileName", file.getOriginalFilename());
|
// meta_list[0] = new NameValuePair("fileName", file.getOriginalFilename());
|
||||||
// meta_list[1] = new NameValuePair("fileLength", String.valueOf(file.getSize()));
|
// meta_list[1] = new NameValuePair("fileLength",
|
||||||
// meta_list[2] = new NameValuePair("fileExt", ext);
|
// String.valueOf(file.getSize()));
|
||||||
// meta_list[3] = new NameValuePair("fileAuthor", "rkg");
|
// meta_list[2] = new NameValuePair("fileExt", ext);
|
||||||
// meta_list[4] = new NameValuePair("fileMd5", md5);
|
// meta_list[3] = new NameValuePair("fileAuthor", "rkg");
|
||||||
|
// meta_list[4] = new NameValuePair("fileMd5", md5);
|
||||||
logger.info("-----------------调用接口上传文件---------------");
|
logger.info("-----------------调用接口上传文件---------------");
|
||||||
filePath = FileManager.upload(fdsfile, null);
|
filePath = FileManager.upload(fdsfile, null);
|
||||||
}
|
}
|
||||||
@@ -557,57 +565,58 @@ public class ConfigSourcesController extends BaseRestController {
|
|||||||
}
|
}
|
||||||
JSONObject jsonObj = new JSONObject();
|
JSONObject jsonObj = new JSONObject();
|
||||||
jsonObj.put("accessUrl", filePath.substring(filePath.indexOf("group")));
|
jsonObj.put("accessUrl", filePath.substring(filePath.indexOf("group")));
|
||||||
// jsonObj.put("accessUrl", "filePath");
|
// jsonObj.put("accessUrl", "filePath");
|
||||||
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response,
|
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "文件上传成功", jsonObj);
|
||||||
"文件上传成功" ,jsonObj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/cfg/v1/fileDigestSources", method = RequestMethod.POST)
|
@RequestMapping(value = "/cfg/v1/fileDigestSources", method = RequestMethod.POST)
|
||||||
@ApiOperation(value = "文件摘要获取", httpMethod = "POST", response = Map.class, notes = "文件摘要获取")
|
@ApiOperation(value = "文件摘要获取", httpMethod = "POST", response = Map.class, notes = "文件摘要获取")
|
||||||
@ApiParam(value = "摘要文件", name = "MultipartFile", required = true)
|
@ApiParam(value = "摘要文件", name = "MultipartFile", required = true)
|
||||||
public Map fileDigestSources(MultipartFile file,HttpServletRequest request,
|
public Map fileDigestSources(MultipartFile file, HttpServletRequest request, HttpServletResponse response) {
|
||||||
HttpServletResponse response){
|
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request,file,null);
|
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request,
|
||||||
//JSONArray fileArray=new JSONArray();
|
file, null);
|
||||||
if (file==null) {
|
// JSONArray fileArray=new JSONArray();
|
||||||
|
if (file == null) {
|
||||||
thread.setExceptionInfo("请上传获取摘要的文件到file");
|
thread.setExceptionInfo("请上传获取摘要的文件到file");
|
||||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "请上传获取摘要的文件到file参数",
|
throw new RestServiceException(thread, System.currentTimeMillis() - start, "请上传获取摘要的文件到file参数",
|
||||||
RestBusinessCode.missing_args.getValue());
|
RestBusinessCode.missing_args.getValue());
|
||||||
}
|
}
|
||||||
JSONObject resultObject = new JSONObject();
|
JSONObject resultObject = new JSONObject();
|
||||||
FileDesc fileDesc = (FileDesc) JSONObject.toBean(JSONObject.fromObject(request.getHeader("File-Desc")),FileDesc.class);
|
FileDesc fileDesc = (FileDesc) JSONObject.toBean(JSONObject.fromObject(request.getHeader("File-Desc")),
|
||||||
|
FileDesc.class);
|
||||||
try {
|
try {
|
||||||
if (!StringUtil.isEmpty(fileDesc.getChecksum())) {
|
if (!StringUtil.isEmpty(fileDesc.getChecksum())) {
|
||||||
//验证Md5
|
// 验证Md5
|
||||||
String md5 = DigestUtils.md5Hex(file.getBytes());
|
String md5 = DigestUtils.md5Hex(file.getInputStream());
|
||||||
System.out.println("----------------------------MD5:'"+md5+"'==='"+fileDesc.getChecksum()+"'");
|
System.out.println("----------------------------MD5:'" + md5 + "'==='" + fileDesc.getChecksum() + "'");
|
||||||
if (!md5.equals(fileDesc.getChecksum())) {
|
if (!md5.equals(fileDesc.getChecksum())) {
|
||||||
thread.setExceptionInfo("checksum与文件MD5值不一致");
|
thread.setExceptionInfo("checksum与文件MD5值不一致");
|
||||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "checksum与文件MD5值不一致",
|
throw new RestServiceException(thread, System.currentTimeMillis() - start, "checksum与文件MD5值不一致",
|
||||||
RestBusinessCode.config_integrity_error.getValue());
|
RestBusinessCode.config_integrity_error.getValue());
|
||||||
}
|
}
|
||||||
String ext = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1);
|
String ext = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1);
|
||||||
FastDFSFile fdsfile = new FastDFSFile(file.getBytes(),file.getOriginalFilename(), ext);
|
FastDFSFile fdsfile = new FastDFSFile(file.getBytes(), file.getOriginalFilename(), ext);
|
||||||
// NameValuePair[] meta_list = new NameValuePair[5];
|
// NameValuePair[] meta_list = new NameValuePair[5];
|
||||||
// meta_list[0] = new NameValuePair("fileName", file.getOriginalFilename());
|
// meta_list[0] = new NameValuePair("fileName", file.getOriginalFilename());
|
||||||
// meta_list[1] = new NameValuePair("fileLength", String.valueOf(file.getSize()));
|
// meta_list[1] = new NameValuePair("fileLength",
|
||||||
// meta_list[2] = new NameValuePair("fileExt", ext);
|
// String.valueOf(file.getSize()));
|
||||||
// meta_list[3] = new NameValuePair("fileAuthor", "rkg");
|
// meta_list[2] = new NameValuePair("fileExt", ext);
|
||||||
// meta_list[4] = new NameValuePair("fileMd5", md5);
|
// meta_list[3] = new NameValuePair("fileAuthor", "rkg");
|
||||||
|
// meta_list[4] = new NameValuePair("fileMd5", md5);
|
||||||
logger.info("-----------------调用接口上传文件---------------");
|
logger.info("-----------------调用接口上传文件---------------");
|
||||||
String filePath = FileManager.upload(fdsfile, null);
|
String filePath = FileManager.upload(fdsfile, null);
|
||||||
resultObject.put("path", filePath.substring(filePath.indexOf("group")));
|
resultObject.put("path", filePath.substring(filePath.indexOf("group")));
|
||||||
}
|
}
|
||||||
|
|
||||||
CommonsMultipartFile filetemp = (CommonsMultipartFile) file;
|
CommonsMultipartFile filetemp = (CommonsMultipartFile) file;
|
||||||
String tempFilePath = filetemp.getStorageDescription().toString();
|
String tempFilePath = filetemp.getStorageDescription().toString();
|
||||||
tempFilePath = tempFilePath.substring(tempFilePath.indexOf("[")+1, tempFilePath.indexOf("]"));
|
tempFilePath = tempFilePath.substring(tempFilePath.indexOf("[") + 1, tempFilePath.indexOf("]"));
|
||||||
|
|
||||||
String digestStr = configSourcesService.getDigestGen(request.getRealPath(File.separator),tempFilePath);
|
String digestStr = configSourcesService.getDigestGen(request.getRealPath(File.separator), tempFilePath);
|
||||||
resultObject.put("digest", digestStr);
|
resultObject.put("digest", digestStr);
|
||||||
resultObject.put("rawLen", file.getSize());
|
resultObject.put("rawLen", file.getSize());
|
||||||
}catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
logger.error("文件上传过程中出现异常");
|
logger.error("文件上传过程中出现异常");
|
||||||
thread.setExceptionInfo("文件上传过程中出现异常");
|
thread.setExceptionInfo("文件上传过程中出现异常");
|
||||||
@@ -621,8 +630,9 @@ public class ConfigSourcesController extends BaseRestController {
|
|||||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "摘要获取过程中出现异常",
|
throw new RestServiceException(thread, System.currentTimeMillis() - start, "摘要获取过程中出现异常",
|
||||||
RestBusinessCode.unknow_error.getValue());
|
RestBusinessCode.unknow_error.getValue());
|
||||||
}
|
}
|
||||||
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "摘要获取成功",resultObject);
|
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "摘要获取成功", resultObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isBlank(Date datetime) {
|
private boolean isBlank(Date datetime) {
|
||||||
if (null != datetime) {
|
if (null != datetime) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import com.nis.domain.restful.MaatConfig;
|
|||||||
import com.nis.domain.restful.MaatRelation;
|
import com.nis.domain.restful.MaatRelation;
|
||||||
import com.nis.listener.CompileGroupRegionRela;
|
import com.nis.listener.CompileGroupRegionRela;
|
||||||
import com.nis.util.Configurations;
|
import com.nis.util.Configurations;
|
||||||
import com.nis.util.Exceptions;
|
|
||||||
import com.nis.util.ReadMaatXmlUtil;
|
import com.nis.util.ReadMaatXmlUtil;
|
||||||
import com.nis.util.ServiceAndRDBIndexReal;
|
import com.nis.util.ServiceAndRDBIndexReal;
|
||||||
import com.nis.web.service.SpringContextHolder;
|
import com.nis.web.service.SpringContextHolder;
|
||||||
@@ -41,108 +40,119 @@ public class ConfigRedisServiceimpl implements ConfigRedisService {
|
|||||||
RedisTemplate<String, String> redisTemplate = SpringContextHolder
|
RedisTemplate<String, String> redisTemplate = SpringContextHolder
|
||||||
.getBean("redisTemplate" + redisDBIndex);
|
.getBean("redisTemplate" + redisDBIndex);
|
||||||
List<Map<String, String>> listMap = configMap.get(redisDBIndex);
|
List<Map<String, String>> listMap = configMap.get(redisDBIndex);
|
||||||
|
if (listMap != null && listMap.size() > 0) {
|
||||||
|
String maatVersionStr = redisTemplate.opsForValue().get("MAAT_VERSION");
|
||||||
|
if (maatVersionStr == null) {
|
||||||
|
maatVersionStr = "0";
|
||||||
|
}
|
||||||
|
if (maatVersionStr != null) {
|
||||||
|
Long maatVersion = Long.valueOf(maatVersionStr) + 1;
|
||||||
|
for (Map<String, String> map : listMap) {
|
||||||
|
String serviceStr = map.get("service");
|
||||||
|
int service = Integer.parseInt(serviceStr);
|
||||||
|
MaatXmlConfig maatXmlConfig = ReadMaatXmlUtil.getMaatConfigByService(service);
|
||||||
|
if (maatXmlConfig != null) {
|
||||||
|
List<MaatXmlExpr> expressionList = maatXmlConfig.getExpressionList();
|
||||||
|
String maatKey = null;
|
||||||
|
for (MaatXmlExpr maatXmlExpr : expressionList) {
|
||||||
|
if (0 == maatXmlExpr.getType().intValue()) {
|
||||||
|
StringBuffer keyBF = new StringBuffer();
|
||||||
|
String[] keySplit = maatXmlExpr.getKeyExpression().split(";");
|
||||||
|
for (String keyStr : keySplit) {
|
||||||
|
if (!StringUtils.isEmpty(keyStr) && keyStr.trim().startsWith("[")) {
|
||||||
|
keyStr = keyStr.trim().replace("[", "").replace("]", "");
|
||||||
|
keyBF.append(map.get(keyStr));
|
||||||
|
} else {
|
||||||
|
keyBF.append(keyStr.trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
StringBuffer valBF = new StringBuffer();
|
||||||
|
String[] valSplit = maatXmlExpr.getValueExpression().split(";");
|
||||||
|
for (String valStr : valSplit) {
|
||||||
|
if (!StringUtils.isEmpty(valStr) && valStr.trim().startsWith("[")) {
|
||||||
|
valStr = valStr.trim().replace("[", "").replace("]", "");
|
||||||
|
valBF.append(map.get(valStr));
|
||||||
|
} else if (valStr.equals(" ")) {
|
||||||
|
valBF.append(" ");
|
||||||
|
} else if (valStr.equals("\\t")) {// xml中是字符串的\t这里判断的时候需要转义为\\t,但是添加的时候需要添加\t不是\\t
|
||||||
|
valBF.append("\t");
|
||||||
|
} else if (valStr.equals("\\n")) {
|
||||||
|
valBF.append("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
maatKey = keyBF.toString();
|
||||||
|
redisTemplate.opsForValue().set(keyBF.toString().toUpperCase(),
|
||||||
|
valBF.toString());
|
||||||
|
logger.info("向{}号redis数据库添加了一条配置,key是{},value是{}", redisDBIndex,
|
||||||
|
keyBF.toString().toUpperCase(), valBF.toString());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (MaatXmlExpr maatXmlExpr : expressionList) {
|
||||||
|
if (maatXmlExpr.getKeyExpression().toUpperCase().equals("MAAT_UPDATE_STATUS")) {
|
||||||
|
if (maatKey != null) {
|
||||||
|
String zset = maatKey.replace("EFFECTIVE_RULE:", "ADD,");
|
||||||
|
redisTemplate.boundZSetOps("MAAT_UPDATE_STATUS").add(zset, maatVersion);
|
||||||
|
logger.info("向{}号redis数据库更新了MAAT_UPDATE_STATUS,内容是{},SCORES是{}",
|
||||||
|
redisDBIndex, zset.toUpperCase(), maatVersion);
|
||||||
|
|
||||||
String maatVersionStr = redisTemplate.opsForValue().get("MAAT_VERSION");
|
}
|
||||||
if (maatVersionStr == null) {
|
} else if (maatXmlExpr.getKeyExpression().toUpperCase()
|
||||||
maatVersionStr = "0";
|
.equals("MAAT_RULE_TIMER")) {
|
||||||
}
|
if (maatKey != null) {
|
||||||
if (maatVersionStr != null) {
|
Double score = 0d;// 界面下发的配置没有超时时间所以这里设置为0
|
||||||
Long maatVersion = Long.valueOf(maatVersionStr) + 1;
|
redisTemplate.boundZSetOps("MAAT_RULE_TIMER").add(maatKey, score);
|
||||||
for (Map<String, String> map : listMap) {
|
|
||||||
String serviceStr = map.get("service");
|
logger.info("向{}号redis数据库更新了MAAT_RULE_TIMER,内容是{},SCORES是{}",
|
||||||
int service = Integer.parseInt(serviceStr);
|
redisDBIndex, maatKey, score);
|
||||||
MaatXmlConfig maatXmlConfig = ReadMaatXmlUtil.getMaatConfigByService(service);
|
|
||||||
if (maatXmlConfig != null) {
|
}
|
||||||
List<MaatXmlExpr> expressionList = maatXmlConfig.getExpressionList();
|
} else if (maatXmlExpr.getKeyExpression().toUpperCase()
|
||||||
String maatKey = null;
|
.equals("MAAT_VERSION_TIMER")) {
|
||||||
for (MaatXmlExpr maatXmlExpr : expressionList) {
|
Long nowTime = new Date().getTime();
|
||||||
if (0 == maatXmlExpr.getType().intValue()) {
|
nowTime = nowTime / 1000l;
|
||||||
StringBuffer keyBF = new StringBuffer();
|
Double score = nowTime.doubleValue();// 使用redis自带的time,得到当前时间的秒
|
||||||
String[] keySplit = maatXmlExpr.getKeyExpression().split(";");
|
redisTemplate.boundZSetOps("MAAT_VERSION_TIMER").add(maatVersion + "",
|
||||||
for (String keyStr : keySplit) {
|
score);
|
||||||
if (!StringUtils.isEmpty(keyStr) && keyStr.trim().startsWith("[")) {
|
|
||||||
keyStr = keyStr.trim().replace("[", "").replace("]", "");
|
logger.info("向{}号redis数据库更新了MAAT_VERSION_TIMER,内容是{},SCORES是{}",
|
||||||
keyBF.append(map.get(keyStr));
|
redisDBIndex, maatVersion, score);
|
||||||
} else {
|
}
|
||||||
keyBF.append(keyStr.trim());
|
}
|
||||||
|
List<MaatXmlSeq> seqList = maatXmlConfig.getSequenceList();
|
||||||
|
for (MaatXmlSeq maatXmlSeq : seqList) {
|
||||||
|
// setRedisDataBase(maatXmlSeq.getRedisDB(),
|
||||||
|
// redisTemplate);
|
||||||
|
String seqKey = maatXmlSeq.getSequenceKey();
|
||||||
|
if (!seqKey.toUpperCase().equals("MAAT_VERSION")) {
|
||||||
|
Integer operation = maatXmlSeq.getOperation();
|
||||||
|
if (operation == 1) {
|
||||||
|
redisTemplate.boundValueOps(seqKey.toUpperCase()).increment(1l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StringBuffer valBF = new StringBuffer();
|
|
||||||
String[] valSplit = maatXmlExpr.getValueExpression().split(";");
|
|
||||||
for (String valStr : valSplit) {
|
|
||||||
if (!StringUtils.isEmpty(valStr) && valStr.trim().startsWith("[")) {
|
|
||||||
valStr = valStr.trim().replace("[", "").replace("]", "");
|
|
||||||
valBF.append(map.get(valStr));
|
|
||||||
} else if (valStr.equals(" ")) {
|
|
||||||
valBF.append(" ");
|
|
||||||
} else if (valStr.equals("\\t")) {// xml中是字符串的\t这里判断的时候需要转义为\\t,但是添加的时候需要添加\t不是\\t
|
|
||||||
valBF.append("\t");
|
|
||||||
} else if (valStr.equals("\\n")) {
|
|
||||||
valBF.append("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
maatKey = keyBF.toString();
|
|
||||||
redisTemplate.opsForValue().set(keyBF.toString().toUpperCase(),
|
|
||||||
valBF.toString());
|
|
||||||
logger.info("向{}号redis数据库添加了一条配置,key是{},value是{}", redisDBIndex,
|
|
||||||
keyBF.toString().toUpperCase(), valBF.toString());
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
for (MaatXmlExpr maatXmlExpr : expressionList) {
|
throw new RuntimeException("无法从maat.xml中获取业务类型" + service + "对应的规则,请检查业务类型是否正确");
|
||||||
if (maatXmlExpr.getKeyExpression().toUpperCase().equals("MAAT_UPDATE_STATUS")) {
|
|
||||||
if (maatKey != null) {
|
|
||||||
String zset = maatKey.replace("EFFECTIVE_RULE:", "ADD,");
|
|
||||||
redisTemplate.boundZSetOps("MAAT_UPDATE_STATUS").add(zset, maatVersion);
|
|
||||||
logger.info("向{}号redis数据库更新了MAAT_UPDATE_STATUS,内容是{},SCORES是{}",
|
|
||||||
redisDBIndex, zset.toUpperCase(), maatVersion);
|
|
||||||
|
|
||||||
}
|
|
||||||
} else if (maatXmlExpr.getKeyExpression().toUpperCase().equals("MAAT_RULE_TIMER")) {
|
|
||||||
if (maatKey != null) {
|
|
||||||
Double score = 0d;// 界面下发的配置没有超时时间所以这里设置为0
|
|
||||||
redisTemplate.boundZSetOps("MAAT_RULE_TIMER").add(maatKey, score);
|
|
||||||
|
|
||||||
logger.info("向{}号redis数据库更新了MAAT_RULE_TIMER,内容是{},SCORES是{}", redisDBIndex,
|
|
||||||
maatKey, score);
|
|
||||||
|
|
||||||
}
|
|
||||||
} else if (maatXmlExpr.getKeyExpression().toUpperCase()
|
|
||||||
.equals("MAAT_VERSION_TIMER")) {
|
|
||||||
Long nowTime = new Date().getTime();
|
|
||||||
nowTime = nowTime / 1000l;
|
|
||||||
Double score = nowTime.doubleValue();// 使用redis自带的time,得到当前时间的秒
|
|
||||||
redisTemplate.boundZSetOps("MAAT_VERSION_TIMER").add(maatVersion + "", score);
|
|
||||||
|
|
||||||
logger.info("向{}号redis数据库更新了MAAT_VERSION_TIMER,内容是{},SCORES是{}", redisDBIndex,
|
|
||||||
maatVersion, score);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
List<MaatXmlSeq> seqList = maatXmlConfig.getSequenceList();
|
|
||||||
for (MaatXmlSeq maatXmlSeq : seqList) {
|
|
||||||
// setRedisDataBase(maatXmlSeq.getRedisDB(),
|
|
||||||
// redisTemplate);
|
|
||||||
String seqKey = maatXmlSeq.getSequenceKey();
|
|
||||||
if (!seqKey.toUpperCase().equals("MAAT_VERSION")) {
|
|
||||||
Integer operation = maatXmlSeq.getOperation();
|
|
||||||
if (operation == 1) {
|
|
||||||
redisTemplate.boundValueOps(seqKey.toUpperCase()).increment(1l);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
redisTemplate.boundValueOps("MAAT_VERSION").increment(1l);
|
||||||
|
logger.info("向{}号redis数据库更新了MAAT_VERSION,更新后版本是{}", redisDBIndex,
|
||||||
|
Integer.valueOf(maatVersionStr) + 1);
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
redisTemplate.boundValueOps("MAAT_VERSION").increment(1l);
|
} else {
|
||||||
logger.info("向{}号redis数据库更新了MAAT_VERSION,更新后版本是{}", redisDBIndex,
|
throw new RuntimeException("向" + redisDBIndex + "号redis库中添加配置时,未发现对应的配置信息,请检查配置参数是否正确");
|
||||||
Integer.valueOf(maatVersionStr) + 1);
|
|
||||||
count++;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("redis数据库编号:" + redisDBIndex + "不正确,请检查数据库编号");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count == configMap.size()) {
|
if (count == configMap.size()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("参数不能为空");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -176,8 +186,12 @@ public class ConfigRedisServiceimpl implements ConfigRedisService {
|
|||||||
CompileGroupRegionRela.addIdRelation(redisDBIndex, compileAndGroupRelations);
|
CompileGroupRegionRela.addIdRelation(redisDBIndex, compileAndGroupRelations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("redis数据库编号:" + redisDBIndex + "不正确,请检查数据库编号");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("参数不能为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -228,15 +242,21 @@ public class ConfigRedisServiceimpl implements ConfigRedisService {
|
|||||||
logger.info("向{}号redis数据库更新了MAAT_VERSION,更新后版本是{}", redisDBIndex,
|
logger.info("向{}号redis数据库更新了MAAT_VERSION,更新后版本是{}", redisDBIndex,
|
||||||
Integer.valueOf(maatVersionStr) + 1);
|
Integer.valueOf(maatVersionStr) + 1);
|
||||||
count++;
|
count++;
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("向" + redisDBIndex + "号redis库中添加配置时,未发现对应的配置信息,请检查配置参数是否正确");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("redis数据库编号:" + redisDBIndex + "不正确,请检查数据库编号");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count == configMap.size()) {
|
if (count == configMap.size()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("参数不能为空");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -254,13 +274,21 @@ public class ConfigRedisServiceimpl implements ConfigRedisService {
|
|||||||
public void setConfig(MaatConfig maatConfig, MaatXmlConfig maatXmlConfig, Long maatVersion, int service,
|
public void setConfig(MaatConfig maatConfig, MaatXmlConfig maatXmlConfig, Long maatVersion, int service,
|
||||||
RedisTemplate<String, String> redisTemplate, Integer redisDBIndex) {
|
RedisTemplate<String, String> redisTemplate, Integer redisDBIndex) {
|
||||||
Map<String, String> compileMap = maatConfig.getCompileMap();
|
Map<String, String> compileMap = maatConfig.getCompileMap();
|
||||||
setCommonConfig(maatXmlConfig, compileMap, 10, maatVersion.doubleValue(), service, redisTemplate, redisDBIndex);// 10代表是编译配置
|
if (compileMap != null && compileMap.size() > 0) {
|
||||||
|
setCommonConfig(maatXmlConfig, compileMap, 10, maatVersion.doubleValue(), service, redisTemplate,
|
||||||
|
redisDBIndex);// 10代表是编译配置
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("无法从参数中获取" + redisDBIndex + "号redis库,业务类型为:" + service + "的编译配置信息,请检查配置参数是否正确");
|
||||||
|
}
|
||||||
|
|
||||||
List<Map<String, String>> groupMapList = maatConfig.getGroupMapList();
|
List<Map<String, String>> groupMapList = maatConfig.getGroupMapList();
|
||||||
if (groupMapList != null && groupMapList.size() > 0) {
|
if (groupMapList != null && groupMapList.size() > 0) {
|
||||||
for (Map<String, String> map : groupMapList) {
|
for (Map<String, String> map : groupMapList) {
|
||||||
setCommonConfig(maatXmlConfig, map, 11, maatVersion.doubleValue(), service, redisTemplate,
|
setCommonConfig(maatXmlConfig, map, 11, maatVersion.doubleValue(), service, redisTemplate,
|
||||||
redisDBIndex);// 11代表是分组配置
|
redisDBIndex);// 11代表是分组配置
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("无法从参数中获取" + redisDBIndex + "号redis库,业务类型为:" + service + "的分组配置信息,请检查配置参数是否正确");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Map<String, String>> ipRegionMapList = maatConfig.getIpRegionMapList();
|
List<Map<String, String>> ipRegionMapList = maatConfig.getIpRegionMapList();
|
||||||
@@ -305,6 +333,15 @@ public class ConfigRedisServiceimpl implements ConfigRedisService {
|
|||||||
redisDBIndex);// 17代表是文本相似性域配置
|
redisDBIndex);// 17代表是文本相似性域配置
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<Map<String, String>> ipclientList = maatConfig.getIpClientRangeMapList();
|
||||||
|
if (ipclientList != null && ipclientList.size() > 0) {
|
||||||
|
for (Map<String, String> map : ipclientList) {
|
||||||
|
setCommonConfig(maatXmlConfig, map, 18, maatVersion.doubleValue(), service, redisTemplate,
|
||||||
|
redisDBIndex);// 18代表是区域ip域配置
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// updateCommonKey(maatXmlConfig);
|
// updateCommonKey(maatXmlConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,6 +425,8 @@ public class ConfigRedisServiceimpl implements ConfigRedisService {
|
|||||||
logger.info("向{}号redis数据库更新了MAAT_VERSION_TIMER,内容是{},SCORES是{}", redisDBIndex, maatVersion, score);
|
logger.info("向{}号redis数据库更新了MAAT_VERSION_TIMER,内容是{},SCORES是{}", redisDBIndex, maatVersion, score);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("无法获取业务类型" + service + "对应的maat规则或传入的配置信息有误,请检查!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -506,22 +545,32 @@ public class ConfigRedisServiceimpl implements ConfigRedisService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException(
|
||||||
|
"无法从maat.xml中获取业务类型" + service + "对应的规则,请检查业务类型是否正确");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
redisTemplate.boundValueOps("MAAT_VERSION").increment(1l);
|
redisTemplate.boundValueOps("MAAT_VERSION").increment(1l);
|
||||||
logger.info("向{}号redis数据库更新了MAAT_VERSION,更新后版本是{}", redisDBIndex,
|
logger.info("向{}号redis数据库更新了MAAT_VERSION,更新后版本是{}", redisDBIndex,
|
||||||
Integer.valueOf(maatVersionStr) + 1);
|
Integer.valueOf(maatVersionStr) + 1);
|
||||||
count++;
|
count++;
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException(
|
||||||
|
"无法从参数中获取" + redisDBIndex + "号redis库,业务类型为:" + service + "的配置id信息,请检查配置参数是否正确");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("向" + redisDBIndex + "号redis库中添加配置时,未发现对应的配置信息,请检查配置参数是否正确");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (count == idMap.size()) {
|
if (count == idMap.size()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("参数信息有误,请检查!");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -556,11 +605,15 @@ public class ConfigRedisServiceimpl implements ConfigRedisService {
|
|||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("向" + redisDBIndex + "号redis库中添加配置时,未发现对应的配置信息,请检查配置参数是否正确");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count == idMap.size()) {
|
if (count == idMap.size()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("参数信息有误,请检查!");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -601,10 +654,14 @@ public class ConfigRedisServiceimpl implements ConfigRedisService {
|
|||||||
redisTemplate, redisDBIndex);// 16代表是文件摘要类域配置
|
redisTemplate, redisDBIndex);// 16代表是文件摘要类域配置
|
||||||
removeCommonConfig(maatXmlConfig, regionIdSet, 17, maatVersion.doubleValue(), service,
|
removeCommonConfig(maatXmlConfig, regionIdSet, 17, maatVersion.doubleValue(), service,
|
||||||
redisTemplate, redisDBIndex);// 17代表是文本相似性域配置
|
redisTemplate, redisDBIndex);// 17代表是文本相似性域配置
|
||||||
|
removeCommonConfig(maatXmlConfig, regionIdSet, 18, maatVersion.doubleValue(), service,
|
||||||
|
redisTemplate, redisDBIndex);// 18代表是区域ip域配置
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("无法获取内存中记录的id映射关系,无法获取业务类型" + service + "对应的maat规则或传入的配置id有误,请检查!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -683,6 +740,8 @@ public class ConfigRedisServiceimpl implements ConfigRedisService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("无法获取业务类型" + service + "对应的maat规则或传入的配置信息有误,请检查!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -707,8 +766,12 @@ public class ConfigRedisServiceimpl implements ConfigRedisService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("redis数据库编号:" + redisDBIndex + "不正确,请检查数据库编号");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("参数不能为空");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ import java.util.concurrent.CountDownLatch;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import net.sf.json.JSONObject;
|
|
||||||
|
|
||||||
import org.apache.ibatis.session.ExecutorType;
|
import org.apache.ibatis.session.ExecutorType;
|
||||||
import org.apache.ibatis.session.SqlSession;
|
import org.apache.ibatis.session.SqlSession;
|
||||||
import org.apache.ibatis.session.SqlSessionFactory;
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
@@ -63,6 +61,8 @@ import com.nis.web.service.BaseService;
|
|||||||
import com.nis.web.service.SaveRequestLogThread;
|
import com.nis.web.service.SaveRequestLogThread;
|
||||||
import com.nis.web.service.SpringContextHolder;
|
import com.nis.web.service.SpringContextHolder;
|
||||||
|
|
||||||
|
import net.sf.json.JSONObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName: ControlService
|
* @ClassName: ControlService
|
||||||
* @Description: TODO(编译配置持久化)
|
* @Description: TODO(编译配置持久化)
|
||||||
@@ -1328,7 +1328,6 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
public String updateConfigSources(SaveRequestLogThread thread, long start, List<ConfigCompile> compileList,
|
public String updateConfigSources(SaveRequestLogThread thread, long start, List<ConfigCompile> compileList,
|
||||||
Date opTime, StringBuffer sb) {
|
Date opTime, StringBuffer sb) {
|
||||||
Map<Integer, List<Long>> compileMap = new HashMap<Integer, List<Long>>();
|
Map<Integer, List<Long>> compileMap = new HashMap<Integer, List<Long>>();
|
||||||
List<ConfigCompile> compileAllList = new ArrayList<ConfigCompile>();
|
|
||||||
if (null != compileList && compileList.size() > 0) {
|
if (null != compileList && compileList.size() > 0) {
|
||||||
for (ConfigCompile config : compileList) {
|
for (ConfigCompile config : compileList) {
|
||||||
String msg = checkCompileOptForUpdate(config);
|
String msg = checkCompileOptForUpdate(config);
|
||||||
|
|||||||
@@ -74,7 +74,7 @@
|
|||||||
编译表名:compile_table_name,分组表名:group_table_name,ip类域配置表名:ip_region_table_name,
|
编译表名:compile_table_name,分组表名:group_table_name,ip类域配置表名:ip_region_table_name,
|
||||||
数值类域配置表名:num_region_table_name,字符串类域配置表名:str_region_table_name,
|
数值类域配置表名:num_region_table_name,字符串类域配置表名:str_region_table_name,
|
||||||
增强字符串域配置表名:str_str_region_table_name,文件摘要类域配置表名:file_digest_table_name,
|
增强字符串域配置表名:str_str_region_table_name,文件摘要类域配置表名:file_digest_table_name,
|
||||||
文本相似性域配置表名:file_like_table_name。
|
文本相似性域配置表名:file_like_table_name,区域ip配置表名:ip_client_range_table_name。
|
||||||
直接写的代表是固定值,直接拼接即可,
|
直接写的代表是固定值,直接拼接即可,
|
||||||
每个属性间用分号分隔,空格用&nbsp表示]]>
|
每个属性间用分号分隔,空格用&nbsp表示]]>
|
||||||
</xs:documentation>
|
</xs:documentation>
|
||||||
|
|||||||
@@ -273,7 +273,7 @@
|
|||||||
<bean id="multipartResolver"
|
<bean id="multipartResolver"
|
||||||
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
|
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
|
||||||
<property name="defaultEncoding" value="utf-8"></property>
|
<property name="defaultEncoding" value="utf-8"></property>
|
||||||
<property name="maxUploadSize" value="104857600"></property>
|
<property name="maxUploadSize" value="10485760000"></property>
|
||||||
<!--<property name="maxInMemorySize" value="1000"></property> -->
|
<!--<property name="maxInMemorySize" value="1000"></property> -->
|
||||||
<property name="uploadTempDir" value="/upload"></property>
|
<property name="uploadTempDir" value="/upload"></property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import org.apache.http.client.methods.HttpPost;
|
|||||||
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||||
import org.apache.http.impl.client.CloseableHttpClient;
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
import org.apache.http.impl.client.HttpClients;
|
import org.apache.http.impl.client.HttpClients;
|
||||||
|
import org.apache.http.params.CoreConnectionPNames;
|
||||||
import org.apache.http.util.EntityUtils;
|
import org.apache.http.util.EntityUtils;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@@ -42,15 +43,17 @@ public class RestTest {
|
|||||||
public void testFileUpload() {
|
public void testFileUpload() {
|
||||||
CloseableHttpResponse response = null;
|
CloseableHttpResponse response = null;
|
||||||
try {
|
try {
|
||||||
File file = new File("C:/Users/dell/Desktop/Lighthouse.jpg");
|
File file = new File("F:/git.rar");
|
||||||
|
|
||||||
// String md5 = DigestUtils.md5Hex(file);
|
// String md5 = DigestUtils.md5Hex(file);
|
||||||
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||||
builder.addBinaryBody("file", file);
|
builder.addBinaryBody("file", file);
|
||||||
|
|
||||||
HttpPost request = new HttpPost(
|
HttpPost request = new HttpPost(
|
||||||
"http://10.0.6.104:8080/galaxy/service/cfg/v1/fileUploadSources");
|
"http://10.0.6.120:8080/galaxy/service/cfg/v1/fileUploadSources");
|
||||||
//galaxy/service/cfg/v1/fileUploadSources
|
//galaxy/service/cfg/v1/fileUploadSources
|
||||||
|
request.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 600000);
|
||||||
|
request.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, 600000);
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("filetype", "doc");
|
jsonObject.put("filetype", "doc");
|
||||||
jsonObject.put("createTime", "2018-05-21 21:00:00");
|
jsonObject.put("createTime", "2018-05-21 21:00:00");
|
||||||
@@ -58,13 +61,12 @@ public class RestTest {
|
|||||||
jsonObject.put("fileName", "1.png");
|
jsonObject.put("fileName", "1.png");
|
||||||
//jsonObject.put("checksum", "d99f9aa4f3748fa48aa6e350c628c67f");
|
//jsonObject.put("checksum", "d99f9aa4f3748fa48aa6e350c628c67f");
|
||||||
|
|
||||||
jsonObject.put("checksum", "8969288f4245120e7c3870287cce0ff3");
|
jsonObject.put("checksum", "faa364a36cddcbbfd65c0224f35fcfd0");
|
||||||
|
|
||||||
request.setHeader("File-Desc", jsonObject.toString());
|
request.setHeader("File-Desc", jsonObject.toString());
|
||||||
HttpEntity entity = builder.build();
|
HttpEntity entity = builder.build();
|
||||||
request.setEntity(entity);
|
request.setEntity(entity);
|
||||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||||
|
|
||||||
response = httpClient.execute(request);
|
response = httpClient.execute(request);
|
||||||
System.out.println(EntityUtils.toString(response.getEntity()));
|
System.out.println(EntityUtils.toString(response.getEntity()));
|
||||||
System.out.println("aa");
|
System.out.println("aa");
|
||||||
|
|||||||
Reference in New Issue
Block a user