(1)境内源IP报表加入对界面时间字段的处理

(2)时间字段的处理放到baseController中
(3)界面ajax函数缩减为1个公用的函数
This commit is contained in:
wangxin
2018-07-10 13:33:28 +08:00
parent 86fa5f0000
commit 0e05e2a0e4
6 changed files with 255 additions and 142 deletions

View File

@@ -1,5 +1,6 @@
package com.nis.web.controller.report;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
@@ -11,6 +12,7 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
@@ -19,7 +21,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.basics.ServiceDictInfo;
import com.nis.domain.configuration.RequestInfo;
import com.nis.domain.log.SearchReport;
import com.nis.domain.report.NtcSrcipDomesticReport;
import com.nis.domain.report.ReportResult;
@@ -50,47 +51,19 @@ public class NtcSrcipDomesticReportController extends BaseController {
}
bean.setSearchService(serviceId.toString());
}
String reportTime=bean.getReportTime();
bean.setSearchBusinessType("1");
ReportResult<NtcSrcipDomesticReport> result=new ReportResult<>();
StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_SERVICE_REPORT+"?");
bean.setPageSize(-1);
bean.setFields("srcProvince,srcCity,sum,reportTime");
String format=Constants.SEARCH_DATEFORMAT;
SimpleDateFormat sdf=new SimpleDateFormat(format);
Date date=new Date();
bean.setSearchReportEndTime(sdf.format(date));
Calendar cal=Calendar.getInstance();
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){
cal.set(Calendar.HOUR_OF_DAY, 0);
}else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.DAY_OF_MONTH, 1);
}else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.DAY_OF_MONTH, 1);
cal.set(Calendar.MONTH, 0);
}
logger.info("search start time "+sdf.format(cal.getTime()));
logger.info("search end time "+sdf.format(date));
bean.setSearchReportStartTime(sdf.format(cal.getTime()));
List<String> titles=new ArrayList<String>();
while(cal.getTime().getTime()<date.getTime()){//构造标题
//报表时间单位加一
if(bean.getReportType()==Constants.REPORT_TYPE_HOUR){
titles.add(sdf.format(cal.getTime()).substring(0,13));
cal.add(Calendar.HOUR_OF_DAY, 1);
}else if(bean.getReportType()==Constants.REPORT_TYPE_DAY){
titles.add(sdf.format(cal.getTime()).substring(0,10));
cal.add(Calendar.DAY_OF_MONTH, 1);
}else if(bean.getReportType()==Constants.REPORT_TYPE_MONTH){
titles.add(sdf.format(cal.getTime()).substring(0,7));
cal.add(Calendar.MONTH, 1);
}
try {
this.setReportSearchTime(bean);
} catch (ParseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
List<String> titles=this.getDateTitiles(bean);
model.addAttribute("titles", titles);
// try {
// result=result.getReport(url.toString(), bean);

View File

@@ -32,9 +32,6 @@ import com.nis.web.controller.BaseController;
public class NtcTagReportController extends BaseController {
@RequestMapping("/ajaxNtcTagReport")
public String list(@ModelAttribute("bean") SearchReport bean,Model model, HttpServletRequest request, HttpServletResponse response) {
// if (bean.getReportType() == null) {
// bean.setReportType(1);
// }
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(bean.getFunctionId());
List<ServiceDictInfo> labels=serviceDictInfoService.findAllLableDict();
model.addAttribute("labels", labels);