|
|
@@ -1,17 +1,25 @@
|
|
|
package com.ylx.order.controller;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.ylx.common.core.domain.R;
|
|
|
+import com.ylx.common.core.domain.entity.SysDictData;
|
|
|
+import com.ylx.common.utils.DictUtils;
|
|
|
+import com.ylx.order.domain.dto.AfterSalesServiceDTO;
|
|
|
import com.ylx.order.domain.vo.RegulationConfigVO;
|
|
|
+import com.ylx.order.enums.AfterSaleServiceDictTypeEnum;
|
|
|
import com.ylx.order.service.IAfterSalesServiceService;
|
|
|
import com.ylx.order.service.RegulationService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
|
|
|
@RestController
|
|
|
@@ -25,6 +33,39 @@ public class AfterSalesServiceController {
|
|
|
@Resource
|
|
|
private IAfterSalesServiceService afterSalesServiceService;
|
|
|
|
|
|
+ @PreAuthorize("@customerAuth.isCustomer()")
|
|
|
+ @ApiOperation("客户端获取售后原因接口:退款=1, 取消订单=2")
|
|
|
+ @GetMapping("/dict/{type}/reason")
|
|
|
+ public R<List<String>> getReasonList(@PathVariable("type") Integer type) {
|
|
|
+
|
|
|
+ String dictType = AfterSaleServiceDictTypeEnum.getDictTypeByCode(type);
|
|
|
+
|
|
|
+ if (ObjectUtil.isNull(dictType)) {
|
|
|
+ return R.fail("无效的type类型参数");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<SysDictData> reasonDictDataList = DictUtils.getSortedDictCache(dictType);
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(reasonDictDataList)) {
|
|
|
+ return R.ok(Collections.emptyList());
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> list = new ArrayList<>(reasonDictDataList.size());
|
|
|
+ for (SysDictData data : reasonDictDataList) {
|
|
|
+ list.add(data.getDictValue());
|
|
|
+ }
|
|
|
+ return R.ok(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PreAuthorize("@customerAuth.isCustomer()")
|
|
|
+ @ApiOperation("客户端用户提交退款")
|
|
|
+ @PostMapping("/submit")
|
|
|
+ public R<?> submitAfterSale(@Validated @RequestBody AfterSalesServiceDTO dto) {
|
|
|
+ this.afterSalesServiceService.submitAfterSale(dto);
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@ApiOperation("根据商户履约状态获取退款描述")
|
|
|
@GetMapping("/desc/list")
|
|
|
public R<List<RegulationConfigVO>> getDescList(Integer execStatus) {
|