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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
package cn.ksource.web.controller.uc;
 
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
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.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.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
 
import cn.ksource.beans.SC_PARTNER_CUSTOMER_INFO;
import cn.ksource.beans.SC_WORKFLOW_INCIDENT;
import cn.ksource.core.page.PageInfo;
import cn.ksource.core.util.ConvertUtil;
import cn.ksource.core.util.DateUtil;
import cn.ksource.core.util.DownloadUtil;
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.uc.order.UcIncidentFacade;
import cn.ksource.web.service.DataDictionaryService;
/**
 * 用户中心--事件管理控制器
 * @note:
 * @version
 * @author sxj
 * @date July 15, 2016 10:35:44 AM
 */
@Controller
@RequestMapping("/uc/ucincident")
public class UcIncidentController {
    
    @Resource(name="ucIncidentFacade")
    private UcIncidentFacade ucIncidentFacade;
    
    @Autowired
    private DataDictionaryService dataDictionaryService;
    
    /**
     * 所有事件页面
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value="ucincidentList.html", method=RequestMethod.GET)
    public ModelAndView incidentList(HttpServletRequest request, HttpServletResponse response) {
        ModelAndView view = new ModelAndView("/uc/incident/ucincidentList");
        String  cusId = WebUtil.getWebLoginUserCusId(request);
        //查询工单数量,通过类型判断查询那种类型的数量
        Map msgCount = ucIncidentFacade.queryIncidentCount(cusId);
        System.out.println(JsonUtil.map2Json(msgCount));
        
        view.addObject("c", msgCount);
        
        
        //查询事件类型数据字典
        List types = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.INCIDENT_TYPE);
        
        view.addObject("types", types);
        //查询该加盟商的事件优先级
        List<Map> eventPri = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.EVENT_PRI);
        view.addObject("eventPri", eventPri);
        //查询事件影响度数据字典
        List<Map> eventDg = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.EVENT_EFFECT_DG);
        view.addObject("eventDg", eventDg);
        
        return view;
    }
    
    /**
     * 跳转到服务目录
     */
    @RequestMapping("ucordersl.html")
    public ModelAndView serviceListTree(HttpServletRequest request,HttpServletResponse response) {
        ModelAndView view = new ModelAndView("/uc/incident/ucordersl");
        String cusId = WebUtil.getWebLoginUserCusId(request);
        String sl = request.getParameter("sl");
        Map trees = ucIncidentFacade.serviceListTree(cusId,sl);
        List tree = (List)trees.get("categoryList");
        Map<String,String> slMap = (Map<String,String>)trees.get("slMap");
        
        List checkSl = new ArrayList();
        if(null!=slMap && slMap.size()>0) {
            for (Map.Entry<String, String> entry : slMap.entrySet()) {  
                String key = entry.getKey();
                String value = entry.getValue();
                Map map = new HashMap();
                map.put("checkId", key);
                map.put("checkName", value);
                checkSl.add(map);
            }
        }
        view.addObject("trees", tree);
        view.addObject("checkSl", checkSl);
        return view;
    }
    
    /**
     * 查询工单列表
     */
    @RequestMapping(value="ucincidentData.html",method=RequestMethod.POST)
    public ModelAndView qdata(HttpServletRequest request,PageInfo pageInfo) {
        ModelAndView modelAndView = new ModelAndView("/uc/incident/ucincidentData");
        Map<String,String> params = ParamsMapUtil.getParameterMap(request);
        String cusId = WebUtil.getWebLoginUserCusId(request);
        params.put("cusId", cusId);
        PageInfo list = ucIncidentFacade.queryIncidentOrderList(pageInfo,params);
        modelAndView.addObject("orderList", list);
        return modelAndView;
    }
    
    
    
    /**
     * 查询工单总数量
     */
    @RequestMapping(value="ucincidentCount.html",method=RequestMethod.POST)
    public void qcount(HttpServletRequest request,HttpServletResponse response) {
        Map<String,String> params = ParamsMapUtil.getParameterMap(request);
        String cusId = WebUtil.getWebLoginUserCusId(request);
        params.put("cusId", cusId);
        int count = ucIncidentFacade.queryIncidentOrderCount(params);
        WebUtil.write(response, String.valueOf(count));
    }
    
