|
@@ -47,48 +47,7 @@ public class CmcDeviceApprovalController extends BaseController
|
47
|
47
|
public TableDataInfo list(CmcDeviceApproval cmcDeviceApproval)
|
48
|
48
|
{
|
49
|
49
|
startPage();
|
50
|
|
- List<CmcDeviceApproval> list = cmcDeviceApprovalService.selectCmcDeviceApprovalList(cmcDeviceApproval);
|
51
|
|
- for(CmcDeviceApproval deviceApproval : list) {
|
52
|
|
- String deviceIds = deviceApproval.getDevices();
|
53
|
|
- StringBuilder deviceNames = new StringBuilder();
|
54
|
|
- if (deviceIds != null && !deviceIds.equals("") && deviceIds.split(",").length > 0) {
|
55
|
|
- for (String deviceId : deviceIds.split(",")) {
|
56
|
|
- CmcDevice device = cmcDeviceService.selectCmcDeviceByDeviceId(Integer.parseInt(deviceId));
|
57
|
|
- deviceNames.append(device.getName()).append("【").append(device.getBrand() != null ? device.getBrand() : "")
|
58
|
|
- .append(device.getSeries() != null ? "-" + device.getSeries() + "】" : "")
|
59
|
|
- .append(device.getCode() != null ? "(设备编号:" + device.getCode() + ")" : "").append(",");
|
60
|
|
- }
|
61
|
|
- deviceApproval.setDeviceNames(deviceNames.substring(0, deviceNames.length() - 1));
|
62
|
|
- }
|
63
|
|
- String modifyDeviceIds = deviceApproval.getModifyDevices();
|
64
|
|
- StringBuilder modifyDeviceNames = new StringBuilder();
|
65
|
|
- StringBuilder modifyDeviceNumbers = new StringBuilder();
|
66
|
|
- if (modifyDeviceIds != null && !modifyDeviceIds.equals("") && modifyDeviceIds.split(",").length > 0) {
|
67
|
|
- for (String deviceId : modifyDeviceIds.split(",")) {
|
68
|
|
- CmcDevice device = cmcDeviceService.selectCmcDeviceByDeviceId(Integer.parseInt(deviceId));
|
69
|
|
- modifyDeviceNumbers.append(device.getDeviceNumber());
|
70
|
|
- modifyDeviceNames.append(device.getName()).append("【").append(device.getBrand() != null ? device.getBrand() : "")
|
71
|
|
- .append(device.getSeries() != null ? "-" + device.getSeries() + "】" : "")
|
72
|
|
- .append(device.getCode() != null ? "(设备编号:" + device.getCode() + ")" : "").append(",");
|
73
|
|
- }
|
74
|
|
- deviceApproval.setModifyDeviceNumbers(modifyDeviceNumbers.substring(0, modifyDeviceNumbers.length() - 1));
|
75
|
|
- deviceApproval.setModifyDeviceNames(modifyDeviceNames.substring(0, modifyDeviceNames.length() - 1));
|
76
|
|
- }
|
77
|
|
- String repairDeviceIds = deviceApproval.getRepairDevices();
|
78
|
|
- StringBuilder repairDeviceNames = new StringBuilder();;
|
79
|
|
- StringBuilder repairDeviceNumbers = new StringBuilder();
|
80
|
|
- if (repairDeviceIds != null && !repairDeviceIds.equals("") && repairDeviceIds.split(",").length > 0) {
|
81
|
|
- for (String deviceId : repairDeviceIds.split(",")) {
|
82
|
|
- CmcDevice device = cmcDeviceService.selectCmcDeviceByDeviceId(Integer.parseInt(deviceId));
|
83
|
|
- repairDeviceNumbers.append(device.getDeviceNumber());
|
84
|
|
- repairDeviceNames.append(device.getName()).append("【").append(device.getBrand() != null ? device.getBrand() : "")
|
85
|
|
- .append(device.getSeries() != null ? "-" + device.getSeries() + "】" : "")
|
86
|
|
- .append(device.getCode() != null ? "(设备编号:" + device.getCode() + ")" : "").append(",");
|
87
|
|
- }
|
88
|
|
- deviceApproval.setRepairDeviceNumbers(repairDeviceNumbers.substring(0, repairDeviceNumbers.length() - 1));
|
89
|
|
- deviceApproval.setRepairDeviceNames(repairDeviceNames.substring(0, repairDeviceNames.length() - 1));
|
90
|
|
- }
|
91
|
|
- }
|
|
50
|
+ List<CmcDeviceApproval> list = DeviceId2Name(cmcDeviceApproval);
|
92
|
51
|
return getDataTable(list);
|
93
|
52
|
}
|
94
|
53
|
|
|
@@ -99,48 +58,7 @@ public class CmcDeviceApprovalController extends BaseController
|
99
|
58
|
@PostMapping("/export")
|
100
|
59
|
public void export(HttpServletResponse response, CmcDeviceApproval cmcDeviceApproval)
|
101
|
60
|
{
|
102
|
|
- List<CmcDeviceApproval> list = cmcDeviceApprovalService.selectCmcDeviceApprovalList(cmcDeviceApproval);
|
103
|
|
- for(CmcDeviceApproval deviceApproval : list) {
|
104
|
|
- String deviceIds = deviceApproval.getDevices();
|
105
|
|
- StringBuilder deviceNames = new StringBuilder();
|
106
|
|
- if (deviceIds != null && !deviceIds.equals("") && deviceIds.split(",").length > 0) {
|
107
|
|
- for (String deviceId : deviceIds.split(",")) {
|
108
|
|
- CmcDevice device = cmcDeviceService.selectCmcDeviceByDeviceId(Integer.parseInt(deviceId));
|
109
|
|
- deviceNames.append(device.getName()).append("【").append(device.getBrand() != null ? device.getBrand() : "")
|
110
|
|
- .append(device.getSeries() != null ? "-" + device.getSeries() + "】" : "")
|
111
|
|
- .append(device.getCode() != null ? "(设备编号:" + device.getCode() + ")" : "").append(",");
|
112
|
|
- }
|
113
|
|
- deviceApproval.setDeviceNames(deviceNames.substring(0, deviceNames.length() - 1));
|
114
|
|
- }
|
115
|
|
- String modifyDeviceIds = deviceApproval.getModifyDevices();
|
116
|
|
- StringBuilder modifyDeviceNames = new StringBuilder();
|
117
|
|
- StringBuilder modifyDeviceNumbers = new StringBuilder();
|
118
|
|
- if (modifyDeviceIds != null && !modifyDeviceIds.equals("") && modifyDeviceIds.split(",").length > 0) {
|
119
|
|
- for (String deviceId : modifyDeviceIds.split(",")) {
|
120
|
|
- CmcDevice device = cmcDeviceService.selectCmcDeviceByDeviceId(Integer.parseInt(deviceId));
|
121
|
|
- modifyDeviceNumbers.append(device.getDeviceNumber());
|
122
|
|
- modifyDeviceNames.append(device.getName()).append("【").append(device.getBrand() != null ? device.getBrand() : "")
|
123
|
|
- .append(device.getSeries() != null ? "-" + device.getSeries() + "】" : "")
|
124
|
|
- .append(device.getCode() != null ? "(设备编号:" + device.getCode() + ")" : "").append(",");
|
125
|
|
- }
|
126
|
|
- deviceApproval.setModifyDeviceNumbers(modifyDeviceNumbers.substring(0, modifyDeviceNumbers.length() - 1));
|
127
|
|
- deviceApproval.setModifyDeviceNames(modifyDeviceNames.substring(0, modifyDeviceNames.length() - 1));
|
128
|
|
- }
|
129
|
|
- String repairDeviceIds = deviceApproval.getRepairDevices();
|
130
|
|
- StringBuilder repairDeviceNames = new StringBuilder();;
|
131
|
|
- StringBuilder repairDeviceNumbers = new StringBuilder();
|
132
|
|
- if (repairDeviceIds != null && !repairDeviceIds.equals("") && repairDeviceIds.split(",").length > 0) {
|
133
|
|
- for (String deviceId : repairDeviceIds.split(",")) {
|
134
|
|
- CmcDevice device = cmcDeviceService.selectCmcDeviceByDeviceId(Integer.parseInt(deviceId));
|
135
|
|
- repairDeviceNumbers.append(device.getDeviceNumber());
|
136
|
|
- repairDeviceNames.append(device.getName()).append("【").append(device.getBrand() != null ? device.getBrand() : "")
|
137
|
|
- .append(device.getSeries() != null ? "-" + device.getSeries() + "】" : "")
|
138
|
|
- .append(device.getCode() != null ? "(设备编号:" + device.getCode() + ")" : "").append(",");
|
139
|
|
- }
|
140
|
|
- deviceApproval.setRepairDeviceNumbers(repairDeviceNumbers.substring(0, repairDeviceNumbers.length() - 1));
|
141
|
|
- deviceApproval.setRepairDeviceNames(repairDeviceNames.substring(0, repairDeviceNames.length() - 1));
|
142
|
|
- }
|
143
|
|
- }
|
|
61
|
+ List<CmcDeviceApproval> list = DeviceId2Name(cmcDeviceApproval);
|
144
|
62
|
ExcelUtil<CmcDeviceApproval> util = new ExcelUtil<CmcDeviceApproval>(CmcDeviceApproval.class);
|
145
|
63
|
util.exportExcel(response, list, "cmc设备审批数据");
|
146
|
64
|
}
|
|
@@ -279,4 +197,68 @@ public class CmcDeviceApprovalController extends BaseController
|
279
|
197
|
{
|
280
|
198
|
return success(cmcDeviceApprovalService.deleteCmcDeviceApprovalByDeviceApplyIds(deviceApplyIds));
|
281
|
199
|
}
|
|
200
|
+
|
|
201
|
+ private List<CmcDeviceApproval> DeviceId2Name(CmcDeviceApproval cmcDeviceApproval) {
|
|
202
|
+ List<CmcDeviceApproval> list = cmcDeviceApprovalService.selectCmcDeviceApprovalList(cmcDeviceApproval);
|
|
203
|
+ for(CmcDeviceApproval deviceApproval : list) {
|
|
204
|
+ String deviceIds = deviceApproval.getDevices();
|
|
205
|
+ StringBuilder deviceNames = new StringBuilder();
|
|
206
|
+ StringBuilder deviceNumbers = new StringBuilder();
|
|
207
|
+ if (deviceIds != null && !deviceIds.equals("") && deviceIds.split(",").length > 0) {
|
|
208
|
+ for (String deviceId : deviceIds.split(",")) {
|
|
209
|
+ CmcDevice device = cmcDeviceService.selectCmcDeviceByDeviceId(Integer.parseInt(deviceId));
|
|
210
|
+ deviceNumbers.append(device.getDeviceNumber());
|
|
211
|
+ deviceNames.append(device.getName()).append("【").append(device.getBrand() != null ? device.getBrand() : "")
|
|
212
|
+ .append(device.getSeries() != null ? "-" + device.getSeries() + "】" : "")
|
|
213
|
+ .append(device.getCode() != null ? "(设备编号:" + device.getCode() + ")" : "").append(",");
|
|
214
|
+ }
|
|
215
|
+ deviceApproval.setDeviceNumbers(deviceNumbers.substring(0, deviceNumbers.length() - 1));
|
|
216
|
+ deviceApproval.setDeviceNames(deviceNames.substring(0, deviceNames.length() - 1));
|
|
217
|
+ }
|
|
218
|
+ String modifyDeviceIds = deviceApproval.getModifyDevices();
|
|
219
|
+ StringBuilder modifyDeviceNames = new StringBuilder();
|
|
220
|
+ StringBuilder modifyDeviceNumbers = new StringBuilder();
|
|
221
|
+ if (modifyDeviceIds != null && !modifyDeviceIds.equals("") && modifyDeviceIds.split(",").length > 0) {
|
|
222
|
+ for (String deviceId : modifyDeviceIds.split(",")) {
|
|
223
|
+ CmcDevice device = cmcDeviceService.selectCmcDeviceByDeviceId(Integer.parseInt(deviceId));
|
|
224
|
+ modifyDeviceNumbers.append(device.getDeviceNumber());
|
|
225
|
+ modifyDeviceNames.append(device.getName()).append("【").append(device.getBrand() != null ? device.getBrand() : "")
|
|
226
|
+ .append(device.getSeries() != null ? "-" + device.getSeries() + "】" : "")
|
|
227
|
+ .append(device.getCode() != null ? "(设备编号:" + device.getCode() + ")" : "").append(",");
|
|
228
|
+ }
|
|
229
|
+ deviceApproval.setModifyDeviceNumbers(modifyDeviceNumbers.substring(0, modifyDeviceNumbers.length() - 1));
|
|
230
|
+ deviceApproval.setModifyDeviceNames(modifyDeviceNames.substring(0, modifyDeviceNames.length() - 1));
|
|
231
|
+ }
|
|
232
|
+ String repairDeviceIds = deviceApproval.getRepairDevices();
|
|
233
|
+ StringBuilder repairDeviceNames = new StringBuilder();;
|
|
234
|
+ StringBuilder repairDeviceNumbers = new StringBuilder();
|
|
235
|
+ if (repairDeviceIds != null && !repairDeviceIds.equals("") && repairDeviceIds.split(",").length > 0) {
|
|
236
|
+ for (String deviceId : repairDeviceIds.split(",")) {
|
|
237
|
+ CmcDevice device = cmcDeviceService.selectCmcDeviceByDeviceId(Integer.parseInt(deviceId));
|
|
238
|
+ repairDeviceNumbers.append(device.getDeviceNumber());
|
|
239
|
+ repairDeviceNames.append(device.getName()).append("【").append(device.getBrand() != null ? device.getBrand() : "")
|
|
240
|
+ .append(device.getSeries() != null ? "-" + device.getSeries() + "】" : "")
|
|
241
|
+ .append(device.getCode() != null ? "(设备编号:" + device.getCode() + ")" : "").append(",");
|
|
242
|
+ }
|
|
243
|
+ deviceApproval.setRepairDeviceNumbers(repairDeviceNumbers.substring(0, repairDeviceNumbers.length() - 1));
|
|
244
|
+ deviceApproval.setRepairDeviceNames(repairDeviceNames.substring(0, repairDeviceNames.length() - 1));
|
|
245
|
+ }
|
|
246
|
+ String returnDeviceIds = deviceApproval.getReturnDevices();
|
|
247
|
+ StringBuilder returnDeviceNames = new StringBuilder();;
|
|
248
|
+ StringBuilder returnDeviceNumbers = new StringBuilder();
|
|
249
|
+ if (returnDeviceIds != null && !returnDeviceIds.equals("") && returnDeviceIds.split(",").length > 0) {
|
|
250
|
+ for (String deviceId : returnDeviceIds.split(",")) {
|
|
251
|
+ CmcDevice device = cmcDeviceService.selectCmcDeviceByDeviceId(Integer.parseInt(deviceId));
|
|
252
|
+ returnDeviceNumbers.append(device.getDeviceNumber());
|
|
253
|
+ returnDeviceNames.append(device.getName()).append("【").append(device.getBrand() != null ? device.getBrand() : "")
|
|
254
|
+ .append(device.getSeries() != null ? "-" + device.getSeries() + "】" : "")
|
|
255
|
+ .append(device.getCode() != null ? "(设备编号:" + device.getCode() + ")" : "").append(",");
|
|
256
|
+ }
|
|
257
|
+ deviceApproval.setReturnDeviceNumbers(returnDeviceNumbers.substring(0, returnDeviceNumbers.length() - 1));
|
|
258
|
+ deviceApproval.setReturnDeviceNames(returnDeviceNames.substring(0, returnDeviceNames.length() - 1));
|
|
259
|
+ }
|
|
260
|
+ }
|
|
261
|
+ return list;
|
|
262
|
+ }
|
|
263
|
+
|
282
|
264
|
}
|