From 50aca2d2dfd13d24201bbab98dc4950e49c002e6 Mon Sep 17 00:00:00 2001 From: zhangdongxu Date: Mon, 26 Nov 2018 17:36:01 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E6=94=B9=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E6=97=A5=E5=BF=97=E4=B8=AD=EF=BC=8C=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E8=AE=B0=E5=BD=95=E8=AF=B7=E6=B1=82=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E7=9A=84=E9=80=BB=E8=BE=91=EF=BC=9B=202=E3=80=81=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E4=B8=8B=E5=8F=91=E6=B5=8B=E8=AF=95=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E4=B8=AD=E5=9B=9E=E8=B0=83=E7=B1=BB=E8=8E=B7=E5=8F=96=E5=BA=8F?= =?UTF-8?q?=E5=88=97=E5=8F=B7=E5=90=8D=E7=A7=B0=E7=94=B1seq=5Fcompileid?= =?UTF-8?q?=E6=94=B9=E4=B8=BASEQ=5FCOMPILEID=EF=BC=9B=203=E3=80=81maat?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=B8=8B=E9=98=80=E9=97=A8=E6=97=B6=E5=9F=9F?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=BF=BD=E5=8A=A0=E7=94=9F=E6=95=88=E8=8C=83?= =?UTF-8?q?=E5=9B=B4(effective=5Frange)=E9=A2=9D=E5=A4=96=E5=AD=97?= =?UTF-8?q?=E6=AE=B5;=20=20=20=E5=9B=9E=E8=B0=83=E7=B1=BB=E9=85=8D?= =?UTF-8?q?=E7=BD=AEINLINE=5FIP=5FCB=E5=92=8CIR=5FSTATIC=5FIP=5FPOOL=5FCB?= =?UTF-8?q?=E8=A1=A8=E6=B7=BB=E5=8A=A0=E7=94=9F=E6=95=88=E8=8C=83=E5=9B=B4?= =?UTF-8?q?(effective=5Frange)=E5=AD=97=E6=AE=B5;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../restful/ConfigSourcesController.java | 6 ++++++ .../controller/restful/MaatTestController.java | 2 +- .../com/nis/web/service/AuditLogThread.java | 11 +---------- .../web/service/ServicesRequestLogService.java | 6 +----- .../service/restful/ConfigSourcesService.java | 18 +++--------------- .../applicationConfig-rule.properties | 2 +- .../commonSources/applicationConfig-parser.xml | 2 ++ .../maatXml/applicationConfig-maatRedis.xml | 4 ++-- 8 files changed, 17 insertions(+), 34 deletions(-) diff --git a/src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java b/src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java index b4e34d5..be4e954 100644 --- a/src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java +++ b/src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java @@ -81,6 +81,9 @@ public class ConfigSourcesController extends BaseRestController { if (getLock(requestId)) { if (null != configSource && null != configSource.getConfigCompileList() && configSource.getConfigCompileList().size() > 0) { + if (configSource.getConfigCompileList()!=null&&configSource.getConfigCompileList().size()>Constants.MAX_LIST_SIZE) { + thread.setContent("批量提交数量超过"+Constants.MAX_LIST_SIZE+"条,不记录请求内容"); + } checkOpAction(thread, System.currentTimeMillis() - start, configSource.getOpAction(), Constants.OPACTION_POST); // 验证配置编译数据 @@ -131,6 +134,9 @@ public class ConfigSourcesController extends BaseRestController { if (null != configSource && null != configSource.getConfigCompileList() && configSource.getConfigCompileList().size() > 0) { int opAction = configSource.getOpAction(); + if (configSource.getConfigCompileList()!=null&&configSource.getConfigCompileList().size()>Constants.MAX_LIST_SIZE) { + thread.setContent("批量提交数量超过"+Constants.MAX_LIST_SIZE+"条,不记录请求内容"); + } checkOpAction(thread, System.currentTimeMillis() - start, opAction, 2); configSourcesService.updateConfigSources(thread, start, configSource.getConfigCompileList(), configSource.getOpTime(), sb); diff --git a/src/main/java/com/nis/web/controller/restful/MaatTestController.java b/src/main/java/com/nis/web/controller/restful/MaatTestController.java index c3f4c02..56114df 100644 --- a/src/main/java/com/nis/web/controller/restful/MaatTestController.java +++ b/src/main/java/com/nis/web/controller/restful/MaatTestController.java @@ -578,7 +578,7 @@ public class MaatTestController { } else if (srcName.toLowerCase().equals("cfgid") || srcName.toLowerCase().equals("keyringid") || srcName.toLowerCase().equals("fileid")) { - Long incrId = configRedisService.getIncrId("seq_compileid"); + Long incrId = configRedisService.getIncrId("SEQ_COMPILEID"); compileIdList.add(incrId); jsonString.append(incrId); } else { diff --git a/src/main/java/com/nis/web/service/AuditLogThread.java b/src/main/java/com/nis/web/service/AuditLogThread.java index f589231..b8db811 100644 --- a/src/main/java/com/nis/web/service/AuditLogThread.java +++ b/src/main/java/com/nis/web/service/AuditLogThread.java @@ -50,7 +50,6 @@ public class AuditLogThread implements Runnable { private int businessCode; private String exceptionInfo; private String traceCode; - private Boolean saveContentFlag=true;//是否保存请求内容 /* * (non-Javadoc) * @@ -63,7 +62,7 @@ public class AuditLogThread implements Runnable { CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_A);// 开启数据源B if (service != null) { service.saveRequestLog(remoteAddr, requestURI, queryString, contextPath, operator, version, opAction, - opTime, content, requestTime, consumerTime, businessCode, exceptionInfo, traceCode,saveContentFlag); + opTime, content, requestTime, consumerTime, businessCode, exceptionInfo, traceCode); } else { logger.error("service 为空!"); } @@ -430,12 +429,4 @@ public class AuditLogThread implements Runnable { public void setTraceCode(String traceCode) { this.traceCode = traceCode; } - - public Boolean getSaveContentFlag() { - return saveContentFlag; - } - - public void setSaveContentFlag(Boolean saveContentFlag) { - this.saveContentFlag = saveContentFlag; - } } diff --git a/src/main/java/com/nis/web/service/ServicesRequestLogService.java b/src/main/java/com/nis/web/service/ServicesRequestLogService.java index 80cc552..a960373 100644 --- a/src/main/java/com/nis/web/service/ServicesRequestLogService.java +++ b/src/main/java/com/nis/web/service/ServicesRequestLogService.java @@ -92,7 +92,7 @@ public class ServicesRequestLogService { */ public void saveRequestLog(String requestAddr, String requestURI, String queryString, String contextPath, String operator, String version, int opAction, Date opTime, Object content, Date requestTime, - long consumerTime, int businessCode, String exceptionInfo, String traceCode,Boolean saveContentFlag) { + long consumerTime, int businessCode, String exceptionInfo, String traceCode) { logger.info("开始记录日志---"); logger.info("请求IP---" + requestAddr); logger.info("请求路径---" + requestURI); @@ -171,13 +171,9 @@ public class ServicesRequestLogService { if ("file".equals(type)) {// 文件上传 log.setRequestContent(content.toString()); } else { - if(!saveContentFlag){ - log.setRequestContent("批量提交数量超过"+Constants.MAX_LIST_SIZE+",不记录请求内容"); - } if (content != null) { log.setRequestContent(content.toString()); } - } } diff --git a/src/main/java/com/nis/web/service/restful/ConfigSourcesService.java b/src/main/java/com/nis/web/service/restful/ConfigSourcesService.java index 1758443..086e5a2 100644 --- a/src/main/java/com/nis/web/service/restful/ConfigSourcesService.java +++ b/src/main/java/com/nis/web/service/restful/ConfigSourcesService.java @@ -127,9 +127,6 @@ public class ConfigSourcesService extends BaseService { Map> maatMap = new HashMap>(); Map> configMap = new HashMap>(); - if (configCompileList!=null&&configCompileList.size()>Constants.MAX_LIST_SIZE) { - thread.setSaveContentFlag(false); - } for (ConfigCompile configCompile : configCompileList) { Integer service = Integer.valueOf(configCompile.getService().toString()); MaatConfig maatConfig = new MaatConfig(); @@ -326,9 +323,6 @@ public class ConfigSourcesService extends BaseService { public void updateConfigSources(AuditLogThread thread, long start, List compileList, Date opTime, StringBuffer sb) throws Exception { Map> compileMap = new HashMap>(); - if (compileList!=null&&compileList.size()>Constants.MAX_LIST_SIZE) { - thread.setSaveContentFlag(false); - } if (null != compileList && compileList.size() > 0) { for (ConfigCompile config : compileList) { checkCompileOptForUpdate(config); @@ -423,7 +417,7 @@ public class ConfigSourcesService extends BaseService { RestBusinessCode.CBParamFormateError.getValue()); } if (jsonObjectList!=null&&jsonObjectList.size()>Constants.MAX_LIST_SIZE) { - thread.setSaveContentFlag(false); + thread.setContent("批量提交数量超过"+Constants.MAX_LIST_SIZE+"条,不记录请求内容"); } Map>> dstMaps = new HashMap>>(); for (int i = 0; i < jsonObjectList.size(); i++) { @@ -645,7 +639,7 @@ public class ConfigSourcesService extends BaseService { RestBusinessCode.CBParamFormateError.getValue()); } if (jsonObjectList!=null&&jsonObjectList.size()>Constants.MAX_LIST_SIZE) { - thread.setSaveContentFlag(false); + thread.setContent("批量提交数量超过"+Constants.MAX_LIST_SIZE+"条,不记录请求内容"); } // Map> cfgMap = new HashMap>(); @@ -879,12 +873,6 @@ public class ConfigSourcesService extends BaseService { maatConfig.getIpRegionMapList().addAll(dstMapList); } - if ((maatConfig.getStrRegionMapList()!=null&&maatConfig.getStrRegionMapList().size()>Constants.MAX_LIST_SIZE) - ||(maatConfig.getStrStrRegionMapList()!=null&&maatConfig.getStrStrRegionMapList().size()>Constants.MAX_LIST_SIZE) - ||(maatConfig.getIpRegionMapList()!=null&&maatConfig.getIpRegionMapList().size()>Constants.MAX_LIST_SIZE) - ||(maatConfig.getNumRegionMapList()!=null&&maatConfig.getNumRegionMapList().size()>Constants.MAX_LIST_SIZE)) { - thread.setSaveContentFlag(false); - } //maatConfig.setService(groupReuse.getService()); list.add(maatConfig); } @@ -958,7 +946,7 @@ public class ConfigSourcesService extends BaseService { } logger.info("调用接口删除Redis中分组复用的域配置接口"); if (reuseMap!=null&&reuseMap.size()>Constants.MAX_LIST_SIZE) { - thread.setSaveContentFlag(false); + thread.setContent("批量提交数量超过"+Constants.MAX_LIST_SIZE+"条,不记录请求内容"); } // 所有的都删除成功返回true if (!configRedisService.delGroupReuseConfig(reuseMap)) { diff --git a/src/main/resources/applicationConfig-rule.properties b/src/main/resources/applicationConfig-rule.properties index f1af9a3..c163087 100644 --- a/src/main/resources/applicationConfig-rule.properties +++ b/src/main/resources/applicationConfig-rule.properties @@ -345,7 +345,7 @@ tapRedisDb=5 #0x205 基于PXY IP替换 517 #0x402 APP DOMAIN特征发现 1026 #0x404 APP IP特征 1028 -maat2Valve=33:strRegion@ACTION&SERVICE&USER_REGION;512:ipRegion@ACTION&SERVICE&USER_REGION;513:strRegion@ACTION&SERVICE&USER_REGION;514:ipRegion@ACTION&SERVICE&USER_REGION;515:strRegion@ACTION&SERVICE&USER_REGION;517:ipRegion@ACTION&SERVICE&USER_REGION;1026:strRegion|strStrRegion@ACTION&SERVICE&USER_REGION;1028:ipRegion@ACTION&SERVICE&USER_REGION;5:ipRegion@COMPILE_ID&USER_REGION +maat2Valve=33:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;512:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;513:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;514:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;515:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;517:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1026:strRegion|strStrRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1028:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;5:ipRegion@COMPILE_ID&USER_REGION&EFFECTIVE_RANGE ##记录哪些service可以被分组复用(只有maat类配置可以被分组复用) #业务ID:域类型1@表名,表名|域类型2@表名;业务ID:域类型1@表名,表名|域类型2@表名 diff --git a/src/main/resources/commonSources/applicationConfig-parser.xml b/src/main/resources/commonSources/applicationConfig-parser.xml index cf008c4..7336c54 100644 --- a/src/main/resources/commonSources/applicationConfig-parser.xml +++ b/src/main/resources/commonSources/applicationConfig-parser.xml @@ -27,6 +27,7 @@ +