zhuguifei
2026-03-10 58402bd5e762361363a0f7d7907153c77dbb819f
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
package com.shlanbao.tzsc.pms.sys.user.controller;
 
import java.text.ParseException;
import java.util.*;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
 
import com.shlanbao.tzsc.base.mapping.MdEquipment;
import com.shlanbao.tzsc.init.BaseParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSON;
import com.shlanbao.tzsc.base.controller.BaseController;
import com.shlanbao.tzsc.base.dao.SchStatFaultDaoI;
import com.shlanbao.tzsc.base.dao.SysUserDaoI;
import com.shlanbao.tzsc.base.mapping.SchStatFault;
import com.shlanbao.tzsc.base.mapping.SysModelPermis;
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.SessionInfo;
import com.shlanbao.tzsc.base.model.Tree;
import com.shlanbao.tzsc.pms.md.fixCode.beans.FixCodeBean;
import com.shlanbao.tzsc.pms.md.fixCode.service.FixCodeServiceI;
import com.shlanbao.tzsc.pms.qm.check.service.impl.QmCheckMassServiceImpl;
import com.shlanbao.tzsc.pms.qm.onlineCheck.bean.QMOnlineCheckBean;
import com.shlanbao.tzsc.pms.qm.onlineCheck.service.QMOnlineCheckService;
import com.shlanbao.tzsc.pms.qm.onlineCheck.service.impl.QmOnlineCheckServiceImpl;
import com.shlanbao.tzsc.pms.sys.org.service.OrgServiceI;
import com.shlanbao.tzsc.pms.sys.resource.service.ResourceServiceI;
import com.shlanbao.tzsc.pms.sys.role.beans.RoleBean;
import com.shlanbao.tzsc.pms.sys.role.service.RoleServiceI;
import com.shlanbao.tzsc.pms.sys.user.beans.UserBean;
import com.shlanbao.tzsc.pms.sys.user.service.ModelPermisServiceI;
import com.shlanbao.tzsc.pms.sys.user.service.UserServiceI;
import com.shlanbao.tzsc.pms.sys.user.service.schStatFaultServiceI;
import com.shlanbao.tzsc.utils.tools.MD5Util;
import com.shlanbao.tzsc.utils.tools.WebContextUtil;
 
import net.sf.json.JSONArray;
/**
 * 用户管理控制器
 * <li>@author Leejean
 * <li>@create 2014-6-27下午02:56:31
 */
@Controller
@RequestMapping("/pms/sysUser")
public class UserController extends BaseController{
    private static final ResourceBundle bundle = ResourceBundle.getBundle("config");
    @Autowired
    private UserServiceI userService;
    @Autowired
    private OrgServiceI orgService;
    @Autowired
    private ResourceServiceI resourceService;
    @Autowired
    private RoleServiceI roleService;
    
    @Autowired 
    private ModelPermisServiceI modelService;
    
    @Autowired
    private QMOnlineCheckService service;
    
    @Autowired
    private  FixCodeServiceI fixService;
    @Autowired
    private schStatFaultServiceI schService;
    
