package cn.ksource.web.controller.tj;
|
|
import cn.ksource.core.util.ConvertUtil;
|
import cn.ksource.core.util.DateUtil;
|
import cn.ksource.core.util.JsonUtil;
|
import cn.ksource.core.util.NumberUtil;
|
import cn.ksource.core.util.ParamsMapUtil;
|
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.IncidentStatisFacade;
|
import cn.ksource.web.facade.tj.LocalStatisFacade;
|
import cn.ksource.web.service.DataDictionaryService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.ui.Model;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.servlet.ModelAndView;
|
|
import javax.annotation.Resource;
|
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletResponse;
|
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
|
@Controller
|
@RequestMapping("/business/pages/tj/localStatis")
|
public class LocalStatisController {
|
|
@Resource
|
private LocalStatisFacade localStatisFacade;
|
|
@Resource
|
private CustomerManageFacade customerFacade;
|
@Autowired
|
private IncidentStatisFacade incidentStatisFacade;
|
@Autowired
|
private DataDictionaryService dataDictionaryService;
|
|
/**
|
* 统计模板
|
*/
|
@RequestMapping("localTemplate.html")
|
public ModelAndView localType(HttpServletRequest request,HttpServletResponse response) {
|
ModelAndView modelAndView = new ModelAndView("/business/pages/tj/localStatis/localTemplate");
|
return modelAndView;
|
}
|
|
/**
|
* 统计模板
|
*/
|
@RequestMapping("localzctj.html")
|
public ModelAndView localzctj(HttpServletRequest request,HttpServletResponse response) {
|
ModelAndView modelAndView = new ModelAndView("/business/pages/tj/localStatis/localzctj");
|
//获取当前查询类型
|
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中的客户信息
|
List cusList = customerFacade.getCusList();
|
modelAndView.addObject("cusList", cusList);
|
|
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("/business/pages/tj/localStatis/localHappenTime");
|
//获取当前session中的客户信息
|
List cusList = customerFacade.getCusList();
|
modelAndView.addObject("cusList", cusList);
|
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("/business/pages/tj/localStatis/localTotalChartIndex");
|
//获取当前session中的客户信息
|
List cusList = customerFacade.getCusList();
|
|
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("cusList", cusList);
|
return modelAndView;
|
}
|
|
|
@RequestMapping("localTotalChart.html")
|
public ModelAndView localTotalChart(HttpServletRequest request,HttpServletResponse response) {
|
ModelAndView modelAndView = new ModelAndView("/business/pages/tj/localStatis/localTotalChart");
|
//获取当前session中的客户信息
|
String cusId = request.getParameter("cusId");
|
String cusName = request.getParameter("cusName");
|
String beginTime = request.getParameter("beginDay");
|
String endTime = request.getParameter("endDay");
|
Map resMap = localStatisFacade.localTotalChart(cusId,cusName,beginTime,endTime);
|
List<Map> typeList = (List<Map>)resMap.get("typeList");
|
List<Map> sourceList = (List<Map>)resMap.get("sourceList");
|
List<Map> closeList = (List<Map>)resMap.get("closeList");
|
List<Map> priList = (List<Map>)resMap.get("priList");
|
List<Map> effectList = (List<Map>)resMap.get("effectList");
|
List<Map> levelList = (List<Map>)resMap.get("levelList");
|
List<Map> timeoutList = (List<Map>)resMap.get("timeoutList");
|
List<Map> resolveList = (List<Map>)resMap.get("resolveList");
|
List<Map> stateList = (List<Map>)resMap.get("stateList");
|
List<Map> resList = (List<Map>)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){
|
List cusList = customerFacade.getCusList();
|
ModelAndView modelAndView = new ModelAndView("/business/pages/tj/localStatis/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("cusList", cusList);
|
Map param=new HashMap();
|
param.put("type", "1");
|
List<Map> userList=incidentStatisFacade.getGcsList(param);
|
modelAndView.addObject("userList", userList);
|
//查询事件类型数据字典
|
List<Map> types = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.INCIDENT_TYPE);
|
modelAndView.addObject("types", types);
|
return modelAndView;
|
}
|
/**
|
* 办公网络保修统计
|
* @param request
|
* @return
|
* @author 李云鹏
|
*/
|
@RequestMapping("localStatis.html")
|
public ModelAndView incidentStatis(HttpServletRequest request){
|
ModelAndView modelAndView=new ModelAndView("/business/pages/tj/localStatis/localStatis");
|
String cusId = request.getParameter("cusId");
|
String beginTime = request.getParameter("beginDay");
|
String endTime = request.getParameter("endDay");
|
String subCustomerId=request.getParameter("sub_customer_id");
|
String wfstate=request.getParameter("wfstate");
|
String jjrId=request.getParameter("jjrId");
|
List<Map> incidentList=localStatisFacade.queryLocalIncidentStatis(cusId,subCustomerId,beginTime,endTime,wfstate,jjrId);
|
if(incidentList!=null && incidentList.size()>0){
|
for(Map map:incidentList){
|
//map.put("STATE", Constants.getmapSC_WORKFLOW_RELEASE_STATE(map.get("STATE").toString()));
|
//查询要求响应时间和实际响应时间
|
long create_time = ConvertUtil.obj2Long(map.get("CREATE_TIME"));
|
String answer_time = ConvertUtil.obj2StrBlank(map.get("ANSWER_TIME"));
|
if(!StringUtil.notEmpty(answer_time)) {
|
answer_time = DateUtil.getCurrentDate14().toString();
|
}
|
long seconds = DateUtil.getSecondsFormDate2Date(create_time, ConvertUtil.obj2Long(answer_time));
|
//将秒转化为分钟
|
double sjxysj = NumberUtil.div(ConvertUtil.obj2Double(seconds), ConvertUtil.obj2Double(60), 1);
|
double xycs=NumberUtil.sub(sjxysj, ConvertUtil.obj2Double(map.get("REQUEST_ANSWER_TIME")));
|
if(xycs>0){
|
map.put("xycssj", xycs);
|
}
|
//处理超时操作
|
//1.判断当前工单有没有解决时间,如果有解决时间 说明已完成,如果没有解决时间 说明未完成
|
String resolveTime = ConvertUtil.obj2StrBlank(map.get("RESOLVE_TIME"));
|
if(!StringUtil.notEmpty(resolveTime)) {
|
resolveTime = DateUtil.getCurrentDate14().toString();
|
}
|
//计算第解决时间和创建事件的事件差 将时间差转化为小时
|
long jjSeconds = DateUtil.getSecondsFormDate2Date(create_time, ConvertUtil.obj2Long(resolveTime));
|
//将秒转化为小时
|
double sjjjsj = NumberUtil.div(ConvertUtil.obj2Double(jjSeconds), ConvertUtil.obj2Double(3600), 2);
|
double clcssj=NumberUtil.sub(sjjjsj, ConvertUtil.obj2Double(map.get("REQUEST_DEAL_TIME")));
|
if(clcssj>0){
|
map.put("clcssj", clcssj);
|
}
|
}
|
}
|
if(incidentList!=null && incidentList.size()>0){
|
for(Map map:incidentList){
|
map.put("STATE", Constants.mapSC_WORKFLOW_INCIDENT_LOCAL_STATE_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;
|
}
|
/**
|
* 初始化页面数据
|
* @author gaofazhan
|
* @param request
|
* @param model
|
*/
|
private void initModel(HttpServletRequest request,Model model){
|
//获取当前session中的客户信息
|
List cusList = customerFacade.getCusList();
|
model.addAttribute("cusList", cusList);
|
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");
|
model.addAttribute("beginTime", beginTime.replaceAll("-", ""));
|
model.addAttribute("endTime", endTime.replaceAll("-", ""));
|
int beginMonth = DateUtil.getYear();
|
String endMonth = DateUtil.getToday("yyyyMM");
|
model.addAttribute("beginMonth", beginMonth+"01");
|
model.addAttribute("endMonth", endMonth);
|
}
|
/**
|
* 驻场事件达成率统计
|
*/
|
@RequestMapping("localStatisDcl.html")
|
public ModelAndView localStatisDcl(Model model,HttpServletRequest request) {
|
ModelAndView modelAndView = new ModelAndView("/business/pages/tj/localStatis/localStatisDcl");
|
initModel(request, model);
|
return modelAndView;
|
}
|
/**
|
* 跳转到驻场事件达成率信息页面
|
*/
|
@RequestMapping("localStatisDclStatis.html")
|
public ModelAndView incidentDclStatis(HttpServletRequest request) {
|
ModelAndView modelAndView = new ModelAndView("/business/pages/tj/localStatis/localStatisDclStatis");
|
String cusId = request.getParameter("cusId");
|
String beginTime = request.getParameter("beginTime");
|
String endTime = request.getParameter("endTime");
|
String subCustomerId = request.getParameter("sub_customer_id");
|
List<Map> reports = localStatisFacade.queryIncidentDclStatis(cusId,subCustomerId,beginTime,endTime);
|
|
modelAndView.addObject("reports", reports);
|
String cusName = request.getParameter("cusName");
|
modelAndView.addObject("cusName", cusName);
|
|
return modelAndView;
|
}
|
/**
|
* 驻场事件关闭原因
|
* @return
|
*/
|
@RequestMapping("localCloseReport.html")
|
public String localCloseReport(Model model,HttpServletRequest request){
|
initModel(request, model);
|
return "/business/pages/tj/localStatis/localCloseReport";
|
}
|
/**
|
* 驻场事件关闭原因数据
|
* @param model
|
* @param request
|
* @param response
|
* @return
|
*/
|
@RequestMapping("localCloseReportData.html")
|
public String localCloseReportData(Model model,HttpServletRequest request,HttpServletResponse response){
|
String cusId = request.getParameter("cusId");
|
String beginDay = request.getParameter("beginDay");
|
String endDay = request.getParameter("endDay");
|
Map report = localStatisFacade.queryCloseReport(cusId,beginDay,endDay);
|
model.addAttribute("report", report);
|
return "/business/pages/tj/localStatis/localCloseReportData";
|
}
|
/**
|
* 驻场事件类型
|
* @return
|
*/
|
@RequestMapping("localTypeReport.html")
|
public String incidentTypeReport(Model model,HttpServletRequest request){
|
initModel(request, model);
|
return "/business/pages/tj/localStatis/localTypeReport";
|
}
|
/**
|
* 驻场事件类型数据
|
* @param model
|
* @param request
|
* @param response
|
* @return
|
*/
|
@RequestMapping("localTypeReportData.html")
|
public String localTypeReportData(Model model,HttpServletRequest request,HttpServletResponse response){
|
String cusId = request.getParameter("cusId");
|
String beginDay = request.getParameter("beginDay");
|
String endDay = request.getParameter("endDay");
|
Map report = localStatisFacade.queryTypeReport(cusId,beginDay,endDay);
|
model.addAttribute("report", report);
|
return "/business/pages/tj/localStatis/localTypeReportData";
|
}
|
/**
|
* 驻场事件处理时长
|
* @return
|
*/
|
@RequestMapping("localDealTimeReport.html")
|
public String localDealTimeReport(Model model,HttpServletRequest request){
|
initModel(request, model);
|
return "/business/pages/tj/localStatis/localDealTimeReport";
|
}
|
@RequestMapping("localDealTimeReportData.html")
|
public String localDealTimeReportData(Model model,HttpServletRequest request,HttpServletResponse response){
|
String cusId = request.getParameter("cusId");
|
String beginDay = request.getParameter("beginDay");
|
String endDay = request.getParameter("endDay");
|
Map report = localStatisFacade.queryDealTimeReport(cusId,beginDay,endDay);
|
model.addAttribute("report", report);
|
return "/business/pages/tj/localStatis/localDealTimeReportData";
|
}
|
/**
|
* 驻场事件处理情况
|
* @return
|
*/
|
@RequestMapping("localDealSatuationReport.html")
|
public String localDealSatuationReport(Model model,HttpServletRequest request){
|
initModel(request, model);
|
return "/business/pages/tj/localStatis/localDealSatuationReport";
|
}
|
@RequestMapping("localDealSatuatioReportData.html")
|
public String localDealSatuatioReportData(Model model,HttpServletRequest request,HttpServletResponse response){
|
String cusId = request.getParameter("cusId");
|
String beginDay = request.getParameter("beginDay");
|
String endDay = request.getParameter("endDay");
|
Map report = localStatisFacade.queryDealSituationReport(cusId,beginDay,endDay);
|
model.addAttribute("report", report);
|
return "/business/pages/tj/localStatis/localDealSatuatioReportData";
|
}
|
/**
|
* 驻场事件处理情况
|
* @return
|
*/
|
@RequestMapping("localDealDayReport.html")
|
public String localDealDayReport(Model model,HttpServletRequest request){
|
initModel(request, model);
|
return "/business/pages/tj/localStatis/localDealDayReport";
|
}
|
@RequestMapping("localDealDayReportData.html")
|
public String localDealDayReportData(Model model,HttpServletRequest request,HttpServletResponse response){
|
Map param=ParamsMapUtil.getParameterMap(request);
|
Map report = localStatisFacade.queryDealDayReport(param);
|
model.addAttribute("report", report);
|
return "/business/pages/tj/localStatis/localDealDayReportData";
|
}
|
}
|