    /**
     * 跳转到订单查看页面
     */
    @RequestMapping("ucincidentDetail.html")
    public ModelAndView incidentDetail(HttpServletRequest request,HttpServletResponse response) {
        ModelAndView modelAndView = new ModelAndView("/uc/incident/ucincidentDetail");
        
        //查询事件基本信息
        String orderId = request.getParameter("orderId");
        String flowId = request.getParameter("flowId");
        
        if(StringUtil.notEmpty(orderId) && !StringUtil.notEmpty(flowId)) {
            SC_WORKFLOW_INCIDENT incident = new SC_WORKFLOW_INCIDENT(orderId).getInstanceById();
            flowId = incident.getFlow_id();
        }
        
        //通过工单编号查询工单基本信息
        Map baseMsg = ucIncidentFacade.queryIncidentBaseMsg(orderId);
        
        modelAndView.addObject("baseMsg", baseMsg);
        modelAndView.addObject("orderId", orderId);
        modelAndView.addObject("flowId", flowId);
        
        
        
        //查询要求响应时间和实际响应时间
        long create_time = ConvertUtil.obj2Long(baseMsg.get("CREATE_TIME"));
        
        String answer_time = ConvertUtil.obj2StrBlank(baseMsg.get("ANSWER_TIME"));
        if(!StringUtil.notEmpty(answer_time)) {
            answer_time =  DateUtil.getCurrentDate14().toString();
        }
        String request_answer_time = ConvertUtil.obj2StrBlank(baseMsg.get("REQUEST_ANSWER_TIME"));
        String answer_timeout = ConvertUtil.obj2StrBlank(baseMsg.get("ANSWER_TIMEOUT"));
        //计算第一次响应时间和创建事件的事件差 将时间差转化为分钟
        long seconds = DateUtil.getSecondsFormDate2Date(create_time, ConvertUtil.obj2Long(answer_time));
        
        //将秒转化为分钟
        double sjxysj = NumberUtil.div(ConvertUtil.obj2Double(seconds), ConvertUtil.obj2Double(60), 1);
        
        baseMsg.put("sjxysj", sjxysj);
        
        
        if(answer_timeout.equals("2")) {
            //计算时间走动长度
            double a1 = NumberUtil.mul(ConvertUtil.obj2Double(seconds), ConvertUtil.obj2Double(250));
            double a2 = NumberUtil.mul(ConvertUtil.obj2Double(request_answer_time), ConvertUtil.obj2Double(60));
            
            double xyWidth = NumberUtil.div(a1, a2);
            if(xyWidth>250) {
                xyWidth = 250;
                baseMsg.put("ANSWER_TIMEOUT", 1);
            }
            baseMsg.put("xyWidth", xyWidth);
        } else {
            baseMsg.put("xyWidth", 250);
        }
        
        
        
        //处理超时操作
        //1.判断当前工单有没有解决时间,如果有解决时间 说明已完成,如果没有解决时间 说明未完成 
        String resolveTime = ConvertUtil.obj2StrBlank(baseMsg.get("RESOLVE_TIME"));
        if(!StringUtil.notEmpty(resolveTime)) {
            resolveTime = DateUtil.getCurrentDate14().toString();
        }
        
        
        //计算实际用了多长时间
        String request_deal_time = ConvertUtil.obj2StrBlank(baseMsg.get("REQUEST_DEAL_TIME"));
        String deal_timeout = ConvertUtil.obj2StrBlank(baseMsg.get("DEAL_TIMEOUT"));
        
        //计算第解决时间和创建事件的事件差 将时间差转化为小时
        long jjSeconds = DateUtil.getSecondsFormDate2Date(create_time, ConvertUtil.obj2Long(resolveTime));
        
        //将秒转化为小时
        double sjjjsj = NumberUtil.div(ConvertUtil.obj2Double(jjSeconds), ConvertUtil.obj2Double(3600), 2);
        
        baseMsg.put("sjjjsj", sjjjsj);
        
        
        
        if(deal_timeout.equals("2")) {
            //计算时间走动长度
            double a1 = NumberUtil.mul(ConvertUtil.obj2Double(jjSeconds), ConvertUtil.obj2Double(250));
            double a2 = NumberUtil.mul(ConvertUtil.obj2Double(request_deal_time), ConvertUtil.obj2Double(3600));
            
            double jjWidth = NumberUtil.div(a1, a2);
            if(jjWidth>250) {
                jjWidth = 250;
                baseMsg.put("DEAL_TIMEOUT", 1);
            }
            baseMsg.put("jjWidth", jjWidth);
        } else {
            baseMsg.put("jjWidth", 250);
        }
        
        
        
        /*List<Map> lzs = incidentFacade.incidentLzRecord(flowId);
        modelAndView.addObject("lzs", lzs);*/
        
        return modelAndView;
    }
    
