删除无用代码、添加注释

This commit is contained in:
zhangdongxu
2018-08-13 09:39:55 +08:00
parent eb49689c55
commit b725577b9a
2 changed files with 36 additions and 4 deletions

View File

@@ -89,6 +89,7 @@ public class ConfigSourcesController extends BaseRestController {
} catch (Exception e) { } catch (Exception e) {
// TODO: handle exception // TODO: handle exception
thread.setExceptionInfo("Maat 规则存储异常:" + e.getMessage()); thread.setExceptionInfo("Maat 规则存储异常:" + e.getMessage());
logger.error("Maat 规则存储异常:" + e.getMessage());
if (e instanceof RestServiceException) { if (e instanceof RestServiceException) {
throw new RestServiceException(thread, System.currentTimeMillis() - start, throw new RestServiceException(thread, System.currentTimeMillis() - start,
"Maat 规则存储异常:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); "Maat 规则存储异常:" + e.getMessage(), ((RestServiceException) e).getErrorCode());
@@ -133,6 +134,7 @@ public class ConfigSourcesController extends BaseRestController {
} catch (Exception e) { } catch (Exception e) {
// TODO: handle exception // TODO: handle exception
thread.setExceptionInfo("MAAT规则状态更新时出现异常:" + e.getMessage()); thread.setExceptionInfo("MAAT规则状态更新时出现异常:" + e.getMessage());
logger.error("MAAT规则状态更新时出现异常:" + e.getMessage());
if (e instanceof RestServiceException) { if (e instanceof RestServiceException) {
throw new RestServiceException(thread, System.currentTimeMillis() - start, throw new RestServiceException(thread, System.currentTimeMillis() - start,
"MAAT规则状态更新时出现异常:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); "MAAT规则状态更新时出现异常:" + e.getMessage(), ((RestServiceException) e).getErrorCode());
@@ -189,6 +191,7 @@ public class ConfigSourcesController extends BaseRestController {
} catch (Exception e) { } catch (Exception e) {
// TODO: handle exception // TODO: handle exception
thread.setExceptionInfo("回调规则存储异常:" + e.getMessage()); thread.setExceptionInfo("回调规则存储异常:" + e.getMessage());
logger.error("回调规则存储异常:" + e.getMessage());
if (e instanceof RestServiceException) { if (e instanceof RestServiceException) {
throw new RestServiceException(thread, System.currentTimeMillis() - start, throw new RestServiceException(thread, System.currentTimeMillis() - start,
"回调规则存储异常:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); "回调规则存储异常:" + e.getMessage(), ((RestServiceException) e).getErrorCode());
@@ -219,6 +222,7 @@ public class ConfigSourcesController extends BaseRestController {
} catch (Exception e) { } catch (Exception e) {
// TODO: handle exception // TODO: handle exception
thread.setExceptionInfo("回调规则状态更新异常:" + e.getMessage()); thread.setExceptionInfo("回调规则状态更新异常:" + e.getMessage());
logger.error("回调规则状态更新异常:" + e.getMessage());
if (e instanceof RestServiceException) { if (e instanceof RestServiceException) {
throw new RestServiceException(thread, System.currentTimeMillis() - start, throw new RestServiceException(thread, System.currentTimeMillis() - start,
"回调规则状态更新异常:" + e.getMessage(), ((RestServiceException) e).getErrorCode()); "回调规则状态更新异常:" + e.getMessage(), ((RestServiceException) e).getErrorCode());

View File

@@ -61,13 +61,21 @@ public class ConfigSourcesService extends BaseService {
@Autowired @Autowired
ConfigRedisService configRedisService; ConfigRedisService configRedisService;
/**
*
* @Description: 判断tableName是否是增强字符串类域配置表
* @date 2018年8月10日 下午4:14:36
* @param tableName
* @param service
* @return
* @throws Exception
*/
public static boolean isStrStrongRegion(String tableName,Integer service) throws Exception{ public static boolean isStrStrongRegion(String tableName,Integer service) throws Exception{
if (null != tableName && !tableName.equals("")) { if (null != tableName && !tableName.equals("")) {
List<String> tableList = new ArrayList<String>(); List<String> tableList = new ArrayList<String>();
Map<Integer, List<String>> sercieNameMap = ServiceAndRDBIndexReal.getSercieNameMap().get(service); Map<Integer, List<String>> sercieNameMap = ServiceAndRDBIndexReal.getSercieNameMap().get(service);
if (sercieNameMap != null && sercieNameMap.size() > 0) { if (sercieNameMap != null && sercieNameMap.size() > 0) {
for (Integer type : sercieNameMap.keySet()) { for (Integer type : sercieNameMap.keySet()) {
String typeStr="";
// 12代表是ip类域配置,13代表是数值类配置,14代表是字符串类域配置,15代表是增强字符串类域配置, // 12代表是ip类域配置,13代表是数值类配置,14代表是字符串类域配置,15代表是增强字符串类域配置,
if ("15".equals(type.toString())) { if ("15".equals(type.toString())) {
List<String> tableNameList = sercieNameMap.get(type); List<String> tableNameList = sercieNameMap.get(type);
@@ -240,8 +248,6 @@ public class ConfigSourcesService extends BaseService {
Map<String, String[]> regionAndFiledMap = maatToValueMap Map<String, String[]> regionAndFiledMap = maatToValueMap
.get(service); .get(service);
// for (MaatConfig maatConfig :
// newMaatConfigList) {
for (int i = 0; i < newMaatConfigList.size(); i++) { for (int i = 0; i < newMaatConfigList.size(); i++) {
MaatConfig maatConfig = newMaatConfigList MaatConfig maatConfig = newMaatConfigList
.get(i); .get(i);
@@ -452,7 +458,6 @@ public class ConfigSourcesService extends BaseService {
Integer ipType = null; Integer ipType = null;
String ipTypeName = ""; String ipTypeName = "";
Integer action = null;
for (CommonSourceFieldCfg commonSourceFieldCfg : commonSourceFieldCfgList) { for (CommonSourceFieldCfg commonSourceFieldCfg : commonSourceFieldCfgList) {
if (commonSourceFieldCfg.getDstName().equals("addr_type")) { if (commonSourceFieldCfg.getDstName().equals("addr_type")) {
String dstVal = srcMap.get( String dstVal = srcMap.get(
@@ -659,6 +664,18 @@ public class ConfigSourcesService extends BaseService {
configRedisService.saveUnMaatConfig(configMap); configRedisService.saveUnMaatConfig(configMap);
} }
/**
*
* @Description:回调类配置状态更新(停/启用)
* @author (zdx)
* @date 2018年8月10日 下午4:28:04
* @param thread
* @param start
* @param jsonString
* @param opTime
* @param sb
* @throws Exception
*/
public void updateCommonSources(AuditLogThread thread, long start, public void updateCommonSources(AuditLogThread thread, long start,
String jsonString, Date opTime, StringBuffer sb) throws Exception{ String jsonString, Date opTime, StringBuffer sb) throws Exception{
JsonArray jsonObjectList = null; JsonArray jsonObjectList = null;
@@ -715,6 +732,7 @@ public class ConfigSourcesService extends BaseService {
} }
} }
try { try {
//停用时isInvalid=true,启用时isInvalid = false
configRedisService.delUnMaatConfig(restMap,validIdMap.containsKey("0")?true:false); configRedisService.delUnMaatConfig(restMap,validIdMap.containsKey("0")?true:false);
} catch (Exception e) { } catch (Exception e) {
// TODO: handle exception // TODO: handle exception
@@ -760,6 +778,16 @@ public class ConfigSourcesService extends BaseService {
} }
} }
/**
*
* @Description:在linux系统下使用摘要获取工具获取文件摘要信息
* @author (zdx)
* @date 2018年8月10日 下午4:29:38
* @param realPath
* @param filePath
* @return
* @throws Exception
*/
public String getDigestGen(String realPath, String filePath) public String getDigestGen(String realPath, String filePath)
throws Exception { throws Exception {
logger.info("----------------开始获取摘要getDigestGen"); logger.info("----------------开始获取摘要getDigestGen");