Browse Source

对账单

skyline 2 năm trước cách đây
mục cha
commit
3ff9a65323

+ 21 - 17
admin-web/src/views/admin/station/statment/dialog.vue

@@ -54,23 +54,23 @@
         </tr>
         <tr style="text-align: center">
           <td>站点名称</td>
-          <td>充电电量</td>
+          <td>订单电量</td>
           <td>①订单电费</td>
           <td>电表电量</td>
           <td>②电表电费</td>
           <td>电损金额=②-①</td>
-          <td>对账服务费</td>
-          <td>订单总金额</td>
+          <td>实收对账服务费</td>
+          <td>订单实收总金额</td>
         </tr>
         <tr style="text-align: center">
           <td>{{ state.ruleForm.stationName }}</td>
-          <td>{{ state.ruleForm.actualElecMoney }}</td>
-          <td>{{ u.fmt.fmtMoney(state.ruleForm.totalMoney) }}</td>
-          <td>{{ state.ruleForm.actualPower }}</td>
+          <td>{{ state.ruleForm.totalPower }}</td>
           <td>{{ u.fmt.fmtMoney(state.ruleForm.elecMoney) }}</td>
+          <td>{{ state.ruleForm.actualPower }}</td>
+          <td>{{ u.fmt.fmtMoney(state.ruleForm.actualPower) }}</td>
           <td>{{ u.fmt.fmtMoney(state.ruleForm.elecLossMoney) }}</td>
-          <td>{{ u.fmt.fmtMoney(state.ruleForm.serviceMoney) }}</td>
-          <td>{{ u.fmt.fmtMoney(state.ruleForm.totalMoney) }}</td>
+          <td>{{ u.fmt.fmtMoney(state.ruleForm.serviceMoney - state.ruleForm.discountAmount) }}</td>
+          <td>{{ u.fmt.fmtMoney(state.ruleForm.totalMoney - state.ruleForm.discountAmount) }}</td>
         </tr>
         <tr style="background-color: lightsteelblue">
           <td colspan="9">二、客户结算数据(含税)(电费和服务费以及金额单位为“元”)</td>
@@ -78,18 +78,22 @@
         <tr style="text-align: center">
           <td>站点名称</td>
           <td>①对账服务费</td>
-          <td>②电损金额</td>
-          <td colspan="2">③实际服务费收入=①-②</td>
-          <td>④分成比例</td>
-          <td colspan="2">分成金额=③*④</td>
+          <td>②服务费分成比例</td>
+          <td>③服务费分成</td>
+          <td>④电损金额</td>
+          <td>⑤电损承担比例</td>
+          <td>⑥电损承担金额</td>
+          <td>⑦分成金额=③-⑥</td>
         </tr>
         <tr style="text-align: center">
           <td>{{ state.ruleForm.stationName }}</td>
-          <td>{{ u.fmt.fmtMoney(state.ruleForm.serviceMoney) }}</td>
-          <td>{{ u.fmt.fmtMoney(state.ruleForm.elecLossMoney) }}</td>
-          <td colspan="2">{{ u.fmt.fmtMoney(state.ruleForm.actualServiceMoney) }}</td>
+          <td>{{ u.fmt.fmtMoney(state.ruleForm.actualServiceMoney) }}</td>
           <td>{{(state.ruleForm.splittingProportion*100).toFixed(2)}}%</td>
-          <td colspan="2">{{ u.fmt.fmtMoney(state.ruleForm.splittingAmount) }}</td>
+          <td>{{ u.fmt.fmtMoney(state.ruleForm.actualServiceMoney * state.ruleForm.splittingProportion)}}</td>
+          <td>{{ u.fmt.fmtMoney(state.ruleForm.elecLossMoney) }}</td>
+          <td>{{(state.ruleForm.elecLossProportion*100).toFixed(2)}}%</td>
+          <td>{{ u.fmt.fmtMoney(state.ruleForm.elecLossAmount) }}</td>
+          <td>{{ u.fmt.fmtMoney(state.ruleForm.actualServiceMoney * state.ruleForm.splittingProportion - state.ruleForm.elecLossAmount) }}</td>
         </tr>
         <tr style="background-color: lightsteelblue">
           <td colspan="9">三、客户结算数据(不含税)(税额和金额单位为“元”)</td>
@@ -101,7 +105,7 @@
           <td colspan="3">应付金额=①-②</td>
         </tr>
         <tr style="text-align: center">
