package cn.ksource.web.controller.uc.ucstatis; import java.util.List; import java.util.Map; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import cn.ksource.core.util.ConvertUtil; import cn.ksource.core.util.DateUtil; import cn.ksource.core.util.JsonUtil; import cn.ksource.core.util.StringUtil; import cn.ksource.core.web.WebUtil; import cn.ksource.web.Constants; import cn.ksource.web.facade.customermanage.CustomerManageFacade; import cn.ksource.web.facade.tj.LocalStatisFacade; @Controller @RequestMapping("/uc/statis/local") public class UcStatisLocalController { @Resource private LocalStatisFacade localStatisFacade; @Resource private CustomerManageFacade customerFacade; /** * 统计模板 */ @RequestMapping("localTemplate.html") public ModelAndView localType(HttpServletRequest request,HttpServletResponse response) { ModelAndView modelAndView = new ModelAndView("/uc/statis/local/localTemplate"); //获取当前查询类型 String queryType = request.getParameter("queryType"); if(StringUtil.isBlank(queryType)){ queryType = "1"; } String focus = request.getParameter("focus"); if(StringUtil.isBlank(focus)){ focus = "LOCAL_TYPE"; } String charTitle = ""; if(queryType.equals("1")){ charTitle="驻场类型"; }else if(queryType.equals("2")){ charTitle="驻场来源"; }else if(queryType.equals("3")){ charTitle="驻场关闭方式"; }else if(queryType.equals("4")){ charTitle="驻场优先级"; }else if(queryType.equals("5")){ charTitle="驻场影响度"; }else if(queryType.equals("6")){ charTitle="驻场服务级别"; }else if(queryType.equals("7")){ charTitle="驻场响应超时"; }else if(queryType.equals("8")){ charTitle="驻场处理超时"; } //获取当前session中的客户信息 Map cus = customerFacade.getCusById(WebUtil.getWebLoginUserCusId(request)); modelAndView.addObject("cus", cus); long month = DateUtil.getCurrentDate6(); long monthFirstDate = ConvertUtil.obj2Long(month+"01"); String beginTime = DateUtil.format("yyyy-MM-dd", monthFirstDate); String endTime = DateUtil.getToday("yyyy-MM-dd"); modelAndView.addObject("beginTime", beginTime.replaceAll("-", "")); modelAndView.addObject("endTime", endTime.replaceAll("-", "")); int beginMonth = DateUtil.getYear(); String endMonth = DateUtil.getToday("yyyyMM"); modelAndView.addObject("beginMonth", beginMonth+"01"); modelAndView.addObject("endMonth", endMonth); modelAndView.addObject("queryType", queryType); modelAndView.addObject("focus", focus); modelAndView.addObject("charTitle", charTitle); return modelAndView; } /** * 查询驻场类型统计占比 */ @RequestMapping("localTemplatePie.html") public void localTemplatePie(HttpServletRequest request,HttpServletResponse response) { List attitude = localStatisFacade.localTypePie(request); WebUtil.write(response, JsonUtil.list2Json(attitude)); } /** * 查询驻场类型时间走势 */ @RequestMapping("localTemplateLine.html") public void localTemplateLine(HttpServletRequest request,HttpServletResponse response) { Map scoreLine = localStatisFacade.localTypeLine(request); WebUtil.write(response, JsonUtil.map2Json(scoreLine)); } /** * 驻场发生时间 * @param request * @param response * @return */ @RequestMapping("localHappenTime.html") public ModelAndView localRole(HttpServletRequest request,HttpServletResponse response) { ModelAndView modelAndView = new ModelAndView("/uc/statis/local/localHappenTime"); //获取当前session中的客户信息 Map cus = customerFacade.getCusById(WebUtil.getWebLoginUserCusId(request)); modelAndView.addObject("cus", cus); modelAndView.addObject("selDay", DateUtil.getCurrentDate8()); return modelAndView; } /** * 查询驻场类型时间走势 */ @RequestMapping("localHappenTimeLine.html") public void localHappenTimeLine(HttpServletRequest request,HttpServletResponse response) { Map scoreLine = localStatisFacade.localTimeLine(request); WebUtil.write(response, JsonUtil.map2Json(scoreLine)); } @RequestMapping("localTotalChartIndex.html") public ModelAndView localTotalChartIndex(HttpServletRequest request,HttpServletResponse response) { ModelAndView modelAndView = new ModelAndView("/uc/statis/local/localTotalChartIndex"); //获取当前session中的客户信息 Map cus = customerFacade.getCusById(WebUtil.getWebLoginUserCusId(request)); long month = DateUtil.getCurrentDate6(); long monthFirstDate = ConvertUtil.obj2Long(month+"01"); String beginTime = DateUtil.format("yyyy-MM-dd", monthFirstDate); String endTime = DateUtil.getToday("yyyy-MM-dd"); modelAndView.addObject("beginTime", beginTime.replaceAll("-", "")); modelAndView.addObject("endTime", endTime.replaceAll("-", "")); modelAndView.addObject("cus", cus); return modelAndView; } @RequestMapping("localTotalChart.html") public ModelAndView localTotalChart(HttpServletRequest request,HttpServletResponse response) { ModelAndView modelAndView = new ModelAndView("/uc/statis/local/localTotalChart"); //获取当前session中的客户信息 String cusId = WebUtil.getWebLoginUserCusId(request); String cusName = request.getParameter("cusName"); String beginTime = request.getParameter("beginDay"); String endTime = request.getParameter("endDay"); Map resMap = localStatisFacade.localTotalChart(cusId,cusName,beginTime,endTime); List typeList = (List)resMap.get("typeList"); List sourceList = (List)resMap.get("sourceList"); List closeList = (List)resMap.get("closeList"); List priList = (List)resMap.get("priList"); List effectList = (List)resMap.get("effectList"); List levelList = (List)resMap.get("levelList"); List timeoutList = (List)resMap.get("timeoutList"); List resolveList = (List)resMap.get("resolveList"); List stateList = (List)resMap.get("stateList"); List resList = (List)resMap.get("resList"); modelAndView.addObject("typeList",typeList); modelAndView.addObject("sourceList",sourceList); modelAndView.addObject("closeList",closeList); modelAndView.addObject("priList",priList); modelAndView.addObject("effectList",effectList); modelAndView.addObject("levelList",levelList); modelAndView.addObject("timeoutList",timeoutList); modelAndView.addObject("resolveList",resolveList); modelAndView.addObject("stateList",stateList); modelAndView.addObject("resList",resList); modelAndView.addObject("cusName",cusName); return modelAndView; } /** * 跳转到办公网络保修统计页面 * @param request * @return * @author 李云鹏 */ @RequestMapping("localStatisIndex.html") public ModelAndView incidentStatisIndex(HttpServletRequest request){ Map cus = customerFacade.getCusById(WebUtil.getWebLoginUserCusId(request)); ModelAndView modelAndView = new ModelAndView("/uc/statis/local/localStatisIndex"); long month = DateUtil.getCurrentDate6(); long monthFirstDate = ConvertUtil.obj2Long(month+"01"); String beginTime = DateUtil.format("yyyy-MM-dd", monthFirstDate); String endTime = DateUtil.getToday("yyyy-MM-dd"); modelAndView.addObject("beginTime", beginTime.replaceAll("-", "")); modelAndView.addObject("endTime", endTime.replaceAll("-", "")); modelAndView.addObject("cus", cus); return modelAndView; } /** * 办公网络保修统计 * @param request * @return * @author 李云鹏 */ @RequestMapping("localStatis.html") public ModelAndView incidentStatis(HttpServletRequest request){ ModelAndView modelAndView=new ModelAndView("/uc/statis/local/localStatis"); String cusId = WebUtil.getWebLoginUserCusId(request); String beginTime = request.getParameter("beginDay"); String endTime = request.getParameter("endDay"); String subCustomerId=request.getParameter("sub_customer_id"); String wfstate=""; List incidentList=localStatisFacade.queryLocalIncidentStatis(cusId,subCustomerId,beginTime,endTime,wfstate,""); if(incidentList!=null && incidentList.size()>0){ for(Map map:incidentList){ map.put("STATE", Constants.getWORKFLOW_BASE_WFSTATE_Label((map.get("STATE").toString()))); } } modelAndView.addObject("incidentList",incidentList); modelAndView.addObject("beginTime",request.getParameter("beginDay")); modelAndView.addObject("endTime",request.getParameter("endDay")); modelAndView.addObject("cusName",request.getParameter("cusName")); return modelAndView; } }