    /**
     * 查看流转记录
     */
    @RequestMapping("viewLcRecord.html")
    public ModelAndView viewLcRecord(HttpServletRequest request) {
        ModelAndView modelAndView = new ModelAndView("/uc/incident/viewLcRecord");
        String flowId = request.getParameter("flowId");
        List<Map> lzs = ucIncidentFacade.incidentLzRecord(flowId);
        modelAndView.addObject("lzs", lzs);
        return modelAndView;
    }
    
    
    /**
     * 查看处理记录
     */
    @RequestMapping("viewRecord.html")
    public ModelAndView viewRecord(HttpServletRequest request,HttpServletResponse response) {
        ModelAndView modelAndView = new ModelAndView("/uc/incident/viewRecord");
        String flowId = request.getParameter("flowId");
        List records = new ArrayList();
        if(StringUtil.notEmpty(flowId)) {
            records = ucIncidentFacade.queryDealRecord(flowId);
            System.out.println(JsonUtil.list2Json(records));
            modelAndView.addObject("records",records);
        }
        return modelAndView;
    }
    
    /**
     * 查看关联设备
     */
    @RequestMapping("viewDevice.html")
    public ModelAndView viewDevice(HttpServletRequest request,HttpServletResponse response) {
        ModelAndView modelAndView = new ModelAndView("/uc/incident/viewDevice");
        //查询关联设备
        String orderId = request.getParameter("orderId");
        String flowId = request.getParameter("flowId");
        List devices = ucIncidentFacade.queryDevices(flowId);
        modelAndView.addObject("devices", devices);
        return modelAndView;
    }
    
    
    /**
     * 查看关联工单
     */
    @RequestMapping("viewOrder.html")
    public ModelAndView viewOrder(HttpServletRequest request,HttpServletResponse response) {
        ModelAndView modelAndView = new ModelAndView("/uc/incident/viewOrder");
        
        //查询关联工单
        String flowId = request.getParameter("flowId");
        List orders = ucIncidentFacade.queryOrders(flowId);
        modelAndView.addObject("orders", orders);
        return modelAndView;
    }
    
    
    /**
     * 查询关联附件
     */
    @RequestMapping("viewFile.html")
    public ModelAndView viewFile(HttpServletRequest request,HttpServletResponse response) {
        ModelAndView modelAndView = new ModelAndView("/uc/incident/viewFile");
        //查询所有的文档附件
        String flowId = request.getParameter("flowId");
        List files = ucIncidentFacade.queryFiles(flowId);
        modelAndView.addObject("files", files);
        return modelAndView;
    }
    
    /**
     * 工单完成时的事件处理报告
     */
    @RequestMapping("finishReport.html")
    public ModelAndView wcReport(HttpServletRequest request) {
        ModelAndView modelAndView = new ModelAndView("/uc/incident/finishReport");
        String orderId = request.getParameter("orderId");
        Map report = ucIncidentFacade.queryWcReport(orderId);
        modelAndView.addObject("report", report);
        return modelAndView;
    }
    
    
    /**
     * 工单关闭时的事件处理报告
     */
    @RequestMapping("closeReport.html")
    public ModelAndView closeReport(HttpServletRequest request) {
        ModelAndView modelAndView = new ModelAndView("/uc/incident/closeReport");
        String orderId = request.getParameter("orderId");
        Map report = ucIncidentFacade.queryCloseReport(orderId);
        modelAndView.addObject("report", report);
        return modelAndView;
    }
    
