package com.ruoyi.bst.reconciliationDate.domain;

import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 渠道对账对象 bst_reconciliation_date
 *
 * @author ruoyi
 * @date 2025-04-23
 */
@Data
public class ReconciliationDate extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    private Long id;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("日期")
    private Date date;

    @Excel(name = "渠道ID")
    @ApiModelProperty("渠道ID")
    private Long channelId;

    @Excel(name = "渠道名称")
    @ApiModelProperty("渠道名称")
    private String channelName;

    @Excel(name = "运营区ID")
    @ApiModelProperty("运营区ID")
    private Long areaId;

    @Excel(name = "骑行订单支付金额")
    @ApiModelProperty("骑行订单支付金额")
    private BigDecimal orderPayAmount;

    @Excel(name = "骑行订单退款金额")
    @ApiModelProperty("骑行订单退款金额")
    private BigDecimal orderRefundAmount;

    @Excel(name = "骑行订单实收金额")
    @ApiModelProperty("骑行订单实收金额")
    private BigDecimal orderActualAmount;

    @Excel(name = "支付总金额")
    @ApiModelProperty("支付总金额")
    private BigDecimal payAmount;

    @Excel(name = "退款总金额")
    @ApiModelProperty("退款总金额")
    private BigDecimal refundAmount;

    @Excel(name = "实收金额")
    @ApiModelProperty("实收金额")
    private BigDecimal actualAmount;

    @Excel(name = "用户分成")
    @ApiModelProperty("用户分成")
    private BigDecimal userBonus;

    @Excel(name = "用户分成退款")
    @ApiModelProperty("用户分成退款")
    private BigDecimal userBonusRefund;

    @Excel(name = "用户实收金额")
    @ApiModelProperty("用户实收金额")
    private BigDecimal userActualBonus;

    @Excel(name = "平台分成")
    @ApiModelProperty("平台分成")
    private BigDecimal platformBonus;

    @Excel(name = "平台分成退款")
    @ApiModelProperty("平台分成退款")
    private BigDecimal platformBonusRefund;

    @Excel(name = "平台实收金额")
    @ApiModelProperty("平台实收金额")
    private BigDecimal platformActualBonus;

    @Excel(name = "分成总金额")
    @ApiModelProperty("分成总金额")
    private BigDecimal totalBonus;

    @Excel(name = "分成退款总金额")
    @ApiModelProperty("分成退款总金额")
    private BigDecimal totalBonusRefund;

    @Excel(name = "实际分成金额")
    @ApiModelProperty("实际分成金额")
    private BigDecimal actualBonus;

    @Excel(name = "支付实收和分成差额")
    @ApiModelProperty("支付实收和分成差额")
    private BigDecimal difference;

    @Excel(name = "渠道成本")
    @ApiModelProperty("渠道成本")
    private BigDecimal channelCost;

}
This commit is contained in:
磷叶 2025-04-23 11:34:59 +08:00
parent 5d6de1e19a
commit a867040c51

View File

@ -0,0 +1,84 @@
package com.ruoyi.task.reconciliationDate;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.ruoyi.bst.channel.domain.vo.ChannelNameVO;
import com.ruoyi.bst.channel.service.ChannelService;
import com.ruoyi.bst.reconciliationDate.domain.ReconciliationDate;
import com.ruoyi.bst.reconciliationDate.service.ReconciliationDateService;
import com.ruoyi.common.utils.collection.CollectionUtils;
import lombok.extern.slf4j.Slf4j;
@Component
@Slf4j
public class ReconciliationDateTask {
@Autowired
private ChannelService channelService;
@Autowired
private ReconciliationDateService reconciliationDateService;
public void recordReconciliationDate(Integer lastDays) {
// 获取昨日日期
LocalDate now = LocalDate.now();
LocalDate startDay = now.minusDays(lastDays);
// 查询所有支付渠道列表
List<ChannelNameVO> channelList = channelService.selectAllChannelNameList();
if (CollectionUtils.isEmptyElement(channelList)) {
log.error("渠道列表为空");
return;
}
while (now.isAfter(startDay)) {
// 支付渠道
for (ChannelNameVO channel : channelList) {
if (channel == null) {
continue;
}
this.insertReconciliationDate(startDay, channel.getChannelId(), channel.getName());
}
startDay = startDay.plusDays(1);
}
}
private void insertReconciliationDate(LocalDate startDay, Long channelId, String channelName) {
// TODO 获取日期对账数据
// TODO 保存对账数据
// int insert = reconciliationDateService.insertReconciliationDate(po);
// if (insert != 1) {
// log.error("保存对账数据失败,{}", po);
// }
}
private boolean isEmpty(ReconciliationDate po) {
// 所有数值类型都为空或者0,则认为对账数据为空
return (po.getActualBonus() == null || po.getActualBonus().compareTo(BigDecimal.ZERO) == 0)
&& (po.getChannelCost() == null || po.getChannelCost().compareTo(BigDecimal.ZERO) == 0)
&& (po.getOrderPayAmount() == null || po.getOrderPayAmount().compareTo(BigDecimal.ZERO) == 0)
&& (po.getOrderRefundAmount() == null || po.getOrderRefundAmount().compareTo(BigDecimal.ZERO) == 0)
&& (po.getOrderActualAmount() == null || po.getOrderActualAmount().compareTo(BigDecimal.ZERO) == 0)
&& (po.getPayAmount() == null || po.getPayAmount().compareTo(BigDecimal.ZERO) == 0)
&& (po.getRefundAmount() == null || po.getRefundAmount().compareTo(BigDecimal.ZERO) == 0)
&& (po.getActualAmount() == null || po.getActualAmount().compareTo(BigDecimal.ZERO) == 0)
&& (po.getUserBonus() == null || po.getUserBonus().compareTo(BigDecimal.ZERO) == 0)
&& (po.getUserBonusRefund() == null || po.getUserBonusRefund().compareTo(BigDecimal.ZERO) == 0)
&& (po.getUserActualBonus() == null || po.getUserActualBonus().compareTo(BigDecimal.ZERO) == 0)
&& (po.getPlatformBonus() == null || po.getPlatformBonus().compareTo(BigDecimal.ZERO) == 0)
&& (po.getPlatformBonusRefund() == null || po.getPlatformBonusRefund().compareTo(BigDecimal.ZERO) == 0)
&& (po.getPlatformActualBonus() == null || po.getPlatformActualBonus().compareTo(BigDecimal.ZERO) == 0)
&& (po.getTotalBonus() == null || po.getTotalBonus().compareTo(BigDecimal.ZERO) == 0)
&& (po.getTotalBonusRefund() == null || po.getTotalBonusRefund().compareTo(BigDecimal.ZERO) == 0)
&& (po.getDifference() == null || po.getDifference().compareTo(BigDecimal.ZERO) == 0);
}
}