zhuguifei
2026-03-10 2c1fd10c6fbabb8e9f0e9f07fe66fb36c008e883
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
package com.shlanbao.tzsc.pms.equ.overhaul.controller;
 
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
 
import com.alibaba.fastjson.JSON;
import com.shlanbao.tzsc.base.mapping.EqpSparePartsBean;
import com.shlanbao.tzsc.base.mapping.SysMaintenanceStaff;
import com.shlanbao.tzsc.data.runtime.netty.NettyServer;
import com.shlanbao.tzsc.init.BaseParams;
import com.shlanbao.tzsc.pms.equ.sbglplan.beans.EquipmentsBean;
import com.shlanbao.tzsc.pms.md.shift.beans.ShiftBean;
import com.shlanbao.tzsc.pms.md.team.beans.TeamBean;
import org.jboss.netty.channel.Channel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
 
import com.shlanbao.tzsc.base.controller.BaseController;
import com.shlanbao.tzsc.base.mapping.EqmMaintain;
import com.shlanbao.tzsc.base.mapping.EqpRequestRecord;
import com.shlanbao.tzsc.base.model.Combobox;
import com.shlanbao.tzsc.base.model.DataGrid;
import com.shlanbao.tzsc.base.model.Json;
import com.shlanbao.tzsc.base.model.PageParams;
import com.shlanbao.tzsc.base.model.Tree;
import com.shlanbao.tzsc.pms.cos.spare.controller.InputFilesController;
import com.shlanbao.tzsc.pms.equ.overhaul.beans.EqmMaintainBean;
import com.shlanbao.tzsc.pms.equ.overhaul.service.EqmMaintainServiceI;
import com.shlanbao.tzsc.pms.md.FilterCount.SchFilterCountBean;
import com.shlanbao.tzsc.pms.sys.datadict.beans.SysEqpTypeBean;
import com.shlanbao.tzsc.utils.params.SysEqpTypeBase;
import com.shlanbao.tzsc.utils.tools.StringUtil;
 
/**
 * 设备检修项目维护控制器 包括添加,编辑,删除,查询设备项目维护
 * @author liuligong
 *
 */
@Controller
@RequestMapping("/pms/overhaul")
public class EqmMaintainController extends BaseController{
    @Autowired
    protected EqmMaintainServiceI eqmMaintainService;
    protected SysEqpTypeBase sysEqpTypeBase;
 
    @RequestMapping("/gotoMaintain")
    public String gotoMaintain()throws Exception{
        return "/pms/equ/overhaul/maintain";
    }
 
    @RequestMapping("/gotoMaintainAdd")
    public String gotoMaintainAdd()throws Exception{
        return "/pms/equ/overhaul/maintainAdd";
    }
 
