Browse Source

修改售后订单的金额回显,加上消费分字段,退款修改金额可以为0

Yangzw 7 months ago
parent
commit
a5aa19e52b
47 changed files with 711 additions and 37 deletions
  1. 4 0
      feifan-framework/feifan-spring-boot-starter-biz-pay/src/main/java/cn/newfeifan/mall/framework/pay/core/client/impl/PayClientFactoryImpl.java
  2. 1 0
      feifan-framework/feifan-spring-boot-starter-biz-pay/src/main/java/cn/newfeifan/mall/framework/pay/core/enums/channel/PayChannelEnum.java
  3. 30 0
      feifan-module-distri/feifan-module-distri-api/src/main/java/cn/newfeifan/mall/module/distri/enums/ConsumptionEnum.java
  4. 2 0
      feifan-module-distri/feifan-module-distri-api/src/main/java/cn/newfeifan/mall/module/distri/enums/ErrorCodeConstants.java
  5. 48 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/consumptionchangelog/vo/ConsumptionChangeLogPageReqVO.java
  6. 59 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/consumptionchangelog/vo/ConsumptionChangeLogRespVO.java
  7. 43 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/consumptionchangelog/vo/ConsumptionChangeLogSaveReqVO.java
  8. 9 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/dailybill/vo/DailyBillPageReqVO.java
  9. 12 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/dailybill/vo/DailyBillRespVO.java
  10. 11 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/dailybill/vo/DailyBillSaveReqVO.java
  11. 9 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ptdailybill/vo/PtDailyBillPageReqVO.java
  12. 12 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ptdailybill/vo/PtDailyBillRespVO.java
  13. 12 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ptdailybill/vo/PtDailyBillSaveReqVO.java
  14. 2 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ptsettlement/vo/PtSettlementPageReqVO.java
  15. 3 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ptsettlement/vo/PtSettlementRespVO.java
  16. 3 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ptsettlement/vo/PtSettlementSaveReqVO.java
  17. 4 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/shopsettlement/excelvo/ShopSettlementExcelRespVO.java
  18. 2 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/shopsettlement/vo/ShopSettlementPageReqVO.java
  19. 4 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/shopsettlement/vo/ShopSettlementRespVO.java
  20. 3 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/shopsettlement/vo/ShopSettlementSaveReqVO.java
  21. 1 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/convert/shopsettlement/ShopSettlementConvert.java
  22. 64 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/dataobject/consumptionchangelog/ConsumptionChangeLogDO.java
  23. 13 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/dataobject/dailybill/DailyBillDO.java
  24. 4 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/dataobject/integral/IntegralDO.java
  25. 13 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/dataobject/ptdailybill/PtDailyBillDO.java
  26. 5 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/dataobject/ptsettlement/PtSettlementDO.java
  27. 4 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/dataobject/shopsettlement/ShopSettlementDO.java
  28. 28 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/mysql/consumptionchangelog/ConsumptionChangeLogMapper.java
  29. 56 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/consumptionchangelog/ConsumptionChangeLogService.java
  30. 87 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/consumptionchangelog/ConsumptionChangeLogServiceImpl.java
  31. 10 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/integral/IntegralService.java
  32. 24 0
      feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/integral/IntegralServiceImpl.java
  33. 9 0
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/aftersale/vo/AfterSaleBaseVO.java
  34. 9 0
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/aftersale/vo/AfterSalePageReqVO.java
  35. 4 0
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/excelVO/DailyBillOrderRespVO.java
  36. 10 6
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/excelVO/SettlementOrderRespVO.java
  37. 9 0
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/vo/TradeOrderBaseVO.java
  38. 3 0
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/app/order/vo/AppTradeOrderDetailRespVO.java
  39. 5 3
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/convert/order/TradeOrderConvert.java
  40. 13 19
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/dal/dataobject/aftersale/AfterSaleDO.java
  41. 9 0
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/dal/dataobject/order/TradeOrderDO.java
  42. 9 0
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/dal/dataobject/order/TradeOrderItemDO.java
  43. 28 0
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/aftersale/AfterSaleServiceImpl.java
  44. 2 4
      feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/order/TradeOrderQueryServiceImpl.java
  45. 2 2
      feifan-module-mall/feifan-module-trade-biz/src/main/resources/mapper/order/BrokerageUserMapper.xml
  46. 1 2
      feifan-module-pay/feifan-module-pay-api/src/main/java/cn/newfeifan/mall/module/pay/api/refund/dto/PayRefundCreateReqDTO.java
  47. 16 1
      feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/service/refund/PayRefundServiceImpl.java

+ 4 - 0
feifan-framework/feifan-spring-boot-starter-biz-pay/src/main/java/cn/newfeifan/mall/framework/pay/core/client/impl/PayClientFactoryImpl.java

@@ -16,6 +16,7 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
 import static cn.newfeifan.mall.framework.pay.core.enums.channel.PayChannelEnum.*;
