报表页面获取业务类型日志总量功能提交
This commit is contained in:
@@ -43,7 +43,7 @@ public class NtcPzReportController extends BaseController{
|
||||
@ResponseBody
|
||||
public Map<String, Object> ajaxGetLogTotal(Model model,long endTime,int action,Integer functionId,Integer compileId){
|
||||
Map<String, Object> data=new HashMap<String, Object>();
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
SimpleDateFormat sdf=new SimpleDateFormat(Constants.SEARCH_DATEFORMAT);
|
||||
int interval=Constants.LOG_TIME_RANGE;
|
||||
Date endDate=new Date(endTime);
|
||||
Date startDate=new Date(endTime-interval);
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package com.nis.web.controller.report;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.text.ParseException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -9,34 +13,71 @@ import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.log.SearchReport;
|
||||
import com.nis.domain.report.NtcServiceReport;
|
||||
import com.nis.domain.report.ReportResult;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.web.controller.BaseController;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/report")
|
||||
public class NtcServiceReportController extends BaseController {
|
||||
@RequestMapping("/ntcLabelReport")
|
||||
public String list(@ModelAttribute("bean") SearchReport bean,Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||
initReportCondition(model, bean);
|
||||
@RequestMapping("/ajaxNtcServiceReport")
|
||||
@ResponseBody
|
||||
public Map<String, Long> report(@ModelAttribute("bean") SearchReport bean,Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||
Map<String, Long> data=new HashMap<>();
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(bean.getFunctionId());
|
||||
if(bean.getAction()!=null){
|
||||
for(FunctionServiceDict service:serviceList){
|
||||
if(service.getAction().intValue()==bean.getAction().intValue()){
|
||||
bean.setSearchService(service.getServiceId().toString());
|
||||
}
|
||||
}
|
||||
}else{
|
||||
StringBuffer serviceId=new StringBuffer();
|
||||
for(int i=0;i<serviceList.size();i++){
|
||||
if(i==0){
|
||||
serviceId.append(serviceList.get(i).getServiceId().toString());
|
||||
}else{
|
||||
serviceId.append(","+serviceList.get(i).getServiceId().toString());
|
||||
}
|
||||
}
|
||||
bean.setSearchService(serviceId.toString());
|
||||
}
|
||||
bean.setSearchBusinessType("1");
|
||||
bean.setPageSize(-1);
|
||||
try {
|
||||
this.setReportSearchTime(bean);
|
||||
} catch (ParseException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
ReportResult<NtcServiceReport> result=new ReportResult<>();
|
||||
StringBuffer url=new StringBuffer(Constants.LOG_BASE_URL+Constants.NTC_SERVICE_REPORT+"?");
|
||||
try {
|
||||
result=result.getReport(url.toString(), bean);
|
||||
} catch (MaatConvertException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
// try {
|
||||
// result=result.getReport(url.toString(), bean);
|
||||
// Page<NtcServiceReport> page=result.getData();
|
||||
// List<NtcServiceReport> data=page.getList();
|
||||
// for(NtcServiceReport report:data){
|
||||
// if(datas.containsKey(report.getService().toString())){
|
||||
// data.put(report.getService().toString(), datas.get(report.getService().toString())+report.getSum().longValue());
|
||||
// }else{
|
||||
// data.put(report.getService().toString(),report.getSum().longValue());
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
if(bean.getAction()!=null){
|
||||
data.put(bean.getAction().toString(), 66666666l);
|
||||
}
|
||||
Page<NtcServiceReport> page=result.getData();
|
||||
model.addAttribute("page", page);
|
||||
return "/report/list";
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +62,31 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
$(".service").each(function(){
|
||||
var target=$(this).find("span");
|
||||
var action=$(this).data("action");
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:'${ctx}/report/ajaxNtcServiceReport',
|
||||
data:{
|
||||
"action":action,
|
||||
"reportType":$('[name="reportType"]').val(),
|
||||
"reportTime":$('[name="reportTime"]').val()
|
||||
},
|
||||
dataType:'json',
|
||||
async:true,
|
||||
success:function(data,textStatus){//处理返回结果
|
||||
if(textStatus=="success"){
|
||||
target.html(data[action]);
|
||||
}
|
||||
},
|
||||
complete:function(XMLHttpRequest,status){//超时设置
|
||||
if(status=="timeout"){
|
||||
target.html(timeout);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function changeReportType(reportType, init) {
|
||||
@@ -102,11 +127,15 @@ var ajaxReport=function(url,target){
|
||||
<body>
|
||||
<div class="page-content">
|
||||
<div class="theme-panel hidden-xs hidden-sm">
|
||||
<c:forEach items="${fns:getDictList('SERVICE_ACTION')}" var="action" >
|
||||
<c:forEach items="${serviceList}" var="service" >
|
||||
<c:forEach items="${fns:getDictList('SERVICE_ACTION')}" var="action">
|
||||
<c:forEach items="${serviceList}" var="service" varStatus="status">
|
||||
<c:if test="${service.functionId eq bean.functionId and action.itemCode eq service.action}">
|
||||
<div class="btn btn-primary">
|
||||
<spring:message code="${action.itemValue}"/>1000000
|
||||
<div data-action="${service.action}" class="service btn
|
||||
<c:if test="${status.index%2==0}">btn-primary</c:if>
|
||||
<c:if test="${status.index%2!=0}">btn-default</c:if>">
|
||||
<spring:message code="${action.itemValue}"/>
|
||||
<spring:message code="log_total"/>
|
||||
<span>0</span>
|
||||
</div>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
|
||||
Reference in New Issue
Block a user