Merge remote-tracking branch 'origin/develop' into develop

# Conflicts:
#	src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java
This commit is contained in:
doufenghu
2018-07-17 19:28:03 +08:00
18 changed files with 1010 additions and 92 deletions

View File

@@ -85,19 +85,20 @@ public class ConfigSourcesController extends BaseRestController {
if (null != configSource && null != configSource.getConfigCompileList()
&& configSource.getConfigCompileList().size() > 0) {
int opAction = configSource.getOpAction();
checkOpAction(thread, System.currentTimeMillis() - start, opAction, 1);
// 验证配置编译数据
validateConfigSource(thread, start, configSource);
Long benginTime = System.currentTimeMillis();
String msg = configSourcesService.saveMaatConfig(thread, start, configSource.getConfigCompileList(), sb);
// String msg = "";
if ("error".equals(msg)) {
Exception exception = ConfigSourcesService.getMsgList().get(0);
throw new RestServiceException(thread, System.currentTimeMillis() - start,
"存储编译配置时出现异常" + exception.getMessage(),CompileVal.getBusinessCode());
}
Long endSaveTime = System.currentTimeMillis();
Long time = (endSaveTime - benginTime) / 1000;
System.out.println("插入数据成功总共需要" + time + "");
} else {
thread.setExceptionInfo("编译配置数据不能为空");
throw new RestServiceException(thread, System.currentTimeMillis() - start, "编译配置数据不能为空",
@@ -108,8 +109,6 @@ public class ConfigSourcesController extends BaseRestController {
"编译配置数据插入成功" + sb.toString(), Constants.IS_DEBUG ? configSource : null);
}
@RequestMapping(value = "/cfg/v1/configSources", method = RequestMethod.PUT)
@ApiOperation(value = "业务配置状态更新", httpMethod = "PUT", response = Map.class, notes = "对有效的配置(封堵|监测|白名单)进行配置失效")
@ApiParam(value = "业务配置数据源", name = "configSource", required = true)

View File

@@ -19,6 +19,11 @@ import org.springframework.web.bind.annotation.RestController;
import com.nis.domain.LogEntity;
import com.nis.domain.Page;
import com.nis.domain.restful.DkBehaviorLog;
import com.nis.domain.restful.MmAvIpLog;
import com.nis.domain.restful.MmAvUrlLog;
import com.nis.domain.restful.MmPicIpLog;
import com.nis.domain.restful.MmPicUrlLog;
import com.nis.domain.restful.MmVoipLog;
import com.nis.domain.restful.NtcAppLog;
import com.nis.domain.restful.NtcAttrTypeReport;
import com.nis.domain.restful.NtcDdosLog;
@@ -885,15 +890,10 @@ public class LogController extends BaseRestController {
logPage.setList(new ArrayList());
} else {
List list = tableMapping.get("obj");
// if (tableMapping.get("obj").size() > page.getPageSize()) {
// list = tableMapping.get("obj").subList(0, page.getPageSize());
// } else {
// list = tableMapping.get("obj").subList(0, tableMapping.get("obj").size());
// }
if (list.size() > 0) {
String jsonString = JsonMapper.toJsonString(list);
List<DkBehaviorLog> List = (java.util.List<DkBehaviorLog>) JsonMapper.fromJsonList(jsonString,
NtcDdosLog.class);
DkBehaviorLog.class);
logPage.setList(List);
logPage.setCount(List.size());
@@ -913,6 +913,272 @@ public class LogController extends BaseRestController {
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "行为识别日志检索成功",
logPage, 0);
}
@RequestMapping(value = "/mmAvIpLogs", method = RequestMethod.GET)
@ApiOperation(value = "音视频IP日志查询", httpMethod = "GET", notes = "对日志功能“音视频IP日志”提供数据基础查询服务")
public Map<String, ?> mmAvIpLogs(Page page, MmAvIpLog mmAvIpLog, Model model, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
request, null);
Page<MmAvIpLog> logPage = null;
try {
resetTime(mmAvIpLog);
testService.queryConditionCheck(auditLogThread, start, mmAvIpLog, MmAvIpLog.class, page);
logPage = new Page<MmAvIpLog>();
logPage.setPageNo(page.getPageNo());
logPage.setPageSize(page.getPageSize());
String orderBy = "";
if (null != page.getOrderBy() && !page.getOrderBy().equals("")) {
orderBy = Page.getOrderBySql(MmAvIpLog.class.getSimpleName(), page.getOrderBy());
} else {
orderBy = "found_Time";
}
ResultSet rs = HiveSqlService.getResultSet(page, mmAvIpLog,
Configurations.getStringProperty(MmAvIpLog.class.getSimpleName() + "HiveTable", "MM_AV_IP_LOG"),
getCol2Col(), orderBy, null);
Map<String, List> tableMapping = HiveJDBC.tableMapping(page, null, rs, MmAvIpLog.class, "foundTime",
"recvTime");
if (tableMapping == null) {
logPage.setList(new ArrayList());
} else {
List list = tableMapping.get("obj");
if (list.size() > 0) {
String jsonString = JsonMapper.toJsonString(list);
List<MmAvIpLog> List = (java.util.List<MmAvIpLog>) JsonMapper.fromJsonList(jsonString,
MmAvIpLog.class);
logPage.setList(List);
logPage.setCount(List.size());
} else {
logPage.setList(new ArrayList());
}
}
} catch (Exception e) {
e.printStackTrace();
auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "音视频IP日志检索失败");
}
throw ((RestServiceException) e);
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "音视频IP日志检索成功",
logPage, 0);
}
@RequestMapping(value = "/mmAvUrlLogs", method = RequestMethod.GET)
@ApiOperation(value = "音视频URL日志查询", httpMethod = "GET", notes = "对日志功能“音视频URL日志”提供数据基础查询服务")
public Map<String, ?> mmAvUrlLogs(Page page, MmAvUrlLog mmAvUrlLog, Model model, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
request, null);
Page<MmAvUrlLog> logPage = null;
try {
resetTime(mmAvUrlLog);
testService.queryConditionCheck(auditLogThread, start, mmAvUrlLog, MmAvUrlLog.class, page);
logPage = new Page<MmAvUrlLog>();
logPage.setPageNo(page.getPageNo());
logPage.setPageSize(page.getPageSize());
String orderBy = "";
if (null != page.getOrderBy() && !page.getOrderBy().equals("")) {
orderBy = Page.getOrderBySql(MmAvIpLog.class.getSimpleName(), page.getOrderBy());
} else {
orderBy = "found_Time";
}
ResultSet rs = HiveSqlService.getResultSet(page, mmAvUrlLog,
Configurations.getStringProperty(MmAvUrlLog.class.getSimpleName() + "HiveTable", "MM_AV_URL_LOG"),
getCol2Col(), orderBy, null);
Map<String, List> tableMapping = HiveJDBC.tableMapping(page, null, rs, MmAvIpLog.class, "foundTime",
"recvTime");
if (tableMapping == null) {
logPage.setList(new ArrayList());
} else {
List list = tableMapping.get("obj");
if (list.size() > 0) {
String jsonString = JsonMapper.toJsonString(list);
List<MmAvUrlLog> List = (java.util.List<MmAvUrlLog>) JsonMapper.fromJsonList(jsonString,
MmAvUrlLog.class);
logPage.setList(List);
logPage.setCount(List.size());
} else {
logPage.setList(new ArrayList());
}
}
} catch (Exception e) {
e.printStackTrace();
auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "音视频URL日志检索失败");
}
throw ((RestServiceException) e);
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "音视频URL日志检索成功",
logPage, 0);
}
@RequestMapping(value = "/mmPicIpLogs", method = RequestMethod.GET)
@ApiOperation(value = "图片IP日志查询", httpMethod = "GET", notes = "对日志功能“图片IP日志”提供数据基础查询服务")
public Map<String, ?> mmPicIpLogs(Page page, MmPicIpLog mmPicIpLog, Model model, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
request, null);
Page<MmPicIpLog> logPage = null;
try {
resetTime(mmPicIpLog);
testService.queryConditionCheck(auditLogThread, start, mmPicIpLog, MmPicIpLog.class, page);
logPage = new Page<MmPicIpLog>();
logPage.setPageNo(page.getPageNo());
logPage.setPageSize(page.getPageSize());
String orderBy = "";
if (null != page.getOrderBy() && !page.getOrderBy().equals("")) {
orderBy = Page.getOrderBySql(MmPicIpLog.class.getSimpleName(), page.getOrderBy());
} else {
orderBy = "found_Time";
}
ResultSet rs = HiveSqlService.getResultSet(page, mmPicIpLog,
Configurations.getStringProperty(MmPicIpLog.class.getSimpleName() + "HiveTable", "MM_PIC_IP_LOG"),
getCol2Col(), orderBy, null);
Map<String, List> tableMapping = HiveJDBC.tableMapping(page, null, rs, MmPicIpLog.class, "foundTime",
"recvTime");
if (tableMapping == null) {
logPage.setList(new ArrayList());
} else {
List list = tableMapping.get("obj");
if (list.size() > 0) {
String jsonString = JsonMapper.toJsonString(list);
List<MmPicIpLog> List = (java.util.List<MmPicIpLog>) JsonMapper.fromJsonList(jsonString,
MmPicIpLog.class);
logPage.setList(List);
logPage.setCount(List.size());
} else {
logPage.setList(new ArrayList());
}
}
} catch (Exception e) {
e.printStackTrace();
auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "图片IP日志检索失败");
}
throw ((RestServiceException) e);
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "图片IP日志检索成功",
logPage, 0);
}
@RequestMapping(value = "/mmPicUrlLogs", method = RequestMethod.GET)
@ApiOperation(value = "图片URL日志查询", httpMethod = "GET", notes = "对日志功能“图片URL日志”提供数据基础查询服务")
public Map<String, ?> mmPicUrlLogs(Page page, MmPicUrlLog mmPicUrlLog, Model model, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
request, null);
Page<MmPicUrlLog> logPage = null;
try {
resetTime(mmPicUrlLog);
testService.queryConditionCheck(auditLogThread, start, mmPicUrlLog, MmPicUrlLog.class, page);
logPage = new Page<MmPicUrlLog>();
logPage.setPageNo(page.getPageNo());
logPage.setPageSize(page.getPageSize());
String orderBy = "";
if (null != page.getOrderBy() && !page.getOrderBy().equals("")) {
orderBy = Page.getOrderBySql(MmPicUrlLog.class.getSimpleName(), page.getOrderBy());
} else {
orderBy = "found_Time";
}
ResultSet rs = HiveSqlService.getResultSet(page, mmPicUrlLog,
Configurations.getStringProperty(MmPicUrlLog.class.getSimpleName() + "HiveTable", "MM_PIC_URL_LOG"),
getCol2Col(), orderBy, null);
Map<String, List> tableMapping = HiveJDBC.tableMapping(page, null, rs, MmPicUrlLog.class, "foundTime",
"recvTime");
if (tableMapping == null) {
logPage.setList(new ArrayList());
} else {
List list = tableMapping.get("obj");
if (list.size() > 0) {
String jsonString = JsonMapper.toJsonString(list);
List<MmPicUrlLog> List = (java.util.List<MmPicUrlLog>) JsonMapper.fromJsonList(jsonString,
MmPicUrlLog.class);
logPage.setList(List);
logPage.setCount(List.size());
} else {
logPage.setList(new ArrayList());
}
}
} catch (Exception e) {
e.printStackTrace();
auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "图片URL日志检索失败");
}
throw ((RestServiceException) e);
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "图片URL日志检索成功",
logPage, 0);
}
@RequestMapping(value = "/mmVoipLogs", method = RequestMethod.GET)
@ApiOperation(value = "VOIP日志查询", httpMethod = "GET", notes = "对日志功能“VOIP日志”提供数据基础查询服务")
public Map<String, ?> mmVoipLogs(Page page, MmVoipLog mmVoipLog, Model model, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
request, null);
Page<MmVoipLog> logPage = null;
try {
resetTime(mmVoipLog);
testService.queryConditionCheck(auditLogThread, start, mmVoipLog, MmAvIpLog.class, page);
logPage = new Page<MmVoipLog>();
logPage.setPageNo(page.getPageNo());
logPage.setPageSize(page.getPageSize());
String orderBy = "";
if (null != page.getOrderBy() && !page.getOrderBy().equals("")) {
orderBy = Page.getOrderBySql(MmVoipLog.class.getSimpleName(), page.getOrderBy());
} else {
orderBy = "found_Time";
}
ResultSet rs = HiveSqlService.getResultSet(page, mmVoipLog,
Configurations.getStringProperty(MmVoipLog.class.getSimpleName() + "HiveTable", "MM_VOIP_LOG"),
getCol2Col(), orderBy, null);
Map<String, List> tableMapping = HiveJDBC.tableMapping(page, null, rs, MmVoipLog.class, "foundTime",
"recvTime");
if (tableMapping == null) {
logPage.setList(new ArrayList());
} else {
List list = tableMapping.get("obj");
if (list.size() > 0) {
String jsonString = JsonMapper.toJsonString(list);
List<MmVoipLog> List = (java.util.List<MmVoipLog>) JsonMapper.fromJsonList(jsonString,
MmVoipLog.class);
logPage.setList(List);
logPage.setCount(List.size());
} else {
logPage.setList(new ArrayList());
}
}
} catch (Exception e) {
e.printStackTrace();
auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "VOIP日志检索失败");
}
throw ((RestServiceException) e);
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "VOIP日志检索成功",
logPage, 0);
}
@RequestMapping(value = "/ntcPzReport", method = RequestMethod.GET)
@ApiOperation(value = "配置日志总量统计", httpMethod = "GET", notes = "配置命中日志数量实时统计报表,对外提供多种数据表现形式,具体可应用于界面配置命中总量业务、配置报表业务等")
public Map<String, ?> ntcPzReport(Page page, NtcPzReport ntcPzReport, Model model, HttpServletRequest request,

View File

@@ -373,10 +373,159 @@
<result column="addr_list" jdbcType="VARCHAR" property="addrList" />
<result column="user_region" jdbcType="VARCHAR" property="userRegion" />
<result column="c2s_pkt_num" jdbcType="VARCHAR" property="c2sPktNum" />
<result column="s2c_pkt_num" jdbcType="VARCHAR" property="s2cPktNum" />
<result column="c2s_byte_num" jdbcType="VARCHAR" property="c2sByteNum" />
<result column="s2c_byte_num" jdbcType="VARCHAR" property="s2cByteNum" />
<result column="c2s_send_pkt_num" jdbcType="VARCHAR" property="c2sSendPktNum" />
<result column="s2c_send_pkt_num" jdbcType="VARCHAR" property="s2cSendPktNum" />
<result column="c2s_send_byte_num" jdbcType="VARCHAR" property="c2sSendByteNum" />
<result column="s2c_send_byte_num" jdbcType="VARCHAR" property="s2cSendByteNum" />
<result column="c2s_recv_pkt_num" jdbcType="VARCHAR" property="c2sRecvPktNum" />
<result column="s2c_recv_pkt_num" jdbcType="VARCHAR" property="s2cRecvPktNum" />
<result column="c2s_recv_byte_num" jdbcType="VARCHAR" property="c2sRecvByteNum" />
<result column="s2c_recv_byte_num" jdbcType="VARCHAR" property="s2cRecvByteNum" />
</resultMap>
<resultMap id="MmAvIpLogMap" type="com.nis.domain.restful.MmAvIpLog">
<result column="cfg_id" jdbcType="BIGINT" property="cfgId" />
<result column="found_Time" jdbcType="TIMESTAMP" property="foundTime" />
<result column="recv_Time" jdbcType="TIMESTAMP" property="recvTime" />
<result column="trans_proto" jdbcType="VARCHAR" property="transProto" />
<result column="addr_type" jdbcType="INTEGER" property="addrType" />
<result column="d_ip" jdbcType="VARCHAR" property="dIp" />
<result column="s_ip" jdbcType="VARCHAR" property="sIp" />
<result column="d_port" jdbcType="VARCHAR" property="dPort" />
<result column="s_port" jdbcType="VARCHAR" property="sPort" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="entrance_id" jdbcType="BIGINT" property="entranceId" />
<result column="device_id" jdbcType="INTEGER" property="deviceId" />
<result column="direction" jdbcType="INTEGER" property="direction" />
<result column="stream_dir" jdbcType="INTEGER" property="streamDir" />
<result column="cap_ip" jdbcType="VARCHAR" property="capIp" />
<result column="addr_list" jdbcType="VARCHAR" property="addrList" />
<result column="user_region" jdbcType="VARCHAR" property="userRegion" />
<result column="pid" jdbcType="VARCHAR" property="pid" />
<result column="url" jdbcType="VARCHAR" property="url" />
<result column="log_uri" jdbcType="VARCHAR" property="logUri" />
<result column="refer" jdbcType="VARCHAR" property="refer" />
<result column="level" jdbcType="INTEGER" property="level" />
<result column="fd_type" jdbcType="INTEGER" property="fdType" />
<result column="protocol" jdbcType="VARCHAR" property="protocol" />
</resultMap>
<resultMap id="MmAvUrlLogMap" type="com.nis.domain.restful.MmAvUrlLog">
<result column="cfg_id" jdbcType="BIGINT" property="cfgId" />
<result column="found_Time" jdbcType="TIMESTAMP" property="foundTime" />
<result column="recv_Time" jdbcType="TIMESTAMP" property="recvTime" />
<result column="trans_proto" jdbcType="VARCHAR" property="transProto" />
<result column="addr_type" jdbcType="INTEGER" property="addrType" />
<result column="d_ip" jdbcType="VARCHAR" property="dIp" />
<result column="s_ip" jdbcType="VARCHAR" property="sIp" />
<result column="d_port" jdbcType="VARCHAR" property="dPort" />
<result column="s_port" jdbcType="VARCHAR" property="sPort" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="entrance_id" jdbcType="BIGINT" property="entranceId" />
<result column="device_id" jdbcType="INTEGER" property="deviceId" />
<result column="direction" jdbcType="INTEGER" property="direction" />
<result column="stream_dir" jdbcType="INTEGER" property="streamDir" />
<result column="cap_ip" jdbcType="VARCHAR" property="capIp" />
<result column="addr_list" jdbcType="VARCHAR" property="addrList" />
<result column="user_region" jdbcType="VARCHAR" property="userRegion" />
<result column="pid" jdbcType="VARCHAR" property="pid" />
<result column="url" jdbcType="VARCHAR" property="url" />
<result column="log_uri" jdbcType="VARCHAR" property="logUri" />
<result column="refer" jdbcType="VARCHAR" property="refer" />
<result column="level" jdbcType="INTEGER" property="level" />
<result column="fd_type" jdbcType="INTEGER" property="fdType" />
<result column="protocol" jdbcType="VARCHAR" property="protocol" />
</resultMap>
<resultMap id="MmPicIpLogMap" type="com.nis.domain.restful.MmPicIpLog">
<result column="cfg_id" jdbcType="BIGINT" property="cfgId" />
<result column="found_Time" jdbcType="TIMESTAMP" property="foundTime" />
<result column="recv_Time" jdbcType="TIMESTAMP" property="recvTime" />
<result column="trans_proto" jdbcType="VARCHAR" property="transProto" />
<result column="addr_type" jdbcType="INTEGER" property="addrType" />
<result column="d_ip" jdbcType="VARCHAR" property="dIp" />
<result column="s_ip" jdbcType="VARCHAR" property="sIp" />
<result column="d_port" jdbcType="VARCHAR" property="dPort" />
<result column="s_port" jdbcType="VARCHAR" property="sPort" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="entrance_id" jdbcType="BIGINT" property="entranceId" />
<result column="device_id" jdbcType="INTEGER" property="deviceId" />
<result column="direction" jdbcType="INTEGER" property="direction" />
<result column="stream_dir" jdbcType="INTEGER" property="streamDir" />
<result column="cap_ip" jdbcType="VARCHAR" property="capIp" />
<result column="addr_list" jdbcType="VARCHAR" property="addrList" />
<result column="user_region" jdbcType="VARCHAR" property="userRegion" />
<result column="pid" jdbcType="VARCHAR" property="pid" />
<result column="url" jdbcType="VARCHAR" property="url" />
<result column="log_uri" jdbcType="VARCHAR" property="logUri" />
<result column="refer" jdbcType="VARCHAR" property="refer" />
<result column="level" jdbcType="INTEGER" property="level" />
<result column="fd_type" jdbcType="INTEGER" property="fdType" />
<result column="protocol" jdbcType="VARCHAR" property="protocol" />
</resultMap>
<resultMap id="MmPicUrlLogMap" type="com.nis.domain.restful.MmPicUrlLog">
<result column="cfg_id" jdbcType="BIGINT" property="cfgId" />
<result column="found_Time" jdbcType="TIMESTAMP" property="foundTime" />
<result column="recv_Time" jdbcType="TIMESTAMP" property="recvTime" />
<result column="trans_proto" jdbcType="VARCHAR" property="transProto" />
<result column="addr_type" jdbcType="INTEGER" property="addrType" />
<result column="d_ip" jdbcType="VARCHAR" property="dIp" />
<result column="s_ip" jdbcType="VARCHAR" property="sIp" />
<result column="d_port" jdbcType="VARCHAR" property="dPort" />
<result column="s_port" jdbcType="VARCHAR" property="sPort" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="entrance_id" jdbcType="BIGINT" property="entranceId" />
<result column="device_id" jdbcType="INTEGER" property="deviceId" />
<result column="direction" jdbcType="INTEGER" property="direction" />
<result column="stream_dir" jdbcType="INTEGER" property="streamDir" />
<result column="cap_ip" jdbcType="VARCHAR" property="capIp" />
<result column="addr_list" jdbcType="VARCHAR" property="addrList" />
<result column="user_region" jdbcType="VARCHAR" property="userRegion" />
<result column="pid" jdbcType="VARCHAR" property="pid" />
<result column="url" jdbcType="VARCHAR" property="url" />
<result column="log_uri" jdbcType="VARCHAR" property="logUri" />
<result column="refer" jdbcType="VARCHAR" property="refer" />
<result column="level" jdbcType="INTEGER" property="level" />
<result column="fd_type" jdbcType="INTEGER" property="fdType" />
<result column="protocol" jdbcType="VARCHAR" property="protocol" />
</resultMap>
<resultMap id="MmVoipLogMap" type="com.nis.domain.restful.MmVoipLog">
<result column="cfg_id" jdbcType="BIGINT" property="cfgId" />
<result column="found_Time" jdbcType="TIMESTAMP" property="foundTime" />
<result column="recv_Time" jdbcType="TIMESTAMP" property="recvTime" />
<result column="trans_proto" jdbcType="VARCHAR" property="transProto" />
<result column="addr_type" jdbcType="INTEGER" property="addrType" />
<result column="d_ip" jdbcType="VARCHAR" property="dIp" />
<result column="s_ip" jdbcType="VARCHAR" property="sIp" />
<result column="d_port" jdbcType="VARCHAR" property="dPort" />
<result column="s_port" jdbcType="VARCHAR" property="sPort" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="entrance_id" jdbcType="BIGINT" property="entranceId" />
<result column="device_id" jdbcType="INTEGER" property="deviceId" />
<result column="direction" jdbcType="INTEGER" property="direction" />
<result column="stream_dir" jdbcType="INTEGER" property="streamDir" />
<result column="cap_ip" jdbcType="VARCHAR" property="capIp" />
<result column="addr_list" jdbcType="VARCHAR" property="addrList" />
<result column="user_region" jdbcType="VARCHAR" property="userRegion" />
<result column="duation" jdbcType="VARCHAR" property="duation" />
<result column="calling_account" jdbcType="VARCHAR" property="callingAccount" />
<result column="called_account" jdbcType="VARCHAR" property="calledAccount" />
<result column="calling_number" jdbcType="VARCHAR" property="callingNumber" />
<result column="called_number" jdbcType="VARCHAR" property="calledNumber" />
<result column="from_to_store_ip" jdbcType="VARCHAR" property="fromToStoreIp" />
<result column="from_to_store_url" jdbcType="VARCHAR" property="fromToStoreUrl" />
<result column="to_store_from_ip" jdbcType="VARCHAR" property="toFromStoreIp" />
<result column="to_store_from_url" jdbcType="VARCHAR" property="toFromStoreUrl" />
<result column="log_uri" jdbcType="VARCHAR" property="logUri" />
<result column="refer" jdbcType="VARCHAR" property="refer" />
<result column="protocol" jdbcType="VARCHAR" property="protocol" />
<result column="pid" jdbcType="VARCHAR" property="pid" />
<result column="url" jdbcType="VARCHAR" property="url" />
<result column="log_uri" jdbcType="VARCHAR" property="logUri" />
<result column="fd_type" jdbcType="INTEGER" property="fdType" />
</resultMap>

View File

@@ -24,6 +24,7 @@ import com.nis.util.ServiceAndRDBIndexReal;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.Transaction;
import redis.clients.jedis.exceptions.JedisConnectionException;
@Service()
public class ConfigJedisServiceimpl implements ConfigRedisService {
@@ -164,8 +165,13 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
} else {
transaction.discard();
}
} catch (JedisConnectionException e) {
// transaction.discard();
logger.error("后台错误:连接redis异常,保存非maat类配置失败,{}", e.getMessage());
throw new RuntimeException("后台错误:连接redis异常,保存非maat类配置失败", e);
} catch (Exception e) {
transaction.discard();
logger.error("后台错误:保存非maat类配置发生了异常,{}", e.getMessage());
throw new RuntimeException("后台错误:保存非maat类配置发生了异常", e);
} finally {
// 释放连接到连接池
@@ -500,9 +506,12 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
addStatisticsReal(configMap, transaction);
transaction.exec();
return true;
}else {
} else {
transaction.exec();
}
} catch (JedisConnectionException e) {
// transaction.discard();
throw new RuntimeException("后台错误:连接redis异常,保存maat类配置失败", e);
} catch (Exception e) {
transaction.discard();
throw new RuntimeException("后台错误:保存maat类配置发生了异常", e);
@@ -735,7 +744,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
}
@Override
public boolean delUnMaatConfig(Map<Integer, Map<Integer, List<Long>>> idMap) {
public boolean delUnMaatConfig(Map<Integer, Map<Integer, List<Long>>> idMap, boolean isInvalid) {
if (idMap != null && idMap.size() > 0) {
int count = 0;
Jedis resource = JedisUtils.getResource(0);
@@ -768,7 +777,14 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
for (String keyStr : keySplit) {
if (!StringUtils.isEmpty(keyStr)
&& keyStr.toUpperCase().equals("EFFECTIVE_RULE")) {
keyStr = "OBSOLETE_RULE";
if(isInvalid) {
keyStr = "OBSOLETE_RULE";
}else {
keyStr = "EFFECTIVE_RULE";
}
keyBF.append(keyStr.trim());
} else if (!StringUtils.isEmpty(keyStr)
&& keyStr.trim().startsWith("[")) {
@@ -792,15 +808,22 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
keyBF.append(keyStr.trim());
}
}
String oldKey = null;
maatKey = keyBF.toString();
String oldKey = maatKey.replace("OBSOLETE_RULE", "EFFECTIVE_RULE");
if (isInvalid) {
oldKey = maatKey.replace("OBSOLETE_RULE", "EFFECTIVE_RULE");
} else {
oldKey = maatKey.replace("EFFECTIVE_RULE", "OBSOLETE_RULE");
}
if (JedisUtils.exists(oldKey.toString().toUpperCase(),
redisDBIndex)) {
transaction.rename(oldKey.toString().toUpperCase(),
keyBF.toString().toUpperCase());
maatKey.toString().toUpperCase());
logger.info("向{}号redis数据库修改了一条配置,修改前key是{},修改后key是{}",
redisDBIndex, oldKey.toString().toUpperCase(),
keyBF.toString().toUpperCase());
maatKey.toString().toUpperCase());
break;
} else {
throw new RuntimeException("后台错误:" + redisDBIndex
@@ -812,10 +835,17 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
if (maatXmlExpr.getKeyExpression().toUpperCase()
.equals("MAAT_UPDATE_STATUS")) {
if (maatKey != null) {
String zset = maatKey.replace("OBSOLETE_RULE:", "DEL,");
transaction.zadd("MAAT_UPDATE_STATUS", maatVersion, zset);
logger.info("向{}号redis数据库更新了MAAT_UPDATE_STATUS,内容是{},SCORES是{}",
redisDBIndex, zset.toUpperCase(), maatVersion);
if (isInvalid) {
String zset = maatKey.replace("OBSOLETE_RULE:", "DEL,");
transaction.zadd("MAAT_UPDATE_STATUS", maatVersion, zset);
logger.info("向{}号redis数据库更新了MAAT_UPDATE_STATUS,内容是{},SCORES是{}",
redisDBIndex, zset.toUpperCase(), maatVersion);
}else {
String zset = maatKey.replace("EFFECTIVE_RULE:", "ADD,");
transaction.zadd("MAAT_UPDATE_STATUS", maatVersion, zset);
logger.info("向{}号redis数据库更新了MAAT_UPDATE_STATUS,内容是{},SCORES是{}",
redisDBIndex, zset.toUpperCase(), maatVersion);
}
}
} else if (maatXmlExpr.getKeyExpression().toUpperCase()
.equals("MAAT_RULE_TIMER")) {
@@ -877,6 +907,9 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
} else {
transaction.discard();
}
} catch (JedisConnectionException e) {
// transaction.discard();
throw new RuntimeException("后台错误:连接redis异常,删除非maat类配置失败", e);
} catch (Exception e) {
transaction.discard();
throw new RuntimeException("后台错误:删除非maat类配置发生了异常", e);
@@ -933,6 +966,9 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
transaction.discard();
}
} catch (JedisConnectionException e) {
// transaction.discard();
throw new RuntimeException("后台错误:连接redis异常,删除maat类配置失败", e);
} catch (Exception e) {
transaction.discard();
throw new RuntimeException("后台错误:删除maat类配置发生了异常", e);

View File

@@ -44,9 +44,10 @@ public interface ConfigRedisService {
/**
* 删除非maat类配置,第一个key是redisDBIndex,第二个key是业务类型,value是配置id集合
* @param idMap
* @param isInvalid 是否将配置置为无效
* @return 成功返回true,失败返回false或抛出异常
*/
public boolean delUnMaatConfig(Map<Integer, Map<Integer, List<Long>>> idMap);
public boolean delUnMaatConfig(Map<Integer, Map<Integer, List<Long>>> idMap,boolean isInvalid);
/**
* 删除maat类配置,第一个key是redisDBIndex,第二个key是业务类型,value是配置id集合

View File

@@ -3024,6 +3024,21 @@ public class ConfigSourcesService extends BaseService {
dstStr.substring(1, dstStr.length() - 1))
.toString();
}
if("dstFile".equals(commonSourceFieldCfg
.getSrcName())){
if ("dst_file".equals(commonSourceFieldCfg
.getDstName())) {
String maatTableName = ServiceAndRDBIndexReal
.getUnMaatTableName(Integer.valueOf(srcMap.get("service")
.toString().trim()));
String dstPath = Constants.MM_SAMPLE_DST_PATH.replace("{tableType}", maatTableName.substring(maatTableName.lastIndexOf("_")+1));
dstPath=dstPath.replace("{fileName}", dstStr.substring(dstStr.lastIndexOf("/")+1));
}else if ("file_id".equals(commonSourceFieldCfg
.getDstName())) {
dstStr= dstStr.substring(dstStr.indexOf("/group"));
}
}
switch (commonSourceFieldCfg.getFieldType()) {
case "Number":
if (!StringUtil.isNumeric(dstStr)) {
@@ -3238,6 +3253,8 @@ public class ConfigSourcesService extends BaseService {
}
// <service,cfgIdList>
Map<Integer, List<Long>> cfgMap = new HashMap<Integer, List<Long>>();
//所有状态更新的配置isValid的值必须相同
Map<String, String> validIdMap = new HashMap<String, String>();
for (int i = 0; i < jsonObjectList.size(); i++) {
JsonObject jsonObj = (JsonObject) jsonObjectList.get(i);
Map<String, Object> srcMap = JSONObject.fromObject(JSONObject
@@ -3250,6 +3267,7 @@ public class ConfigSourcesService extends BaseService {
msg + sb.toString(),
CompileVal.getBusinessCode());
}
validIdMap.put(srcMap.get("isValid").toString(), srcMap.get("isValid").toString());
Integer service = Integer.valueOf(srcMap.get("service").toString());
Long cfgId = Long.valueOf(srcMap.get("cfgId").toString());
if (cfgMap.containsKey(service)) {
@@ -3261,6 +3279,13 @@ public class ConfigSourcesService extends BaseService {
}
}
if (validIdMap.size()>1) {
thread.setExceptionInfo(RestBusinessCode.IsValidNonUniq.getErrorReason());
throw new RestServiceException(thread,
System.currentTimeMillis() - start,
RestBusinessCode.IsValidNonUniq.getErrorReason(),
RestBusinessCode.IsValidNonUniq.getValue());
}
Map<Integer, Map<Integer, List<Long>>> restMap = new HashMap<Integer, Map<Integer, List<Long>>>();
Iterator serviceIterator = cfgMap.keySet().iterator();
while (serviceIterator.hasNext()) {
@@ -3287,7 +3312,8 @@ public class ConfigSourcesService extends BaseService {
}
}
try {
configRedisService.delUnMaatConfig(restMap);
configRedisService.delUnMaatConfig(restMap,validIdMap.containsKey("0")?true:false);
} catch (Exception e) {
// TODO: handle exception
logger.error(e.getMessage());
@@ -3328,10 +3354,12 @@ public class ConfigSourcesService extends BaseService {
if (!StringUtil.isNumeric(service)) {
CompileVal.setBusinessCode(RestBusinessCode.IsValidInWrongRange.getValue());
return RestBusinessCode.IsValidInWrongRange.getErrorReason();
} else if (!isValid.equals("0")) {
CompileVal.setBusinessCode(RestBusinessCode.IsValidIsF.getValue());
return RestBusinessCode.IsValidIsF.getErrorReason();
}
//配置取消改为状态更新(停/启用)
// else if (!isValid.equals("0")) {
// CompileVal.setBusinessCode(RestBusinessCode.IsValidIsF.getValue());
// return RestBusinessCode.IsValidIsF.getErrorReason();
// }
}
return "ok";
}