国际化新增default_request 默认来函

优化首页统计,避免空情况出现。
部分业务来函为默认来函,展示默认来函
This commit is contained in:
duandongmei
2018-11-01 11:10:52 +08:00
parent 883dea867a
commit 07fd611b53
9 changed files with 80 additions and 42 deletions

View File

@@ -3,7 +3,9 @@ package com.nis.web.controller.configuration.statistics;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@@ -46,10 +48,12 @@ import com.nis.web.service.CommonService;
@RequestMapping("${adminPath}/configure/statistics") @RequestMapping("${adminPath}/configure/statistics")
public class ConfigureStatisticsController extends BaseController{ public class ConfigureStatisticsController extends BaseController{
@RequestMapping(value = {"/configureStateStatistics"}) @RequestMapping(value = {"/configureStateStatistics"})
public String configStateStatistics(Model model,HttpServletRequest request public String configStateStatistics(Model model,HttpServletRequest request
,HttpServletResponse response ,HttpServletResponse response
,RedirectAttributes redirectAttributes){ ,RedirectAttributes redirectAttributes){
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
/****************************Request Info Statistics*****************************/ /****************************Request Info Statistics*****************************/
//1、查询所有有效的service //1、查询所有有效的service
List<FunctionServiceDict> serviceDictList = DictUtils.getFunctionServiceDictList(); List<FunctionServiceDict> serviceDictList = DictUtils.getFunctionServiceDictList();
@@ -61,7 +65,12 @@ public class ConfigureStatisticsController extends BaseController{
//3、根据当前页的requestInfo信息查询request统计信息 //3、根据当前页的requestInfo信息查询request统计信息
List<Object[]> requestStatisticList=new ArrayList<Object[]>(); List<Object[]> requestStatisticList=new ArrayList<Object[]>();
if(!StringUtil.isEmpty(requestInfos)){ if(!StringUtil.isEmpty(requestInfos)){
requestStatisticList=configureStatisticsService.getRequestStateStatistics(requestInfos,serviceDictList); Date requestStatisticTime=configureStatisticsService.getRequestStatisticTime();
String requestStatisticTimeStr="";
if(!StringUtil.isEmpty(requestStatisticTime)){
requestStatisticTimeStr=sdf.format(requestStatisticTime);
}
requestStatisticList=configureStatisticsService.getRequestStateStatistics(requestInfos,serviceDictList,requestStatisticTimeStr);
if(!StringUtil.isEmpty(requestStatisticList)){ if(!StringUtil.isEmpty(requestStatisticList)){
for (Iterator iterator = requestStatisticList.iterator(); iterator.hasNext();) { for (Iterator iterator = requestStatisticList.iterator(); iterator.hasNext();) {
Map map = (Map) iterator.next(); Map map = (Map) iterator.next();
@@ -72,16 +81,22 @@ public class ConfigureStatisticsController extends BaseController{
} }
} }
} }
model.addAttribute("requestStatisticTime", requestStatisticTimeStr);
} }
requestPage.setList(requestStatisticList); requestPage.setList(requestStatisticList);
model.addAttribute("requestInfos", requestInfos); model.addAttribute("requestInfos", requestInfos);
model.addAttribute("serviceList", serviceDictList); model.addAttribute("serviceList", serviceDictList);
model.addAttribute("requestStatisticTime", configureStatisticsService.getRequestStatisticTime());
model.addAttribute("page", requestPage); model.addAttribute("page", requestPage);
/****************************Config Status Info Statistics*****************************/ /****************************Config Status Info Statistics*****************************/
List<Object[]> list = configureStatisticsService.getConfigStateStatistics(); Date cfgStatisticTime=configureStatisticsService.getConfigStatisticTime();
String cfgStatisticTimeStr="";
if(!StringUtil.isEmpty(cfgStatisticTime)){
cfgStatisticTimeStr=sdf.format(cfgStatisticTime);
}
List<Object[]> list = configureStatisticsService.getConfigStateStatistics(cfgStatisticTimeStr);
model.addAttribute("configStatistics", list); model.addAttribute("configStatistics", list);
model.addAttribute("configStatisticTime", configureStatisticsService.getConfigStatisticTime()); model.addAttribute("configStatisticTime", cfgStatisticTimeStr);
return "/index"; return "/index";
} }

View File

@@ -1,6 +1,7 @@
package com.nis.web.dao.configuration.statistics; package com.nis.web.dao.configuration.statistics;
import java.util.Date;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@@ -14,9 +15,9 @@ import com.nis.web.dao.MyBatisDao;
@MyBatisDao @MyBatisDao
public interface ConfigureStatisticsDao { public interface ConfigureStatisticsDao {
public List<Object[]> getConfigStateStatistics( ); public List<Object[]> getConfigStateStatistics(@Param("statisticTime")String statisticTime);
public List<Object[]> getConfigStatisticTime(); public Date getConfigStatisticTime();
public List<Object[]> getRequestStatisticTime(); public Date getRequestStatisticTime();
public List<Object[]> getRequestStateStatistics(@Param("requestList")List<RequestInfo> requestList,@Param("serviceList")List<FunctionServiceDict> serviceList) ; public List<Object[]> getRequestStateStatistics(@Param("requestList")List<RequestInfo> requestList,@Param("serviceList")List<FunctionServiceDict> serviceList,@Param("statisticTime")String statisticTime) ;
public Integer getEffectiveCfgNum(@Param("serviceId")Integer serviceId); public Integer getEffectiveCfgNum(@Param("serviceId")Integer serviceId);
} }

View File

@@ -9,7 +9,10 @@
sum(case when c.cfg_state =3 then 1 else 0 end) as cancle_approved, sum(case when c.cfg_state =3 then 1 else 0 end) as cancle_approved,
sum(case when c.cfg_state =0 then 1 else 0 end) as created, sum(case when c.cfg_state =0 then 1 else 0 end) as created,
sum(case when c.cfg_state =-1 then 1 else 0 end) as deleted sum(case when c.cfg_state =-1 then 1 else 0 end) as deleted
from (select distinct cfg_state,service_id,compile_id from cfg_num_statistics) c from (
select distinct cfg_state,service_id,compile_id from cfg_num_statistics
where statistic_time = #{statisticTime}
) c
group by service_id; group by service_id;
</select> </select>
@@ -18,22 +21,18 @@
<foreach item="serivice" collection="serviceList" separator=","> <foreach item="serivice" collection="serviceList" separator=",">
sum(case when c.service_id =${serivice.serviceId} then 1 else 0 end) as ${serivice.serviceName} sum(case when c.service_id =${serivice.serviceId} then 1 else 0 end) as ${serivice.serviceName}
</foreach> </foreach>
from (select distinct service_id,request_id,compile_id from request_num_statistics) c from (select distinct service_id,request_id,compile_id from request_num_statistics
where request_id in where statistic_time =#{statisticTime}
<foreach item="requestInfo" collection="requestList" separator="," open="(" close=")"> ) c
${requestInfo.id}
</foreach>
group by request_id group by request_id
</select> </select>
<select id="getConfigStatisticTime" resultType="java.util.LinkedHashMap"> <select id="getConfigStatisticTime" resultType="java.util.Date">
select statistic_time select min(statistic_time) statistic_time
from cfg_num_statistics c from cfg_num_statistics c
order by statistic_time asc
</select> </select>
<select id="getRequestStatisticTime" resultType="java.util.LinkedHashMap"> <select id="getRequestStatisticTime" resultType="java.util.Date">
select statistic_time select min(statistic_time)
from request_num_statistics c from request_num_statistics c
order by statistic_time asc
</select> </select>
<!-- <select id="getRequestStateCount" resultType="long"> <!-- <select id="getRequestStateCount" resultType="long">
select count(request_id) count select count(request_id) count

View File

@@ -1,5 +1,6 @@
package com.nis.web.service.configuration.statistics; package com.nis.web.service.configuration.statistics;
import java.util.Date;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -25,17 +26,19 @@ public class ConfigureStatisticsService extends CrudService<NumCfgDao,NumBoundar
@Autowired @Autowired
protected ConfigureStatisticsDao configureStatisticsDao; protected ConfigureStatisticsDao configureStatisticsDao;
public List<Object[]> getConfigStateStatistics(){ public List<Object[]> getConfigStateStatistics(String statisticTime){
return configureStatisticsDao.getConfigStateStatistics(); return configureStatisticsDao.getConfigStateStatistics(statisticTime);
} }
public List<Object[]> getConfigStatisticTime(){ public Date getConfigStatisticTime(){
return configureStatisticsDao.getConfigStatisticTime(); Date statisticTime=configureStatisticsDao.getConfigStatisticTime();
return statisticTime;
} }
public List<Object[]> getRequestStatisticTime(){ public Date getRequestStatisticTime(){
return configureStatisticsDao.getRequestStatisticTime(); Date statisticTime=configureStatisticsDao.getRequestStatisticTime();
return statisticTime;
} }
public List<Object[]> getRequestStateStatistics(List<RequestInfo> requestList,List<FunctionServiceDict> serviceList){ public List<Object[]> getRequestStateStatistics(List<RequestInfo> requestList,List<FunctionServiceDict> serviceList,String statistcTime){
List<Object[]> dataList=configureStatisticsDao.getRequestStateStatistics(requestList,serviceList); List<Object[]> dataList=configureStatisticsDao.getRequestStateStatistics(requestList,serviceList,statistcTime);
return dataList; return dataList;
} }
public Integer getEffectiveCfgNum(Integer serviceId){ public Integer getEffectiveCfgNum(Integer serviceId){

View File

@@ -1300,4 +1300,5 @@ ip_range_in_the_same=Start IP and end IP in a IP range must with in the same sub
log_to_url=To HTTP URL log_to_url=To HTTP URL
source_compile_id=Configuration Source source_compile_id=Configuration Source
most_keywords=%s can have 1024 chars at most most_keywords=%s can have 1024 chars at most
hex_case_insensitive=Hexadecimal values must case insensitive hex_case_insensitive=Hexadecimal values must case insensitive
default_request=Default Letter

View File

@@ -1298,4 +1298,5 @@ log_to_url=To HTTP URL
source_compile_id=Configuration Source source_compile_id=Configuration Source
av_protocol_note=Note:Recognizable Protocols Include RTSP,RTMP. av_protocol_note=Note:Recognizable Protocols Include RTSP,RTMP.
most_keywords=%s can have 1024 chars at most most_keywords=%s can have 1024 chars at most
hex_case_insensitive=Hexadecimal values must case insensitive hex_case_insensitive=Hexadecimal values must case insensitive
default_request=Default Letter

View File

@@ -1292,4 +1292,5 @@ ip_range_in_the_same=IP\u8303\u56F4\u7684\u8D77\u59CBIP\u4E0E\u7EC8\u6B62IP\u5FC
log_to_url=\u8F6CHTTP URL\u914D\u7F6E log_to_url=\u8F6CHTTP URL\u914D\u7F6E
source_compile_id=\u914D\u7F6E\u6765\u6E90 source_compile_id=\u914D\u7F6E\u6765\u6E90
most_keywords=%s\u6700\u591A\u5305\u542B1024\u4E2A\u5B57\u7B26 most_keywords=%s\u6700\u591A\u5305\u542B1024\u4E2A\u5B57\u7B26
hex_case_insensitive=16\u8FDB\u5236\u7684\u503C\u5927\u5C0F\u5199\u4E0D\u654F\u611F hex_case_insensitive=16\u8FDB\u5236\u7684\u503C\u5927\u5C0F\u5199\u4E0D\u654F\u611F
default_request=\u9ED8\u8BA4\u51FD

View File

@@ -0,0 +1,18 @@
INSERT INTO sys_data_dictionary_name
(`id`, `module_name`, `mark`, `remark`, `revision`, `create_time`, `modify_time`, `status`)
VALUES
(127, 'ANTIDDOS协议', 'ANTIDDOS_PROTOCOL', '', '', "2018/11/1 10:34:00", "2018/11/1 10:34:00", 1);
INSERT INTO sys_data_dictionary_item
(`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`)
VALUES
(2979, 'TCP_SYN', 'TCP_SYN', 'TCP_SYN', 0, 1, 1, 127);
INSERT INTO sys_data_dictionary_item
(`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`)
VALUES
(2980, 'UDP_DNS', 'UDP_DNS', 'UDP_DNS', 0, 1, 1, 127);
INSERT INTO sys_data_dictionary_item
(`id`, `item_code`, `item_value`, `item_desc`, `item_sort`, `status`, `type`, `dictionary_id`)
VALUES
(2981, 'UDP_NTP', 'UDP_NTP', 'UDP_NTP', 0, 1, 1, 127);

View File

@@ -85,11 +85,7 @@
<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/> <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/> <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
<font size="4"><i class="fa fa-cogs"> <spring:message code="letter_statistics_info"/> <font size="4"><i class="fa fa-cogs"> <spring:message code="letter_statistics_info"/>
[<spring:message code="statistic_time"/><c:forEach items="${requestStatisticTime }" var="requestStatisticTime" varStatus="status"> [<spring:message code="statistic_time"/>${requestStatisticTime }]
<c:if test="${status.index eq 0 }">
${requestStatisticTime.statistic_time }
</c:if>
</c:forEach>]
</i> </i>
</font> </font>
<a style="color:#333333" href="javascript:page(${page.pageNo},${page.pageSize});" class="icon-refresh pull-right"> </a> <a style="color:#333333" href="javascript:page(${page.pageNo},${page.pageSize});" class="icon-refresh pull-right"> </a>
@@ -107,7 +103,14 @@
<tbody> <tbody>
<c:forEach items="${page.list }" var="requestStatistics" varStatus="statusRequest" step="1"> <c:forEach items="${page.list }" var="requestStatistics" varStatus="statusRequest" step="1">
<tr> <tr>
<td>${requestStatistics['request']}</td> <td>
<c:if test="${requestStatistics['request'] eq '0'}">
<spring:message code="default_request"/>
</c:if>
<c:if test="${requestStatistics['request'] ne '0'}">
${requestStatistics['request']}
</c:if>
</td>
<c:forEach items="${serviceList }" var="serviceDict" varStatus="status" step="1"> <c:forEach items="${serviceList }" var="serviceDict" varStatus="status" step="1">
<td>${requestStatistics[serviceDict.serviceName]}</td> <td>${requestStatistics[serviceDict.serviceName]}</td>
</c:forEach> </c:forEach>
@@ -121,11 +124,7 @@
</div> </div>
<div class="statisticsStatus"> <div class="statisticsStatus">
<font size="4"><i class="fa fa-cogs"> <spring:message code="configure_statistics_info"/> <font size="4"><i class="fa fa-cogs"> <spring:message code="configure_statistics_info"/>
[<spring:message code="statistic_time"/><c:forEach items="${configStatisticTime }" var="configStatisticTime" varStatus="status"> [<spring:message code="statistic_time"/>[<spring:message code="statistic_time"/>${configStatisticTime }]
<c:if test="${status.index eq 0 }">
${configStatisticTime.statistic_time }
</c:if>
</c:forEach>]
</i></font> <a style="color:#333333" href="javascript:page(${page.pageNo},${page.pageSize});" class="icon-refresh pull-right"> </a> </i></font> <a style="color:#333333" href="javascript:page(${page.pageNo},${page.pageSize});" class="icon-refresh pull-right"> </a>
<h5 class="page-header"></h5> <h5 class="page-header"></h5>
<table id="contentTable" class="table table-striped table-bordered table-condensed text-nowrap"> <table id="contentTable" class="table table-striped table-bordered table-condensed text-nowrap">