调整日志配置总量查询,整页配置只查询一次,减小资源浪费
This commit is contained in:
@@ -50,30 +50,46 @@ import net.sf.json.JsonConfig;
|
||||
public class NtcPzReportController extends BaseController{
|
||||
@RequestMapping(value="ajaxGetLogTotal",method=RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Map<String, Object> ajaxGetLogTotal(Model model,long endTime,int action,Integer functionId,Integer compileId){
|
||||
Map<String, Object> data=new HashMap<String, Object>();
|
||||
public List<Map<String, Object>> ajaxGetLogTotal(Model model,long endTime,String actions,Integer functionId,String compileIds){
|
||||
List<Map<String, Object>> dataList=new ArrayList<>();
|
||||
SimpleDateFormat sdf=new SimpleDateFormat(Constants.SEARCH_DATEFORMAT);
|
||||
int interval=Constants.LOG_TIME_RANGE;
|
||||
Date endDate=new Date(endTime);
|
||||
Date startDate=new Date(endTime-interval);
|
||||
int serviceId=0;
|
||||
String serviceIdsStr="";
|
||||
StringBuffer serviceIds=new StringBuffer();
|
||||
List<FunctionServiceDict> serviceList=DictUtils.getFunctionServiceDictList(functionId.intValue());
|
||||
for(FunctionServiceDict service:serviceList){
|
||||
if(service.getAction().intValue()==action){
|
||||
serviceId=service.getServiceId().intValue();
|
||||
break;
|
||||
for(String action:actions.split(",")) {
|
||||
for(FunctionServiceDict service:serviceList){
|
||||
if(service.getAction().intValue()==Integer.parseInt(action)){
|
||||
serviceIds.append(service.getServiceId().intValue());
|
||||
serviceIds.append(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
data.put("compileId", compileId.intValue());
|
||||
String json=ConfigServiceUtil.getReport(Constants.BUSINESSTYPE_CONFIG, String.valueOf(compileId), String.valueOf(serviceId), sdf.format(startDate), sdf.format(endDate));
|
||||
if(serviceIds.toString().endsWith(",")) {
|
||||
serviceIdsStr=serviceIds.toString().substring(0,serviceIds.toString().lastIndexOf(","));
|
||||
}
|
||||
String json=ConfigServiceUtil.getReport(Constants.BUSINESSTYPE_CONFIG, compileIds, serviceIdsStr, sdf.format(startDate), sdf.format(endDate));
|
||||
List<NtcPzReport> list=getList(json);
|
||||
if(list!=null&&list.size()>0){
|
||||
data.put("sum",list.get(0).getSum().longValue());
|
||||
String[] idArr=compileIds.split(",");
|
||||
if(list!=null&&(list.size()>0)){
|
||||
for(NtcPzReport report:list) {
|
||||
Map<String, Object> data=new HashMap<String, Object>();
|
||||
data.put("compileId", report.getCfgId().longValue());
|
||||
data.put("sum",report.getSum().longValue());
|
||||
dataList.add(data);
|
||||
}
|
||||
}else {
|
||||
data.put("sum", 0);
|
||||
for(String id:idArr) {
|
||||
Map<String, Object> data=new HashMap<String, Object>();
|
||||
data.put("compileId", id);
|
||||
data.put("sum",0);
|
||||
dataList.add(data);
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
return dataList;
|
||||
}
|
||||
@RequestMapping("/ntcPzReport")
|
||||
public String list(@ModelAttribute("bean") SearchReport bean,Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
Reference in New Issue
Block a user