+import static cn.newfeifan.mall.framework.pay.core.enums.channel.PayChannelEnum.ZERO_PURCHASE;
 
 /**
  * 支付客户端的工厂实现类
@@ -54,6 +55,9 @@ public class PayClientFactoryImpl implements PayClientFactory {
 
         //富友支付
         clientClass.put(JSAPI, WxPubPayClient.class);
+
+        // 短信验证码支付
+        clientClass.put(ZERO_PURCHASE, MockPayClient.class);
     }
 
     @Override

+ 1 - 0
feifan-framework/feifan-spring-boot-starter-biz-pay/src/main/java/cn/newfeifan/mall/framework/pay/core/enums/channel/PayChannelEnum.java

@@ -31,6 +31,7 @@ public enum PayChannelEnum {
     MOCK("mock", "模拟支付", NonePayClientConfig.class),
 
     WALLET("wallet", "钱包支付", NonePayClientConfig.class),
+    ZERO_PURCHASE("zero_purchase", "零元购", NonePayClientConfig.class),
 
     JSAPI("JSAPI","富友微信公众号支付", NonePayClientConfig.class);
 

+ 30 - 0
feifan-module-distri/feifan-module-distri-api/src/main/java/cn/newfeifan/mall/module/distri/enums/ConsumptionEnum.java

@@ -0,0 +1,30 @@
+package cn.newfeifan.mall.module.distri.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
+public enum ConsumptionEnum {
+
+    PT_TOP_TUP(1,"平台充值"),
+    COMMISSION_TRANSITION(2,"佣金转化为消费分"),
+    CONSUMPTION_TRANSFER(3,"消费分转出"),
+    CONSUMPTION_RECIPIENT(4,"消费分转入"),
+    COMMISSION_WITHDRAWAL(5,"佣金提现"),
+    PAY_ORDER(6,"购物支付"),
+    REFUND_ORDER(7,"退回退款返回"),
+    ;
+
+    private final Integer type;
+    private final String name;
+
+    public static String getName(Integer type){
+        for (ConsumptionEnum value : ConsumptionEnum.values()) {
+            if(value.getType().equals(type)){
+                return value.getName();
+            }
+        }
+        return null;
+    }
+}

+ 2 - 0
feifan-module-distri/feifan-module-distri-api/src/main/java/cn/newfeifan/mall/module/distri/enums/ErrorCodeConstants.java

@@ -30,4 +30,6 @@ public interface ErrorCodeConstants {
     ErrorCode ORDER_SETTLEMENT_NOT_EXISTS = new ErrorCode(1_003_031_005, "该结算订单二级表记录不存在");
     ErrorCode PT_DAILY_BILL_NOT_EXISTS = new ErrorCode(1_003_031_006, "平台每日账单不存在");
 
+    ErrorCode CONSUMPTION_CHANGE_LOG_NOT_EXISTS = new ErrorCode(1_002_030_036, "消费分变动记录不存在");
+
 }

+ 48 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/consumptionchangelog/vo/ConsumptionChangeLogPageReqVO.java

@@ -0,0 +1,48 @@
+package cn.newfeifan.mall.module.distri.controller.admin.consumptionchangelog.vo;
+
+import cn.newfeifan.mall.framework.common.pojo.PageParam;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDateTime;
+
+import static cn.newfeifan.mall.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - 平台消费分变动记录分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class ConsumptionChangeLogPageReqVO extends PageParam {
+
+    @Schema(description = "用户ID", example = "10871")
+    private Long userId;
+
+    @Schema(description = "变动的消费分")
+    private Long consumptionPoints;
+
+    @Schema(description = "变动后消费分")
+    private Long afterConsumptionPoints;
+
+    @Schema(description = "消费分变动类型", example = "2")
+    private Integer consumptionStatus;
+
+    @Schema(description = "创建时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] createTime;
+
+    @Schema(description = "实际消费分")
+    private Long practicalConsumptionPoints;
+
+    @Schema(description = "消费分产生对象", example = "23323")
+    private Long generateUserId;
+
+    @Schema(description = "订单Id", example = "18715")
+    private Long orderId;
+
+    @Schema(description = "订单编号")
+    private String orderNo;
+
+}

+ 59 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/consumptionchangelog/vo/ConsumptionChangeLogRespVO.java

@@ -0,0 +1,59 @@
+package cn.newfeifan.mall.module.distri.controller.admin.consumptionchangelog.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Schema(description = "管理后台 - 平台消费分变动记录 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class ConsumptionChangeLogRespVO {
+
+    @Schema(description = "日志编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7160")
+    @ExcelProperty("日志编号")
+    private Long id;
+
+    @Schema(description = "用户ID", example = "10871")
+    @ExcelProperty("用户ID")
+    private Long userId;
+
+    @Schema(description = "变动的消费分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("变动的消费分")
+    private Long consumptionPoints;
+
+    @Schema(description = "变动后消费分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("变动后消费分")
+    private Long afterConsumptionPoints;
+
+    @Schema(description = "消费分变动类型", example = "2")
+    @ExcelProperty("消费分变动类型")
+    private Integer consumptionStatus;
+
+    @Schema(description = "类型名称")
+    private String consumptionStatusName;
+
+    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("创建时间")
+    private LocalDateTime createTime;
+
+    @Schema(description = "实际消费分")
+    @ExcelProperty("实际消费分")
+    private Long practicalConsumptionPoints;
+
+    @Schema(description = "消费分产生对象", example = "23323")
+    private Long generateUserId;
+
+    private String generateUserName;
+
+    @Schema(description = "订单Id", example = "18715")
+    @ExcelProperty("订单Id")
+    private Long orderId;
+
+    @Schema(description = "订单编号")
+    @ExcelProperty("订单编号")
+    private String orderNo;
+
+}

+ 43 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/consumptionchangelog/vo/ConsumptionChangeLogSaveReqVO.java

@@ -0,0 +1,43 @@
+package cn.newfeifan.mall.module.distri.controller.admin.consumptionchangelog.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Builder;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+@Schema(description = "管理后台 - 平台消费分变动记录新增/修改 Request VO")
+@Data
+@Builder
+public class ConsumptionChangeLogSaveReqVO {
+
+    @Schema(description = "日志编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7160")
+    private Long id;
+
+    @Schema(description = "用户ID", example = "10871")
+    private Long userId;
+
+    @Schema(description = "变动的消费分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotNull(message = "变动的消费分不能为空")
+    private Long consumptionPoints;
+
+    @Schema(description = "变动后消费分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotNull(message = "变动后消费分不能为空")
+    private Long afterConsumptionPoints;
+
+    @Schema(description = "消费分变动类型", example = "2")
+    private Integer consumptionStatus;
+
+    @Schema(description = "实际消费分")
+    private Long practicalConsumptionPoints;
+
+    @Schema(description = "消费分产生对象", example = "23323")
+    private Long generateUserId;
+
+    @Schema(description = "订单Id", example = "18715")
+    private Long orderId;
+
+    @Schema(description = "订单编号")
+    private String orderNo;
+
+}

+ 9 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/dailybill/vo/DailyBillPageReqVO.java

@@ -56,4 +56,13 @@ public class DailyBillPageReqVO extends PageParam {
     @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
     private LocalDate[] orderCalcTime;
 
+    @Schema(description = "消费分")
+    private Long consumptionPoints;
+
+    @Schema(description = "确收消费分")
+    private Long receivedConsumptionPoints;
+
+    @Schema(description = "退款消费分")
+    private Long refundConsumptionPoints;
+
 }

+ 12 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/dailybill/vo/DailyBillRespVO.java

@@ -72,6 +72,18 @@ public class DailyBillRespVO {
     @ExcelProperty("订单所属日期")
     private LocalDate orderCalcTime;
 
+    @Schema(description = "消费分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("消费分")
+    private Long consumptionPoints;
+
+    @Schema(description = "确收消费分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("确收消费分")
+    private Long receivedConsumptionPoints;
+
+    @Schema(description = "退款消费分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("退款消费分")
+    private Long refundConsumptionPoints;
+
     public String getOrderCalcTime() {
         return orderCalcTime.toString();
     }

+ 11 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/dailybill/vo/DailyBillSaveReqVO.java

@@ -56,4 +56,15 @@ public class DailyBillSaveReqVO {
     @NotNull(message = "订单所属日期不能为空")
     private LocalDate orderCalcTime;
 
+    @Schema(description = "消费分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotNull(message = "消费分不能为空")
+    private Long consumptionPoints;
+
+    @Schema(description = "确收消费分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotNull(message = "确收消费分不能为空")
+    private Long receivedConsumptionPoints;
+
+    @Schema(description = "退款消费分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotNull(message = "退款消费分不能为空")
+    private Long refundConsumptionPoints;
 }

+ 9 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ptdailybill/vo/PtDailyBillPageReqVO.java

@@ -50,4 +50,13 @@ public class PtDailyBillPageReqVO extends PageParam {
     @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
     private LocalDateTime[] createTime;
 
+    @Schema(description = "消费分")
+    private Long consumptionPoints;
+
+    @Schema(description = "确收消费分")
+    private Long receivedConsumptionPoints;
+
+    @Schema(description = "退款消费分")
+    private Long refundConsumptionPoints;
+
 }

+ 12 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ptdailybill/vo/PtDailyBillRespVO.java

@@ -57,6 +57,18 @@ public class PtDailyBillRespVO {
     @ExcelProperty("创建时间")
     private LocalDateTime createTime;
 
+    @Schema(description = "消费分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("消费分")
+    private Long consumptionPoints;
+
+    @Schema(description = "确收消费分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("确收消费分")
+    private Long receivedConsumptionPoints;
+
+    @Schema(description = "退款消费分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("退款消费分")
+    private Long refundConsumptionPoints;
+
     public String getOrderCalcTime() {
         return orderCalcTime.toString();
     }

+ 12 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ptdailybill/vo/PtDailyBillSaveReqVO.java

@@ -50,4 +50,16 @@ public class PtDailyBillSaveReqVO {
     @NotEmpty(message = "订单ID列表,文本类型不能为空")
     private String orderIds;
 
+    @Schema(description = "消费分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotNull(message = "消费分不能为空")
+    private Long consumptionPoints;
+
+    @Schema(description = "确收消费分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotNull(message = "确收消费分不能为空")
+    private Long receivedConsumptionPoints;
+
+    @Schema(description = "退款消费分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotNull(message = "退款消费分不能为空")
+    private Long refundConsumptionPoints;
+
 }

+ 2 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ptsettlement/vo/PtSettlementPageReqVO.java

@@ -34,4 +34,6 @@ public class PtSettlementPageReqVO extends PageParam {
     @Schema(description = "是否结账")
     private Boolean platformTransferConfirm;
 
+    @Schema(description = "抵扣消费分")
+    private Long consumptionPoints;
 }

+ 3 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ptsettlement/vo/PtSettlementRespVO.java

@@ -37,4 +37,7 @@ public class PtSettlementRespVO {
     @ExcelProperty("是否结账")
     private Boolean platformTransferConfirm;
 
+    @Schema(description = "抵扣消费分")
+    @ExcelProperty("抵扣消费分")
+    private Long consumptionPoints;
 }

+ 3 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/ptsettlement/vo/PtSettlementSaveReqVO.java

@@ -27,4 +27,7 @@ public class PtSettlementSaveReqVO {
     @Schema(description = "是否结账")
     private Boolean platformTransferConfirm;
 
+    @Schema(description = "抵扣消费分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotNull(message = "抵扣消费分不能为空")
+    private Long consumptionPoints;
 }

+ 4 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/shopsettlement/excelvo/ShopSettlementExcelRespVO.java

@@ -28,6 +28,10 @@ public class ShopSettlementExcelRespVO {
     @ExcelProperty("抵扣积分")
     private Double shopAmount;
 
+    @Schema(description = "抵扣消费分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("抵扣消费分")
+    private Double shopConsumptionPoints;
+
     @Schema(description = "共计成本价格(高精度 + 成本)")
     @ExcelProperty("应结(成本)")
     private Double shopTotalHighAmount;

+ 2 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/shopsettlement/vo/ShopSettlementPageReqVO.java

@@ -43,4 +43,6 @@ public class ShopSettlementPageReqVO extends PageParam {
     @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
     private LocalDateTime[] createTime;
 
+    @Schema(description = "抵扣消费分")
+    private Long ShopConsumptionPoints;
 }

+ 4 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/shopsettlement/vo/ShopSettlementRespVO.java

@@ -52,4 +52,8 @@ public class ShopSettlementRespVO {
     @ExcelProperty("创建时间")
     private LocalDateTime createTime;
 
+    @Schema(description = "抵扣消费分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("抵扣消费分")
+    private Long shopConsumptionPoints;
+
 }

+ 3 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/controller/admin/shopsettlement/vo/ShopSettlementSaveReqVO.java

@@ -39,4 +39,7 @@ public class ShopSettlementSaveReqVO {
     @Schema(description = "转账凭证附件")
     private String attachment;
 
+    @Schema(description = "抵扣消费分", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotNull(message = "抵扣消费分不能为空")
+    private Long shopConsumptionPoints;
 }

+ 1 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/convert/shopsettlement/ShopSettlementConvert.java

@@ -18,6 +18,7 @@ public interface ShopSettlementConvert {
         for (ShopSettlementExcelRespVO respVO : respVOList) {
             respVO.setPlatformCollectionAmount(respVO.getPlatformCollectionAmount() / ONE_HUNDRED);
             respVO.setShopAmount(respVO.getShopAmount() / MILLION);
+            respVO.setShopConsumptionPoints(respVO.getShopConsumptionPoints() / MILLION);
             respVO.setShopTotalHighAmount(Math.floor(respVO.getShopTotalHighAmount() / ONE_HUNDRED * ONE_HUNDRED) / ONE_HUNDRED);       // 将小数点后的位数截断,保留两位但不进行四舍五入
         }
         return respVOList;

+ 64 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/dataobject/consumptionchangelog/ConsumptionChangeLogDO.java

@@ -0,0 +1,64 @@
+package cn.newfeifan.mall.module.distri.dal.dataobject.consumptionchangelog;
+
+import cn.newfeifan.mall.framework.mybatis.core.dataobject.BaseDO;
+import com.baomidou.mybatisplus.annotation.KeySequence;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.*;
+
+/**
+ * 平台消费分变动记录 DO
+ *
+ * @author 非繁人
+ */
+@TableName("distri_consumption_change_log")
+@KeySequence("distri_consumption_change_log_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class ConsumptionChangeLogDO extends BaseDO {
+
+    /**
+     * 日志编号
+     */
+    @TableId
+    private Long id;
+    /**
+     * 用户ID
+     */
+    private Long userId;
+    /**
+     * 变动的消费分
+     */
+    private Long consumptionPoints;
+    /**
+     * 变动后消费分
+     */
+    private Long afterConsumptionPoints;
+    /**
+     * 消费分变动类型
+     */
+    private Integer consumptionStatus;
+    /**
+     * 实际消费分
+     */
+    private Long practicalConsumptionPoints;
+
+    /**
+     * 消费分产生对象
+     */
+    private Long generateUserId;
+    /**
+     * 订单Id
+     */
+    private Long orderId;
+    /**
+     * 订单编号
+     */
+    private String orderNo;
+
+
+}

