Browse Source

trade:退款理由的维护

YunaiV 1 year ago
parent
commit
666ba351a2

+ 13 - 0
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/config/vo/TradeConfigBaseVO.java

@@ -19,6 +19,19 @@ import java.util.List;
  */
 @Data
 public class TradeConfigBaseVO {
+
+    // ========== 售后相关 ==========
+
+    @Schema(description = "售后的退款理由", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotEmpty(message = "售后的退款理由不能为空")
+    private List<String> afterSaleRefundReasons;
+
+    @Schema(description = "售后的退货理由", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotEmpty(message = "售后的退货理由不能为空")
+    private List<String> afterSaleReturnReasons;
+
+    // ========== 配送相关 ==========
+
     /**
      * 是否启用全场包邮
      */

+ 0 - 15
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/AppTradeAfterSaleController.java

@@ -9,7 +9,6 @@ import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSa
 import cn.iocoder.yudao.module.trade.convert.aftersale.TradeAfterSaleConvert;
 import cn.iocoder.yudao.module.trade.enums.aftersale.AfterSaleOperateTypeEnum;
 import cn.iocoder.yudao.module.trade.enums.aftersale.TradeAfterSaleStatusEnum;
-import cn.iocoder.yudao.module.trade.enums.aftersale.TradeAfterSaleWayEnum;
 import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.annotations.AfterSaleLog;
 import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.util.AfterSaleLogUtils;
 import cn.iocoder.yudao.module.trade.service.aftersale.TradeAfterSaleService;
@@ -21,9 +20,6 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Objects;
 
 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
 import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
@@ -58,17 +54,6 @@ public class AppTradeAfterSaleController {
         return success(afterSaleService.getApplyingAfterSaleCount(getLoginUserId()));
     }
 
-    // TODO 芋艿:待实现
-    @GetMapping(value = "/get-reason-list")
-    @Operation(summary = "获得售后原因")
-    @Parameter(name = "way", description = "售后类型", required = true, example = "10")
-    public CommonResult<List<String>> getAfterSaleReasonList(@RequestParam("way") Integer way) {
-        if (Objects.equals(TradeAfterSaleWayEnum.REFUND.getWay(), way)) {
-            return success(Arrays.asList("不想要了", "商品质量问题", "商品描述不符"));
-        }
-        return success(Arrays.asList("不想要了", "商品质量问题", "商品描述不符", "商品错发漏发", "商品包装破损"));
-    }
-
     @PostMapping(value = "/create")
     @Operation(summary = "申请售后")
     @AfterSaleLog(id = "#info.data", content = "'申请售后:售后编号['+#info.data+'],订单编号['+#createReqVO.orderItemId+'], '", operateType = AfterSaleOperateTypeEnum.MEMBER_CREATE)

+ 10 - 0
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/config/vo/AppTradeConfigRespVO.java

@@ -9,6 +9,16 @@ import java.util.List;
 @Data
 public class AppTradeConfigRespVO {
 
+    // ========== 售后相关 ==========
+
+    @Schema(description = "售后的退款理由", requiredMode = Schema.RequiredMode.REQUIRED)
+    private List<String> afterSaleRefundReasons;
+
+    @Schema(description = "售后的退货理由", requiredMode = Schema.RequiredMode.REQUIRED)
+    private List<String> afterSaleReturnReasons;
+
+    // ========== 分销相关 ==========
+
     @Schema(description = "分销海报地址数组", requiredMode = Schema.RequiredMode.REQUIRED)
     private List<String> brokeragePosterUrls;
 

+ 13 - 0
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/config/TradeConfigDO.java

@@ -35,6 +35,19 @@ public class TradeConfigDO extends BaseDO {
     @TableId
     private Long id;
 
+    // ========== 售后相关 ==========
+
+    /**
+     * 售后的退款理由
+     */
+    @TableField(typeHandler = JacksonTypeHandler.class)
+    private List<String> afterSaleRefundReasons;
+    /**
+     * 售后的退货理由
+     */
+    @TableField(typeHandler = JacksonTypeHandler.class)
+    private List<String> afterSaleReturnReasons;
+
     // ========== 配送相关 ==========
 
     /**

+ 0 - 2
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/aftersale/TradeAfterSaleServiceImpl.java

@@ -125,12 +125,10 @@ public class TradeAfterSaleServiceImpl implements TradeAfterSaleService, AfterSa
         if (orderItem == null) {
             throw exception(ORDER_ITEM_NOT_FOUND);
         }
-
         // 已申请售后,不允许再发起售后申请
         if (!TradeOrderItemAfterSaleStatusEnum.isNone(orderItem.getAfterSaleStatus())) {
             throw exception(AFTER_SALE_CREATE_FAIL_ORDER_ITEM_APPLIED);
         }
-
         // 申请的退款金额,不能超过商品的价格
         if (createReqVO.getRefundPrice() > orderItem.getPayPrice()) {
             throw exception(AFTER_SALE_CREATE_FAIL_REFUND_PRICE_ERROR);

+ 1 - 1
yudao-server/src/main/resources/application-local.yaml

@@ -9,7 +9,7 @@ spring:
     exclude:
       - com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源
       - org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration # 排除积木报表带来的 MongoDB 的自动配置
-#      - org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration # 默认 local 环境,不开启 Quartz 的自动配置
+      - org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration # 默认 local 环境,不开启 Quartz 的自动配置
       - de.codecentric.boot.admin.server.config.AdminServerAutoConfiguration # 禁用 Spring Boot Admin 的 Server 的自动配置
       - de.codecentric.boot.admin.server.ui.config.AdminServerUiAutoConfiguration # 禁用 Spring Boot Admin 的 Server UI 的自动配置
       - de.codecentric.boot.admin.client.config.SpringBootAdminClientAutoConfiguration # 禁用 Spring Boot Admin 的 Client 的自动配置