-          <td colspan="2">{{ u.fmt.fmtMoney(state.ruleForm.splittingAmount) }}</td>
+          <td colspan="2">{{ u.fmt.fmtMoney(state.ruleForm.actualServiceMoney * state.ruleForm.splittingProportion - state.ruleForm.elecLossAmount) }}</td>
           <td colspan="2">{{(state.ruleForm.vatRate*100).toFixed(2)}}%</td>
           <td colspan="2">{{ u.fmt.fmtMoney(state.ruleForm.vatAmount) }}</td>
           <td colspan="2">{{ u.fmt.fmtMoney(state.ruleForm.actualSplittingAmount) }}</td>

+ 8 - 8
service/src/main/java/com/kym/service/admin/impl/StatementsServiceImpl.java

@@ -3,6 +3,7 @@ package com.kym.service.admin.impl;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.PageHelper;
+import com.kym.common.exception.BusinessException;
 import com.kym.common.utils.CommUtil;
 import com.kym.entity.admin.InvestorInfo;
 import com.kym.entity.admin.Statements;
@@ -50,7 +51,7 @@ public class StatementsServiceImpl extends ServiceImpl<StatementsMapper, Stateme
 
         // 校验站点月统计信息已填写实际抄表电量和实际抄表电费金额
         if (statMonthInfo.getActualPower() == null || statMonthInfo.getActualElecMoney() == null) {
-            throw new RuntimeException("请先完善月统计实际抄表电量和实际抄表电费金额");
+            throw new BusinessException("请先完善月统计实际抄表电量和实际抄表电费金额");
         }
 
         // 站点关联客户和物业信息
@@ -59,19 +60,18 @@ public class StatementsServiceImpl extends ServiceImpl<StatementsMapper, Stateme
                 .list();
 
         if (CommUtil.isEmptyOrNull(investorInfoList)) {
-            throw new RuntimeException("请先完善站点相关投资者/物业信息");
+            throw new BusinessException("请先完善站点相关投资者/物业信息");
         }
 
         // 创建客户对账单
         var res = investorInfoList.stream().map(investorInfo -> {
             // 实际参与分成的服务费=总服务费-优惠金额-电损电费
-            var actualServiceMoney = statMonthInfo.getServiceMoney()
-                    - statMonthInfo.getDiscountAmount()
-                    - (int) ((statMonthInfo.getActualElecMoney() - statMonthInfo.getElecMoney()) * investorInfo.getElecLossProportion());
+            var actualServiceMoney = statMonthInfo.getServiceMoney() - statMonthInfo.getDiscountAmount();
             // 总电损电费
             var elecLossMoney = statMonthInfo.getActualElecMoney() - statMonthInfo.getElecMoney();
+            var elecLossAmount = (int) (elecLossMoney * investorInfo.getElecLossProportion());
             // 分成金额 = 实际参与分成的服务费 * 分成比例 - 电损金额 * 电损承担比例
-            var splittingAmount = (int) (actualServiceMoney * investorInfo.getSplittingProportion()) - (int) (elecLossMoney * investorInfo.getElecLossProportion());
+            var splittingAmount = (int) (actualServiceMoney * investorInfo.getSplittingProportion()) - elecLossAmount;
             return new Statements()
                     .setAdminUserId(investorInfo.getAdminUserId())
                     .setAdminUserName(investorInfo.getAdminUserName())
@@ -94,8 +94,8 @@ public class StatementsServiceImpl extends ServiceImpl<StatementsMapper, Stateme
                     .setElecLossProportion(investorInfo.getElecLossProportion()) // 电损承担比例
                     .setElecLossAmount((int) (elecLossMoney * investorInfo.getElecLossProportion()))    // 电损承担金额
                     .setVatRate(investorInfo.getVatRate()) // 增值税率 0.06表示6%
-                    .setVatAmount((int) (splittingAmount * investorInfo.getVatRate())) // 增值税额(分)
-                    .setActualSplittingAmount(splittingAmount - (int) (splittingAmount * investorInfo.getVatRate())); // 实际分成金额(分)
+                    .setVatAmount((int) (splittingAmount / (1 + investorInfo.getVatRate()) * investorInfo.getVatRate() * 1.12)) // 增值税额(分)
+                    .setActualSplittingAmount(splittingAmount - (int) (splittingAmount / (1 + investorInfo.getVatRate()) * investorInfo.getVatRate() * 1.12)); // 实际分成金额(分)
         }).toList();
         saveBatch(res);
     }