+ 13 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/dataobject/dailybill/DailyBillDO.java

@@ -73,4 +73,17 @@ public class DailyBillDO extends BaseDO {
      */
     private LocalDate orderCalcTime;
 
+    /**
+     * 消费分
+     */
+    private Long consumptionPoints;
+    /**
+     * 确收消费分
+     */
+    private Long receivedConsumptionPoints;
+    /**
+     * 退款消费分
+     */
+    private Long refundConsumptionPoints;
+
 }

+ 4 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/dataobject/integral/IntegralDO.java

@@ -69,4 +69,8 @@ public class IntegralDO extends BaseDO {
      */
     private Long highQuotaTotal;
 
+    /**
+     * 当前消费分
+     */
+    private Long consumptionPoints;
 }

+ 13 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/dataobject/ptdailybill/PtDailyBillDO.java

@@ -65,4 +65,17 @@ public class PtDailyBillDO extends BaseDO {
      */
     private String orderIds;
 
+    /**
+     * 消费分
+     */
+    private Long consumptionPoints;
+    /**
+     * 确收消费分
+     */
+    private Long receivedConsumptionPoints;
+    /**
+     * 退款消费分
+     */
+    private Long refundConsumptionPoints;
+
 }

+ 5 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/dataobject/ptsettlement/PtSettlementDO.java

