diff --git a/electripper-admin/src/main/resources/application-druid.yml b/electripper-admin/src/main/resources/application-druid.yml index 31d8e47..410c5ba 100644 --- a/electripper-admin/src/main/resources/application-druid.yml +++ b/electripper-admin/src/main/resources/application-druid.yml @@ -7,7 +7,7 @@ spring: # 主库数据源 master: # url: jdbc:mysql://47.120.68.19:3306/electripper?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 - url: jdbc:mysql://localhost:3306/ele2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:mysql://localhost:3306/electripper?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root password: 123456 # url: jdbc:mysql://117.26.179.22:61110/electripper?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 diff --git a/electripper-system/src/main/java/com/ruoyi/system/domain/EtReconciliation.java b/electripper-system/src/main/java/com/ruoyi/system/domain/EtReconciliation.java index 8bd0ad7..04ee558 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/domain/EtReconciliation.java +++ b/electripper-system/src/main/java/com/ruoyi/system/domain/EtReconciliation.java @@ -85,5 +85,8 @@ public class EtReconciliation extends BaseEntity @Excel(name = "渠道成本") private BigDecimal channelCost; + @Excel(name = "余额") + private BigDecimal balance; + } diff --git a/electripper-system/src/main/java/com/ruoyi/system/mapper/EtReconciliationMapper.java b/electripper-system/src/main/java/com/ruoyi/system/mapper/EtReconciliationMapper.java index 57cb6f0..74d634b 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/mapper/EtReconciliationMapper.java +++ b/electripper-system/src/main/java/com/ruoyi/system/mapper/EtReconciliationMapper.java @@ -1,19 +1,21 @@ package com.ruoyi.system.mapper; +import java.math.BigDecimal; import java.util.List; import com.ruoyi.system.domain.EtReconciliation; +import org.apache.ibatis.annotations.Param; /** * 平台对账Mapper接口 - * + * * @author qzz * @date 2024-10-03 */ -public interface EtReconciliationMapper +public interface EtReconciliationMapper { /** * 查询平台对账 - * + * * @param reconciliationId 平台对账主键 * @return 平台对账 */ @@ -21,7 +23,7 @@ public interface EtReconciliationMapper /** * 查询平台对账列表 - * + * * @param etReconciliation 平台对账 * @return 平台对账集合 */ @@ -29,7 +31,7 @@ public interface EtReconciliationMapper /** * 新增平台对账 - * + * * @param etReconciliation 平台对账 * @return 结果 */ @@ -37,7 +39,7 @@ public interface EtReconciliationMapper /** * 修改平台对账 - * + * * @param etReconciliation 平台对账 * @return 结果 */ @@ -45,7 +47,7 @@ public interface EtReconciliationMapper /** * 删除平台对账 - * + * * @param reconciliationId 平台对账主键 * @return 结果 */ @@ -53,9 +55,14 @@ public interface EtReconciliationMapper /** * 批量删除平台对账 - * + * * @param reconciliationIds 需要删除的数据主键集合 * @return 结果 */ public int deleteEtReconciliationByReconciliationIds(Long[] reconciliationIds); + + /** + * 日报查询 + */ + BigDecimal getDepositBalance(@Param("day") String previousDay); } 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 687df94..16f8786 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 @@ -50,6 +50,7 @@ import java.math.RoundingMode; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDate; +import java.time.format.DateTimeFormatter; import java.util.*; import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; @@ -1151,101 +1152,20 @@ public class EtOrderServiceImpl implements IEtOrderService SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Calendar calendar = Calendar.getInstance(); calendar.setTime(DateUtils.getNowDate()); + String today = dateFormat.format(calendar.getTime()); + getTodayData(today, incomeVos, incomeCosts, depositVos); calendar.add(Calendar.DAY_OF_MONTH, -1); + for (int i = 0; i < 13; i++) { - String formattedDate = dateFormat.format(calendar.getTime()); - String startDateStr = formattedDate + " " + Constants.DATE_FORMAT_START_PEREND; - String endDateStr = formattedDate + " " + Constants.DATE_FORMAT_END_PEREND; - int orderCount = etOrderMapper.getOrderNum(startDateStr, endDateStr, null,null); - IndexAdminVo.IncomeVo incomeVo = new IndexAdminVo.IncomeVo(); - - EtReconciliation reconciliation = new EtReconciliation(); - // 准备额外的查询参数 - reconciliation.setDay(formattedDate); - List<EtReconciliation> 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) { - // 累加服务费 - if (item.getPlatformServiceFee() != null) { - serviceFeeTotal = serviceFeeTotal.add(item.getPlatformServiceFee()); - } - // 累加手续费(假设 handlingCharge 是 EtReconciliation 的一个属性) - if (item.getHandlingCharge() != null) { - handlingFeeTotal = handlingFeeTotal.add(item.getHandlingCharge()); - } - // 累加渠道成本 - if (item.getChannelCost() != null) { - channelCostTotal = channelCostTotal.add(item.getChannelCost()); - } - // 提现服务费只拿第一个值 - 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()); - } - } - - // 计算平台盈利(这里只是一个示例,具体公式根据实际情况调整) - BigDecimal platformProfit = serviceFeeTotal.subtract(handlingFeeTotal).subtract(channelCostTotal); - - // 设置 IncomeCostVo 的值 - incomeCostVo.setDay(formattedDate); - incomeCostVo.setServiceFee(serviceFeeTotal); - incomeCostVo.setHandlingFee(handlingFeeTotal); - incomeCostVo.setWithdrawalFee(withdrawServiceFeeFirst); // 设置提现手续费 - 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)); - incomeVo.setRefundFee(etOrderMapper.getRefundFee(startDateStr, endDateStr, null,null,null)); - - incomeVos.add(incomeVo); - incomeCosts.add(incomeCostVo); - depositVos.add(depositVo); + String day = dateFormat.format(calendar.getTime()); + getDataByDate(day, incomeVos, incomeCosts, depositVos); calendar.add(Calendar.DATE, -1); } + calendar.setTime(DateUtils.getNowDate()); + String todayStartDateStr = today + " " + Constants.DATE_FORMAT_START_PEREND; + String todayEndDateStr = today + " " + Constants.DATE_FORMAT_END_PEREND; + indexAdminVo.setIncomeVoList(incomeVos); indexAdminVo.setIncomeCostList(incomeCosts); indexAdminVo.setDepositList(depositVos); @@ -1257,10 +1177,6 @@ public class EtOrderServiceImpl implements IEtOrderService indexAdminVo.setVehicleVo(vehicleVo); /** 运维统计*/ - String formattedDate = dateFormat.format(calendar.getTime()); - String todayStartDateStr = formattedDate + " " + Constants.DATE_FORMAT_START_PEREND; - String todayEndDateStr = formattedDate + " " + Constants.DATE_FORMAT_END_PEREND; - IndexAdminVo.OperationVo operationVo = new IndexAdminVo.OperationVo(); operationVo.setReplacementOrderCount(etAdminOrderMapper.getOrderCount(ServiceConstants.ADMIN_ORDER_TYPE_REPLACEMENT,ServiceConstants.REPLACEMENT_ELECTRICITY_STATUS_UNDER_WAY,null));//待换电 operationVo.setRepairCount(etAdminOrderMapper.getOrderCount(ServiceConstants.ADMIN_ORDER_TYPE_REPAIR,ServiceConstants.REPLACEMENT_ELECTRICITY_STATUS_REPAIR,null));//待维修 @@ -1273,6 +1189,230 @@ public class EtOrderServiceImpl implements IEtOrderService return indexAdminVo; } + private void getDataByDate(String formattedDate, ArrayList<IndexAdminVo.IncomeVo> incomeVos, ArrayList<IndexAdminVo.IncomeCostVo> incomeCosts, ArrayList<IndexAdminVo.DepositVo> depositVos) { + String startDateStr = formattedDate + " " + Constants.DATE_FORMAT_START_PEREND; + String endDateStr = formattedDate + " " + Constants.DATE_FORMAT_END_PEREND; + IndexAdminVo.IncomeVo incomeVo = new IndexAdminVo.IncomeVo(); + IndexAdminVo.IncomeCostVo incomeCostVo = new IndexAdminVo.IncomeCostVo(); + IndexAdminVo.DepositVo depositVo = new IndexAdminVo.DepositVo(); + + int orderCount = etOrderMapper.getOrderNum(startDateStr, endDateStr, null,null); + EtReconciliation reconciliation = new EtReconciliation(); + // 准备额外的查询参数 + reconciliation.setDay(formattedDate); + List<EtReconciliation> etReconciliations = reconciliationMapper.selectEtReconciliationList(reconciliation); + Collections.reverse(etReconciliations); + + // 初始化统计变量 + 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) { + // 累加服务费 + if (item.getPlatformServiceFee() != null) { + serviceFeeTotal = serviceFeeTotal.add(item.getPlatformServiceFee()); + } + // 累加手续费(假设 handlingCharge 是 EtReconciliation 的一个属性) + if (item.getHandlingCharge() != null) { + handlingFeeTotal = handlingFeeTotal.add(item.getHandlingCharge()); + } + // 累加渠道成本 + if (item.getChannelCost() != null) { + channelCostTotal = channelCostTotal.add(item.getChannelCost()); + } + // 提现服务费只拿第一个值 + 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()); + } + // 押金余额 + if (item.getBalance() != null) { + depositBalance = depositBalance.add(item.getBalance()); + } + } + + // 计算平台盈利(这里只是一个示例,具体公式根据实际情况调整) + BigDecimal platformProfit = serviceFeeTotal.subtract(handlingFeeTotal).subtract(channelCostTotal); + + // 设置 IncomeCostVo 的值 + incomeCostVo.setDay(formattedDate); + incomeCostVo.setServiceFee(serviceFeeTotal); + incomeCostVo.setHandlingFee(handlingFeeTotal); + incomeCostVo.setWithdrawalFee(withdrawServiceFeeFirst); // 设置提现手续费 + incomeCostVo.setChannelCost(channelCostTotal); + incomeCostVo.setPlatformProfit(platformProfit); + + // 押金统计 + depositVo.setDay(formattedDate); + depositVo.setPay(depositPay); + depositVo.setRefund(depositRefund); + depositVo.setDeduction(depositDeduction); + depositVo.setSurplus(depositSurplus); + depositVo.setBalance(depositBalance); + + incomeVo.setDay(formattedDate); + incomeVo.setOrderNum(orderCount); + incomeVo.setOrderFee(etOrderMapper.getOrderFee(startDateStr, endDateStr, null)); + incomeVo.setRefundFee(etOrderMapper.getRefundFee(startDateStr, endDateStr, null,null,null)); + + incomeVos.add(incomeVo); + incomeCosts.add(incomeCostVo); + depositVos.add(depositVo); + } + + private void getTodayData(String today, ArrayList<IndexAdminVo.IncomeVo> incomeVos, ArrayList<IndexAdminVo.IncomeCostVo> incomeCosts, ArrayList<IndexAdminVo.DepositVo> depositVos) { + String startDateStr = today + " " + Constants.DATE_FORMAT_START_PEREND; + String endDateStr = today + " " + Constants.DATE_FORMAT_END_PEREND; + IndexAdminVo.IncomeVo incomeVo = new IndexAdminVo.IncomeVo(); + IndexAdminVo.IncomeCostVo incomeCostVo = new IndexAdminVo.IncomeCostVo(); + IndexAdminVo.DepositVo depositVo = new IndexAdminVo.DepositVo(); + + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(DateUtils.getNowDate()); + // 将日期减去一天以获取前一天 + calendar.add(Calendar.DATE, -1); + String previousDay = dateFormat.format(calendar.getTime()); + + + // 初始化统计变量 + BigDecimal serviceFeeTotal = BigDecimal.ZERO; + BigDecimal handlingFeeTotal = BigDecimal.ZERO; + BigDecimal channelCostTotal = BigDecimal.ZERO; + BigDecimal withdrawServiceFeeFirst = BigDecimal.ZERO; + // 计算平台盈利(这里只是一个示例,具体公式根据实际情况调整) + BigDecimal platformProfit = serviceFeeTotal.subtract(handlingFeeTotal).subtract(channelCostTotal); + + // 押金统计 + BigDecimal depositPay = BigDecimal.ZERO; + BigDecimal depositRefund = BigDecimal.ZERO; + BigDecimal depositDeduction = BigDecimal.ZERO; + BigDecimal depositSurplus = BigDecimal.ZERO; + + List<ChannelVO> channelVOS = etChannelService.selectSmChannelList(new ChannelQuery()); + for (ChannelVO channel:channelVOS) { + SelfReconciliationVO selfReconciliationVO = buildSelfReconciliation(startDateStr,endDateStr, today,channel.getChannelId()); + // 累加服务费 + if (selfReconciliationVO.getPlatformServiceFee() != null) { + serviceFeeTotal = serviceFeeTotal.add(selfReconciliationVO.getPlatformServiceFee()); + } + // 累加手续费(假设 handlingCharge 是 EtReconciliation 的一个属性) + if (selfReconciliationVO.getHandlingCharge() != null) { + handlingFeeTotal = handlingFeeTotal.add(selfReconciliationVO.getHandlingCharge()); + } + // 累加渠道成本 + if (selfReconciliationVO.getChannelCost() != null) { + channelCostTotal = channelCostTotal.add(selfReconciliationVO.getChannelCost()); + } + // 提现服务费只拿第一个值 + if (selfReconciliationVO.getWithdrawServiceFee() != null) { + withdrawServiceFeeFirst = selfReconciliationVO.getWithdrawServiceFee(); + } + // 押金支付 + if (selfReconciliationVO.getDepositPaid() != null) { + depositPay = depositPay.add(selfReconciliationVO.getDepositPaid()); + } + // 押金退款 + if (selfReconciliationVO.getDepositRefund() != null) { + depositRefund = depositRefund.add(selfReconciliationVO.getDepositRefund()); + } + // 押金抵扣 + if (selfReconciliationVO.getDeductionAmount() != null) { + depositDeduction = depositDeduction.add(selfReconciliationVO.getDeductionAmount()); + } + // 押金盈余 + if (selfReconciliationVO.getDepositChange() != null) { + depositSurplus = depositSurplus.add(selfReconciliationVO.getDepositChange()); + } + } + + // 设置 IncomeCostVo 的值 + incomeCostVo.setDay(today); + incomeCostVo.setServiceFee(serviceFeeTotal); + incomeCostVo.setHandlingFee(handlingFeeTotal); + incomeCostVo.setWithdrawalFee(withdrawServiceFeeFirst); // 设置提现手续费 + incomeCostVo.setChannelCost(channelCostTotal); + incomeCostVo.setPlatformProfit(platformProfit); + + // 押金统计 + depositVo.setDay(today); + depositVo.setPay(depositPay); + depositVo.setRefund(depositRefund); + depositVo.setDeduction(depositDeduction); + depositVo.setSurplus(depositSurplus); + depositVo.setBalance(reconciliationMapper.getDepositBalance(previousDay).add(depositSurplus)); + + incomeVo.setDay(today); + incomeVo.setOrderNum(etOrderMapper.getOrderNum(startDateStr, endDateStr, null,null)); + incomeVo.setOrderFee(etOrderMapper.getOrderFee(startDateStr, endDateStr, null)); + incomeVo.setRefundFee(etOrderMapper.getRefundFee(startDateStr, endDateStr, null,null,null)); + + incomeVos.add(incomeVo); + incomeCosts.add(incomeCostVo); + depositVos.add(depositVo); + } + + private SelfReconciliationVO buildSelfReconciliation(String startDateStr, String endDateStr, String formattedDate, Long channelId) { + SelfReconciliationVO selfReconciliationVO = new SelfReconciliationVO(); + selfReconciliationVO.setDay(formattedDate); + BigDecimal deductionAmount = defaultIfNull(etOrderMapper.getDepositDeductionAmount(startDateStr, endDateStr, null,channelId),BigDecimal.ZERO);// 押金抵扣金额 538 + BigDecimal depositAmount = defaultIfNull(etOrderMapper.getDepositAmount(startDateStr, endDateStr, null,channelId),BigDecimal.ZERO);// 押金收入 25123 + BigDecimal handlingFee = etCapitalFlowMapper.getHandlingFee2(startDateStr, endDateStr, null, null,channelId);//手续费,扣除掉退款部分的 + BigDecimal platformServiceFee = etCapitalFlowMapper.getServiceFee2(startDateStr, endDateStr, null,null,channelId);//平台服务费 ,扣除掉退款部分的 + BigDecimal withdrawServiceFee = etCapitalFlowMapper.getWithdrawServiceFee(startDateStr, endDateStr,null);//提现服务费 ,扣除掉提现失败部分的 + BigDecimal cost = defaultIfNull(etOrderMapper.getCost(startDateStr, endDateStr, null,channelId),BigDecimal.ZERO);// 押金收入 25123 + + selfReconciliationVO.setDeductionAmount(deductionAmount); + selfReconciliationVO.setDepositPaid(depositAmount); + selfReconciliationVO.setHandlingCharge(handlingFee); + selfReconciliationVO.setPlatformServiceFee(platformServiceFee); + if(channelId == 2){ + selfReconciliationVO.setChannelCost(cost); + } + selfReconciliationVO.setWithdrawServiceFee(withdrawServiceFee); + + /** 总支出*/ + BigDecimal orderRefund = defaultIfNull(etOrderMapper.getRefundFee2(startDateStr, endDateStr, null, null,channelId), BigDecimal.ZERO);//订单退款 + BigDecimal depositRefundFee = defaultIfNull(etOrderMapper.getDepositRefundFee(startDateStr, endDateStr, null, null,channelId), BigDecimal.ZERO);//押金退款 24795 25386 + // depositChange 等于depositAmount减去deductionAmount减去depositRefundFee + selfReconciliationVO.setDepositChange(depositAmount.subtract(deductionAmount).subtract(depositRefundFee)); + // 统计所有用户今日账变 进账 + BigDecimal userReceipts = defaultIfNull(etCapitalFlowMapper.getAllUserReceipts(startDateStr, endDateStr, null,channelId),BigDecimal.ZERO); + + selfReconciliationVO.setOrderRefund(orderRefund); + selfReconciliationVO.setDepositRefund(depositRefundFee); + BigDecimal depositBalance = depositAmount.subtract(depositRefundFee).subtract(deductionAmount); + selfReconciliationVO.setDepositBalance(depositBalance); + selfReconciliationVO.setUserReceipts(userReceipts); + return selfReconciliationVO; + } + + /** * 首页统计-总管理 */ diff --git a/electripper-system/src/main/java/com/ruoyi/system/task/EtTask.java b/electripper-system/src/main/java/com/ruoyi/system/task/EtTask.java index cf66329..cd4b03d 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/task/EtTask.java +++ b/electripper-system/src/main/java/com/ruoyi/system/task/EtTask.java @@ -885,13 +885,20 @@ public class EtTask { String endDateStr = formattedDate + " " + Constants.DATE_FORMAT_END_PEREND; /** 总收入*/ SelfReconciliationVO selfReconciliationVO = buildSelfReconciliation(startDateStr,endDateStr, formattedDate,aLong,channel.getChannelId()); + calendar.add(Calendar.DATE, -1); + String previousDay = dateFormat.format(calendar.getTime()); + setBalance(previousDay,selfReconciliationVO); // 保存 saveRecon(formattedDate, selfReconciliationVO,channel.getChannelId()); - calendar.add(Calendar.DATE, -1); } } } + private void setBalance(String previousDay, SelfReconciliationVO selfReconciliationVO) { + BigDecimal depositBalance = defaultIfNull(etReconciliationMapper.getDepositBalance(previousDay),BigDecimal.ZERO); + selfReconciliationVO.setDepositBalance(depositBalance.add(selfReconciliationVO.getDepositChange())); + } + private SelfReconciliationVO buildSelfReconciliation(String startDateStr, String endDateStr, String formattedDate, Long aLong, Long channelId) { SelfReconciliationVO selfReconciliationVO = new SelfReconciliationVO(); selfReconciliationVO.setDay(formattedDate); @@ -955,6 +962,7 @@ public class EtTask { etReconciliation.setOrderCount(selfReconciliationVO.getOrderCount()); etReconciliation.setChannelCost(selfReconciliationVO.getChannelCost()); etReconciliation.setWithdrawServiceFee(selfReconciliationVO.getWithdrawServiceFee()); + etReconciliation.setBalance(selfReconciliationVO.getDepositBalance()); int i1 = etReconciliationMapper.insertEtReconciliation(etReconciliation); log.info("【平台对账】保存对账数据结果:【{}】",i1); } diff --git a/electripper-system/src/main/resources/mapper/system/EtCapitalFlowMapper.xml b/electripper-system/src/main/resources/mapper/system/EtCapitalFlowMapper.xml index b677096..a2c2cd9 100644 --- a/electripper-system/src/main/resources/mapper/system/EtCapitalFlowMapper.xml +++ b/electripper-system/src/main/resources/mapper/system/EtCapitalFlowMapper.xml @@ -29,7 +29,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" </resultMap> <sql id="selectEtCapitalFlowVo"> - select flow_id, area_id, owner, owner_id, owner_phone, owner_type, order_no, out_trade_no, type, bus_type, status, amount, handling_charge, platform_service_fee, operator_dividend, operator_balance, partner_dividend, pay_type, create_time, model_id from et_capital_flow + select flow_id, area_id, owner, owner_id, owner_phone, owner_type, order_no, out_trade_no, type, bus_type, status, amount, + handling_charge, platform_service_fee, operator_dividend, operator_balance, + partner_dividend, pay_type, create_time, model_id from et_capital_flow </sql> <sql id="searchCondition"> diff --git a/electripper-system/src/main/resources/mapper/system/EtReconciliationMapper.xml b/electripper-system/src/main/resources/mapper/system/EtReconciliationMapper.xml index 440bdc0..134ca85 100644 --- a/electripper-system/src/main/resources/mapper/system/EtReconciliationMapper.xml +++ b/electripper-system/src/main/resources/mapper/system/EtReconciliationMapper.xml @@ -24,12 +24,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" <result property="orderCount" column="order_count" /> <result property="withdrawServiceFee" column="withdraw_service_fee" /> <result property="channelCost" column="channel_cost" /> + <result property="balance" column="balance" /> </resultMap> <sql id="selectEtReconciliationVo"> select reconciliation_id, order_paid, total_amount, deposit_paid, pay_channel, create_time, day, deposit_refund, deduction_amount, handling_charge, user_receipts, settlement_amount, platform_service_fee, order_refund, order_surplus, deposit_surplus, - order_count, withdraw_service_fee, channel_cost from et_reconciliation + order_count, withdraw_service_fee, channel_cost, balance from et_reconciliation </sql> <select id="selectEtReconciliationList" parameterType="EtReconciliation" resultMap="EtReconciliationResult"> @@ -61,6 +62,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where reconciliation_id = #{reconciliationId} </select> + <select id="getDepositBalance" resultType="java.math.BigDecimal"> + select COALESCE(sum(balance),0) from et_reconciliation where day = #{day} and pay_channel = 2 + </select> + <insert id="insertEtReconciliation" parameterType="EtReconciliation" useGeneratedKeys="true" keyProperty="reconciliationId"> insert into et_reconciliation <trim prefix="(" suffix=")" suffixOverrides=","> @@ -82,6 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" <if test="orderCount != null">order_count,</if> <if test="withdrawServiceFee != null">withdraw_service_fee,</if> <if test="channelCost != null">channel_cost,</if> + <if test="balance != null">balance,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="orderPaid != null">#{orderPaid},</if> @@ -102,6 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" <if test="orderCount != null">#{orderCount},</if> <if test="withdrawServiceFee != null">#{withdrawServiceFee},</if> <if test="channelCost != null">#{channelCost},</if> + <if test="balance != null">#{balance},</if> </trim> </insert> @@ -126,6 +133,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" <if test="orderCount != null">order_count = #{orderCount},</if> <if test="withdrawServiceFee != null">withdraw_service</if> <if test="channelCost != null">channel_cost = #{channelCost},</if> + <if test="balance != null">balance = #{balance},</if> </trim> where reconciliation_id = #{reconciliationId} </update>