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
package com.shlanbao.tzsc.pms.md.eqptype.controller;
 
import java.util.ArrayList;
import java.util.List;
 
import javax.servlet.http.HttpServletRequest;
 
import org.apache.log4j.Logger;
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.shlanbao.tzsc.base.model.DataGrid;
import com.shlanbao.tzsc.base.model.Json;
import com.shlanbao.tzsc.base.model.PageParams;
import com.shlanbao.tzsc.pms.md.eqptype.beans.MdEqpTypeChildBean;
import com.shlanbao.tzsc.pms.md.eqptype.service.MdEqpTypeChildServiceI;
import com.shlanbao.tzsc.utils.tools.JSONUtil;
 
/**
 * 添加 设备轮保项
 * @author luther.zhang 20150514
 *
 */
@Controller
@RequestMapping("/pms/md/eqptypeChild")
public class MdEqpTypeChildController {
    protected Logger log = Logger.getLogger(this.getClass());
    @Autowired
    private MdEqpTypeChildServiceI mdEqpTypeChildService;
    protected String message="程序异常,请稍后再试.";
 
    @RequestMapping("/goToLbJsp")
    public String goToLbJsp(HttpServletRequest request,String id){
        MdEqpTypeChildBean bean = new MdEqpTypeChildBean();
        bean.setQueryId(id);
        request.setAttribute("bean",bean);
        return "/pms/md/eqptype/editLunBaoChild";
    }
    @RequestMapping("/goToRhJsp")
    public String goToRhJsp(HttpServletRequest request,String id){
        MdEqpTypeChildBean bean = new MdEqpTypeChildBean();
        bean.setQueryId(id);
        request.setAttribute("bean",bean);
        return "/pms/md/eqptype/editRunHuaChild";
    }
    @RequestMapping("/goToWxJsp")
    public String goToWxJsp(HttpServletRequest request,String id){
        MdEqpTypeChildBean bean = new MdEqpTypeChildBean();
        bean.setQueryId(id);
        request.setAttribute("bean",bean);
        return "/pms/md/eqptype/editWeiXiuChild";
    }
    
    @ResponseBody
    @RequestMapping("/queryMdType")
    public DataGrid queryMdType(MdEqpTypeChildBean mdTypeBean,PageParams pageParams){
        try {
            if(null!=mdTypeBean.getQueryId()&&!"".equals(mdTypeBean.getQueryId())){
                DataGrid gd = mdEqpTypeChildService.queryMdTypeChild(mdTypeBean, pageParams);
                return gd;
            }else{
                List<MdEqpTypeChildBean> lastList = new ArrayList<MdEqpTypeChildBean>();
                return new DataGrid(lastList,0L);
            }
        } catch (Exception e) {
            log.error("查询异常。", e);
        }
        return null;
    }
    /**
     * 新建修改
     */
    @ResponseBody
    @RequestMapping("/editMdTypeChild")
    public Json editMdTypeChild(MdEqpTypeChildBean bean,HttpServletRequest request){
        Json json=new Json();
        try {
            String type = request.getParameter("type");//类型
            String isInsert = request.getParameter("isInsert");
            String reqString = request.getParameter("reqString");
            if(null!=reqString){
                // 填充BEAN
                MdEqpTypeChildBean[] beans = (MdEqpTypeChildBean[]) JSONUtil.JSONString2ObjectArray(reqString,MdEqpTypeChildBean.class);
                if("save".equals(isInsert)){
                    mdEqpTypeChildService.saveMdTypeChild(type,beans);
                    json.setMsg("新增成功!");
                    json.setSuccess(true);
                }else if("update".equals(isInsert)){
                    mdEqpTypeChildService.editMdTypeChild(type,beans);
                    json.setMsg("更新成功!");
                    json.setSuccess(true);
                }
            }else{
                json.setMsg("失败");
                json.setSuccess(false);
            }
        } catch (Exception e) {
            log.error(message, e);
            json.setMsg("新增失败!");
            json.setSuccess(false);
        }
        return json;
    }
    
    
    @ResponseBody
    @RequestMapping("/getPaulbyEqpType")
    public List<MdEqpTypeChildBean> getPaulbyEqpType(String eqpTypeId,String type,HttpServletRequest request){
        try {
            return mdEqpTypeChildService.getPaulbyEqpType(eqpTypeId, type);
        } catch (Exception e) {
            log.error("查询异常。", e);
        }
        return null;
    }
    
    @ResponseBody
    @RequestMapping("/getPaulbyEqp")
    public List<MdEqpTypeChildBean> getPaulbyEqp(String eqpId,String type,HttpServletRequest request){
        try {
            return mdEqpTypeChildService.getPaulbyEqp(eqpId, type);
        } catch (Exception e) {
            log.error("查询异常。", e);
        }
        return null;
    }
    /**
     * 根据设备型号ID查询对应的轮保规则
     * @param equBean
     * @param pageParams
     * @return
     */
    @ResponseBody
    @RequestMapping("/queryEqpTypeChildByEqp")
    public List<MdEqpTypeChildBean> queryEqpTypeChildByEqp(String eqpid,String type){
        try {
            if(null!=eqpid&&!"".equals(eqpid)){
                return mdEqpTypeChildService.queryEqpTypeChildByEqp(eqpid,type);
            }else{
                List<MdEqpTypeChildBean> lastList = new ArrayList<MdEqpTypeChildBean>();
                return new DataGrid(lastList,0L).getRows();
            }
        } catch (Exception e) {
        }
        return null;
    }
}