懒羊羊
2023-11-14 8286c62256f23bc2367a6729c0f46f84215e380b
提交 | 用户 | 时间
8286c6 1 package cn.stylefeng.guns.modular.bs.equipmentInfo.controller;
2
3 import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
4 import cn.stylefeng.guns.modular.bs.equipmentInfo.entity.EquipmentInfo;
5 import cn.stylefeng.guns.modular.bs.equipmentInfo.model.params.EquipmentInfoParam;
6 import cn.stylefeng.guns.modular.bs.equipmentInfo.model.result.EquipmentInfoResult;
7 import cn.stylefeng.guns.modular.bs.equipmentInfo.service.EquipmentInfoService;
8 import cn.stylefeng.guns.modular.om.productionOrdeInfo.model.params.ProductionOrdeInfoParam;
9 import cn.stylefeng.guns.modular.om.productionOrdeInfo.model.result.ProductionOrdeInfoResult;
10 import cn.stylefeng.roses.core.base.controller.BaseController;
11 import cn.stylefeng.roses.kernel.model.response.ResponseData;
12 import org.springframework.beans.factory.annotation.Autowired;
13 import org.springframework.stereotype.Controller;
14 import org.springframework.web.bind.annotation.CrossOrigin;
15 import org.springframework.web.bind.annotation.RequestMapping;
16 import org.springframework.web.bind.annotation.ResponseBody;
17
18 import java.util.ArrayList;
19 import java.util.HashMap;
20 import java.util.List;
21 import java.util.Map;
22
23
24 /**
25  * 设备档案控制器
26  *
27  * @author cl
28  * @Date 2022-10-28 10:10:06
29  */
30 @Controller
31 @RequestMapping("/equipmentInfo")
32 public class EquipmentInfoController extends BaseController {
33
34     private String PREFIX = "modular/bs/equipmentInfo";
35
36     @Autowired
37     private EquipmentInfoService equipmentInfoService;
38
39     /**
40      * 跳转到主页面
41      *
42      * @author cl
43      * @Date 2022-10-28
44      */
45     @RequestMapping("")
46     public String index() {
47         return PREFIX + "/equipmentInfo.html";
48     }
49
50     /**
51      * 新增页面
52      *
53      * @author cl
54      * @Date 2022-10-28
55      */
56     @RequestMapping("/add")
57     public String add() {
58         return PREFIX + "/equipmentInfo_add.html";
59     }
60
61     /**
62      * 编辑页面
63      *
64      * @author cl
65      * @Date 2022-10-28
66      */
67     @RequestMapping("/edit")
68     public String edit() {
69         return PREFIX + "/equipmentInfo_edit.html";
70     }
71
72     /**
73      * 新增接口
74      *
75      * @author cl
76      * @Date 2022-10-28
77      */
78     @RequestMapping("/addItem")
79     @ResponseBody
80     public ResponseData addItem(EquipmentInfoParam equipmentInfoParam) {
81         this.equipmentInfoService.add(equipmentInfoParam);
82         return ResponseData.success();
83     }
84
85     /**
86      * 编辑接口
87      *
88      * @author cl
89      * @Date 2022-10-28
90      */
91     @RequestMapping("/editItem")
92     @ResponseBody
93     public ResponseData editItem(EquipmentInfoParam equipmentInfoParam) {
94         this.equipmentInfoService.update(equipmentInfoParam);
95         return ResponseData.success();
96     }
97
98     /**
99      * 导出excel
100      *
101      * @author cl
102      * @Date 2022-10-28
103      */
104     @RequestMapping("/exportTable")
105     @ResponseBody
106     public ResponseData exportTable(EquipmentInfoParam equipmentInfoParam) {
107         List<EquipmentInfoResult> list = equipmentInfoService.exportTable(equipmentInfoParam);
108         return ResponseData.success(list);
109     }
110
111     /**
112      * 删除接口
113      *
114      * @author cl
115      * @Date 2022-10-28
116      */
117     @RequestMapping("/delete")
118     @ResponseBody
119     public ResponseData delete(EquipmentInfoParam equipmentInfoParam) {
120         this.equipmentInfoService.delete(equipmentInfoParam);
121         return ResponseData.success();
122     }
123
124     /**
125      * 查看详情接口
126      *
127      * @author cl
128      * @Date 2022-10-28
129      */
130     @RequestMapping("/detail")
131     @ResponseBody
132     public ResponseData detail(EquipmentInfoParam equipmentInfoParam) {
133         EquipmentInfo detail = this.equipmentInfoService.getById(equipmentInfoParam.getId());
134         return ResponseData.success(detail);
135     }
136
137     /**
138      * 查询列表
139      *
140      * @author cl
141      * @Date 2022-10-28
142      */
143     @ResponseBody
144     @RequestMapping("/list")
145     public LayuiPageInfo list(EquipmentInfoParam equipmentInfoParam) {
146         return this.equipmentInfoService.findPageBySpec(equipmentInfoParam);
147     }
148
149     @ResponseBody
150     @CrossOrigin
151     @RequestMapping("/largeScreenList")
152     public List largeScreenList(EquipmentInfoParam equipmentInfoParam) {
153         ArrayList arrayList = new ArrayList();
154         LayuiPageInfo pageBySpec = this.equipmentInfoService.findPageBySpec(equipmentInfoParam);
155         List<EquipmentInfoResult> result = pageBySpec.getData();
156         for (EquipmentInfoResult equipmentInfoResult : result) {
157             ArrayList resultList = new ArrayList();
158             resultList.add(equipmentInfoResult.getWorkshopCode());
159             resultList.add(equipmentInfoResult.getEquipmentNo());
160             resultList.add(equipmentInfoResult.getLocationCode());
161             arrayList.add(resultList);
162         }
163         return arrayList;
164     }
165
166     @ResponseBody
167     @CrossOrigin
168     @RequestMapping("/DeviceInformation")
169     public Map DeviceInformation() {
170         HashMap<String,String> map = new HashMap();
171         map.put("onLineQuantity","45");
172         map.put("equipmentQuantity","36");
173         map.put("waitQuantity","89");
174         map.put("hitchQuantity","12");
175         return map;
176     }
177
178     @ResponseBody
179     @CrossOrigin
180     @RequestMapping("/centerLeft1")
181     public ResponseData centerLeft1() {
182         Map map = new HashMap();
183         List xData = new ArrayList();
184         List seriesData = new ArrayList();
185         List<EquipmentInfoResult> list = equipmentInfoService.centerLeft1();
186         for (EquipmentInfoResult equipmentInfoResult : list) {
187             Map map1 = new HashMap();
188             xData.add(equipmentInfoResult.getEquipmentNo());
189             map1.put("name",equipmentInfoResult.getEquipmentNo());
190             map1.put("value",Integer.valueOf( equipmentInfoResult.getNum()));
191             seriesData.add(map1);
192         }
193         map.put("xData",xData);
194         map.put("seriesData",seriesData);
195         return ResponseData.success(map);
196     }
197
198 }
199
200