diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/number/NumberUtils.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/number/NumberUtils.java
index 822510096..55ab367a3 100644
--- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/number/NumberUtils.java
+++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/number/NumberUtils.java
@@ -13,4 +13,28 @@ public class NumberUtils {
return StrUtil.isNotEmpty(str) ? Long.valueOf(str) : null;
}
+ /**
+ * 通过经纬度获取地球上两点之间的距离
+ *
+ * 参考 <DistanceUtil> 实现,目前它已经被 hutool 删除
+ *
+ * @param lat1 经度1
+ * @param lng1 纬度1
+ * @param lat2 经度2
+ * @param lng2 纬度2
+ * @return 距离,单位:千米
+ */
+ public static double getDistance(double lat1, double lng1, double lat2, double lng2) {
+ double radLat1 = lat1 * Math.PI / 180.0;
+ double radLat2 = lat2 * Math.PI / 180.0;
+ double a = radLat1 - radLat2;
+ double b = lng1 * Math.PI / 180.0 - lng2 * Math.PI / 180.0;
+ double distance = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2)
+ + Math.cos(radLat1) * Math.cos(radLat2)
+ * Math.pow(Math.sin(b / 2), 2)));
+ distance = distance * 6378.137;
+ distance = Math.round(distance * 10000d) / 10000d;
+ return distance;
+ }
+
}
diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/spring/SpringExpressionUtils.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/spring/SpringExpressionUtils.java
index 5e82d5e3b..ae8bcf904 100644
--- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/spring/SpringExpressionUtils.java
+++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/spring/SpringExpressionUtils.java
@@ -3,7 +3,6 @@ package cn.iocoder.yudao.framework.common.util.spring;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ArrayUtil;
-import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.core.DefaultParameterNameDiscoverer;
@@ -87,47 +86,4 @@ public class SpringExpressionUtils {
return result;
}
- /**
- * JoinPoint 切面 批量解析 EL 表达式,转换 jspl参数
- *
- * @param joinPoint 切面点
- * @param info 返回值
- * @param expressionStrings EL 表达式数组
- * @return Map 结果
- * @author 陈賝
- * @since 2023/6/18 11:20
- */
- // TODO @chenchen: 这个方法,和 parseExpressions 比较接近,是不是可以合并下;
- public static Map parseExpression(JoinPoint joinPoint, Object info, List expressionStrings) {
- // 如果为空,则不进行解析
- if (CollUtil.isEmpty(expressionStrings)) {
- return MapUtil.newHashMap();
- }
-
- // 第一步,构建解析的上下文 EvaluationContext
- // 通过 joinPoint 获取被注解方法
- MethodSignature signature = (MethodSignature) joinPoint.getSignature();
- Method method = signature.getMethod();
- // 使用 spring 的 ParameterNameDiscoverer 获取方法形参名数组
- String[] parameterNames = PARAMETER_NAME_DISCOVERER.getParameterNames(method);
- // Spring 的表达式上下文对象
- EvaluationContext context = new StandardEvaluationContext();
- if (ArrayUtil.isNotEmpty(parameterNames)) {
- //获取方法参数值
- Object[] args = joinPoint.getArgs();
- for (int i = 0; i < args.length; i++) {
- // 替换 SP EL 里的变量值为实际值, 比如 #user --> user对象
- context.setVariable(parameterNames[i], args[i]);
- }
- context.setVariable("info", info);
- }
- // 第二步,逐个参数解析
- Map result = MapUtil.newHashMap(expressionStrings.size(), true);
- expressionStrings.forEach(key -> {
- Object value = EXPRESSION_PARSER.parseExpression(key).getValue(context);
- result.put(key, value);
- });
- return result;
- }
-
}
diff --git a/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/aftersale/TradeAfterSaleStatusEnum.java b/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/aftersale/AfterSaleStatusEnum.java
similarity index 93%
rename from yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/aftersale/TradeAfterSaleStatusEnum.java
rename to yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/aftersale/AfterSaleStatusEnum.java
index 3a8f3d46a..23c1b2efe 100644
--- a/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/aftersale/TradeAfterSaleStatusEnum.java
+++ b/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/aftersale/AfterSaleStatusEnum.java
@@ -18,7 +18,7 @@ import static cn.hutool.core.util.ArrayUtil.firstMatch;
*/
@AllArgsConstructor
@Getter
-public enum TradeAfterSaleStatusEnum implements IntArrayValuable {
+public enum AfterSaleStatusEnum implements IntArrayValuable {
/**
* 【申请售后】
@@ -54,7 +54,7 @@ public enum TradeAfterSaleStatusEnum implements IntArrayValuable {
SELLER_REFUSE(63,"卖家拒绝收货", "商家拒绝收货"), // 有赞的状态提示:商家拒绝收货,不同意退款
;
- public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(TradeAfterSaleStatusEnum::getStatus).toArray();
+ public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(AfterSaleStatusEnum::getStatus).toArray();
/**
* 进行中的售后状态
@@ -88,7 +88,7 @@ public enum TradeAfterSaleStatusEnum implements IntArrayValuable {
return ARRAYS;
}
- public static TradeAfterSaleStatusEnum valueOf(Integer status) {
+ public static AfterSaleStatusEnum valueOf(Integer status) {
return firstMatch(value -> value.getStatus().equals(status), values());
}
diff --git a/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/aftersale/TradeAfterSaleTypeEnum.java b/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/aftersale/AfterSaleTypeEnum.java
similarity index 85%
rename from yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/aftersale/TradeAfterSaleTypeEnum.java
rename to yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/aftersale/AfterSaleTypeEnum.java
index d5323aac8..dfb32f7be 100644
--- a/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/aftersale/TradeAfterSaleTypeEnum.java
+++ b/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/aftersale/AfterSaleTypeEnum.java
@@ -13,12 +13,12 @@ import java.util.Arrays;
*/
@RequiredArgsConstructor
@Getter
-public enum TradeAfterSaleTypeEnum implements IntArrayValuable {
+public enum AfterSaleTypeEnum implements IntArrayValuable {
IN_SALE(10, "售中退款"), // 交易完成前买家申请退款
AFTER_SALE(20, "售后退款"); // 交易完成后买家申请退款
- public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(TradeAfterSaleTypeEnum::getType).toArray();
+ public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(AfterSaleTypeEnum::getType).toArray();
/**
* 类型
diff --git a/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/aftersale/TradeAfterSaleWayEnum.java b/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/aftersale/AfterSaleWayEnum.java
similarity index 84%
rename from yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/aftersale/TradeAfterSaleWayEnum.java
rename to yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/aftersale/AfterSaleWayEnum.java
index 1bbb35327..1d608a102 100644
--- a/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/aftersale/TradeAfterSaleWayEnum.java
+++ b/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/aftersale/AfterSaleWayEnum.java
@@ -13,12 +13,12 @@ import java.util.Arrays;
*/
@RequiredArgsConstructor
@Getter
-public enum TradeAfterSaleWayEnum implements IntArrayValuable {
+public enum AfterSaleWayEnum implements IntArrayValuable {
REFUND(10, "仅退款"),
RETURN_AND_REFUND(20, "退货退款");
- public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(TradeAfterSaleWayEnum::getWay).toArray();
+ public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(AfterSaleWayEnum::getWay).toArray();
/**
* 方式
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/TradeAfterSaleController.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/AfterSaleController.java
similarity index 69%
rename from yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/TradeAfterSaleController.java
rename to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/AfterSaleController.java
index 3b438568b..bfe9b2fc6 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/TradeAfterSaleController.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/AfterSaleController.java
@@ -8,13 +8,13 @@ import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
import cn.iocoder.yudao.module.pay.api.notify.dto.PayRefundNotifyReqDTO;
import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.*;
-import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.log.TradeAfterSaleLogRespVO;
-import cn.iocoder.yudao.module.trade.convert.aftersale.TradeAfterSaleConvert;
-import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleDO;
+import cn.iocoder.yudao.module.trade.convert.aftersale.AfterSaleConvert;
+import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.AfterSaleDO;
+import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.AfterSaleLogDO;
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
-import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.service.AfterSaleLogService;
-import cn.iocoder.yudao.module.trade.service.aftersale.TradeAfterSaleService;
+import cn.iocoder.yudao.module.trade.service.aftersale.AfterSaleLogService;
+import cn.iocoder.yudao.module.trade.service.aftersale.AfterSaleService;
import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@@ -27,8 +27,6 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.annotation.security.PermitAll;
import javax.validation.Valid;
-import java.time.LocalDateTime;
-import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -42,10 +40,10 @@ import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUti
@RequestMapping("/trade/after-sale")
@Validated
@Slf4j
-public class TradeAfterSaleController {
+public class AfterSaleController {
@Resource
- private TradeAfterSaleService afterSaleService;
+ private AfterSaleService afterSaleService;
@Resource
private TradeOrderQueryService tradeOrderQueryService;
@Resource
@@ -56,26 +54,26 @@ public class TradeAfterSaleController {
@GetMapping("/page")
@Operation(summary = "获得售后订单分页")
@PreAuthorize("@ss.hasPermission('trade:after-sale:query')")
- public CommonResult> getAfterSalePage(@Valid TradeAfterSalePageReqVO pageVO) {
+ public CommonResult> getAfterSalePage(@Valid AfterSalePageReqVO pageVO) {
// 查询售后
- PageResult pageResult = afterSaleService.getAfterSalePage(pageVO);
+ PageResult pageResult = afterSaleService.getAfterSalePage(pageVO);
if (CollUtil.isEmpty(pageResult.getList())) {
return success(PageResult.empty());
}
// 查询会员
Map memberUsers = memberUserApi.getUserMap(
- convertSet(pageResult.getList(), TradeAfterSaleDO::getUserId));
- return success(TradeAfterSaleConvert.INSTANCE.convertPage(pageResult, memberUsers));
+ convertSet(pageResult.getList(), AfterSaleDO::getUserId));
+ return success(AfterSaleConvert.INSTANCE.convertPage(pageResult, memberUsers));
}
@GetMapping("/get-detail")
@Operation(summary = "获得售后订单详情")
@Parameter(name = "id", description = "售后编号", required = true, example = "1")
@PreAuthorize("@ss.hasPermission('trade:after-sale:query')")
- public CommonResult getOrderDetail(@RequestParam("id") Long id) {
+ public CommonResult getOrderDetail(@RequestParam("id") Long id) {
// 查询订单
- TradeAfterSaleDO afterSale = afterSaleService.getAfterSale(id);
+ AfterSaleDO afterSale = afterSaleService.getAfterSale(id);
if (afterSale == null) {
return success(null);
}
@@ -83,34 +81,11 @@ public class TradeAfterSaleController {
// 查询订单
TradeOrderDO order = tradeOrderQueryService.getOrder(afterSale.getOrderId());
// 查询订单项
- List orderItems = tradeOrderQueryService.getOrderItemListByOrderId(id);
+ TradeOrderItemDO orderItem = tradeOrderQueryService.getOrderItem(afterSale.getOrderItemId());
// 拼接数据
MemberUserRespDTO user = memberUserApi.getUser(afterSale.getUserId());
- // 获取售后日志
- List logs = afterSaleLogService.getLog(afterSale.getId());
- // TODO 方便测试看效果,review 后移除
- if (logs == null) {
- logs = new ArrayList<>();
- }
- for (int i = 1; i <= 6; i++) {
- TradeAfterSaleLogRespVO respVO = new TradeAfterSaleLogRespVO();
- respVO.setId((long) i);
- respVO.setUserId((long) i);
- respVO.setUserType(i % 2 == 0 ? 2 : 1);
- // 模拟系统操作
- if (i == 2) {
- respVO.setUserType(3);
- }
- respVO.setAfterSaleId(id);
- respVO.setOrderId((long) i);
- respVO.setOrderItemId((long) i);
- respVO.setBeforeStatus((i - 1) * 10);
- respVO.setAfterStatus(i * 10);
- respVO.setContent("66+6");
- respVO.setCreateTime(LocalDateTime.now());
- logs.add(respVO);
- }
- return success(TradeAfterSaleConvert.INSTANCE.convert(afterSale, order, orderItems, user, logs));
+ List logs = afterSaleLogService.getAfterSaleLogList(afterSale.getId());
+ return success(AfterSaleConvert.INSTANCE.convert(afterSale, order, orderItem, user, logs));
}
@PutMapping("/agree")
@@ -125,7 +100,7 @@ public class TradeAfterSaleController {
@PutMapping("/disagree")
@Operation(summary = "拒绝售后")
@PreAuthorize("@ss.hasPermission('trade:after-sale:disagree')")
- public CommonResult disagreeAfterSale(@RequestBody TradeAfterSaleDisagreeReqVO confirmReqVO) {
+ public CommonResult disagreeAfterSale(@RequestBody AfterSaleDisagreeReqVO confirmReqVO) {
afterSaleService.disagreeAfterSale(getLoginUserId(), confirmReqVO);
return success(true);
}
@@ -143,7 +118,7 @@ public class TradeAfterSaleController {
@Operation(summary = "拒绝收货")
@Parameter(name = "id", description = "售后编号", required = true, example = "1")
@PreAuthorize("@ss.hasPermission('trade:after-sale:receive')")
- public CommonResult refuseAfterSale(TradeAfterSaleRefuseReqVO refuseReqVO) {
+ public CommonResult refuseAfterSale(AfterSaleRefuseReqVO refuseReqVO) {
afterSaleService.refuseAfterSale(getLoginUserId(), refuseReqVO);
return success(true);
}
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/TradeAfterSaleBaseVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/AfterSaleBaseVO.java
similarity index 98%
rename from yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/TradeAfterSaleBaseVO.java
rename to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/AfterSaleBaseVO.java
index 456fa1810..ae7bd395c 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/TradeAfterSaleBaseVO.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/AfterSaleBaseVO.java
@@ -15,7 +15,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
*/
@Data
-public class TradeAfterSaleBaseVO {
+public class AfterSaleBaseVO {
@Schema(description = "售后流水号", requiredMode = Schema.RequiredMode.REQUIRED, example = "202211190847450020500077")
@NotNull(message = "售后流水号不能为空")
@@ -53,7 +53,7 @@ public class TradeAfterSaleBaseVO {
@Schema(description = "订单流水号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2022111917190001")
@NotNull(message = "订单流水号不能为空")
- private Long orderNo;
+ private String orderNo;
@Schema(description = "订单项编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "572")
@NotNull(message = "订单项编号不能为空")
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/TradeAfterSaleDetailRespVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/AfterSaleDetailRespVO.java
similarity index 83%
rename from yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/TradeAfterSaleDetailRespVO.java
rename to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/AfterSaleDetailRespVO.java
index af6db85c7..3f220770b 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/TradeAfterSaleDetailRespVO.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/AfterSaleDetailRespVO.java
@@ -1,6 +1,6 @@
package cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo;
-import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.log.TradeAfterSaleLogRespVO;
+import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.log.AfterSaleLogRespVO;
import cn.iocoder.yudao.module.trade.controller.admin.base.member.user.MemberUserRespVO;
import cn.iocoder.yudao.module.trade.controller.admin.base.product.property.ProductPropertyValueDetailRespVO;
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderBaseVO;
@@ -12,20 +12,21 @@ import java.util.List;
@Schema(description = "管理后台 - 售后订单的详情 Response VO")
@Data
-public class TradeAfterSaleDetailRespVO extends TradeAfterSaleBaseVO {
+public class AfterSaleDetailRespVO extends AfterSaleBaseVO {
@Schema(description = "售后编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long id;
- /**
- * 订单项列表
- */
- private List- items;
+
/**
* 订单基本信息
*/
private TradeOrderBaseVO order;
+ /**
+ * 订单项列表
+ */
+ private OrderItem orderItem;
/**
* 用户信息
@@ -35,11 +36,11 @@ public class TradeAfterSaleDetailRespVO extends TradeAfterSaleBaseVO {
/**
* 售后日志
*/
- private List logs;
+ private List logs;
@Schema(description = "管理后台 - 交易订单的详情的订单项目")
@Data
- public static class Item extends TradeOrderItemBaseVO {
+ public static class OrderItem extends TradeOrderItemBaseVO {
/**
* 属性数组
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/TradeAfterSaleDisagreeReqVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/AfterSaleDisagreeReqVO.java
similarity index 94%
rename from yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/TradeAfterSaleDisagreeReqVO.java
rename to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/AfterSaleDisagreeReqVO.java
index 906728afd..6fa511acd 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/TradeAfterSaleDisagreeReqVO.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/AfterSaleDisagreeReqVO.java
@@ -8,7 +8,7 @@ import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - 交易售后拒绝 Request VO")
@Data
-public class TradeAfterSaleDisagreeReqVO {
+public class AfterSaleDisagreeReqVO {
@Schema(description = "售后编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
@NotNull(message = "售后编号不能为空")
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/TradeAfterSalePageReqVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/AfterSalePageReqVO.java
similarity index 70%
rename from yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/TradeAfterSalePageReqVO.java
rename to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/AfterSalePageReqVO.java
index 4c9431b5b..f74c84b8f 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/TradeAfterSalePageReqVO.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/AfterSalePageReqVO.java
@@ -2,9 +2,9 @@ package cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.validation.InEnum;
-import cn.iocoder.yudao.module.trade.enums.aftersale.TradeAfterSaleStatusEnum;
-import cn.iocoder.yudao.module.trade.enums.aftersale.TradeAfterSaleTypeEnum;
-import cn.iocoder.yudao.module.trade.enums.aftersale.TradeAfterSaleWayEnum;
+import cn.iocoder.yudao.module.trade.enums.aftersale.AfterSaleStatusEnum;
+import cn.iocoder.yudao.module.trade.enums.aftersale.AfterSaleTypeEnum;
+import cn.iocoder.yudao.module.trade.enums.aftersale.AfterSaleWayEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -19,21 +19,21 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
-public class TradeAfterSalePageReqVO extends PageParam {
+public class AfterSalePageReqVO extends PageParam {
@Schema(description = "售后流水号", example = "202211190847450020500077")
private String no;
@Schema(description = "售后状态", example = "10")
- @InEnum(value = TradeAfterSaleStatusEnum.class, message = "售后状态必须是 {value}")
+ @InEnum(value = AfterSaleStatusEnum.class, message = "售后状态必须是 {value}")
private Integer status;
@Schema(description = "售后类型", example = "20")
- @InEnum(value = TradeAfterSaleTypeEnum.class, message = "售后类型必须是 {value}")
+ @InEnum(value = AfterSaleTypeEnum.class, message = "售后类型必须是 {value}")
private Integer type;
@Schema(description = "售后方式", example = "10")
- @InEnum(value = TradeAfterSaleWayEnum.class, message = "售后方式必须是 {value}")
+ @InEnum(value = AfterSaleWayEnum.class, message = "售后方式必须是 {value}")
private Integer way;
@Schema(description = "订单编号", example = "18078")
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/TradeAfterSaleRefuseReqVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/AfterSaleRefuseReqVO.java
similarity index 93%
rename from yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/TradeAfterSaleRefuseReqVO.java
rename to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/AfterSaleRefuseReqVO.java
index e82610060..6dfced4d8 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/TradeAfterSaleRefuseReqVO.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/AfterSaleRefuseReqVO.java
@@ -7,7 +7,7 @@ import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - 交易售后拒绝收货 Request VO")
@Data
-public class TradeAfterSaleRefuseReqVO {
+public class AfterSaleRefuseReqVO {
@Schema(description = "售后编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
@NotNull(message = "售后编号不能为空")
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/TradeAfterSaleRespPageItemVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/AfterSaleRespPageItemVO.java
similarity index 93%
rename from yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/TradeAfterSaleRespPageItemVO.java
rename to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/AfterSaleRespPageItemVO.java
index b5af865cc..3e76405e9 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/TradeAfterSaleRespPageItemVO.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/AfterSaleRespPageItemVO.java
@@ -14,7 +14,7 @@ import java.util.List;
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
-public class TradeAfterSaleRespPageItemVO extends TradeAfterSaleBaseVO {
+public class AfterSaleRespPageItemVO extends AfterSaleBaseVO {
@Schema(description = "售后编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "27630")
private Long id;
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/log/TradeAfterSaleLogRespVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/log/AfterSaleLogRespVO.java
similarity index 79%
rename from yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/log/TradeAfterSaleLogRespVO.java
rename to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/log/AfterSaleLogRespVO.java
index d7a1940df..f33dcf373 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/log/TradeAfterSaleLogRespVO.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/aftersale/vo/log/AfterSaleLogRespVO.java
@@ -8,7 +8,7 @@ import java.time.LocalDateTime;
@Schema(description = "管理后台 - 交易售后日志 Response VO")
@Data
-public class TradeAfterSaleLogRespVO {
+public class AfterSaleLogRespVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20669")
private Long id;
@@ -25,14 +25,6 @@ public class TradeAfterSaleLogRespVO {
@NotNull(message = "售后编号不能为空")
private Long afterSaleId;
- @Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "25870")
- @NotNull(message = "订单编号不能为空")
- private Long orderId;
-
- @Schema(description = "订单项编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23154")
- @NotNull(message = "订单项编号不能为空")
- private Long orderItemId;
-
@Schema(description = "售后状态(之前)", example = "2")
private Integer beforeStatus;
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/config/TradeConfigController.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/config/TradeConfigController.java
index e41f98081..5e0558fbf 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/config/TradeConfigController.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/config/TradeConfigController.java
@@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.trade.dal.dataobject.config.TradeConfigDO;
import cn.iocoder.yudao.module.trade.service.config.TradeConfigService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -26,6 +27,9 @@ public class TradeConfigController {
@Resource
private TradeConfigService tradeConfigService;
+ @Value("${yudao.tencent-lbs-key}")
+ private String tencentLbsKey;
+
@PutMapping("/save")
@Operation(summary = "更新交易中心配置")
@PreAuthorize("@ss.hasPermission('trade:config:save')")
@@ -39,7 +43,11 @@ public class TradeConfigController {
@PreAuthorize("@ss.hasPermission('trade:config:query')")
public CommonResult getConfig() {
TradeConfigDO config = tradeConfigService.getTradeConfig();
- return success(TradeConfigConvert.INSTANCE.convert(config));
+ TradeConfigRespVO configVO = TradeConfigConvert.INSTANCE.convert(config);
+ if (configVO != null) {
+ configVO.setTencentLbsKey(tencentLbsKey);
+ }
+ return success(configVO);
}
}
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/config/vo/TradeConfigBaseVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/config/vo/TradeConfigBaseVO.java
index 5531a3ace..1507e2b8f 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/config/vo/TradeConfigBaseVO.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/config/vo/TradeConfigBaseVO.java
@@ -44,6 +44,10 @@ public class TradeConfigBaseVO {
@PositiveOrZero(message = "全场包邮的最小金额不能是负数")
private Integer deliveryExpressFreePrice;
+ @Schema(description = "是否开启自提", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
+ @NotNull(message = "是否开启自提不能为空")
+ private Boolean deliveryPickUpEnabled;
+
// ========== 分销相关 ==========
@Schema(description = "是否启用分佣", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/config/vo/TradeConfigRespVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/config/vo/TradeConfigRespVO.java
index 52aff751f..5ded00ace 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/config/vo/TradeConfigRespVO.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/config/vo/TradeConfigRespVO.java
@@ -14,4 +14,7 @@ public class TradeConfigRespVO extends TradeConfigBaseVO {
@Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long id;
+ @Schema(description = "腾讯地图 KEY", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456")
+ private String tencentLbsKey;
+
}
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/ExpressTemplateChargeBaseVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateChargeBaseVO.java
similarity index 85%
rename from yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/ExpressTemplateChargeBaseVO.java
rename to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateChargeBaseVO.java
index 7fb1111d5..efb15c894 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/ExpressTemplateChargeBaseVO.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateChargeBaseVO.java
@@ -11,7 +11,10 @@ import java.util.List;
* 快递运费模板运费设置 Base VO,提供给添加运费模板使用
*/
@Data
-public class ExpressTemplateChargeBaseVO {
+public class DeliveryExpressTemplateChargeBaseVO {
+
+ @Schema(description = "编号", example = "6592", hidden = true) // 由于想简单一点,复用这个 VO 在更新操作,所以 hidden 为 false
+ private Long id;
@Schema(description = "区域编号列表", requiredMode = Schema.RequiredMode.REQUIRED, example = "[1,120000]")
@NotEmpty(message = "区域编号列表不能为空")
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateCreateReqVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateCreateReqVO.java
index 26173a977..c5eeaebc9 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateCreateReqVO.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateCreateReqVO.java
@@ -6,7 +6,6 @@ import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.validation.Valid;
-import java.util.Collections;
import java.util.List;
@Schema(description = "管理后台 - 快递运费模板创建 Request VO")
@@ -17,10 +16,10 @@ public class DeliveryExpressTemplateCreateReqVO extends DeliveryExpressTemplateB
@Schema(description = "区域运费列表")
@Valid
- private List templateCharge;
+ private List charges;
@Schema(description = "包邮区域列表")
@Valid
- private List templateFree;
+ private List frees;
}
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateDetailRespVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateDetailRespVO.java
index 44cb042f9..272ab59a0 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateDetailRespVO.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateDetailRespVO.java
@@ -17,9 +17,9 @@ public class DeliveryExpressTemplateDetailRespVO extends DeliveryExpressTemplate
private Long id;
@Schema(description = "运费模板运费设置", requiredMode = Schema.RequiredMode.REQUIRED)
- private List templateCharge;
+ private List charges;
@Schema(description = "运费模板包邮区域", requiredMode = Schema.RequiredMode.REQUIRED)
- private List templateFree;
+ private List frees;
}
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/ExpressTemplateFreeBaseVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateFreeBaseVO.java
similarity index 95%
rename from yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/ExpressTemplateFreeBaseVO.java
rename to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateFreeBaseVO.java
index 9334abf07..b3e0f12b5 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/ExpressTemplateFreeBaseVO.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateFreeBaseVO.java
@@ -11,7 +11,7 @@ import java.util.List;
* 快递运费模板包邮 Base VO,提供给添加运费模板使用
*/
@Data
-public class ExpressTemplateFreeBaseVO {
+public class DeliveryExpressTemplateFreeBaseVO {
@Schema(description = "区域编号列表", requiredMode = Schema.RequiredMode.REQUIRED, example = "[1,120000]")
@NotEmpty(message = "区域编号列表不能为空")
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateUpdateReqVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateUpdateReqVO.java
index b8b372271..4c1774524 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateUpdateReqVO.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateUpdateReqVO.java
@@ -21,36 +21,10 @@ public class DeliveryExpressTemplateUpdateReqVO extends DeliveryExpressTemplateB
@Schema(description = "区域运费列表")
@Valid
- private List templateCharge;
+ private List charges;
@Schema(description = "包邮区域列表")
@Valid
- private List templateFree;
+ private List frees;
- @Schema(description = "管理后台 - 快递运费模板区域运费更新 Request VO")
- @Data
- public static class ExpressTemplateChargeUpdateVO extends ExpressTemplateChargeBaseVO {
-
- @Schema(description = "编号", example = "6592")
- private Long id;
-
- // TODO @jason:这几个字段,应该不通过前端传递,而是后端查询后去赋值的
- @Schema(description = "配送模板编号", example = "1")
- private Long templateId;
-
- @Schema(description = "配送计费方式", example = "1")
- private Integer chargeMode;
-
- }
-
- @Schema(description = "管理后台 - 快递运费模板包邮区域更新 Request VO")
- @Data
- public static class ExpressTemplateFreeUpdateVO extends ExpressTemplateFreeBaseVO {
-
- @Schema(description = "编号", example = "6592")
- private Long id;
-
- @Schema(description = "配送模板编号", example = "1")
- private Long templateId;
- }
}
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/AppTradeAfterSaleController.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/AppAfterSaleController.java
similarity index 61%
rename from yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/AppTradeAfterSaleController.java
rename to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/AppAfterSaleController.java
index eaf6a1b62..06eabbb57 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/AppTradeAfterSaleController.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/AppAfterSaleController.java
@@ -3,15 +3,11 @@ package cn.iocoder.yudao.module.trade.controller.app.aftersale;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSaleCreateReqVO;
-import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSaleDeliveryReqVO;
-import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSaleRespVO;
-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.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;
+import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppAfterSaleCreateReqVO;
+import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppAfterSaleDeliveryReqVO;
+import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppAfterSaleRespVO;
+import cn.iocoder.yudao.module.trade.convert.aftersale.AfterSaleConvert;
+import cn.iocoder.yudao.module.trade.service.aftersale.AfterSaleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -29,23 +25,23 @@ import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUti
@RequestMapping("/trade/after-sale")
@Validated
@Slf4j
-public class AppTradeAfterSaleController {
+public class AppAfterSaleController {
@Resource
- private TradeAfterSaleService afterSaleService;
+ private AfterSaleService afterSaleService;
@GetMapping(value = "/page")
@Operation(summary = "获得售后分页")
- public CommonResult> getAfterSalePage(PageParam pageParam) {
- return success(TradeAfterSaleConvert.INSTANCE.convertPage02(
+ public CommonResult> getAfterSalePage(PageParam pageParam) {
+ return success(AfterSaleConvert.INSTANCE.convertPage02(
afterSaleService.getAfterSalePage(getLoginUserId(), pageParam)));
}
@GetMapping(value = "/get")
@Operation(summary = "获得售后订单")
@Parameter(name = "id", description = "售后编号", required = true, example = "1")
- public CommonResult getAfterSale(@RequestParam("id") Long id) {
- return success(TradeAfterSaleConvert.INSTANCE.convert(afterSaleService.getAfterSale(getLoginUserId(), id)));
+ public CommonResult getAfterSale(@RequestParam("id") Long id) {
+ return success(AfterSaleConvert.INSTANCE.convert(afterSaleService.getAfterSale(getLoginUserId(), id)));
}
@GetMapping(value = "/get-applying-count")
@@ -56,16 +52,13 @@ public class AppTradeAfterSaleController {
@PostMapping(value = "/create")
@Operation(summary = "申请售后")
- @AfterSaleLog(id = "#info.data", content = "'申请售后:售后编号['+#info.data+'],订单编号['+#createReqVO.orderItemId+'], '", operateType = AfterSaleOperateTypeEnum.MEMBER_CREATE)
- public CommonResult createAfterSale(@RequestBody AppTradeAfterSaleCreateReqVO createReqVO) {
- AfterSaleLogUtils.setBeforeStatus(0);
- AfterSaleLogUtils.setAfterStatus(TradeAfterSaleStatusEnum.APPLY.getStatus());
+ public CommonResult createAfterSale(@RequestBody AppAfterSaleCreateReqVO createReqVO) {
return success(afterSaleService.createAfterSale(getLoginUserId(), createReqVO));
}
@PutMapping(value = "/delivery")
@Operation(summary = "退回货物")
- public CommonResult deliveryAfterSale(@RequestBody AppTradeAfterSaleDeliveryReqVO deliveryReqVO) {
+ public CommonResult deliveryAfterSale(@RequestBody AppAfterSaleDeliveryReqVO deliveryReqVO) {
afterSaleService.deliveryAfterSale(getLoginUserId(), deliveryReqVO);
return success(true);
}
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/vo/AppTradeAfterSaleCreateReqVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/vo/AppAfterSaleCreateReqVO.java
similarity index 87%
rename from yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/vo/AppTradeAfterSaleCreateReqVO.java
rename to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/vo/AppAfterSaleCreateReqVO.java
index 3bf8dd944..253db62a2 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/vo/AppTradeAfterSaleCreateReqVO.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/vo/AppAfterSaleCreateReqVO.java
@@ -1,7 +1,7 @@
package cn.iocoder.yudao.module.trade.controller.app.aftersale.vo;
import cn.iocoder.yudao.framework.common.validation.InEnum;
-import cn.iocoder.yudao.module.trade.enums.aftersale.TradeAfterSaleWayEnum;
+import cn.iocoder.yudao.module.trade.enums.aftersale.AfterSaleWayEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -11,7 +11,7 @@ import java.util.List;
@Schema(description = "用户 App - 交易售后创建 Request VO")
@Data
-public class AppTradeAfterSaleCreateReqVO {
+public class AppAfterSaleCreateReqVO {
@Schema(description = "订单项编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
@NotNull(message = "订单项编号不能为空")
@@ -19,7 +19,7 @@ public class AppTradeAfterSaleCreateReqVO {
@Schema(description = "售后方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "售后方式不能为空")
- @InEnum(value = TradeAfterSaleWayEnum.class, message = "售后方式必须是 {value}")
+ @InEnum(value = AfterSaleWayEnum.class, message = "售后方式必须是 {value}")
private Integer way;
@Schema(description = "退款金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/vo/AppTradeAfterSaleDeliveryReqVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/vo/AppAfterSaleDeliveryReqVO.java
similarity index 94%
rename from yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/vo/AppTradeAfterSaleDeliveryReqVO.java
rename to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/vo/AppAfterSaleDeliveryReqVO.java
index dc5180c67..83b88d133 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/vo/AppTradeAfterSaleDeliveryReqVO.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/vo/AppAfterSaleDeliveryReqVO.java
@@ -7,7 +7,7 @@ import javax.validation.constraints.NotNull;
@Schema(description = "用户 App - 交易售后退回货物 Request VO")
@Data
-public class AppTradeAfterSaleDeliveryReqVO {
+public class AppAfterSaleDeliveryReqVO {
@Schema(description = "售后编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
@NotNull(message = "售后编号不能为空")
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/vo/AppTradeAfterSaleRespVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/vo/AppAfterSaleRespVO.java
similarity index 98%
rename from yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/vo/AppTradeAfterSaleRespVO.java
rename to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/vo/AppAfterSaleRespVO.java
index 90ccb4d34..55ae73a03 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/vo/AppTradeAfterSaleRespVO.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/aftersale/vo/AppAfterSaleRespVO.java
@@ -9,7 +9,7 @@ import java.util.List;
@Schema(description = "用户 App - 交易售后 Response VO")
@Data
-public class AppTradeAfterSaleRespVO {
+public class AppAfterSaleRespVO {
@Schema(description = "售后编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long id;
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/config/AppTradeConfigController.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/config/AppTradeConfigController.java
index 6b7660a1c..5046c6512 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/config/AppTradeConfigController.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/config/AppTradeConfigController.java
@@ -10,6 +10,7 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -30,11 +31,14 @@ public class AppTradeConfigController {
@Resource
private TradeConfigService tradeConfigService;
+ @Value("${yudao.tencent-lbs-key}")
+ private String tencentLbsKey;
+
@GetMapping("/get")
@Operation(summary = "获得交易配置")
public CommonResult getTradeConfig() {
- TradeConfigDO tradeConfig = ObjUtil.defaultIfNull(tradeConfigService.getTradeConfig(), new TradeConfigDO());
- return success(TradeConfigConvert.INSTANCE.convert02(tradeConfig));
+ TradeConfigDO config = ObjUtil.defaultIfNull(tradeConfigService.getTradeConfig(), new TradeConfigDO());
+ return success(TradeConfigConvert.INSTANCE.convert02(config).setTencentLbsKey(tencentLbsKey));
}
}
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/config/vo/AppTradeConfigRespVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/config/vo/AppTradeConfigRespVO.java
index a9515f609..c80472c8b 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/config/vo/AppTradeConfigRespVO.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/config/vo/AppTradeConfigRespVO.java
@@ -3,12 +3,22 @@ package cn.iocoder.yudao.module.trade.controller.app.config.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
+import javax.validation.constraints.NotNull;
import java.util.List;
@Schema(description = "用户 App - 交易配置 Response VO")
@Data
public class AppTradeConfigRespVO {
+ @Schema(description = "腾讯地图 KEY", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456")
+ private String tencentLbsKey;
+
+ // ========== 配送相关 ==========
+
+ @Schema(description = "是否开启自提", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
+ @NotNull(message = "是否开启自提不能为空")
+ private Boolean deliveryPickUpEnabled;
+
// ========== 售后相关 ==========
@Schema(description = "售后的退款理由", requiredMode = Schema.RequiredMode.REQUIRED)
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/AppDeliverPickUpStoreController.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/AppDeliverPickUpStoreController.java
index 3b49fb6ae..fcc4993f1 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/AppDeliverPickUpStoreController.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/AppDeliverPickUpStoreController.java
@@ -1,10 +1,14 @@
package cn.iocoder.yudao.module.trade.controller.app.delivery;
-import cn.hutool.core.util.RandomUtil;
+import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.trade.controller.app.delivery.vo.pickup.AppDeliveryPickUpStoreRespVO;
+import cn.iocoder.yudao.module.trade.convert.delivery.DeliveryPickUpStoreConvert;
+import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
+import cn.iocoder.yudao.module.trade.service.delivery.DeliveryPickUpStoreService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
@@ -12,9 +16,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
-import java.util.ArrayList;
+import javax.annotation.Resource;
import java.util.List;
-import java.util.Random;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@@ -24,51 +27,29 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Validated
public class AppDeliverPickUpStoreController {
- // TODO 待实现[门店自提]:如果 latitude、longitude 非空,计算经纬度,并排序。计算的库,可以使用 hutool 的 DistanceUtil 计算。
+ @Resource
+ private DeliveryPickUpStoreService deliveryPickUpStoreService;
+
@GetMapping("/list")
@Operation(summary = "获得自提门店列表")
+ @Parameters({
+ @Parameter(name = "latitude", description = "精度", example = "110"),
+ @Parameter(name = "longitude", description = "纬度", example = "120")
+ })
public CommonResult
> getDeliveryPickUpStoreList(
@RequestParam(value = "latitude", required = false) Double latitude,
@RequestParam(value = "longitude", required = false) Double longitude) {
- List list = new ArrayList<>();
- Random random = new Random();
- for (int i = 0; i < 10; i++) {
- AppDeliveryPickUpStoreRespVO store = new AppDeliveryPickUpStoreRespVO();
- store.setId(random.nextLong());
- store.setName(RandomUtil.randomString(10));
- store.setLogo("https://www.iocoder.cn/" + (i + 1) + ".png");
- store.setPhone("15601691300");
- store.setAreaId(random.nextInt(100000));
- store.setAreaName("上海-" + RandomUtil.randomString(10));
- store.setDetailAddress("普陀区-" + RandomUtil.randomString(10));
- store.setLatitude(random.nextDouble() * 10);
- store.setLongitude(random.nextDouble() * 10);
- store.setDistance(random.nextInt(1000));
-
- list.add(store);
- }
-
- return success(list);
+ List list = deliveryPickUpStoreService.getDeliveryPickUpStoreListByStatus(
+ CommonStatusEnum.ENABLE.getStatus());
+ return success(DeliveryPickUpStoreConvert.INSTANCE.convertList(list, latitude, longitude));
}
- // TODO 待实现[门店自提]:
@GetMapping("/get")
@Operation(summary = "获得自提门店")
@Parameter(name = "id", description = "门店编号")
public CommonResult getOrder(@RequestParam("id") Long id) {
- AppDeliveryPickUpStoreRespVO store = new AppDeliveryPickUpStoreRespVO();
- Random random = new Random();
- store.setId(random.nextLong());
- store.setName(RandomUtil.randomString(10));
- store.setLogo("https://www.iocoder.cn/" + (1) + ".png");
- store.setPhone("15601691300");
- store.setAreaId(random.nextInt(100000));
- store.setAreaName("上海-" + RandomUtil.randomString(10));
- store.setDetailAddress("普陀区-" + RandomUtil.randomString(10));
- store.setLatitude(random.nextDouble() * 10);
- store.setLongitude(random.nextDouble() * 10);
- store.setDistance(random.nextInt(1000));
- return success(store);
+ DeliveryPickUpStoreDO store = deliveryPickUpStoreService.getDeliveryPickUpStore(id);
+ return success(DeliveryPickUpStoreConvert.INSTANCE.convert03(store));
}
}
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/vo/pickup/AppDeliveryPickUpStoreRespVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/vo/pickup/AppDeliveryPickUpStoreRespVO.java
index 6ceb200ad..1ca25ade5 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/vo/pickup/AppDeliveryPickUpStoreRespVO.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/vo/pickup/AppDeliveryPickUpStoreRespVO.java
@@ -34,7 +34,7 @@ public class AppDeliveryPickUpStoreRespVO {
@Schema(description = "经度", requiredMode = Schema.RequiredMode.REQUIRED, example = "6.99")
private Double longitude;
- @Schema(description = "距离,单位:米", example = "100") // 只有在用户传递了经纬度时,才进行计算
- private Integer distance;
+ @Schema(description = "距离,单位:千米", example = "100") // 只有在用户传递了经纬度时,才进行计算
+ private Double distance;
}
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/aftersale/TradeAfterSaleConvert.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/aftersale/AfterSaleConvert.java
similarity index 58%
rename from yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/aftersale/TradeAfterSaleConvert.java
rename to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/aftersale/AfterSaleConvert.java
index 9faaefb5d..fd759c625 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/aftersale/TradeAfterSaleConvert.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/aftersale/AfterSaleConvert.java
@@ -4,16 +4,16 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO;
import cn.iocoder.yudao.module.product.api.property.dto.ProductPropertyValueDetailRespDTO;
-import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleDetailRespVO;
-import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSaleRespPageItemVO;
-import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.log.TradeAfterSaleLogRespVO;
+import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.AfterSaleDetailRespVO;
+import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.AfterSaleRespPageItemVO;
+import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.log.AfterSaleLogRespVO;
import cn.iocoder.yudao.module.trade.controller.admin.base.member.user.MemberUserRespVO;
import cn.iocoder.yudao.module.trade.controller.admin.base.product.property.ProductPropertyValueDetailRespVO;
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderBaseVO;
-import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSaleCreateReqVO;
-import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSaleRespVO;
-import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleDO;
-import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleLogDO;
+import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppAfterSaleCreateReqVO;
+import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppAfterSaleRespVO;
+import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.AfterSaleDO;
+import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.AfterSaleLogDO;
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties;
@@ -26,9 +26,9 @@ import java.util.List;
import java.util.Map;
@Mapper
-public interface TradeAfterSaleConvert {
+public interface AfterSaleConvert {
- TradeAfterSaleConvert INSTANCE = Mappers.getMapper(TradeAfterSaleConvert.class);
+ AfterSaleConvert INSTANCE = Mappers.getMapper(AfterSaleConvert.class);
@Mappings({
@Mapping(target = "id", ignore = true),
@@ -37,7 +37,7 @@ public interface TradeAfterSaleConvert {
@Mapping(target = "creator", ignore = true),
@Mapping(target = "updater", ignore = true),
})
- TradeAfterSaleDO convert(AppTradeAfterSaleCreateReqVO createReqVO, TradeOrderItemDO tradeOrderItem);
+ AfterSaleDO convert(AppAfterSaleCreateReqVO createReqVO, TradeOrderItemDO tradeOrderItem);
@Mappings({
@Mapping(source = "afterSale.orderId", target = "merchantOrderId"),
@@ -45,16 +45,16 @@ public interface TradeAfterSaleConvert {
@Mapping(source = "afterSale.applyReason", target = "reason"),
@Mapping(source = "afterSale.refundPrice", target = "price")
})
- PayRefundCreateReqDTO convert(String userIp, TradeAfterSaleDO afterSale,
+ PayRefundCreateReqDTO convert(String userIp, AfterSaleDO afterSale,
TradeOrderProperties orderProperties);
MemberUserRespVO convert(MemberUserRespDTO bean);
- PageResult convertPage(PageResult page);
+ PageResult convertPage(PageResult page);
- default PageResult convertPage(PageResult pageResult,
- Map memberUsers) {
- PageResult voPageResult = convertPage(pageResult);
+ default PageResult convertPage(PageResult pageResult,
+ Map memberUsers) {
+ PageResult voPageResult = convertPage(pageResult);
// 处理会员
voPageResult.getList().forEach(afterSale -> afterSale.setUser(
convert(memberUsers.get(afterSale.getUserId()))));
@@ -63,27 +63,26 @@ public interface TradeAfterSaleConvert {
ProductPropertyValueDetailRespVO convert(ProductPropertyValueDetailRespDTO bean);
- AppTradeAfterSaleRespVO convert(TradeAfterSaleDO bean);
+ AppAfterSaleRespVO convert(AfterSaleDO bean);
- PageResult convertPage02(PageResult page);
+ PageResult convertPage02(PageResult page);
- List convertList(List list);
-
- default TradeAfterSaleDetailRespVO convert(TradeAfterSaleDO afterSale, TradeOrderDO order, List orderItems,
- MemberUserRespDTO user, List logs) {
- TradeAfterSaleDetailRespVO respVO = convert(afterSale, orderItems);
+ default AfterSaleDetailRespVO convert(AfterSaleDO afterSale, TradeOrderDO order, TradeOrderItemDO orderItem,
+ MemberUserRespDTO user, List logs) {
+ AfterSaleDetailRespVO respVO = convert02(afterSale);
// 处理用户信息
respVO.setUser(convert(user));
// 处理订单信息
respVO.setOrder(convert(order));
+ respVO.setOrderItem(convert02(orderItem));
// 处理售后日志
respVO.setLogs(convertList1(logs));
return respVO;
}
- List convertList1(List list);
- @Mapping(target = "id", source = "afterSale.id")
- TradeAfterSaleDetailRespVO convert(TradeAfterSaleDO afterSale, List orderItems);
- TradeOrderBaseVO convert(TradeOrderDO order);
+ List convertList1(List list);
+ AfterSaleDetailRespVO convert02(AfterSaleDO bean);
+ AfterSaleDetailRespVO.OrderItem convert02(TradeOrderItemDO bean);
+ TradeOrderBaseVO convert(TradeOrderDO bean);
}
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/aftersale/AfterSaleLogConvert.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/aftersale/AfterSaleLogConvert.java
new file mode 100644
index 000000000..e8960c4ac
--- /dev/null
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/aftersale/AfterSaleLogConvert.java
@@ -0,0 +1,15 @@
+package cn.iocoder.yudao.module.trade.convert.aftersale;
+
+import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.AfterSaleLogDO;
+import cn.iocoder.yudao.module.trade.service.aftersale.bo.AfterSaleLogCreateReqBO;
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+@Mapper
+public interface AfterSaleLogConvert {
+
+ AfterSaleLogConvert INSTANCE = Mappers.getMapper(AfterSaleLogConvert.class);
+
+ AfterSaleLogDO convert(AfterSaleLogCreateReqBO bean);
+
+}
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/delivery/DeliveryExpressTemplateConvert.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/delivery/DeliveryExpressTemplateConvert.java
index 665dc787d..b917d874b 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/delivery/DeliveryExpressTemplateConvert.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/delivery/DeliveryExpressTemplateConvert.java
@@ -42,36 +42,32 @@ public interface DeliveryExpressTemplateConvert {
List chargeList,
List freeList) {
DeliveryExpressTemplateDetailRespVO respVO = convert2(bean);
- respVO.setTemplateCharge(convertTemplateChargeList(chargeList));
- respVO.setTemplateFree(convertTemplateFreeList(freeList));
+ respVO.setCharges(convertTemplateChargeList(chargeList));
+ respVO.setFrees(convertTemplateFreeList(freeList));
return respVO;
}
// ========== Template Charge ==========
- DeliveryExpressTemplateChargeDO convertTemplateCharge(Long templateId, Integer chargeMode, ExpressTemplateChargeBaseVO vo);
-
- DeliveryExpressTemplateChargeDO convertTemplateCharge(DeliveryExpressTemplateUpdateReqVO.ExpressTemplateChargeUpdateVO vo);
+ DeliveryExpressTemplateChargeDO convertTemplateCharge(Long templateId, Integer chargeMode, DeliveryExpressTemplateChargeBaseVO vo);
DeliveryExpressTemplateRespBO.Charge convertTemplateCharge(DeliveryExpressTemplateChargeDO bean);
- default List convertTemplateChargeList(Long templateId, Integer chargeMode, List list) {
+ default List convertTemplateChargeList(Long templateId, Integer chargeMode, List list) {
return CollectionUtils.convertList(list, vo -> convertTemplateCharge(templateId, chargeMode, vo));
}
// ========== Template Free ==========
- DeliveryExpressTemplateFreeDO convertTemplateFree(Long templateId, ExpressTemplateFreeBaseVO vo);
-
- DeliveryExpressTemplateFreeDO convertTemplateFree(DeliveryExpressTemplateUpdateReqVO.ExpressTemplateFreeUpdateVO vo);
+ DeliveryExpressTemplateFreeDO convertTemplateFree(Long templateId, DeliveryExpressTemplateFreeBaseVO vo);
DeliveryExpressTemplateRespBO.Free convertTemplateFree(DeliveryExpressTemplateFreeDO bean);
- List convertTemplateChargeList(List list);
+ List convertTemplateChargeList(List list);
- List convertTemplateFreeList(List list);
+ List convertTemplateFreeList(List list);
- default List convertTemplateFreeList(Long templateId, List list) {
+ default List convertTemplateFreeList(Long templateId, List list) {
return CollectionUtils.convertList(list, vo -> convertTemplateFree(templateId, vo));
}
@@ -93,4 +89,5 @@ public interface DeliveryExpressTemplateConvert {
});
return result;
}
+
}
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/delivery/DeliveryPickUpStoreConvert.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/delivery/DeliveryPickUpStoreConvert.java
index 6522f3281..1d5b360a5 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/delivery/DeliveryPickUpStoreConvert.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/delivery/DeliveryPickUpStoreConvert.java
@@ -1,11 +1,14 @@
package cn.iocoder.yudao.module.trade.convert.delivery;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
+import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreCreateReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreRespVO;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreSimpleRespVO;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreUpdateReqVO;
+import cn.iocoder.yudao.module.trade.controller.app.delivery.vo.pickup.AppDeliveryPickUpStoreRespVO;
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
@@ -38,4 +41,18 @@ public interface DeliveryPickUpStoreConvert {
return AreaUtils.format(areaId);
}
+ default List convertList(List list,
+ Double latitude, Double longitude) {
+ List voList = CollectionUtils.convertList(list, store -> {
+ AppDeliveryPickUpStoreRespVO storeVO = convert03(store);
+ if (latitude != null && longitude != null) {
+ storeVO.setDistance(NumberUtils.getDistance(latitude, longitude, storeVO.getLatitude(), storeVO.getLongitude()));
+ }
+ return storeVO;
+ });
+ return voList;
+ }
+ @Mapping(source = "areaId", target = "areaName", qualifiedByName = "convertAreaIdToAreaName")
+ AppDeliveryPickUpStoreRespVO convert03(DeliveryPickUpStoreDO bean);
+
}
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderLogConvert.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderLogConvert.java
index 5ab369270..df76f32ab 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderLogConvert.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderLogConvert.java
@@ -10,6 +10,6 @@ public interface TradeOrderLogConvert {
TradeOrderLogConvert INSTANCE = Mappers.getMapper(TradeOrderLogConvert.class);
- TradeOrderLogDO convert(TradeOrderLogCreateReqBO createReqBO);
+ TradeOrderLogDO convert(TradeOrderLogCreateReqBO bean);
}
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/aftersale/TradeAfterSaleDO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/aftersale/AfterSaleDO.java
similarity index 91%
rename from yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/aftersale/TradeAfterSaleDO.java
rename to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/aftersale/AfterSaleDO.java
index 9916f3e4e..214592b62 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/aftersale/TradeAfterSaleDO.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/aftersale/AfterSaleDO.java
@@ -3,9 +3,9 @@ package cn.iocoder.yudao.module.trade.dal.dataobject.aftersale;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
-import cn.iocoder.yudao.module.trade.enums.aftersale.TradeAfterSaleStatusEnum;
-import cn.iocoder.yudao.module.trade.enums.aftersale.TradeAfterSaleTypeEnum;
-import cn.iocoder.yudao.module.trade.enums.aftersale.TradeAfterSaleWayEnum;
+import cn.iocoder.yudao.module.trade.enums.aftersale.AfterSaleStatusEnum;
+import cn.iocoder.yudao.module.trade.enums.aftersale.AfterSaleTypeEnum;
+import cn.iocoder.yudao.module.trade.enums.aftersale.AfterSaleWayEnum;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
@@ -25,7 +25,7 @@ import java.util.List;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
-public class TradeAfterSaleDO extends BaseDO {
+public class AfterSaleDO extends BaseDO {
/**
* 售后编号,主键自增
@@ -40,19 +40,19 @@ public class TradeAfterSaleDO extends BaseDO {
/**
* 退款状态
*
- * 枚举 {@link TradeAfterSaleStatusEnum}
+ * 枚举 {@link AfterSaleStatusEnum}
*/
private Integer status;
/**
* 售后方式
*
- * 枚举 {@link TradeAfterSaleWayEnum}
+ * 枚举 {@link AfterSaleWayEnum}
*/
private Integer way;
/**
* 售后类型
*
- * 枚举 {@link TradeAfterSaleTypeEnum}
+ * 枚举 {@link AfterSaleTypeEnum}
*/
private Integer type;
/**
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/aftersale/TradeAfterSaleLogDO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/aftersale/AfterSaleLogDO.java
similarity index 79%
rename from yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/aftersale/TradeAfterSaleLogDO.java
rename to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/aftersale/AfterSaleLogDO.java
index 56a0f0f32..2820f23e1 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/aftersale/TradeAfterSaleLogDO.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/aftersale/AfterSaleLogDO.java
@@ -11,8 +11,6 @@ import lombok.*;
/**
* 交易售后日志 DO
*
- * // TODO 可优化:参考淘宝或者有赞:1)增加 action 表示什么操作;2)content 记录每个操作的明细
- *
* @author 芋道源码
*/
@TableName("trade_after_sale_log")
@@ -23,7 +21,7 @@ import lombok.*;
@Builder
@NoArgsConstructor
@AllArgsConstructor
-public class TradeAfterSaleLogDO extends BaseDO {
+public class AfterSaleLogDO extends BaseDO {
/**
* 编号
@@ -43,19 +41,28 @@ public class TradeAfterSaleLogDO extends BaseDO {
* 枚举 {@link UserTypeEnum}
*/
private Integer userType;
+
/**
* 售后编号
*
- * 关联 {@link TradeAfterSaleDO#getId()}
+ * 关联 {@link AfterSaleDO#getId()}
*/
private Long afterSaleId;
- // todo @CHENCHEN: 改成 Integer 哈;主要未来改文案,不好洗 log 存的字段;
+ /**
+ * 操作前状态
+ */
+ private Integer beforeStatus;
+ /**
+ * 操作后状态
+ */
+ private Integer afterStatus;
+
/**
* 操作类型
*
* 枚举 {@link AfterSaleOperateTypeEnum}
*/
- private String operateType;
+ private Integer operateType;
/**
* 操作明细
*/
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/config/TradeConfigDO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/config/TradeConfigDO.java
index f5b20d4c5..fabd02622 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/config/TradeConfigDO.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/config/TradeConfigDO.java
@@ -59,6 +59,11 @@ public class TradeConfigDO extends BaseDO {
*/
private Integer deliveryExpressFreePrice;
+ /**
+ * 是否开启自提
+ */
+ private Boolean deliveryPickUpEnabled;
+
// ========== 分销相关 ==========
/**
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderItemDO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderItemDO.java
index deb895eef..10b07ce58 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderItemDO.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderItemDO.java
@@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.trade.dal.dataobject.order;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
-import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleDO;
+import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.AfterSaleDO;
import cn.iocoder.yudao.module.trade.dal.dataobject.cart.CartDO;
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderItemAfterSaleStatusEnum;
import com.baomidou.mybatisplus.annotation.TableField;
@@ -166,7 +166,7 @@ public class TradeOrderItemDO extends BaseDO {
/**
* 售后单编号
*
- * 关联 {@link TradeAfterSaleDO#getId()} 字段
+ * 关联 {@link AfterSaleDO#getId()} 字段
*/
private Long afterSaleId;
/**
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/aftersale/AfterSaleLogMapper.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/aftersale/AfterSaleLogMapper.java
new file mode 100644
index 000000000..c0ec91c6d
--- /dev/null
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/aftersale/AfterSaleLogMapper.java
@@ -0,0 +1,16 @@
+package cn.iocoder.yudao.module.trade.dal.mysql.aftersale;
+
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.AfterSaleLogDO;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface AfterSaleLogMapper extends BaseMapperX {
+
+ default List selectListByAfterSaleId(Long afterSaleId) {
+ return selectList(AfterSaleLogDO::getAfterSaleId, afterSaleId);
+ }
+
+}
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/aftersale/AfterSaleMapper.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/aftersale/AfterSaleMapper.java
new file mode 100644
index 000000000..68a09a82a
--- /dev/null
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/aftersale/AfterSaleMapper.java
@@ -0,0 +1,51 @@
+package cn.iocoder.yudao.module.trade.dal.mysql.aftersale;
+
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.AfterSalePageReqVO;
+import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.AfterSaleDO;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.Collection;
+
+@Mapper
+public interface AfterSaleMapper extends BaseMapperX {
+
+ default PageResult selectPage(AfterSalePageReqVO reqVO) {
+ return selectPage(reqVO, new LambdaQueryWrapperX()
+ .likeIfPresent(AfterSaleDO::getNo, reqVO.getNo())
+ .eqIfPresent(AfterSaleDO::getStatus, reqVO.getStatus())
+ .eqIfPresent(AfterSaleDO::getType, reqVO.getType())
+ .eqIfPresent(AfterSaleDO::getWay, reqVO.getWay())
+ .likeIfPresent(AfterSaleDO::getOrderNo, reqVO.getOrderNo())
+ .likeIfPresent(AfterSaleDO::getSpuName, reqVO.getSpuName())
+ .betweenIfPresent(AfterSaleDO::getCreateTime, reqVO.getCreateTime())
+ .orderByDesc(AfterSaleDO::getId));
+ }
+
+ default PageResult selectPage(Long userId, PageParam pageParam) {
+ return selectPage(pageParam, new LambdaQueryWrapperX()
+ .eqIfPresent(AfterSaleDO::getUserId, userId)
+ .orderByDesc(AfterSaleDO::getId));
+ }
+
+ default int updateByIdAndStatus(Long id, Integer status, AfterSaleDO update) {
+ return update(update, new LambdaUpdateWrapper()
+ .eq(AfterSaleDO::getId, id).eq(AfterSaleDO::getStatus, status));
+ }
+
+ default AfterSaleDO selectByIdAndUserId(Long id, Long userId) {
+ return selectOne(AfterSaleDO::getId, id,
+ AfterSaleDO::getUserId, userId);
+ }
+
+ default Long selectCountByUserIdAndStatus(Long userId, Collection statuses) {
+ return selectCount(new LambdaQueryWrapperX()
+ .eq(AfterSaleDO::getUserId, userId)
+ .in(AfterSaleDO::getStatus, statuses));
+ }
+
+}
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/aftersale/TradeAfterSaleLogMapper.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/aftersale/TradeAfterSaleLogMapper.java
deleted file mode 100644
index b92ce075f..000000000
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/aftersale/TradeAfterSaleLogMapper.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package cn.iocoder.yudao.module.trade.dal.mysql.aftersale;
-
-import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
-import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleLogDO;
-import org.apache.ibatis.annotations.Mapper;
-
-@Mapper
-public interface TradeAfterSaleLogMapper extends BaseMapperX {
-}
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/aftersale/TradeAfterSaleMapper.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/aftersale/TradeAfterSaleMapper.java
deleted file mode 100644
index 1206a9860..000000000
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/aftersale/TradeAfterSaleMapper.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package cn.iocoder.yudao.module.trade.dal.mysql.aftersale;
-
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
-import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
-import cn.iocoder.yudao.module.trade.controller.admin.aftersale.vo.TradeAfterSalePageReqVO;
-import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleDO;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import org.apache.ibatis.annotations.Mapper;
-
-import java.util.Collection;
-
-@Mapper
-public interface TradeAfterSaleMapper extends BaseMapperX {
-
- default PageResult selectPage(TradeAfterSalePageReqVO reqVO) {
- return selectPage(reqVO, new LambdaQueryWrapperX()
- .likeIfPresent(TradeAfterSaleDO::getNo, reqVO.getNo())
- .eqIfPresent(TradeAfterSaleDO::getStatus, reqVO.getStatus())
- .eqIfPresent(TradeAfterSaleDO::getType, reqVO.getType())
- .eqIfPresent(TradeAfterSaleDO::getWay, reqVO.getWay())
- .likeIfPresent(TradeAfterSaleDO::getOrderNo, reqVO.getOrderNo())
- .likeIfPresent(TradeAfterSaleDO::getSpuName, reqVO.getSpuName())
- .betweenIfPresent(TradeAfterSaleDO::getCreateTime, reqVO.getCreateTime())
- .orderByDesc(TradeAfterSaleDO::getId));
- }
-
- default PageResult selectPage(Long userId, PageParam pageParam) {
- return selectPage(pageParam, new LambdaQueryWrapperX()
- .eqIfPresent(TradeAfterSaleDO::getUserId, userId)
- .orderByDesc(TradeAfterSaleDO::getId));
- }
-
- default int updateByIdAndStatus(Long id, Integer status, TradeAfterSaleDO update) {
- return update(update, new LambdaUpdateWrapper()
- .eq(TradeAfterSaleDO::getId, id).eq(TradeAfterSaleDO::getStatus, status));
- }
-
- default TradeAfterSaleDO selectByIdAndUserId(Long id, Long userId) {
- return selectOne(TradeAfterSaleDO::getId, id,
- TradeAfterSaleDO::getUserId, userId);
- }
-
- default Long selectCountByUserIdAndStatus(Long userId, Collection statuses) {
- return selectCount(new LambdaQueryWrapperX()
- .eq(TradeAfterSaleDO::getUserId, userId)
- .in(TradeAfterSaleDO::getStatus, statuses));
- }
-
-}
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/redis/RedisKeyConstants.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/redis/RedisKeyConstants.java
new file mode 100644
index 000000000..f9b7d8f0e
--- /dev/null
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/redis/RedisKeyConstants.java
@@ -0,0 +1,18 @@
+package cn.iocoder.yudao.module.trade.dal.redis;
+
+/**
+ * 交易 Redis Key 枚举类
+ *
+ * @author 芋道源码
+ */
+public interface RedisKeyConstants {
+
+ /**
+ * 交易序号的缓存
+ *
+ * KEY 格式:trade_no:{prefix}
+ * VALUE 数据格式:编号自增
+ */
+ String TRADE_NO = "trade_no:";
+
+}
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/redis/no/TradeOrderNoRedisDAO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/redis/no/TradeNoRedisDAO.java
similarity index 59%
rename from yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/redis/no/TradeOrderNoRedisDAO.java
rename to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/redis/no/TradeNoRedisDAO.java
index 8ad619269..8b76f195e 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/redis/no/TradeOrderNoRedisDAO.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/redis/no/TradeNoRedisDAO.java
@@ -2,10 +2,12 @@ package cn.iocoder.yudao.module.trade.dal.redis.no;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
+import cn.iocoder.yudao.module.trade.dal.redis.RedisKeyConstants;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
+import java.time.Duration;
import java.time.LocalDateTime;
/**
@@ -14,9 +16,11 @@ import java.time.LocalDateTime;
* @author HUIHUI
*/
@Repository
-public class TradeOrderNoRedisDAO {
+public class TradeNoRedisDAO {
- public static final String TRADE_ORDER_NO_PREFIX = "O";
+ public static final String TRADE_ORDER_NO_PREFIX = "o";
+
+ public static final String AFTER_SALE_NO_PREFIX = "r";
@Resource
private StringRedisTemplate stringRedisTemplate;
@@ -28,8 +32,12 @@ public class TradeOrderNoRedisDAO {
* @return 序号
*/
public String generate(String prefix) {
+ // 递增序号
String noPrefix = prefix + DateUtil.format(LocalDateTime.now(), DatePattern.PURE_DATETIME_PATTERN);
- Long no = stringRedisTemplate.opsForValue().increment(noPrefix);
+ String key = RedisKeyConstants.TRADE_NO + noPrefix;
+ Long no = stringRedisTemplate.opsForValue().increment(key);
+ // 设置过期时间
+ stringRedisTemplate.expire(key, Duration.ofMinutes(1L));
return noPrefix + no;
}
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/config/AfterSaleLogConfiguration.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersale/config/AfterSaleLogConfiguration.java
similarity index 74%
rename from yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/config/AfterSaleLogConfiguration.java
rename to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersale/config/AfterSaleLogConfiguration.java
index 1c382d24f..1c2613789 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/config/AfterSaleLogConfiguration.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersale/config/AfterSaleLogConfiguration.java
@@ -1,6 +1,6 @@
-package cn.iocoder.yudao.module.trade.framework.aftersalelog.config;
+package cn.iocoder.yudao.module.trade.framework.aftersale.config;
-import cn.iocoder.yudao.module.trade.framework.aftersalelog.core.aop.AfterSaleLogAspect;
+import cn.iocoder.yudao.module.trade.framework.aftersale.core.aop.AfterSaleLogAspect;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/core/annotations/AfterSaleLog.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersale/core/annotations/AfterSaleLog.java
similarity index 58%
rename from yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/core/annotations/AfterSaleLog.java
rename to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersale/core/annotations/AfterSaleLog.java
index 59c116909..bc41bf986 100644
--- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersalelog/core/annotations/AfterSaleLog.java
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersale/core/annotations/AfterSaleLog.java
@@ -1,6 +1,7 @@
-package cn.iocoder.yudao.module.trade.framework.aftersalelog.core.annotations;
+package cn.iocoder.yudao.module.trade.framework.aftersale.core.annotations;
import cn.iocoder.yudao.module.trade.enums.aftersale.AfterSaleOperateTypeEnum;
+import cn.iocoder.yudao.module.trade.framework.aftersale.core.aop.AfterSaleLogAspect;
import java.lang.annotation.*;
@@ -11,28 +12,16 @@ import java.lang.annotation.*;
*
* @author 陈賝
* @since 2023/6/8 17:04
- * @see cn.iocoder.yudao.module.trade.framework.aftersalelog.core.aop.AfterSaleLogAspect
+ * @see AfterSaleLogAspect
*/
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface AfterSaleLog {
- /**
- * 售后 ID
- */
- @Deprecated
- String id() default "";
-
/**
* 操作类型
*/
AfterSaleOperateTypeEnum operateType();
- /**
- * 日志内容
- */
- @Deprecated
- String content() default "";
-
}
diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersale/core/aop/AfterSaleLogAspect.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersale/core/aop/AfterSaleLogAspect.java
new file mode 100644
index 000000000..f7b3f7e90
--- /dev/null
+++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/aftersale/core/aop/AfterSaleLogAspect.java
@@ -0,0 +1,133 @@
+package cn.iocoder.yudao.module.trade.framework.aftersale.core.aop;
+
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
+import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderLogDO;
+import cn.iocoder.yudao.module.trade.framework.aftersale.core.annotations.AfterSaleLog;
+import cn.iocoder.yudao.module.trade.service.aftersale.AfterSaleLogService;
+import cn.iocoder.yudao.module.trade.service.aftersale.bo.AfterSaleLogCreateReqBO;
+import lombok.extern.slf4j.Slf4j;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.AfterReturning;
+import org.aspectj.lang.annotation.Aspect;
+
+import javax.annotation.Resource;
+import java.util.Map;
+
+import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString;
+import static java.util.Collections.emptyMap;
+
+/**
+ * 售后订单的操作记录的 AOP 切面
+ *
+ * @author 陈賝
+ * @since 2023/6/13 13:54
+ */
+@Slf4j
+@Aspect
+public class AfterSaleLogAspect {
+
+ /**
+ * 用户编号
+ *
+ * 目前的使用场景:支付回调时,需要强制设置下用户编号
+ */
+ private static final ThreadLocal USER_ID = new ThreadLocal<>();
+ /**
+ * 用户类型
+ */
+ private static final ThreadLocal USER_TYPE = new ThreadLocal<>();
+ /**
+ * 订单编号
+ */
+ private static final ThreadLocal AFTER_SALE_ID = new ThreadLocal<>();
+ /**
+ * 操作前的状态
+ */
+ private static final ThreadLocal BEFORE_STATUS = new ThreadLocal<>();
+ /**
+ * 操作后的状态
+ */
+ private static final ThreadLocal AFTER_STATUS = new ThreadLocal<>();
+ /**
+ * 拓展参数 Map,用于格式化操作内容
+ */
+ private static final ThreadLocal