|
@@ -78,7 +78,7 @@ public class BillGenerationServiceImpl {
|
|
|
public void generateBill(List<SwWaterUsageEntryDo> swWaterUsageEntryDoList, Map<String, SwUserManagementDo> userMap) {
|
|
|
String dsKey = ContextHolder.getValue("dsKey");
|
|
|
log.info("dsKey:{}", dsKey);
|
|
|
- log.debug("需要生成账单的抄表记录为:{}", swWaterUsageEntryDoList);
|
|
|
+ log.debug("需要生成账单的抄表记录为:{},条数为:{}", swWaterUsageEntryDoList,swWaterUsageEntryDoList.size());
|
|
|
long asyncTasksStart = System.currentTimeMillis();
|
|
|
// 对数据按照抄表日期排序
|
|
|
List<SwWaterUsageEntryDo> collect = swWaterUsageEntryDoList.parallelStream()
|
|
@@ -148,12 +148,19 @@ public class BillGenerationServiceImpl {
|
|
|
saveUsageEntryList.add(usageEntryDo);
|
|
|
continue;
|
|
|
}
|
|
|
- try {
|
|
|
- // 生成代缴费账单
|
|
|
- swBillManagementUnpaidDo = produceBill(swUserManagementDo, swWaterUsageEntry, currentUser);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- log.error("缴费记录生成失败原因:{}", e.getMessage());
|
|
|
+ // 特殊处理 上次抄表数为1本次为0
|
|
|
+ if(BigDecimal.ZERO.compareTo(swWaterUsageEntry.getThisreading())==0 && BigDecimal.ONE.compareTo(swWaterUsageEntry.getLastreading())==0 ) {
|
|
|
+ log.debug("户号:{}上次抄表数为1本次为0", swWaterUsageEntry.getUsernumber());
|
|
|
+ // 不生成账单
|
|
|
+ usageEntryDo.setState("5");
|
|
|
+ }else{
|
|
|
+ try {
|
|
|
+ // 生成代缴费账单
|
|
|
+ swBillManagementUnpaidDo = produceBill(swUserManagementDo, swWaterUsageEntry, currentUser);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error("缴费记录生成失败原因:{}", e.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (swBillManagementUnpaidDo == null) {
|
|
@@ -265,6 +272,8 @@ public class BillGenerationServiceImpl {
|
|
|
if (waterPrice == null || waterPrice.compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
throw new CustomException("当前用户水价异常:" + waterPrice);
|
|
|
}
|
|
|
+ // TODO at [ 2025-07-17】 xh: 考虑后续可能增加阶梯水价的逻辑
|
|
|
+
|
|
|
BigDecimal meterMaxValue = swUserManagementDo.getMetermaxvalue();
|
|
|
if (meterMaxValue == null || meterMaxValue.compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
throw new CustomException("当前用户表具最大度数异常:" + meterMaxValue);
|