fix(log):日志检索模块,删除历史activesys ,修改logSource数据类型为int。增加NTC_IP_LOG 日志检索测试服务接口。后续删除历史遗留日志检索功能及其相关对象
This commit is contained in:
@@ -219,9 +219,18 @@ public class BaseRestController {
|
||||
return convert(restResult);
|
||||
}
|
||||
|
||||
public Map serviceResponse(SaveRequestLogThread thread, long time, HttpServletRequest request,
|
||||
HttpServletResponse response, String msg, Object data, String activeSys, String logSource) {
|
||||
logger.info("结果集处理开始----" + System.currentTimeMillis());
|
||||
/**
|
||||
* 日志结果响应格式规范
|
||||
* @param auditLogThread
|
||||
* @param executedTime
|
||||
* @param request
|
||||
* @param msg
|
||||
* @param data
|
||||
* @param logSource
|
||||
* @return
|
||||
*/
|
||||
public Map serviceLogResponse(SaveRequestLogThread auditLogThread, long executedTime, HttpServletRequest request,
|
||||
String msg, Object data, Integer logSource) {
|
||||
RestResult restResult = new RestResult();
|
||||
String requestMethod = request.getMethod();
|
||||
if (requestMethod.equals(RequestMethod.GET.name())) {
|
||||
@@ -240,12 +249,11 @@ public class BaseRestController {
|
||||
restResult.setFromUri(request.getRequestURI());
|
||||
restResult.setData(data);
|
||||
restResult.setMsg(msg);
|
||||
restResult.setActiveSys(activeSys);
|
||||
restResult.setLogSource(logSource);
|
||||
restResult.setTraceCode(thread.getTraceCode());
|
||||
thread.setConsumerTime(time);
|
||||
thread.setBusinessCode(restResult.getBusinessCode().getValue());
|
||||
new Thread(thread).start();
|
||||
restResult.setTraceCode(auditLogThread.getTraceCode());
|
||||
auditLogThread.setConsumerTime(executedTime);
|
||||
auditLogThread.setBusinessCode(restResult.getBusinessCode().getValue());
|
||||
new Thread(auditLogThread).start();
|
||||
return convert(restResult);
|
||||
}
|
||||
|
||||
@@ -264,7 +272,6 @@ public class BaseRestController {
|
||||
}
|
||||
successMap.put(RestConstants.TRACE_CODE, re.getTraceCode());
|
||||
successMap.put(RestConstants.REST_SERVICE_DATA, re.getData());
|
||||
logger.info("结果集处理结束----" + System.currentTimeMillis());
|
||||
return successMap;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class DfKeyConvertUrlController extends BaseRestController{
|
||||
@Autowired
|
||||
protected ServicesRequestLogService servicesRequestLogService;
|
||||
|
||||
protected String logSource = "0";
|
||||
protected int logSource = 0;
|
||||
|
||||
@RequestMapping(value="/dfKeyConvertUrlSources", method = RequestMethod.GET)
|
||||
@ApiOperation(value="关键字业务转换URL日志信息获取" , httpMethod = "GET", notes="get log list")
|
||||
@@ -61,7 +61,9 @@ public class DfKeyConvertUrlController extends BaseRestController{
|
||||
|
||||
if(!Constants.ACTIVESYS_A.equals(searchActiveSys)
|
||||
&& !Constants.ACTIVESYS_C.equals(searchActiveSys)
|
||||
) searchActiveSys=Constants.ACTIVESYS_B;
|
||||
) {
|
||||
searchActiveSys=Constants.ACTIVESYS_B;
|
||||
}
|
||||
|
||||
long start=System.currentTimeMillis();
|
||||
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
|
||||
@@ -80,11 +82,10 @@ public class DfKeyConvertUrlController extends BaseRestController{
|
||||
if (!(e instanceof RestServiceException)) {
|
||||
e = new RestServiceException(thread, System.currentTimeMillis() - start, "关键字业务转换URL日志信息检索失败");
|
||||
}
|
||||
((RestServiceException) e).setActiveSys(searchActiveSys);
|
||||
((RestServiceException) e).setLogSource(logSource);
|
||||
throw ((RestServiceException) e);
|
||||
}
|
||||
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "关键字业务转换URL日志信息检索成功",dfKeyConvertUrlPage
|
||||
,searchActiveSys, logSource);
|
||||
return serviceLogResponse(thread, System.currentTimeMillis()-start, request, "关键字业务转换URL日志信息检索成功",dfKeyConvertUrlPage
|
||||
, logSource);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class DfKeyMailAddController extends BaseRestController {
|
||||
@Autowired
|
||||
protected DfKeyMailAddService dfKeyMailAddService;
|
||||
|
||||
protected String logSource = "0";
|
||||
protected int logSource = 0;
|
||||
|
||||
@RequestMapping(value = "/dfKeyMailAddSources", method = RequestMethod.GET)
|
||||
@ApiOperation(value = "关键字业务转换邮件地址日志信息获取", httpMethod = "GET", notes = "get log list")
|
||||
@@ -61,7 +61,9 @@ public class DfKeyMailAddController extends BaseRestController {
|
||||
|
||||
if(!Constants.ACTIVESYS_A.equals(searchActiveSys)
|
||||
&& !Constants.ACTIVESYS_C.equals(searchActiveSys)
|
||||
) searchActiveSys=Constants.ACTIVESYS_B;
|
||||
) {
|
||||
searchActiveSys=Constants.ACTIVESYS_B;
|
||||
}
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null);
|
||||
@@ -81,11 +83,11 @@ public class DfKeyMailAddController extends BaseRestController {
|
||||
if (!(e instanceof RestServiceException)) {
|
||||
e = new RestServiceException(thread, System.currentTimeMillis() - start, "关键字业务转换邮件地址日志信息检索失败");
|
||||
}
|
||||
((RestServiceException) e).setActiveSys(searchActiveSys);
|
||||
|
||||
((RestServiceException) e).setLogSource(logSource);
|
||||
throw ((RestServiceException) e);
|
||||
}
|
||||
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "关键字业务转换邮件地址日志信息检索成功",
|
||||
dfKeyMailAddPage,searchActiveSys, logSource);
|
||||
return serviceLogResponse(thread, System.currentTimeMillis() - start, request, "关键字业务转换邮件地址日志信息检索成功",
|
||||
dfKeyMailAddPage, logSource);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -50,7 +50,7 @@ public class IntervalTimeSearchController extends BaseRestController{
|
||||
@Autowired
|
||||
protected ServicesRequestLogService servicesRequestLogService;
|
||||
|
||||
protected String logSource = "0";
|
||||
protected Integer logSource = 0;
|
||||
|
||||
@RequestMapping(value="/djFlowControlStopSources", method = RequestMethod.GET)
|
||||
@ApiOperation(value="监测规则流控信息获取" , httpMethod = "GET", notes="get log list")
|
||||
@@ -59,9 +59,12 @@ public class IntervalTimeSearchController extends BaseRestController{
|
||||
Page page, DjFlowControlStop flowControlStop, HttpServletRequest request,
|
||||
HttpServletResponse response, Model model) {
|
||||
|
||||
if(!Constants.ACTIVESYS_A.equals(searchActiveSys)
|
||||
if (!Constants.ACTIVESYS_A.equals(searchActiveSys)
|
||||
&& !Constants.ACTIVESYS_C.equals(searchActiveSys)
|
||||
)searchActiveSys=Constants.ACTIVESYS_B;
|
||||
) {
|
||||
searchActiveSys=Constants.ACTIVESYS_B;
|
||||
|
||||
}
|
||||
|
||||
long start=System.currentTimeMillis();
|
||||
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
|
||||
@@ -79,11 +82,10 @@ public class IntervalTimeSearchController extends BaseRestController{
|
||||
if (!(e instanceof RestServiceException)) {
|
||||
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测规则流控信息检索失败");
|
||||
}
|
||||
((RestServiceException) e).setActiveSys(searchActiveSys);
|
||||
((RestServiceException) e).setLogSource(logSource);
|
||||
throw ((RestServiceException) e);
|
||||
}
|
||||
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "监测规则流控信息检索成功",flowControlStopPage
|
||||
,searchActiveSys, logSource);
|
||||
return serviceLogResponse(thread, System.currentTimeMillis()-start,request, "监测规则流控信息检索成功", flowControlStopPage
|
||||
, logSource);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.nis.web.controller.restful;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.NtcIpLog;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.controller.BaseRestController;
|
||||
import com.nis.web.service.SaveRequestLogThread;
|
||||
import com.nis.web.service.ServicesRequestLogService;
|
||||
import com.nis.web.service.restful.LogTestService;
|
||||
import com.wordnik.swagger.annotations.Api;
|
||||
import com.wordnik.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by darnell on 2018/6/10.
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("${servicePath}/log/v1")
|
||||
@Api(value = "LogController", description = "配置命中日志基本服务接口")
|
||||
public class LogController extends BaseRestController{
|
||||
@Autowired
|
||||
public LogTestService testService;
|
||||
|
||||
@Autowired
|
||||
protected ServicesRequestLogService servicesRequestLogService;
|
||||
|
||||
@RequestMapping(value = "/ntcIpLogs", method = RequestMethod.GET)
|
||||
@ApiOperation(value = "IP地址日志查询", httpMethod = "GET", notes = "对应配置为IP地址管理,存储动作为阻断与监测的命中日志。对日志功能IP地址提供数据基础查询服务")
|
||||
public Map<String, ?> ntcIpLogs(Page page, NtcIpLog ntcIpLog, Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||
long start = System.currentTimeMillis();
|
||||
SaveRequestLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null);
|
||||
|
||||
Page<NtcIpLog> ntcIpLogPage = new Page<>();
|
||||
try {
|
||||
ntcIpLogPage = testService.findNtcIpLogPage(
|
||||
new Page<NtcIpLog>(request, response, NtcIpLog.class), ntcIpLog);
|
||||
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "IP地址日志检索成功", ntcIpLogPage, 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -24,7 +24,7 @@ import com.nis.web.controller.BaseController;
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/sys/area")
|
||||
public class AreaController extends BaseController {
|
||||
|
||||
|
||||
|
||||
@ModelAttribute
|
||||
public SysArea get(@RequestParam(required=false) Long id) {
|
||||
|
||||
Reference in New Issue
Block a user