    /**
     * 首页
     * @author Leejean
     * @create 2014-8-14下午07:03:44
     * @return
     */
    @RequestMapping("/index")
    public String index(HttpServletRequest request){
        try {
            String pms_websocket = bundle.getString("pms_websocket");
            String wct_websocket = bundle.getString("wct_websocket");
            if(pms_websocket!=null){
                request.setAttribute("pms_websocket",pms_websocket);
            }
            if(wct_websocket!=null){
                request.setAttribute("wct_websocket",wct_websocket);
            }
 
            return "/pms/index";
        } catch (Exception e) {
            log.error(message, e);
        }
        return "/error/noResource";
    }
    /**
     * 退出
     * @author Leejean
     * @create 2014-8-14下午07:03:44
     * @return
     */
    @RequestMapping("/exit")
    public String exit(HttpSession session){
        try {
            session.invalidate();
            return "/pms/sys/user/login";
        } catch (Exception e) {
            log.error(message, e);
        }
        return "/error/noResource";
    }
    /**
     * 用户登录
     * @author Leejean
     * @create 2014-6-27下午03:00:36
     */
    @ResponseBody
    @RequestMapping("/login")
    public Json login(UserBean userBean,HttpSession session,HttpServletRequest request){
        Json json=new Json();
        try {
            userBean=userService.login(userBean);
            if(userBean!=null){
                String uid=userBean.getId();
                json.setMsg("登录成功!");
                json.setSuccess(true);
                
                SessionInfo sessionInfo=new SessionInfo();
                sessionInfo.setUser(userBean);
                sessionInfo.setIp(WebContextUtil.getRemoteIp(request));
                //得到用户的机构
                List<Tree> organizations=orgService.getOrgsByUser(userBean.getId());
                sessionInfo.setOrganizations(JSON.toJSONString(organizations));
                
                //得到用户的角色
                List<RoleBean> roles=roleService.getRolesByUser(uid);
                sessionInfo.setRoles(roles);
                
                //得到用户的权限(显示成树,拥有的权限才会checked=true)
                List<Tree> resources = resourceService.getResByUser(uid);
                sessionInfo.setResources(JSON.toJSONString(resources));
                
                Map<String,String> resourcesMap = new HashMap<String,String>();
                for (Tree tree : resources) {
                    if(tree.isChecked()){
                        if(tree.getAttributes()!=null){
                            resourcesMap.put(tree.getAttributes().toString(),tree.getText() );
                        }
                            
                    }
                }
                sessionInfo.setResourcesMap(resourcesMap);
                
                WebContextUtil.saveObjToSession(session,"sessionInfo", sessionInfo,60*60*8);//保存8小时
                List <SysModelPermis> list = modelService.getDefaultSysModel(userBean.getId(), roles.get(0).getId());
                FixCodeBean fcb = new FixCodeBean();
                fcb.setUpcode("SYZSMK001");
                List<FixCodeBean> fixList = fixService.queryFixCode(fcb);
                if(list.size()<=0)
                {
                  if(fixList.size()>0){
                      for(int i=0;i<fixList.size();i++){
                          fcb = (FixCodeBean)fixList.get(i);
                          if("YZSMK0001001".equals(fcb.getType())){
                                SysModelPermis sp = new SysModelPermis();
                                sp.setRoleId(roles.get(0).getId());
                                sp.setUserId(userBean.getId());
                                sp.setMdFixCodeId(fcb.getId());
                                sp.setCreateTime(new Date());
                                sp.setRemark("默认添加");
                                modelService.insertDefaultSysModel(sp);
                          }
                        }  
                  }    
                    
                    
                }
            request.setAttribute("sysModelList", list);    
            request.setAttribute("fixList", fixList);    
            }else{
                json.setMsg("账号密码错误或该用户已被禁用,请重新登录!");
            }
        } catch (Exception e) {
            log.error("用户登录", e);
        }
        return json;
    }
 
