cy
2022-06-21 129904537f66509f97b285e7eb4f42b3dc349dd0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
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<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){
        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<Map> 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;
    }
    
}