@@ -45,4 +45,9 @@ public class PtSettlementDO extends BaseDO {
      */
     private Boolean platformTransferConfirm;
 
+    /**
+     * 抵扣消费分
+     */
+    private Long consumptionPoints;
+
 }

+ 4 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/dataobject/shopsettlement/ShopSettlementDO.java

@@ -57,4 +57,8 @@ public class ShopSettlementDO extends BaseDO {
      */
     private String attachment;
 
+    /**
+     * 抵扣消费分
+     */
+    private Long shopConsumptionPoints;
 }

+ 28 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/dal/mysql/consumptionchangelog/ConsumptionChangeLogMapper.java

@@ -0,0 +1,28 @@
+package cn.newfeifan.mall.module.distri.dal.mysql.consumptionchangelog;
+
+import cn.newfeifan.mall.framework.common.pojo.PageResult;
+import cn.newfeifan.mall.framework.mybatis.core.mapper.BaseMapperX;
+import cn.newfeifan.mall.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.newfeifan.mall.module.distri.controller.admin.consumptionchangelog.vo.ConsumptionChangeLogPageReqVO;
+import cn.newfeifan.mall.module.distri.dal.dataobject.consumptionchangelog.ConsumptionChangeLogDO;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 平台消费分变动记录 Mapper
+ *
+ * @author 非繁人
+ */
+@Mapper
+public interface ConsumptionChangeLogMapper extends BaseMapperX<ConsumptionChangeLogDO> {
+
+    default PageResult<ConsumptionChangeLogDO> selectPage(ConsumptionChangeLogPageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<ConsumptionChangeLogDO>()
+                .eqIfPresent(ConsumptionChangeLogDO::getUserId, reqVO.getUserId())
+                .eqIfPresent(ConsumptionChangeLogDO::getConsumptionPoints, reqVO.getConsumptionPoints())
+                .eqIfPresent(ConsumptionChangeLogDO::getAfterConsumptionPoints, reqVO.getAfterConsumptionPoints())
+                .eqIfPresent(ConsumptionChangeLogDO::getConsumptionStatus, reqVO.getConsumptionStatus())
+                .betweenIfPresent(ConsumptionChangeLogDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(ConsumptionChangeLogDO::getId));
+    }
+
+}

+ 56 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/consumptionchangelog/ConsumptionChangeLogService.java

@@ -0,0 +1,56 @@
+package cn.newfeifan.mall.module.distri.service.consumptionchangelog;
+
+import cn.newfeifan.mall.framework.common.pojo.PageResult;
+import cn.newfeifan.mall.module.distri.controller.admin.consumptionchangelog.vo.ConsumptionChangeLogPageReqVO;
+import cn.newfeifan.mall.module.distri.controller.admin.consumptionchangelog.vo.ConsumptionChangeLogRespVO;
+import cn.newfeifan.mall.module.distri.controller.admin.consumptionchangelog.vo.ConsumptionChangeLogSaveReqVO;
+import cn.newfeifan.mall.module.distri.dal.dataobject.consumptionchangelog.ConsumptionChangeLogDO;
+
+import javax.validation.Valid;
+
+/**
+ * 平台消费分变动记录 Service 接口
+ *
+ * @author 非繁人
+ */
+public interface ConsumptionChangeLogService {
+
+    /**
+     * 创建平台消费分变动记录
+     *
+     * @param createReqVO 创建信息
+     * @return 编号
+     */
+    Long createConsumptionChangeLog(@Valid ConsumptionChangeLogSaveReqVO createReqVO);
+
+    /**
+     * 更新平台消费分变动记录
+     *
+     * @param updateReqVO 更新信息
+     */
+    void updateConsumptionChangeLog(@Valid ConsumptionChangeLogSaveReqVO updateReqVO);
+
+    /**
+     * 删除平台消费分变动记录
+     *
+     * @param id 编号
+     */
+    void deleteConsumptionChangeLog(Long id);
+
+    /**
+     * 获得平台消费分变动记录
+     *
+     * @param id 编号
+     * @return 平台消费分变动记录
+     */
+    ConsumptionChangeLogDO getConsumptionChangeLog(Long id);
+
+    /**
+     * 获得平台消费分变动记录分页
+     *
+     * @param pageReqVO 分页查询
+     * @return 平台消费分变动记录分页
+     */
+    PageResult<ConsumptionChangeLogRespVO> getConsumptionChangeLogPage(ConsumptionChangeLogPageReqVO pageReqVO);
+
+}

