diff --git a/DB/version4.3toMASTER.sql b/DB/version4.3toMASTER.sql index a7e508ef3..91d0b3ef3 100644 --- a/DB/version4.3toMASTER.sql +++ b/DB/version4.3toMASTER.sql @@ -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); + diff --git a/framework/src/main/java/cn/lili/modules/store/entity/dos/Bill.java b/framework/src/main/java/cn/lili/modules/store/entity/dos/Bill.java index 02d2fe2ce..89011fb45 100644 --- a/framework/src/main/java/cn/lili/modules/store/entity/dos/Bill.java +++ b/framework/src/main/java/cn/lili/modules/store/entity/dos/Bill.java @@ -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; + + /** * 开始算钱啦 diff --git a/framework/src/main/java/cn/lili/modules/store/mapper/BillMapper.java b/framework/src/main/java/cn/lili/modules/store/mapper/BillMapper.java index 8d0c47243..867f591d0 100644 --- a/framework/src/main/java/cn/lili/modules/store/mapper/BillMapper.java +++ b/framework/src/main/java/cn/lili/modules/store/mapper/BillMapper.java @@ -35,8 +35,10 @@ public interface BillMapper extends BaseMapper { * @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 { * @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 queryWrapper); } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/store/serviceimpl/BillServiceImpl.java b/framework/src/main/java/cn/lili/modules/store/serviceimpl/BillServiceImpl.java index 8d0819267..4d58b471e 100644 --- a/framework/src/main/java/cn/lili/modules/store/serviceimpl/BillServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/store/serviceimpl/BillServiceImpl.java @@ -95,12 +95,16 @@ public class BillServiceImpl extends ServiceImpl 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; }