重点保障事件、事件封堵、事件监测接口支持:多选专项taskId、统计时间范围、专项上报时间范围查询
This commit is contained in:
@@ -6,10 +6,8 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.nis.util.JsonDateSerializer;
|
||||
import com.wordnik.swagger.annotations.ApiModel;
|
||||
import com.wordnik.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.commons.httpclient.util.DateUtil;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author GouGe
|
||||
@@ -21,7 +19,7 @@ public class EventKeyProtection {
|
||||
@JsonInclude(value = JsonInclude.Include.NON_NULL)
|
||||
@ApiModelProperty(value = "审核时间")
|
||||
private Date taskTime;
|
||||
|
||||
|
||||
@JsonInclude(value = JsonInclude.Include.NON_NULL)
|
||||
@ApiModelProperty(value = "统计时间")
|
||||
private Date reportTime;
|
||||
@@ -29,10 +27,10 @@ public class EventKeyProtection {
|
||||
@JsonInclude(value = JsonInclude.Include.NON_NULL)
|
||||
@ApiModelProperty(value = "事件名称")
|
||||
private String taskName;
|
||||
|
||||
|
||||
@JsonInclude(value = JsonInclude.Include.NON_NULL)
|
||||
@ApiModelProperty(value = "事件ID")
|
||||
private long taskId;
|
||||
private String taskIds;
|
||||
|
||||
@JsonInclude(value = JsonInclude.Include.NON_NULL)
|
||||
@ApiModelProperty(value = "来函件数")
|
||||
@@ -54,7 +52,16 @@ public class EventKeyProtection {
|
||||
private String searchReportEndTime;
|
||||
private String searchTaskStartTime;
|
||||
private String searchTaskEndTime;
|
||||
private List<Long> taskIdList;
|
||||
|
||||
@JsonIgnore
|
||||
public List<Long> getTaskIdList() {
|
||||
return taskIdList;
|
||||
}
|
||||
|
||||
public void setTaskIdList(List<Long> taskIdList) {
|
||||
this.taskIdList = taskIdList;
|
||||
}
|
||||
|
||||
@JsonSerialize(using = JsonDateSerializer.class)
|
||||
public Date getTaskTime() {
|
||||
@@ -141,28 +148,35 @@ public class EventKeyProtection {
|
||||
this.searchTaskEndTime = searchTaskEndTime;
|
||||
}
|
||||
|
||||
public long getTaskId() {
|
||||
return taskId;
|
||||
public String getTaskIds() {
|
||||
return taskIds;
|
||||
}
|
||||
|
||||
public void setTaskId(long taskId) {
|
||||
this.taskId = taskId;
|
||||
public void setTaskIds(String taskIds) {
|
||||
this.taskIds = taskIds;
|
||||
}
|
||||
|
||||
|
||||
@JsonSerialize(using = JsonDateSerializer.class)
|
||||
public Date getReportTime() {
|
||||
return reportTime;
|
||||
}
|
||||
return reportTime;
|
||||
}
|
||||
|
||||
public void setReportTime(Date reportTime) {
|
||||
this.reportTime = reportTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EventKeyProtection [taskTime=" + taskTime + ", reportTime=" + reportTime + ", taskName=" + taskName
|
||||
+ ", taskId=" + taskId + ", letterNum=" + letterNum + ", configNum=" + configNum + ", monitorNum="
|
||||
+ monitorNum + ", controlNum=" + controlNum + "]";
|
||||
}
|
||||
public void setReportTime(Date reportTime) {
|
||||
this.reportTime = reportTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EventKeyProtection{" +
|
||||
"taskTime=" + taskTime +
|
||||
", reportTime=" + reportTime +
|
||||
", taskName='" + taskName + '\'' +
|
||||
", taskIds='" + taskIds + '\'' +
|
||||
", letterNum=" + letterNum +
|
||||
", configNum=" + configNum +
|
||||
", monitorNum=" + monitorNum +
|
||||
", controlNum=" + controlNum +
|
||||
", taskIdList=" + taskIdList +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.nis.domain.restful;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.httpclient.util.DateUtil;
|
||||
|
||||
@@ -27,7 +28,7 @@ public class EventMonitorOrBlock {
|
||||
private String taskName;
|
||||
@JsonInclude(value = JsonInclude.Include.NON_NULL)
|
||||
@ApiModelProperty(value = "事件ID")
|
||||
private long taskId;
|
||||
private String taskIds;
|
||||
@JsonInclude(value = JsonInclude.Include.NON_NULL)
|
||||
@ApiModelProperty(value = "ip数量")
|
||||
private long ipNum;
|
||||
@@ -49,7 +50,16 @@ public class EventMonitorOrBlock {
|
||||
private String searchTaskStartTime;
|
||||
private String searchTaskEndTime;
|
||||
private int reportType;
|
||||
private List<Long> taskIdList;
|
||||
|
||||
@JsonIgnore
|
||||
public List<Long> getTaskIdList() {
|
||||
return taskIdList;
|
||||
}
|
||||
|
||||
public void setTaskIdList(List<Long> taskIdList) {
|
||||
this.taskIdList = taskIdList;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public int getReportType() {
|
||||
@@ -59,7 +69,7 @@ public class EventMonitorOrBlock {
|
||||
public void setReportType(int reportType) {
|
||||
this.reportType = reportType;
|
||||
}
|
||||
|
||||
|
||||
@JsonSerialize(using = JsonDateSerializer.class)
|
||||
public Date getTaskTime() {
|
||||
return taskTime;
|
||||
@@ -153,27 +163,37 @@ public class EventMonitorOrBlock {
|
||||
this.searchTaskEndTime = searchTaskEndTime;
|
||||
}
|
||||
|
||||
public long getTaskId() {
|
||||
return taskId;
|
||||
public String getTaskIds() {
|
||||
return taskIds;
|
||||
}
|
||||
|
||||
public void setTaskId(long taskId) {
|
||||
this.taskId = taskId;
|
||||
public void setTaskIds(String taskIds) {
|
||||
this.taskIds = taskIds;
|
||||
}
|
||||
|
||||
@JsonSerialize(using = JsonDateSerializer.class)
|
||||
public Date getReportTime() {
|
||||
return reportTime;
|
||||
}
|
||||
public Date getReportTime() {
|
||||
return reportTime;
|
||||
}
|
||||
|
||||
public void setReportTime(Date reportTime) {
|
||||
this.reportTime = reportTime;
|
||||
}
|
||||
public void setReportTime(Date reportTime) {
|
||||
this.reportTime = reportTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EventMonitorOrBlock [taskTime=" + taskTime + ", reportTime=" + reportTime + ", taskName=" + taskName
|
||||
+ ", taskId=" + taskId + ", ipNum=" + ipNum + ", httpNum=" + httpNum + ", mailNum=" + mailNum
|
||||
+ ", vedioNum=" + vedioNum + ", agentNum=" + agentNum + "]";
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EventMonitorOrBlock{" +
|
||||
"taskTime=" + taskTime +
|
||||
", reportTime=" + reportTime +
|
||||
", taskName='" + taskName + '\'' +
|
||||
", taskIds='" + taskIds + '\'' +
|
||||
", ipNum=" + ipNum +
|
||||
", httpNum=" + httpNum +
|
||||
", mailNum=" + mailNum +
|
||||
", vedioNum=" + vedioNum +
|
||||
", agentNum=" + agentNum +
|
||||
", reportType=" + reportType +
|
||||
", taskIdList=" + taskIdList +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
|
||||
SELECT task_time as taskTime,
|
||||
report_time as reportTime,
|
||||
task_id as taskId,
|
||||
task_id as taskIds,
|
||||
task_name as taskName,
|
||||
letter_num as letterNum,
|
||||
config_num as configNum,
|
||||
monitor_num as monitorTime,
|
||||
control_num as controlerNum
|
||||
monitor_num as monitorNum,
|
||||
control_num as controlNum
|
||||
FROM ntc_major_task_report
|
||||
<where>
|
||||
<if test="searchReportStartTime != null and searchReportStartTime !=''">
|
||||
@@ -26,20 +26,23 @@
|
||||
<if test="searchTaskEndTime != null and searchTaskEndTime !=''">
|
||||
<![CDATA[AND task_time < #{searchTaskEndTime}]]>
|
||||
</if>
|
||||
<if test="taskId != null and taskId !='' and taskId != 0">
|
||||
AND task_id = #{taskId}
|
||||
<if test="taskIdList != null and taskIdList.size() > 0">
|
||||
and task_id in
|
||||
<foreach item="item" index="index" collection="taskIdList" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="taskName != null and taskName !=''">
|
||||
AND task_name like concat(concat('%',#{taskName}),'%')
|
||||
</if>
|
||||
</where>
|
||||
order by taskId asc;
|
||||
order by reportTime desc;
|
||||
</select>
|
||||
<select id="getEventsMonitorOrBlock" resultType="com.nis.domain.restful.EventMonitorOrBlock"
|
||||
useCache="false" flushCache="true">
|
||||
SELECT task_time as taskTime,
|
||||
report_time as reportTime,
|
||||
task_id as taskId,
|
||||
report_time as reportTime,
|
||||
task_id as taskIds,
|
||||
task_name as taskName,
|
||||
ip_num as ipNum,
|
||||
http_num as httpNum,
|
||||
@@ -60,8 +63,11 @@
|
||||
<if test="searchTaskEndTime != null and searchTaskEndTime !=''">
|
||||
<![CDATA[AND task_time < #{searchTaskEndTime}]]>
|
||||
</if>
|
||||
<if test="taskId != null and taskId !='' and taskId != 0">
|
||||
AND task_id = #{taskId}
|
||||
<if test="taskIdList != null and taskIdList.size() > 0">
|
||||
and task_id in
|
||||
<foreach item="item" index="index" collection="taskIdList" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="reportType != null and reportType !=''">
|
||||
AND report_type = #{reportType}
|
||||
@@ -70,6 +76,6 @@
|
||||
AND task_name like concat(concat('%',#{taskName}),'%')
|
||||
</if>
|
||||
</where>
|
||||
order by taskId asc;
|
||||
order by reportTime desc;
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -13,7 +13,7 @@ import org.apache.log4j.Logger;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -43,35 +43,45 @@ public class EventService {
|
||||
String searchTaskStartTime = eventKeyProtection.getSearchTaskStartTime();
|
||||
String searchTaskEndTime = eventKeyProtection.getSearchTaskEndTime();
|
||||
String taskName = eventKeyProtection.getTaskName();
|
||||
long taskId = eventKeyProtection.getTaskId();
|
||||
int countParamEmpty = 0;
|
||||
try{
|
||||
logger.info("开始获取重点保障事件信息,参数为{"
|
||||
+ ((null == searchReportStartTime && !"".equals(searchReportStartTime)) ? "无"+countParamEmpty++ : format.parse(searchReportStartTime))
|
||||
+ "},{"
|
||||
+ ((null == searchReportEndTime && !"".equals(searchReportEndTime)) ? "无"+countParamEmpty++ : format.parse(searchReportEndTime))
|
||||
+ "},{"
|
||||
+ ((null == searchTaskStartTime && !"".equals(searchTaskStartTime)) ? "无"+countParamEmpty++ : format.parse(searchTaskStartTime))
|
||||
+ "},{"
|
||||
+ ((null == searchTaskEndTime && !"".equals(searchTaskEndTime)) ? "无"+countParamEmpty++ : format.parse(searchTaskEndTime))
|
||||
+ "},{"
|
||||
+ ((null == taskName && !"".equals(taskName)) ? "无"+countParamEmpty++ : taskName)
|
||||
+ "},{"
|
||||
+ ((null == String.valueOf(taskId) && !"".equals(String.valueOf(taskId))) ? "无"+countParamEmpty++ : (long)taskId));
|
||||
}catch(Exception ex){
|
||||
logger.error("时间参数处理转换异常,{}", ex);
|
||||
String rangeOfday = CalendarUtils.getRangeOfday(DateUtils.getDateTime());
|
||||
String startTemp = CalendarUtils.getRangeNhourOfTime(rangeOfday, -24*30);
|
||||
eventKeyProtection = new EventKeyProtection();
|
||||
eventKeyProtection.setSearchReportStartTime(startTemp);
|
||||
logger.info("获取重点保障事件API请求参数转换异常,默认查询起始时间"+startTemp+"至今数据");
|
||||
String taskIds = eventKeyProtection.getTaskIds();
|
||||
List<Long> longList = new ArrayList<>();
|
||||
if (taskIds != null) {
|
||||
String[] strarr = taskIds.split(",");
|
||||
List<String> strings = Arrays.asList(strarr);
|
||||
for (String str : strings) {
|
||||
Long i = Long.parseLong(str);
|
||||
longList.add(i);
|
||||
}
|
||||
}
|
||||
if(countParamEmpty == 5){
|
||||
String rangeOfday = CalendarUtils.getRangeOfday(DateUtils.getDateTime());
|
||||
String startTemp = CalendarUtils.getRangeNhourOfTime(rangeOfday, -24*30);
|
||||
eventKeyProtection.setTaskIdList(longList);
|
||||
int countParamEmpty = 0;
|
||||
try {
|
||||
logger.info("开始获取重点保障事件信息,参数为{"
|
||||
+ ((null == searchReportStartTime && !"".equals(searchReportStartTime)) ? "无" + countParamEmpty++ : format.parse(searchReportStartTime))
|
||||
+ "},{"
|
||||
+ ((null == searchReportEndTime && !"".equals(searchReportEndTime)) ? "无" + countParamEmpty++ : format.parse(searchReportEndTime))
|
||||
+ "},{"
|
||||
+ ((null == searchTaskStartTime && !"".equals(searchTaskStartTime)) ? "无" + countParamEmpty++ : format.parse(searchTaskStartTime))
|
||||
+ "},{"
|
||||
+ ((null == searchTaskEndTime && !"".equals(searchTaskEndTime)) ? "无" + countParamEmpty++ : format.parse(searchTaskEndTime))
|
||||
+ "},{"
|
||||
+ ((null == taskName && !"".equals(taskName)) ? "无" + countParamEmpty++ : taskName)
|
||||
+ "},{"
|
||||
+ ((null == taskIds && !"".equals(taskIds)) ? "无" + countParamEmpty++ : taskIds) + "}");
|
||||
} catch (Exception ex) {
|
||||
logger.error("时间参数处理转换异常,{}", ex);
|
||||
String rangeOfday = CalendarUtils.getRangeOfday(DateUtils.getDateTime());
|
||||
String startTemp = CalendarUtils.getRangeNhourOfTime(rangeOfday, -24 * 30);
|
||||
eventKeyProtection = new EventKeyProtection();
|
||||
eventKeyProtection.setSearchReportStartTime(startTemp);
|
||||
logger.info("获取重点保障事件API请求参数为空,默认查询起始时间"+startTemp+"至今数据");
|
||||
logger.info("获取重点保障事件API请求参数转换异常,默认查询起始时间" + startTemp + "至今数据");
|
||||
}
|
||||
if (countParamEmpty == 6) {
|
||||
String rangeOfday = CalendarUtils.getRangeOfday(DateUtils.getDateTime());
|
||||
String startTemp = CalendarUtils.getRangeNhourOfTime(rangeOfday, -24 * 30);
|
||||
eventKeyProtection = new EventKeyProtection();
|
||||
eventKeyProtection.setSearchReportStartTime(startTemp);
|
||||
logger.info("获取重点保障事件API请求参数为空,默认查询起始时间" + startTemp + "至今数据");
|
||||
}
|
||||
try {
|
||||
list = eventServiceDao.getEventsKeyProtection(eventKeyProtection);
|
||||
@@ -88,7 +98,7 @@ public class EventService {
|
||||
* @param eventMonitorOrBlock
|
||||
* @return
|
||||
*/
|
||||
public Page<EventMonitorOrBlock> getEventsMonitorOrBlock(EventMonitorOrBlock eventMonitorOrBlock,String logMark) {
|
||||
public Page<EventMonitorOrBlock> getEventsMonitorOrBlock(EventMonitorOrBlock eventMonitorOrBlock, String logMark) {
|
||||
List<EventMonitorOrBlock> list = new ArrayList();
|
||||
Page<EventMonitorOrBlock> page = new Page<>();
|
||||
String searchReportStartTime = eventMonitorOrBlock.getSearchReportStartTime();
|
||||
@@ -96,47 +106,57 @@ public class EventService {
|
||||
String searchTaskStartTime = eventMonitorOrBlock.getSearchTaskStartTime();
|
||||
String searchTaskEndTime = eventMonitorOrBlock.getSearchTaskEndTime();
|
||||
String taskName = eventMonitorOrBlock.getTaskName();
|
||||
long taskId = eventMonitorOrBlock.getTaskId();
|
||||
String taskIds = eventMonitorOrBlock.getTaskIds();
|
||||
List<Long> longList = new ArrayList<>();
|
||||
if (taskIds != null) {
|
||||
String[] strarr = taskIds.split(",");
|
||||
List<String> strings = Arrays.asList(strarr);
|
||||
for (String str : strings) {
|
||||
Long i = Long.parseLong(str);
|
||||
longList.add(i);
|
||||
}
|
||||
}
|
||||
eventMonitorOrBlock.setTaskIdList(longList);
|
||||
int countParamEmpty = 0;
|
||||
if (taskName != null) {
|
||||
eventMonitorOrBlock.setTaskName(taskName.trim());
|
||||
}
|
||||
try{
|
||||
logger.info("开始获取"+logMark+",参数为{"
|
||||
+ ((null == searchReportStartTime && !"".equals(searchReportStartTime)) ? "无"+countParamEmpty++ : format.parse(searchReportStartTime))
|
||||
+ "},{"
|
||||
+ ((null == searchReportEndTime && !"".equals(searchReportEndTime)) ? "无"+countParamEmpty++ : format.parse(searchReportEndTime))
|
||||
+ "},{"
|
||||
+ ((null == searchTaskStartTime && !"".equals(searchTaskStartTime)) ? "无"+countParamEmpty++ : format.parse(searchTaskStartTime))
|
||||
+ "},{"
|
||||
+ ((null == searchTaskEndTime && !"".equals(searchTaskEndTime)) ? "无"+countParamEmpty++ : format.parse(searchTaskEndTime))
|
||||
+ "},{"
|
||||
+ ((null == taskName && !"".equals(taskName)) ? "无"+countParamEmpty++ : taskName)
|
||||
+ "},{"
|
||||
+ ((null == String.valueOf(taskId) && !"".equals(String.valueOf(taskId))) ? "无"+countParamEmpty++ : (long)taskId));
|
||||
}catch(Exception ex){
|
||||
logger.error("时间参数处理转换异常,{}", ex);
|
||||
String rangeNhourOfTime = CalendarUtils.getRangeOfhour(DateUtils.getDateTime());
|
||||
String startTemp = CalendarUtils.getRangeNhourOfTime(rangeNhourOfTime, -24);
|
||||
int typeId = eventMonitorOrBlock.getReportType();
|
||||
eventMonitorOrBlock = new EventMonitorOrBlock();
|
||||
eventMonitorOrBlock.setSearchReportStartTime(startTemp);
|
||||
eventMonitorOrBlock.setReportType(typeId);
|
||||
logger.info("获取"+logMark+"API请求参数转换异常,默认查询起始时间"+startTemp+"到现在的数据");
|
||||
try {
|
||||
logger.info("开始获取" + logMark + ",参数为{"
|
||||
+ ((null == searchReportStartTime && !"".equals(searchReportStartTime)) ? "无" + countParamEmpty++ : format.parse(searchReportStartTime))
|
||||
+ "},{"
|
||||
+ ((null == searchReportEndTime && !"".equals(searchReportEndTime)) ? "无" + countParamEmpty++ : format.parse(searchReportEndTime))
|
||||
+ "},{"
|
||||
+ ((null == searchTaskStartTime && !"".equals(searchTaskStartTime)) ? "无" + countParamEmpty++ : format.parse(searchTaskStartTime))
|
||||
+ "},{"
|
||||
+ ((null == searchTaskEndTime && !"".equals(searchTaskEndTime)) ? "无" + countParamEmpty++ : format.parse(searchTaskEndTime))
|
||||
+ "},{"
|
||||
+ ((null == taskName && !"".equals(taskName)) ? "无" + countParamEmpty++ : taskName)
|
||||
+ "},{"
|
||||
+ ((null == taskIds && !"".equals(taskIds)) ? "无" + countParamEmpty++ : taskIds)+ "}");
|
||||
} catch (Exception ex) {
|
||||
logger.error("时间参数处理转换异常", ex);
|
||||
String rangeNhourOfTime = CalendarUtils.getRangeOfhour(DateUtils.getDateTime());
|
||||
String startTemp = CalendarUtils.getRangeNhourOfTime(rangeNhourOfTime, -24);
|
||||
int typeId = eventMonitorOrBlock.getReportType();
|
||||
eventMonitorOrBlock = new EventMonitorOrBlock();
|
||||
eventMonitorOrBlock.setSearchReportStartTime(startTemp);
|
||||
eventMonitorOrBlock.setReportType(typeId);
|
||||
logger.info("获取" + logMark + "API请求参数转换异常,默认查询起始时间" + startTemp + "到现在的数据");
|
||||
}
|
||||
if(countParamEmpty==5){
|
||||
String rangeNhourOfTime = CalendarUtils.getRangeOfhour(DateUtils.getDateTime());
|
||||
String startTemp = CalendarUtils.getRangeNhourOfTime(rangeNhourOfTime, -24);
|
||||
int typeId = eventMonitorOrBlock.getReportType();
|
||||
eventMonitorOrBlock = new EventMonitorOrBlock();
|
||||
eventMonitorOrBlock.setSearchReportStartTime(startTemp);
|
||||
eventMonitorOrBlock.setReportType(typeId);
|
||||
logger.info("获取"+logMark+"API请求参数为空,默认查询起始时间"+startTemp+"到现在的数据");
|
||||
if (countParamEmpty == 6) {
|
||||
String rangeNhourOfTime = CalendarUtils.getRangeOfhour(DateUtils.getDateTime());
|
||||
String startTemp = CalendarUtils.getRangeNhourOfTime(rangeNhourOfTime, -24);
|
||||
int typeId = eventMonitorOrBlock.getReportType();
|
||||
eventMonitorOrBlock = new EventMonitorOrBlock();
|
||||
eventMonitorOrBlock.setSearchReportStartTime(startTemp);
|
||||
eventMonitorOrBlock.setReportType(typeId);
|
||||
logger.info("获取" + logMark + "API请求参数为空,默认查询起始时间" + startTemp + "到现在的数据");
|
||||
}
|
||||
try {
|
||||
list = eventServiceDao.getEventsMonitorOrBlock(eventMonitorOrBlock);
|
||||
} catch (Exception ex) {
|
||||
logger.error(logMark+"查询异常,{}", ex);
|
||||
logger.error(logMark + "查询异常", ex);
|
||||
}
|
||||
page.setList(list);
|
||||
return page;
|
||||
|
||||
Reference in New Issue
Block a user