+ 87 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/consumptionchangelog/ConsumptionChangeLogServiceImpl.java

@@ -0,0 +1,87 @@
+package cn.newfeifan.mall.module.distri.service.consumptionchangelog;
+
+import cn.newfeifan.mall.framework.common.pojo.PageResult;
+import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
+import cn.newfeifan.mall.module.distri.controller.admin.consumptionchangelog.vo.ConsumptionChangeLogPageReqVO;
+import cn.newfeifan.mall.module.distri.controller.admin.consumptionchangelog.vo.ConsumptionChangeLogRespVO;
+import cn.newfeifan.mall.module.distri.controller.admin.consumptionchangelog.vo.ConsumptionChangeLogSaveReqVO;
+import cn.newfeifan.mall.module.distri.dal.dataobject.consumptionchangelog.ConsumptionChangeLogDO;
+import cn.newfeifan.mall.module.distri.dal.mysql.consumptionchangelog.ConsumptionChangeLogMapper;
+import cn.newfeifan.mall.module.distri.enums.ConsumptionEnum;
+import cn.newfeifan.mall.module.member.dal.dataobject.user.MemberUserDO;
+import cn.newfeifan.mall.module.member.service.user.MemberUserService;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import javax.annotation.Resource;
+
+import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.newfeifan.mall.module.distri.enums.ErrorCodeConstants.CONSUMPTION_CHANGE_LOG_NOT_EXISTS;
+
+/**
+ * 平台消费分变动记录 Service 实现类
+ *
+ * @author 非繁人
+ */
+@Service
+@Validated
+public class ConsumptionChangeLogServiceImpl implements ConsumptionChangeLogService {
+
+    @Resource
+    private ConsumptionChangeLogMapper consumptionChangeLogMapper;
+
+    @Resource
+    private MemberUserService memberUserService;
+
+    @Override
+    public Long createConsumptionChangeLog(ConsumptionChangeLogSaveReqVO createReqVO) {
+        // 插入
+        ConsumptionChangeLogDO consumptionChangeLog = BeanUtils.toBean(createReqVO, ConsumptionChangeLogDO.class);
+        consumptionChangeLogMapper.insert(consumptionChangeLog);
+        // 返回
+        return consumptionChangeLog.getId();
+    }
+
+    @Override
+    public void updateConsumptionChangeLog(ConsumptionChangeLogSaveReqVO updateReqVO) {
+        // 校验存在
+        validateConsumptionChangeLogExists(updateReqVO.getId());
+        // 更新
+        ConsumptionChangeLogDO updateObj = BeanUtils.toBean(updateReqVO, ConsumptionChangeLogDO.class);
+        consumptionChangeLogMapper.updateById(updateObj);
+    }
+
+    @Override
+    public void deleteConsumptionChangeLog(Long id) {
+        // 校验存在
+        validateConsumptionChangeLogExists(id);
+        // 删除
+        consumptionChangeLogMapper.deleteById(id);
+    }
+
+    private void validateConsumptionChangeLogExists(Long id) {
+        if (consumptionChangeLogMapper.selectById(id) == null) {
+            throw exception(CONSUMPTION_CHANGE_LOG_NOT_EXISTS);
+        }
+    }
+
+    @Override
+    public ConsumptionChangeLogDO getConsumptionChangeLog(Long id) {
+        return consumptionChangeLogMapper.selectById(id);
+    }
+
+    @Override
+    public PageResult<ConsumptionChangeLogRespVO> getConsumptionChangeLogPage(ConsumptionChangeLogPageReqVO pageReqVO) {
+        PageResult<ConsumptionChangeLogRespVO> bean = BeanUtils.toBean(consumptionChangeLogMapper.selectPage(pageReqVO), ConsumptionChangeLogRespVO.class);
+
+        for (ConsumptionChangeLogRespVO consumptionChangeLogRespVO : bean.getList()) {
+            consumptionChangeLogRespVO.setConsumptionStatusName(ConsumptionEnum.getName(consumptionChangeLogRespVO.getConsumptionStatus()));
+            if(consumptionChangeLogRespVO.getGenerateUserId() != null){
+                MemberUserDO user = memberUserService.getUser(consumptionChangeLogRespVO.getGenerateUserId());
+                consumptionChangeLogRespVO.setGenerateUserName(user.getUsername());
+            }
+        }
+        return bean;
+    }
+
+}

+ 10 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/integral/IntegralService.java

@@ -90,4 +90,14 @@ public interface IntegralService {
      * @param orderNum 订单号
      */
     void updateIntegralFreezeHighQuota(Long generateUserId, Long userId, CaclEnum caclEnum, Long totalFreezeHighQuota, Long tradeOrderId, String orderNum);
+
+    /**
+     * 修改用户消费积分
+     * @param generateUserId 用户
+     * @param userId 用户
+     * @param payConsumptionPoints 消费分
+     * @param tradeOrderId  订单id
+     * @param tradeOrderNum 订单编号
+     */
+    void updateUserConsumptionPoints(Long generateUserId, Long userId, Long payConsumptionPoints, Long tradeOrderId, String tradeOrderNum);
 }

+ 24 - 0
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/integral/IntegralServiceImpl.java

@@ -1,5 +1,6 @@
 package cn.newfeifan.mall.module.distri.service.integral;
 
+import cn.newfeifan.mall.module.distri.controller.admin.consumptionchangelog.vo.ConsumptionChangeLogSaveReqVO;
 import cn.newfeifan.mall.module.distri.controller.admin.ptprofitlog.vo.PtProfitLogSaveReqVO;
 import cn.newfeifan.mall.module.distri.dal.dataobject.integral.IntegralDO;
 import cn.newfeifan.mall.module.distri.dal.dataobject.orderpercentage.OrderPercentageDO;
@@ -7,6 +8,8 @@ import cn.newfeifan.mall.module.distri.dal.dataobject.ptprofitlog.PtProfitLogDO;
 import cn.newfeifan.mall.module.distri.dal.mysql.integral.IntegralMapper;
 import cn.newfeifan.mall.module.distri.dal.mysql.ptprofit.PtProfitMapper;
 import cn.newfeifan.mall.module.distri.enums.CaclEnum;
+import cn.newfeifan.mall.module.distri.enums.ConsumptionEnum;
+import cn.newfeifan.mall.module.distri.service.consumptionchangelog.ConsumptionChangeLogService;
 import cn.newfeifan.mall.module.distri.service.orderpercentage.OrderPercentageService;
 import cn.newfeifan.mall.module.distri.service.ptprofitlog.PtProfitLogService;
 import org.springframework.stereotype.Service;
