|
@@ -58,16 +58,25 @@ public class BillGenerationServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 异步方法
|
|
|
+ * @param swWaterUsageEntryDoList
|
|
|
+ * @param attributes
|
|
|
+ */
|
|
|
@Async(value = "zhswThreadPool")
|
|
|
- public void generateBill(List<SwWaterUsageEntryDo> swWaterUsageEntryDoList, ServletRequestAttributes attributes) {
|
|
|
+ public void asyncGenerateBill(List<SwWaterUsageEntryDo> swWaterUsageEntryDoList, ServletRequestAttributes attributes){
|
|
|
RequestContextHolder.setRequestAttributes(attributes);
|
|
|
SysUserVo currentUser = ZHSWCommonUtils.getCurrentUser();
|
|
|
-
|
|
|
log.info("当前生成账单的用户:{},所属的租户库为:{}", currentUser.getAccount(), currentUser.getTenantDo().getDskey());
|
|
|
if (swWaterUsageEntryDoList == null || swWaterUsageEntryDoList.isEmpty()) {
|
|
|
log.error("暂无需要生成账单的信息");
|
|
|
return;
|
|
|
}
|
|
|
+ generateBill(swWaterUsageEntryDoList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void generateBill(List<SwWaterUsageEntryDo> swWaterUsageEntryDoList) {
|
|
|
log.debug("需要生成账单的抄表记录为:{}", swWaterUsageEntryDoList);
|
|
|
// 对数据按照抄表日期排序
|
|
|
List<SwWaterUsageEntryDo> collect = swWaterUsageEntryDoList.stream()
|
|
@@ -165,7 +174,7 @@ public class BillGenerationServiceImpl {
|
|
|
public void generateBill(String id, ServletRequestAttributes attributes) {
|
|
|
log.info("开始给抄表记录:{},生成账单信息", id);
|
|
|
SwWaterUsageEntryDo swWaterUsageEntryDo = swWaterUsageEntryService.getById(id);
|
|
|
- this.generateBill(Collections.singletonList(swWaterUsageEntryDo), attributes);
|
|
|
+ this.asyncGenerateBill(Collections.singletonList(swWaterUsageEntryDo), attributes);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -175,7 +184,7 @@ public class BillGenerationServiceImpl {
|
|
|
return;
|
|
|
}
|
|
|
log.info("开始给抄表记录:{},生成账单信息", ids);
|
|
|
- this.generateBill(swWaterUsageEntryService.getBaseMapper().selectBatchIds(ids), attributes);
|
|
|
+ this.asyncGenerateBill(swWaterUsageEntryService.getBaseMapper().selectBatchIds(ids), attributes);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -185,7 +194,7 @@ public class BillGenerationServiceImpl {
|
|
|
.eq(SwWaterUsageEntryDo::getDeleted, "0")
|
|
|
.eq(SwWaterUsageEntryDo::getState, 0));
|
|
|
log.info("开始给抄表记录:{},生成账单信息", list.stream().map(SwWaterUsageEntryDo::getId).collect(Collectors.toList()));
|
|
|
- this.generateBill(list, attributes);
|
|
|
+ this.asyncGenerateBill(list, attributes);
|
|
|
}
|
|
|
|
|
|
/**
|