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
package com.shlanbao.tzsc.pms.equ.eqpWheelCover.controller;
 
import java.util.Date;
import java.util.List;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
 
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.google.gson.Gson;
import com.shlanbao.tzsc.base.mapping.EqmWheelCover;
import com.shlanbao.tzsc.base.mapping.SysEqpCategory;
import com.shlanbao.tzsc.base.mapping.SysRole;
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.equ.eqpWheelCover.service.EqmWheelCoverServiceI;
import com.shlanbao.tzsc.pms.sys.datadict.service.SysEqpCategoryServiceI;
import com.shlanbao.tzsc.utils.tools.StringUtil;
/**
 * 设备计划控制层
 * @author Administrator
 *
 */
@Controller
@RequestMapping("/pms/eqmWheelCover")
public class EqmWheelCoverController {
    protected Logger log = Logger.getLogger(this.getClass());
    @Autowired
    private SysEqpCategoryServiceI mdEqpCategoryService;
        
    @Autowired
    private EqmWheelCoverServiceI eqmWheelCoverService;
    
    /**
     * 设备保养计划新增
     * @param cateid
     * @return
     * @throws Exception
     */
    
    
    @RequestMapping("/goToAddWheelCover")
    public String goToAddWheelCover(String cateid,HttpServletRequest request)throws Exception{
        SysEqpCategory category = mdEqpCategoryService.getMdCategoryById(cateid);
        EqmWheelCover bean =new EqmWheelCover();
        bean.setCategoryId(category.getId());
        bean.setCategoryName(category.getName());
        request.setAttribute("bean", bean);
        return "/pms/equ/wheelCover/addWheelCover";
    }
        
    @ResponseBody
    @RequestMapping("/addWheelCover")
    public Json addWheelCover(EqmWheelCover bean,String categoryId , HttpServletRequest request,HttpSession session)throws Exception{
            Json json = new Json();
            try {
                
                
                /*LoginBean loginBean = (LoginBean) session.getAttribute("loginInfo");
                if(loginBean!=null){
                    bean.setLastUpdateName(loginBean.getName());
                }*/
                bean.setSysEc(categoryId);
                bean.setCreateTime(new Date());
                bean.setLastUpdateTime(new Date());
                eqmWheelCoverService.addBean(bean);
                json.setMsg("操作成功!");
                json.setSuccess(true);
            } catch (Exception e) {
                e.printStackTrace();
                json.setMsg("操作失败!");
                json.setSuccess(false);
            }
            return json;
        }
    
    /**
     * 设备润滑计划修改
     * @param id
     * @return
     * @throws Exception
     */
    @RequestMapping("/goToEditWheelCover")
    public String goToEditWheelCover(String id,HttpServletRequest request)throws Exception{
        if(StringUtil.notNull(id)){
            EqmWheelCover bean =eqmWheelCoverService.getBeanByIds(id);
            request.setAttribute("bean", bean);
            return "/pms/equ/wheelCover/editWheelCover";
        }else{
            return "";
        }
    }
    
 
    
    @ResponseBody
    @RequestMapping("/editWheelCover")
    public Json editWheelCover(EqmWheelCover bean,HttpServletRequest request,HttpSession session)throws Exception{
        Json json = new Json();
        try {
            bean.setLastUpdateTime(new Date());
            eqmWheelCoverService.updateBean(bean);
            json.setMsg("操作成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            json.setMsg("操作失败!");
            json.setSuccess(false);
        }
        return json;
    }
    
    
    /**
     * 功能说明:查询角色
     *   添加保养基础数据时,选择的角色
     * @author zhouzhiqin
     * @date  2017年9月9日13:54:28
     * 
     * */
    @ResponseBody
    @RequestMapping("/getRoleAll")
    public String getRoleAll(HttpServletRequest request,HttpSession session)throws Exception{
        List<SysRole> list=eqmWheelCoverService.getRoleAll();
        Gson gson=new Gson();
         String json = gson.toJson(list);
        //返回到前台
        return json;
    }
    
    
    
        
    /**设备保养查询 */
    @ResponseBody
    @RequestMapping("/queryWheelCoverById")
    public DataGrid queryInspectionById(SysEqpCategory mdTypeBean, PageParams pageParams) {
        try {
            DataGrid gd = eqmWheelCoverService.queryWheelCoverById(mdTypeBean, pageParams);
            return gd;
        } catch (Exception e) {
            log.error("查询异常!!!", e);
        }
        return null;
    }    
    
    
    /**删除选中的设备保养明细 */
    @ResponseBody
    @RequestMapping("/deleteWheelCover")
    public Json deleteWheelCover(String id) {
        Json json = new Json();
        try {
            eqmWheelCoverService.deleteWheelCover(id);
            json.setMsg("操作成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            log.error("删除数据异常。", e);
            json.setMsg("操作失败!");
            json.setSuccess(false);
        }
        return json;
    }
 
 
    /**
     * 批量删除
     * @param ids
     * @return
     */
    @ResponseBody
    @RequestMapping("/batchDeleteWheelCover")
    public Json batchDeleteWheelCover(String ids) {
        Json json = new Json();
        try {
            eqmWheelCoverService.batchDeleteWheelCover(ids);
            json.setMsg("操作成功!");
            json.setSuccess(true);
        } catch (Exception e) {
            log.error("删除数据异常。", e);
            json.setMsg("操作失败!");
            json.setSuccess(false);
        }
        return json;
    }
    public EqmWheelCoverServiceI getEqmWheelCoverService() {
        return eqmWheelCoverService;
    }
 
    public void setEqmWheelCoverService(EqmWheelCoverServiceI eqmWheelCoverService) {
        this.eqmWheelCoverService = eqmWheelCoverService;
    }
    
    
        
    
    }