|
@@ -158,14 +158,14 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements IB
|
158
|
158
|
|
159
|
159
|
@Override
|
160
|
160
|
@Transactional(rollbackFor = Exception.class)
|
161
|
|
- public ResponseBean getExcelData(MultipartFile file) {
|
|
161
|
+ public ResponseBean getExcelData(MultipartFile file, UserElement userElement) {
|
162
|
162
|
ResponseBean responseBean = new ResponseBean();
|
163
|
163
|
if (file == null) {
|
164
|
164
|
responseBean.addError("对象不能为空");
|
165
|
165
|
return responseBean;
|
166
|
166
|
}
|
167
|
167
|
|
168
|
|
- responseBean = getExcelData(file, responseBean);
|
|
168
|
+ responseBean = getExcelData(file, responseBean, userElement.getCommunityId());
|
169
|
169
|
List<TempBill> tempBills = (List<TempBill>) responseBean.getData();
|
170
|
170
|
|
171
|
171
|
Map<String, Object> map = Maps.newHashMap();
|
|
@@ -213,7 +213,7 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements IB
|
213
|
213
|
return responseBean;
|
214
|
214
|
}
|
215
|
215
|
|
216
|
|
- responseBean = getExcelData(file, responseBean);
|
|
216
|
+ responseBean = getExcelData(file, responseBean, userElement.getCommunityId());
|
217
|
217
|
List<TempBill> tempBills = (List<TempBill>) responseBean.getData();
|
218
|
218
|
|
219
|
219
|
Double sumDouble = 0.0;
|
|
@@ -273,9 +273,18 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements IB
|
273
|
273
|
// int rows = billMapper.insert(bill);
|
274
|
274
|
boolean b = this.saveOrUpdate(bill);
|
275
|
275
|
if (b) {
|
|
276
|
+ QueryWrapper<Message> queryWrapper = new QueryWrapper<>();
|
|
277
|
+ queryWrapper.eq("community_id", userElement.getCommunityId());
|
|
278
|
+ queryWrapper.eq("message_type", "7");
|
|
279
|
+ queryWrapper.eq("model_type", "2");
|
|
280
|
+ queryWrapper.eq("source", "2");
|
|
281
|
+ queryWrapper.eq("status", "1");
|
|
282
|
+ queryWrapper.eq("advice_type","4");
|
|
283
|
+ queryWrapper.eq("bill_id", billId);
|
|
284
|
+ Message message = messageMapper.selectOne(queryWrapper);
|
276
|
285
|
// 草稿时插入消息
|
277
|
|
- if ("2".equals(bill.getBillStatus())) {
|
278
|
|
- Message message = new Message();
|
|
286
|
+ if ("2".equals(bill.getBillStatus()) && null == message) {
|
|
287
|
+ message = new Message();
|
279
|
288
|
message.setCommunityId(userElement.getCommunityId());
|
280
|
289
|
message.setMessageType("7");
|
281
|
290
|
message.setAdviceType("4");
|
|
@@ -295,14 +304,6 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements IB
|
295
|
304
|
}
|
296
|
305
|
// 发布时消息为无效
|
297
|
306
|
if ("0".equals(bill.getBillStatus())) {
|
298
|
|
- QueryWrapper<Message> queryWrapper = new QueryWrapper<>();
|
299
|
|
- queryWrapper.eq("community_id", userElement.getCommunityId());
|
300
|
|
- queryWrapper.eq("message_type", "7");
|
301
|
|
- queryWrapper.eq("model_type", "2");
|
302
|
|
- queryWrapper.eq("source", "2");
|
303
|
|
- queryWrapper.eq("status", "1");
|
304
|
|
- queryWrapper.eq("advice_type","4");
|
305
|
|
- Message message = messageMapper.selectOne(queryWrapper);
|
306
|
307
|
if (null != message) {
|
307
|
308
|
message.setStatus("0");
|
308
|
309
|
message.setUpdateDate(LocalDateTime.now());
|
|
@@ -310,7 +311,6 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements IB
|
310
|
311
|
messageMapper.updateById(message);
|
311
|
312
|
}
|
312
|
313
|
|
313
|
|
-
|
314
|
314
|
// 插入消息表, 消息类型为 消息
|
315
|
315
|
Message messageModel = new Message();
|
316
|
316
|
messageModel.setCommunityId(userElement.getCommunityId());
|
|
@@ -390,7 +390,7 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements IB
|
390
|
390
|
return responseBean;
|
391
|
391
|
}
|
392
|
392
|
|
393
|
|
- private ResponseBean getExcelData(MultipartFile file, ResponseBean responseBean) {
|
|
393
|
+ private ResponseBean getExcelData(MultipartFile file, ResponseBean responseBean, Integer communityId) {
|
394
|
394
|
|
395
|
395
|
// 数据
|
396
|
396
|
List<TempBill> tempBills = Lists.newArrayList();
|
|
@@ -424,26 +424,39 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements IB
|
424
|
424
|
int currentRow = i + 1;
|
425
|
425
|
Row row = sheetAt.getRow(i);
|
426
|
426
|
Cell cell = getCell(row.getCell(0));
|
|
427
|
+ if (null == cell) {
|
|
428
|
+ throw new WisdomException("第" + currentRow + "行 编号 不能为空");
|
|
429
|
+ }
|
|
430
|
+ // 获取编号
|
|
431
|
+ String roomId = cell.getStringCellValue().trim();
|
|
432
|
+ QueryWrapper<TpRoomNo> roomNoQueryWrapper = new QueryWrapper<>();
|
|
433
|
+ roomNoQueryWrapper.eq("community_id", communityId);
|
|
434
|
+ roomNoQueryWrapper.eq("id", roomId);
|
|
435
|
+ TpRoomNo tpRoomNo = tpRoomNoMapper.selectOne(roomNoQueryWrapper);
|
|
436
|
+ if (null == tpRoomNo) {
|
|
437
|
+ throw new WisdomException("编号: " + roomId + " 不是本小区的房产");
|
|
438
|
+ }
|
|
439
|
+ cell = getCell(row.getCell(1));
|
427
|
440
|
if (null == cell) {
|
428
|
441
|
throw new WisdomException("第" + currentRow + "行 期/区 不能为空");
|
429
|
442
|
}
|
430
|
443
|
String phase = cell.getStringCellValue().trim();
|
431
|
|
- cell = getCell(row.getCell(1));
|
|
444
|
+ cell = getCell(row.getCell(2));
|
432
|
445
|
if (null == cell) {
|
433
|
446
|
throw new WisdomException("第" + currentRow + "行 楼栋 不能为空");
|
434
|
447
|
}
|
435
|
448
|
String building = cell.getStringCellValue().trim();
|
436
|
|
- cell = getCell(row.getCell(2));
|
|
449
|
+ cell = getCell(row.getCell(3));
|
437
|
450
|
if (null == cell) {
|
438
|
451
|
throw new WisdomException("第" + currentRow + "行 单元 不能为空");
|
439
|
452
|
}
|
440
|
453
|
String unit = cell.getStringCellValue().trim();
|
441
|
|
- cell = getCell(row.getCell(3));
|
|
454
|
+ cell = getCell(row.getCell(4));
|
442
|
455
|
if (null == cell) {
|
443
|
456
|
throw new WisdomException("第" + currentRow + "行 楼层 不能为空");
|
444
|
457
|
}
|
445
|
458
|
String level = cell.getStringCellValue().trim();
|
446
|
|
- cell = getCell(row.getCell(4));
|
|
459
|
+ cell = getCell(row.getCell(5));
|
447
|
460
|
if (null == cell) {
|
448
|
461
|
throw new WisdomException("第" + currentRow + "行 房号 不能为空");
|
449
|
462
|
}
|
|
@@ -451,7 +464,7 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements IB
|
451
|
464
|
|
452
|
465
|
|
453
|
466
|
// 收费说明可以为空
|
454
|
|
- cell = getCell(row.getCell(5));
|
|
467
|
+ cell = getCell(row.getCell(6));
|
455
|
468
|
String billExplain = null;
|
456
|
469
|
if (null != cell) {
|
457
|
470
|
billExplain = cell.getStringCellValue().trim();
|
|
@@ -460,7 +473,7 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements IB
|
460
|
473
|
}
|
461
|
474
|
}
|
462
|
475
|
|
463
|
|
- cell = getCell(row.getCell(6));
|
|
476
|
+ cell = getCell(row.getCell(7));
|
464
|
477
|
if (null == cell) {
|
465
|
478
|
throw new WisdomException("第" + currentRow + "行 金额 不能为空");
|
466
|
479
|
}
|
|
@@ -624,14 +637,16 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements IB
|
624
|
637
|
TpRoomNo tpRoomNo = records.get(index);
|
625
|
638
|
row = sheet.createRow(currentRow);
|
626
|
639
|
cell = row.createCell(0);
|
627
|
|
- cell.setCellValue(tpRoomNo.getPhaseName());
|
|
640
|
+ cell.setCellValue(tpRoomNo.getId() + "");
|
628
|
641
|
cell = row.createCell(1);
|
629
|
|
- cell.setCellValue(tpRoomNo.getBuildingName());
|
|
642
|
+ cell.setCellValue(tpRoomNo.getPhaseName());
|
630
|
643
|
cell = row.createCell(2);
|
631
|
|
- cell.setCellValue(tpRoomNo.getUnitName());
|
|
644
|
+ cell.setCellValue(tpRoomNo.getBuildingName());
|
632
|
645
|
cell = row.createCell(3);
|
633
|
|
- cell.setCellValue(tpRoomNo.getLevelName());
|
|
646
|
+ cell.setCellValue(tpRoomNo.getUnitName());
|
634
|
647
|
cell = row.createCell(4);
|
|
648
|
+ cell.setCellValue(tpRoomNo.getLevelName());
|
|
649
|
+ cell = row.createCell(5);
|
635
|
650
|
cell.setCellValue(tpRoomNo.getName());
|
636
|
651
|
currentRow ++;
|
637
|
652
|
index ++;
|