删除日志统计和日志报表接口

This commit is contained in:
zhangdongxu
2017-12-22 15:22:11 +08:00
parent 9bcc1211c6
commit ed111ec4b8
149 changed files with 44 additions and 20019 deletions

View File

@@ -1,231 +0,0 @@
package com.nis.web.controller.restful;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.nis.domain.Page;
import com.nis.domain.restful.DfDjLogStatistics;
import com.nis.domain.restful.DfDjPzLogStatistics;
import com.nis.restful.RestServiceException;
import com.nis.util.Constants;
import com.nis.util.JsonMapper;
import com.nis.util.redis.RedisDao;
import com.nis.util.redis.SaveRedisThread;
import com.nis.web.controller.BaseRestController;
import com.nis.web.service.SaveRequestLogThread;
import com.nis.web.service.ServicesRequestLogService;
import com.nis.web.service.restful.DfdjLogStatService;
import com.wordnik.swagger.annotations.ApiOperation;
/**
* @ClassName: LogStatisticsController
* @Description: 封堵/监测日志统计查询服务
* @author (zbc)
* @date 2016年11月14日 下午4:00:00
* @version V1.0
*/
@RestController
@RequestMapping("${servicePath}/log/v1")
@SuppressWarnings({ "rawtypes", "unchecked" })
public class DfDjLogStatController extends BaseRestController {
protected final Logger logger = Logger.getLogger(this.getClass());
protected String logSource="0";
@Autowired
protected DfdjLogStatService logStatService;
@Autowired
protected RedisDao redisDao;
@Autowired
protected ServicesRequestLogService servicesRequestLogService;
/*@RequestMapping(value="/dfLogStatistics", method = RequestMethod.GET)
@ApiOperation(value="封堵日志总量统计查询" , httpMethod = "GET", notes="get log list")
public Map dfLogStatistics(
@RequestParam(value = "searchStatActiveSys", required = false, defaultValue = "2") String searchStatActiveSys,
@RequestParam(value = "searchService", required = true) String searchService,
DfDjLogStatistics logStatistics, HttpServletRequest request, HttpServletResponse response) {
if(!"4".equals(searchStatActiveSys) ) {
searchStatActiveSys="2";
logStatistics.setSearchStatActiveSys(searchStatActiveSys);
}
long start = System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
DfDjLogStatistics entity = null;
try{
logStatService.queryConditionCheck(thread,start,logStatistics, DfDjLogStatistics.class, null);
entity = logStatService.findDfLogStatistics(logStatistics);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"封堵日志总量统计检索失败");
}
((RestServiceException) e).setActiveSys(searchStatActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "封堵日志总量统计检索成功",
entity, searchStatActiveSys, logSource);
}
@RequestMapping(value="/dfPzLogStatistics", method = RequestMethod.GET)
@ApiOperation(value="封堵配置日志总量统计查询" , httpMethod = "GET", notes="get log list")
public Map dfPzLogStatistics(
@RequestParam(value = "searchStatActiveSys", required = false, defaultValue = "2") String searchStatActiveSys,
@RequestParam(value = "searchService", required = true) String searchService,
Page<DfDjPzLogStatistics> page, DfDjPzLogStatistics logStatistics,
HttpServletRequest request, HttpServletResponse response) {
if(!"4".equals(searchStatActiveSys) ) {
searchStatActiveSys="2";
logStatistics.setSearchStatActiveSys(searchStatActiveSys);
}
long start = System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DfDjPzLogStatistics> logPage = null;
boolean keyExists = false;
String key = "";
try {
logStatService.queryConditionCheck(thread,start,logStatistics, DfDjPzLogStatistics.class, page);
if (Constants.IS_OPEN_REDIS) {
// 根据查询条件获取key
key = logStatService.getJedisKey(request, true);
// 判断key是否存在
keyExists = redisDao.exists(key);
}
// 存在则直接从redis中查询
if (keyExists) {
logPage = (Page<DfDjPzLogStatistics>) JsonMapper.fromJsonString(redisDao.getString(key), Page.class);
} else {
// 不存在则查询数据库并保存查询结果到redis中
logPage = logStatService.findDfPzLogStatistics(
new Page<DfDjPzLogStatistics>(request, response, DfDjPzLogStatistics.class), logStatistics);
if (Constants.IS_OPEN_REDIS)
new SaveRedisThread(key, logPage, Constants.ORACLE_EXPIRE).start();
}
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"封堵配置日志总量统计检索失败");
}
((RestServiceException) e).setActiveSys(searchStatActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "封堵配置日志总量统计检索成功",
logPage, searchStatActiveSys, logSource);
}
@RequestMapping(value="/djLogStatistics", method = RequestMethod.GET)
@ApiOperation(value="监测日志总量统计查询" , httpMethod = "GET", notes="get log list")
public Map djLogStatistics(
@RequestParam(value = "searchStatActiveSys", required = false, defaultValue = "2") String searchStatActiveSys,
@RequestParam(value = "searchService", required = true) String searchService,
DfDjLogStatistics logStatistics, HttpServletRequest request, HttpServletResponse response) {
if(!"4".equals(searchStatActiveSys) ) {
searchStatActiveSys="2";
logStatistics.setSearchStatActiveSys(searchStatActiveSys);
}
long start = System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
DfDjLogStatistics entity = null;
try{
logStatService.queryConditionCheck(thread,start,logStatistics, DfDjLogStatistics.class, null);
entity = logStatService.findDjLogStatistics(logStatistics);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"监测日志总量统计检索失败");
}
((RestServiceException) e).setActiveSys(searchStatActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测日志总量统计检索成功",
entity, searchStatActiveSys, logSource);
}
@RequestMapping(value="/djPzLogStatistics", method = RequestMethod.GET)
@ApiOperation(value="监测配置日志总量统计查询" , httpMethod = "GET", notes="get log list")
public Map djPzLogStatistics(
@RequestParam(value = "searchStatActiveSys", required = false, defaultValue = "2") String searchStatActiveSys,
@RequestParam(value = "searchService", required = true) String searchService,
Page<DfDjPzLogStatistics> page, DfDjPzLogStatistics logStatistics,
HttpServletRequest request, HttpServletResponse response) {
if(!"4".equals(searchStatActiveSys) ) {
searchStatActiveSys="2";
logStatistics.setSearchStatActiveSys(searchStatActiveSys);
}
long start = System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DfDjPzLogStatistics> logPage = null;
boolean keyExists = false;
String key = "";
try {
logStatService.queryConditionCheck(thread,start,logStatistics, DfDjPzLogStatistics.class, page);
if (Constants.IS_OPEN_REDIS) {
// 根据查询条件获取key
key = logStatService.getJedisKey(request, true);
// 判断key是否存在
keyExists = redisDao.exists(key);
}
// 存在则直接从redis中查询
if (keyExists) {
logPage = (Page<DfDjPzLogStatistics>) JsonMapper.fromJsonString(redisDao.getString(key), Page.class);
} else {
// 不存在则查询数据库并保存查询结果到redis中
logPage = logStatService.findDjPzLogStatistics(
new Page<DfDjPzLogStatistics>(request, response, DfDjPzLogStatistics.class), logStatistics);
if (Constants.IS_OPEN_REDIS)
new SaveRedisThread(key, logPage, Constants.ORACLE_EXPIRE).start();
}
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"监测配置日志总量统计检索失败");
}
((RestServiceException) e).setActiveSys(searchStatActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测配置日志总量统计检索成功",
logPage, searchStatActiveSys, logSource);
}*/
}

View File

