首页增加押金统计
This commit is contained in:
		
							parent
							
								
									9787c88219
								
							
						
					
					
						commit
						dbdddbec65
					
				|  | @ -87,6 +87,9 @@ public class IndexAdminVo { | ||||||
|     /** 收入及成本 */ |     /** 收入及成本 */ | ||||||
|     private List<IncomeCostVo> incomeCostList; |     private List<IncomeCostVo> incomeCostList; | ||||||
| 
 | 
 | ||||||
|  |     /** 押金统计list */ | ||||||
|  |     private List<DepositVo> depositList; | ||||||
|  | 
 | ||||||
|     /** |     /** | ||||||
|      * 营收统计  incomeVo |      * 营收统计  incomeVo | ||||||
|      */ |      */ | ||||||
|  | @ -114,6 +117,25 @@ public class IndexAdminVo { | ||||||
|         private BigDecimal platformProfit;   // 平台盈利 |         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; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * 车辆统计 |      * 车辆统计 | ||||||
|  |  | ||||||
|  | @ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.entity.AsUser; | ||||||
| import com.ruoyi.common.core.domain.vo.LabelVo; | import com.ruoyi.common.core.domain.vo.LabelVo; | ||||||
| import org.apache.ibatis.annotations.Param; | import org.apache.ibatis.annotations.Param; | ||||||
| 
 | 
 | ||||||
|  | import java.math.BigDecimal; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  | @ -199,4 +200,9 @@ public interface AsUserMapper | ||||||
|      * 解绑系统用户 |      * 解绑系统用户 | ||||||
|      */ |      */ | ||||||
|     int unbindSystemUserBySysUserId(Long sysUserId); |     int unbindSystemUserBySysUserId(Long sysUserId); | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 获取押金余额 | ||||||
|  |      */ | ||||||
|  |     BigDecimal getDepositBalance(String formattedDate); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.entity.AsUser; | ||||||
| import com.ruoyi.common.core.domain.vo.LabelVo; | import com.ruoyi.common.core.domain.vo.LabelVo; | ||||||
| import com.ruoyi.system.domain.vo.AuthenticationVo; | import com.ruoyi.system.domain.vo.AuthenticationVo; | ||||||
| 
 | 
 | ||||||
|  | import java.math.BigDecimal; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  | @ -261,4 +262,9 @@ public interface IAsUserService | ||||||
|      * 修改用户密码 |      * 修改用户密码 | ||||||
|      */ |      */ | ||||||
|     void updateUserPwd(Long userId, String newPassword); |     void updateUserPwd(Long userId, String newPassword); | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 根据日期查询用户余额 | ||||||
|  |      */ | ||||||
|  |     BigDecimal getDepositBalance(String formattedDate); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -661,4 +661,12 @@ public class AsUserServiceImpl implements IAsUserService | ||||||
|         asUserMapper.updateUserPwd(userId, newPassword); |         asUserMapper.updateUserPwd(userId, newPassword); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * 根据日期查询用户余额 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public BigDecimal getDepositBalance(String formattedDate) { | ||||||
|  |         return asUserMapper.getDepositBalance(formattedDate); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1146,6 +1146,8 @@ public class EtOrderServiceImpl implements IEtOrderService | ||||||
|         /** 营收统计*/ |         /** 营收统计*/ | ||||||
|         ArrayList<IndexAdminVo.IncomeVo> incomeVos = new ArrayList<>(); |         ArrayList<IndexAdminVo.IncomeVo> incomeVos = new ArrayList<>(); | ||||||
|         ArrayList<IndexAdminVo.IncomeCostVo> incomeCosts =  new ArrayList<>(); |         ArrayList<IndexAdminVo.IncomeCostVo> incomeCosts =  new ArrayList<>(); | ||||||
|  |         ArrayList<IndexAdminVo.DepositVo> depositVos =  new ArrayList<>(); | ||||||
|  | 
 | ||||||
|         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); | ||||||
|         Calendar calendar = Calendar.getInstance(); |         Calendar calendar = Calendar.getInstance(); | ||||||
|         calendar.setTime(DateUtils.getNowDate()); |         calendar.setTime(DateUtils.getNowDate()); | ||||||
|  | @ -1164,12 +1166,20 @@ public class EtOrderServiceImpl implements IEtOrderService | ||||||
|             List<EtReconciliation> etReconciliations = reconciliationMapper.selectEtReconciliationList(reconciliation); |             List<EtReconciliation> etReconciliations = reconciliationMapper.selectEtReconciliationList(reconciliation); | ||||||
|             Collections.reverse(etReconciliations); |             Collections.reverse(etReconciliations); | ||||||
|             IndexAdminVo.IncomeCostVo incomeCostVo = new IndexAdminVo.IncomeCostVo(); |             IndexAdminVo.IncomeCostVo incomeCostVo = new IndexAdminVo.IncomeCostVo(); | ||||||
|  |             IndexAdminVo.DepositVo depositVo = new IndexAdminVo.DepositVo(); | ||||||
|             // 初始化统计变量 |             // 初始化统计变量 | ||||||
|             BigDecimal serviceFeeTotal = BigDecimal.ZERO; |             BigDecimal serviceFeeTotal = BigDecimal.ZERO; | ||||||
|             BigDecimal handlingFeeTotal = BigDecimal.ZERO; |             BigDecimal handlingFeeTotal = BigDecimal.ZERO; | ||||||
|             BigDecimal channelCostTotal = BigDecimal.ZERO; |             BigDecimal channelCostTotal = BigDecimal.ZERO; | ||||||
|             BigDecimal withdrawServiceFeeFirst = 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 进行统计 |             // 遍历 etReconciliations 进行统计 | ||||||
|             for (EtReconciliation item : etReconciliations) { |             for (EtReconciliation item : etReconciliations) { | ||||||
|                 // 累加服务费 |                 // 累加服务费 | ||||||
|  | @ -1188,6 +1198,22 @@ public class EtOrderServiceImpl implements IEtOrderService | ||||||
|                 if (item.getWithdrawServiceFee() != null) { |                 if (item.getWithdrawServiceFee() != null) { | ||||||
|                     withdrawServiceFeeFirst = item.getWithdrawServiceFee(); |                     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.setChannelCost(channelCostTotal); | ||||||
|             incomeCostVo.setPlatformProfit(platformProfit); |             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.setDay(formattedDate); | ||||||
|             incomeVo.setOrderNum(orderCount); |             incomeVo.setOrderNum(orderCount); | ||||||
|             incomeVo.setOrderFee(etOrderMapper.getOrderFee(startDateStr, endDateStr, null)); |             incomeVo.setOrderFee(etOrderMapper.getOrderFee(startDateStr, endDateStr, null)); | ||||||
|  | @ -1208,10 +1243,12 @@ public class EtOrderServiceImpl implements IEtOrderService | ||||||
| 
 | 
 | ||||||
|             incomeVos.add(incomeVo); |             incomeVos.add(incomeVo); | ||||||
|             incomeCosts.add(incomeCostVo); |             incomeCosts.add(incomeCostVo); | ||||||
|  |             depositVos.add(depositVo); | ||||||
|             calendar.add(Calendar.DATE, -1); |             calendar.add(Calendar.DATE, -1); | ||||||
|         } |         } | ||||||
|         indexAdminVo.setIncomeVoList(incomeVos); |         indexAdminVo.setIncomeVoList(incomeVos); | ||||||
|         indexAdminVo.setIncomeCostList(incomeCosts); |         indexAdminVo.setIncomeCostList(incomeCosts); | ||||||
|  |         indexAdminVo.setDepositList(depositVos); | ||||||
| 
 | 
 | ||||||
|         /** 车辆统计*/ |         /** 车辆统计*/ | ||||||
|         IndexAdminVo.VehicleVo vehicleVo = new IndexAdminVo.VehicleVo(); |         IndexAdminVo.VehicleVo vehicleVo = new IndexAdminVo.VehicleVo(); | ||||||
|  |  | ||||||
|  | @ -187,6 +187,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||||
| 		</if> | 		</if> | ||||||
| 	</select> | 	</select> | ||||||
| 
 | 
 | ||||||
|  | 	<select id="getDepositBalance" resultType="java.math.BigDecimal"> | ||||||
|  | 		SELECT | ||||||
|  | 			COALESCE(SUM(balance), 0) AS total_balance | ||||||
|  | 		FROM | ||||||
|  | 		et_user | ||||||
|  | 		WHERE | ||||||
|  | 			update_time <= #{formattedDate} | ||||||
|  | 		AND appid = 'wx3428c498d5061192' | ||||||
|  | 	</select> | ||||||
|  | 
 | ||||||
| 	<insert id="insertUser" parameterType="AsUser" useGeneratedKeys="true" keyProperty="userId"> | 	<insert id="insertUser" parameterType="AsUser" useGeneratedKeys="true" keyProperty="userId"> | ||||||
|  		insert into et_user( |  		insert into et_user( | ||||||
|  			<if test="userId != null and userId != 0">user_id,</if> |  			<if test="userId != null and userId != 0">user_id,</if> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user