@@ -33,6 +36,9 @@ public class IntegralServiceImpl implements IntegralService {
     @Resource
     private OrderPercentageService orderPercentageService;
 
+    @Resource
+    private ConsumptionChangeLogService consumptionChangeLogService;
+
     /**
      * add by Ben
      * 修改用户积分
@@ -122,6 +128,24 @@ public class IntegralServiceImpl implements IntegralService {
         ptProfitLogService.createPtProfitLog(profitLogSaveReqVO);
     }
 
+    @Override
+    public void updateUserConsumptionPoints(Long generateUserId, Long userId, Long payConsumptionPoints, Long tradeOrderId, String tradeOrderNum) {
+        // 获取用户钱包,然后退回消费分
+        IntegralDO integralDO = integralMapper.selectOne(IntegralDO::getUserId, userId);
+        integralDO.setConsumptionPoints(integralDO.getConsumptionPoints() + payConsumptionPoints);
+        integralMapper.updateById(integralDO);
+
+        // 记录消费分变动日志
+        consumptionChangeLogService.createConsumptionChangeLog(ConsumptionChangeLogSaveReqVO.builder()
+                        .userId(userId)
+                        .generateUserId(generateUserId)
+                        .consumptionPoints(payConsumptionPoints)
+                        .afterConsumptionPoints(integralDO.getConsumptionPoints())
+                        .consumptionStatus(ConsumptionEnum.REFUND_ORDER.getType())
+                .build());
+
+    }
+
 //
 //    /**
 //     * 修改用户身价

+ 9 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/aftersale/vo/AfterSaleBaseVO.java

@@ -118,4 +118,13 @@ public class AfterSaleBaseVO {
 
     @Schema(description = "店铺id", example = "20588")
     private Long shopId;
+
+    @Schema(description = "退还的使用的消费分")
+    private Long refundConsumptionPoints;
+
+    @Schema(description = "退款总金额,单位:分")
+    private Long refundPriceTotal;
+
+    @Schema(description = "退还的使用的积分")
+    private Long refundIntegral;
 }

+ 9 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/aftersale/vo/AfterSalePageReqVO.java

@@ -57,4 +57,13 @@ public class AfterSalePageReqVO extends PageParam {
 
     @Schema(description = "用户id", example = "1")
     private Long userId;
+
+    @Schema(description = "退还的使用的消费分")
+    private Long refundConsumptionPoints;
+
+    @Schema(description = "退款总金额,单位:分")
+    private Long refundPriceTotal;
+
+    @Schema(description = "退还的使用的积分")
+    private Long refundIntegral;
 }

+ 4 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/excelVO/DailyBillOrderRespVO.java

@@ -31,6 +31,10 @@ public class DailyBillOrderRespVO {
     @ExcelProperty("积分抵扣")
     private Double payIntegral;
 
+    @Schema(description = "支付消费分")
+    @ExcelProperty("消费分抵扣")
+    private Double payConsumptionPoints;
+
     @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
     @ExcelProperty("下单时间")
     private LocalDateTime createTime;

+ 10 - 6
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/excelVO/SettlementOrderRespVO.java

@@ -17,20 +17,24 @@ public class SettlementOrderRespVO {
 
     @Schema(description = "应付金额(总)", requiredMode = Schema.RequiredMode.REQUIRED, example = "26217")
     @ExcelProperty("销售额")
-    private Double payPrice;
+    private Double totalPrice;
 
     @Schema(description = "确收现金")
     @ExcelProperty("确收现金")
-    private Double payCash;
+    private Double payPrice;
 
-    @Schema(description = "退款金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "23373")
-    @ExcelProperty("退款金额")
-    private Double refundPrice;
+//    @Schema(description = "退款金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "23373")
+//    @ExcelProperty("退款金额")
+//    private Double refundPrice;
 
-    @Schema(description = "支付积分")
+    @Schema(description = "确收积分")
     @ExcelProperty("确收积分")
     private Double payIntegral;
 
+    @Schema(description = "确收消费分")
+    @ExcelProperty("确收消费分")
+    private Double payConsumptionPoints;
+
     @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
     @ExcelProperty("下单时间")
     private LocalDateTime createTime;

+ 9 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/admin/order/vo/TradeOrderBaseVO.java

@@ -156,4 +156,13 @@ public class TradeOrderBaseVO {
 
     @Schema(description = "售后状态", example = "0")
     private Integer refundStatus;
+
+    @Schema(description = "支付积分")
+    private Long payIntegral;
+
+    @Schema(description = "支付的消费分")
+    private Long payConsumptionPoints;
+
+    @Schema(description = "退回的消费分")
+    private Long refundConsumption;
 }

+ 3 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/controller/app/order/vo/AppTradeOrderDetailRespVO.java

@@ -147,4 +147,7 @@ public class AppTradeOrderDetailRespVO {
 
     @Schema(description = "支付积分", example = "10000")
     private Long payIntegral;
+
+    @Schema(description = "本订单使用消费分", example = "36")
+    private Long payConsumptionPoints;
 }

+ 5 - 3
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/convert/order/TradeOrderConvert.java

@@ -298,11 +298,12 @@ public interface TradeOrderConvert {
     default List<SettlementOrderRespVO> convertSettOrder(List<TradeOrderDO> list) {
         List<SettlementOrderRespVO> respVOS = BeanUtils.toBean(list, SettlementOrderRespVO.class);
         for (SettlementOrderRespVO respVO : respVOS) {
-            respVO.setPayPrice(respVO.getPayPrice() / ONE_HUNDRED);
-            respVO.setRefundPrice(respVO.getRefundPrice() / ONE_HUNDRED);
+            respVO.setTotalPrice(respVO.getTotalPrice() / ONE_HUNDRED);
+//            respVO.setRefundPrice(respVO.getRefundPrice() / ONE_HUNDRED);
             respVO.setPayIntegral(respVO.getPayIntegral() / MILLION);
+            respVO.setPayConsumptionPoints(respVO.getPayConsumptionPoints() / MILLION);
 
-            respVO.setPayCash(respVO.getPayPrice() - respVO.getRefundPrice());
+            respVO.setPayPrice(respVO.getPayPrice() / ONE_HUNDRED);
 
         }
         return respVOS;
@@ -314,6 +315,7 @@ public interface TradeOrderConvert {
             respVO.setPayPrice(respVO.getPayPrice() / ONE_HUNDRED);
             respVO.setRefundPrice(respVO.getRefundPrice() / ONE_HUNDRED);
             respVO.setPayIntegral(respVO.getPayIntegral() / MILLION);
+            respVO.setPayConsumptionPoints(respVO.getPayConsumptionPoints() / MILLION);
             respVO.setPayCash(respVO.getPayPrice() - respVO.getRefundPrice());
         }
         return respVOS;

+ 13 - 19
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/dal/dataobject/aftersale/AfterSaleDO.java

@@ -33,37 +33,31 @@ public class AfterSaleDO extends BaseDO {
     private Long id;
     /**
      * 售后单号
-     *
      * 例如说,1146347329394184195
      */
     private String no;
     /**
      * 退款状态
-     *
      * 枚举 {@link AfterSaleStatusEnum}
      */
     private Integer status;
     /**
      * 售后方式
-     *
      * 枚举 {@link AfterSaleWayEnum}
      */
     private Integer way;
     /**
      * 售后类型
-     *
      * 枚举 {@link AfterSaleTypeEnum}
      */
     private Integer type;
     /**
      * 用户编号
-     *
      * 关联 MemberUserDO 的 id 编号
      */
     private Long userId;
     /**
      * 申请原因
-     *
      * type = 退款,对应 trade_after_sale_refund_reason 类型
      * type = 退货退款,对应 trade_after_sale_refund_and_return_reason 类型
      */
@@ -74,7 +68,6 @@ public class AfterSaleDO extends BaseDO {
     private String applyDescription;
     /**
      * 补充凭证图片
-     *
      * 数组,以逗号分隔
      */
     @TableField(typeHandler = JacksonTypeHandler.class)
@@ -83,52 +76,44 @@ public class AfterSaleDO extends BaseDO {
     // ========== 交易订单相关 ==========
     /**
      * 交易订单编号
-     *
      * 关联 {@link TradeOrderDO#getId()}
      */
     private Long orderId;
     /**
      * 订单流水号
-     *
      * 冗余 {@link TradeOrderDO#getNo()}
      */
     private String orderNo;
     /**
      * 交易订单项编号
-     *
      * 关联 {@link TradeOrderItemDO#getId()}
      */
     private Long orderItemId;
     /**
      * 商品 SPU 编号
-     *
      * 关联 ProductSpuDO 的 id 字段
      * 冗余 {@link TradeOrderItemDO#getSpuId()}
      */
     private Long spuId;
     /**
      * 商品 SPU 名称
-     *
      * 关联 ProductSkuDO 的 name 字段
      * 冗余 {@link TradeOrderItemDO#getSpuName()}
      */
     private String spuName;
     /**
      * 商品 SKU 编号
-     *
      * 关联 ProductSkuDO 的编号
      */
     private Long skuId;
     /**
      * 属性数组,JSON 格式
-     *
      * 冗余 {@link TradeOrderItemDO#getProperties()}
      */
     @TableField(typeHandler = TradeOrderItemDO.PropertyTypeHandler.class)
     private List<TradeOrderItemDO.Property> properties;
     /**
      * 商品图片
-     *
      * 冗余 {@link TradeOrderItemDO#getPicUrl()}
      */
     private String picUrl;
@@ -145,13 +130,11 @@ public class AfterSaleDO extends BaseDO {
     private LocalDateTime auditTime;
     /**
      * 审批人
-     *
      * 关联 AdminUserDO 的 id 编号
      */
     private Long auditUserId;
     /**
      * 审批备注
-     *
      * 注意,只有审批不通过才会填写
      */
     private String auditReason;
@@ -163,7 +146,6 @@ public class AfterSaleDO extends BaseDO {
     private Integer refundPrice;
     /**
      * 支付退款编号
-     *
      * 对接 pay-module-biz 支付服务的退款订单编号,即 PayRefundDO 的 id 编号
      */
     private Long payRefundId;
@@ -175,7 +157,6 @@ public class AfterSaleDO extends BaseDO {
     // ========== 退货相关 ==========
     /**
      * 退货物流公司编号
-     *
      * 关联 LogisticsDO 的 id 编号
      */
     private Long logisticsId;
@@ -208,4 +189,17 @@ public class AfterSaleDO extends BaseDO {
      */
     private Long merchantId;
 
+    /**
+     * 退还的使用的消费分
+     */
+    private Long refundConsumptionPoints;
+    /**
+     * 退款总金额,单位:分
+     */
+    private Long refundPriceTotal;
+    /**
+     * 退还的使用的积分
+     */
+    private Long refundIntegral;
+
 }

+ 9 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/dal/dataobject/order/TradeOrderDO.java

@@ -374,4 +374,13 @@ public class TradeOrderDO extends BaseDO {
      * 发货信息附件
      */
     private String attachment;
+
+    /**
+     * 支付消费分
+     */
+    private Long payConsumptionPoints;
+    /**
+     * 退还的使用的消费分
+     */
+    private Long refundConsumption;
 }

+ 9 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/dal/dataobject/order/TradeOrderItemDO.java

@@ -185,6 +185,15 @@ public class TradeOrderItemDO extends BaseDO {
 
     private BigDecimal highPrecisionPrice;
 
+    /**
+     * 支付消费分
+     */
+    private Long payConsumptionPoints;
+    /**
+     * 退还的使用的消费分
+     */
+    private Long refundConsumption;
+
     /**
      * 商品属性
      */

+ 28 - 0
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/aftersale/AfterSaleServiceImpl.java

@@ -414,6 +414,7 @@ public class AfterSaleServiceImpl implements AfterSaleService {
         Long orderItemId = afterSale.getOrderItemId();
         TradeOrderItemDO tradeOrderItemDO = tradeOrderItemMapper.selectById(orderItemId);
         Long payIntegral = tradeOrderItemDO.getPayIntegral();//支付积分
+        Long payConsumptionPoints = tradeOrderItemDO.getPayConsumptionPoints();// 支付的消费分
 
         //查询该订单是否有对应的日结单
         DailyBillDO dailyBill = dailyBillService.getDailyBill(afterSale.getMerchantId(), afterSale.getShopId(), tradeOrderDO.getCreateTime().toLocalDate());
@@ -446,6 +447,33 @@ public class AfterSaleServiceImpl implements AfterSaleService {
             }
         }
 
+        //记录退还消费分
+        if(payConsumptionPoints>0) {
+            TradeOrderItemDO toid = new TradeOrderItemDO();
+            toid.setId(tradeOrderItemDO.getId());
+            toid.setRefundConsumption(payConsumptionPoints);
+            tradeOrderItemMapper.updateById(toid);
+
+            if(tradeOrderDO.getRefundConsumption() != null){
+                tradeOrderDO.setRefundConsumption(tradeOrderDO.getRefundConsumption()+payConsumptionPoints);
+            }else{
+                tradeOrderDO.setRefundConsumption(payConsumptionPoints);
+            }
+            tradeOrderMapper.updateById(tradeOrderDO);
+
+            //退回退款订单项,购物者支付的消费分
+            integralService.updateUserConsumptionPoints(orderUserId,orderUserId, payConsumptionPoints, tradeOrderId, tradeOrderNum);
+
+            if(dailyBill != null){
+                //有就追加退回消费分
+                dailyBill.setRefundConsumptionPoints(dailyBill.getRefundConsumptionPoints()+payConsumptionPoints);
+                dailyBill.setReceivedConsumptionPoints(dailyBill.getReceivedConsumptionPoints()-payConsumptionPoints);
+
+                ptDailyBill.setRefundConsumptionPoints(ptDailyBill.getRefundConsumptionPoints()+payConsumptionPoints);
+                ptDailyBill.setReceivedConsumptionPoints(ptDailyBill.getReceivedConsumptionPoints()-payConsumptionPoints);
+            }
+        }
+
         if(dailyBill != null){
             //有就追加退款金额
             dailyBill.setRefundPrice(dailyBill.getRefundPrice()+afterSale.getRefundPrice());

+ 2 - 4
feifan-module-mall/feifan-module-trade-biz/src/main/java/cn/newfeifan/mall/module/trade/service/order/TradeOrderQueryServiceImpl.java

@@ -40,9 +40,7 @@ import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.time.DayOfWeek;
 import java.time.LocalDate;
-import java.time.temporal.TemporalAdjusters;
 import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -294,8 +292,8 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
         LocalDate today = LocalDate.now(); // 获取今天的日期
 
         if (startTime == null && endTime == null) {
-            startTime = today.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)); // 获取本周的开始日期
-            endTime = today.with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY)); // 获取本周的结束日期
+            startTime = today.minusDays(6); // 获取今天的前七天
+            endTime = today; // 获取今天
         }
         List<LocalDate> weekDates = generateWeekDates(startTime, endTime); // 生成本周的日期数组
         List<EChartsResult.Series> series = weekDates.stream().map(ignored -> new EChartsResult.Series().setCount(0).setMoney(0L)).collect(Collectors.toList());

+ 2 - 2
feifan-module-mall/feifan-module-trade-biz/src/main/resources/mapper/order/BrokerageUserMapper.xml

@@ -6,12 +6,12 @@
             resultType="cn.newfeifan.mall.module.trade.service.order.TradeOrderCountWithMoney">
         SELECT
             DATE(o.create_time) `date`,
-            SUM(o.pay_rmb) + (SUM(o.pay_integral) / 10000) money,
+            SUM(o.pay_rmb) + (SUM(o.pay_integral) / 10000) + (SUM(o.pay_consumption_points) / 10000) money,
             count(*) count
         FROM
             trade_order o
         WHERE
-            o.create_time BETWEEN #{start} AND #{end} and o.merchant_id = #{merId} and o.shop_id = #{shopId} and o.pay_status = 1
+            date(o.create_time) BETWEEN #{start} AND #{end} and o.merchant_id = #{merId} and o.shop_id = #{shopId} and o.pay_status = 1
         GROUP BY
             DATE(o.create_time)
         ORDER BY

+ 1 - 2
feifan-module-pay/feifan-module-pay-api/src/main/java/cn/newfeifan/mall/module/pay/api/refund/dto/PayRefundCreateReqDTO.java

@@ -3,7 +3,6 @@ package cn.newfeifan.mall.module.pay.api.refund.dto;
 import lombok.Data;
 import org.hibernate.validator.constraints.Length;
 
-import javax.validation.constraints.Min;
 import javax.validation.constraints.NotEmpty;
 import javax.validation.constraints.NotNull;
 
@@ -52,7 +51,7 @@ public class PayRefundCreateReqDTO {
      * 退款金额,单位:分
      */
     @NotNull(message = "退款金额不能为空")
-    @Min(value = 1, message = "退款金额必须大于零")
+//    @Min(value = 1, message = "退款金额必须大于零")
     private Integer price;
 
 }

+ 16 - 1
feifan-module-pay/feifan-module-pay-biz/src/main/java/cn/newfeifan/mall/module/pay/service/refund/PayRefundServiceImpl.java

@@ -6,6 +6,7 @@ import cn.newfeifan.mall.framework.common.pojo.PageResult;
 import cn.newfeifan.mall.framework.pay.core.client.PayClient;
 import cn.newfeifan.mall.framework.pay.core.client.dto.refund.PayRefundRespDTO;
 import cn.newfeifan.mall.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
+import cn.newfeifan.mall.framework.pay.core.enums.channel.PayChannelEnum;
 import cn.newfeifan.mall.framework.pay.core.enums.refund.PayRefundStatusRespEnum;
 import cn.newfeifan.mall.framework.tenant.core.util.TenantUtils;
 import cn.newfeifan.mall.module.pay.api.refund.dto.PayRefundCreateReqDTO;
@@ -34,6 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
 
 import javax.annotation.Resource;
+import java.time.LocalDateTime;
 import java.util.List;
 
 import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
@@ -141,7 +143,20 @@ public class PayRefundServiceImpl implements PayRefundService {
         //选择不同的渠道退款
         if (channel.getCode().equals(FuYouPayOrderTypeEnum.JSAPI.getCode())) {
             fuYouPayOrderService.payRefund(reqDTO, order, refund, channel, client);
-        } else {
+        } else if(channel.getCode().equals(PayChannelEnum.ZERO_PURCHASE.getCode())) {
+            // 1. 零元购不用退款
+            PayRefundDO updateRefundObj = new PayRefundDO()
+                    .setSuccessTime(LocalDateTime.now())
+                    .setStatus(PayRefundStatusEnum.SUCCESS.getStatus());
+            refundMapper.updateByIdAndStatus(refund.getId(), refund.getStatus(), updateRefundObj);
+
+            // 2. 更新订单
+            orderService.updateOrderRefundPrice(refund.getOrderId(), refund.getRefundPrice());
+
+            // 3. 插入退款通知记录
+            notifyService.createPayNotifyTask(PayNotifyTypeEnum.REFUND.getType(),
+                    refund.getId());
+        }else {
             // 这里是原来芋道的,不去改动
             selectChannelRefund(reqDTO, order, refund, channel, client);
         }