|
|
@@ -36,21 +36,23 @@ public class StatementsServiceImpl extends ServiceImpl<StatementsMapper, Stateme
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public void createStatements(String stationId, String statMonth) {
|
|
|
+ public void createStatements(String statMonthId) {
|
|
|
// 站点统计信息
|
|
|
var statMonthInfo = stationStatMonthService.lambdaQuery()
|
|
|
- .eq(StationStatMonth::getStationId, stationId)
|
|
|
- .eq(StationStatMonth::getStatMonth, statMonth)
|
|
|
+ .eq(StationStatMonth::getId, statMonthId)
|
|
|
.one();
|
|
|
// 站点关联客户和物业信息
|
|
|
var investorInfoList = investorInfoService.lambdaQuery()
|
|
|
- .eq(InvestorInfo::getStationId, stationId)
|
|
|
+ .eq(InvestorInfo::getStationId, statMonthInfo.getStationId())
|
|
|
.list();
|
|
|
|
|
|
// 创建客户对账单
|
|
|
var res = investorInfoList.stream().map(investorInfo -> {
|
|
|
- var actualServiceMoney = statMonthInfo.getServiceMoney() - statMonthInfo.getDiscountAmount() - (statMonthInfo.getActualElecMoney() - statMonthInfo.getElecMoney());
|
|
|
- var vatAmount = (int) (actualServiceMoney * investorInfo.getVatRate());
|
|
|
+ // 实际参与分成的服务费=总服务费-优惠金额-电损电费
|
|
|
+ var actualServiceMoney = statMonthInfo.getServiceMoney()
|
|
|
+ - statMonthInfo.getDiscountAmount()
|
|
|
+ - (int) ((statMonthInfo.getActualElecMoney() - statMonthInfo.getElecMoney()) * investorInfo.getElecLossProportion());
|
|
|
+ var splittingAmount = (int) (actualServiceMoney * investorInfo.getSplittingProportion());
|
|
|
return new Statements()
|
|
|
.setAdminUserId(investorInfo.getAdminUserId())
|
|
|
.setAdminUserName(investorInfo.getAdminUserName())
|
|
|
@@ -62,16 +64,17 @@ public class StatementsServiceImpl extends ServiceImpl<StatementsMapper, Stateme
|
|
|
.setElecLossPower(statMonthInfo.getActualPower() - statMonthInfo.getTotalPower()) // 电损电量
|
|
|
.setTotalMoney(statMonthInfo.getTotalMoney())
|
|
|
.setElecMoney(statMonthInfo.getElecMoney())
|
|
|
+ .setActualElecMoney(statMonthInfo.getActualElecMoney())// 实际抄表电费
|
|
|
.setElecLossMoney(statMonthInfo.getActualElecMoney() - statMonthInfo.getElecMoney()) // 电损电费(分)
|
|
|
.setServiceMoney(statMonthInfo.getServiceMoney())
|
|
|
.setDiscountAmount(statMonthInfo.getDiscountAmount())
|
|
|
.setServiceMoneyDiscount(statMonthInfo.getServiceMoneyDiscount())
|
|
|
.setActualServiceMoney(actualServiceMoney) // 实际参与分成的服务费(分)
|
|
|
.setSplittingProportion(investorInfo.getSplittingProportion()) // 分成比例 0.45表示45%
|
|
|
- .setSplittingAmount((int) (actualServiceMoney * investorInfo.getSplittingProportion())) // 分成金额(分)
|
|
|
+ .setSplittingAmount(splittingAmount) // 分成金额(分)
|
|
|
.setVatRate(investorInfo.getVatRate()) // 增值税率 0.06表示6%
|
|
|
- .setVatAmount(vatAmount) // 增值税额(分)
|
|
|
- .setActualSplittingAmount(actualServiceMoney - vatAmount); // 实际分成金额(分)
|
|
|
+ .setVatAmount((int) (splittingAmount * investorInfo.getVatRate())) // 增值税额(分)
|
|
|
+ .setActualSplittingAmount(splittingAmount - (int) (splittingAmount * investorInfo.getVatRate())); // 实际分成金额(分)
|
|
|
}).toList();
|
|
|
saveBatch(res);
|
|
|
}
|