1.Traffic Statistic页面和Protocol Statistic页面添加direction查询条件

2.原始邮件日志查询所有动作时添加多个service查询条件
This commit is contained in:
shangguanyanfei
2019-01-21 14:49:55 +08:00
parent 8b972c6126
commit 53c8f2279b
9 changed files with 44 additions and 33 deletions

View File

@@ -218,19 +218,20 @@ public class DashboardServiceController extends BaseRestController {
*/
@RequestMapping(value = "trafficBandwidthTransThree", method = RequestMethod.GET)
@ApiOperation(value = "带宽根据ip46,协议tcp,udp查询详情", httpMethod = "GET", notes = "对应带宽根据IPv4,6,协议tcp,udp统计数据显示")
public Map<String,?> trafficBandwidthTransThree(String beginDate,String endDate,String searchQuotaType,Model model, HttpServletRequest request, HttpServletResponse response) {
public Map<String,?> trafficBandwidthTransThree(String beginDate,String endDate,String searchQuotaType,Model model,Integer searchDirection,
HttpServletRequest request, HttpServletResponse response) {
long start = System.currentTimeMillis();
AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null);
Map resultMap=new HashMap();
try {
if(StringUtils.isEmpty(beginDate)&&StringUtils.isEmpty(endDate)) {
Calendar cal = Calendar. getInstance ();
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
endDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format(cal.getTime());//获取到完整的时间
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1);
beginDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format(cal.getTime());
}
resultMap = dashboardService.getBandwidthTransEntrance(beginDate, endDate,searchQuotaType);
resultMap = dashboardService.getBandwidthTransEntrance(beginDate, endDate,searchQuotaType,searchDirection);
} catch (Exception e) {
auditLogThread.setExceptionInfo("带宽实时统计数据检索失败:"+e.getMessage());
@@ -321,14 +322,14 @@ public class DashboardServiceController extends BaseRestController {
*/
@RequestMapping(value = "trafficProtocolList", method = RequestMethod.GET)
@ApiOperation(value = "协议统计占比与报表", httpMethod = "GET", notes = "对应协议统计详情占比与报表")
public Map<String, ?> trafficProtocolList(Integer[] protoType,String beginDate, String endDate,Integer entranceId, Model model, HttpServletRequest request,
HttpServletResponse response) {
public Map<String, ?> trafficProtocolList(Integer[] protoType,String beginDate, String endDate,Integer entranceId, Model model,
Integer searchDirection,HttpServletRequest request,HttpServletResponse response) {
long start = System.currentTimeMillis();
AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
List<HashMap> list = new ArrayList<HashMap>();
try {
List<Map> ipActiveList = dashboardService.getProtocolList(beginDate, endDate,protoType,entranceId);
List<Map> ipActiveList = dashboardService.getProtocolList(beginDate, endDate,protoType,entranceId,searchDirection);
if (ipActiveList != null && ipActiveList.size() > 0) {
String jsonString = JsonMapper.toJsonString(ipActiveList);
list = (java.util.List<HashMap>) JsonMapper.fromJsonList(jsonString, HashMap.class);

View File

@@ -180,9 +180,9 @@ public class NtcLogSearchController extends BaseRestController {
AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
null);
//判断searchCfgId是否为null
if(ntcMailLog.getSearchCfgId() ==null){
ntcMailLog.setSearchCfgId("-1");
}
// if(ntcMailLog.getSearchCfgId() ==null){
// ntcMailLog.setSearchCfgId("-1");
// }
try {
resetTime(ntcMailLog);
ntcLogService.queryConditionCheck(auditLogThread, start, ntcMailLog, NtcMailLog.class, page);

View File

@@ -19,8 +19,8 @@ public interface NtcTotalReportDao {
List<Map> getTotalReportList(@Param("reportTime") Date reportTime);
List<Map> getNetFlowPortInfoNew(@Param("statTime") Date statTime);
List<TrafficTransStatistic> getBandwidthTrans(@Param("entranceId") Integer entranceId,@Param("beginDate") String beginDate,@Param("endDate") String endDate,@Param("addrType") String addrType,@Param("transType") Integer transType);
List<TrafficTransStatistic> getBandwidthTransIPVx(@Param("beginDate") String beginDate,@Param("endDate") String endDate);
List<TrafficTransStatistic> getBandwidthTransProtocol(@Param("beginDate") String beginDate,@Param("endDate") String endDate);
List<TrafficTransStatistic> getBandwidthTransIPVx(@Param("beginDate") String beginDate,@Param("endDate") String endDate,@Param("searchDirection") Integer searchDirection);
List<TrafficTransStatistic> getBandwidthTransProtocol(@Param("beginDate") String beginDate,@Param("endDate") String endDate,@Param("searchDirection") Integer searchDirection);
String getAddrType();
String getTransType();
String getEntranceId();

View File

@@ -73,11 +73,13 @@
WHERE
<![CDATA[ stat_time >= #{beginDate} and stat_time < #{endDate} ]]>
and addr_type in (4,6)
and direction =#{searchDirection}
group by addr_type,stat_time ,entrance_id order by stat_time
</select>
<select id="getBandwidthTransProtocol" resultMap="BandwidthResultMap">
select addr_type,trans_type,entrance_id,IFNULL((SUM(c2s_byte_len+s2c_byte_len)*8)/300/1024/1024/1024,0) gbps,IFNULL(SUM(c2s_pkt_num+s2c_pkt_num)/300,0) pps,IFNULL(SUM(link_num),0) linkNum, stat_time from traffic_trans_statistic
WHERE <![CDATA[stat_time >= #{beginDate} and stat_time < #{endDate} ]]>
and direction =#{searchDirection}
and trans_type in (6,17) group by trans_type,stat_time ,entrance_id order by stat_time
</select>

View File

@@ -13,6 +13,6 @@ public interface TrafficProtocolStatisticDao {
TrafficProtocolStatistic getMaxStatTime();
List<Map> protocolChart(@Param("statTime")Date statTime);
List<Map> getProtocolList(@Param("beginTime")String beginTime,@Param("endTime")String endTime,@Param("protoType")Integer[] protoType,@Param("entranceId")Integer entranceId);
List<Map> getProtocolList(@Param("beginTime")String beginTime,@Param("endTime")String endTime,@Param("protoType")Integer[] protoType,@Param("entranceId")Integer entranceId,@Param("searchDirection")Integer searchDirection);
}

View File

@@ -37,7 +37,10 @@
</foreach>
</if>
<if test="entranceId !=null">
and entrance_id=#{entranceId}
and entrance_id = #{entranceId}
</if>
<if test="searchDirection !=null">
and direction = #{searchDirection}
</if>
GROUP BY proto_type ) p
LEFT JOIN ui_code_protocol_type_dic c ON p.proto_type=c.view_code ORDER BY p.GByte DESC

View File

@@ -195,16 +195,27 @@ public abstract class BaseLogService {
} catch (Exception e) {
throw new RestServiceException("searchFoundStartTime参数错误", RestBusinessCode.param_formate_error.getValue());
}
//service参数改为可以传多个
if (!StringUtil.isBlank(entity.getSearchService())) {
String[] splits = org.apache.commons.lang.StringUtils.split(entity.getSearchService(), ",");
for (String service : splits) {
try {
Integer.parseInt(service);
} catch (Exception e) {
throw new RestServiceException("searchService参数错误", RestBusinessCode.param_formate_error.getValue());
}
try {
if (!StringUtil.isBlank(entity.getSearchService())) {
Integer.parseInt(entity.getSearchService());
}
} catch (NumberFormatException e) {
throw new RestServiceException("searchService参数格式错误", RestBusinessCode.param_formate_error.getValue());
} catch (Exception e) {
throw new RestServiceException("searchService参数错误", RestBusinessCode.param_formate_error.getValue());
}
// try {
// if (!StringUtil.isBlank(entity.getSearchService())) {
// Integer.parseInt(entity.getSearchService());
// }
// } catch (NumberFormatException e) {
// throw new RestServiceException("searchService参数格式错误", RestBusinessCode.param_formate_error.getValue());
// } catch (Exception e) {
// throw new RestServiceException("searchService参数错误", RestBusinessCode.param_formate_error.getValue());
// }
try {
checkCloumnIsExist(thread, start, clazz, page);
} catch (RestServiceException e) {

View File

@@ -1004,7 +1004,8 @@ public class LogDataService {
if (field.equals("cfg_id")
|| field.equals("web_id")
|| field.equals("app_id")
|| field.equals("proto_id")) {
|| field.equals("proto_id")
|| field.equals("service")) {
if (field.equals("cfg_id")) {
if (value.toString().trim()
.equals("0")) {
@@ -1015,13 +1016,6 @@ public class LogDataService {
+ " ="
+ value.toString()
.trim());
} else if (value.toString()
.trim().equals("-1")) {
whereSB.append(" and "
+ filedAndColumnMap
.get(key)
.toLowerCase()
+ " >0");
} else {
whereSB.append(" and "
+ filedAndColumnMap

View File

@@ -733,12 +733,12 @@ public class DashboardService extends BaseService {
*
* @return
*/
public List<Map> getProtocolList(String startTime, String endTime, Integer[] protoType,Integer entranceId) {
public List<Map> getProtocolList(String startTime, String endTime, Integer[] protoType,Integer entranceId,Integer searchDirection) {
// TrafficProtocolStatistic maxStatTime = trafficProtocolStatisticDao.getMaxStatTime();
List<Map> list = new ArrayList<Map>();
// if (maxStatTime != null && maxStatTime.getStatTime() != null) {
// Date statTime = maxStatTime.getStatTime();
list = trafficProtocolStatisticDao.getProtocolList(startTime, endTime, protoType,entranceId);
list = trafficProtocolStatisticDao.getProtocolList(startTime, endTime, protoType,entranceId,searchDirection);
// }
return list;
}
@@ -1290,13 +1290,13 @@ public class DashboardService extends BaseService {
return fieldType == null ? null : fieldType.split(",");
}
public Map<String, Map> getBandwidthTransEntrance(String beginDate, String endDate,String searchQuotaType) throws ParseException {
public Map<String, Map> getBandwidthTransEntrance(String beginDate, String endDate,String searchQuotaType,Integer searchDirection) throws ParseException {
Map<String, Map> resultMap = new HashMap<String, Map>();
Map<String, ArrayList<TrafficTransStatistic>> listMap = new HashMap<String, ArrayList<TrafficTransStatistic>>();
List<TrafficTransStatistic> bandwidthListIPvx = new ArrayList<TrafficTransStatistic>();
List<TrafficTransStatistic> bandwidthListProtocol = new ArrayList<TrafficTransStatistic>();
bandwidthListIPvx = ntcTotalReportDao.getBandwidthTransIPVx(beginDate, endDate);
bandwidthListProtocol = ntcTotalReportDao.getBandwidthTransProtocol(beginDate, endDate);
bandwidthListIPvx = ntcTotalReportDao.getBandwidthTransIPVx(beginDate, endDate,searchDirection);
bandwidthListProtocol = ntcTotalReportDao.getBandwidthTransProtocol(beginDate, endDate,searchDirection);
Map<String, Map> trafficMap = new HashMap<String, Map>();
if ((!StringUtil.isEmpty(bandwidthListIPvx) && bandwidthListIPvx.size() > 0)
|| (!StringUtil.isEmpty(bandwidthListProtocol) && bandwidthListProtocol.size() > 0)) {