From dbdddbec65bf4d446111e4c14794da92b8af54d0 Mon Sep 17 00:00:00 2001 From: 18650502300 <18650502300@163.com> Date: Tue, 4 Mar 2025 15:58:05 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=A2=9E=E5=8A=A0=E6=8A=BC?= =?UTF-8?q?=E9=87=91=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/system/domain/vo/IndexAdminVo.java | 22 +++++++++++ .../com/ruoyi/system/mapper/AsUserMapper.java | 6 +++ .../ruoyi/system/service/IAsUserService.java | 6 +++ .../service/impl/AsUserServiceImpl.java | 8 ++++ .../service/impl/EtOrderServiceImpl.java | 37 +++++++++++++++++++ .../resources/mapper/system/AsUserMapper.xml | 12 +++++- 6 files changed, 90 insertions(+), 1 deletion(-) diff --git a/electripper-system/src/main/java/com/ruoyi/system/domain/vo/IndexAdminVo.java b/electripper-system/src/main/java/com/ruoyi/system/domain/vo/IndexAdminVo.java index 96979a9..b38cd68 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/domain/vo/IndexAdminVo.java +++ b/electripper-system/src/main/java/com/ruoyi/system/domain/vo/IndexAdminVo.java @@ -87,6 +87,9 @@ public class IndexAdminVo { /** 收入及成本 */ private List incomeCostList; + /** 押金统计list */ + private List depositList; + /** * 营收统计 incomeVo */ @@ -114,6 +117,25 @@ public class IndexAdminVo { private BigDecimal platformProfit; // 平台盈利 } + /** + * 押金统计 + */ + @Data + public static class DepositVo { + /** 日期 */ + private String day; + /** 押金充值 */ + private BigDecimal pay; + /** 押金退款 */ + private BigDecimal refund; + /** 押金抵扣 */ + private BigDecimal deduction; + /** 押金盈余 */ + private BigDecimal surplus; + /** 押金余额 */ + private BigDecimal balance; + } + /** * 车辆统计 diff --git a/electripper-system/src/main/java/com/ruoyi/system/mapper/AsUserMapper.java b/electripper-system/src/main/java/com/ruoyi/system/mapper/AsUserMapper.java index 4f0e70e..2ab5560 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/mapper/AsUserMapper.java +++ b/electripper-system/src/main/java/com/ruoyi/system/mapper/AsUserMapper.java @@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.entity.AsUser; import com.ruoyi.common.core.domain.vo.LabelVo; import org.apache.ibatis.annotations.Param; +import java.math.BigDecimal; import java.util.List; /** @@ -199,4 +200,9 @@ public interface AsUserMapper * 解绑系统用户 */ int unbindSystemUserBySysUserId(Long sysUserId); + + /** + * 获取押金余额 + */ + BigDecimal getDepositBalance(String formattedDate); } diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/IAsUserService.java b/electripper-system/src/main/java/com/ruoyi/system/service/IAsUserService.java index 23f7b0b..c0d26e6 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/IAsUserService.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/IAsUserService.java @@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.entity.AsUser; import com.ruoyi.common.core.domain.vo.LabelVo; import com.ruoyi.system.domain.vo.AuthenticationVo; +import java.math.BigDecimal; import java.util.List; /** @@ -261,4 +262,9 @@ public interface IAsUserService * 修改用户密码 */ void updateUserPwd(Long userId, String newPassword); + + /** + * 根据日期查询用户余额 + */ + BigDecimal getDepositBalance(String formattedDate); } diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsUserServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsUserServiceImpl.java index 5d4e46c..f2a8c23 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsUserServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/AsUserServiceImpl.java @@ -661,4 +661,12 @@ public class AsUserServiceImpl implements IAsUserService asUserMapper.updateUserPwd(userId, newPassword); } + /** + * 根据日期查询用户余额 + */ + @Override + public BigDecimal getDepositBalance(String formattedDate) { + return asUserMapper.getDepositBalance(formattedDate); + } + } diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtOrderServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtOrderServiceImpl.java index 44b39da..687df94 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtOrderServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtOrderServiceImpl.java @@ -1146,6 +1146,8 @@ public class EtOrderServiceImpl implements IEtOrderService /** 营收统计*/ ArrayList incomeVos = new ArrayList<>(); ArrayList incomeCosts = new ArrayList<>(); + ArrayList depositVos = new ArrayList<>(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Calendar calendar = Calendar.getInstance(); calendar.setTime(DateUtils.getNowDate()); @@ -1164,12 +1166,20 @@ public class EtOrderServiceImpl implements IEtOrderService List etReconciliations = reconciliationMapper.selectEtReconciliationList(reconciliation); Collections.reverse(etReconciliations); IndexAdminVo.IncomeCostVo incomeCostVo = new IndexAdminVo.IncomeCostVo(); + IndexAdminVo.DepositVo depositVo = new IndexAdminVo.DepositVo(); // 初始化统计变量 BigDecimal serviceFeeTotal = BigDecimal.ZERO; BigDecimal handlingFeeTotal = BigDecimal.ZERO; BigDecimal channelCostTotal = BigDecimal.ZERO; BigDecimal withdrawServiceFeeFirst = BigDecimal.ZERO; + // 押金统计 + BigDecimal depositPay = BigDecimal.ZERO; + BigDecimal depositRefund = BigDecimal.ZERO; + BigDecimal depositDeduction = BigDecimal.ZERO; + BigDecimal depositSurplus = BigDecimal.ZERO; + BigDecimal depositBalance = BigDecimal.ZERO; + // 遍历 etReconciliations 进行统计 for (EtReconciliation item : etReconciliations) { // 累加服务费 @@ -1188,6 +1198,22 @@ public class EtOrderServiceImpl implements IEtOrderService if (item.getWithdrawServiceFee() != null) { withdrawServiceFeeFirst = item.getWithdrawServiceFee(); } + // 押金支付 + if (item.getDepositPaid() != null) { + depositPay = depositPay.add(item.getDepositPaid()); + } + // 押金退款 + if (item.getDepositRefund() != null) { + depositRefund = depositRefund.add(item.getDepositRefund()); + } + // 押金抵扣 + if (item.getDeductionAmount() != null) { + depositDeduction = depositDeduction.add(item.getDeductionAmount()); + } + // 押金盈余 + if (item.getDepositSurplus() != null) { + depositSurplus = depositSurplus.add(item.getDepositSurplus()); + } } // 计算平台盈利(这里只是一个示例,具体公式根据实际情况调整) @@ -1201,6 +1227,15 @@ public class EtOrderServiceImpl implements IEtOrderService incomeCostVo.setChannelCost(channelCostTotal); incomeCostVo.setPlatformProfit(platformProfit); + // 押金统计 + depositVo.setDay(formattedDate); + depositVo.setPay(depositPay); + depositVo.setRefund(depositRefund); + depositVo.setDeduction(depositDeduction); + depositVo.setSurplus(depositSurplus); + depositVo.setBalance(asUserService.getDepositBalance + (formattedDate)); + incomeVo.setDay(formattedDate); incomeVo.setOrderNum(orderCount); incomeVo.setOrderFee(etOrderMapper.getOrderFee(startDateStr, endDateStr, null)); @@ -1208,10 +1243,12 @@ public class EtOrderServiceImpl implements IEtOrderService incomeVos.add(incomeVo); incomeCosts.add(incomeCostVo); + depositVos.add(depositVo); calendar.add(Calendar.DATE, -1); } indexAdminVo.setIncomeVoList(incomeVos); indexAdminVo.setIncomeCostList(incomeCosts); + indexAdminVo.setDepositList(depositVos); /** 车辆统计*/ IndexAdminVo.VehicleVo vehicleVo = new IndexAdminVo.VehicleVo(); diff --git a/electripper-system/src/main/resources/mapper/system/AsUserMapper.xml b/electripper-system/src/main/resources/mapper/system/AsUserMapper.xml index 7862605..91b8ee7 100644 --- a/electripper-system/src/main/resources/mapper/system/AsUserMapper.xml +++ b/electripper-system/src/main/resources/mapper/system/AsUserMapper.xml @@ -187,7 +187,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + + + insert into et_user( user_id, user_name,