|
@@ -95,7 +95,7 @@ public class BillGenerationServiceImpl {
|
|
|
// 本次抄表日期
|
|
|
Date currentreadingdate = swWaterUsageEntry.getCurrentreadingdate();
|
|
|
// 校验 是否已存在抄表记录
|
|
|
- if (swWaterUsageEntry.getState() != 0) {
|
|
|
+ if (swWaterUsageEntry.getState() == 1) {
|
|
|
log.error("当前用户:{},时间:{}的抄表记录已生成账单信息", usernumber, currentreadingdate);
|
|
|
return;
|
|
|
}
|
|
@@ -127,6 +127,7 @@ public class BillGenerationServiceImpl {
|
|
|
// 生成代缴费账单
|
|
|
swBillManagementUnpaidDo= produceBill(swUserManagementDo, swWaterUsageEntry);
|
|
|
}catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
log.error("缴费记录生成失败原因:{}",e.getMessage());
|
|
|
}
|
|
|
|
|
@@ -180,15 +181,23 @@ public class BillGenerationServiceImpl {
|
|
|
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
|
|
|
TransactionStatus status = transactionManager.getTransaction(def);
|
|
|
try {
|
|
|
- // 抄表记录状态更新
|
|
|
- swWaterUsageEntryService.updateBatchById(saveUsageEntryList,4000);
|
|
|
- // 账单保存
|
|
|
- swBillManagementUnpaidService.saveBatch(swBillManagementUnpaidDos, 1000);
|
|
|
- // 更新用户表的本次抄表时间和本次抄表度数
|
|
|
- swUserManagementService.updateBatchById(userSaveList);
|
|
|
+ if(!saveUsageEntryList.isEmpty()){
|
|
|
+ // 抄表记录状态更新
|
|
|
+ swWaterUsageEntryService.updateBatchById(saveUsageEntryList,4000);
|
|
|
+ }
|
|
|
+ if(!swBillManagementUnpaidDos.isEmpty()){
|
|
|
+ // 账单保存
|
|
|
+ swBillManagementUnpaidService.saveBatch(swBillManagementUnpaidDos, 1000);
|
|
|
+ }
|
|
|
+ if(!userSaveList.isEmpty()){
|
|
|
+ // 更新用户表的本次抄表时间和本次抄表度数
|
|
|
+ swUserManagementService.updateBatchById(userSaveList);
|
|
|
+ }
|
|
|
+
|
|
|
// 事务性操作
|
|
|
transactionManager.commit(status);
|
|
|
} catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
transactionManager.rollback(status);
|
|
|
log.error("账单保存异常");
|
|
|
}
|