(1)修复业务日志总量查询回显0的bug
(2)调整业务日志总量查询方法,改为批量查询,减少资源浪费
This commit is contained in:
@@ -5,10 +5,12 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
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;
|
||||
@@ -32,17 +34,13 @@ import net.sf.json.JsonConfig;
|
||||
public class NtcServiceReportController extends BaseController {
|
||||
@RequestMapping("/ajaxNtcServiceReport")
|
||||
@ResponseBody
|
||||
public Map<String, Long> report(@ModelAttribute("bean") SearchReport bean,Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||
Map<String, Long> datas=new HashMap<>();
|
||||
public List<Map<String, Object>> report(@ModelAttribute("bean") SearchReport bean,Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||
List<Map<String, Object>> datas=new ArrayList<Map<String, Object>>();
|
||||
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());
|
||||
}
|
||||
}
|
||||
StringBuffer serviceId=new StringBuffer();
|
||||
if(StringUtils.isNotBlank(bean.getServices())){
|
||||
serviceId.append(bean.getServices());
|
||||
}else{
|
||||
StringBuffer serviceId=new StringBuffer();
|
||||
for(int i=0;i<serviceList.size();i++){
|
||||
if(i==0){
|
||||
serviceId.append(serviceList.get(i).getServiceId().toString());
|
||||
@@ -50,8 +48,8 @@ public class NtcServiceReportController extends BaseController {
|
||||
serviceId.append(","+serviceList.get(i).getServiceId().toString());
|
||||
}
|
||||
}
|
||||
bean.setSearchService(serviceId.toString());
|
||||
}
|
||||
bean.setSearchService(serviceId.toString());
|
||||
bean.setSearchBusinessType("1");
|
||||
bean.setPageSize(-1);
|
||||
try {
|
||||
@@ -64,13 +62,20 @@ public class NtcServiceReportController extends BaseController {
|
||||
try {
|
||||
String json=ConfigServiceUtil.getReport(url.toString(), bean);
|
||||
List<NtcServiceReport> data=getList(json);
|
||||
Map<Integer, Long> dataMap=new HashMap<>();
|
||||
for(NtcServiceReport report:data){
|
||||
if(datas.containsKey(report.getService().toString())){
|
||||
datas.put(report.getService().toString(), datas.get(report.getService().toString())+report.getSum().longValue());
|
||||
if(dataMap.containsKey(report.getService())){
|
||||
dataMap.put(report.getService(), dataMap.get(report.getService())+report.getSum().longValue());
|
||||
}else{
|
||||
datas.put(report.getService().toString(),report.getSum().longValue());
|
||||
dataMap.put(report.getService(),report.getSum().longValue());
|
||||
}
|
||||
}
|
||||
for(Entry<Integer, Long> e:dataMap.entrySet()) {
|
||||
Map<String, Object> _data=new HashMap<>();
|
||||
_data.put("service", e.getKey());
|
||||
_data.put("sum", e.getValue());
|
||||
datas.add(_data);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -66,32 +66,7 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
$(".service").each(function(){
|
||||
var target=$(this).find("span");
|
||||
var action=$(this).data("action");
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:'${ctx}/report/ajaxNtcServiceReport',
|
||||
data:{
|
||||
"action":action,
|
||||
"functionId":$("#functionId").val(),
|
||||
"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);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
ajaxServiceLogTotal();
|
||||
$("#export-btn").click(function(){
|
||||
var te = $(".in table").tableExport({
|
||||
headings:true,
|
||||
@@ -126,7 +101,54 @@
|
||||
$("#reportTypeDiv").append('<input id="intype" name="reportTime" class="form-control input-medium Wdate" type="text" value="' + reportTime.substring(0, 4) + '" readonly="readonly" onclick=WdatePicker({dateFmt:"yyyy",isShowClear:true});>');
|
||||
}
|
||||
}
|
||||
|
||||
var ajaxServiceLogTotal=function(){
|
||||
var services=[];
|
||||
var objs=[];
|
||||
$(".service").each(function(){
|
||||
objs.push($(this));
|
||||
services.push($(this).data("service"));
|
||||
});
|
||||
var timeout=$.validator.messages.timeout;
|
||||
var failed=$.validator.messages.failed;
|
||||
$.ajax({
|
||||
type:'post',
|
||||
timeout:10000,//超时时间设置,查询接口时间过长超时
|
||||
url:'${ctx}/report/ajaxNtcServiceReport',
|
||||
data:{
|
||||
"services":services.join(","),
|
||||
"functionId":$("#functionId").val(),
|
||||
"reportType":$('[name="reportType"]').val(),
|
||||
"reportTime":$('[name="reportTime"]').val()
|
||||
},
|
||||
dataType:'json',
|
||||
async:true,
|
||||
success:function(data,textStatus){//处理返回结果
|
||||
if(textStatus=="success"){
|
||||
for(var i=0;i<services.length;i++){
|
||||
var target=objs[i].find("span");
|
||||
for(var da in data){
|
||||
if(data[da].service==services[i]){
|
||||
target.html(data[da].sum);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
complete:function(XMLHttpRequest,status){//超时设置
|
||||
if(status=="timeout"){
|
||||
for(var i=0;i<services.length;i++){
|
||||
var target=objs[i].find("span");
|
||||
target.html(timeout);
|
||||
}
|
||||
}else if(status !="success"){
|
||||
for(var i=0;i<services.length;i++){
|
||||
var target=objs[i].find("span");
|
||||
target.html(failed);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
var ajaxReport=function(url,target){
|
||||
loading('<spring:message code="onloading"/>');
|
||||
$.ajax({
|
||||
@@ -193,7 +215,7 @@ function customColumnClick(){
|
||||
<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 data-action="${service.action}" class="service btn
|
||||
<div data-service="${service.serviceId}" 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}"/>
|
||||
|
||||
Reference in New Issue
Block a user