店铺结算单增加积分/砍价商品退款统计
This commit is contained in:
parent
b439d8283f
commit
9e3b9c8f38
@ -88,3 +88,34 @@ ALTER TABLE li_order_item ADD `is_refund` varchar(255) DEFAULT NULL COMMENT '是
|
||||
交易表增加订单状态字段
|
||||
*/
|
||||
ALTER TABLE li_order_item ADD `refund_price` decimal(10,2) DEFAULT NULL COMMENT '退款金额';
|
||||
|
||||
/**
|
||||
结算单表,增加砍价/积分退款金额字段
|
||||
*/
|
||||
ALTER TABLE li_bill ADD `point_refund_settlement_price` decimal(10,2) DEFAULT NULL COMMENT '退货积分补贴返还';
|
||||
ALTER TABLE li_bill ADD `kanjia_refund_settlement_price` decimal(10,2) DEFAULT NULL COMMENT '退货砍价补贴返还';
|
||||
|
||||
UPDATE li_bill b
|
||||
SET b.point_refund_settlement_price =IFNULL((
|
||||
SELECT
|
||||
SUM( point_settlement_price )
|
||||
FROM
|
||||
li_store_flow sf
|
||||
WHERE
|
||||
sf.flow_type = 'REFUND'
|
||||
AND sf.store_id=b.store_id
|
||||
AND sf.create_time BETWEEN b.start_time
|
||||
AND b.end_time),0)
|
||||
|
||||
UPDATE li_bill b
|
||||
SET b.kanjia_refund_settlement_price =IFNULL((
|
||||
SELECT
|
||||
SUM( kanjia_settlement_price )
|
||||
FROM
|
||||
li_store_flow sf
|
||||
WHERE
|
||||
sf.flow_type = 'REFUND'
|
||||
AND sf.store_id=b.store_id
|
||||
AND sf.create_time BETWEEN b.start_time
|
||||
AND b.end_time),0);
|
||||
|
||||
|
@ -103,9 +103,16 @@ public class Bill extends BaseIdEntity {
|
||||
@ApiModelProperty(value = "积分商品结算价格")
|
||||
private Double pointSettlementPrice;
|
||||
|
||||
@ApiModelProperty(value = "退货积分补贴返还")
|
||||
private Double pointRefundSettlementPrice;
|
||||
|
||||
@ApiModelProperty(value = "砍价商品结算价格")
|
||||
private Double kanjiaSettlementPrice;
|
||||
|
||||
@ApiModelProperty(value = "退货砍价补贴返还")
|
||||
private Double kanjiaRefundSettlementPrice;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 开始算钱啦
|
||||
|
@ -35,8 +35,10 @@ public interface BillMapper extends BaseMapper<Bill> {
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 结算单
|
||||
*/
|
||||
@Select("SELECT IFNULL(SUM( final_price ),0) AS orderPrice,IFNULL(SUM( commission_price ),0) AS commissionPrice" +
|
||||
",IFNULL(SUM( distribution_rebate ),0) AS distributionCommission,IFNULL(SUM( site_coupon_commission ),0) AS siteCouponCommission" +
|
||||
@Select("SELECT IFNULL(SUM( final_price ),0) AS orderPrice" +
|
||||
",IFNULL(SUM( commission_price ),0) AS commissionPrice" +
|
||||
",IFNULL(SUM( distribution_rebate ),0) AS distributionCommission" +
|
||||
",IFNULL(SUM( site_coupon_commission ),0) AS siteCouponCommission" +
|
||||
",IFNULL(SUM( point_settlement_price ),0) AS pointSettlementPrice " +
|
||||
",IFNULL(SUM( kanjia_settlement_price ),0) AS kanjiaSettlementPrice " +
|
||||
",IFNULL(SUM( bill_price ),0) AS billPrice " +
|
||||
@ -49,8 +51,12 @@ public interface BillMapper extends BaseMapper<Bill> {
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 结算单
|
||||
*/
|
||||
@Select("SELECT IFNULL(SUM( final_price ),0) AS refundPrice,IFNULL(SUM( commission_price ),0) AS refundCommissionPrice" +
|
||||
",IFNULL(SUM( distribution_rebate ),0) AS distributionRefundCommission,IFNULL(SUM( site_coupon_commission ),0) AS siteCouponRefundCommission" +
|
||||
@Select("SELECT IFNULL(SUM( final_price ),0) AS refundPrice" +
|
||||
",IFNULL(SUM( commission_price ),0) AS refundCommissionPrice" +
|
||||
",IFNULL(SUM( distribution_rebate ),0) AS distributionRefundCommission" +
|
||||
",IFNULL(SUM( site_coupon_commission ),0) AS siteCouponRefundCommission" +
|
||||
",IFNULL(SUM( kanjia_settlement_price ),0) AS kanjiaRefundSettlementPrice" +
|
||||
",IFNULL(SUM( point_settlement_price ),0) AS pointRefundSettlementPrice" +
|
||||
",IFNULL(SUM( final_price ),0) AS billPrice FROM li_store_flow ${ew.customSqlSegment}")
|
||||
Bill getRefundBill(@Param(Constants.WRAPPER) QueryWrapper<Bill> queryWrapper);
|
||||
}
|
@ -95,12 +95,16 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements Bi
|
||||
if (refundBill != null) {
|
||||
//退单金额
|
||||
bill.setRefundPrice(refundBill.getRefundPrice() != null ? refundBill.getRefundPrice() : 0D);
|
||||
//退单产生退还佣金金额
|
||||
//退单 平台服务费返还
|
||||
bill.setRefundCommissionPrice(refundBill.getRefundCommissionPrice() != null ? refundBill.getRefundCommissionPrice() : 0D);
|
||||
//分销订单退还,返现佣金返还
|
||||
//退单 分销佣金返还
|
||||
bill.setDistributionRefundCommission(refundBill.getDistributionRefundCommission() != null ? refundBill.getDistributionRefundCommission() : 0D);
|
||||
//退货平台优惠券补贴返还
|
||||
//退单 平台优惠券补贴返还
|
||||
bill.setSiteCouponRefundCommission(refundBill.getSiteCouponRefundCommission() != null ? refundBill.getSiteCouponRefundCommission() : 0D);
|
||||
//退单 平台优惠券补贴返还
|
||||
bill.setPointRefundSettlementPrice(refundBill.getPointRefundSettlementPrice() != null ? refundBill.getPointRefundSettlementPrice() : 0D);
|
||||
//退单 砍价补贴返还
|
||||
bill.setKanjiaRefundSettlementPrice(refundBill.getKanjiaRefundSettlementPrice() != null ? refundBill.getKanjiaRefundSettlementPrice() : 0D);
|
||||
//退款金额=店铺最终退款结算金额
|
||||
refundPrice = refundBill.getBillPrice() != null ? refundBill.getBillPrice() : 0D;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user