@@ -1,753 +0,0 @@
package com.nis.web.controller.restful;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.nis.domain.Page;
import com.nis.domain.restful.DfJitAffairDestReport;
import com.nis.domain.restful.DfJitAffairSrcReport;
import com.nis.domain.restful.DfJitFlDestReport;
import com.nis.domain.restful.DfJitFlSrcReport;
import com.nis.domain.restful.DfJitGuaranteeDestReport;
import com.nis.domain.restful.DfJitGuaranteeSrcReport;
import com.nis.domain.restful.DfJitIdDestReport;
import com.nis.domain.restful.DfJitIdSrcReport;
import com.nis.domain.restful.DfJitMissionDestReport;
import com.nis.domain.restful.DfJitMissionSrcReport;
import com.nis.domain.restful.DfJitTagDestReport;
import com.nis.domain.restful.DfJitTagSrcReport;
import com.nis.restful.RestBusinessCode;
import com.nis.restful.RestServiceException;
import com.nis.util.Constants;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseRestController;
import com.nis.web.service.SaveRequestLogThread;
import com.nis.web.service.ServicesRequestLogService;
import com.nis.web.service.restful.DfJitLogSearchService;
import com.wordnik.swagger.annotations.ApiOperation;
/**
*
* @ClassName: DfJitLogSearchController
* @Description: 管控日志实时统计查询服务
* @author (rkg)
* @date 2016年9月13日上午10:32:21
* @version V1.0
*/
@RestController
@RequestMapping("${servicePath}/log/v1")
@SuppressWarnings({ "rawtypes" })
public class DfJitLogSearchController extends BaseRestController {
private final Logger logger1 = Logger.getLogger(this.getClass());
protected String logSource="0";
@Autowired
private DfJitLogSearchService dfJitLogSearchService;
@Autowired
protected ServicesRequestLogService servicesRequestLogService;
@RequestMapping(value = "/dfJitFlSrcReportSources", method = RequestMethod.GET)
@ApiOperation(value = "管控分类性质源IP实时统计", httpMethod = "GET", notes = "管控分类性质源IP实时统计列表")
public Map dfJitFlSrcReportSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DfJitFlSrcReport dfJitFlSrcReportSources, HttpServletRequest request,
HttpServletResponse response) {
if(!Constants.ACTIVESYS_A.equals(searchActiveSys) && !Constants.ACTIVESYS_C.equals(searchActiveSys)) searchActiveSys=Constants.ACTIVESYS_B;
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DfJitFlSrcReport> dfJitFlSrcReportSourcesPage = null;
try {
// 公共请求参数校验
dfJitLogSearchService.queryDfJitFlCheck(thread, start, dfJitFlSrcReportSources.getSearchFl(),
dfJitFlSrcReportSources.getSearchXz());
dfJitLogSearchService.queryConditionCheck(thread, start, dfJitFlSrcReportSources, DfJitFlSrcReport.class,
page);
dfJitFlSrcReportSourcesPage = dfJitLogSearchService.findDfJitFlSrcReport(
new Page<DfJitFlSrcReport>(request, response, DfJitFlSrcReport.class), dfJitFlSrcReportSources);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控分类性质源IP实时统计检索失败");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控分类性质源IP实时统计检索成功",
dfJitFlSrcReportSourcesPage, searchActiveSys,logSource);
}
@RequestMapping(value = "/dfJitFlDestReportSources", method = RequestMethod.GET)
@ApiOperation(value = "管控分类性质目的IP实时统计服务", httpMethod = "GET", notes = "管控分类性质目的IP实时统计列表")
public Map dfJitFlDestReportSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DfJitFlDestReport dfJitFlDestReport, HttpServletRequest request, HttpServletResponse response) {
if(!Constants.ACTIVESYS_A.equals(searchActiveSys) && !Constants.ACTIVESYS_C.equals(searchActiveSys)) searchActiveSys=Constants.ACTIVESYS_B;
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DfJitFlDestReport> reporPage = null;
try {
// 公共请求参数校验
dfJitLogSearchService.queryDfJitFlCheck(thread, start, dfJitFlDestReport.getSearchFl(),
dfJitFlDestReport.getSearchXz());
dfJitLogSearchService.queryConditionCheck(thread, start, dfJitFlDestReport, DfJitFlDestReport.class, page);
reporPage = dfJitLogSearchService.findDfJitFlDestReport(
new Page<DfJitFlDestReport>(request, response, DfJitFlDestReport.class), dfJitFlDestReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控分类性质目的IP实时统计检索失败");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控分类性质目的IP实时统计检索成功",
reporPage, searchActiveSys,logSource);
}
@RequestMapping(value = "/dfJitAffairSrcReportSources", method = RequestMethod.GET)
@ApiOperation(value = "管控事件子话题源IP实时统计服务", httpMethod = "GET", notes = "管控事件子话题源IP实时统计列表")
public Map dfJitAffairSrcReportSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DfJitAffairSrcReport dfJitAffairSrcReport, HttpServletRequest request,
HttpServletResponse response) {
if(!Constants.ACTIVESYS_A.equals(searchActiveSys) && !Constants.ACTIVESYS_C.equals(searchActiveSys)) searchActiveSys=Constants.ACTIVESYS_B;
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
// 公共请求参数校验
try {
if (!StringUtil.isBlank(dfJitAffairSrcReport.getSearchAffair())) {
Integer.parseInt(dfJitAffairSrcReport.getSearchAffair());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchAffair参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchAffair参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
try {
if (!StringUtil.isBlank(dfJitAffairSrcReport.getSearchTopic())) {
Integer.parseInt(dfJitAffairSrcReport.getSearchTopic());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchTopic参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchTopic参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
Page<DfJitAffairSrcReport> reporPage = null;
try {
dfJitLogSearchService.queryConditionCheck(thread, start, dfJitAffairSrcReport, DfJitAffairSrcReport.class,
page);
reporPage = dfJitLogSearchService.findDfJitAffairSrcReport(
new Page<DfJitAffairSrcReport>(request, response, DfJitAffairSrcReport.class),
dfJitAffairSrcReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控事件子话题源IP实时统计检索失败");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控事件子话题源IP实时统计检索成功",
reporPage, searchActiveSys,logSource);
}
@RequestMapping(value = "/dfJitAffairDestReportSources", method = RequestMethod.GET)
@ApiOperation(value = "管控事件子话题目的IP实时统计服务", httpMethod = "GET", notes = "管控事件子话题目的IP实时统计列表")
public Map dfJitAffairDestReportSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DfJitAffairDestReport dfJitAffairDestReport, HttpServletRequest request,
HttpServletResponse response) {
if(!Constants.ACTIVESYS_A.equals(searchActiveSys) && !Constants.ACTIVESYS_C.equals(searchActiveSys)) searchActiveSys=Constants.ACTIVESYS_B;
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
// 公共请求参数校验
try {
if (!StringUtil.isBlank(dfJitAffairDestReport.getSearchAffair())) {
Integer.parseInt(dfJitAffairDestReport.getSearchAffair());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchAffair参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchAffair参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
try {
if (!StringUtil.isBlank(dfJitAffairDestReport.getSearchTopic())) {
Integer.parseInt(dfJitAffairDestReport.getSearchTopic());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchTopic参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchTopic参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
Page<DfJitAffairDestReport> reporPage = null;
try {
dfJitLogSearchService.queryConditionCheck(thread, start, dfJitAffairDestReport, DfJitAffairDestReport.class,
page);
reporPage = dfJitLogSearchService.findDfJitAffairDestReport(
new Page<DfJitAffairDestReport>(request, response, DfJitAffairDestReport.class),
dfJitAffairDestReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控事件子话题目的IP实时统计检索失败");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控事件子话题目的IP实时统计检索成功",
reporPage, searchActiveSys,logSource);
}
@RequestMapping(value = "/dfJitMissionSrcReportSources", method = RequestMethod.GET)
@ApiOperation(value = "管控任务源IP实时统计服务", httpMethod = "GET", notes = "管控任务源IP实时统计列表")
public Map dfJitMissionSrcReportSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DfJitMissionSrcReport dfJitMissionSrcReport, HttpServletRequest request,
HttpServletResponse response) {
if(!Constants.ACTIVESYS_A.equals(searchActiveSys) && !Constants.ACTIVESYS_C.equals(searchActiveSys)) searchActiveSys=Constants.ACTIVESYS_B;
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
// 公共请求参数校验
try {
if (!StringUtil.isBlank(dfJitMissionSrcReport.getSearchMission())) {
Integer.parseInt(dfJitMissionSrcReport.getSearchMission());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchMission参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchMission参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
Page<DfJitMissionSrcReport> reporPage = null;
try {
dfJitLogSearchService.queryConditionCheck(thread, start, dfJitMissionSrcReport, DfJitMissionSrcReport.class,
page);
reporPage = dfJitLogSearchService.findDfJitMissionSrcReport(
new Page<DfJitMissionSrcReport>(request, response, DfJitMissionSrcReport.class),
dfJitMissionSrcReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控任务源IP实时统计检索失败");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控任务源IP实时统计检索成功",
reporPage, searchActiveSys,logSource);
}
@RequestMapping(value = "/dfJitMissionDestReportSources", method = RequestMethod.GET)
@ApiOperation(value = "管控任务目的IP实时统计服务", httpMethod = "GET", notes = "管控任务目的IP实时统计列表")
public Map dfJitMissionDestReportSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DfJitMissionDestReport dfJitMissionDestReport, HttpServletRequest request,
HttpServletResponse response) {
if(!Constants.ACTIVESYS_A.equals(searchActiveSys) && !Constants.ACTIVESYS_C.equals(searchActiveSys)) searchActiveSys=Constants.ACTIVESYS_B;
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
// 公共请求参数校验
try {
if (!StringUtil.isBlank(dfJitMissionDestReport.getSearchMission())) {
Integer.parseInt(dfJitMissionDestReport.getSearchMission());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchMission参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchMission参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
Page<DfJitMissionDestReport> reporPage = null;
try {
dfJitLogSearchService.queryConditionCheck(thread, start, dfJitMissionDestReport,
DfJitMissionDestReport.class, page);
reporPage = dfJitLogSearchService.findDfJitMissionDestReport(
new Page<DfJitMissionDestReport>(request, response, DfJitMissionDestReport.class),
dfJitMissionDestReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控任务目的IP实时统计检索失败");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控任务目的IP实时统计检索成功",
reporPage, searchActiveSys,logSource);
}
@RequestMapping(value = "/dfJitGuaranteeSrcReportSources", method = RequestMethod.GET)
@ApiOperation(value = "管控保障期源IP实时统计服务", httpMethod = "GET", notes = "管控保障期源IP实时统计列表")
public Map dfJitGuaranteeSrcReportSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DfJitGuaranteeSrcReport dfJitGuaranteeSrcReport, HttpServletRequest request,
HttpServletResponse response) {
if(!Constants.ACTIVESYS_A.equals(searchActiveSys) && !Constants.ACTIVESYS_C.equals(searchActiveSys)) searchActiveSys=Constants.ACTIVESYS_B;
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
// 公共请求参数校验
try {
if (!StringUtil.isBlank(dfJitGuaranteeSrcReport.getSearchGuarantee())) {
Integer.parseInt(dfJitGuaranteeSrcReport.getSearchGuarantee());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchGuarantee参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchGuarantee参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
Page<DfJitGuaranteeSrcReport> reporPage = null;
try {
dfJitLogSearchService.queryConditionCheck(thread, start, dfJitGuaranteeSrcReport,
DfJitGuaranteeSrcReport.class, page);
reporPage = dfJitLogSearchService.findDfJitGuaranteeSrcReport(
new Page<DfJitGuaranteeSrcReport>(request, response, DfJitGuaranteeSrcReport.class),
dfJitGuaranteeSrcReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控保障期源IP实时统计检索失败");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控保障期源IP实时统计检索成功",
reporPage, searchActiveSys,logSource);
}
@RequestMapping(value = "/dfJitGuaranteeDestReportSources", method = RequestMethod.GET)
@ApiOperation(value = "管控保障期目的IP实时统计服务", httpMethod = "GET", notes = "管控保障期目的IP实时统计列表")
public Map dfJitGuaranteeDestReportSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DfJitGuaranteeDestReport dfJitGuaranteeDestReport, HttpServletRequest request,
HttpServletResponse response) {
if(!Constants.ACTIVESYS_A.equals(searchActiveSys) && !Constants.ACTIVESYS_C.equals(searchActiveSys)) searchActiveSys=Constants.ACTIVESYS_B;
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
// 公共请求参数校验
try {
if (!StringUtil.isBlank(dfJitGuaranteeDestReport.getSearchGuarantee())) {
Integer.parseInt(dfJitGuaranteeDestReport.getSearchGuarantee());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchGuarantee参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchGuarantee参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
Page<DfJitGuaranteeDestReport> reporPage = null;
try {
dfJitLogSearchService.queryConditionCheck(thread, start, dfJitGuaranteeDestReport,
DfJitGuaranteeDestReport.class, page);
reporPage = dfJitLogSearchService.findDfJitGuaranteeDestReport(
new Page<DfJitGuaranteeDestReport>(request, response, DfJitGuaranteeDestReport.class),
dfJitGuaranteeDestReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控保障期目的IP实时统计检索失败");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控保障期目的IP实时统计检索成功",
reporPage, searchActiveSys,logSource);
}
@RequestMapping(value = "/dfJitTagSrcReportSources", method = RequestMethod.GET)
@ApiOperation(value = "管控标签源IP实时统计服务", httpMethod = "GET", notes = "管控标签源IP实时统计列表")
public Map dfJitTagSrcReportSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DfJitTagSrcReport dfJitTagSrcReport, HttpServletRequest request, HttpServletResponse response) {
if(!Constants.ACTIVESYS_A.equals(searchActiveSys) && !Constants.ACTIVESYS_C.equals(searchActiveSys)) searchActiveSys=Constants.ACTIVESYS_B;
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
// 公共请求参数校验
if (null != dfJitTagSrcReport.getSearchTag() && !dfJitTagSrcReport.getSearchTag().equals("")) {
String[] tagArr = dfJitTagSrcReport.getSearchTag().split(",");
List<String> tagList = new ArrayList<String>();
for (int i = 0; i < tagArr.length; i++) {
if (!tagArr[i].equals("")) {
try {
Integer.parseInt(tagArr[i]);
tagList.add(tagArr[i]);
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread,
System.currentTimeMillis() - start, "searchTag参数格式错误",
RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchTag参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
}
}
StringBuffer sb = new StringBuffer();
for (String str : tagList) {
sb.append(str + ",");
}
String tag = sb.substring(0, sb.length() - 1);
dfJitTagSrcReport.setSearchTag(tag);
}
Page<DfJitTagSrcReport> reporPage = null;
try {
dfJitLogSearchService.queryConditionCheck(thread, start, dfJitTagSrcReport, DfJitTagSrcReport.class, page);
reporPage = dfJitLogSearchService.findDfJitTagSrcReport(
new Page<DfJitTagSrcReport>(request, response, DfJitTagSrcReport.class), dfJitTagSrcReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控标签源IP实时统计检索失败");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控标签源IP实时统计检索成功",
reporPage, searchActiveSys,logSource);
}
@RequestMapping(value = "/dfJitTagDestReportSources", method = RequestMethod.GET)
@ApiOperation(value = "管控标签目的IP实时统计服务", httpMethod = "GET", notes = "管控标签目的IP实时统计列表")
public Map dfJitTagDestReportSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DfJitTagDestReport dfJitTagDestReport, HttpServletRequest request,
HttpServletResponse response) {
if(!Constants.ACTIVESYS_A.equals(searchActiveSys) && !Constants.ACTIVESYS_C.equals(searchActiveSys)) searchActiveSys=Constants.ACTIVESYS_B;
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
// 公共请求参数校验
if (null != dfJitTagDestReport.getSearchTag() && !dfJitTagDestReport.getSearchTag().equals("")) {
String[] tagArr = dfJitTagDestReport.getSearchTag().split(",");
List<String> tagList = new ArrayList<String>();
for (int i = 0; i < tagArr.length; i++) {
if (!tagArr[i].equals("")) {
try {
Integer.parseInt(tagArr[i]);
tagList.add(tagArr[i]);
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread,
System.currentTimeMillis() - start, "searchTag参数格式错误",
RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchTag参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
}
}
StringBuffer sb = new StringBuffer();
for (String str : tagList) {
sb.append(str + ",");
}
String tag = sb.substring(0, sb.length() - 1);
dfJitTagDestReport.setSearchTag(tag);
}
Page<DfJitTagDestReport> reporPage = null;
try {
dfJitLogSearchService.queryConditionCheck(thread, start, dfJitTagDestReport, DfJitTagDestReport.class,
page);
reporPage = dfJitLogSearchService.findDfJitTagDestReport(
new Page<DfJitTagDestReport>(request, response, DfJitTagDestReport.class), dfJitTagDestReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控标签目的IP实时统计检索失败");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控标签目的IP实时统计检索成功",
reporPage, searchActiveSys,logSource);
}
@RequestMapping(value = "/dfJitIdSrcReportSources", method = RequestMethod.GET)
@ApiOperation(value = "管控规则源IP实时统计服务", httpMethod = "GET", notes = "管控规则源IP实时统计列表")
public Map dfJitIdSrcReportSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DfJitIdSrcReport dfJitIdSrcReport, HttpServletRequest request, HttpServletResponse response) {
if(!Constants.ACTIVESYS_A.equals(searchActiveSys) && !Constants.ACTIVESYS_C.equals(searchActiveSys)) searchActiveSys=Constants.ACTIVESYS_B;
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
// 公共请求参数校验
try {
if (!StringUtil.isBlank(dfJitIdSrcReport.getSearchId())) {
Integer.parseInt(dfJitIdSrcReport.getSearchId());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchId参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchId参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
Page<DfJitIdSrcReport> reporPage = null;
try {
dfJitLogSearchService.queryConditionCheck(thread, start, dfJitIdSrcReport, DfJitIdSrcReport.class, page);
reporPage = dfJitLogSearchService.findDfJitIdSrcReport(
new Page<DfJitIdSrcReport>(request, response, DfJitIdSrcReport.class), dfJitIdSrcReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控规则源IP实时统计检索失败");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控规则源IP实时统计检索成功",
reporPage, searchActiveSys,logSource);
}
@RequestMapping(value = "/dfJitIdDestReportSources", method = RequestMethod.GET)
@ApiOperation(value = "管控规则目的IP实时统计服务", httpMethod = "GET", notes = "管控规则目的IP实时统计列表")
public Map dfJitIdDestReportSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DfJitIdDestReport dfJitIdDestReport, HttpServletRequest request, HttpServletResponse response) {
if(!Constants.ACTIVESYS_A.equals(searchActiveSys) && !Constants.ACTIVESYS_C.equals(searchActiveSys)) searchActiveSys=Constants.ACTIVESYS_B;
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
// 公共请求参数校验
try {
if (!StringUtil.isBlank(dfJitIdDestReport.getSearchId())) {
Integer.parseInt(dfJitIdDestReport.getSearchId());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchId参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchId参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
Page<DfJitIdDestReport> reporPage = null;
try {
dfJitLogSearchService.queryConditionCheck(thread, start, dfJitIdDestReport, DfJitIdDestReport.class, page);
reporPage = dfJitLogSearchService.findDfJitIdDestReport(
new Page<DfJitIdDestReport>(request, response, DfJitIdDestReport.class), dfJitIdDestReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控规则目的IP实时统计检索失败");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控规则目的IP实时统计检索成功",
reporPage, searchActiveSys,logSource);
}
}

View File

@@ -1,215 +0,0 @@
package com.nis.web.controller.restful;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
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 com.nis.domain.DfReportEntity;
import com.nis.domain.LogEntity;
import com.nis.domain.Page;
import com.nis.domain.restful.DfLwhhAttrReport;
import com.nis.domain.restful.DfLwhhTagReport;
import com.nis.domain.restful.DfSrcIpAttrReport;
import com.nis.domain.restful.DfSrcIpTagReport;
import com.nis.restful.RestServiceException;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.web.controller.BaseRestController;
import com.nis.web.service.SaveRequestLogThread;
import com.nis.web.service.ServicesRequestLogService;
import com.nis.web.service.restful.DfMultiDimensionalReportService;
import com.wordnik.swagger.annotations.ApiOperation;
/**
*
* @ClassName: DfMultiDimensionalReportController
* @Description: TODO(df多维实时统计)
* @author (DDM)
* @date 2017年8月4日下午2:53:01
* @version V1.0
*/
@RestController
@RequestMapping("${servicePath}/log/v1")
@SuppressWarnings({ "rawtypes" })
public class DfMultiDimensionalReportController extends BaseRestController {
protected final Logger logger = Logger.getLogger(this.getClass());
protected String activeSys = Constants.ACTIVESYS_ALL;
protected String logSource = "0";
@Autowired
protected DfMultiDimensionalReportService dfMultiDimensionalReportService;
@Autowired
protected ServicesRequestLogService servicesRequestLogService;
@RequestMapping(value = "dfLwhhAttrReportSources", method = RequestMethod.GET)
@ApiOperation(value = "来文函号、性质多维实时统计", httpMethod = "GET", notes = "get log list")
public Map dfServiceReportSources(Page page, DfLwhhAttrReport dfLwhhAttrReport, Model model,
HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DfLwhhAttrReport> lwhhAttrReportPage = null;
try {
//设置本地默认查询时间
resetTime(dfLwhhAttrReport);
// 校验
dfMultiDimensionalReportService.queryConditionCheck(thread, start, dfLwhhAttrReport, DfLwhhAttrReport.class,
page);
// 查询数据库
lwhhAttrReportPage = dfMultiDimensionalReportService.findDfLwhhAttrReportPage(
new Page<DfLwhhAttrReport>(request, response, DfLwhhAttrReport.class), dfLwhhAttrReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "来文函号、性质多维实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "来文函号、性质多维实时统计成功",
lwhhAttrReportPage, activeSys, logSource);
}
@RequestMapping(value = "dfLwhhTagReportSources", method = RequestMethod.GET)
@ApiOperation(value = "来文函号、标签多维实时统计", httpMethod = "GET", notes = "get log list")
public Map dfServiceReportSources(Page page, DfLwhhTagReport dfLwhhTagReport, Model model,
HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DfLwhhTagReport> lwhhTagReportPage = null;
try {
//设置本地默认查询时间
resetTime(dfLwhhTagReport);
// 校验
dfMultiDimensionalReportService.queryConditionCheck(thread, start, dfLwhhTagReport, DfLwhhTagReport.class,
page);
// 查询数据库
lwhhTagReportPage = dfMultiDimensionalReportService.findDfLwhhTagReportPage(
new Page<DfLwhhTagReport>(request, response, DfLwhhTagReport.class), dfLwhhTagReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "来文函号、标签多维实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "来文函号、标签多维实时统计成功",
lwhhTagReportPage, activeSys, logSource);
}
@RequestMapping(value = "dfSrcIpAttrReportSources", method = RequestMethod.GET)
@ApiOperation(value = "来文函号、性质多维实时统计", httpMethod = "GET", notes = "get log list")
public Map dfServiceReportSources(Page page, DfSrcIpAttrReport dfSrcIpAttrReport, Model model,
HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DfSrcIpAttrReport> srcIpAttrReportPage = null;
try {
//设置本地默认查询时间
resetTime(dfSrcIpAttrReport);
// 校验
dfMultiDimensionalReportService.queryConditionCheck(thread, start, dfSrcIpAttrReport, DfSrcIpAttrReport.class,
page);
// 查询数据库
srcIpAttrReportPage = dfMultiDimensionalReportService.findDfSrcIpAttrReportPage(
new Page<DfSrcIpAttrReport>(request, response, DfSrcIpAttrReport.class), dfSrcIpAttrReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "境内源ip、性质多维实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "境内源ip、性质多维实时统计成功",
srcIpAttrReportPage, activeSys, logSource);
}
@RequestMapping(value = "dfSrcIpTagReportSources", method = RequestMethod.GET)
@ApiOperation(value = "来文函号、标签多维实时统计", httpMethod = "GET", notes = "get log list")
public Map dfServiceReportSources(Page page, DfSrcIpTagReport dfSrcIpTagReport, Model model,
HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DfSrcIpTagReport> srcIpTagReportPage = null;
try {
//设置本地默认查询时间
resetTime(dfSrcIpTagReport);
// 校验
dfMultiDimensionalReportService.queryConditionCheck(thread, start, dfSrcIpTagReport, DfSrcIpTagReport.class,
page);
// 查询数据库
srcIpTagReportPage = dfMultiDimensionalReportService.findDfSrcIpTagReportPage(
new Page<DfSrcIpTagReport>(request, response, DfSrcIpTagReport.class), dfSrcIpTagReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "境内源ip、标签多维实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "境内源ip、标签多维实时统计成功",
srcIpTagReportPage, activeSys, logSource);
}
/**
*
* @Title: resetTime
* @Description: (实时统计默认查询本地一个小时的数据)
* @param @param entity
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
public void resetTime(DfReportEntity<?> entity) throws Exception {
Map<String, String> map = DateUtils.getLocalTime(entity.getSearchReportStartTime(),
entity.getSearchReportEndTime(), Constants.REPORT_LOCAL_TIME,"report");
entity.setSearchReportStartTime(map.get("startTime"));
entity.setSearchReportEndTime(map.get("endTime"));
}
}

View File

@@ -1,333 +0,0 @@
/**
* @Title: DfStatLogController.java
* @Package com.nis.web.controller
* @Description: TODO(用一句话描述该文件做什么)
* @author ddm
* @date 2016年9月13日 下午1:22:15
* @version V1.0
*/
package com.nis.web.controller.restful;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.nis.domain.Page;
import com.nis.domain.StatLogEntity;
import com.nis.domain.restful.DfLwhhAttrDaily;
import com.nis.domain.restful.DfLwhhAttrMonth;
import com.nis.domain.restful.DfLwhhTagDaily;
import com.nis.domain.restful.DfLwhhTagMonth;
import com.nis.domain.restful.DfSrcIpAttrDaily;
import com.nis.domain.restful.DfSrcIpAttrMonth;
import com.nis.domain.restful.DfSrcIpTagDaily;
import com.nis.domain.restful.DfSrcIpTagMonth;
import com.nis.restful.RestServiceException;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.util.redis.RedisDao;
import com.nis.web.controller.BaseRestController;
import com.nis.web.service.SaveRequestLogThread;
import com.nis.web.service.ServicesRequestLogService;
import com.nis.web.service.restful.DfMultiDimensionalStatLogService;
import com.wordnik.swagger.annotations.ApiOperation;
/**
* @ClassName: DfStatLogController
* @Description: TODO(这里用一句话描述这个类的作用)
* @author (ddm)
* @date 2016年9月13日 下午1:22:15
* @version V1.0
*/
@RestController
@RequestMapping("${servicePath}/log/v1")
@SuppressWarnings({ "rawtypes", "unchecked" })
public class DfMultiDimensionalStatLogController extends BaseRestController{
protected final Logger logger = Logger.getLogger(this.getClass());
protected String logSource="0";
protected String activeSys=Constants.ACTIVESYS_ALL;
@Autowired
protected DfMultiDimensionalStatLogService dfMultiDimensionalStatLogService;
@Autowired
protected RedisDao redisDao;
@Autowired
protected ServicesRequestLogService servicesRequestLogService;
@RequestMapping(value="dfLwhhAttrDailySources", method = RequestMethod.GET)
@ApiOperation(value="封堵来文函号-性质多维日报表" , httpMethod = "GET", notes="get log list")
public Map dfLwhhAttrDailySources(
Page page,DfLwhhAttrDaily dfLwhhAttrDaily, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DfLwhhAttrDaily> dfLwhhAttrDailyPage =null;
try {
resetTime(dfLwhhAttrDaily, "daily");
dfMultiDimensionalStatLogService.queryConditionCheck(thread,start,dfLwhhAttrDaily, DfLwhhAttrDaily.class, page);
dfLwhhAttrDailyPage = dfMultiDimensionalStatLogService.dfLwhhAttrDaily(new Page<DfLwhhAttrDaily>(request, response,DfLwhhAttrDaily.class), dfLwhhAttrDaily);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"封堵来文函号-性质多维日报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "封堵来文函号-标签多维日报表检索成功",dfLwhhAttrDailyPage,activeSys,logSource);
}
@RequestMapping(value="dfLwhhAttrMonthSources", method = RequestMethod.GET)
@ApiOperation(value="封堵来文函号-性质多维月报表" , httpMethod = "GET", notes="get log list")
public Map dfLwhhAttrMonthSources(
Page page,DfLwhhAttrMonth dfLwhhAttrMonth, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DfLwhhAttrMonth> dfLwhhAttrMonthPage =null;
try {
resetTime(dfLwhhAttrMonth, "month");
//查询条件校验
dfMultiDimensionalStatLogService.queryConditionCheck(thread,start,dfLwhhAttrMonth, DfLwhhAttrMonth.class, page);
dfLwhhAttrMonthPage = dfMultiDimensionalStatLogService.dfLwhhAttrMonth(new Page<DfLwhhAttrMonth>(request, response,DfLwhhAttrMonth.class), dfLwhhAttrMonth);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"封堵来文函号-性质多维月报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "封堵来文函号-性质多维月报表检索成功",dfLwhhAttrMonthPage,activeSys,logSource);
}
@RequestMapping(value="dfLwhhTagDailySources", method = RequestMethod.GET)
@ApiOperation(value="封堵来文函号-标签多维日报表" , httpMethod = "GET", notes="get log list")
public Map dfLwhhTagDailySources(
Page page,DfLwhhTagDaily dfLwhhTagDaily, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DfLwhhTagDaily> dfLwhhTagDailyPage =null;
try {
resetTime(dfLwhhTagDaily, "daily");
dfMultiDimensionalStatLogService.queryConditionCheck(thread,start,dfLwhhTagDaily, DfLwhhTagDaily.class, page);
dfLwhhTagDailyPage = dfMultiDimensionalStatLogService.dfLwhhTagDaily(new Page<DfLwhhTagDaily>(request, response,DfLwhhTagDaily.class), dfLwhhTagDaily);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"封堵来文函号-标签多维日报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "封堵来文函号-标签多维日报表检索成功",dfLwhhTagDailyPage,activeSys,logSource);
}
@RequestMapping(value="dfLwhhTagMonthSources", method = RequestMethod.GET)
@ApiOperation(value="封堵来文函号-标签多维月报表" , httpMethod = "GET", notes="get log list")
public Map dfLwhhTagMonthSources(
Page page,DfLwhhTagMonth dfLwhhTagMonth, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DfLwhhTagMonth> dfLwhhTagMonthPage =null;
try {
resetTime(dfLwhhTagMonth, "month");
//查询条件校验
dfMultiDimensionalStatLogService.queryConditionCheck(thread,start,dfLwhhTagMonth, DfLwhhTagMonth.class, page);
dfLwhhTagMonthPage = dfMultiDimensionalStatLogService.dfLwhhTagMonth(new Page<DfLwhhTagMonth>(request, response,DfLwhhTagMonth.class), dfLwhhTagMonth);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"封堵来文函号-标签多维月报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "封堵来文函号-标签多维月报表检索成功",dfLwhhTagMonthPage,activeSys,logSource);
}
@RequestMapping(value="dfSrcIpAttrDailySources", method = RequestMethod.GET)
@ApiOperation(value="封堵省-性质多维日报表" , httpMethod = "GET", notes="get log list")
public Map dfSrcIpAttrDailySources(
Page page,DfSrcIpAttrDaily dfSrcIpAttrDaily, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DfSrcIpAttrDaily> dfSrcIpAttrDailyPage =null;
try {
resetTime(dfSrcIpAttrDaily, "daily");
dfMultiDimensionalStatLogService.queryConditionCheck(thread,start,dfSrcIpAttrDaily, DfSrcIpAttrDaily.class, page);
dfSrcIpAttrDailyPage = dfMultiDimensionalStatLogService.dfSrcIpAttrDaily(new Page<DfSrcIpAttrDaily>(request, response,DfSrcIpAttrDaily.class), dfSrcIpAttrDaily);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"封堵省-性质多维日报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "封堵省-标签多维日报表检索成功",dfSrcIpAttrDailyPage,activeSys,logSource);
}
@RequestMapping(value="dfSrcIpAttrMonthSources", method = RequestMethod.GET)
@ApiOperation(value="封堵省-性质多维月报表" , httpMethod = "GET", notes="get log list")
public Map dfSrcIpAttrMonthSources(
Page page,DfSrcIpAttrMonth dfSrcIpAttrMonth, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DfSrcIpAttrMonth> dfSrcIpAttrMonthPage =null;
try {
resetTime(dfSrcIpAttrMonth, "month");
//查询条件校验
dfMultiDimensionalStatLogService.queryConditionCheck(thread,start,dfSrcIpAttrMonth, DfSrcIpAttrMonth.class, page);
dfSrcIpAttrMonthPage = dfMultiDimensionalStatLogService.dfSrcIpAttrMonth(new Page<DfSrcIpAttrMonth>(request, response,DfSrcIpAttrMonth.class), dfSrcIpAttrMonth);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"封堵省-性质多维月报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "封堵省-性质多维月报表检索成功",dfSrcIpAttrMonthPage,activeSys,logSource);
}
@RequestMapping(value="dfSrcIpTagDailySources", method = RequestMethod.GET)
@ApiOperation(value="封堵省-标签多维日报表" , httpMethod = "GET", notes="get log list")
public Map dfSrcIpTagDailySources(
Page page,DfSrcIpTagDaily dfSrcIpTagDaily, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DfSrcIpTagDaily> dfSrcIpTagDailyPage =null;
try {
resetTime(dfSrcIpTagDaily, "daily");
dfMultiDimensionalStatLogService.queryConditionCheck(thread,start,dfSrcIpTagDaily, DfSrcIpTagDaily.class, page);
dfSrcIpTagDailyPage = dfMultiDimensionalStatLogService.dfSrcIpTagDaily(new Page<DfSrcIpTagDaily>(request, response,DfSrcIpTagDaily.class), dfSrcIpTagDaily);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"封堵省-标签多维日报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "封堵省-标签多维日报表检索成功",dfSrcIpTagDailyPage,activeSys,logSource);
}
@RequestMapping(value="dfSrcIpTagMonthSources", method = RequestMethod.GET)
@ApiOperation(value="封堵省-标签多维月报表" , httpMethod = "GET", notes="get log list")
public Map dfSrcIpTagMonthSources(
Page page,DfSrcIpTagMonth dfSrcIpTagMonth, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DfSrcIpTagMonth> dfSrcIpTagMonthPage =null;
try {
resetTime(dfSrcIpTagMonth, "month");
//查询条件校验
dfMultiDimensionalStatLogService.queryConditionCheck(thread,start,dfSrcIpTagMonth, DfSrcIpTagMonth.class, page);
dfSrcIpTagMonthPage = dfMultiDimensionalStatLogService.dfSrcIpTagMonth(new Page<DfSrcIpTagMonth>(request, response,DfSrcIpTagMonth.class), dfSrcIpTagMonth);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"封堵省-标签多维月报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "封堵省-标签多维月报表检索成功",dfSrcIpTagMonthPage,activeSys,logSource);
}
/**
*
* @Title: resetTime
* @Description: (日报表默认查询本地前一天的数据)
* @param @param entity
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
public void resetTime(StatLogEntity<?> entity,String type) throws Exception{
Map<String, String> map = DateUtils.getLocalTime(entity.getSearchStatStartTime(),
entity.getSearchStatEndTime(), Constants.REPORT_LOCAL_TIME,type);
entity.setSearchStatStartTime(map.get("startTime"));
entity.setSearchStatEndTime(map.get("endTime"));
}
}

View File

@@ -1,636 +0,0 @@
package com.nis.web.controller.restful;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
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 com.nis.domain.DfReportEntity;
import com.nis.domain.LogEntity;
import com.nis.domain.Page;
import com.nis.domain.restful.DfAttrTypeReport;
import com.nis.domain.restful.DfDestIpCountryReport;
import com.nis.domain.restful.DfDestIpReport;
import com.nis.domain.restful.DfEntranceReport;
import com.nis.domain.restful.DfLwhhReport;
import com.nis.domain.restful.DfPzReport;
import com.nis.domain.restful.DfPzReportStat;
import com.nis.domain.restful.DfServiceReport;
import com.nis.domain.restful.DfSrcIpDomeSticReport;
import com.nis.domain.restful.DfSrcIpReport;
import com.nis.domain.restful.DfTagReport;
import com.nis.restful.RestServiceException;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.web.controller.BaseRestController;
import com.nis.web.service.SaveRequestLogThread;
import com.nis.web.service.ServicesRequestLogService;
import com.nis.web.service.restful.DfReportService;
import com.wordnik.swagger.annotations.ApiOperation;
import net.sf.json.JSONObject;
/**
* @ClassName: DfReportController
* @Description: TODO(一句话描述这个类)
* @author (DDM)
* @date 2016年10月31日上午11:56:50
* @version V1.0
*/
@RestController
@RequestMapping("${servicePath}/log/v1")
@SuppressWarnings({ "rawtypes" })
public class DfReportController extends BaseRestController {
protected final Logger logger = Logger.getLogger(this.getClass());
protected String activeSys = Constants.ACTIVESYS_ALL;
protected String logSource = "0";
@Autowired
protected DfReportService dfReportService;
@Autowired
protected ServicesRequestLogService servicesRequestLogService;
@RequestMapping(value = "dfPzReportSources", method = RequestMethod.GET)
@ApiOperation(value = "管控配置实时统计服务", httpMethod = "GET", notes = "get log list")
public Map dfPzReportSources(Page page, DfPzReport dfPzReport, Model model, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DfPzReport> pzReportPage = null;
try {
//设置本地默认查询时间
resetTime(dfPzReport);
dfReportService.queryConditionCheck(thread, start, dfPzReport, DfPzReport.class, page);
// 查询数据库
pzReportPage = dfReportService.findDfPzReportPage(new Page<DfPzReport>(request, response, DfPzReport.class),
dfPzReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控配置实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控配置实时统计成功",
pzReportPage, activeSys, logSource);
}
/**
* 配置统计[小时]
*
* @param page
* @param dfPzReport
* @param model
* @param request
* @param response
* @return
*/
@RequestMapping(value = "dfPzStatSources", method = RequestMethod.GET)
@ApiOperation(value = "管控各配置量统计服务[小时]", httpMethod = "GET", notes = "get log list")
public Map dfPzStatSources(Page page, DfPzReportStat dfPzReportStat, Model model, HttpServletRequest request,
HttpServletResponse response) {
if (!Constants.ACTIVESYS_A.equals(dfPzReportStat.getSearchStatActiveSys())
&& !Constants.ACTIVESYS_C.equals(dfPzReportStat.getSearchStatActiveSys())
&& !Constants.ACTIVESYS_AB.equals(dfPzReportStat.getSearchStatActiveSys())
) {
dfPzReportStat.setSearchStatActiveSys(Constants.ACTIVESYS_B);
}
activeSys = dfPzReportStat.getSearchStatActiveSys();
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DfPzReportStat> pzReportPage = null;
try {
//设置本地默认查询时间
resetTime(dfPzReportStat);
dfReportService.queryConditionCheck(thread, start, dfPzReportStat, DfPzReportStat.class, page);
// 查询数据库
pzReportPage = dfReportService.findDfPzReportStatPage(
new Page<DfPzReportStat>(request, response, DfPzReportStat.class), dfPzReportStat);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控各配置量统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控各配置量统计成功",
pzReportPage, activeSys, logSource);
}
/**
* 配置统计[分钟]
*
* @param page
* @param dfPzReport
* @param model
* @param request
* @param response
* @return
*/
@RequestMapping(value = "dfPzStatMinutesSources", method = RequestMethod.GET)
@ApiOperation(value = "管控各配置量统计服务[分钟]", httpMethod = "GET", notes = "get log list")
public Map dfPzStatMinutesSources(Page page, DfPzReportStat dfPzReportStat, Model model, HttpServletRequest request,
HttpServletResponse response) {
if (!Constants.ACTIVESYS_A.equals(dfPzReportStat.getSearchStatActiveSys())
&& !Constants.ACTIVESYS_C.equals(dfPzReportStat.getSearchStatActiveSys())
&& !Constants.ACTIVESYS_AB.equals(dfPzReportStat.getSearchStatActiveSys())
) {
dfPzReportStat.setSearchStatActiveSys(Constants.ACTIVESYS_B);
}
activeSys = dfPzReportStat.getSearchStatActiveSys();
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DfPzReportStat> pzReportPage = null;
try {
//设置本地默认查询时间
resetTime(dfPzReportStat);
dfReportService.queryConditionCheck(thread, start, dfPzReportStat, DfPzReportStat.class, page);
// 查询数据库
pzReportPage = dfReportService.findDfPzReportStatMinutesPage(
new Page<DfPzReportStat>(request, response, DfPzReportStat.class), dfPzReportStat);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控各配置量统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控各配置量统计成功",
pzReportPage, activeSys, logSource);
}
/**
* 配置统计
*
* @param page
* @param dfPzReport
* @param model
* @param request
* @param response
* @return
*/
@RequestMapping(value = "dfPzSumStatSources", method = RequestMethod.GET)
@ApiOperation(value = "管控配置总量统计服务", httpMethod = "GET", notes = "get log list")
public Map dfPzSumStatSources(Page page, DfPzReportStat dfPzReportStat, Model model, HttpServletRequest request,
HttpServletResponse response) {
if (!Constants.ACTIVESYS_A.equals(dfPzReportStat.getSearchStatActiveSys())
&& !Constants.ACTIVESYS_C.equals(dfPzReportStat.getSearchStatActiveSys())
) {
dfPzReportStat.setSearchStatActiveSys(Constants.ACTIVESYS_B);
}
activeSys = dfPzReportStat.getSearchStatActiveSys();
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
JSONObject json = new JSONObject();
try {
//设置本地默认查询时间
resetTime(dfPzReportStat);
dfReportService.queryConditionCheck(thread, start, dfPzReportStat, DfPzReportStat.class,page);
// 查询数据库
Long sum = dfReportService.findDfPzReportSumStat(
new Page<DfPzReportStat>(request, response, DfPzReportStat.class), dfPzReportStat);
if (sum == null)
sum = 0l;
json.put("sum", sum);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控配置总量统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控配置总量统计成功", json,
activeSys, logSource);
}
@RequestMapping(value = "dfServiceReportSources", method = RequestMethod.GET)
@ApiOperation(value = "管控业务类型实时统计", httpMethod = "GET", notes = "get log list")
public Map dfServiceReportSources(Page page, DfServiceReport dfServiceReport, Model model,
HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DfServiceReport> serviceReportPage = null;
try {
//设置本地默认查询时间
resetTime(dfServiceReport);
// 校验
dfReportService.queryConditionCheck(thread, start, dfServiceReport, DfServiceReport.class,
page);
// 查询数据库
serviceReportPage = dfReportService.findDfServiceReportPage(
new Page<DfServiceReport>(request, response, DfServiceReport.class), dfServiceReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控业务类型实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控业务类型实时统计成功",
serviceReportPage, activeSys, logSource);
}
@RequestMapping(value = "dfTagReportSources", method = RequestMethod.GET)
@ApiOperation(value = "管控标签实时统计", httpMethod = "GET", notes = "get log list")
public Map dfTagReportSources(Page page, DfTagReport dfTagReport, Model model, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DfTagReport> tagReportPage = null;
try {
//设置本地默认查询时间
resetTime(dfTagReport);
// 校验
dfReportService.queryConditionCheck(thread, start, dfTagReport, DfTagReport.class, page);
// 查询数据库
tagReportPage = dfReportService
.findDfTagReportPage(new Page<DfTagReport>(request, response, DfTagReport.class), dfTagReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控标签实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控标签实时统计成功",
tagReportPage, activeSys, logSource);
}
@RequestMapping(value = "/dfSrcIpDomesticReportSources", method = RequestMethod.GET)
@ApiOperation(value = "管控境内源IP实时统计服务", httpMethod = "GET", notes = "管控境内源IP实时统计列表")
public Map dfSrcIpDomesticReportSources(Page page, DfSrcIpReport dfSrcIpDomesticReport, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DfSrcIpReport> reporPage = null;
try {
//设置本地默认查询时间
resetTime(dfSrcIpDomesticReport);
dfReportService.queryConditionCheck(thread, start, dfSrcIpDomesticReport, DfSrcIpReport.class, page);
reporPage = dfReportService.findDfSrcIpReport(
new Page<DfSrcIpReport>(request, response, DfSrcIpReport.class), dfSrcIpDomesticReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控境内源IP实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控境内源IP实时统计检索成功",
reporPage, activeSys, logSource);
}
@RequestMapping(value = "/dfDestIpCountryReportSources", method = RequestMethod.GET)
@ApiOperation(value = "管控各国家目的IP实时统计服务", httpMethod = "GET", notes = "管控各国家目的IP实时统计列表")
public Map dfDestIpCountryReportSources(Page page, DfDestIpReport dfDestIpReport, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DfDestIpReport> reporPage = null;
try {
//设置本地默认查询时间
resetTime(dfDestIpReport);
dfReportService.queryConditionCheck(thread, start, dfDestIpReport, DfDestIpReport.class, page);
reporPage = dfReportService.findDfDestIpReport(
new Page<DfDestIpReport>(request, response, DfDestIpReport.class), dfDestIpReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控各国家目的IP实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控各国家目的IP实时统计检索成功",
reporPage, activeSys, logSource);
}
@RequestMapping(value = "dfPzPrivServiceSumSources", method = RequestMethod.GET)
@ApiOperation(value = "管控配置总量实时统计", httpMethod = "GET", notes = "get log list")
public Map dfPzPrivServiceSumSources(Page page, DfPzReport dfPzReport, Model model, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DfPzReport> pzReportPage = null;
try {
//设置本地默认查询时间
resetTime(dfPzReport);
dfReportService.queryConditionCheck(thread, start, dfPzReport, DfPzReport.class, page);
// 查询数据库
pzReportPage = dfReportService.findDfPriTagReport(new Page<DfPzReport>(request, response, DfPzReport.class),
dfPzReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控配置总量实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控配置总量实时统计成功",
pzReportPage, activeSys, logSource);
}
@RequestMapping(value = "dfAttrTypeReportSources", method = RequestMethod.GET)
@ApiOperation(value = "管控性质(带私有标签)实时统计", httpMethod = "GET", notes = "get log list")
public Map dfAttrTypeReportSources(Page page, DfAttrTypeReport dfAttrTypeReport, Model model,
HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DfAttrTypeReport> attrTypeReportPage = null;
try {
//设置本地默认查询时间
resetTime(dfAttrTypeReport);
dfReportService.queryConditionCheck(thread, start, dfAttrTypeReport, DfPzReport.class, page);
// 查询数据库
attrTypeReportPage = dfReportService.findAttrTypeReport(
new Page<DfAttrTypeReport>(request, response, DfAttrTypeReport.class), dfAttrTypeReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控性质(带私有标签)实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控性质(带私有标签)实时统计成功",
attrTypeReportPage, activeSys, logSource);
}
@RequestMapping(value = "dfSrcIpDomesticPrivServiceReportSources", method = RequestMethod.GET)
@ApiOperation(value = "管控境内源IP(带私有标签)实时统计", httpMethod = "GET", notes = "get log list")
public Map dfSrcIpDomesticPrivServiceReportSources(Page page, DfSrcIpDomeSticReport dfSrcIpDomeSticReport,
Model model, HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DfSrcIpDomeSticReport> srcIpDomeSticReportPage = null;
try {
//设置本地默认查询时间
resetTime(dfSrcIpDomeSticReport);
dfReportService.queryConditionCheck(thread, start, dfSrcIpDomeSticReport, DfSrcIpDomeSticReport.class,
page);
// 查询数据库
srcIpDomeSticReportPage = dfReportService.findSrcIpDomeSticReport(
new Page<DfSrcIpDomeSticReport>(request, response, DfSrcIpDomeSticReport.class),
dfSrcIpDomeSticReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控境内源IP(带私有标签)实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控境内源IP(带私有标签)实时统计成功",
srcIpDomeSticReportPage, activeSys, logSource);
}
@RequestMapping(value = "dfDestIpCountryPrivServiceReportSources", method = RequestMethod.GET)
@ApiOperation(value = "管控境内目的IP(带私有标签)实时统计", httpMethod = "GET", notes = "get log list")
public Map dfDestIpCountryPrivServiceReportSources(Page page, DfDestIpCountryReport dfDestIpCountryReport,
Model model, HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DfDestIpCountryReport> dfDestIpCountryReportPage = null;
try {
//设置本地默认查询时间
resetTime(dfDestIpCountryReport);
dfReportService.queryConditionCheck(thread, start, dfDestIpCountryReport, DfDestIpCountryReport.class,
page);
// 查询数据库
dfDestIpCountryReportPage = dfReportService.findDestIpCountryReport(
new Page<DfDestIpCountryReport>(request, response, DfDestIpCountryReport.class),
dfDestIpCountryReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控境内目的IP(带私有标签)实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控境内目的IP(带私有标签)实时统计成功",
dfDestIpCountryReportPage, activeSys, logSource);
}
@RequestMapping(value = "dfEntranceReportSources", method = RequestMethod.GET)
@ApiOperation(value = "管控局点(带私有标签)实时统计", httpMethod = "GET", notes = "get log list")
public Map dfEntranceReportSources(Page page, DfEntranceReport dfEntranceReport, Model model,
HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DfEntranceReport> dfEntranceReportPage = null;
try {
//设置本地默认查询时间
resetTime(dfEntranceReport);
dfReportService.queryConditionCheck(thread, start, dfEntranceReport, DfEntranceReport.class,
page);
// 查询数据库
dfEntranceReportPage = dfReportService.findDfEntranceReport(
new Page<DfEntranceReport>(request, response, DfEntranceReport.class), dfEntranceReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控局点(带私有标签)实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控局点(带私有标签)实时统计成功",
dfEntranceReportPage, activeSys, logSource);
}
@RequestMapping(value = "dfLwhhReportSources", method = RequestMethod.GET)
@ApiOperation(value = "管控来文函号(带私有标签)实时统计", httpMethod = "GET", notes = "get log list")
public Map dfLwhhReportSources(Page page, DfLwhhReport dfLwhhReport, Model model, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DfLwhhReport> dfLwhhReportPage = null;
try {
//设置本地默认查询时间
resetTime(dfLwhhReport);
dfReportService.queryConditionCheck(thread, start, dfLwhhReport, DfLwhhReport.class, page);
// 查询数据库
dfLwhhReportPage = dfReportService
.findDfLwhhReport(new Page<DfLwhhReport>(request, response, DfLwhhReport.class), dfLwhhReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控来文函号(带私有标签)实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控来文函号(带私有标签)实时统计成功",
dfLwhhReportPage, activeSys, logSource);
}
@RequestMapping(value = "dfTagPrivServiceReportSources", method = RequestMethod.GET)
@ApiOperation(value = "管控标签(带私有标签)实时统计", httpMethod = "GET", notes = "get log list")
public Map dfTagPrivServiceReportSources(Page page, DfTagReport dfTagReport, Model model, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DfTagReport> dfTagReportPage = null;
try {
//设置本地默认查询时间
resetTime(dfTagReport);
dfReportService.queryConditionCheck(thread, start, dfTagReport, DfTagReport.class, page);
// 查询数据库
dfTagReportPage = dfReportService
.findDfTagReportPage(new Page<DfTagReport>(request, response, DfTagReport.class), dfTagReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "管控标签(带私有标签)实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "管控标签(带私有标签)实时统计成功",
dfTagReportPage, activeSys, logSource);
}
/**
*
* @Title: resetTime
* @Description: (实时统计默认查询本地一个小时的数据)
* @param @param entity
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
public void resetTime(DfReportEntity<?> entity) throws Exception {
Map<String, String> map = DateUtils.getLocalTime(entity.getSearchReportStartTime(),
entity.getSearchReportEndTime(), Constants.REPORT_LOCAL_TIME,"report");
entity.setSearchReportStartTime(map.get("startTime"));
entity.setSearchReportEndTime(map.get("endTime"));
}
}

View File

@@ -1,792 +0,0 @@
/**
* @Title: DfStatLogController.java
* @Package com.nis.web.controller
* @Description: TODO(用一句话描述该文件做什么)
* @author ddm
* @date 2016年9月13日 下午1:22:15
* @version V1.0
*/
package com.nis.web.controller.restful;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.nis.domain.DfReportEntity;
import com.nis.domain.Page;
import com.nis.domain.StatLogEntity;
import com.nis.domain.restful.DfAttrStatLogDaily;
import com.nis.domain.restful.DfAttrStatLogMonth;
import com.nis.domain.restful.DfDestIpCounrtyStatLogDaily;
import com.nis.domain.restful.DfDestIpCounrtyStatLogMonth;
import com.nis.domain.restful.DfEntrStatLogDaily;
import com.nis.domain.restful.DfEntrStatLogMonth;
import com.nis.domain.restful.DfLwhhStatLogDaily;
import com.nis.domain.restful.DfLwhhStatLogMonth;
import com.nis.domain.restful.DfSrcIpDomesticStatLogDaily;
import com.nis.domain.restful.DfSrcIpDomesticStatLogMonth;
import com.nis.domain.restful.DfStatLogDaily;
import com.nis.domain.restful.DfStatLogMonth;
import com.nis.domain.restful.DfTagStatLogDaily;
import com.nis.domain.restful.DfTagStatLogMonth;
import com.nis.restful.RestBusinessCode;
import com.nis.restful.RestServiceException;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.util.JsonMapper;
import com.nis.util.StringUtil;
import com.nis.util.redis.RedisDao;
import com.nis.util.redis.SaveRedisThread;
import com.nis.web.controller.BaseRestController;
import com.nis.web.service.SaveRequestLogThread;
import com.nis.web.service.ServicesRequestLogService;
import com.nis.web.service.restful.DfStatLogService;
import com.wordnik.swagger.annotations.ApiOperation;
/**
* @ClassName: DfStatLogController
* @Description: TODO(这里用一句话描述这个类的作用)
* @author (ddm)
* @date 2016年9月13日 下午1:22:15
* @version V1.0
*/
@RestController
@RequestMapping("${servicePath}/log/v1")
@SuppressWarnings({ "rawtypes", "unchecked" })
public class DfStatLogController extends BaseRestController{
protected final Logger logger = Logger.getLogger(this.getClass());
protected String logSource="0";
protected String activeSys=Constants.ACTIVESYS_ALL;
@Autowired
protected DfStatLogService dfStatLogService;
@Autowired
protected RedisDao redisDao;
@Autowired
protected ServicesRequestLogService servicesRequestLogService;
@RequestMapping(value="dfStatLogDailySources", method = RequestMethod.GET)
@ApiOperation(value="封堵日志配置日报表" , httpMethod = "GET", notes="get log list")
public Map dfStatLogDailySources(
Page page,DfStatLogDaily dailyLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DfStatLogDaily> dailyLogPage =null;
try {
resetTime(dailyLog, "daily");
if (!StringUtil.isBlank(dailyLog.getSearchConfigId())) {
Long.parseLong(dailyLog.getSearchConfigId());
}
dfStatLogService.queryConditionCheck(thread,start,dailyLog, DfStatLogDaily.class, page);
dailyLogPage = dfStatLogService.dfStatLogDaily(new Page<DfStatLogDaily>(request, response,DfStatLogDaily.class), dailyLog);
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
RestServiceException restE = new RestServiceException(thread, System.currentTimeMillis() - start,
"SearchConfigId参数格式错误", RestBusinessCode.param_formate_error.getValue());
restE.setActiveSys(activeSys);
restE.setLogSource(logSource);
throw restE;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"封堵日志配置日报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "封堵日志配置日报表检索成功",dailyLogPage,activeSys,logSource);
}
@RequestMapping(value="dfStatLogMonthSources", method = RequestMethod.GET)
@ApiOperation(value="封堵日志配置月报表" , httpMethod = "GET", notes="get log list")
public Map dfStatLogMonthSources(
Page page,DfStatLogMonth monthLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DfStatLogMonth> monthLogPage =null;
try {
resetTime(monthLog, "month");
if (!StringUtil.isBlank(monthLog.getSearchConfigId())) {
Long.parseLong(monthLog.getSearchConfigId());
}
//查询条件校验
dfStatLogService.queryConditionCheck(thread,start,monthLog, DfStatLogMonth.class, page);
monthLogPage = dfStatLogService.dfStatLogMonth(new Page<DfStatLogMonth>(request, response,DfStatLogMonth.class), monthLog);
}catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
RestServiceException restE = new RestServiceException(thread, System.currentTimeMillis() - start,
"SearchConfigId参数格式错误", RestBusinessCode.param_formate_error.getValue());
restE.setActiveSys(activeSys);
restE.setLogSource(logSource);
throw restE;
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"封堵日志配置月报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "封堵日志配置月报表检索成功",monthLogPage,activeSys,logSource);
}
/**
* 标签日报表
*
* @Title: dfTagStatLogDailySources
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @param page
* @param @param dailyLog
* @param @param request
* @param @param response
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@RequestMapping(value="dfTagStatLogDailySources", method = RequestMethod.GET)
@ApiOperation(value="标签封堵日志配置日报表" , httpMethod = "GET", notes="get log list")
public Map dfTagStatLogDailySources(
Page page,DfTagStatLogDaily dailyLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
//查询条件校验
Page<DfTagStatLogDaily> dailyLogPage =null;
try {
resetTime(dailyLog, "daily");
if (!StringUtil.isBlank(dailyLog.getSearchTag())) {
Integer.parseInt(dailyLog.getSearchTag());
}
dfStatLogService.queryConditionCheck(thread,start,dailyLog, DfTagStatLogDaily.class, page);
dailyLogPage = dfStatLogService.dfTagStatLogDaily(new Page<DfTagStatLogDaily>(request, response,DfTagStatLogDaily.class), dailyLog);
}catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
RestServiceException restE = new RestServiceException(thread, System.currentTimeMillis() - start,
"SearchTag参数格式错误", RestBusinessCode.param_formate_error.getValue());
restE.setActiveSys(activeSys);
restE.setLogSource(logSource);
throw restE;
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"标签封堵日志配置日报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "标签封堵日志配置日报表检索成功",dailyLogPage,activeSys,logSource);
}
/**
* 标签月报表
*
* @Title: dfTagStatLogDailySources
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @param page
* @param @param dailyLog
* @param @param request
* @param @param response
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@RequestMapping(value="dfTagStatLogMonthSources", method = RequestMethod.GET)
@ApiOperation(value="标签封堵日志配置月报表" , httpMethod = "GET", notes="get log list")
public Map dfTagStatLogMonthSources(
Page page,DfTagStatLogMonth monthLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DfTagStatLogMonth> monthLogPage =null;
try {
resetTime(monthLog, "month");
if (!StringUtil.isBlank(monthLog.getSearchTag())) {
Integer.parseInt(monthLog.getSearchTag());
}
//查询条件校验
dfStatLogService.queryConditionCheck(thread,start,monthLog, DfTagStatLogMonth.class, page);
monthLogPage = dfStatLogService.dfTagStatLogMonth(new Page<DfTagStatLogMonth>(request, response,DfTagStatLogMonth.class), monthLog);
}catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
RestServiceException restE = new RestServiceException(thread, System.currentTimeMillis() - start,
"SearchTag参数格式错误", RestBusinessCode.param_formate_error.getValue());
restE.setActiveSys(activeSys);
restE.setLogSource(logSource);
throw restE;
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"标签封堵日志配置月报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "标签封堵日志配置月报表检索成功",monthLogPage,activeSys,logSource);
}
/**
* @Title: dfTagStatLogDailySources
* @Description: (性质日报表)
* @param @param page
* @param @param dailyLog
* @param @param request
* @param @param response
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@RequestMapping(value="dfAttrStatLogDailySources", method = RequestMethod.GET)
@ApiOperation(value="性质封堵日志配置日报表" , httpMethod = "GET", notes="get log list")
public Map dfAttrStatLogDailySources(
Page page,DfAttrStatLogDaily dailyLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DfAttrStatLogDaily> dailyLogPage =null;
try {
resetTime(dailyLog, "daily");
if (!StringUtil.isBlank(dailyLog.getSearchAttrType())) {
Integer.parseInt(dailyLog.getSearchAttrType());
}
dfStatLogService.queryConditionCheck(thread,start,dailyLog, DfAttrStatLogDaily.class, page);
dailyLogPage = dfStatLogService.dfAttrStatLogDaily(new Page<DfAttrStatLogDaily>(request, response,DfAttrStatLogDaily.class), dailyLog);
}catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
RestServiceException restE = new RestServiceException(thread, System.currentTimeMillis() - start,
"SearchAttrType参数格式错误", RestBusinessCode.param_formate_error.getValue());
restE.setActiveSys(activeSys);
restE.setLogSource(logSource);
throw restE;
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"性质封堵日志配置日报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "性质封堵日志配置日报表检索成功",dailyLogPage,activeSys,logSource);
}
/**
* @Title: dfAttrStatLogDailySources
* @Description: (性质月报表)
* @param @param page
* @param @param dailyLog
* @param @param request
* @param @param response
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@RequestMapping(value="dfAttrStatLogMonthSources", method = RequestMethod.GET)
@ApiOperation(value="性质封堵日志配置月报表" , httpMethod = "GET", notes="get log list")
public Map dfAttrStatLogMonthSources(
Page page,DfAttrStatLogMonth monthLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DfAttrStatLogMonth> monthLogPage =null;
try {
resetTime(monthLog, "month");
if (!StringUtil.isBlank(monthLog.getSearchAttrType())) {
Integer.parseInt(monthLog.getSearchAttrType());
}
//查询条件校验
dfStatLogService.queryConditionCheck(thread,start,monthLog, DfAttrStatLogMonth.class, page);
monthLogPage = dfStatLogService.dfAttrStatLogMonth(new Page<DfAttrStatLogMonth>(request, response,DfAttrStatLogMonth.class), monthLog);
}catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
RestServiceException restE = new RestServiceException(thread, System.currentTimeMillis() - start,
"SearchAttrType参数格式错误", RestBusinessCode.param_formate_error.getValue());
restE.setActiveSys(activeSys);
restE.setLogSource(logSource);
throw restE;
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"性质封堵日志配置月报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "性质封堵日志配置月报表检索成功",monthLogPage,activeSys,logSource);
}
/**
* @Title: dfEntrStatLogDailySources
* @Description: (局点日报表)
* @param @param page
* @param @param dailyLog
* @param @param request
* @param @param response
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@RequestMapping(value="dfEntrStatLogDailySources", method = RequestMethod.GET)
@ApiOperation(value="局点封堵日志配置日报表" , httpMethod = "GET", notes="get log list")
public Map dfEntrStatLogDailySources(
Page page,DfEntrStatLogDaily dailyLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DfEntrStatLogDaily> dailyLogPage =null;
try {
resetTime(dailyLog, "daily");
if (!StringUtil.isBlank(dailyLog.getSearchEntranceId())) {
Integer.parseInt(dailyLog.getSearchEntranceId());
}
dfStatLogService.queryConditionCheck(thread,start,dailyLog, DfEntrStatLogDaily.class, page);
dailyLogPage = dfStatLogService.dfEntrStatLogDaily(new Page<DfEntrStatLogDaily>(request, response,DfEntrStatLogDaily.class), dailyLog);
}catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
RestServiceException restE = new RestServiceException(thread, System.currentTimeMillis() - start,
"SearchEntranceId参数格式错误", RestBusinessCode.param_formate_error.getValue());
restE.setActiveSys(activeSys);
restE.setLogSource(logSource);
throw restE;
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"局点封堵日志配置日报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "局点封堵日志配置日报表检索成功",dailyLogPage,activeSys,logSource);
}
/**
* @Title: dfEntrStatLogDailySources
* @Description: (局点月报表)
* @param @param page
* @param @param dailyLog
* @param @param request
* @param @param response
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@RequestMapping(value="dfEntrStatLogMonthSources", method = RequestMethod.GET)
@ApiOperation(value="局点封堵日志配置月报表" , httpMethod = "GET", notes="get log list")
public Map dfEntrStatLogMonthSources(
Page page,DfEntrStatLogMonth monthLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DfEntrStatLogMonth> monthLogPage =null;
try {
resetTime(monthLog, "month");
if (!StringUtil.isBlank(monthLog.getSearchEntranceId())) {
Integer.parseInt(monthLog.getSearchEntranceId());
}
//查询条件校验
dfStatLogService.queryConditionCheck(thread,start,monthLog, DfEntrStatLogMonth.class, page);
monthLogPage = dfStatLogService.dfEntrStatLogMonth(new Page<DfEntrStatLogMonth>(request, response,DfEntrStatLogMonth.class), monthLog);
}catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
RestServiceException restE = new RestServiceException(thread, System.currentTimeMillis() - start,
"SearchEntranceId参数格式错误", RestBusinessCode.param_formate_error.getValue());
restE.setActiveSys(activeSys);
restE.setLogSource(logSource);
throw restE;
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"局点封堵日志配置月报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "局点封堵日志配置月报表检索成功",monthLogPage,activeSys,logSource);
}
/**
* @Title: dfLwhhStatLogDailySources
* @Description: (局点日报表)
* @param @param page
* @param @param dailyLog
* @param @param request
* @param @param response
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@RequestMapping(value="dfLwhhStatLogDailySources", method = RequestMethod.GET)
@ApiOperation(value="来文函号封堵日志配置日报表" , httpMethod = "GET", notes="get log list")
public Map dfLwhhStatLogDailySources(
Page page,DfLwhhStatLogDaily dailyLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
//查询条件校验
Page<DfLwhhStatLogDaily> dailyLogPage =null;
try {
resetTime(dailyLog, "daily");
if (!StringUtil.isBlank(dailyLog.getSearchLwhh())) {
Integer.parseInt(dailyLog.getSearchLwhh());
}
dfStatLogService.queryConditionCheck(thread,start,dailyLog, DfLwhhStatLogDaily.class, page);
dailyLogPage = dfStatLogService.dfLwhhStatLogDaily(new Page<DfLwhhStatLogDaily>(request, response,DfLwhhStatLogDaily.class), dailyLog);
}catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
RestServiceException restE = new RestServiceException(thread, System.currentTimeMillis() - start,
"SearchLwhh参数格式错误", RestBusinessCode.param_formate_error.getValue());
restE.setActiveSys(activeSys);
restE.setLogSource(logSource);
throw restE;
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"来文函号封堵日志配置日报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "来文函号封堵日志配置日报表检索成功",dailyLogPage,activeSys,logSource);
}
/**
* @Title: dfLwhhStatLogDailySources
* @Description: (局点月报表)
* @param @param page
* @param @param dailyLog
* @param @param request
* @param @param response
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@RequestMapping(value="dfLwhhStatLogMonthSources", method = RequestMethod.GET)
@ApiOperation(value="来文函号封堵日志配置月报表" , httpMethod = "GET", notes="get log list")
public Map dfLwhhStatLogMonthSources(
Page page,DfLwhhStatLogMonth monthLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DfLwhhStatLogMonth> monthLogPage =null;
try {
resetTime(monthLog, "month");
if (!StringUtil.isBlank(monthLog.getSearchLwhh())) {
Integer.parseInt(monthLog.getSearchLwhh());
}
//查询条件校验
dfStatLogService.queryConditionCheck(thread,start,monthLog, DfLwhhStatLogMonth.class, page);
monthLogPage = dfStatLogService.dfLwhhStatLogMonth(new Page<DfLwhhStatLogMonth>(request, response,DfLwhhStatLogMonth.class), monthLog);
}catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
RestServiceException restE = new RestServiceException(thread, System.currentTimeMillis() - start,
"SearchLwhh参数格式错误", RestBusinessCode.param_formate_error.getValue());
restE.setActiveSys(activeSys);
restE.setLogSource(logSource);
throw restE;
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"来文函号封堵日志配置月报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "来文函号封堵日志配置月报表检索成功",monthLogPage,activeSys,logSource);
}
/**
* 境内源IP日报表
*
* @Title: dfSrcIpDomesticStatLogDailySources
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @param page
* @param @param dailyLog
* @param @param request
* @param @param response
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@RequestMapping(value="dfSrcIpDomesticStatLogDailySources", method = RequestMethod.GET)
@ApiOperation(value="境内源IP封堵日志配置日报表" , httpMethod = "GET", notes="get log list")
public Map dfSrcIpDomesticStatLogDailySources(
Page page,DfSrcIpDomesticStatLogDaily dailyLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DfSrcIpDomesticStatLogDaily> dailyLogPage =null;
try {
resetTime(dailyLog, "daily");
dfStatLogService.queryConditionCheck(thread,start,dailyLog, DfSrcIpDomesticStatLogDaily.class, page);
dailyLogPage = dfStatLogService.dfSrcIpDomesticStatLogDaily(new Page<DfSrcIpDomesticStatLogDaily>(request, response,DfSrcIpDomesticStatLogDaily.class), dailyLog);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"境内源IP封堵日志配置日报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "境内源IP封堵日志配置日报表检索成功",dailyLogPage,activeSys,logSource);
}
/**
* 境内源IP月报表
*
* @Title: dfSrcIpDomesticStatLogMonthSources
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @param page
* @param @param dailyLog
* @param @param request
* @param @param response
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@RequestMapping(value="dfSrcIpDomesticStatLogMonthSources", method = RequestMethod.GET)
@ApiOperation(value="境内源IP封堵日志配置月报表" , httpMethod = "GET", notes="get log list")
public Map dfSrcIpDomesticStatLogMonthSources(
Page page,DfSrcIpDomesticStatLogMonth monthLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DfSrcIpDomesticStatLogMonth> monthLogPage =null;
try {
resetTime(monthLog, "month");
//查询条件校验
dfStatLogService.queryConditionCheck(thread,start,monthLog, DfSrcIpDomesticStatLogMonth.class, page);
monthLogPage = dfStatLogService.dfSrcIpDomesticStatLogMonth(new Page<DfSrcIpDomesticStatLogMonth>(request, response,DfSrcIpDomesticStatLogMonth.class), monthLog);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"境内源IP封堵日志配置月报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "境内源IP封堵日志配置月报表检索成功",monthLogPage,activeSys,logSource);
}
/**
* 国家目的IP日报表
*
* @Title: dfDestIpCounrtyStatLogDailySources
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @param page
* @param @param dailyLog
* @param @param request
* @param @param response
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@RequestMapping(value="dfDestIpCountryStatLogDailySources", method = RequestMethod.GET)
@ApiOperation(value="国家目的IP封堵日志配置日报表" , httpMethod = "GET", notes="get log list")
public Map dfDestIpCounrtyStatLogDailySources(
Page page,DfDestIpCounrtyStatLogDaily dailyLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DfDestIpCounrtyStatLogDaily> dailyLogPage =null;
try {
resetTime(dailyLog, "daily");
dfStatLogService.queryConditionCheck(thread,start,dailyLog, DfDestIpCounrtyStatLogDaily.class, page);
dailyLogPage = dfStatLogService.dfDestIpCounrtyStatLogDaily(new Page<DfDestIpCounrtyStatLogDaily>(request, response,DfDestIpCounrtyStatLogDaily.class), dailyLog);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"国家目的IP封堵日志配置日报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "国家目的IP封堵日志配置日报表检索成功",dailyLogPage,activeSys,logSource);
}
/**
* 国家目的IP月报表
*
* @Title: dfDestIpCounrtyStatLogMonthSources
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @param page
* @param @param dailyLog
* @param @param request
* @param @param response
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@RequestMapping(value="dfDestIpCountryStatLogMonthSources", method = RequestMethod.GET)
@ApiOperation(value="国家目的IP封堵日志配置月报表" , httpMethod = "GET", notes="get log list")
public Map dfDestIpCounrtyStatLogMonthSources(
Page page,DfDestIpCounrtyStatLogMonth monthLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DfDestIpCounrtyStatLogMonth> monthLogPage =null;
try {
resetTime(monthLog, "month");
//查询条件校验
dfStatLogService.queryConditionCheck(thread,start,monthLog, DfDestIpCounrtyStatLogMonth.class, page);
monthLogPage = dfStatLogService.dfDestIpCounrtyStatLogMonth(new Page<DfDestIpCounrtyStatLogMonth>(request, response,DfDestIpCounrtyStatLogMonth.class), monthLog);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"国家目的IP封堵日志配置月报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "国家目的IP封堵日志配置月报表检索成功",monthLogPage,activeSys,logSource);
}
/**
*
* @Title: resetTime
* @Description: (日报表默认查询本地前一天的数据)
* @param @param entity
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
public void resetTime(StatLogEntity<?> entity,String type) throws Exception{
Map<String, String> map = DateUtils.getLocalTime(entity.getSearchStatStartTime(),
entity.getSearchStatEndTime(), Constants.REPORT_LOCAL_TIME,type);
entity.setSearchStatStartTime(map.get("startTime"));
entity.setSearchStatEndTime(map.get("endTime"));
}
}

View File

@@ -1,921 +0,0 @@
package com.nis.web.controller.restful;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.nis.domain.Page;
import com.nis.domain.restful.DjCkStatLog;
import com.nis.domain.restful.DjJitAffairDestReport;
import com.nis.domain.restful.DjJitAffairSrcReport;
import com.nis.domain.restful.DjJitFlDestReport;
import com.nis.domain.restful.DjJitFlSrcReport;
import com.nis.domain.restful.DjJitGuaranteeDestReport;
import com.nis.domain.restful.DjJitGuaranteeSrcReport;
import com.nis.domain.restful.DjJitIdDestReport;
import com.nis.domain.restful.DjJitIdSrcReport;
import com.nis.domain.restful.DjJitMissionDestReport;
import com.nis.domain.restful.DjJitMissionSrcReport;
import com.nis.domain.restful.DjJitTagDestReport;
import com.nis.domain.restful.DjJitTagSrcReport;
import com.nis.restful.RestBusinessCode;
import com.nis.restful.RestServiceException;
import com.nis.util.Constants;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseRestController;
import com.nis.web.service.SaveRequestLogThread;
import com.nis.web.service.ServicesRequestLogService;
import com.nis.web.service.restful.DjJitLogSearchService;
import com.wordnik.swagger.annotations.ApiOperation;
/**
*
* @ClassName: DjJitLogSearchController
* @Description: 监测日志实时统计查询服务
* @author (rkg)
* @date 2016年9月13日上午10:32:21
* @version V1.0
*/
@RestController
@RequestMapping("${servicePath}/log/v1")
@SuppressWarnings({ "rawtypes" })
public class DjJitLogSearchController extends BaseRestController {
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private final Logger logger1 = Logger.getLogger(this.getClass());
protected String logSource = "0";
@Autowired
private DjJitLogSearchService djJitLogSearchService;
@Autowired
protected ServicesRequestLogService servicesRequestLogService;
@RequestMapping(value = "/djJitFlSrcReportSources", method = RequestMethod.GET)
@ApiOperation(value = "监测分类性质源IP实时统计", httpMethod = "GET", notes = "监测分类性质源IP实时统计列表")
public Map djJitFlSrcReportSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DjJitFlSrcReport djJitFlSrcReportSources, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DjJitFlSrcReport> djJitFlSrcReportSourcesPage = null;
try {
// 公共请求参数校验
djJitLogSearchService.queryDjJitFlCheck(thread, start, djJitFlSrcReportSources.getSearchFl(),
djJitFlSrcReportSources.getSearchXz());
djJitLogSearchService.queryConditionCheck(thread, start, djJitFlSrcReportSources, DjJitFlSrcReport.class,
page);
djJitFlSrcReportSourcesPage = djJitLogSearchService.findDjJitFlSrcReport(
new Page<DjJitFlSrcReport>(request, response, DjJitFlSrcReport.class), djJitFlSrcReportSources);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测分类性质源IP实时统计检索失败");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测分类性质源IP实时统计检索成功",
djJitFlSrcReportSourcesPage, searchActiveSys, logSource);
}
@RequestMapping(value = "/djJitFlDestReportSources", method = RequestMethod.GET)
@ApiOperation(value = "监测分类性质目的IP实时统计服务", httpMethod = "GET", notes = "监测分类性质目的IP实时统计列表")
public Map djJitFlDestReportSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DjJitFlDestReport djJitFlDestReport, HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DjJitFlDestReport> reporPage = null;
try {
// 公共请求参数校验
djJitLogSearchService.queryDjJitFlCheck(thread, start, djJitFlDestReport.getSearchFl(),
djJitFlDestReport.getSearchXz());
djJitLogSearchService.queryConditionCheck(thread, start, djJitFlDestReport, DjJitFlDestReport.class, page);
reporPage = djJitLogSearchService.findDjJitFlDestReport(
new Page<DjJitFlDestReport>(request, response, DjJitFlDestReport.class), djJitFlDestReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测分类性质目的IP实时统计检索失败");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测分类性质目的IP实时统计检索成功",
reporPage, searchActiveSys, logSource);
}
@RequestMapping(value = "/djJitAffairSrcReportSources", method = RequestMethod.GET)
@ApiOperation(value = "监测事件子话题源IP实时统计服务", httpMethod = "GET", notes = "监测事件子话题源IP实时统计列表")
public Map djJitAffairSrcReportSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DjJitAffairSrcReport djJitAffairSrcReport, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
// 公共请求参数校验
try {
if (!StringUtil.isBlank(djJitAffairSrcReport.getSearchAffair())) {
Integer.parseInt(djJitAffairSrcReport.getSearchAffair());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchAffair参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchAffair参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
try {
if (!StringUtil.isBlank(djJitAffairSrcReport.getSearchTopic())) {
Integer.parseInt(djJitAffairSrcReport.getSearchTopic());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchTopic参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchTopic参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
Page<DjJitAffairSrcReport> reporPage = null;
try {
djJitLogSearchService.queryConditionCheck(thread, start, djJitAffairSrcReport, DjJitAffairSrcReport.class,
page);
reporPage = djJitLogSearchService.findDjJitAffairSrcReport(
new Page<DjJitAffairSrcReport>(request, response, DjJitAffairSrcReport.class),
djJitAffairSrcReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测事件子话题源IP实时统计检索失败");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测事件子话题源IP实时统计检索成功",
reporPage, searchActiveSys, logSource);
}
@RequestMapping(value = "/djJitAffairDestReportSources", method = RequestMethod.GET)
@ApiOperation(value = "监测事件子话题目的IP实时统计服务", httpMethod = "GET", notes = "监测事件子话题目的IP实时统计列表")
public Map djJitAffairDestReportSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DjJitAffairDestReport djJitAffairDestReport, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
// 公共请求参数校验
try {
if (!StringUtil.isBlank(djJitAffairDestReport.getSearchAffair())) {
Integer.parseInt(djJitAffairDestReport.getSearchAffair());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchAffair参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchAffair参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
try {
if (!StringUtil.isBlank(djJitAffairDestReport.getSearchTopic())) {
Integer.parseInt(djJitAffairDestReport.getSearchTopic());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchTopic参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchTopic参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
Page<DjJitAffairDestReport> reporPage = null;
try {
djJitLogSearchService.queryConditionCheck(thread, start, djJitAffairDestReport, DjJitAffairDestReport.class,
page);
reporPage = djJitLogSearchService.findDjJitAffairDestReport(
new Page<DjJitAffairDestReport>(request, response, DjJitAffairDestReport.class),
djJitAffairDestReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测事件子话题目的IP实时统计检索失败");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测事件子话题目的IP实时统计检索成功",
reporPage, searchActiveSys, logSource);
}
@RequestMapping(value = "/djJitMissionSrcReportSources", method = RequestMethod.GET)
@ApiOperation(value = "监测任务源IP实时统计服务", httpMethod = "GET", notes = "监测任务源IP实时统计列表")
public Map djJitMissionSrcReportSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DjJitMissionSrcReport djJitMissionSrcReport, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
// 公共请求参数校验
try {
if (!StringUtil.isBlank(djJitMissionSrcReport.getSearchMission())) {
Integer.parseInt(djJitMissionSrcReport.getSearchMission());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchMission参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchMission参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
Page<DjJitMissionSrcReport> reporPage = null;
try {
djJitLogSearchService.queryConditionCheck(thread, start, djJitMissionSrcReport, DjJitMissionSrcReport.class,
page);
reporPage = djJitLogSearchService.findDjJitMissionSrcReport(
new Page<DjJitMissionSrcReport>(request, response, DjJitMissionSrcReport.class),
djJitMissionSrcReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测任务源IP实时统计检索失败");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测任务源IP实时统计检索成功",
reporPage, searchActiveSys, logSource);
}
@RequestMapping(value = "/djJitMissionDestReportSources", method = RequestMethod.GET)
@ApiOperation(value = "监测任务目的IP实时统计服务", httpMethod = "GET", notes = "监测任务目的IP实时统计列表")
public Map djJitMissionDestReportSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DjJitMissionDestReport djJitMissionDestReport, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
// 公共请求参数校验
try {
if (!StringUtil.isBlank(djJitMissionDestReport.getSearchMission())) {
Integer.parseInt(djJitMissionDestReport.getSearchMission());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchMission参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchMission参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
Page<DjJitMissionDestReport> reporPage = null;
try {
djJitLogSearchService.queryConditionCheck(thread, start, djJitMissionDestReport,
DjJitMissionDestReport.class, page);
reporPage = djJitLogSearchService.findDjJitMissionDestReport(
new Page<DjJitMissionDestReport>(request, response, DjJitMissionDestReport.class),
djJitMissionDestReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测任务目的IP实时统计检索失败");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测任务目的IP实时统计检索成功",
reporPage, searchActiveSys, logSource);
}
@RequestMapping(value = "/djJitGuaranteeSrcReportSources", method = RequestMethod.GET)
@ApiOperation(value = "监测保障期源IP实时统计服务", httpMethod = "GET", notes = "监测保障期源IP实时统计列表")
public Map djJitGuaranteeSrcReportSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DjJitGuaranteeSrcReport djJitGuaranteeSrcReport, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
// 公共请求参数校验
try {
if (!StringUtil.isBlank(djJitGuaranteeSrcReport.getSearchGuarantee())) {
Integer.parseInt(djJitGuaranteeSrcReport.getSearchGuarantee());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchGuarantee参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchGuarantee参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
Page<DjJitGuaranteeSrcReport> reporPage = null;
try {
djJitLogSearchService.queryConditionCheck(thread, start, djJitGuaranteeSrcReport,
DjJitGuaranteeSrcReport.class, page);
reporPage = djJitLogSearchService.findDjJitGuaranteeSrcReport(
new Page<DjJitGuaranteeSrcReport>(request, response, DjJitGuaranteeSrcReport.class),
djJitGuaranteeSrcReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测保障期源IP实时统计检索失败");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测保障期源IP实时统计检索成功",
reporPage, searchActiveSys, logSource);
}
@RequestMapping(value = "/djJitGuaranteeDestReportSources", method = RequestMethod.GET)
@ApiOperation(value = "监测保障期目的IP实时统计服务", httpMethod = "GET", notes = "监测保障期目的IP实时统计列表")
public Map djJitGuaranteeDestReportSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DjJitGuaranteeDestReport djJitGuaranteeDestReport, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
// 公共请求参数校验
try {
if (!StringUtil.isBlank(djJitGuaranteeDestReport.getSearchGuarantee())) {
Integer.parseInt(djJitGuaranteeDestReport.getSearchGuarantee());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchGuarantee参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchGuarantee参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
Page<DjJitGuaranteeDestReport> reporPage = null;
try {
djJitLogSearchService.queryConditionCheck(thread, start, djJitGuaranteeDestReport,
DjJitGuaranteeDestReport.class, page);
reporPage = djJitLogSearchService.findDjJitGuaranteeDestReport(
new Page<DjJitGuaranteeDestReport>(request, response, DjJitGuaranteeDestReport.class),
djJitGuaranteeDestReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测保障期目的IP实时统计检索失败");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测保障期目的IP实时统计检索成功",
reporPage, searchActiveSys, logSource);
}
@RequestMapping(value = "/djJitTagSrcReportSources", method = RequestMethod.GET)
@ApiOperation(value = "监测标签源IP实时统计服务", httpMethod = "GET", notes = "监测标签源IP实时统计列表")
public Map djJitTagSrcReportSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DjJitTagSrcReport djJitTagSrcReport, HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
// 公共请求参数校验
if (null != djJitTagSrcReport.getSearchTag() && !djJitTagSrcReport.getSearchTag().equals("")) {
String[] tagArr = djJitTagSrcReport.getSearchTag().split(",");
List<String> tagList = new ArrayList<String>();
for (int i = 0; i < tagArr.length; i++) {
if (!tagArr[i].equals("")) {
try {
Integer.parseInt(tagArr[i]);
tagList.add(tagArr[i]);
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread,
System.currentTimeMillis() - start, "searchTag参数格式错误",
RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchTag参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
}
}
StringBuffer sb = new StringBuffer();
for (String str : tagList) {
sb.append(str + ",");
}
String tag = sb.substring(0, sb.length() - 1);
djJitTagSrcReport.setSearchTag(tag);
}
Page<DjJitTagSrcReport> reporPage = null;
try {
djJitLogSearchService.queryConditionCheck(thread, start, djJitTagSrcReport, DjJitTagSrcReport.class, page);
reporPage = djJitLogSearchService.findDjJitTagSrcReport(
new Page<DjJitTagSrcReport>(request, response, DjJitTagSrcReport.class), djJitTagSrcReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测标签源IP实时统计检索失败");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测标签源IP实时统计检索成功",
reporPage, searchActiveSys, logSource);
}
@RequestMapping(value = "/djJitTagDestReportSources", method = RequestMethod.GET)
@ApiOperation(value = "监测标签目的IP实时统计服务", httpMethod = "GET", notes = "监测标签目的IP实时统计列表")
public Map djJitTagDestReportSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DjJitTagDestReport djJitTagDestReport, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
// 公共请求参数校验
if (null != djJitTagDestReport.getSearchTag() && !djJitTagDestReport.getSearchTag().equals("")) {
String[] tagArr = djJitTagDestReport.getSearchTag().split(",");
List<String> tagList = new ArrayList<String>();
for (int i = 0; i < tagArr.length; i++) {
if (!tagArr[i].equals("")) {
try {
Integer.parseInt(tagArr[i]);
tagList.add(tagArr[i]);
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread,
System.currentTimeMillis() - start, "searchTag参数格式错误",
RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchTag参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
}
}
StringBuffer sb = new StringBuffer();
for (String str : tagList) {
sb.append(str + ",");
}
String tag = sb.substring(0, sb.length() - 1);
djJitTagDestReport.setSearchTag(tag);
}
Page<DjJitTagDestReport> reporPage = null;
try {
djJitLogSearchService.queryConditionCheck(thread, start, djJitTagDestReport, DjJitTagDestReport.class,
page);
reporPage = djJitLogSearchService.findDjJitTagDestReport(
new Page<DjJitTagDestReport>(request, response, DjJitTagDestReport.class), djJitTagDestReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测标签目的IP实时统计检索失败");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测标签目的IP实时统计检索成功",
reporPage, searchActiveSys, logSource);
}
@RequestMapping(value = "/djJitIdSrcReportSources", method = RequestMethod.GET)
@ApiOperation(value = "监测规则源IP实时统计服务", httpMethod = "GET", notes = "监测规则源IP实时统计列表")
public Map djJitIdSrcReportSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DjJitIdSrcReport djJitIdSrcReport, HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
// 公共请求参数校验
try {
if (!StringUtil.isBlank(djJitIdSrcReport.getSearchId())) {
Integer.parseInt(djJitIdSrcReport.getSearchId());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchId参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchId参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
Page<DjJitIdSrcReport> reporPage = null;
try {
djJitLogSearchService.queryConditionCheck(thread, start, djJitIdSrcReport, DjJitIdSrcReport.class, page);
reporPage = djJitLogSearchService.findDjJitIdSrcReport(
new Page<DjJitIdSrcReport>(request, response, DjJitIdSrcReport.class), djJitIdSrcReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测规则源IP实时统计检索失败");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测规则源IP实时统计检索成功",
reporPage, searchActiveSys, logSource);
}
@RequestMapping(value = "/djJitIdDestReportSources", method = RequestMethod.GET)
@ApiOperation(value = "监测规则目的IP实时统计服务", httpMethod = "GET", notes = "监测规则目的IP实时统计列表")
public Map djJitIdDestReportSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DjJitIdDestReport djJitIdDestReport, HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
// 公共请求参数校验
try {
if (!StringUtil.isBlank(djJitIdDestReport.getSearchId())) {
Integer.parseInt(djJitIdDestReport.getSearchId());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchId参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchId参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
Page<DjJitIdDestReport> reporPage = null;
try {
djJitLogSearchService.queryConditionCheck(thread, start, djJitIdDestReport, DjJitIdDestReport.class, page);
reporPage = djJitLogSearchService.findDjJitIdDestReport(
new Page<DjJitIdDestReport>(request, response, DjJitIdDestReport.class), djJitIdDestReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测规则目的IP实时统计检索失败");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测规则目的IP实时统计检索成功",
reporPage, searchActiveSys, logSource);
}
@RequestMapping(value = "/djCkStatLogSources", method = RequestMethod.GET)
@ApiOperation(value = "监测日志国际出入口统计服务", httpMethod = "GET", notes = "监测日志国际出入口统计列表")
public Map djCkStatLogSources(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
Page page, DjCkStatLog djCkStatLog, HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
// 公共请求参数校验
try {
if (!StringUtil.isBlank(djCkStatLog.getSearchCfgId())) {
Long.parseLong(djCkStatLog.getSearchCfgId());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchCfgId参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchId参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
try {
if (!StringUtil.isBlank(djCkStatLog.getSearchGjCkId())) {
Long.parseLong(djCkStatLog.getSearchGjCkId());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchGjCkId参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchGjCkId参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
try {
if (!StringUtil.isBlank(djCkStatLog.getSearchActiveSys())) {
Integer.parseInt(djCkStatLog.getSearchActiveSys());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchActiveSys参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchGjCkId参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
try {
if (!StringUtil.isBlank(djCkStatLog.getSearchCapStartTime())) {
sdf.parse(djCkStatLog.getSearchCapStartTime());
}
} catch (ParseException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchCapStartTime参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchCapStartTime参数格式格式");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
try {
if (!StringUtil.isBlank(djCkStatLog.getSearchCapEndTime())) {
sdf.parse(djCkStatLog.getSearchCapEndTime());
}
} catch (ParseException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchCapEndTime参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchCapEndTime参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
throw ((RestServiceException) e);
}
try {
if (!StringUtil.isBlank(djCkStatLog.getSearchService())) {
Integer.parseInt(djCkStatLog.getSearchService());
}
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
RestServiceException restError = new RestServiceException(thread, System.currentTimeMillis() - start,
"searchService参数格式错误", RestBusinessCode.param_formate_error.getValue());
restError.setActiveSys(searchActiveSys);
restError.setLogSource(logSource);
throw restError;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "searchService参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
try {
djJitLogSearchService.checkCloumnIsExist(thread, start, DjCkStatLog.class, page);
} catch (RestServiceException e) {
logger1.error(e);
e.setActiveSys(searchActiveSys);
e.setLogSource(logSource);
throw e;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "请求参数错误");
}
((RestServiceException) e).setActiveSys(searchActiveSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
Page<DjCkStatLog> reporPage = null;
try {
reporPage = djJitLogSearchService
.findDjCkStatLog(new Page<DjCkStatLog>(request, response, DjCkStatLog.class), djCkStatLog);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger1.error(e);
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, "监测日志国际出入口统计检索成功",
reporPage, searchActiveSys, logSource);
}
}

View File

@@ -1,215 +0,0 @@
package com.nis.web.controller.restful;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
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 com.nis.domain.DfReportEntity;
import com.nis.domain.LogEntity;
import com.nis.domain.Page;
import com.nis.domain.restful.DjLwhhAttrReport;
import com.nis.domain.restful.DjLwhhTagReport;
import com.nis.domain.restful.DjSrcIpAttrReport;
import com.nis.domain.restful.DjSrcIpTagReport;
import com.nis.restful.RestServiceException;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.web.controller.BaseRestController;
import com.nis.web.service.SaveRequestLogThread;
import com.nis.web.service.ServicesRequestLogService;
import com.nis.web.service.restful.DjMultiDimensionalReportService;
import com.wordnik.swagger.annotations.ApiOperation;
/**
*
* @ClassName: DjMultiDimensionalReportController
* @Description: TODO(dj多维实时统计)
* @author (DDM)
* @date 2017年8月4日下午2:53:01
* @version V1.0
*/
@RestController
@RequestMapping("${servicePath}/log/v1")
@SuppressWarnings({ "rawtypes" })
public class DjMultiDimensionalReportController extends BaseRestController {
protected final Logger logger = Logger.getLogger(this.getClass());
protected String activeSys = Constants.ACTIVESYS_ALL;
protected String logSource = "0";
@Autowired
protected DjMultiDimensionalReportService djMultiDimensionalReportService;
@Autowired
protected ServicesRequestLogService servicesRequestLogService;
@RequestMapping(value = "djLwhhAttrReportSources", method = RequestMethod.GET)
@ApiOperation(value = "来文函号、性质多维实时统计", httpMethod = "GET", notes = "get log list")
public Map djServiceReportSources(Page page, DjLwhhAttrReport djLwhhAttrReport, Model model,
HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DjLwhhAttrReport> lwhhAttrReportPage = null;
try {
//设置本地默认查询时间
resetTime(djLwhhAttrReport);
// 校验
djMultiDimensionalReportService.queryConditionCheck(thread, start, djLwhhAttrReport, DjLwhhAttrReport.class,
page);
// 查询数据库
lwhhAttrReportPage = djMultiDimensionalReportService.findDjLwhhAttrReportPage(
new Page<DjLwhhAttrReport>(request, response, DjLwhhAttrReport.class), djLwhhAttrReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "来文函号、性质多维实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "来文函号、性质多维实时统计成功",
lwhhAttrReportPage, activeSys, logSource);
}
@RequestMapping(value = "djLwhhTagReportSources", method = RequestMethod.GET)
@ApiOperation(value = "来文函号、标签多维实时统计", httpMethod = "GET", notes = "get log list")
public Map djServiceReportSources(Page page, DjLwhhTagReport djLwhhTagReport, Model model,
HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DjLwhhTagReport> lwhhTagReportPage = null;
try {
//设置本地默认查询时间
resetTime(djLwhhTagReport);
// 校验
djMultiDimensionalReportService.queryConditionCheck(thread, start, djLwhhTagReport, DjLwhhTagReport.class,
page);
// 查询数据库
lwhhTagReportPage = djMultiDimensionalReportService.findDjLwhhTagReportPage(
new Page<DjLwhhTagReport>(request, response, DjLwhhTagReport.class), djLwhhTagReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "来文函号、标签多维实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "来文函号、标签多维实时统计成功",
lwhhTagReportPage, activeSys, logSource);
}
@RequestMapping(value = "djSrcIpAttrReportSources", method = RequestMethod.GET)
@ApiOperation(value = "来文函号、性质多维实时统计", httpMethod = "GET", notes = "get log list")
public Map djServiceReportSources(Page page, DjSrcIpAttrReport djSrcIpAttrReport, Model model,
HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DjSrcIpAttrReport> srcIpAttrReportPage = null;
try {
//设置本地默认查询时间
resetTime(djSrcIpAttrReport);
// 校验
djMultiDimensionalReportService.queryConditionCheck(thread, start, djSrcIpAttrReport, DjSrcIpAttrReport.class,
page);
// 查询数据库
srcIpAttrReportPage = djMultiDimensionalReportService.findDjSrcIpAttrReportPage(
new Page<DjSrcIpAttrReport>(request, response, DjSrcIpAttrReport.class), djSrcIpAttrReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "境内源ip、性质多维实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "境内源ip、性质多维实时统计成功",
srcIpAttrReportPage, activeSys, logSource);
}
@RequestMapping(value = "djSrcIpTagReportSources", method = RequestMethod.GET)
@ApiOperation(value = "来文函号、标签多维实时统计", httpMethod = "GET", notes = "get log list")
public Map djServiceReportSources(Page page, DjSrcIpTagReport djSrcIpTagReport, Model model,
HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DjSrcIpTagReport> srcIpTagReportPage = null;
try {
//设置本地默认查询时间
resetTime(djSrcIpTagReport);
// 校验
djMultiDimensionalReportService.queryConditionCheck(thread, start, djSrcIpTagReport, DjSrcIpTagReport.class,
page);
// 查询数据库
srcIpTagReportPage = djMultiDimensionalReportService.findDjSrcIpTagReportPage(
new Page<DjSrcIpTagReport>(request, response, DjSrcIpTagReport.class), djSrcIpTagReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "境内源ip、标签多维实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "境内源ip、标签多维实时统计成功",
srcIpTagReportPage, activeSys, logSource);
}
/**
*
* @Title: resetTime
* @Description: (实时统计默认查询本地一个小时的数据)
* @param @param entity
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
public void resetTime(DfReportEntity<?> entity) throws Exception {
Map<String, String> map = DateUtils.getLocalTime(entity.getSearchReportStartTime(),
entity.getSearchReportEndTime(), Constants.REPORT_LOCAL_TIME,"report");
entity.setSearchReportStartTime(map.get("startTime"));
entity.setSearchReportEndTime(map.get("endTime"));
}
}

View File

@@ -1,333 +0,0 @@
/**
* @Title: DjStatLogController.java
* @Package com.nis.web.controller
* @Description: TODO(用一句话描述该文件做什么)
* @author ddm
* @date 2016年9月13日 下午1:22:15
* @version V1.0
*/
package com.nis.web.controller.restful;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.nis.domain.Page;
import com.nis.domain.StatLogEntity;
import com.nis.domain.restful.DjLwhhAttrDaily;
import com.nis.domain.restful.DjLwhhAttrMonth;
import com.nis.domain.restful.DjLwhhTagDaily;
import com.nis.domain.restful.DjLwhhTagMonth;
import com.nis.domain.restful.DjSrcIpAttrDaily;
import com.nis.domain.restful.DjSrcIpAttrMonth;
import com.nis.domain.restful.DjSrcIpTagDaily;
import com.nis.domain.restful.DjSrcIpTagMonth;
import com.nis.restful.RestServiceException;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.util.redis.RedisDao;
import com.nis.web.controller.BaseRestController;
import com.nis.web.service.SaveRequestLogThread;
import com.nis.web.service.ServicesRequestLogService;
import com.nis.web.service.restful.DjMultiDimensionalStatLogService;
import com.wordnik.swagger.annotations.ApiOperation;
/**
* @ClassName: DjStatLogController
* @Description: TODO(这里用一句话描述这个类的作用)
* @author (ddm)
* @date 2016年9月13日 下午1:22:15
* @version V1.0
*/
@RestController
@RequestMapping("${servicePath}/log/v1")
@SuppressWarnings({ "rawtypes", "unchecked" })
public class DjMultiDimensionalStatLogController extends BaseRestController{
protected final Logger logger = Logger.getLogger(this.getClass());
protected String logSource="0";
protected String activeSys=Constants.ACTIVESYS_ALL;
@Autowired
protected DjMultiDimensionalStatLogService djMultiDimensionalStatLogService;
@Autowired
protected RedisDao redisDao;
@Autowired
protected ServicesRequestLogService servicesRequestLogService;
@RequestMapping(value="djLwhhAttrDailySources", method = RequestMethod.GET)
@ApiOperation(value="监测来文函号-性质多维日报表" , httpMethod = "GET", notes="get log list")
public Map djLwhhAttrDailySources(
Page page,DjLwhhAttrDaily djLwhhAttrDaily, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DjLwhhAttrDaily> djLwhhAttrDailyPage =null;
try {
resetTime(djLwhhAttrDaily, "daily");
djMultiDimensionalStatLogService.queryConditionCheck(thread,start,djLwhhAttrDaily, DjLwhhAttrDaily.class, page);
djLwhhAttrDailyPage = djMultiDimensionalStatLogService.djLwhhAttrDaily(new Page<DjLwhhAttrDaily>(request, response,DjLwhhAttrDaily.class), djLwhhAttrDaily);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"监测来文函号-性质多维日报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "监测来文函号-标签多维日报表检索成功",djLwhhAttrDailyPage,activeSys,logSource);
}
@RequestMapping(value="djLwhhAttrMonthSources", method = RequestMethod.GET)
@ApiOperation(value="监测来文函号-性质多维月报表" , httpMethod = "GET", notes="get log list")
public Map djLwhhAttrMonthSources(
Page page,DjLwhhAttrMonth djLwhhAttrMonth, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DjLwhhAttrMonth> djLwhhAttrMonthPage =null;
try {
resetTime(djLwhhAttrMonth, "month");
//查询条件校验
djMultiDimensionalStatLogService.queryConditionCheck(thread,start,djLwhhAttrMonth, DjLwhhAttrMonth.class, page);
djLwhhAttrMonthPage = djMultiDimensionalStatLogService.djLwhhAttrMonth(new Page<DjLwhhAttrMonth>(request, response,DjLwhhAttrMonth.class), djLwhhAttrMonth);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"监测来文函号-性质多维月报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "监测来文函号-性质多维月报表检索成功",djLwhhAttrMonthPage,activeSys,logSource);
}
@RequestMapping(value="djLwhhTagDailySources", method = RequestMethod.GET)
@ApiOperation(value="监测来文函号-标签多维日报表" , httpMethod = "GET", notes="get log list")
public Map djLwhhTagDailySources(
Page page,DjLwhhTagDaily djLwhhTagDaily, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DjLwhhTagDaily> djLwhhTagDailyPage =null;
try {
resetTime(djLwhhTagDaily, "daily");
djMultiDimensionalStatLogService.queryConditionCheck(thread,start,djLwhhTagDaily, DjLwhhTagDaily.class, page);
djLwhhTagDailyPage = djMultiDimensionalStatLogService.djLwhhTagDaily(new Page<DjLwhhTagDaily>(request, response,DjLwhhTagDaily.class), djLwhhTagDaily);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"监测来文函号-标签多维日报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "监测来文函号-标签多维日报表检索成功",djLwhhTagDailyPage,activeSys,logSource);
}
@RequestMapping(value="djLwhhTagMonthSources", method = RequestMethod.GET)
@ApiOperation(value="监测来文函号-标签多维月报表" , httpMethod = "GET", notes="get log list")
public Map djLwhhTagMonthSources(
Page page,DjLwhhTagMonth djLwhhTagMonth, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DjLwhhTagMonth> djLwhhTagMonthPage =null;
try {
resetTime(djLwhhTagMonth, "month");
//查询条件校验
djMultiDimensionalStatLogService.queryConditionCheck(thread,start,djLwhhTagMonth, DjLwhhTagMonth.class, page);
djLwhhTagMonthPage = djMultiDimensionalStatLogService.djLwhhTagMonth(new Page<DjLwhhTagMonth>(request, response,DjLwhhTagMonth.class), djLwhhTagMonth);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"监测来文函号-标签多维月报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "监测来文函号-标签多维月报表检索成功",djLwhhTagMonthPage,activeSys,logSource);
}
@RequestMapping(value="djSrcIpAttrDailySources", method = RequestMethod.GET)
@ApiOperation(value="监测省-性质多维日报表" , httpMethod = "GET", notes="get log list")
public Map djSrcIpAttrDailySources(
Page page,DjSrcIpAttrDaily djSrcIpAttrDaily, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DjSrcIpAttrDaily> djSrcIpAttrDailyPage =null;
try {
resetTime(djSrcIpAttrDaily, "daily");
djMultiDimensionalStatLogService.queryConditionCheck(thread,start,djSrcIpAttrDaily, DjSrcIpAttrDaily.class, page);
djSrcIpAttrDailyPage = djMultiDimensionalStatLogService.djSrcIpAttrDaily(new Page<DjSrcIpAttrDaily>(request, response,DjSrcIpAttrDaily.class), djSrcIpAttrDaily);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"监测省-性质多维日报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "监测省-标签多维日报表检索成功",djSrcIpAttrDailyPage,activeSys,logSource);
}
@RequestMapping(value="djSrcIpAttrMonthSources", method = RequestMethod.GET)
@ApiOperation(value="监测省-性质多维月报表" , httpMethod = "GET", notes="get log list")
public Map djSrcIpAttrMonthSources(
Page page,DjSrcIpAttrMonth djSrcIpAttrMonth, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DjSrcIpAttrMonth> djSrcIpAttrMonthPage =null;
try {
resetTime(djSrcIpAttrMonth, "month");
//查询条件校验
djMultiDimensionalStatLogService.queryConditionCheck(thread,start,djSrcIpAttrMonth, DjSrcIpAttrMonth.class, page);
djSrcIpAttrMonthPage = djMultiDimensionalStatLogService.djSrcIpAttrMonth(new Page<DjSrcIpAttrMonth>(request, response,DjSrcIpAttrMonth.class), djSrcIpAttrMonth);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"监测省-性质多维月报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "监测省-性质多维月报表检索成功",djSrcIpAttrMonthPage,activeSys,logSource);
}
@RequestMapping(value="djSrcIpTagDailySources", method = RequestMethod.GET)
@ApiOperation(value="监测省-标签多维日报表" , httpMethod = "GET", notes="get log list")
public Map djSrcIpTagDailySources(
Page page,DjSrcIpTagDaily djSrcIpTagDaily, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DjSrcIpTagDaily> djSrcIpTagDailyPage =null;
try {
resetTime(djSrcIpTagDaily, "daily");
djMultiDimensionalStatLogService.queryConditionCheck(thread,start,djSrcIpTagDaily, DjSrcIpTagDaily.class, page);
djSrcIpTagDailyPage = djMultiDimensionalStatLogService.djSrcIpTagDaily(new Page<DjSrcIpTagDaily>(request, response,DjSrcIpTagDaily.class), djSrcIpTagDaily);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"监测省-标签多维日报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "监测省-标签多维日报表检索成功",djSrcIpTagDailyPage,activeSys,logSource);
}
@RequestMapping(value="djSrcIpTagMonthSources", method = RequestMethod.GET)
@ApiOperation(value="监测省-标签多维月报表" , httpMethod = "GET", notes="get log list")
public Map djSrcIpTagMonthSources(
Page page,DjSrcIpTagMonth djSrcIpTagMonth, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DjSrcIpTagMonth> djSrcIpTagMonthPage =null;
try {
resetTime(djSrcIpTagMonth, "month");
//查询条件校验
djMultiDimensionalStatLogService.queryConditionCheck(thread,start,djSrcIpTagMonth, DjSrcIpTagMonth.class, page);
djSrcIpTagMonthPage = djMultiDimensionalStatLogService.djSrcIpTagMonth(new Page<DjSrcIpTagMonth>(request, response,DjSrcIpTagMonth.class), djSrcIpTagMonth);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"监测省-标签多维月报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "监测省-标签多维月报表检索成功",djSrcIpTagMonthPage,activeSys,logSource);
}
/**
*
* @Title: resetTime
* @Description: (日报表默认查询本地前一天的数据)
* @param @param entity
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
public void resetTime(StatLogEntity<?> entity,String type) throws Exception{
Map<String, String> map = DateUtils.getLocalTime(entity.getSearchStatStartTime(),
entity.getSearchStatEndTime(), Constants.REPORT_LOCAL_TIME,type);
entity.setSearchStatStartTime(map.get("startTime"));
entity.setSearchStatEndTime(map.get("endTime"));
}
}

View File

@@ -1,487 +0,0 @@
package com.nis.web.controller.restful;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
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 com.nis.domain.DfReportEntity;
import com.nis.domain.Page;
import com.nis.domain.restful.DjAttrTypeReport;
import com.nis.domain.restful.DjDestIpCountryReport;
import com.nis.domain.restful.DjEntranceReport;
import com.nis.domain.restful.DjLwhhReport;
import com.nis.domain.restful.DjPzReport;
import com.nis.domain.restful.DjSrcIpDomeSticReport;
import com.nis.domain.restful.DjTagReport;
import com.nis.domain.restful.DjPzReportStat;
import com.nis.restful.RestServiceException;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.web.controller.BaseRestController;
import com.nis.web.service.SaveRequestLogThread;
import com.nis.web.service.ServicesRequestLogService;
import com.nis.web.service.restful.DjReportService;
import com.wordnik.swagger.annotations.ApiOperation;
import net.sf.json.JSONObject;
/**
* @ClassName: DjReportController
* @Description: 监测日志实时统计查询服务
* @author (ZBC)
* @date 2016年11月22日下午06:00:00
* @version V1.0
*/
@RestController
@RequestMapping("${servicePath}/log/v1")
@SuppressWarnings({ "rawtypes" })
public class DjReportController extends BaseRestController {
protected final Logger logger = Logger.getLogger(this.getClass());
protected String activeSys = Constants.ACTIVESYS_ALL;
protected String logSource = "0";
@Autowired
protected DjReportService djReportService;
@Autowired
protected ServicesRequestLogService servicesRequestLogService;
@RequestMapping(value = "djPzReportSources", method = RequestMethod.GET)
@ApiOperation(value = "监测配置实时统计服务", httpMethod = "GET", notes = "get log list")
public Map djPzReportSources(Page page, DjPzReport djPzReport, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DjPzReport> pzReportPage = null;
try {
//设置本地默认查询时间
resetTime(djPzReport);
djReportService.queryConditionCheck(thread, start, djPzReport, DjPzReport.class, page);
// 查询数据库
pzReportPage = djReportService.findDjPzReportPage(new Page<DjPzReport>(request, response, DjPzReport.class),
djPzReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测配置实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测配置实时统计成功",
pzReportPage, activeSys, logSource);
}
/**
* 配置统计【小时】
*
* @param page
* @param djPzReport
* @param model
* @param request
* @param response
* @return
*/
@RequestMapping(value = "djPzStatSources", method = RequestMethod.GET)
@ApiOperation(value = "监测各配置量统计服务[小时]", httpMethod = "GET", notes = "get log list")
public Map djPzStatSources(Page page, DjPzReportStat djPzReportStat, Model model, HttpServletRequest request,
HttpServletResponse response) {
if (!Constants.ACTIVESYS_A.equals(djPzReportStat.getSearchStatActiveSys())
&& !Constants.ACTIVESYS_C.equals(djPzReportStat.getSearchStatActiveSys())
&& !Constants.ACTIVESYS_AB.equals(djPzReportStat.getSearchStatActiveSys())) {
djPzReportStat.setSearchStatActiveSys(Constants.ACTIVESYS_B);
}
activeSys = djPzReportStat.getSearchStatActiveSys();
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DjPzReportStat> pzReportPage = null;
try {
//设置本地默认查询时间
resetTime(djPzReportStat);
djReportService.queryConditionCheck(thread, start, djPzReportStat, DjPzReportStat.class, page);
// 查询数据库
pzReportPage = djReportService.findDjPzReportStatPage(
new Page<DjPzReportStat>(request, response, DjPzReportStat.class), djPzReportStat);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测各配置量统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测各配置量统计成功",
pzReportPage, activeSys, logSource);
}
/**
* 配置统计【分钟】
*
* @param page
* @param djPzReport
* @param model
* @param request
* @param response
* @return
*/
@RequestMapping(value = "djPzStatMinutesSources", method = RequestMethod.GET)
@ApiOperation(value = "监测各配置量统计服务[分钟]", httpMethod = "GET", notes = "get log list")
public Map djPzStatMinutesSources(Page page, DjPzReportStat djPzReportStat, Model model, HttpServletRequest request,
HttpServletResponse response) {
if (!Constants.ACTIVESYS_A.equals(djPzReportStat.getSearchStatActiveSys())
&& !Constants.ACTIVESYS_C.equals(djPzReportStat.getSearchStatActiveSys())
&& !Constants.ACTIVESYS_AB.equals(djPzReportStat.getSearchStatActiveSys())) {
djPzReportStat.setSearchStatActiveSys(Constants.ACTIVESYS_B);
}
activeSys = djPzReportStat.getSearchStatActiveSys();
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DjPzReportStat> pzReportPage = null;
try {
//设置本地默认查询时间
resetTime(djPzReportStat);
djReportService.queryConditionCheck(thread, start, djPzReportStat, DjPzReportStat.class, page);
// 查询数据库
pzReportPage = djReportService.findDjPzReportStatMinutesPage(
new Page<DjPzReportStat>(request, response, DjPzReportStat.class), djPzReportStat);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测各配置量统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测各配置量统计成功",
pzReportPage, activeSys, logSource);
}
/**
* 配置统计
*
* @param page
* @param djPzReport
* @param model
* @param request
* @param response
* @return
*/
@RequestMapping(value = "djPzSumStatSources", method = RequestMethod.GET)
@ApiOperation(value = "监测配置总量统计服务", httpMethod = "GET", notes = "get log list")
public Map djPzSumStatSources(Page page, DjPzReportStat djPzReportStat, Model model, HttpServletRequest request,
HttpServletResponse response) {
if (!Constants.ACTIVESYS_A.equals(djPzReportStat.getSearchStatActiveSys())
&& !Constants.ACTIVESYS_C.equals(djPzReportStat.getSearchStatActiveSys())
) {
djPzReportStat.setSearchStatActiveSys(Constants.ACTIVESYS_B);
}
activeSys = djPzReportStat.getSearchStatActiveSys();
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
JSONObject json = new JSONObject();
try {
//设置本地默认查询时间
resetTime(djPzReportStat);
djReportService.queryConditionCheck(thread, start, djPzReportStat, DjPzReportStat.class,
page);
// 查询数据库
Long sum = djReportService.findDjPzReportSumStat(
new Page<DjPzReportStat>(request, response, DjPzReportStat.class), djPzReportStat);
if (sum == null)
sum = 0l;
json.put("sum", sum);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测配置总量统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测配置总量统计成功", json,
activeSys, logSource);
}
@RequestMapping(value = "djPzPrivServiceReportSources", method = RequestMethod.GET)
@ApiOperation(value = "监测配置(带私有标签)统计服务", httpMethod = "GET", notes = "get log list")
public Map djPzPrivServiceReportSources(Page page, DjPzReport djPzReport, Model model, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DjPzReport> djPzReportPage = null;
try {
//设置本地默认查询时间
resetTime(djPzReport);
djReportService.queryConditionCheck(thread, start, djPzReport, DjPzReport.class, page);
// 查询数据库
djPzReportPage = djReportService
.findDjPzPrivPage(new Page<DjPzReport>(request, response, DjPzReport.class), djPzReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测配置(带私有标签)统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测配置(带私有标签)统计成功",
djPzReportPage, activeSys, logSource);
}
@RequestMapping(value = "djAttrTypeReportSources", method = RequestMethod.GET)
@ApiOperation(value = "监测性质(带私有标签)实时统计", httpMethod = "GET", notes = "get log list")
public Map djAttrTypeReportSources(Page page, DjAttrTypeReport djAttrTypeReport, Model model,
HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DjAttrTypeReport> attrTypeReportPage = null;
try {
//设置本地默认查询时间
resetTime(djAttrTypeReport);
djReportService.queryConditionCheck(thread, start, djAttrTypeReport, DjPzReport.class, page);
// 查询数据库
attrTypeReportPage = djReportService.findAttrTypeReport(
new Page<DjAttrTypeReport>(request, response, DjAttrTypeReport.class), djAttrTypeReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测性质(带私有标签)实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测性质(带私有标签)实时统计成功",
attrTypeReportPage, activeSys, logSource);
}
@RequestMapping(value = "djSrcIpDomesticPrivServiceReportSources", method = RequestMethod.GET)
@ApiOperation(value = "监测境内源IP(带私有标签)实时统计", httpMethod = "GET", notes = "get log list")
public Map djSrcIpDomesticPrivServiceReportSources(Page page, DjSrcIpDomeSticReport djSrcIpDomeSticReport,
Model model, HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DjSrcIpDomeSticReport> srcIpDomeSticReportPage = null;
try {
//设置本地默认查询时间
resetTime(djSrcIpDomeSticReport);
djReportService.queryConditionCheck(thread, start, djSrcIpDomeSticReport, DjSrcIpDomeSticReport.class,
page);
// 查询数据库
srcIpDomeSticReportPage = djReportService.findSrcIpDomeSticReport(
new Page<DjSrcIpDomeSticReport>(request, response, DjSrcIpDomeSticReport.class),
djSrcIpDomeSticReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测境内源IP(带私有标签)实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测境内源IP(带私有标签)实时统计成功",
srcIpDomeSticReportPage, activeSys, logSource);
}
@RequestMapping(value = "djDestIpCountryPrivServiceReportSources", method = RequestMethod.GET)
@ApiOperation(value = "监测境内目的IP(带私有标签)实时统计", httpMethod = "GET", notes = "get log list")
public Map djDestIpCountryPrivServiceReportSources(Page page, DjDestIpCountryReport djDestIpCountryReport,
Model model, HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DjDestIpCountryReport> djDestIpCountryReportPage = null;
try {
//设置本地默认查询时间
resetTime(djDestIpCountryReport);
djReportService.queryConditionCheck(thread, start, djDestIpCountryReport, DjDestIpCountryReport.class,
page);
// 查询数据库
djDestIpCountryReportPage = djReportService.findDestIpCountryReport(
new Page<DjDestIpCountryReport>(request, response, DjDestIpCountryReport.class),
djDestIpCountryReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测境内目的IP(带私有标签)实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测境内目的IP(带私有标签)实时统计成功",
djDestIpCountryReportPage, activeSys, logSource);
}
@RequestMapping(value = "djEntranceReportSources", method = RequestMethod.GET)
@ApiOperation(value = "监测局点(带私有标签)实时统计", httpMethod = "GET", notes = "get log list")
public Map djEntranceReportSources(Page page, DjEntranceReport djEntranceReport, Model model,
HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DjEntranceReport> djEntranceReportPage = null;
try {
//设置本地默认查询时间
resetTime(djEntranceReport);
djReportService.queryConditionCheck(thread, start, djEntranceReport, DjEntranceReport.class,
page);
// 查询数据库
djEntranceReportPage = djReportService.findDjEntranceReport(
new Page<DjEntranceReport>(request, response, DjEntranceReport.class), djEntranceReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测局点(带私有标签)实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测局点(带私有标签)实时统计成功",
djEntranceReportPage, activeSys, logSource);
}
@RequestMapping(value = "djLwhhReportSources", method = RequestMethod.GET)
@ApiOperation(value = "监测来文函号(带私有标签)实时统计", httpMethod = "GET", notes = "get log list")
public Map djLwhhReportSources(Page page, DjLwhhReport djLwhhReport, Model model, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DjLwhhReport> djLwhhReportPage = null;
try {
//设置本地默认查询时间
resetTime(djLwhhReport);
djReportService.queryConditionCheck(thread, start, djLwhhReport, DjLwhhReport.class, page);
// 查询数据库
djLwhhReportPage = djReportService
.findDjLwhhReport(new Page<DjLwhhReport>(request, response, DjLwhhReport.class), djLwhhReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测来文函号(带私有标签)实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测来文函号(带私有标签)实时统计成功",
djLwhhReportPage, activeSys, logSource);
}
@RequestMapping(value = "djTagPrivServiceReportSources", method = RequestMethod.GET)
@ApiOperation(value = "监测标签(带私有标签)实时统计", httpMethod = "GET", notes = "get log list")
public Map djTagPrivServiceReportSources(Page page, DjTagReport djTagReport, Model model, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
Page<DjTagReport> djTagReportPage = null;
try {
//设置本地默认查询时间
resetTime(djTagReport);
djReportService.queryConditionCheck(thread, start, djTagReport, DjTagReport.class, page);
// 查询数据库
djTagReportPage = djReportService
.findDjTagReportPage(new Page<DjTagReport>(request, response, DjTagReport.class), djTagReport);
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.debug(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(thread, System.currentTimeMillis() - start, "监测标签(带私有标签)实时统计失败");
}
((RestServiceException) e).setLogSource(logSource);
((RestServiceException) e).setActiveSys(activeSys);
throw ((RestServiceException) e);
}
return serviceResponse(thread, System.currentTimeMillis() - start, request, response, "监测标签(带私有标签)实时统计成功",
djTagReportPage, activeSys, logSource);
}
/**
*
* @Title: resetTime
* @Description: (实时统计默认查询本地一个小时的数据)
* @param @param entity
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
public void resetTime(DfReportEntity<?> entity) throws Exception {
Map<String, String> map = DateUtils.getLocalTime(entity.getSearchReportStartTime(),
entity.getSearchReportEndTime(), Constants.REPORT_LOCAL_TIME,"report");
entity.setSearchReportStartTime(map.get("startTime"));
entity.setSearchReportEndTime(map.get("endTime"));
}
}

View File

@@ -1,791 +0,0 @@
/**
* @Title: DjStatLogController.java
* @Package com.nis.web.controller
* @Description: TODO(用一句话描述该文件做什么)
* @author ddm
* @date 2016年9月13日 下午1:22:15
* @version V1.0
*/
package com.nis.web.controller.restful;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.nis.domain.Page;
import com.nis.domain.StatLogEntity;
import com.nis.domain.restful.DjAttrStatLogDaily;
import com.nis.domain.restful.DjAttrStatLogMonth;
import com.nis.domain.restful.DjDestIpCounrtyStatLogDaily;
import com.nis.domain.restful.DjDestIpCounrtyStatLogMonth;
import com.nis.domain.restful.DjEntrStatLogDaily;
import com.nis.domain.restful.DjEntrStatLogMonth;
import com.nis.domain.restful.DjLwhhStatLogDaily;
import com.nis.domain.restful.DjLwhhStatLogMonth;
import com.nis.domain.restful.DjSrcIpDomesticStatLogDaily;
import com.nis.domain.restful.DjSrcIpDomesticStatLogMonth;
import com.nis.domain.restful.DjStatLogDaily;
import com.nis.domain.restful.DjStatLogMonth;
import com.nis.domain.restful.DjTagStatLogDaily;
import com.nis.domain.restful.DjTagStatLogMonth;
import com.nis.restful.RestBusinessCode;
import com.nis.restful.RestServiceException;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.util.JsonMapper;
import com.nis.util.StringUtil;
import com.nis.util.redis.RedisDao;
import com.nis.util.redis.SaveRedisThread;
import com.nis.web.controller.BaseRestController;
import com.nis.web.service.SaveRequestLogThread;
import com.nis.web.service.ServicesRequestLogService;
import com.nis.web.service.restful.DjStatLogService;
import com.wordnik.swagger.annotations.ApiOperation;
/**
* @ClassName: DjStatLogController
* @Description: TODO(这里用一句话描述这个类的作用)
* @author (ddm)
* @date 2016年9月13日 下午1:22:15
* @version V1.0
*/
@RestController
@RequestMapping("${servicePath}/log/v1")
@SuppressWarnings({ "rawtypes", "unchecked" })
public class DjStatLogController extends BaseRestController{
protected final Logger logger = Logger.getLogger(this.getClass());
protected String logSource="0";
protected String activeSys=Constants.ACTIVESYS_ALL;
@Autowired
protected DjStatLogService djStatLogService;
@Autowired
protected RedisDao redisDao;
@Autowired
protected ServicesRequestLogService servicesRequestLogService;
@RequestMapping(value="djStatLogDailySources", method = RequestMethod.GET)
@ApiOperation(value="监测日志配置日报表" , httpMethod = "GET", notes="get log list")
public Map djStatLogDailySources(
Page page,DjStatLogDaily dailyLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DjStatLogDaily> dailyLogPage =null;
try {
resetTime(dailyLog, "daily");
if (!StringUtil.isBlank(dailyLog.getSearchConfigId())) {
Long.parseLong(dailyLog.getSearchConfigId());
}
djStatLogService.queryConditionCheck(thread,start,dailyLog, DjStatLogDaily.class, page);
dailyLogPage = djStatLogService.djStatLogDaily(new Page<DjStatLogDaily>(request, response,DjStatLogDaily.class), dailyLog);
} catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
RestServiceException restE = new RestServiceException(thread, System.currentTimeMillis() - start,
"SearchConfigId参数格式错误", RestBusinessCode.param_formate_error.getValue());
restE.setActiveSys(activeSys);
restE.setLogSource(logSource);
throw restE;
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"监测日志配置日报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "监测日志配置日报表检索成功",dailyLogPage,activeSys,logSource);
}
@RequestMapping(value="djStatLogMonthSources", method = RequestMethod.GET)
@ApiOperation(value="监测日志配置月报表" , httpMethod = "GET", notes="get log list")
public Map djStatLogMonthSources(
Page page,DjStatLogMonth monthLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DjStatLogMonth> monthLogPage =null;
try {
resetTime(monthLog, "month");
if (!StringUtil.isBlank(monthLog.getSearchConfigId())) {
Long.parseLong(monthLog.getSearchConfigId());
}
//查询条件校验
djStatLogService.queryConditionCheck(thread,start,monthLog, DjStatLogMonth.class, page);
monthLogPage = djStatLogService.djStatLogMonth(new Page<DjStatLogMonth>(request, response,DjStatLogMonth.class), monthLog);
}catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
RestServiceException restE = new RestServiceException(thread, System.currentTimeMillis() - start,
"SearchConfigId参数格式错误", RestBusinessCode.param_formate_error.getValue());
restE.setActiveSys(activeSys);
restE.setLogSource(logSource);
throw restE;
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"监测日志配置月报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "监测日志配置月报表检索成功",monthLogPage,activeSys,logSource);
}
/**
* 标签日报表
*
* @Title: djTagStatLogDailySources
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @param page
* @param @param dailyLog
* @param @param request
* @param @param response
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@RequestMapping(value="djTagStatLogDailySources", method = RequestMethod.GET)
@ApiOperation(value="标签监测日志配置日报表" , httpMethod = "GET", notes="get log list")
public Map djTagStatLogDailySources(
Page page,DjTagStatLogDaily dailyLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
//查询条件校验
Page<DjTagStatLogDaily> dailyLogPage =null;
try {
resetTime(dailyLog, "daily");
if (!StringUtil.isBlank(dailyLog.getSearchTag())) {
Integer.parseInt(dailyLog.getSearchTag());
}
djStatLogService.queryConditionCheck(thread,start,dailyLog, DjTagStatLogDaily.class, page);
dailyLogPage = djStatLogService.djTagStatLogDaily(new Page<DjTagStatLogDaily>(request, response,DjTagStatLogDaily.class), dailyLog);
}catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
RestServiceException restE = new RestServiceException(thread, System.currentTimeMillis() - start,
"SearchTag参数格式错误", RestBusinessCode.param_formate_error.getValue());
restE.setActiveSys(activeSys);
restE.setLogSource(logSource);
throw restE;
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"标签监测日志配置日报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "标签监测日志配置日报表检索成功",dailyLogPage,activeSys,logSource);
}
/**
* 标签月报表
*
* @Title: djTagStatLogDailySources
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @param page
* @param @param dailyLog
* @param @param request
* @param @param response
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@RequestMapping(value="djTagStatLogMonthSources", method = RequestMethod.GET)
@ApiOperation(value="标签监测日志配置月报表" , httpMethod = "GET", notes="get log list")
public Map djTagStatLogMonthSources(
Page page,DjTagStatLogMonth monthLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DjTagStatLogMonth> monthLogPage =null;
try {
resetTime(monthLog, "month");
if (!StringUtil.isBlank(monthLog.getSearchTag())) {
Integer.parseInt(monthLog.getSearchTag());
}
//查询条件校验
djStatLogService.queryConditionCheck(thread,start,monthLog, DjTagStatLogMonth.class, page);
monthLogPage = djStatLogService.djTagStatLogMonth(new Page<DjTagStatLogMonth>(request, response,DjTagStatLogMonth.class), monthLog);
}catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
RestServiceException restE = new RestServiceException(thread, System.currentTimeMillis() - start,
"SearchTag参数格式错误", RestBusinessCode.param_formate_error.getValue());
restE.setActiveSys(activeSys);
restE.setLogSource(logSource);
throw restE;
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"标签监测日志配置月报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "标签监测日志配置月报表检索成功",monthLogPage,activeSys,logSource);
}
/**
* @Title: djTagStatLogDailySources
* @Description: (性质日报表)
* @param @param page
* @param @param dailyLog
* @param @param request
* @param @param response
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@RequestMapping(value="djAttrStatLogDailySources", method = RequestMethod.GET)
@ApiOperation(value="性质监测日志配置日报表" , httpMethod = "GET", notes="get log list")
public Map djAttrStatLogDailySources(
Page page,DjAttrStatLogDaily dailyLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DjAttrStatLogDaily> dailyLogPage =null;
try {
resetTime(dailyLog, "daily");
if (!StringUtil.isBlank(dailyLog.getSearchAttrType())) {
Integer.parseInt(dailyLog.getSearchAttrType());
}
djStatLogService.queryConditionCheck(thread,start,dailyLog, DjAttrStatLogDaily.class, page);
dailyLogPage = djStatLogService.djAttrStatLogDaily(new Page<DjAttrStatLogDaily>(request, response,DjAttrStatLogDaily.class), dailyLog);
}catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
RestServiceException restE = new RestServiceException(thread, System.currentTimeMillis() - start,
"SearchAttrType参数格式错误", RestBusinessCode.param_formate_error.getValue());
restE.setActiveSys(activeSys);
restE.setLogSource(logSource);
throw restE;
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"性质监测日志配置日报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "性质监测日志配置日报表检索成功",dailyLogPage,activeSys,logSource);
}
/**
* @Title: djAttrStatLogDailySources
* @Description: (性质月报表)
* @param @param page
* @param @param dailyLog
* @param @param request
* @param @param response
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@RequestMapping(value="djAttrStatLogMonthSources", method = RequestMethod.GET)
@ApiOperation(value="性质监测日志配置月报表" , httpMethod = "GET", notes="get log list")
public Map djAttrStatLogMonthSources(
Page page,DjAttrStatLogMonth monthLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DjAttrStatLogMonth> monthLogPage =null;
try {
resetTime(monthLog, "month");
if (!StringUtil.isBlank(monthLog.getSearchAttrType())) {
Integer.parseInt(monthLog.getSearchAttrType());
}
//查询条件校验
djStatLogService.queryConditionCheck(thread,start,monthLog, DjAttrStatLogMonth.class, page);
monthLogPage = djStatLogService.djAttrStatLogMonth(new Page<DjAttrStatLogMonth>(request, response,DjAttrStatLogMonth.class), monthLog);
}catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
RestServiceException restE = new RestServiceException(thread, System.currentTimeMillis() - start,
"SearchAttrType参数格式错误", RestBusinessCode.param_formate_error.getValue());
restE.setActiveSys(activeSys);
restE.setLogSource(logSource);
throw restE;
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"性质监测日志配置月报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "性质监测日志配置月报表检索成功",monthLogPage,activeSys,logSource);
}
/**
* @Title: djEntrStatLogDailySources
* @Description: (局点日报表)
* @param @param page
* @param @param dailyLog
* @param @param request
* @param @param response
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@RequestMapping(value="djEntrStatLogDailySources", method = RequestMethod.GET)
@ApiOperation(value="局点监测日志配置日报表" , httpMethod = "GET", notes="get log list")
public Map djEntrStatLogDailySources(
Page page,DjEntrStatLogDaily dailyLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DjEntrStatLogDaily> dailyLogPage =null;
try {
resetTime(dailyLog, "daily");
if (!StringUtil.isBlank(dailyLog.getSearchEntranceId())) {
Integer.parseInt(dailyLog.getSearchEntranceId());
}
djStatLogService.queryConditionCheck(thread,start,dailyLog, DjEntrStatLogDaily.class, page);
dailyLogPage = djStatLogService.djEntrStatLogDaily(new Page<DjEntrStatLogDaily>(request, response,DjEntrStatLogDaily.class), dailyLog);
}catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
RestServiceException restE = new RestServiceException(thread, System.currentTimeMillis() - start,
"SearchEntranceId参数格式错误", RestBusinessCode.param_formate_error.getValue());
restE.setActiveSys(activeSys);
restE.setLogSource(logSource);
throw restE;
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"局点监测日志配置日报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "局点监测日志配置日报表检索成功",dailyLogPage,activeSys,logSource);
}
/**
* @Title: djEntrStatLogDailySources
* @Description: (局点月报表)
* @param @param page
* @param @param dailyLog
* @param @param request
* @param @param response
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@RequestMapping(value="djEntrStatLogMonthSources", method = RequestMethod.GET)
@ApiOperation(value="局点监测日志配置月报表" , httpMethod = "GET", notes="get log list")
public Map djEntrStatLogMonthSources(
Page page,DjEntrStatLogMonth monthLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DjEntrStatLogMonth> monthLogPage =null;
try {
resetTime(monthLog, "month");
if (!StringUtil.isBlank(monthLog.getSearchEntranceId())) {
Integer.parseInt(monthLog.getSearchEntranceId());
}
//查询条件校验
djStatLogService.queryConditionCheck(thread,start,monthLog, DjEntrStatLogMonth.class, page);
monthLogPage = djStatLogService.djEntrStatLogMonth(new Page<DjEntrStatLogMonth>(request, response,DjEntrStatLogMonth.class), monthLog);
}catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
RestServiceException restE = new RestServiceException(thread, System.currentTimeMillis() - start,
"SearchEntranceId参数格式错误", RestBusinessCode.param_formate_error.getValue());
restE.setActiveSys(activeSys);
restE.setLogSource(logSource);
throw restE;
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"局点监测日志配置月报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "局点监测日志配置月报表检索成功",monthLogPage,activeSys,logSource);
}
/**
* @Title: djLwhhStatLogDailySources
* @Description: (局点日报表)
* @param @param page
* @param @param dailyLog
* @param @param request
* @param @param response
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@RequestMapping(value="djLwhhStatLogDailySources", method = RequestMethod.GET)
@ApiOperation(value="来文函号监测日志配置日报表" , httpMethod = "GET", notes="get log list")
public Map djLwhhStatLogDailySources(
Page page,DjLwhhStatLogDaily dailyLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
//查询条件校验
Page<DjLwhhStatLogDaily> dailyLogPage =null;
try {
resetTime(dailyLog, "daily");
if (!StringUtil.isBlank(dailyLog.getSearchLwhh())) {
Integer.parseInt(dailyLog.getSearchLwhh());
}
djStatLogService.queryConditionCheck(thread,start,dailyLog, DjLwhhStatLogDaily.class, page);
dailyLogPage = djStatLogService.djLwhhStatLogDaily(new Page<DjLwhhStatLogDaily>(request, response,DjLwhhStatLogDaily.class), dailyLog);
}catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
RestServiceException restE = new RestServiceException(thread, System.currentTimeMillis() - start,
"SearchLwhh参数格式错误", RestBusinessCode.param_formate_error.getValue());
restE.setActiveSys(activeSys);
restE.setLogSource(logSource);
throw restE;
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"来文函号监测日志配置日报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "来文函号监测日志配置日报表检索成功",dailyLogPage,activeSys,logSource);
}
/**
* @Title: djLwhhStatLogDailySources
* @Description: (局点月报表)
* @param @param page
* @param @param dailyLog
* @param @param request
* @param @param response
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@RequestMapping(value="djLwhhStatLogMonthSources", method = RequestMethod.GET)
@ApiOperation(value="来文函号监测日志配置月报表" , httpMethod = "GET", notes="get log list")
public Map djLwhhStatLogMonthSources(
Page page,DjLwhhStatLogMonth monthLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DjLwhhStatLogMonth> monthLogPage =null;
try {
resetTime(monthLog, "month");
if (!StringUtil.isBlank(monthLog.getSearchLwhh())) {
Integer.parseInt(monthLog.getSearchLwhh());
}
//查询条件校验
djStatLogService.queryConditionCheck(thread,start,monthLog, DjLwhhStatLogMonth.class, page);
monthLogPage = djStatLogService.djLwhhStatLogMonth(new Page<DjLwhhStatLogMonth>(request, response,DjLwhhStatLogMonth.class), monthLog);
}catch (NumberFormatException e) {
thread.setExceptionInfo(e.getMessage() + " " + e.getCause());
e.printStackTrace();
logger.error(e);
RestServiceException restE = new RestServiceException(thread, System.currentTimeMillis() - start,
"SearchLwhh参数格式错误", RestBusinessCode.param_formate_error.getValue());
restE.setActiveSys(activeSys);
restE.setLogSource(logSource);
throw restE;
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"来文函号监测日志配置月报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "来文函号监测日志配置月报表检索成功",monthLogPage,activeSys,logSource);
}
/**
* 境内源IP日报表
*
* @Title: djSrcIpDomesticStatLogDailySources
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @param page
* @param @param dailyLog
* @param @param request
* @param @param response
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@RequestMapping(value="djSrcIpDomesticStatLogDailySources", method = RequestMethod.GET)
@ApiOperation(value="境内源IP监测日志配置日报表" , httpMethod = "GET", notes="get log list")
public Map djSrcIpDomesticStatLogDailySources(
Page page,DjSrcIpDomesticStatLogDaily dailyLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DjSrcIpDomesticStatLogDaily> dailyLogPage =null;
try {
resetTime(dailyLog, "daily");
djStatLogService.queryConditionCheck(thread,start,dailyLog, DjSrcIpDomesticStatLogDaily.class, page);
dailyLogPage = djStatLogService.djSrcIpDomesticStatLogDaily(new Page<DjSrcIpDomesticStatLogDaily>(request, response,DjSrcIpDomesticStatLogDaily.class), dailyLog);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"境内源IP监测日志配置日报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "境内源IP监测日志配置日报表检索成功",dailyLogPage,activeSys,logSource);
}
/**
* 境内源IP月报表
*
* @Title: djSrcIpDomesticStatLogMonthSources
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @param page
* @param @param dailyLog
* @param @param request
* @param @param response
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@RequestMapping(value="djSrcIpDomesticStatLogMonthSources", method = RequestMethod.GET)
@ApiOperation(value="境内源IP监测日志配置月报表" , httpMethod = "GET", notes="get log list")
public Map djSrcIpDomesticStatLogMonthSources(
Page page,DjSrcIpDomesticStatLogMonth monthLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DjSrcIpDomesticStatLogMonth> monthLogPage =null;
try {
resetTime(monthLog, "month");
//查询条件校验
djStatLogService.queryConditionCheck(thread,start,monthLog, DjSrcIpDomesticStatLogMonth.class, page);
monthLogPage = djStatLogService.djSrcIpDomesticStatLogMonth(new Page<DjSrcIpDomesticStatLogMonth>(request, response,DjSrcIpDomesticStatLogMonth.class), monthLog);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"境内源IP监测日志配置月报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "境内源IP监测日志配置月报表检索成功",monthLogPage,activeSys,logSource);
}
/**
* 国家目的IP日报表
*
* @Title: djDestIpCounrtyStatLogDailySources
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @param page
* @param @param dailyLog
* @param @param request
* @param @param response
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@RequestMapping(value="djDestIpCountryStatLogDailySources", method = RequestMethod.GET)
@ApiOperation(value="国家目的IP监测日志配置日报表" , httpMethod = "GET", notes="get log list")
public Map djDestIpCounrtyStatLogDailySources(
Page page,DjDestIpCounrtyStatLogDaily dailyLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DjDestIpCounrtyStatLogDaily> dailyLogPage =null;
try {
resetTime(dailyLog, "daily");
djStatLogService.queryConditionCheck(thread,start,dailyLog, DjDestIpCounrtyStatLogDaily.class, page);
dailyLogPage = djStatLogService.djDestIpCounrtyStatLogDaily(new Page<DjDestIpCounrtyStatLogDaily>(request, response,DjDestIpCounrtyStatLogDaily.class), dailyLog);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"国家目的IP监测日志配置日报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "国家目的IP监测日志配置日报表检索成功",dailyLogPage,activeSys,logSource);
}
/**
* 国家目的IP月报表
*
* @Title: djDestIpCounrtyStatLogMonthSources
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @param page
* @param @param dailyLog
* @param @param request
* @param @param response
* @param @return
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
@RequestMapping(value="djDestIpCountryStatLogMonthSources", method = RequestMethod.GET)
@ApiOperation(value="国家目的IP监测日志配置月报表" , httpMethod = "GET", notes="get log list")
public Map djDestIpCounrtyStatLogMonthSources(
Page page,DjDestIpCounrtyStatLogMonth monthLog, HttpServletRequest request, HttpServletResponse response) {
long start=System.currentTimeMillis();
SaveRequestLogThread thread=super.saveRequestLog(servicesRequestLogService,Constants.OPACTION_GET,request, null);
Page<DjDestIpCounrtyStatLogMonth> monthLogPage =null;
try {
resetTime(monthLog, "month");
//查询条件校验
djStatLogService.queryConditionCheck(thread,start,monthLog, DjDestIpCounrtyStatLogMonth.class, page);
monthLogPage = djStatLogService.djDestIpCounrtyStatLogMonth(new Page<DjDestIpCounrtyStatLogMonth>(request, response,DjDestIpCounrtyStatLogMonth.class), monthLog);
}catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
if(!(e instanceof RestServiceException)){
e=new RestServiceException(thread,System.currentTimeMillis()-start,"国家目的IP监测日志配置月报表检索失败");
}
((RestServiceException) e).setActiveSys(activeSys);
((RestServiceException) e).setLogSource(logSource);
throw ((RestServiceException) e);
}
return serviceResponse(thread,System.currentTimeMillis()-start,request, response, "国家目的IP监测日志配置月报表检索成功",monthLogPage,activeSys,logSource);
}
/**
*
* @Title: resetTime
* @Description: (日报表默认查询本地前一天的数据)
* @param @param entity
* @return Map 返回类型
* @author DDM
* @version V1.0
*/
public void resetTime(StatLogEntity<?> entity,String type) throws Exception{
Map<String, String> map = DateUtils.getLocalTime(entity.getSearchStatStartTime(),
entity.getSearchStatEndTime(), Constants.REPORT_LOCAL_TIME,type);
entity.setSearchStatStartTime(map.get("startTime"));
entity.setSearchStatEndTime(map.get("endTime"));
}
}

View File

@@ -1,109 +0,0 @@
package com.nis.web.controller.restful;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.datanucleus.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.nis.domain.Page;
import com.nis.domain.restful.DfDjNestLog;
import com.nis.restful.RestServiceException;
import com.nis.util.Constants;
import com.nis.util.JsonMapper;
import com.nis.util.redis.RedisDao;
import com.nis.util.redis.SaveRedisThread;
import com.nis.web.controller.BaseRestController;
import com.nis.web.service.SaveRequestLogThread;
import com.nis.web.service.ServicesRequestLogService;
import com.nis.web.service.restful.DfDjNestLogService;
import com.wordnik.swagger.annotations.ApiOperation;
/**
*
* @ClassName: dfDjNestLogController
* @Description: 嵌套日志查询服务
* @author (zbc)
* @date 2016年11月11日 下午4:40:00
* @version V1.0
*/
@RestController
@RequestMapping("${servicePath}/log/v1")
@SuppressWarnings({ "rawtypes", "unchecked" })
public class dfDjNestLogController extends BaseRestController {
protected final Logger logger = Logger.getLogger(this.getClass());
@Autowired
protected DfDjNestLogService dfDjNestLogService;
@Autowired
protected RedisDao redisDao;
@Autowired
protected ServicesRequestLogService servicesRequestLogService;
protected String logSource = "0";
@RequestMapping(value = "/dfDjNestLogs", method = RequestMethod.GET)
@ApiOperation(value = "嵌套日志分页获取", httpMethod = "GET", notes = "get log list")
public Map dfDjNestLogList(
@RequestParam(value = "searchActiveSys", required = false, defaultValue = Constants.ACTIVESYS_B) String searchActiveSys,
@RequestParam(value = "searchLayerId", required = true) String searchLayerId,
Page page, DfDjNestLog dfDjNestLog, HttpServletRequest request, HttpServletResponse response) {
if(!Constants.ACTIVESYS_A.equals(searchActiveSys) && !Constants.ACTIVESYS_C.equals(searchActiveSys))searchActiveSys=Constants.ACTIVESYS_B;
if(StringUtils.notEmpty(searchLayerId)) {
dfDjNestLog.setSearchLayerId(searchLayerId);
}
long start = System.currentTimeMillis();
SaveRequestLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null);
boolean keyExists = false;
String key = "";
Page<DfDjNestLog> dfDjNestLogPage = null;
try {
// 请求参数校验
dfDjNestLogService.queryConditionCheck(thread, start, dfDjNestLog, DfDjNestLog.class, page);
if (Constants.IS_OPEN_REDIS) {
// 根据查询条件获取key
key = dfDjNestLogService.getJedisKey(request, true);
// 判断key是否存在
keyExists = redisDao.exists(key);
}
// 存在则直接从redis中查询
if (keyExists) {
dfDjNestLogPage = (Page<DfDjNestLog>) JsonMapper.fromJsonString(redisDao.getString(key), Page.class);
} else {
// 不存在则查询数据库并保存查询结果到redis中
dfDjNestLogPage = dfDjNestLogService
.findDfDjNestLogPage(new Page<DfDjNestLog>(request, response, DfDjNestLog.class), dfDjNestLog);
if (Constants.IS_OPEN_REDIS)
new SaveRedisThread(key, dfDjNestLogPage, Constants.ORACLE_EXPIRE).start();
}
} catch (Exception e) {
thread.setExceptionInfo(e.getMessage()+" "+e.getCause());
e.printStackTrace();
logger.error(e);
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, "嵌套日志检索成功",
dfDjNestLogPage, searchActiveSys, logSource);
}
}