From f8db53896f3467a2943a20d08d2588f63c41eb10 Mon Sep 17 00:00:00 2001 From: jason <2667446@qq.com> Date: Tue, 30 May 2023 21:17:51 +0800 Subject: [PATCH] =?UTF-8?q?review=20=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../trade/enums/ErrorCodeConstants.java | 1 + .../delivery/DeliveryExpressController.java | 2 -- .../DeliveryExpressTemplateController.java | 1 - .../vo/express/DeliveryExpressBaseVO.java | 4 +-- .../DeliveryExpressTemplateCreateReqVO.java | 6 ++-- .../DeliveryExpressTemplateSimpleRespVO.java | 1 + .../DeliveryExpressTemplateUpdateReqVO.java | 33 ++++++++++++++++--- .../ExpressTemplateChargeUpdateVO.java | 22 ------------- .../ExpressTemplateFreeUpdateVO.java | 19 ----------- .../delivery/DeliveryExpressConvert.java | 6 ---- .../DeliveryExpressTemplateConvert.java | 9 ++--- .../DeliveryExpressTemplateServiceImpl.java | 8 ++--- 12 files changed, 40 insertions(+), 72 deletions(-) delete mode 100644 yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/ExpressTemplateChargeUpdateVO.java delete mode 100644 yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/ExpressTemplateFreeUpdateVO.java diff --git a/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/ErrorCodeConstants.java b/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/ErrorCodeConstants.java index b887ae8c8..0ace583e7 100644 --- a/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/ErrorCodeConstants.java +++ b/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/ErrorCodeConstants.java @@ -50,6 +50,7 @@ public interface ErrorCodeConstants { ErrorCode EXPRESS_CODE_DUPLICATE = new ErrorCode(1011003001, "已经存在该编码的快递公司"); ErrorCode EXPRESS_TEMPLATE_NOT_EXISTS = new ErrorCode(1011003002, "运费模板不存在"); ErrorCode EXPRESS_TEMPLATE_NAME_DUPLICATE = new ErrorCode(1011003002, "已经存在该运费模板名"); + ErrorCode PICK_UP_STORE_NOT_EXISTS = new ErrorCode(1011003003, "自提门店不存在"); // ========== Price 相关 1011004000 ============ ErrorCode PRICE_CALCULATE_PAY_PRICE_ILLEGAL = new ErrorCode(1011004000, "支付价格计算异常,原因:价格小于等于 0"); diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/DeliveryExpressController.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/DeliveryExpressController.java index 72b9e08d0..cff98a558 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/DeliveryExpressController.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/DeliveryExpressController.java @@ -75,7 +75,6 @@ public class DeliveryExpressController { return success(DeliveryExpressConvert.INSTANCE.convertPage(pageResult)); } - // TODO @jason:运费模版,@芋艿 你的意思是运费模板导出没有必要吧。已经去掉了。这个是快递公司导出 @GetMapping("/export-excel") @Operation(summary = "导出快递公司 Excel") @PreAuthorize("@ss.hasPermission('trade:delivery:express:export')") @@ -87,5 +86,4 @@ public class DeliveryExpressController { List dataList = DeliveryExpressConvert.INSTANCE.convertList02(list); ExcelUtils.write(response, "快递公司.xls", "数据", DeliveryExpressExcelVO.class, dataList); } - } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/DeliveryExpressTemplateController.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/DeliveryExpressTemplateController.java index fed5ee13c..1dcab4055 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/DeliveryExpressTemplateController.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/DeliveryExpressTemplateController.java @@ -20,7 +20,6 @@ import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; - @Tag(name = "管理后台 - 快递运费模板") @RestController @RequestMapping("/trade/delivery/express-template") diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/express/DeliveryExpressBaseVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/express/DeliveryExpressBaseVO.java index c4f629cf6..b92faccdb 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/express/DeliveryExpressBaseVO.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/express/DeliveryExpressBaseVO.java @@ -27,8 +27,8 @@ public class DeliveryExpressBaseVO { @NotNull(message = "排序不能为空") private Integer sort; - @Schema(description = "状态(0正常 1停用)", required = true, example = "1") - @NotNull(message = "状态(0正常 1停用)不能为空") + @Schema(description = "状态", required = true, example = "1") + @NotNull(message = "状态不能为空") private Integer status; } 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 ee51c5659..26173a977 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 @@ -15,14 +15,12 @@ import java.util.List; @ToString(callSuper = true) public class DeliveryExpressTemplateCreateReqVO extends DeliveryExpressTemplateBaseVO { - // TODO @jason:不用给默认值哈 - @Schema(description = "区域运费列表") @Valid - private List templateCharge = Collections.emptyList(); + private List templateCharge; @Schema(description = "包邮区域列表") @Valid - private List templateFree = Collections.emptyList(); + private List templateFree; } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateSimpleRespVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateSimpleRespVO.java index 2f2c8280d..957ce3c08 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateSimpleRespVO.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/DeliveryExpressTemplateSimpleRespVO.java @@ -5,6 +5,7 @@ import lombok.*; import java.time.LocalDateTime; // TODO @jason:simplae 是不是不用继承 DeliveryExpressTemplateBaseVO,直接 id name 属性就够了。 +// @芋艿 这里给列表显示用的。 需要显示计费方式和排序, 所以继承 DeliveryExpressTemplateBaseVO。 这是去掉了包邮区域和 区域运费列表 @Schema(description = "管理后台 - 快递运费模板 精简 Response VO") @Data @EqualsAndHashCode(callSuper = true) 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 0f5c65221..d059e3200 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 @@ -7,7 +7,6 @@ import lombok.ToString; import javax.validation.Valid; import javax.validation.constraints.NotNull; -import java.util.Collections; import java.util.List; @Schema(description = "管理后台 - 快递运费模板更新 Request VO") @@ -20,14 +19,38 @@ public class DeliveryExpressTemplateUpdateReqVO extends DeliveryExpressTemplateB @NotNull(message = "编号不能为空") private Long id; - // TODO @jason:pojo 不给默认值哈 - @Schema(description = "区域运费列表") @Valid - private List templateCharge = Collections.emptyList(); + private List templateCharge; @Schema(description = "包邮区域列表") @Valid - private List templateFree = Collections.emptyList(); + private List templateFree; + @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/admin/delivery/vo/expresstemplate/ExpressTemplateChargeUpdateVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/ExpressTemplateChargeUpdateVO.java deleted file mode 100644 index e9fcb08f9..000000000 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/ExpressTemplateChargeUpdateVO.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.expresstemplate; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -// TODO @jason:这个 vo 可以内嵌到 DeliveryExpressTemplateUpdateReqVO,避免 vo 过多,不好分辨 -@Schema(description = "管理后台 - 快递公司创建 Request VO") -@Data -public 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; - -} diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/ExpressTemplateFreeUpdateVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/ExpressTemplateFreeUpdateVO.java deleted file mode 100644 index e2c894456..000000000 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/expresstemplate/ExpressTemplateFreeUpdateVO.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.expresstemplate; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -// TODO @jason:这个 vo 可以内嵌到 DeliveryExpressTemplateUpdateReqVO,避免 vo 过多,不好分辨 -// TODO @jason:swagger 缺失 -/** - * 快递运费模板包邮 更新 VO - */ -@Data -public 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/convert/delivery/DeliveryExpressConvert.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/delivery/DeliveryExpressConvert.java index 474881790..c4529ba89 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/delivery/DeliveryExpressConvert.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/delivery/DeliveryExpressConvert.java @@ -12,12 +12,6 @@ import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; - -/** - * 快递公司 Convert - * - * @author jason - */ @Mapper public interface DeliveryExpressConvert { 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 20e94cb25..424c7e132 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 @@ -11,11 +11,6 @@ import org.mapstruct.factory.Mappers; import java.util.List; -/** - * 快递运费模板 Convert - * - * @author jason - */ @Mapper public interface DeliveryExpressTemplateConvert { @@ -48,7 +43,7 @@ public interface DeliveryExpressTemplateConvert { DeliveryExpressTemplateChargeDO convertTemplateCharge(Long templateId, Integer chargeMode, ExpressTemplateChargeBaseVO vo); - DeliveryExpressTemplateChargeDO convertTemplateCharge(ExpressTemplateChargeUpdateVO vo); + DeliveryExpressTemplateChargeDO convertTemplateCharge(DeliveryExpressTemplateUpdateReqVO.ExpressTemplateChargeUpdateVO vo); default List convertTemplateChargeList(Long templateId, Integer chargeMode, List list) { return CollectionUtils.convertList(list, vo -> convertTemplateCharge(templateId, chargeMode, vo)); @@ -58,7 +53,7 @@ public interface DeliveryExpressTemplateConvert { DeliveryExpressTemplateFreeDO convertTemplateFree(Long templateId, ExpressTemplateFreeBaseVO vo); - DeliveryExpressTemplateFreeDO convertTemplateFree(ExpressTemplateFreeUpdateVO vo); + DeliveryExpressTemplateFreeDO convertTemplateFree(DeliveryExpressTemplateUpdateReqVO.ExpressTemplateFreeUpdateVO vo); List convertTemplateChargeList(List list); diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/delivery/DeliveryExpressTemplateServiceImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/delivery/DeliveryExpressTemplateServiceImpl.java index d7bf96978..d77bb78c2 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/delivery/DeliveryExpressTemplateServiceImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/delivery/DeliveryExpressTemplateServiceImpl.java @@ -82,10 +82,10 @@ public class DeliveryExpressTemplateServiceImpl implements DeliveryExpressTempla private void updateExpressTemplateFree(DeliveryExpressTemplateUpdateReqVO updateReqVO) { // 1.1 获得新增/修改的区域列表 List oldFreeList = expressTemplateFreeMapper.selectListByTemplateId(updateReqVO.getId()); - List newFreeList = updateReqVO.getTemplateFree(); + List newFreeList = updateReqVO.getTemplateFree(); List addFreeList = new ArrayList<>(newFreeList.size()); // 新增包邮区域列表 List updateFreeList = new ArrayList<>(newFreeList.size()); // 更新包邮区域列表 - for (ExpressTemplateFreeUpdateVO item : newFreeList) { + for (DeliveryExpressTemplateUpdateReqVO.ExpressTemplateFreeUpdateVO item : newFreeList) { if (Objects.nonNull(item.getId())) { updateFreeList.add(INSTANCE.convertTemplateFree(item)); } else { @@ -113,10 +113,10 @@ public class DeliveryExpressTemplateServiceImpl implements DeliveryExpressTempla private void updateExpressTemplateCharge(DeliveryExpressTemplateUpdateReqVO updateReqVO) { // 1.1 获得新增/修改的区域列表 List oldChargeList = expressTemplateChargeMapper.selectListByTemplateId(updateReqVO.getId()); - List newChargeList = updateReqVO.getTemplateCharge(); + List newChargeList = updateReqVO.getTemplateCharge(); List addList = new ArrayList<>(newChargeList.size()); // 新增运费区域列表 List updateList = new ArrayList<>(newChargeList.size()); // 更新运费区域列表 - for (ExpressTemplateChargeUpdateVO item : newChargeList) { + for (DeliveryExpressTemplateUpdateReqVO.ExpressTemplateChargeUpdateVO item : newChargeList) { if (item.getId() != null) { // 计费模式以主表为准 item.setChargeMode(updateReqVO.getChargeMode());