流量统计-解决traffic详情时折线图最后时间点数据为0问题。解决用户行为统计中用户名跟ip可能为空无用户名登录时报错问题。app,协议,traffic详情时间查询条件格式化,默认时间显示为最近一小时,列表数据保留两位小数。
This commit is contained in:
@@ -115,9 +115,9 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
public String bandwidthList(Model model){
|
||||
Calendar cal = Calendar. getInstance ();
|
||||
cal.setTime(new Date());
|
||||
String now = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format(cal.getTime());//获取到完整的时间
|
||||
String now = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());//获取到完整的时间
|
||||
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1);
|
||||
String oneHoursAgo = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format(cal.getTime());
|
||||
String oneHoursAgo = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());
|
||||
model.addAttribute("beginDate", oneHoursAgo);
|
||||
model.addAttribute("endDate", now);
|
||||
return "/dashboard/trafficBandwidthList";
|
||||
@@ -126,7 +126,14 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
* 流量统计滚动动作查看详情页面
|
||||
*/
|
||||
@RequestMapping(value={"trafficBlockList","trafficMonitorList"})
|
||||
public String serviceBlockList(@RequestParam("searchAction")String searchAction,HttpServletRequest request, HttpServletResponse response, Model model){
|
||||
public String serviceBlockList(@RequestParam("searchAction")String searchAction,Model model){
|
||||
Calendar cal = Calendar. getInstance ();
|
||||
cal.setTime(new Date());
|
||||
String now = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());//获取到完整的时间
|
||||
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1);
|
||||
String oneHoursAgo = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());
|
||||
model.addAttribute("beginDate", oneHoursAgo);
|
||||
model.addAttribute("endDate", now);
|
||||
model.addAttribute("searchAction", searchAction);
|
||||
return "/dashboard/trafficActionTransList";
|
||||
}
|
||||
@@ -135,12 +142,13 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value="actionEntranceTrans")
|
||||
@ResponseBody
|
||||
public List actionTrans(@RequestParam("searchAction")String searchAction){
|
||||
public List actionTrans(String beginDate,String endDate,@RequestParam("searchAction")String searchAction){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List resultList = new ArrayList();
|
||||
String url = Constants.DASHBOARD_URL+Constants.NTC_ACTION_ENTRANCE_REPORT;
|
||||
url=url+"?searchAction="+searchAction;
|
||||
try {
|
||||
url = urlAddDate(url,beginDate,endDate);
|
||||
String string = HttpClientUtil.get(url);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
||||
@@ -153,13 +161,23 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
* url路径时间参数格式化
|
||||
* @param url
|
||||
* @param beginDate
|
||||
* @param endDate
|
||||
* @return
|
||||
* @throws URISyntaxException
|
||||
*/
|
||||
public String urlAddDate(String url,String beginDate,String endDate) throws URISyntaxException{
|
||||
if(StringUtil.isBlank(beginDate)||StringUtil.isBlank(endDate)){
|
||||
Calendar cal = Calendar. getInstance ();
|
||||
cal.setTime(new Date());
|
||||
endDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format(cal.getTime());//获取到完整的时间
|
||||
endDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).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());
|
||||
beginDate = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());
|
||||
}
|
||||
URIBuilder uriBuilder = new URIBuilder(url);
|
||||
uriBuilder.addParameter("beginDate",beginDate);
|
||||
@@ -239,11 +257,11 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
public String protocolTypeList(Model model){
|
||||
Calendar cal = Calendar. getInstance ();
|
||||
cal.setTime(new Date());
|
||||
String now = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format(cal.getTime());//获取到完整的时间
|
||||
String now = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());//获取到完整的时间
|
||||
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1);
|
||||
String oneHoursAgo = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format(cal.getTime());
|
||||
model.addAttribute("searchFoundStartTime", oneHoursAgo);
|
||||
model.addAttribute("searchFoundEndTime", now);
|
||||
String oneHoursAgo = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());
|
||||
model.addAttribute("beginDate", oneHoursAgo);
|
||||
model.addAttribute("endDate", now);
|
||||
return "/dashboard/trafficProtocolTypeList";
|
||||
}
|
||||
/**
|
||||
@@ -251,16 +269,12 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value="protocolList")
|
||||
@ResponseBody
|
||||
public List protocolList(Model model,@RequestParam(required=false)String searchFoundStartTime,@RequestParam(required=false)String searchFoundEndTime){
|
||||
public List protocolList(Model model,@RequestParam(required=false)String beginDate,@RequestParam(required=false)String endDate){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_PROTOCOL_LIST;
|
||||
try {
|
||||
if(!StringUtil.isBlank(searchFoundStartTime)&&!StringUtil.isBlank(searchFoundEndTime)){
|
||||
searchFoundStartTime=URLEncoder.encode(searchFoundStartTime, "UTF-8");
|
||||
searchFoundEndTime=URLEncoder.encode(searchFoundEndTime, "UTF-8");
|
||||
url+="?searchFoundStartTime="+searchFoundStartTime+"&searchFoundEndTime="+searchFoundEndTime;
|
||||
}
|
||||
url=urlAddDate(url,beginDate,endDate);
|
||||
String string = HttpClientUtil.get(url);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
||||
@@ -311,7 +325,14 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
* App类型详细列表
|
||||
*/
|
||||
@RequestMapping(value="appTypeList")
|
||||
public String appTypeList(){
|
||||
public String appTypeList(Model model){
|
||||
Calendar cal = Calendar. getInstance ();
|
||||
cal.setTime(new Date());
|
||||
String now = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());//获取到完整的时间
|
||||
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1);
|
||||
String oneHoursAgo = new SimpleDateFormat( "yyyy-MM-dd HH:mm:00" ).format(cal.getTime());
|
||||
model.addAttribute("beginDate", oneHoursAgo);
|
||||
model.addAttribute("endDate", now);
|
||||
return "/dashboard/trafficAppTypeList";
|
||||
}
|
||||
/**
|
||||
@@ -319,16 +340,12 @@ public class TrafficStatisticsInfoController extends BaseController {
|
||||
*/
|
||||
@RequestMapping(value="appList")
|
||||
@ResponseBody
|
||||
public List appList(@RequestParam(value="searchFoundStartTime",required=false)String searchFoundStartTime,@RequestParam(value="searchFoundEndTime",required=false)String searchFoundEndTime){
|
||||
public List appList(@RequestParam(value="beginDate",required=false)String beginDate,@RequestParam(value="endDate",required=false)String endDate){
|
||||
Map<String, Object> fromJsonList = new HashMap<String, Object>();
|
||||
List list = new ArrayList();
|
||||
String url = Constants.DASHBOARD_URL+Constants.TRAFFIC_APP_LIST;
|
||||
try {
|
||||
if(!StringUtil.isBlank(searchFoundStartTime)&&!StringUtil.isBlank(searchFoundEndTime)){
|
||||
searchFoundStartTime=URLEncoder.encode(searchFoundStartTime, "UTF-8");
|
||||
searchFoundEndTime=URLEncoder.encode(searchFoundEndTime, "UTF-8");
|
||||
url+="?searchFoundStartTime="+searchFoundStartTime+"&searchFoundEndTime="+searchFoundEndTime;
|
||||
}
|
||||
url=urlAddDate(url,beginDate,endDate);
|
||||
String string = HttpClientUtil.get(url);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
fromJsonList = gson.fromJson(string, new TypeToken<Map>(){}.getType());
|
||||
|
||||
@@ -94,23 +94,29 @@ public class TrafficStatisticsReportController extends BaseController {
|
||||
model.addAttribute("accountList", accountList);
|
||||
if(StringUtil.isBlank(account)&&accountList!=null&&accountList.size()>0&&!"3".equals(searchBusinessType)) {
|
||||
Map accountMap = (Map) accountList.get(0);
|
||||
String firstAccount=(String) accountMap.get("account");
|
||||
String userString = HttpClientUtil.get(userUrl+"&searchAccount="+firstAccount);
|
||||
// 指定用户 查询
|
||||
Gson usergson = new GsonBuilder().create();
|
||||
userJsonList = usergson.fromJson(userString, new TypeToken<Map>(){}.getType());
|
||||
userList = (ArrayList) userJsonList.get("data");
|
||||
String firstAccount="";
|
||||
if(accountMap!=null&&accountMap.get("account")!=null){
|
||||
firstAccount=(String) accountMap.get("account");
|
||||
String userString = HttpClientUtil.get(userUrl+"&searchAccount="+firstAccount);
|
||||
// 指定用户 查询
|
||||
Gson usergson = new GsonBuilder().create();
|
||||
userJsonList = usergson.fromJson(userString, new TypeToken<Map>(){}.getType());
|
||||
userList = (ArrayList) userJsonList.get("data");
|
||||
}
|
||||
model.addAttribute("userList", userList);
|
||||
model.addAttribute("searchAccount", firstAccount);
|
||||
}
|
||||
if(StringUtil.isBlank(nasIp)&&nasIpList!=null&&nasIpList.size()>0&&!"2".equals(searchBusinessType)) {
|
||||
Map IpMap = (Map) nasIpList.get(0);
|
||||
String firstIp=(String) IpMap.get("nasIp");
|
||||
String ipString = HttpClientUtil.get(ipUrl+"&searchNasIp="+firstIp);
|
||||
// 指定IP查询
|
||||
Gson ipgson = new GsonBuilder().create();
|
||||
ipJsonList = ipgson.fromJson(ipString, new TypeToken<Map>(){}.getType());
|
||||
ipList = (ArrayList) ipJsonList.get("data");
|
||||
Map ipMap = (Map) nasIpList.get(0);
|
||||
String firstIp="";
|
||||
if(ipMap!=null&&ipMap.get("nasIp")!=null){
|
||||
firstIp=(String) ipMap.get("nasIp");
|
||||
String ipString = HttpClientUtil.get(ipUrl+"&searchNasIp="+firstIp);
|
||||
// 指定IP查询
|
||||
Gson ipgson = new GsonBuilder().create();
|
||||
ipJsonList = ipgson.fromJson(ipString, new TypeToken<Map>(){}.getType());
|
||||
ipList = (ArrayList) ipJsonList.get("data");
|
||||
}
|
||||
model.addAttribute("ipList", ipList);
|
||||
model.addAttribute("searchNasIp", firstIp);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user