    /**
     * 锁定用户登录
     * @author Leejean
     * @create 2014-7-10下午01:47:16
     */
    @ResponseBody
    @RequestMapping("/lockUser")
    public void lockUser(HttpSession session){
        try {
            SessionInfo sessionInfo=(SessionInfo)session.getAttribute("sessionInfo");
            sessionInfo.setIslock(true);
        } catch (Exception e) {
            log.error("锁定用户登录", e);
        }
    }
    /**
     * 用户登录解锁
     * @author Leejean
     * @create 2014-7-10下午02:06:47
     */
    @ResponseBody
    @RequestMapping("/breakLock")
    public Json breakLock(UserBean userBean,HttpSession session){
        Json json=new Json();
        try {
            SessionInfo sessionInfo=(SessionInfo)session.getAttribute("sessionInfo");
            if(sessionInfo.getUser().getPwd().equals(MD5Util.SHA256(userBean.getPwd()))){
                sessionInfo.setIslock(false);
                json.setMsg("解锁成功");
                json.setSuccess(true);
            }else{
                json.setMsg("密码错误");
            }
        } catch (Exception e) {
            log.error(message, e);
        }
        return json;
    }
    /**
     * 修改密码
     * @author Leejean
     * @create 2014-7-10下午02:16:36
     */
    @ResponseBody
    @RequestMapping("/editPwd")
    public Json editPwd(UserBean userBean,HttpSession session){
        Json json=new Json();
        try {
            SessionInfo sessionInfo=(SessionInfo)session.getAttribute("sessionInfo");
            UserBean user=sessionInfo.getUser();
            if(user.getPwd().equals(MD5Util.SHA256(userBean.getOldpwd()))){
                userService.editPwd(user.getId(),userBean.getPwd());
                json.setMsg("修改成功");
                user.setPwd(MD5Util.SHA256(userBean.getPwd()));
                json.setSuccess(true);
            }else{
                json.setMsg("输入的原始密码错误");
            }
        } catch (Exception e) {
            log.error("修改密码异常", e);
        }
        return json;
    }
    /**
     * 查询系统用户
     */
    @ResponseBody
    @RequestMapping("/getAllUser")
    public DataGrid getAllUser(UserBean userBean,PageParams pageParams){
        try {
            return userService.querySysUser(userBean,pageParams);
        } catch (Exception e) {
            log.error(message, e);
        }
        return null;
    }
    @RequestMapping("/goToUserAddJsp")
    public String goToAddUserJsp(){
        return "/pms/sys/user/userAdd";
    }
    /**
     * 新建用户
     */
    @ResponseBody
    @RequestMapping("/addSysUser")
    public Json addSysUser(UserBean userBean){
        Json json=new Json();
        try {
            userService.addSysUser(userBean);
            json.setMsg("新增用户成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            log.error(message, e);
            json.setMsg("新增用户失败!");
            json.setSuccess(false);
        }
        return json;
    }
    /**
     * 编辑用户
     */
    @ResponseBody
    @RequestMapping("/editSysUser")
    public Json editSysUser(UserBean userBean){
        Json json=new Json();
        try {
            userService.editSysUser(userBean);
            json.setMsg("编辑用户成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            log.error(message, e);
            json.setMsg("编辑用户失败!");
            json.setSuccess(false);
        }
        return json;
    }
    /**
     * 删除用户
     */
    @ResponseBody
    @RequestMapping("/deleteSysUser")
    public Json deleteSysUser(String id){
        Json json=new Json();
        try {
            userService.deleteSysUser(id);
            json.setMsg("删除用户成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            log.error(message, e);
            json.setMsg("删除用户失败!");
            json.setSuccess(false);
        }
        return json;
    }
    /**
     * 批量删除用户
     */
    @ResponseBody
    @RequestMapping("/batchDeleteSysUser")
    public Json batchDeleteSysUser(String ids){
        Json json=new Json();
        try {
            userService.batchDeleteSysUser(ids);
            json.setMsg("批量删除用户成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            log.error(message, e);
            json.setMsg("批量删除用户失败!");
            json.setSuccess(false);
        }
        return json;
    }
    /**
     * 跳转到用户编辑页面
     * @author Leejean
     * @create 2014-8-14下午07:03:44
     * @return
     */
    @RequestMapping("/goToUserEditJsp")
    public String goToUserEditJsp(String id,HttpServletRequest request){
        try {
            request.setAttribute("checkedUser", userService.getSysUserById(id));
        } catch (Exception e) {
            log.error("跳转到用户编辑页面失败", e);
        }
        return "/pms/sys/user/userEdit";
    }
    /**
     * 重置密码
     * @author Leejean
     * @create 2014-8-18下午08:36:38
     * @param id 用户id
     * @return
     */
    @ResponseBody
    @RequestMapping("/resetPwd")
    public Json resetPwd(String id){
        Json json=new Json();
        try {
            userService.editSysUser(new UserBean(id,MD5Util.SHA256("123456")));
            json.setMsg("重置密码为:123456,为了账户安全,请尽早修改密码!");
            json.setSuccess(true);
        } catch (Exception e) {
            log.error(message, e);
            json.setMsg("批量删除用户失败!");
            json.setSuccess(false);
        }
        return json;
    }
    /**
     * 重置密码
     * @author Leejean
     * @create 2014-8-18下午08:36:38
     * @param id 用户id
     * @return
     */
    @ResponseBody
    @RequestMapping("/enableOrUnenableSysUser")
    public Json enableOrUnenableSysUser(UserBean userBean){
        Json json=new Json();
        try {
            userService.editSysUser(userBean);
            json.setMsg("操作成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            log.error(message, e);
            json.setMsg("操作失败!");
            json.setSuccess(false);
        }
        return json;
    }
    /*****************用户-角色******************/
    /**
     * 跳转到用户角色分配页面
     * @author Leejean
     * @create 2014-8-18下午09:51:14
     * @param id
     * @param request
     * @return
     */
    @RequestMapping("/goToUserAssignRoleJsp")
    public String goToUserAssignRoleJsp(String id,String name,HttpServletRequest request){
        try {
            request.setCharacterEncoding("utf-8");
            request.setAttribute("checkedUserId", id);
            request.setAttribute("checkedUserName",name);
        } catch (Exception e) {
            log.error("跳转到用户角色分配页面失败", e);
        }
        return "/pms/sys/user/assignRole";
    }
    /**
     * 给用户分配角色
     * @author Leejean
     * @create 2014-8-19下午03:28:55
     * @param id 用户id
     * @param ids 授权角色Ids
     * @return
     */
    @ResponseBody
    @RequestMapping("/assignRole")
    public Json assignRole(String id,String ids){
        Json json=new Json();
        try {
            roleService.assignRole(id,ids);
            json.setMsg("角色分配成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            log.error(message, e);
            json.setMsg("操作分配失败!");
            json.setSuccess(false);
        }
        return json;
    }
    /**
     * 获得用户角色
     * @author Leejean
     * @create 2014-8-18下午08:36:38
     * @param id 用户id
     * @return
     */
    @ResponseBody
    @RequestMapping("/getRolesByUser")
    public List<RoleBean> getRolesByUser(String id){        
        try {
            return roleService.getRolesByUser(id);
        } catch (Exception e) {
            log.error(message, e);
        }
        return null;
    }
    /**
     * 跳转到用户批量角色分配页面
     * @author Leejean
     * @create 2014-8-18下午09:51:14
     * @param id
     * @param request
     * @return
     */
    @RequestMapping("/goToUserBatchAssignRoleJsp")
    public String goToUserBatchAssignRoleJsp(String ids,String names,HttpServletRequest request){
        try {
            request.setAttribute("checkedUserIds", ids);
            request.setAttribute("checkedUserNames",names);
        } catch (Exception e) {
            log.error("跳转到用户角色分配页面失败", e);
        }
        return "/pms/sys/user/batchAssignRole";
    }
    /**
     * 用户角色批量分配
     * @author Leejean
     * @create 2014-8-19下午07:22:22
     * @param uids 用户ids
     * @param rids 角色ids
     * @return
     */
    @ResponseBody
    @RequestMapping("/batchAssignRole")
    public Json batchAssignRole(String uids,String rids){
        Json json=new Json();
        try {
            roleService.batchAssignRole(uids,rids);
            json.setMsg("用户角色批量分配成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            log.error(message, e);
            json.setMsg("用户角色批量分配失败!");
            json.setSuccess(false);
        }
        return json;
    }
    /*****************用户-机构******************/
    /**
     * 跳转到用户组织机构分配页面
     * @author Leejean
     * @create 2014-8-18下午09:50:25
     * @param id
     * @param request
     * @return
     */
    @RequestMapping("/goToUserAssignOrgJsp")
    public String goToUserAssignOrgJsp(String id,HttpServletRequest request){
        try {
            request.setAttribute("checkedUserId", id);
        } catch (Exception e) {
            log.error("跳转到用户组织机构分配页面失败", e);
        }
        return "/pms/sys/user/assignOrg";
    }
    /**
     * 获得用户的机构
     * @author Leejean
     * @create 2014-8-18下午08:36:38
     * @param id 用户id
     * @return
     */
    @ResponseBody
    @RequestMapping("/getOrgsByUser")
    public List<Tree> getOrgsByUser(String id){        
        try {
            return orgService.getOrgsByUser(id);
        } catch (Exception e) {
            log.error(message, e);
        }
        return null;
    }
    
    /**
     * 给用户分配组织机构
     * @author Leejean
     * @create 2014-8-20上午09:27:20
     * @param id 用户id
     * @param ids 组织机构id
     * @return
     */
    @ResponseBody
    @RequestMapping("/assignOrg")
    public Json assignOrg(String id,String ids){                
        Json json=new Json();
        try {
            orgService.assignOrg(id,ids);
            json.setMsg("分配组织机构成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            log.error(message, e);
            json.setMsg("分配组织机构失败!");
            json.setSuccess(false);
        }
        return json;
    }
    /**
     * 跳转到用户组织机构批量分配页面
     * @author Leejean
     * @create 2014-8-18下午09:50:25
     * @param id
     * @param request
     * @return
     */
    @RequestMapping("/goToUserBatchAssignOrgJsp")
    public String goToUserBatchAssignOrgJsp(String id,HttpServletRequest request){
        try {
            //request.setAttribute("checkedUserId", id);
        } catch (Exception e) {
            log.error("跳转到用户组织机构批量分配页面", e);
        }
        return "/pms/sys/user/batchAssignOrg";
    }
    /**
     * 用户组织机构批量分配
     * @author Leejean
     * @create 2014-8-19下午07:22:22
     * @param uids 用户ids
     * @param oids 角色ids
     * @return
     */
    @ResponseBody
    @RequestMapping("/batchAssignOrg")
    public Json batchAssignOrg(String uids,String oids){
        Json json=new Json();
        try {
            orgService.batchAssignOrg(uids,oids);
            json.setMsg("用户组织机构批量分配成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            log.error(message, e);
            json.setMsg("用户组织机构分配失败!");
            json.setSuccess(false);
        }
        return json;
    }
    
    /**
     * 跳转到统计图编辑页面
     * @author Rengj
     * @create 2016-12-23下午13:50:25
     * @param id
     * @param request
     * @return
     */
    @RequestMapping("/goToUserModelJsp")
    public String goToUserModelJsp(HttpServletRequest request){
         List list= service.getProdJson();
        request.setAttribute("Json", JSONArray.fromObject(list));
        return "/pms/sys/user/model/modelEdit";
    }
    
    /**
     * 跳转到统计图编辑页面
     * @author Rengj
     * @create 2016-12-23下午13:50:25
     * @param id
     * @param request
     * @return
     */
    @ResponseBody
    @RequestMapping("/updateModelPremis")
    public Json updateModelPremis(String mdFixCodeId,String remark,HttpSession session){
        Json json=new Json();
        //得到用户的角色
        SessionInfo sessionInfo = (SessionInfo) session.getAttribute("sessionInfo");
        String[] ids = mdFixCodeId.split(",");
        String[] param = remark.split(",");
        try {
             for(int i=0;i<ids.length;i++){
               List<SysModelPermis> sysModelList = modelService.getSysModel(sessionInfo.getUser().getId(),sessionInfo.getRoles().get(0).getId(), ids[i]);
               if(sysModelList.size()>0 && "del".equals(param[i])){
                   for(int j = 0;j<sysModelList.size();j++ ){
                       SysModelPermis sp = (SysModelPermis)sysModelList.get(j);
                       modelService.deleteSysModel(sp.getId());
                   }
               }else if(sysModelList.size()<=0 && "save".equals(param[i])){
                   SysModelPermis smp =new SysModelPermis();
                   smp.setUserId(sessionInfo.getUser().getId());
                   smp.setRoleId(sessionInfo.getRoles().get(0).getId());
                   smp.setMdFixCodeId(ids[i]);
                   smp.setCreateTime(new Date());
                   smp.setRemark("界面添加");
                   modelService.insertDefaultSysModel(smp);
               }
             } 
            json.setMsg("首页统计显示维护成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            log.error(message, e);
            json.setMsg("首页统计显示维护失败!");
            json.setSuccess(false);
        }
        return json;
    }
    
    
    /**
     * 首页统计显示权限
     * @author Rengj
     * @create 2016-12-26上午9:50:25
     * @param id
     * @param request
     * @return
     */
    @ResponseBody
    @RequestMapping("/getModel")
    public String getModelPremis(HttpSession session,HttpServletRequest request){
        List list =new ArrayList();
        try {
                FixCodeBean fcb = new FixCodeBean();
                fcb.setUpcode("SYZSMK001");
                List<FixCodeBean> fixList = fixService.queryFixCode(fcb);
                //得到用户的角色
                SessionInfo sessionInfo = (SessionInfo) session.getAttribute("sessionInfo");
                List <SysModelPermis> sysModellist = modelService.getDefaultSysModel(sessionInfo.getUser().getId(),sessionInfo.getRoles().get(0).getId());
                String param = request.getParameter("param");
                for(int j=0; j<fixList.size();j++){
                    fcb = (FixCodeBean) fixList.get(j);
                    if(!"edit".equals(param)){
                        for(int i=0;i<sysModellist.size();i++){
                            SysModelPermis smp = (SysModelPermis)sysModellist.get(i);
                            if(smp.getMdFixCodeId().equals(fcb.getId())){
                                list.add(fcb);
                            }
                         }
                    }else{
                        list.add(fcb);
                    }
                }
            
        } catch (Exception e) {
            log.error(message, e);
        }
        return JSON.toJSONString(list);
    }
    /**
     * 生产实绩故障数据统
     * @author Rengj
     * @create 2016-12-26下午12:42:22
     * @return string
     */
    @ResponseBody
    @RequestMapping("/getSchStatfaultJson")
    public String getJson() throws Exception{
        List<?> list= schService.getSchStatFault();
        List<SchStatFault> schStatlist = new ArrayList<SchStatFault>();
        for(int i=0;i<list.size();i++){
             Object[] o = (Object[]) list.get(i);
             SchStatFault sf =new SchStatFault();
             sf.setName(o[0].toString());
             sf.setTime(Double.parseDouble(o[1].toString()));
             sf.setTimes(Long.parseLong(o[2].toString()));
             sf.setFlag(Long.parseLong(o[3].toString()));
              schStatlist.add(sf);
        }
        return  JSON.toJSONString(schStatlist);
    }
}