    @ResponseBody
    @RequestMapping("/addMaintain")
    public Json addMaintain(EqmMaintainBean eqmMaintain)throws Exception{
        Json json = new Json();
        try {
            eqmMaintainService.addEqmMaintain(eqmMaintain);
            json.setMsg("操作成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            json.setMsg("操作失败!");
            json.setSuccess(false);
        }
        return json;
    }
 
    @ResponseBody
    @RequestMapping("/deleteMaintain")
    public Json deleteMaintain(String id)throws Exception{
        Json json = new Json();
        try {
            eqmMaintainService.deleteEqmMaintainById(id);
            json.setMsg("操作成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            json.setMsg("操作失败!");
            json.setSuccess(false);
        }
        return json;
    }
 
    @RequestMapping("/gotoMaintainEdit")
    public String gotoMaintainEdit(String id,HttpServletRequest request)throws Exception{
        request.setAttribute("bean", eqmMaintainService.getEqmMaintainById(id));
        return "/pms/equ/overhaul/maintainEdit";
    }
    @RequestMapping("/gotoMaintainEditSlove")
    public String gotoMaintainEditSlove(String id,HttpServletRequest request)throws Exception{
        request.setAttribute("bean", eqmMaintainService.getEqmMaintainById(id));
        return "/pms/equ/overhaul/maintainEditSolve";
    }
    @ResponseBody
    @RequestMapping("/editMaintain")
    public Json editMaintain(EqmMaintainBean eqmMaintain)throws Exception{
        Json json = new Json();
        try {
            eqmMaintainService.editEqmMaintain(eqmMaintain);
            json.setMsg("操作成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            json.setMsg("操作失败!");
            json.setSuccess(false);
        }
        return json;
    }
    @ResponseBody
    @RequestMapping("/queryMaintain")
    public DataGrid queryMaintain(EqmMaintainBean eqmMaintain,PageParams pageParams)throws Exception{
        try {
            DataGrid gd = eqmMaintainService.queryEqmMaintain(eqmMaintain, pageParams);
            return gd;
        } catch (Exception e) {
            log.error("查询设备检修项目数据异常。", e);
        }
        return null;
    }
    /**
     * 导入excel
     * @param file
     * @param request
     * @return
     */
    @RequestMapping("/inputExeclAndReadWrite")
    @ResponseBody
     public Json inputExeclAndReadWrite(@RequestParam(value = "importFile", required = false)
                                           MultipartFile file,HttpServletRequest request) {
            Json json = new Json();
            try {
            String path = request.getSession().getServletContext().getRealPath("upload");
            String fileName = file.getOriginalFilename();
            File targetFile = new File(path, fileName);
            if (!targetFile.exists()) {
                targetFile.mkdirs();
            }
                file.transferTo(targetFile);
            String url = path + "/" + fileName;
            String bm=fileName.substring( (fileName.lastIndexOf(".")+1) ,fileName.length());
            List<EqmMaintainBean> list =null;
            InputFilesController fl=new InputFilesController();
            if("xls".equals(bm)){
                list=fl.readXls2003_3(url);
            }else if("xlsx".equals(bm)){
                list=fl.readXlsx2007_3(url);
            }
            if(list!=null&&list.size()>0){
                    eqmMaintainService.inputExeclAndReadWrite(list);
                    json.setMsg("导入成功!");
                    json.setSuccess(true);
                }
            } catch (Exception e) {
                json.setMsg("导入失败!");
                json.setSuccess(false);
                e.printStackTrace();
            }
         return json;
    }
    /**
     * 更新备件的数量信息
     *
     */
    @RequestMapping("/updateSpareParts")
    @ResponseBody
    public void updateSpareParts(String all_id,String use_n,String all_num){
        eqmMaintainService.updateSpareParts(all_id, use_n,all_num);
    }
 
    //润滑部位下拉框
    @RequestMapping("/combobox")
    @ResponseBody
    public List<Combobox> combobox(String equipmentId){
        Map<String, String> retMap;
            Object o[] = code(equipmentId);
            String code=o[0].toString();
            String name=o[1].toString();
            try {
                retMap = sysEqpTypeBase.getDJBoxRoleAlls(code,name);
                List<Combobox> combox = new ArrayList<Combobox>();
                for (Map.Entry<String, String> entry : retMap.entrySet()) {
                        Combobox box = new Combobox();
                        box.setId(entry.getValue());
                        box.setName(entry.getKey());
                        System.out.println("key= " + entry.getKey() + " and value= " + entry.getValue());
                        combox.add(box);
                      }
                return combox;
                //String jsonf=JSONArray.fromObject(retMap).toString();
            } catch (UnsupportedEncodingException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        return null;
    }
 
    //根据设备ID查询code和设备NAME
    @RequestMapping("/code")
    @ResponseBody
    public Object[] code(String equipmentId){
        return eqmMaintainService.loadToRhBuWeiCode(equipmentId);
    }
 
    /**
     * @param stim
     * @param etim
     * @param pageParams
     * @return
     * @throws Exception
     * 查询设备维修呼叫记录
     */
    @ResponseBody
    @RequestMapping("/queryRepairCallInfo")
    public DataGrid queryRepairCallInfo(String stim,String etim,PageParams pageParams)throws Exception{
        try {
            DataGrid gd = eqmMaintainService.queryRepairCallInfo(stim,etim, pageParams);
            return gd;
        } catch (Exception e) {
            e.printStackTrace();
            log.error("查询设备维修呼叫记录异常。", e);
        }
        return null;
    }
    /**
     * 查询维修呼叫中备品备件更换记录
     * @return
     * @throws Exception
     */
    @ResponseBody
    @RequestMapping("/queryRepairChangeSparepartInfo")
    public DataGrid queryRepairChangeSparepartInfo(String id)throws Exception{
        try {
            DataGrid gd = eqmMaintainService.queryRepairChangeSparepartInfo(id);
            return gd;
        } catch (Exception e) {
            log.error("查询设备维修呼叫记录异常。", e);
        }
        return null;
    }
 
    /**
     * 维修记录反馈
     * @param id
     * @return
     */
    @ResponseBody
    @RequestMapping("/dasSendEquipmentWorkOrderResult")
    public Json sendMsg(String id){
        Json json=new Json();
        try {
            RestTemplate client = new RestTemplate();
            String url = "http://"+ BaseParams.LOCALADRESS+":8080/GF_LBDWS/wct/eqpMainCall/sendRepairRecordMsg.json";
            HttpHeaders headers = new HttpHeaders();
            headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
            MultiValueMap<String,String> map = new LinkedMultiValueMap<>();
            map.add("id",id);
            map.add("sts","1");
            HttpEntity<MultiValueMap<String,String>> request = new HttpEntity<>(map,headers);
            ResponseEntity<Json> res = client.postForEntity(url,request,Json.class);
 
            Json resJson = res.getBody();
            if (!resJson.isSuccess()){
                throw new RuntimeException(resJson.getMsg());
            }
            json.setSuccess(true);
            json.setMsg("反馈成功!");
        } catch (Exception e) {
            json.setMsg("反馈失败!");
        }
        return json;
    }
 
    /**
     * 受理维修请求
     * @param id
     * @return
     */
    @ResponseBody
    @RequestMapping("/acceptRequest")
    public Json acceptRequest(String id){
            return eqmMaintainService.acceptRequest(id);
    }
    /**
     * 结束维修请求
     * @param id
     * @return
     */
    @ResponseBody
    @RequestMapping("/finishRequest")
    public Json finishRequest(String id){
        return eqmMaintainService.finishRequest(id);
    }
 
    /**
     * 初始化故障数
     * @param id
     * @return
     */
    @ResponseBody
    @RequestMapping("/loadTroubleTree")
    public List<Tree>  loadTroubleTree(String id){
        return eqmMaintainService.loadTroubleTree(id);
    }
 
    /**
     * 添加故障信息
     * @param id
     * @return
     */
    @ResponseBody
    @RequestMapping("/addTroubleInfo")
    public Json  addTroubleInfo(String id,String mesId,String nodeId){
        return eqmMaintainService.addTroubleInfo(id,mesId,nodeId);
    }
 
 
    /**
     * 添加故障数接点
     * @param id
     * @param text
     * @return
     */
    @ResponseBody
    @RequestMapping("/addTroubleTreeNode")
    public Json  addTroubleTreeNode(String id,String text){
        return eqmMaintainService.addTroubleTreeNode(id,text);
    }
 
    /**
     * 编辑当前故障树节点
     * @param id
     * @param text
     * @return
     */
    @ResponseBody
    @RequestMapping("/editTroubleTreeNode")
    public Json  editTroubleTreeNode(String id,String text){
        return eqmMaintainService.editTroubleTreeNode(id,text);
    }
 
    /**
     * 删除节点
     * @param id
     * @return
     */
    @ResponseBody
    @RequestMapping("/deleteTroubleTreeNode")
    public Json  deleteTroubleTreeNode(String id){
        return eqmMaintainService.deleteTroubleTreeNode(id);
    }
 
    /**
     * 跳转到故障树编辑页面
     */
    @RequestMapping("/goToEditTroubleTreeNodeJSP")
    public String  goToEditTroubleTreeNodeJSP(String id,HttpServletRequest request){
        String txt=eqmMaintainService.goToEditTroubleTreeNodeJSP(id);
        request.setAttribute("text", txt);
        return "/pms/equ/trouble/addTroubleTreeNode";
    }
 
    /**
     * 查询备品备件
     * @return
     */
    @ResponseBody
    @RequestMapping("/chooseSparePart")
    public DataGrid  chooseSparePart(String desc,PageParams pageParam){
        return eqmMaintainService.chooseSparePart(desc,pageParam);
    }
 
    @ResponseBody
    @RequestMapping("/saveChooseSparePart")
    public Json  saveChooseSparePart(String callId,String id,String num){
        return eqmMaintainService.saveChooseSparePart(callId,id,StringUtil.convert2Float(num));
    }
 
    @RequestMapping("/goToEditJsp")
    public String goToEditJsp(HttpServletRequest request,String id){
        try {
            EqpRequestRecord record = eqmMaintainService.getCallInfoById(id);
            request.setAttribute("callInfo",record);
        } catch (Exception e) {
            log.error("获取ID:"+id+"的数据失败", e);
        }
        return "/pms/equ/trouble/edit";
    }
    @ResponseBody
    @RequestMapping("/editCallInfo")
    public Json editCallInfo(EqpRequestRecord requestRecord){
        Json json=new Json();
        try {
            eqmMaintainService.editCallInfo(requestRecord);
            json.setMsg("编辑成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            log.error(message, e);
            json.setMsg("编辑失败!");
        }
        return json;
    }
    @ResponseBody
    @RequestMapping("/addSparePart")
    public Json addSparePart(EqpSparePartsBean sparePartsBean){
        Json json=new Json();
        try {
            eqmMaintainService.addSparePart(sparePartsBean);
            json.setMsg("添加成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            log.error(message, e);
            json.setMsg("添加失败!");
        }
        return json;
    }
 
 
    @ResponseBody
    @RequestMapping("/editCallInfos")
    public Json editCallInfos(EqpRequestRecord requestRecord){
        //System.out.println(requestRecords);
        Json json=new Json();
        try {
            //for(EqpRequestRecord requestRecord : requestRecords){
                eqmMaintainService.editCallInfo(requestRecord);
            //}
 
            json.setMsg("编辑成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            log.error(message, e);
            json.setMsg("编辑失败!");
        }
        return json;
    }
 
    @RequestMapping("/goToAddRepairCall")
    public String goToAddRepairCall(){
        return "/pms/equ/overhaul/addRepairCall";
    }
 
    /**
     * 获得所有班次
     */
    @ResponseBody
    @RequestMapping("/getAllShifts")
    public List<ShiftBean> getAllShifts(){
        try {
            return eqmMaintainService.getAllShifts();
        } catch (Exception e) {
            log.error("查询所有班次异常", e);
        }
        return null;
    }
 
    /**
     * 获得所有班组
     */
    @ResponseBody
    @RequestMapping("/getAllTeams")
    public List<TeamBean> getAllTeams(){
        try {
            return eqmMaintainService.getAllTeams();
        } catch (Exception e) {
            log.error("查询所有班组异常", e);
        }
        return null;
    }
 
    /**
     * 获得所有设备
     */
    @ResponseBody
    @RequestMapping("/getAllEqus")
    public List<EquipmentsBean> getAllEqus(){
        try {
            return eqmMaintainService.getAllEqus();
        } catch (Exception e) {
            log.error("查询所有设备异常", e);
        }
        return null;
    }
 
    /**
     * 获得所有维修工
     */
    @ResponseBody
    @RequestMapping("/getAllStaff")
    public /*List<SysMaintenanceStaff>*/ Json getAllStaff(@RequestParam("eqpName") String eqpName){
        Json json = new Json();
        try {
            List<SysMaintenanceStaff> allStaff = eqmMaintainService.getAllStaff(eqpName);
            json.setSuccess(true);
            json.setObj(allStaff);
        } catch (Exception e) {
            log.error("查询所有维修工异常", e);
            json.setMsg(e.getMessage());
        }
        return json;
    }
 
    /**
     * @Description: 获得该故障详细类型的所有故障描述(故障描述按照出现次数倒叙排列)
     * @Param: [faultTypeDetail 故障详细类型]
     * @return: java.lang.String
     * @Author: sunzhen
     * @Date: 2019/10/29
     */
    @ResponseBody
    @RequestMapping("/getDescription")
    public String getDescription(@RequestParam("faultTypeDetail") String faultTypeDetail){
        try {
            String descriptions = eqmMaintainService.getDescription(faultTypeDetail);
            return descriptions;
        } catch (Exception e) {
            log.error("故障描述获取异常", e);
        }
        return null;
    }
 
    /**
     * 新增维修呼叫记录
     * @author sunzhen
     * @create 2019年9月26日上午9:19:48
     * @param eqpRequestRecord
     * @return
     */
    @ResponseBody
    @RequestMapping("/addRepairCall")
    public Json addRepairCall(EqpRequestRecord eqpRequestRecord){
        Json json = new Json();
        try {
            eqmMaintainService.addRepairCall(eqpRequestRecord);
            json.setSuccess(true);
            json.setMsg("操作成功!");
           /* //利用netty远程调用wct系统的维修呼叫推送(写在控制层是防止hibernate保存在缓存,wct那边查询不到该条记录)
            NettyServer nettyServer=NettyServer.getInstance();
            Channel nettyChannel = nettyServer.getNettyChannel();
            Map<String, String> map = new HashMap<>();
            map.put("pushMaintenanceCall",eqpRequestRecord.getId());
            String str = JSON.toJSONString(map);
            if(null==nettyChannel){
                json.setMsg("推送异常,Netty的连接为空");
            }else{
                nettyChannel.write(str);
            }*/
            RestTemplate client = new RestTemplate();
            String url = "http://"+ BaseParams.LOCALADRESS+":8080/GF_LBDWS/wct/eqpMainCall/pushMaintenanceCall.json";
            HttpHeaders headers = new HttpHeaders();
            headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
            MultiValueMap<String,String> map = new LinkedMultiValueMap<>();
            map.add("id",eqpRequestRecord.getId());
            HttpEntity<MultiValueMap<String,String>> request = new HttpEntity<>(map,headers);
            ResponseEntity<Json> res = client.postForEntity(url,request,Json.class);
 
            Json resJson = res.getBody();
            if (!json.isSuccess()){
                throw new RuntimeException(resJson.getMsg());
            }
 
        } catch (Exception e) {
            log.error("新增维修呼叫记录失败", e);
            json.setMsg(e.getMessage());
        }
        return json;
    }
 
    /**
     * 删除维修呼叫记录
     * @author sunzhen
     * @create 2019年9月26日上午21:58:48
     * @param id
     * @return
     */
    @ResponseBody
    @RequestMapping("/deleteRepairCall")
    public Json deleteRepairCall(String id){
        Json json = new Json();
        try {
            eqmMaintainService.deleteRepairCall(id);
            json.setSuccess(true);
            json.setMsg("操作成功!");
           /* //利用netty远程调用wct系统的维修呼叫推送
            NettyServer nettyServer=NettyServer.getInstance();
            Channel nettyChannel = nettyServer.getNettyChannel();
            Map<String, String> map = new HashMap<>();
            map.put("refresh","refresh");
            String str = JSON.toJSONString(map);
            if(null==nettyChannel){
                json.setMsg("推送异常,Netty的连接为空");
            }else{
                nettyChannel.write(str);
            }*/
 
            RestTemplate client = new RestTemplate();
            String url = "http://"+ BaseParams.LOCALADRESS+":8080/GF_LBDWS/wct/eqpMainCall/refreshMaintenanceCall.json";
            HttpHeaders headers = new HttpHeaders();
            headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
            MultiValueMap<String,String> map = new LinkedMultiValueMap<>();
            HttpEntity<MultiValueMap<String,String>> request = new HttpEntity<>(map,headers);
            ResponseEntity<Json> res = client.postForEntity(url,request,Json.class);
 
            Json resJson = res.getBody();
            if (!json.isSuccess()){
                throw new RuntimeException(resJson.getMsg());
            }
        } catch (Exception e) {
            log.error("删除维修呼叫记录失败", e);
            json.setMsg("删除维修呼叫记录失败");
        }
        return json;
    }
 
    /**
     * 批量删除维修呼叫记录
     * @author sunzhen
     * @create 2019年9月26日上午21:58:48
     * @param ids
     * @return
     */
    @ResponseBody
    @RequestMapping("/beatchDeleteRepairCall")
    public Json beatchDeleteRepairCall(String ids){
        Json json = new Json();
        try {
            eqmMaintainService.beatchDeleteRepairCall(ids);
            json.setSuccess(true);
            json.setMsg("操作成功!");
            /*//利用netty远程调用wct系统的维修呼叫推送
            NettyServer nettyServer=NettyServer.getInstance();
            Channel nettyChannel = nettyServer.getNettyChannel();
            Map<String, String> map = new HashMap<>();
            map.put("refresh","refresh");
            String str = JSON.toJSONString(map);
            if(null==nettyChannel){
                json.setMsg("推送异常,Netty的连接为空");
            }else{
                nettyChannel.write(str);
            }*/
            RestTemplate client = new RestTemplate();
            String url = "http://"+ BaseParams.LOCALADRESS+":8080/GF_LBDWS/wct/eqpMainCall/refreshMaintenanceCall.json";
            HttpHeaders headers = new HttpHeaders();
            headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
            MultiValueMap<String,String> map = new LinkedMultiValueMap<>();
            HttpEntity<MultiValueMap<String,String>> request = new HttpEntity<>(map,headers);
            ResponseEntity<Json> res = client.postForEntity(url,request,Json.class);
 
            Json resJson = res.getBody();
            if (!resJson.isSuccess()){
                throw new RuntimeException(resJson.getMsg());
            }
        } catch (Exception e) {
            log.error("批量删除维修呼叫记录失败", e);
            json.setMsg(e.getMessage());
        }
        return json;
    }
 
}