    /**
     * 下载文件
     */
    @RequestMapping("downloadFile.html")
    public void downloadFile(HttpServletRequest request,HttpServletResponse response) {
        String fileId = request.getParameter("fileId");
        Map fileMsg = ucIncidentFacade.queryFileMsg(fileId);
        if(null!=fileMsg && fileMsg.size()>0) {
            String fileName = ConvertUtil.obj2StrBlank(fileMsg.get("FILE_NAME"));
            String filePath = ConvertUtil.obj2StrBlank(fileMsg.get("FILE_PATH"));
            String basePath = request.getSession().getServletContext().getRealPath("");
            System.out.println("path------------------------>"+basePath+filePath);
            File file = new File(basePath+filePath);
            try {
                DownloadUtil.download(response, file, fileName, false);
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    }
 
    
    /**
     * 事件服务台首页
     * @param model
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value="ucIncidentManageIndex.html")
    public String ucIncidentManageIndex(Model model,HttpServletRequest request,HttpServletResponse response){
        String cusId = WebUtil.getWebLoginUserCusId(request);
        if(StringUtil.isNotBlank(cusId)){
            model.addAttribute("cusId", cusId);
        }
        return "/uc/incident/ucIncidentManageIndex";
    }
    
    /**
     * 事件服务台首页明细加载
     * @param model
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value="ucIncidentManageIndexLoad.html")
    public String incidentManageIndexLoad(Model model,HttpServletRequest request,HttpServletResponse response){
        String cusId = WebUtil.getWebLoginUserCusId(request);
        Map<String,String> params = ParamsMapUtil.getParameterMap(request);
        params.put("cusId", cusId);
        
        //工单池数量
        int poolCount = ucIncidentFacade.incidentpoolCount(params); 
        //已超时
        int timeoutCount = ucIncidentFacade.queryincidentTimeoutCount(params);
        //待处理数量
        int pendingCount = ucIncidentFacade. queryincidentOrderNodeCount(params); 
        //进行中数量
        int inHandCount = ucIncidentFacade.queryincidentJxzCount(params); 
        
        
        model.addAttribute("poolCount",poolCount);
        model.addAttribute("timeoutCount",timeoutCount);
        model.addAttribute("pendingCount",pendingCount);
        model.addAttribute("inHandCount",inHandCount);
        return "/uc/incident/ucIncidentManageIndexLoad";
    }
    
    /**
     * 查询最近一月事件数量
     * @param request
     * @param response
     */
    @RequestMapping(value="getIncidentSumLineChart.html")
    public void getIncidentSumLineChart(HttpServletRequest request,HttpServletResponse response){
        Map info = ucIncidentFacade.getLastMonthIncidentCount(request);
        WebUtil.write(response, JsonUtil.map2Json(info));
    }
    /**
     * 查询最近一月事件级别分析
     * @param request
     * @param response
     */
    @RequestMapping(value="getIncidentLvPieChart.html")
    public void getIncidentLvPieChart(HttpServletRequest request,HttpServletResponse response){
        Map info = ucIncidentFacade.getLastMonthIncidentLv(request);
        WebUtil.write(response, JsonUtil.map2Json(info));
    } 
    
    /**
     * 查询最近一月事件优先级分析
     * @param request
     * @param response
     */
    @RequestMapping(value="getIncidentPriPieChart.html")
    public void getIncidentPriPieChart(HttpServletRequest request,HttpServletResponse response){
        Map info = ucIncidentFacade.getLastMonthIncidentPri(request);
        WebUtil.write(response, JsonUtil.map2Json(info));
    } 
    
    /**
     * 查询最近一月事件影响度分析
     * @param request
     * @param response
     */
    @RequestMapping(value="getIncidentEffectPieChart.html")
    public void getIncidentEffectPieChart(HttpServletRequest request,HttpServletResponse response){
        Map info = ucIncidentFacade.getLastMonthIncidentEffect(request);
        //System.out.println("json--------------------------"+JsonUtil.map2Json(info));
        WebUtil.write(response, JsonUtil.map2Json(info));
    } 
    
    /**
     * 查询最近一月服务目录事件数量
     * @param request
     * @param response
     */
    @RequestMapping(value="getIncidentServerLineChart.html")
    public void getIncidentServerLineChart(HttpServletRequest request,HttpServletResponse response){
        Map info = ucIncidentFacade.getLastMonthIncidentServer(request);
        WebUtil.write(response, JsonUtil.map2Json(info));
    }
    
    /**
     * 所有工单池
     */
    @RequestMapping("ucincidentpool.html")
    public ModelAndView incidentpool(HttpServletRequest request,HttpServletResponse response) {
        ModelAndView modelAndView = new ModelAndView("/uc/incident/ucincidentpool");
        String cusId = WebUtil.getWebLoginUserCusId(request);
        //查询工单数量,通过类型判断查询那种类型的数量
        Map msgCount = ucIncidentFacade.queryincidentpoolCount(cusId);
        
        System.out.println(JsonUtil.map2Json(msgCount));
        
        modelAndView.addObject("c", msgCount);
        //查询工单类型
        Map<String, String> state = Constants.mapWORKFLOW_BASE_BUSINESS_TYPE;
        List ways = new ArrayList();
        for (Map.Entry<String, String> entry : state.entrySet()) {  
            String key = entry.getKey();
            String value = entry.getValue();
            Map map = new HashMap();
            map.put("typeId", key);
            map.put("typeName", value);
            ways.add(map);
        }
        modelAndView.addObject("types", ways);
        
        return modelAndView;
    }
    
    
    /**
     * 查询工单池数据
     */
    @RequestMapping("ucincidentpoolData.html")
    public ModelAndView incidentpoolData(HttpServletRequest request,PageInfo pageInfo) {
        ModelAndView modelAndView = new ModelAndView("/uc/incident/ucincidentpoolData");
        String cusId = WebUtil.getWebLoginUserCusId(request);
        Map<String,String> params = ParamsMapUtil.getParameterMap(request);
        params.put("cusId", cusId);
        PageInfo orderList = ucIncidentFacade.incidentpoolData(pageInfo,params);
        
        modelAndView.addObject("orders", orderList);
        return modelAndView;
    }
    
    /**
     * 查询工单池数据
     */
    @RequestMapping("ucincidentpoolCount.html")
    public void incidentpoolCount(HttpServletRequest request,HttpServletResponse response) {
        String cusId = WebUtil.getWebLoginUserCusId(request);
        Map<String,String> params = ParamsMapUtil.getParameterMap(request);
        params.put("cusId", cusId);
        int count = ucIncidentFacade.incidentpoolCount(params);
        WebUtil.write(response, String.valueOf(count));
    }
    
    /**
     * 待响应列表页面
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value="ucincidentNodeList.html", method=RequestMethod.GET)
    public ModelAndView incidentNodeList(HttpServletRequest request, HttpServletResponse response) {
        ModelAndView view = new ModelAndView("/uc/incident/ucincidentNodeList");
        String cusId = WebUtil.getWebLoginUserCusId(request);
        //查询工单数量,通过类型判断查询那种类型的数量
        Map msgCount = ucIncidentFacade.queryincidentNodeCount(cusId);
        
        System.out.println(JsonUtil.map2Json(msgCount));
        
        view.addObject("c", msgCount);
        //查询事件类型数据字典
        List types = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.INCIDENT_TYPE);
        
        view.addObject("types", types);
        
        //查询该加盟商的事件优先级
        List<Map> eventPri = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.EVENT_PRI);
        view.addObject("eventPri", eventPri);
        //查询事件影响度数据字典
        List<Map> eventDg = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.EVENT_EFFECT_DG);
        view.addObject("eventDg", eventDg);
        
        
        return view;
    }
    
    
    /**
     * 查询工单列表数据
     */
    @RequestMapping(value="ucincidentNodeData.html",method=RequestMethod.POST)
    public ModelAndView incidentNodeData(HttpServletRequest request,PageInfo pageInfo) {
        ModelAndView modelAndView = new ModelAndView("/uc/incident/ucincidentNodeData");
        String cusId = WebUtil.getWebLoginUserCusId(request);
        Map<String,String> params = ParamsMapUtil.getParameterMap(request);
        params.put("cusId", cusId);
        PageInfo list = ucIncidentFacade.queryincidentOrderNodeList(pageInfo,params);
        modelAndView.addObject("orderList", list);
        return modelAndView;
    }
    
    
    
    /**
     * 查询工单总数量
     */
    @RequestMapping(value="ucincidentNodeCount.html",method=RequestMethod.POST)
    public void incidentNodeCount(HttpServletRequest request,HttpServletResponse response) {
        String cusId = WebUtil.getWebLoginUserCusId(request);
        Map<String,String> params = ParamsMapUtil.getParameterMap(request);
        params.put("cusId", cusId);
        int count = ucIncidentFacade.queryincidentOrderNodeCount(params);
        WebUtil.write(response, String.valueOf(count));
    }
    
    /**
     * 待响应列表页面
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value="ucincidentJxzList.html", method=RequestMethod.GET)
    public ModelAndView incidentJxzList(HttpServletRequest request, HttpServletResponse response) {
        ModelAndView view = new ModelAndView("/uc/incident/ucincidentJxzList");
        String cusId = WebUtil.getWebLoginUserCusId(request);
        //查询工单数量,通过类型判断查询那种类型的数量
        Map msgCount = ucIncidentFacade.queryincidentJxzNodeCount(cusId);
        
        System.out.println(JsonUtil.map2Json(msgCount));
        
        view.addObject("c", msgCount);
        //查询事件类型数据字典
        List types = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.INCIDENT_TYPE);
        
        view.addObject("types", types);
        
        //查询该加盟商的事件优先级
        List<Map> eventPri = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.EVENT_PRI);
        view.addObject("eventPri", eventPri);
        //查询事件影响度数据字典
        List<Map> eventDg = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.EVENT_EFFECT_DG);
        view.addObject("eventDg", eventDg);
        return view;
    }
    
    
    
    /**
     * 查询进行中工单列表数据
     */
    @RequestMapping(value="ucincidentJxzData.html",method=RequestMethod.POST)
    public ModelAndView incidentJxzData(HttpServletRequest request,PageInfo pageInfo) {
        ModelAndView modelAndView = new ModelAndView("/uc/incident/ucincidentJxzData");
        String cusId = WebUtil.getWebLoginUserCusId(request);
        Map<String,String> params = ParamsMapUtil.getParameterMap(request);
        params.put("cusId", cusId);
        PageInfo list = ucIncidentFacade.queryincidentJxzList(pageInfo,params);
        modelAndView.addObject("orderList", list);
        return modelAndView;
    }
    
    
    
    /**
     * 查询进行中工单总数量
     */
    @RequestMapping(value="ucincidentJxzCount.html",method=RequestMethod.POST)
    public void incidentJxzCount(HttpServletRequest request,HttpServletResponse response) {
        String cusId = WebUtil.getWebLoginUserCusId(request);
        Map<String,String> params = ParamsMapUtil.getParameterMap(request);
        params.put("cusId", cusId);
        int count = ucIncidentFacade.queryincidentJxzCount(params);
        WebUtil.write(response, String.valueOf(count));
    }
    
    /**
     * 已超时列表页面
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value="ucincidentTimeoutList.html", method=RequestMethod.GET)
    public ModelAndView incidentTimeoutList(HttpServletRequest request, HttpServletResponse response) {
        ModelAndView view = new ModelAndView("/uc/incident/ucincidentTimeoutList");
        String cusId = WebUtil.getWebLoginUserCusId(request);
        //查询工单数量,通过类型判断查询那种类型的数量
        Map msgCount = ucIncidentFacade.queryincidentTimeoutCount(cusId);
        
        System.out.println(JsonUtil.map2Json(msgCount));
        
        view.addObject("c", msgCount);
        //查询事件类型数据字典
        List types = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.INCIDENT_TYPE);
        
        view.addObject("types", types);
        
        //查询该加盟商的事件优先级
        List<Map> eventPri = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.EVENT_PRI);
        view.addObject("eventPri", eventPri);
        //查询事件影响度数据字典
        List<Map> eventDg = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.EVENT_EFFECT_DG);
        view.addObject("eventDg", eventDg);
        return view;
    }
    
    /**
     * 已超时工单列表数据
     */
    @RequestMapping(value="ucincidentTimeoutData.html",method=RequestMethod.POST)
    public ModelAndView incidentTimeoutData(HttpServletRequest request,PageInfo pageInfo) {
        ModelAndView modelAndView = new ModelAndView("/uc/incident/ucincidentTimeoutData");
        String cusId = WebUtil.getWebLoginUserCusId(request);
        Map<String,String> params = ParamsMapUtil.getParameterMap(request);
        params.put("cusId", cusId);
        PageInfo list = ucIncidentFacade.queryincidentTimeoutList(pageInfo,params);
        modelAndView.addObject("orderList", list);
        return modelAndView;
    }
    
    
    
    /**
     * 查询已超时工单总数量
     */
    @RequestMapping(value="ucincidentTimeoutCount.html",method=RequestMethod.POST)
    public void incidentTimeoutCount(HttpServletRequest request,HttpServletResponse response) {
        String cusId = WebUtil.getWebLoginUserCusId(request);
        Map<String,String> params = ParamsMapUtil.getParameterMap(request);
        params.put("cusId", cusId);
        int count = ucIncidentFacade.queryincidentTimeoutCount(params);
        WebUtil.write(response, String.valueOf(count));
    }
    
    /**
     * 问题待响应列表页面
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value="ucincidentEndList.html", method=RequestMethod.GET)
    public ModelAndView incidentEndList(HttpServletRequest request, HttpServletResponse response) {
        ModelAndView view = new ModelAndView("/uc/incident/ucincidentEndList");
        //查询事件类型数据字典
        List types = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.INCIDENT_TYPE);
        
        view.addObject("types", types);
        
        //查询该加盟商的事件优先级
        List<Map> eventPri = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.EVENT_PRI);
        view.addObject("eventPri", eventPri);
        //查询事件影响度数据字典
        List<Map> eventDg = dataDictionaryService.getDataDictionaryByCategoryKey(Constants.EVENT_EFFECT_DG);
        view.addObject("eventDg", eventDg);
        view.addObject("type", request.getParameter("type"));
        return view;
    }
    
    
    
    /**
     * 查询问题工单列表数据
     */
    @RequestMapping(value="ucincidentEndData.html",method=RequestMethod.POST)
    public ModelAndView incidentEndData(HttpServletRequest request,PageInfo pageInfo) {
        ModelAndView modelAndView = new ModelAndView("/uc/incident/ucincidentEndData");
        String cusId = WebUtil.getWebLoginUserCusId(request);
        Map<String,String> params = ParamsMapUtil.getParameterMap(request);
        params.put("cusId", cusId);
        PageInfo list = ucIncidentFacade.queryincidentEndList(pageInfo,params);
        modelAndView.addObject("orderList", list);
        modelAndView.addObject("type", request.getParameter("type"));
        return modelAndView;
    }
    
    
    
    /**
     * 查询问题工单总数量
     */
    @RequestMapping(value="ucincidentEndCount.html",method=RequestMethod.POST)
    public void incidentEndCount(HttpServletRequest request,HttpServletResponse response) {
        String cusId = WebUtil.getWebLoginUserCusId(request);
        Map<String,String> params = ParamsMapUtil.getParameterMap(request);
        params.put("cusId", cusId);
        int count = ucIncidentFacade.queryincidentEndCount(params);
        WebUtil.write(response, String.valueOf(count));
    }
    
    /**
     * 跳转到当前客户的子客户页面
     */
    @RequestMapping("ucsubCus.html")
    public ModelAndView subCus(HttpServletRequest request,HttpServletResponse response) {
        ModelAndView modelAndView = new ModelAndView("/uc/incident/ucsubCus");
        
        String customerId = WebUtil.getWebLoginUser(request).getCustomerId();
        String subCustomerId = request.getParameter("subCustomerId");
        
        Map result = ucIncidentFacade.querySubCus(customerId,subCustomerId);
        
        
        List<Map> customers = (List<Map>)result.get("subs");
        List checkSl = (List)result.get("checks");
        
        //查询当前客户
        Map currCus = new SC_PARTNER_CUSTOMER_INFO(customerId).getBeanMapById();
        if(subCustomerId.equals(customerId)){
            currCus.put("checked", 1);
            Map map = new HashMap();
            map.put("checkId", currCus.get("ID"));
            map.put("checkName", currCus.get("CUSTOMER_NAME"));
            checkSl.add(map);
        }
        
        modelAndView.addObject("customers", customers);
        modelAndView.addObject("checkSl", checkSl);
        
        modelAndView.addObject("currCus", currCus);
        return modelAndView;
    }
    
}