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

View File

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

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

View File

@@ -1,5 +1,6 @@
package com.nis.web.service.configuration.statistics;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
@@ -25,17 +26,19 @@ public class ConfigureStatisticsService extends CrudService<NumCfgDao,NumBoundar
@Autowired
protected ConfigureStatisticsDao configureStatisticsDao;
public List<Object[]> getConfigStateStatistics(){
return configureStatisticsDao.getConfigStateStatistics();
public List<Object[]> getConfigStateStatistics(String statisticTime){
return configureStatisticsDao.getConfigStateStatistics(statisticTime);
}
public List<Object[]> getConfigStatisticTime(){
return configureStatisticsDao.getConfigStatisticTime();
public Date getConfigStatisticTime(){
Date statisticTime=configureStatisticsDao.getConfigStatisticTime();
return statisticTime;
}
public List<Object[]> getRequestStatisticTime(){
return configureStatisticsDao.getRequestStatisticTime();
public Date getRequestStatisticTime(){
Date statisticTime=configureStatisticsDao.getRequestStatisticTime();
return statisticTime;
}
public List<Object[]> getRequestStateStatistics(List<RequestInfo> requestList,List<FunctionServiceDict> serviceList){
List<Object[]> dataList=configureStatisticsDao.getRequestStateStatistics(requestList,serviceList);
public List<Object[]> getRequestStateStatistics(List<RequestInfo> requestList,List<FunctionServiceDict> serviceList,String statistcTime){
List<Object[]> dataList=configureStatisticsDao.getRequestStateStatistics(requestList,serviceList,statistcTime);
return dataList;
}
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
source_compile_id=Configuration Source
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
av_protocol_note=Note:Recognizable Protocols Include RTSP,RTMP.
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
source_compile_id=\u914D\u7F6E\u6765\u6E90
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="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
<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">
<c:if test="${status.index eq 0 }">
${requestStatisticTime.statistic_time }
</c:if>
</c:forEach>]
[<spring:message code="statistic_time"/>${requestStatisticTime }]
</i>
</font>
<a style="color:#333333" href="javascript:page(${page.pageNo},${page.pageSize});" class="icon-refresh pull-right"> </a>
@@ -107,7 +103,14 @@
<tbody>
<c:forEach items="${page.list }" var="requestStatistics" varStatus="statusRequest" step="1">
<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">
<td>${requestStatistics[serviceDict.serviceName]}</td>
</c:forEach>
@@ -121,11 +124,7 @@
</div>
<div class="statisticsStatus">
<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">
<c:if test="${status.index eq 0 }">
${configStatisticTime.statistic_time }
</c:if>
</c:forEach>]
[<spring:message code="statistic_time"/>[<spring:message code="statistic_time"/>${configStatisticTime }]
</i></font> <a style="color:#333333" href="javascript:page(${page.pageNo},${page.pageSize});" class="icon-refresh pull-right"> </a>
<h5 class="page-header"></h5>
<table id="contentTable" class="table table-striped table-bordered table-condensed text-nowrap">