|
@@ -794,6 +794,10 @@ public class AmountWaterUsedAmountServiceImpl implements AmountWaterUsedAmountSe
|
|
|
List<EstimatedDayDto> list = amountWaterUsedAmountMapper.getEstimatedDay(beforDate,baseClosingAccountInfoDto.getYear(),baseClosingAccountInfoDto.getMonth(),siteId,customerId);
|
|
|
if(list != null && list.size() > 0){
|
|
|
for(EstimatedDayDto dto:list){
|
|
|
+
|
|
|
+ PayBaseCustomerandmeterrela customerInfo = payBaseCustomerandmeterrelaMapper.get(dto.getId());
|
|
|
+ Integer calculateway = customerInfo.getCalculateway();//结算方式
|
|
|
+
|
|
|
BigDecimal dayReading = dto.getDayReading();
|
|
|
BigDecimal mReading = dto.getMReading();
|
|
|
String readdate = dto.getReaddate();
|
|
@@ -806,6 +810,14 @@ public class AmountWaterUsedAmountServiceImpl implements AmountWaterUsedAmountSe
|
|
|
if(dayReading != null && mReading != null){
|
|
|
BigDecimal amount = dayReading.subtract(mReading);
|
|
|
|
|
|
+ // 0水量 不计费但计量
|
|
|
+ if(amount.intValue()<=0|| calculateway == 3){
|
|
|
+ amount = new BigDecimal(0);
|
|
|
+ }
|
|
|
+ if(calculateway ==2){
|
|
|
+ amount = customerInfo.getFixedamount();
|
|
|
+ }
|
|
|
+
|
|
|
Integer isEnable = this.isEnable(baseClosingAccountInfoDto.getYear(),baseClosingAccountInfoDto.getMonth(),watermeterId,waterPropertyId,siteId,customerId);
|
|
|
//isEnable 0非阶梯 1阶梯 2异常(不做处理)
|
|
|
if(isEnable ==0){
|
|
@@ -835,6 +847,18 @@ public class AmountWaterUsedAmountServiceImpl implements AmountWaterUsedAmountSe
|
|
|
if (objAmount != null) {
|
|
|
availableAmount = new BigDecimal(objAmount.toString());
|
|
|
}
|
|
|
+ if(availableAmount.compareTo(BigDecimal.ZERO) == 0){
|
|
|
+ Object objlableL = new Object();
|
|
|
+ if(i > 1){
|
|
|
+ Object objlableL1 = ReflectionsUtil.getFieldValue(payBaseAccount, "availableL" + i);
|
|
|
+ objlableL = ReflectionsUtil.getFieldValue(payBaseAccount, "availableL" + (i-1));
|
|
|
+ //减去前一阶的阶梯量
|
|
|
+ availableAmount = new BigDecimal(objlableL1.toString()).subtract(new BigDecimal(objlableL.toString()));
|
|
|
+ }else{
|
|
|
+ objlableL = ReflectionsUtil.getFieldValue(payBaseAccount, "availableL" + i);
|
|
|
+ availableAmount = new BigDecimal(objlableL.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
//阶梯结算水量
|
|
|
BigDecimal calAmount = BigDecimal.ZERO;
|
|
|
if (availableAmount.intValue() > 0) {
|
|
@@ -863,6 +887,11 @@ public class AmountWaterUsedAmountServiceImpl implements AmountWaterUsedAmountSe
|
|
|
balance = remaining.subtract(fee);
|
|
|
}
|
|
|
}
|
|
|
+ //查询该户是否有历史欠费
|
|
|
+ BigDecimal historyDebt = payPayReceivableMapper.getHistoryDebt(siteId,customerId,accountId);
|
|
|
+ historyDebt = historyDebt != null ? historyDebt : BigDecimal.ZERO;
|
|
|
+ //如果有欠费必须加上之前欠费
|
|
|
+ balance = balance.add(historyDebt.negate());
|
|
|
payRechargeaccountMapper.updateBalance(balance,new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()),payRechargeaccountDto.getId());
|
|
|
//修改账户用水余额字段跟预计费日期
|
|
|
log.info("【"+payRechargeaccountDto.getAccountnumber()+"】户:用水余额:"+balance+",预计费日期:"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|