|
@@ -66,7 +66,14 @@ public class LedgerImportController extends BaseController {
|
|
66
|
public AjaxResult importSupervisionProblem(@RequestParam("file") MultipartFile file) throws Exception {
|
66
|
public AjaxResult importSupervisionProblem(@RequestParam("file") MultipartFile file) throws Exception {
|
|
67
|
String batchNo = generateBatchNo();
|
67
|
String batchNo = generateBatchNo();
|
|
68
|
ExcelUtil<LedgerSupervisionProblem> util = new ExcelUtil<>(LedgerSupervisionProblem.class);
|
68
|
ExcelUtil<LedgerSupervisionProblem> util = new ExcelUtil<>(LedgerSupervisionProblem.class);
|
|
69
|
- List<LedgerSupervisionProblem> list = util.importExcel(file.getInputStream());
|
|
|
|
|
|
69
|
+ List<LedgerSupervisionProblem> list = util.importExcel(file.getInputStream(), 1);
|
|
|
|
70
|
+ // 过滤null元素,避免空指针异常
|
|
|
|
71
|
+ if (list != null) {
|
|
|
|
72
|
+ list.removeIf(item -> item == null);
|
|
|
|
73
|
+ }
|
|
|
|
74
|
+ if (list == null || list.isEmpty()) {
|
|
|
|
75
|
+ return AjaxResult.error("导入数据为空或解析失败,请检查Excel表头是否与模板一致");
|
|
|
|
76
|
+ }
|
|
70
|
list.forEach(item -> {
|
77
|
list.forEach(item -> {
|
|
71
|
item.setImportBatch(batchNo);
|
78
|
item.setImportBatch(batchNo);
|
|
72
|
item.setSourceType("1");
|
79
|
item.setSourceType("1");
|
|
@@ -82,7 +89,14 @@ public class LedgerImportController extends BaseController {
|
|
82
|
public AjaxResult importPatrolInspection(@RequestParam("file") MultipartFile file) throws Exception {
|
89
|
public AjaxResult importPatrolInspection(@RequestParam("file") MultipartFile file) throws Exception {
|
|
83
|
String batchNo = generateBatchNo();
|
90
|
String batchNo = generateBatchNo();
|
|
84
|
ExcelUtil<LedgerPatrolInspection> util = new ExcelUtil<>(LedgerPatrolInspection.class);
|
91
|
ExcelUtil<LedgerPatrolInspection> util = new ExcelUtil<>(LedgerPatrolInspection.class);
|
|
85
|
- List<LedgerPatrolInspection> list = util.importExcel(file.getInputStream());
|
|
|
|
|
|
92
|
+ List<LedgerPatrolInspection> list = util.importExcel(file.getInputStream(), 1);
|
|
|
|
93
|
+ // 过滤null元素,避免空指针异常
|
|
|
|
94
|
+ if (list != null) {
|
|
|
|
95
|
+ list.removeIf(item -> item == null);
|
|
|
|
96
|
+ }
|
|
|
|
97
|
+ if (list == null || list.isEmpty()) {
|
|
|
|
98
|
+ return AjaxResult.error("导入数据为空或解析失败,请检查Excel表头是否与模板一致");
|
|
|
|
99
|
+ }
|
|
86
|
list.forEach(item -> {
|
100
|
list.forEach(item -> {
|
|
87
|
item.setImportBatch(batchNo);
|
101
|
item.setImportBatch(batchNo);
|
|
88
|
item.setSourceType("1");
|
102
|
item.setSourceType("1");
|
|
@@ -98,7 +112,14 @@ public class LedgerImportController extends BaseController {
|
|
98
|
public AjaxResult importRealtimeInterception(@RequestParam("file") MultipartFile file) throws Exception {
|
112
|
public AjaxResult importRealtimeInterception(@RequestParam("file") MultipartFile file) throws Exception {
|
|
99
|
String batchNo = generateBatchNo();
|
113
|
String batchNo = generateBatchNo();
|
|
100
|
ExcelUtil<LedgerRealtimeInterception> util = new ExcelUtil<>(LedgerRealtimeInterception.class);
|
114
|
ExcelUtil<LedgerRealtimeInterception> util = new ExcelUtil<>(LedgerRealtimeInterception.class);
|
|
101
|
- List<LedgerRealtimeInterception> list = util.importExcel(file.getInputStream());
|
|
|
|
|
|
115
|
+ List<LedgerRealtimeInterception> list = util.importExcel(file.getInputStream(), 1);
|
|
|
|
116
|
+ // 过滤null元素,避免空指针异常
|
|
|
|
117
|
+ if (list != null) {
|
|
|
|
118
|
+ list.removeIf(item -> item == null);
|
|
|
|
119
|
+ }
|
|
|
|
120
|
+ if (list == null || list.isEmpty()) {
|
|
|
|
121
|
+ return AjaxResult.error("导入数据为空或解析失败,请检查Excel表头是否与模板一致");
|
|
|
|
122
|
+ }
|
|
102
|
list.forEach(item -> {
|
123
|
list.forEach(item -> {
|
|
103
|
item.setImportBatch(batchNo);
|
124
|
item.setImportBatch(batchNo);
|
|
104
|
item.setSourceType("1");
|
125
|
item.setSourceType("1");
|
|
@@ -114,7 +135,14 @@ public class LedgerImportController extends BaseController {
|
|
114
|
public AjaxResult importServicePatrol(@RequestParam("file") MultipartFile file) throws Exception {
|
135
|
public AjaxResult importServicePatrol(@RequestParam("file") MultipartFile file) throws Exception {
|
|
115
|
String batchNo = generateBatchNo();
|
136
|
String batchNo = generateBatchNo();
|
|
116
|
ExcelUtil<LedgerServicePatrol> util = new ExcelUtil<>(LedgerServicePatrol.class);
|
137
|
ExcelUtil<LedgerServicePatrol> util = new ExcelUtil<>(LedgerServicePatrol.class);
|
|
117
|
- List<LedgerServicePatrol> list = util.importExcel(file.getInputStream());
|
|
|
|
|
|
138
|
+ List<LedgerServicePatrol> list = util.importExcel(file.getInputStream(), 1);
|
|
|
|
139
|
+ // 过滤null元素,避免空指针异常
|
|
|
|
140
|
+ if (list != null) {
|
|
|
|
141
|
+ list.removeIf(item -> item == null);
|
|
|
|
142
|
+ }
|
|
|
|
143
|
+ if (list == null || list.isEmpty()) {
|
|
|
|
144
|
+ return AjaxResult.error("导入数据为空或解析失败,请检查Excel表头是否与模板一致");
|
|
|
|
145
|
+ }
|
|
118
|
list.forEach(item -> {
|
146
|
list.forEach(item -> {
|
|
119
|
item.setImportBatch(batchNo);
|
147
|
item.setImportBatch(batchNo);
|
|
120
|
item.setSourceType("1");
|
148
|
item.setSourceType("1");
|
|
@@ -130,7 +158,14 @@ public class LedgerImportController extends BaseController {
|
|
130
|
public AjaxResult importComplaint(@RequestParam("file") MultipartFile file) throws Exception {
|
158
|
public AjaxResult importComplaint(@RequestParam("file") MultipartFile file) throws Exception {
|
|
131
|
String batchNo = generateBatchNo();
|
159
|
String batchNo = generateBatchNo();
|
|
132
|
ExcelUtil<LedgerComplaint> util = new ExcelUtil<>(LedgerComplaint.class);
|
160
|
ExcelUtil<LedgerComplaint> util = new ExcelUtil<>(LedgerComplaint.class);
|
|
133
|
- List<LedgerComplaint> list = util.importExcel(file.getInputStream());
|
|
|
|
|
|
161
|
+ List<LedgerComplaint> list = util.importExcel(file.getInputStream(), 1);
|
|
|
|
162
|
+ // 过滤null元素,避免空指针异常
|
|
|
|
163
|
+ if (list != null) {
|
|
|
|
164
|
+ list.removeIf(item -> item == null);
|
|
|
|
165
|
+ }
|
|
|
|
166
|
+ if (list == null || list.isEmpty()) {
|
|
|
|
167
|
+ return AjaxResult.error("导入数据为空或解析失败,请检查Excel表头是否与模板一致");
|
|
|
|
168
|
+ }
|
|
134
|
list.forEach(item -> {
|
169
|
list.forEach(item -> {
|
|
135
|
item.setImportBatch(batchNo);
|
170
|
item.setImportBatch(batchNo);
|
|
136
|
item.setSourceType("1");
|
171
|
item.setSourceType("1");
|
|
@@ -146,7 +181,14 @@ public class LedgerImportController extends BaseController {
|
|
146
|
public AjaxResult importSecurityTest(@RequestParam("file") MultipartFile file) throws Exception {
|
181
|
public AjaxResult importSecurityTest(@RequestParam("file") MultipartFile file) throws Exception {
|
|
147
|
String batchNo = generateBatchNo();
|
182
|
String batchNo = generateBatchNo();
|
|
148
|
ExcelUtil<LedgerSecurityTest> util = new ExcelUtil<>(LedgerSecurityTest.class);
|
183
|
ExcelUtil<LedgerSecurityTest> util = new ExcelUtil<>(LedgerSecurityTest.class);
|
|
149
|
- List<LedgerSecurityTest> list = util.importExcel(file.getInputStream());
|
|
|
|
|
|
184
|
+ List<LedgerSecurityTest> list = util.importExcel(file.getInputStream(), 1);
|
|
|
|
185
|
+ // 过滤null元素,避免空指针异常
|
|
|
|
186
|
+ if (list != null) {
|
|
|
|
187
|
+ list.removeIf(item -> item == null);
|
|
|
|
188
|
+ }
|
|
|
|
189
|
+ if (list == null || list.isEmpty()) {
|
|
|
|
190
|
+ return AjaxResult.error("导入数据为空或解析失败,请检查Excel表头是否与模板一致");
|
|
|
|
191
|
+ }
|
|
150
|
list.forEach(item -> {
|
192
|
list.forEach(item -> {
|
|
151
|
item.setImportBatch(batchNo);
|
193
|
item.setImportBatch(batchNo);
|
|
152
|
item.setSourceType("1");
|
194
|
item.setSourceType("1");
|
|
@@ -162,7 +204,14 @@ public class LedgerImportController extends BaseController {
|
|
162
|
public AjaxResult importChannelPassRate(@RequestParam("file") MultipartFile file) throws Exception {
|
204
|
public AjaxResult importChannelPassRate(@RequestParam("file") MultipartFile file) throws Exception {
|
|
163
|
String batchNo = generateBatchNo();
|
205
|
String batchNo = generateBatchNo();
|
|
164
|
ExcelUtil<LedgerChannelPassRate> util = new ExcelUtil<>(LedgerChannelPassRate.class);
|
206
|
ExcelUtil<LedgerChannelPassRate> util = new ExcelUtil<>(LedgerChannelPassRate.class);
|
|
165
|
- List<LedgerChannelPassRate> list = util.importExcel(file.getInputStream());
|
|
|
|
|
|
207
|
+ List<LedgerChannelPassRate> list = util.importExcel(file.getInputStream(), 1);
|
|
|
|
208
|
+ // 过滤null元素,避免空指针异常
|
|
|
|
209
|
+ if (list != null) {
|
|
|
|
210
|
+ list.removeIf(item -> item == null);
|
|
|
|
211
|
+ }
|
|
|
|
212
|
+ if (list == null || list.isEmpty()) {
|
|
|
|
213
|
+ return AjaxResult.error("导入数据为空或解析失败,请检查Excel表头是否与模板一致");
|
|
|
|
214
|
+ }
|
|
166
|
list.forEach(item -> {
|
215
|
list.forEach(item -> {
|
|
167
|
item.setImportBatch(batchNo);
|
216
|
item.setImportBatch(batchNo);
|
|
168
|
item.setSourceType("1");
|
217
|
item.setSourceType("1");
|
|
@@ -178,7 +227,14 @@ public class LedgerImportController extends BaseController {
|
|
178
|
public AjaxResult importUnsafeEvent(@RequestParam("file") MultipartFile file) throws Exception {
|
227
|
public AjaxResult importUnsafeEvent(@RequestParam("file") MultipartFile file) throws Exception {
|
|
179
|
String batchNo = generateBatchNo();
|
228
|
String batchNo = generateBatchNo();
|
|
180
|
ExcelUtil<LedgerUnsafeEvent> util = new ExcelUtil<>(LedgerUnsafeEvent.class);
|
229
|
ExcelUtil<LedgerUnsafeEvent> util = new ExcelUtil<>(LedgerUnsafeEvent.class);
|
|
181
|
- List<LedgerUnsafeEvent> list = util.importExcel(file.getInputStream());
|
|
|
|
|
|
230
|
+ List<LedgerUnsafeEvent> list = util.importExcel(file.getInputStream(), 1);
|
|
|
|
231
|
+ // 过滤null元素,避免空指针异常
|
|
|
|
232
|
+ if (list != null) {
|
|
|
|
233
|
+ list.removeIf(item -> item == null);
|
|
|
|
234
|
+ }
|
|
|
|
235
|
+ if (list == null || list.isEmpty()) {
|
|
|
|
236
|
+ return AjaxResult.error("导入数据为空或解析失败,请检查Excel表头是否与模板一致");
|
|
|
|
237
|
+ }
|
|
182
|
list.forEach(item -> {
|
238
|
list.forEach(item -> {
|
|
183
|
item.setImportBatch(batchNo);
|
239
|
item.setImportBatch(batchNo);
|
|
184
|
item.setSourceType("1");
|
240
|
item.setSourceType("1");
|
|
@@ -194,7 +250,14 @@ public class LedgerImportController extends BaseController {
|
|
194
|
public AjaxResult importSeizureStats(@RequestParam("file") MultipartFile file) throws Exception {
|
250
|
public AjaxResult importSeizureStats(@RequestParam("file") MultipartFile file) throws Exception {
|
|
195
|
String batchNo = generateBatchNo();
|
251
|
String batchNo = generateBatchNo();
|
|
196
|
ExcelUtil<LedgerSeizureStats> util = new ExcelUtil<>(LedgerSeizureStats.class);
|
252
|
ExcelUtil<LedgerSeizureStats> util = new ExcelUtil<>(LedgerSeizureStats.class);
|
|
197
|
- List<LedgerSeizureStats> list = util.importExcel(file.getInputStream());
|
|
|
|
|
|
253
|
+ List<LedgerSeizureStats> list = util.importExcel(file.getInputStream(), 1);
|
|
|
|
254
|
+ // 过滤null元素,避免空指针异常
|
|
|
|
255
|
+ if (list != null) {
|
|
|
|
256
|
+ list.removeIf(item -> item == null);
|
|
|
|
257
|
+ }
|
|
|
|
258
|
+ if (list == null || list.isEmpty()) {
|
|
|
|
259
|
+ return AjaxResult.error("导入数据为空或解析失败,请检查Excel表头是否与模板一致");
|
|
|
|
260
|
+ }
|
|
198
|
list.forEach(item -> {
|
261
|
list.forEach(item -> {
|
|
199
|
item.setImportBatch(batchNo);
|
262
|
item.setImportBatch(batchNo);
|
|
200
|
item.setSourceType("1");
|
263
|
item.setSourceType("1");
|
|
@@ -210,7 +273,17 @@ public class LedgerImportController extends BaseController {
|
|
210
|
public AjaxResult importTerminalBonus(@RequestParam("file") MultipartFile file) throws Exception {
|
273
|
public AjaxResult importTerminalBonus(@RequestParam("file") MultipartFile file) throws Exception {
|
|
211
|
String batchNo = generateBatchNo();
|
274
|
String batchNo = generateBatchNo();
|
|
212
|
ExcelUtil<LedgerTerminalBonus> util = new ExcelUtil<>(LedgerTerminalBonus.class);
|
275
|
ExcelUtil<LedgerTerminalBonus> util = new ExcelUtil<>(LedgerTerminalBonus.class);
|
|
213
|
- List<LedgerTerminalBonus> list = util.importExcel(file.getInputStream());
|
|
|
|
|
|
276
|
+ // titleNum=1 表示跳过第1行标题,从第2行读取表头
|
|
|
|
277
|
+ List<LedgerTerminalBonus> list = util.importExcel(file.getInputStream(), 1);
|
|
|
|
278
|
+
|
|
|
|
279
|
+ // 过滤null元素,避免空指针异常
|
|
|
|
280
|
+ if (list != null) {
|
|
|
|
281
|
+ list.removeIf(item -> item == null);
|
|
|
|
282
|
+ }
|
|
|
|
283
|
+ if (list == null || list.isEmpty()) {
|
|
|
|
284
|
+ return AjaxResult.error("导入数据为空或解析失败,请检查Excel表头是否与模板一致");
|
|
|
|
285
|
+ }
|
|
|
|
286
|
+
|
|
214
|
list.forEach(item -> {
|
287
|
list.forEach(item -> {
|
|
215
|
item.setImportBatch(batchNo);
|
288
|
item.setImportBatch(batchNo);
|
|
216
|
item.setSourceType("1");
|
289
|
item.setSourceType("1");
|
|
@@ -226,7 +299,14 @@ public class LedgerImportController extends BaseController {
|
|
226
|
public AjaxResult importExamScore(@RequestParam("file") MultipartFile file) throws Exception {
|
299
|
public AjaxResult importExamScore(@RequestParam("file") MultipartFile file) throws Exception {
|
|
227
|
String batchNo = generateBatchNo();
|
300
|
String batchNo = generateBatchNo();
|
|
228
|
ExcelUtil<LedgerExamScore> util = new ExcelUtil<>(LedgerExamScore.class);
|
301
|
ExcelUtil<LedgerExamScore> util = new ExcelUtil<>(LedgerExamScore.class);
|
|
229
|
- List<LedgerExamScore> list = util.importExcel(file.getInputStream());
|
|
|
|
|
|
302
|
+ List<LedgerExamScore> list = util.importExcel(file.getInputStream(), 1);
|
|
|
|
303
|
+ // 过滤null元素,避免空指针异常
|
|
|
|
304
|
+ if (list != null) {
|
|
|
|
305
|
+ list.removeIf(item -> item == null);
|
|
|
|
306
|
+ }
|
|
|
|
307
|
+ if (list == null || list.isEmpty()) {
|
|
|
|
308
|
+ return AjaxResult.error("导入数据为空或解析失败,请检查Excel表头是否与模板一致");
|
|
|
|
309
|
+ }
|
|
230
|
list.forEach(item -> {
|
310
|
list.forEach(item -> {
|
|
231
|
item.setImportBatch(batchNo);
|
311
|
item.setImportBatch(batchNo);
|
|
232
|
item.setSourceType("1");
|
312
|
item.setSourceType("1");
|
|
@@ -241,9 +321,15 @@ public class LedgerImportController extends BaseController {
|
|
241
|
@PostMapping("/rewardApproval")
|
321
|
@PostMapping("/rewardApproval")
|
|
242
|
public AjaxResult importRewardApproval(@RequestParam("file") MultipartFile file) throws Exception {
|
322
|
public AjaxResult importRewardApproval(@RequestParam("file") MultipartFile file) throws Exception {
|
|
243
|
String batchNo = generateBatchNo();
|
323
|
String batchNo = generateBatchNo();
|
|
244
|
- ExcelUtil<LedgerRewardApproval> util =
|
|
|
|
245
|
- new ExcelUtil<>(LedgerRewardApproval.class);
|
|
|
|
246
|
- List<LedgerRewardApproval> list = util.importExcel(file.getInputStream());
|
|
|
|
|
|
324
|
+ ExcelUtil<LedgerRewardApproval> util = new ExcelUtil<>(LedgerRewardApproval.class);
|
|
|
|
325
|
+ List<LedgerRewardApproval> list = util.importExcel(file.getInputStream(), 1);
|
|
|
|
326
|
+ // 过滤null元素,避免空指针异常
|
|
|
|
327
|
+ if (list != null) {
|
|
|
|
328
|
+ list.removeIf(item -> item == null);
|
|
|
|
329
|
+ }
|
|
|
|
330
|
+ if (list == null || list.isEmpty()) {
|
|
|
|
331
|
+ return AjaxResult.error("导入数据为空或解析失败,请检查Excel表头是否与模板一致");
|
|
|
|
332
|
+ }
|
|
247
|
list.forEach(item -> {
|
333
|
list.forEach(item -> {
|
|
248
|
item.setImportBatch(batchNo);
|
334
|
item.setImportBatch(batchNo);
|
|
249
|
item.setSourceType("1");
|
335
|
item.setSourceType("1");
|
|
@@ -259,7 +345,14 @@ public class LedgerImportController extends BaseController {
|
|
259
|
public AjaxResult importDailyTraining(@RequestParam("file") MultipartFile file) throws Exception {
|
345
|
public AjaxResult importDailyTraining(@RequestParam("file") MultipartFile file) throws Exception {
|
|
260
|
String batchNo = generateBatchNo();
|
346
|
String batchNo = generateBatchNo();
|
|
261
|
ExcelUtil<LedgerDailyTraining> util = new ExcelUtil<>(LedgerDailyTraining.class);
|
347
|
ExcelUtil<LedgerDailyTraining> util = new ExcelUtil<>(LedgerDailyTraining.class);
|
|
262
|
- List<LedgerDailyTraining> list = util.importExcel(file.getInputStream());
|
|
|
|
|
|
348
|
+ List<LedgerDailyTraining> list = util.importExcel(file.getInputStream(), 1);
|
|
|
|
349
|
+ // 过滤null元素,避免空指针异常
|
|
|
|
350
|
+ if (list != null) {
|
|
|
|
351
|
+ list.removeIf(item -> item == null);
|
|
|
|
352
|
+ }
|
|
|
|
353
|
+ if (list == null || list.isEmpty()) {
|
|
|
|
354
|
+ return AjaxResult.error("导入数据为空或解析失败,请检查Excel表头是否与模板一致");
|
|
|
|
355
|
+ }
|
|
263
|
list.forEach(item -> { item.setImportBatch(batchNo); item.setSourceType("1"); item.setCreateBy(getUsername()); });
|
356
|
list.forEach(item -> { item.setImportBatch(batchNo); item.setSourceType("1"); item.setCreateBy(getUsername()); });
|
|
264
|
dailyTrainingService.batchInsert(list);
|
357
|
dailyTrainingService.batchInsert(list);
|
|
265
|
return AjaxResult.success("导入成功,共" + list.size() + "条");
|
358
|
return AjaxResult.success("导入成功,共" + list.size() + "条");
|
|
@@ -271,7 +364,14 @@ public class LedgerImportController extends BaseController {
|
|
271
|
public AjaxResult importLeaderDuty(@RequestParam("file") MultipartFile file) throws Exception {
|
364
|
public AjaxResult importLeaderDuty(@RequestParam("file") MultipartFile file) throws Exception {
|
|
272
|
String batchNo = generateBatchNo();
|
365
|
String batchNo = generateBatchNo();
|
|
273
|
ExcelUtil<LedgerLeaderDuty> util = new ExcelUtil<>(LedgerLeaderDuty.class);
|
366
|
ExcelUtil<LedgerLeaderDuty> util = new ExcelUtil<>(LedgerLeaderDuty.class);
|
|
274
|
- List<LedgerLeaderDuty> list = util.importExcel(file.getInputStream());
|
|
|
|
|
|
367
|
+ List<LedgerLeaderDuty> list = util.importExcel(file.getInputStream(), 1);
|
|
|
|
368
|
+ // 过滤null元素,避免空指针异常
|
|
|
|
369
|
+ if (list != null) {
|
|
|
|
370
|
+ list.removeIf(item -> item == null);
|
|
|
|
371
|
+ }
|
|
|
|
372
|
+ if (list == null || list.isEmpty()) {
|
|
|
|
373
|
+ return AjaxResult.error("导入数据为空或解析失败,请检查Excel表头是否与模板一致");
|
|
|
|
374
|
+ }
|
|
275
|
list.forEach(item -> { item.setImportBatch(batchNo); item.setSourceType("1"); item.setCreateBy(getUsername()); });
|
375
|
list.forEach(item -> { item.setImportBatch(batchNo); item.setSourceType("1"); item.setCreateBy(getUsername()); });
|
|
276
|
leaderDutyService.batchInsert(list);
|
376
|
leaderDutyService.batchInsert(list);
|
|
277
|
return AjaxResult.success("导入成功,共" + list.size() + "条");
|
377
|
return AjaxResult.success("导入成功,共" + list.size() + "条");
|
|
@@ -283,7 +383,14 @@ public class LedgerImportController extends BaseController {
|
|
283
|
public AjaxResult importHealthSoldier(@RequestParam("file") MultipartFile file) throws Exception {
|
383
|
public AjaxResult importHealthSoldier(@RequestParam("file") MultipartFile file) throws Exception {
|
|
284
|
String batchNo = generateBatchNo();
|
384
|
String batchNo = generateBatchNo();
|
|
285
|
ExcelUtil<LedgerHealthSoldier> util = new ExcelUtil<>(LedgerHealthSoldier.class);
|
385
|
ExcelUtil<LedgerHealthSoldier> util = new ExcelUtil<>(LedgerHealthSoldier.class);
|
|
286
|
- List<LedgerHealthSoldier> list = util.importExcel(file.getInputStream());
|
|
|
|
|
|
386
|
+ List<LedgerHealthSoldier> list = util.importExcel(file.getInputStream(), 1);
|
|
|
|
387
|
+ // 过滤null元素,避免空指针异常
|
|
|
|
388
|
+ if (list != null) {
|
|
|
|
389
|
+ list.removeIf(item -> item == null);
|
|
|
|
390
|
+ }
|
|
|
|
391
|
+ if (list == null || list.isEmpty()) {
|
|
|
|
392
|
+ return AjaxResult.error("导入数据为空或解析失败,请检查Excel表头是否与模板一致");
|
|
|
|
393
|
+ }
|
|
287
|
list.forEach(item -> { item.setImportBatch(batchNo); item.setSourceType("1"); item.setCreateBy(getUsername()); });
|
394
|
list.forEach(item -> { item.setImportBatch(batchNo); item.setSourceType("1"); item.setCreateBy(getUsername()); });
|
|
288
|
healthSoldierService.batchInsert(list);
|
395
|
healthSoldierService.batchInsert(list);
|
|
289
|
return AjaxResult.success("导入成功,共" + list.size() + "条");
|
396
|
return AjaxResult.success("导入成功,共" + list.size() + "条");
|
|
@@ -295,7 +402,14 @@ public class LedgerImportController extends BaseController {
|
|
295
|
public AjaxResult importDormFireSafety(@RequestParam("file") MultipartFile file) throws Exception {
|
402
|
public AjaxResult importDormFireSafety(@RequestParam("file") MultipartFile file) throws Exception {
|
|
296
|
String batchNo = generateBatchNo();
|
403
|
String batchNo = generateBatchNo();
|
|
297
|
ExcelUtil<LedgerDormFireSafety> util = new ExcelUtil<>(LedgerDormFireSafety.class);
|
404
|
ExcelUtil<LedgerDormFireSafety> util = new ExcelUtil<>(LedgerDormFireSafety.class);
|
|
298
|
- List<LedgerDormFireSafety> list = util.importExcel(file.getInputStream());
|
|
|
|
|
|
405
|
+ List<LedgerDormFireSafety> list = util.importExcel(file.getInputStream(), 1);
|
|
|
|
406
|
+ // 过滤null元素,避免空指针异常
|
|
|
|
407
|
+ if (list != null) {
|
|
|
|
408
|
+ list.removeIf(item -> item == null);
|
|
|
|
409
|
+ }
|
|
|
|
410
|
+ if (list == null || list.isEmpty()) {
|
|
|
|
411
|
+ return AjaxResult.error("导入数据为空或解析失败,请检查Excel表头是否与模板一致");
|
|
|
|
412
|
+ }
|
|
299
|
list.forEach(item -> { item.setImportBatch(batchNo); item.setSourceType("1"); item.setCreateBy(getUsername()); });
|
413
|
list.forEach(item -> { item.setImportBatch(batchNo); item.setSourceType("1"); item.setCreateBy(getUsername()); });
|
|
300
|
dormFireSafetyService.batchInsert(list);
|
414
|
dormFireSafetyService.batchInsert(list);
|
|
301
|
return AjaxResult.success("导入成功,共" + list.size() + "条");
|
415
|
return AjaxResult.success("导入成功,共" + list.size() + "条");
|
|
@@ -307,7 +421,14 @@ public class LedgerImportController extends BaseController {
|
|
307
|
public AjaxResult importTrainingIssue(@RequestParam("file") MultipartFile file) throws Exception {
|
421
|
public AjaxResult importTrainingIssue(@RequestParam("file") MultipartFile file) throws Exception {
|
|
308
|
String batchNo = generateBatchNo();
|
422
|
String batchNo = generateBatchNo();
|
|
309
|
ExcelUtil<LedgerTrainingIssue> util = new ExcelUtil<>(LedgerTrainingIssue.class);
|
423
|
ExcelUtil<LedgerTrainingIssue> util = new ExcelUtil<>(LedgerTrainingIssue.class);
|
|
310
|
- List<LedgerTrainingIssue> list = util.importExcel(file.getInputStream());
|
|
|
|
|
|
424
|
+ List<LedgerTrainingIssue> list = util.importExcel(file.getInputStream(), 1);
|
|
|
|
425
|
+ // 过滤null元素,避免空指针异常
|
|
|
|
426
|
+ if (list != null) {
|
|
|
|
427
|
+ list.removeIf(item -> item == null);
|
|
|
|
428
|
+ }
|
|
|
|
429
|
+ if (list == null || list.isEmpty()) {
|
|
|
|
430
|
+ return AjaxResult.error("导入数据为空或解析失败,请检查Excel表头是否与模板一致");
|
|
|
|
431
|
+ }
|
|
311
|
list.forEach(item -> { item.setImportBatch(batchNo); item.setSourceType("1"); item.setCreateBy(getUsername()); });
|
432
|
list.forEach(item -> { item.setImportBatch(batchNo); item.setSourceType("1"); item.setCreateBy(getUsername()); });
|
|
312
|
trainingIssueService.batchInsert(list);
|
433
|
trainingIssueService.batchInsert(list);
|
|
313
|
return AjaxResult.success("导入成功,共" + list.size() + "条");
|
434
|
return AjaxResult.success("导入成功,共" + list.size() + "条");
|
|
@@ -323,7 +444,14 @@ public class LedgerImportController extends BaseController {
|
|
323
|
public AjaxResult importRewardPenalty(@RequestParam("file") MultipartFile file) throws Exception {
|
444
|
public AjaxResult importRewardPenalty(@RequestParam("file") MultipartFile file) throws Exception {
|
|
324
|
String batchNo = generateBatchNo();
|
445
|
String batchNo = generateBatchNo();
|
|
325
|
ExcelUtil<LedgerRewardPenalty> util = new ExcelUtil<>(LedgerRewardPenalty.class);
|
446
|
ExcelUtil<LedgerRewardPenalty> util = new ExcelUtil<>(LedgerRewardPenalty.class);
|
|
326
|
- List<LedgerRewardPenalty> list = util.importExcel(file.getInputStream());
|
|
|
|
|
|
447
|
+ List<LedgerRewardPenalty> list = util.importExcel(file.getInputStream(), 1);
|
|
|
|
448
|
+ // 过滤null元素,避免空指针异常
|
|
|
|
449
|
+ if (list != null) {
|
|
|
|
450
|
+ list.removeIf(item -> item == null);
|
|
|
|
451
|
+ }
|
|
|
|
452
|
+ if (list == null || list.isEmpty()) {
|
|
|
|
453
|
+ return AjaxResult.error("导入数据为空或解析失败,请检查Excel表头是否与模板一致");
|
|
|
|
454
|
+ }
|
|
327
|
list.forEach(item -> { item.setImportBatch(batchNo); item.setSourceType("1"); item.setCreateBy(getUsername()); });
|
455
|
list.forEach(item -> { item.setImportBatch(batchNo); item.setSourceType("1"); item.setCreateBy(getUsername()); });
|
|
328
|
rewardPenaltyService.batchInsert(list);
|
456
|
rewardPenaltyService.batchInsert(list);
|
|
329
|
return AjaxResult.success("导入成功,共" + list.size() + "条");
|
457
|
return AjaxResult.success("导入成功,共" + list.size() + "条");
|
|
@@ -339,7 +467,14 @@ public class LedgerImportController extends BaseController {
|
|
339
|
public AjaxResult importLeaveSpecial(@RequestParam("file") MultipartFile file) throws Exception {
|
467
|
public AjaxResult importLeaveSpecial(@RequestParam("file") MultipartFile file) throws Exception {
|
|
340
|
String batchNo = generateBatchNo();
|
468
|
String batchNo = generateBatchNo();
|
|
341
|
ExcelUtil<LedgerLeaveSpecial> util = new ExcelUtil<>(LedgerLeaveSpecial.class);
|
469
|
ExcelUtil<LedgerLeaveSpecial> util = new ExcelUtil<>(LedgerLeaveSpecial.class);
|
|
342
|
- List<LedgerLeaveSpecial> list = util.importExcel(file.getInputStream());
|
|
|
|
|
|
470
|
+ List<LedgerLeaveSpecial> list = util.importExcel(file.getInputStream(), 1);
|
|
|
|
471
|
+ // 过滤null元素,避免空指针异常
|
|
|
|
472
|
+ if (list != null) {
|
|
|
|
473
|
+ list.removeIf(item -> item == null);
|
|
|
|
474
|
+ }
|
|
|
|
475
|
+ if (list == null || list.isEmpty()) {
|
|
|
|
476
|
+ return AjaxResult.error("导入数据为空或解析失败,请检查Excel表头是否与模板一致");
|
|
|
|
477
|
+ }
|
|
343
|
list.forEach(item -> { item.setImportBatch(batchNo); item.setSourceType("1"); item.setCreateBy(getUsername()); });
|
478
|
list.forEach(item -> { item.setImportBatch(batchNo); item.setSourceType("1"); item.setCreateBy(getUsername()); });
|
|
344
|
leaveSpecialService.batchInsert(list);
|
479
|
leaveSpecialService.batchInsert(list);
|
|
345
|
return AjaxResult.success("导入成功,共" + list.size() + "条");
|
480
|
return AjaxResult.success("导入成功,共" + list.size() + "条");
|
|
@@ -355,7 +490,14 @@ public class LedgerImportController extends BaseController {
|
|
355
|
public AjaxResult importBannerLetter(@RequestParam("file") MultipartFile file) throws Exception {
|
490
|
public AjaxResult importBannerLetter(@RequestParam("file") MultipartFile file) throws Exception {
|
|
356
|
String batchNo = generateBatchNo();
|
491
|
String batchNo = generateBatchNo();
|
|
357
|
ExcelUtil<LedgerBannerLetter> util = new ExcelUtil<>(LedgerBannerLetter.class);
|
492
|
ExcelUtil<LedgerBannerLetter> util = new ExcelUtil<>(LedgerBannerLetter.class);
|
|
358
|
- List<LedgerBannerLetter> list = util.importExcel(file.getInputStream());
|
|
|
|
|
|
493
|
+ List<LedgerBannerLetter> list = util.importExcel(file.getInputStream(), 1);
|
|
|
|
494
|
+ // 过滤null元素,避免空指针异常
|
|
|
|
495
|
+ if (list != null) {
|
|
|
|
496
|
+ list.removeIf(item -> item == null);
|
|
|
|
497
|
+ }
|
|
|
|
498
|
+ if (list == null || list.isEmpty()) {
|
|
|
|
499
|
+ return AjaxResult.error("导入数据为空或解析失败,请检查Excel表头是否与模板一致");
|
|
|
|
500
|
+ }
|
|
359
|
list.forEach(item -> { item.setImportBatch(batchNo); item.setSourceType("1"); item.setCreateBy(getUsername()); });
|
501
|
list.forEach(item -> { item.setImportBatch(batchNo); item.setSourceType("1"); item.setCreateBy(getUsername()); });
|
|
360
|
bannerLetterService.batchInsert(list);
|
502
|
bannerLetterService.batchInsert(list);
|
|
361
|
return AjaxResult.success("导入成功,共" + list.size() + "条");
|
503
|
return AjaxResult.success("导入成功,共" + list.size() + "条");
|