Commit 3da2eb89b2a05ae6741495e0e23ae756cf0ff8a2
1 parent
f129eab3
新增快递公司功能
Showing
15 changed files
with
535 additions
and
4 deletions
sql/mysql/optional/mall.sql
| @@ -433,7 +433,7 @@ CREATE TABLE `trade_delivery_pick_up_store_staff` ( | @@ -433,7 +433,7 @@ CREATE TABLE `trade_delivery_pick_up_store_staff` ( | ||
| 433 | DROP TABLE IF EXISTS `trade_delivery_express`; | 433 | DROP TABLE IF EXISTS `trade_delivery_express`; |
| 434 | CREATE TABLE `trade_delivery_express` ( | 434 | CREATE TABLE `trade_delivery_express` ( |
| 435 | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号,自增', | 435 | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号,自增', |
| 436 | - `code` varchar(64) NOT NULL COMMENT '快递公司 code', | 436 | + `code` varchar(64) NOT NULL COMMENT '快递公司编号', |
| 437 | `name` varchar(64) NOT NULL COMMENT '快递公司名称', | 437 | `name` varchar(64) NOT NULL COMMENT '快递公司名称', |
| 438 | `logo` varchar(256) COMMENT '快递公司logo', | 438 | `logo` varchar(256) COMMENT '快递公司logo', |
| 439 | `sort` int NOT NULL DEFAULT 0 COMMENT '排序', | 439 | `sort` int NOT NULL DEFAULT 0 COMMENT '排序', |
| @@ -445,7 +445,7 @@ CREATE TABLE `trade_delivery_express` ( | @@ -445,7 +445,7 @@ CREATE TABLE `trade_delivery_express` ( | ||
| 445 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 445 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 446 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | 446 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 447 | PRIMARY KEY (`id`) USING BTREE | 447 | PRIMARY KEY (`id`) USING BTREE |
| 448 | -) ENGINE=InnoDB COMMENT='配送快递公司'; | 448 | +) ENGINE=InnoDB COMMENT='快递公司'; |
| 449 | 449 | ||
| 450 | SET FOREIGN_KEY_CHECKS = 1; | 450 | SET FOREIGN_KEY_CHECKS = 1; |
| 451 | 451 | ||
| @@ -478,6 +478,15 @@ INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, ` | @@ -478,6 +478,15 @@ INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, ` | ||
| 478 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2027, 'Banner创建', 'market:banner:create', 3, 2, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0'); | 478 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2027, 'Banner创建', 'market:banner:create', 3, 2, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0'); |
| 479 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2028, 'Banner更新', 'market:banner:update', 3, 3, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0'); | 479 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2028, 'Banner更新', 'market:banner:update', 3, 3, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0'); |
| 480 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2029, 'Banner删除', 'market:banner:delete', 3, 4, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0'); | 480 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2029, 'Banner删除', 'market:banner:delete', 3, 4, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0'); |
| 481 | +INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2164, '配送管理', '', 1, 0, 2072, 'delivery', '', '', '', 0, b'1', b'1', b'1', '1', '2023-05-18 09:18:02', '1', '2023-05-18 09:48:48', b'0'); | ||
| 482 | +INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2165, '快递发货', '', 1, 0, 2164, 'express', '', '', '', 0, b'1', b'1', b'1', '1', '2023-05-18 09:22:06', '1', '2023-05-18 09:22:06', b'0'); | ||
| 483 | +INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2166, '门店自提', '', 1, 1, 2164, 'pick-up-store', '', '', '', 0, b'1', b'1', b'1', '1', '2023-05-18 09:23:14', '1', '2023-05-18 09:23:14', b'0'); | ||
| 484 | +INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2167, '快递公司', '', 2, 0, 2165, 'express', '', 'mall/trade/delivery/express/index', 'Express', 0, b'1', b'1', b'1', '1', '2023-05-18 09:27:21', '1', '2023-05-18 22:11:14', b'0'); | ||
| 485 | +INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2168, '快递公司查询', 'trade:delivery:express:query', 3, 1, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0'); | ||
| 486 | +INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2169, '快递公司创建', 'trade:delivery:express:create', 3, 2, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0'); | ||
| 487 | +INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2170, '快递公司更新', 'trade:delivery:express:update', 3, 3, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0'); | ||
| 488 | +INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2171, '快递公司删除', 'trade:delivery:express:delete', 3, 4, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0'); | ||
| 489 | +INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2172, '快递公司导出', 'trade:delivery:express:export', 3, 5, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0'); | ||
| 481 | 490 | ||
| 482 | INSERT INTO `system_dict_data`(`sort`,`label`,`value`,`dict_type`,`status`,`color_type`,`css_class`,`remark`,`creator`,`create_time`,`updater`,`update_time`,`deleted`) VALUES | 491 | INSERT INTO `system_dict_data`(`sort`,`label`,`value`,`dict_type`,`status`,`color_type`,`css_class`,`remark`,`creator`,`create_time`,`updater`,`update_time`,`deleted`) VALUES |
| 483 | (1,'打',2,'product_unit',0,'','','',1, NOW(),1, NOW(),0), | 492 | (1,'打',2,'product_unit',0,'','','',1, NOW(),1, NOW(),0), |
yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/enums/ErrorCodeConstants.java
| @@ -42,7 +42,11 @@ public interface ErrorCodeConstants { | @@ -42,7 +42,11 @@ public interface ErrorCodeConstants { | ||
| 42 | ErrorCode AFTER_SALE_REFUND_FAIL_STATUS_NOT_WAIT_REFUND = new ErrorCode(1011000110, "退款失败,售后单状态不是【待退款】"); | 42 | ErrorCode AFTER_SALE_REFUND_FAIL_STATUS_NOT_WAIT_REFUND = new ErrorCode(1011000110, "退款失败,售后单状态不是【待退款】"); |
| 43 | ErrorCode AFTER_SALE_CANCEL_FAIL_STATUS_NOT_APPLY_OR_AGREE = new ErrorCode(1011000111, "取消售后单失败,售后单状态不是【待审核】或【卖家同意】"); | 43 | ErrorCode AFTER_SALE_CANCEL_FAIL_STATUS_NOT_APPLY_OR_AGREE = new ErrorCode(1011000111, "取消售后单失败,售后单状态不是【待审核】或【卖家同意】"); |
| 44 | 44 | ||
| 45 | - // ========== Cart 模块 1-011-001-000 ========== | 45 | + // ========== Cart 模块 1-011-002-000 ========== |
| 46 | ErrorCode CARD_ITEM_NOT_FOUND = new ErrorCode(1011002000, "购物车项不存在"); | 46 | ErrorCode CARD_ITEM_NOT_FOUND = new ErrorCode(1011002000, "购物车项不存在"); |
| 47 | 47 | ||
| 48 | + // ========== 物流配送模块 1-011-003-000 ========== | ||
| 49 | + ErrorCode DELIVERY_EXPRESS_NOT_EXISTS = new ErrorCode(1011003000, "快递公司不存在"); | ||
| 50 | + ErrorCode EXPRESS_CODE_DUPLICATE = new ErrorCode(1011003001, "已经存在该编码的快递公司"); | ||
| 51 | + | ||
| 48 | } | 52 | } |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/DeliveryExpressController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.trade.controller.admin.delivery; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.*; | ||
| 4 | +import cn.iocoder.yudao.module.trade.convert.delivery.DeliveryExpressConvert; | ||
| 5 | +import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO; | ||
| 6 | +import cn.iocoder.yudao.module.trade.service.delivery.DeliveryExpressService; | ||
| 7 | +import org.springframework.web.bind.annotation.*; | ||
| 8 | +import javax.annotation.Resource; | ||
| 9 | +import org.springframework.validation.annotation.Validated; | ||
| 10 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 11 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 12 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 13 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 14 | + | ||
| 15 | +import javax.validation.constraints.*; | ||
| 16 | +import javax.validation.*; | ||
| 17 | +import javax.servlet.http.*; | ||
| 18 | +import java.util.*; | ||
| 19 | +import java.io.IOException; | ||
| 20 | + | ||
| 21 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 22 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 23 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 24 | + | ||
| 25 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||
| 26 | + | ||
| 27 | +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | ||
| 28 | +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; | ||
| 29 | + | ||
| 30 | +@Tag(name = "管理后台 - 快递公司") | ||
| 31 | +@RestController | ||
| 32 | +@RequestMapping("/trade/delivery/express") | ||
| 33 | +@Validated | ||
| 34 | +public class DeliveryExpressController { | ||
| 35 | + | ||
| 36 | + @Resource | ||
| 37 | + private DeliveryExpressService deliveryExpressService; | ||
| 38 | + | ||
| 39 | + @PostMapping("/create") | ||
| 40 | + @Operation(summary = "创建快递公司") | ||
| 41 | + @PreAuthorize("@ss.hasPermission('trade:delivery:express:create')") | ||
| 42 | + public CommonResult<Long> createDeliveryExpress(@Valid @RequestBody DeliveryExpressCreateReqVO createReqVO) { | ||
| 43 | + return success(deliveryExpressService.createDeliveryExpress(createReqVO)); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + @PutMapping("/update") | ||
| 47 | + @Operation(summary = "更新快递公司") | ||
| 48 | + @PreAuthorize("@ss.hasPermission('trade:delivery:express:update')") | ||
| 49 | + public CommonResult<Boolean> updateDeliveryExpress(@Valid @RequestBody DeliveryExpressUpdateReqVO updateReqVO) { | ||
| 50 | + deliveryExpressService.updateDeliveryExpress(updateReqVO); | ||
| 51 | + return success(true); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + @DeleteMapping("/delete") | ||
| 55 | + @Operation(summary = "删除快递公司") | ||
| 56 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 57 | + @PreAuthorize("@ss.hasPermission('trade:delivery:express:delete')") | ||
| 58 | + public CommonResult<Boolean> deleteDeliveryExpress(@RequestParam("id") Long id) { | ||
| 59 | + deliveryExpressService.deleteDeliveryExpress(id); | ||
| 60 | + return success(true); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @GetMapping("/get") | ||
| 64 | + @Operation(summary = "获得快递公司") | ||
| 65 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 66 | + @PreAuthorize("@ss.hasPermission('trade:delivery:express:query')") | ||
| 67 | + public CommonResult<DeliveryExpressRespVO> getDeliveryExpress(@RequestParam("id") Long id) { | ||
| 68 | + DeliveryExpressDO deliveryExpress = deliveryExpressService.getDeliveryExpress(id); | ||
| 69 | + return success(DeliveryExpressConvert.INSTANCE.convert(deliveryExpress)); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + @GetMapping("/page") | ||
| 73 | + @Operation(summary = "获得快递公司分页") | ||
| 74 | + @PreAuthorize("@ss.hasPermission('trade:delivery-express:query')") | ||
| 75 | + public CommonResult<PageResult<DeliveryExpressRespVO>> getDeliveryExpressPage(@Valid DeliveryExpressPageReqVO pageVO) { | ||
| 76 | + PageResult<DeliveryExpressDO> pageResult = deliveryExpressService.getDeliveryExpressPage(pageVO); | ||
| 77 | + return success(DeliveryExpressConvert.INSTANCE.convertPage(pageResult)); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + @GetMapping("/export-excel") | ||
| 81 | + @Operation(summary = "导出快递公司 Excel") | ||
| 82 | + @PreAuthorize("@ss.hasPermission('trade:delivery:express:export')") | ||
| 83 | + @OperateLog(type = EXPORT) | ||
| 84 | + public void exportDeliveryExpressExcel(@Valid DeliveryExpressExportReqVO exportReqVO, | ||
| 85 | + HttpServletResponse response) throws IOException { | ||
| 86 | + List<DeliveryExpressDO> list = deliveryExpressService.getDeliveryExpressList(exportReqVO); | ||
| 87 | + // 导出 Excel | ||
| 88 | + List<DeliveryExpressExcelVO> dataList = DeliveryExpressConvert.INSTANCE.convertList02(list); | ||
| 89 | + ExcelUtils.write(response, "快递公司.xls", "数据", DeliveryExpressExcelVO.class, dataList); | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | +} |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/DeliveryExpressBaseVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.*; | ||
| 5 | +import java.util.*; | ||
| 6 | +import java.time.LocalDateTime; | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | +import javax.validation.constraints.*; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | +* 快递公司 Base VO,提供给添加、修改、详细的子 VO 使用 | ||
| 12 | +* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | ||
| 13 | +*/ | ||
| 14 | +@Data | ||
| 15 | +public class DeliveryExpressBaseVO { | ||
| 16 | + | ||
| 17 | + @Schema(description = "快递公司编号", required = true) | ||
| 18 | + @NotNull(message = "快递公司编号不能为空") | ||
| 19 | + private String code; | ||
| 20 | + | ||
| 21 | + @Schema(description = "快递公司名称", required = true, example = "李四") | ||
| 22 | + @NotNull(message = "快递公司名称不能为空") | ||
| 23 | + private String name; | ||
| 24 | + | ||
| 25 | + @Schema(description = "快递公司logo") | ||
| 26 | + private String logo; | ||
| 27 | + | ||
| 28 | + @Schema(description = "排序", required = true) | ||
| 29 | + @NotNull(message = "排序不能为空") | ||
| 30 | + private Integer sort; | ||
| 31 | + | ||
| 32 | + @Schema(description = "状态(0正常 1停用)", required = true, example = "1") | ||
| 33 | + @NotNull(message = "状态(0正常 1停用)不能为空") | ||
| 34 | + private Integer status; | ||
| 35 | + | ||
| 36 | +} |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/DeliveryExpressCreateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import java.util.*; | ||
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 6 | +import javax.validation.constraints.*; | ||
| 7 | + | ||
| 8 | +@Schema(description = "管理后台 - 快递公司创建 Request VO") | ||
| 9 | +@Data | ||
| 10 | +@EqualsAndHashCode(callSuper = true) | ||
| 11 | +@ToString(callSuper = true) | ||
| 12 | +public class DeliveryExpressCreateReqVO extends DeliveryExpressBaseVO { | ||
| 13 | + | ||
| 14 | +} |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/DeliveryExpressExcelVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo; | ||
| 2 | + | ||
| 3 | +import com.alibaba.excel.annotation.ExcelProperty; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.time.LocalDateTime; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 快递公司 Excel VO | ||
| 10 | + * | ||
| 11 | + * @author jason | ||
| 12 | + */ | ||
| 13 | +@Data | ||
| 14 | +public class DeliveryExpressExcelVO { | ||
| 15 | + | ||
| 16 | + @ExcelProperty("编号") | ||
| 17 | + private Long id; | ||
| 18 | + | ||
| 19 | + @ExcelProperty("快递公司编号") | ||
| 20 | + private String code; | ||
| 21 | + | ||
| 22 | + @ExcelProperty("快递公司名称") | ||
| 23 | + private String name; | ||
| 24 | + | ||
| 25 | + @ExcelProperty("快递公司logo") | ||
| 26 | + private String logo; | ||
| 27 | + | ||
| 28 | + @ExcelProperty("排序") | ||
| 29 | + private Integer sort; | ||
| 30 | + | ||
| 31 | + @ExcelProperty("状态(0正常 1停用)") | ||
| 32 | + private Byte status; | ||
| 33 | + | ||
| 34 | + @ExcelProperty("创建时间") | ||
| 35 | + private LocalDateTime createTime; | ||
| 36 | + | ||
| 37 | +} |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/DeliveryExpressExportReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 6 | + | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | + | ||
| 9 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 10 | + | ||
| 11 | +@Schema(description = "管理后台 - 快递公司 Excel 导出 Request VO") | ||
| 12 | +@Data | ||
| 13 | +public class DeliveryExpressExportReqVO { | ||
| 14 | + | ||
| 15 | + @Schema(description = "快递公司编号") | ||
| 16 | + private String code; | ||
| 17 | + | ||
| 18 | + @Schema(description = "快递公司名称", example = "李四") | ||
| 19 | + private String name; | ||
| 20 | + | ||
| 21 | + @Schema(description = "状态(0正常 1停用)", example = "1") | ||
| 22 | + private Integer status; | ||
| 23 | + | ||
| 24 | + @Schema(description = "创建时间") | ||
| 25 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 26 | + private LocalDateTime[] createTime; | ||
| 27 | + | ||
| 28 | +} |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/DeliveryExpressPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import java.util.*; | ||
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | + | ||
| 10 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 11 | + | ||
| 12 | +@Schema(description = "管理后台 - 快递公司分页 Request VO") | ||
| 13 | +@Data | ||
| 14 | +@EqualsAndHashCode(callSuper = true) | ||
| 15 | +@ToString(callSuper = true) | ||
| 16 | +public class DeliveryExpressPageReqVO extends PageParam { | ||
| 17 | + | ||
| 18 | + @Schema(description = "快递公司编号") | ||
| 19 | + private String code; | ||
| 20 | + | ||
| 21 | + @Schema(description = "快递公司名称", example = "李四") | ||
| 22 | + private String name; | ||
| 23 | + | ||
| 24 | + @Schema(description = "状态(0正常 1停用)", example = "1") | ||
| 25 | + private Integer status; | ||
| 26 | + | ||
| 27 | + @Schema(description = "创建时间") | ||
| 28 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 29 | + private LocalDateTime[] createTime; | ||
| 30 | + | ||
| 31 | +} |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/DeliveryExpressRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.*; | ||
| 5 | +import java.time.LocalDateTime; | ||
| 6 | + | ||
| 7 | +@Schema(description = "管理后台 - 快递公司 Response VO") | ||
| 8 | +@Data | ||
| 9 | +@EqualsAndHashCode(callSuper = true) | ||
| 10 | +@ToString(callSuper = true) | ||
| 11 | +public class DeliveryExpressRespVO extends DeliveryExpressBaseVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "编号", required = true, example = "6592") | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + @Schema(description = "创建时间", required = true) | ||
| 17 | + private LocalDateTime createTime; | ||
| 18 | + | ||
| 19 | +} |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/DeliveryExpressUpdateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.*; | ||
| 5 | +import java.util.*; | ||
| 6 | +import javax.validation.constraints.*; | ||
| 7 | + | ||
| 8 | +@Schema(description = "管理后台 - 快递公司更新 Request VO") | ||
| 9 | +@Data | ||
| 10 | +@EqualsAndHashCode(callSuper = true) | ||
| 11 | +@ToString(callSuper = true) | ||
| 12 | +public class DeliveryExpressUpdateReqVO extends DeliveryExpressBaseVO { | ||
| 13 | + | ||
| 14 | + @Schema(description = "编号", required = true, example = "6592") | ||
| 15 | + @NotNull(message = "编号不能为空") | ||
| 16 | + private Long id; | ||
| 17 | + | ||
| 18 | +} |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/delivery/DeliveryExpressConvert.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.trade.convert.delivery; | ||
| 2 | + | ||
| 3 | +import java.util.*; | ||
| 4 | + | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | + | ||
| 7 | +import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressCreateReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressExcelVO; | ||
| 9 | +import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressRespVO; | ||
| 10 | +import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressUpdateReqVO; | ||
| 11 | +import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO; | ||
| 12 | +import org.mapstruct.Mapper; | ||
| 13 | +import org.mapstruct.factory.Mappers; | ||
| 14 | + | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * 快递公司 Convert | ||
| 18 | + * | ||
| 19 | + * @author 芋道源码 | ||
| 20 | + */ | ||
| 21 | +@Mapper | ||
| 22 | +public interface DeliveryExpressConvert { | ||
| 23 | + | ||
| 24 | + DeliveryExpressConvert INSTANCE = Mappers.getMapper(DeliveryExpressConvert.class); | ||
| 25 | + | ||
| 26 | + DeliveryExpressDO convert(DeliveryExpressCreateReqVO bean); | ||
| 27 | + | ||
| 28 | + DeliveryExpressDO convert(DeliveryExpressUpdateReqVO bean); | ||
| 29 | + | ||
| 30 | + DeliveryExpressRespVO convert(DeliveryExpressDO bean); | ||
| 31 | + | ||
| 32 | + List<DeliveryExpressRespVO> convertList(List<DeliveryExpressDO> list); | ||
| 33 | + | ||
| 34 | + PageResult<DeliveryExpressRespVO> convertPage(PageResult<DeliveryExpressDO> page); | ||
| 35 | + | ||
| 36 | + List<DeliveryExpressExcelVO> convertList02(List<DeliveryExpressDO> list); | ||
| 37 | + | ||
| 38 | +} |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/delivery/DeliveryExpressDO.java
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/delivery/DeliveryExpressMapper.java
| 1 | package cn.iocoder.yudao.module.trade.dal.mysql.delivery; | 1 | package cn.iocoder.yudao.module.trade.dal.mysql.delivery; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 6 | +import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressExportReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressPageReqVO; | ||
| 4 | import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO; | 8 | import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO; |
| 9 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
| 5 | import org.apache.ibatis.annotations.Mapper; | 10 | import org.apache.ibatis.annotations.Mapper; |
| 6 | 11 | ||
| 12 | +import java.util.List; | ||
| 13 | + | ||
| 7 | @Mapper | 14 | @Mapper |
| 8 | public interface DeliveryExpressMapper extends BaseMapperX<DeliveryExpressDO> { | 15 | public interface DeliveryExpressMapper extends BaseMapperX<DeliveryExpressDO> { |
| 9 | 16 | ||
| 17 | + default PageResult<DeliveryExpressDO> selectPage(DeliveryExpressPageReqVO reqVO) { | ||
| 18 | + return selectPage(reqVO, new LambdaQueryWrapperX<DeliveryExpressDO>() | ||
| 19 | + .likeIfPresent(DeliveryExpressDO::getCode, reqVO.getCode()) | ||
| 20 | + .likeIfPresent(DeliveryExpressDO::getName, reqVO.getName()) | ||
| 21 | + .eqIfPresent(DeliveryExpressDO::getStatus, reqVO.getStatus()) | ||
| 22 | + .betweenIfPresent(DeliveryExpressDO::getCreateTime, reqVO.getCreateTime()) | ||
| 23 | + .orderByAsc(DeliveryExpressDO::getSort)); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + default List<DeliveryExpressDO> selectList(DeliveryExpressExportReqVO reqVO) { | ||
| 27 | + return selectList(new LambdaQueryWrapperX<DeliveryExpressDO>() | ||
| 28 | + .likeIfPresent(DeliveryExpressDO::getCode, reqVO.getCode()) | ||
| 29 | + .likeIfPresent(DeliveryExpressDO::getName, reqVO.getName()) | ||
| 30 | + .eqIfPresent(DeliveryExpressDO::getStatus, reqVO.getStatus()) | ||
| 31 | + .betweenIfPresent(DeliveryExpressDO::getCreateTime, reqVO.getCreateTime()) | ||
| 32 | + .orderByAsc(DeliveryExpressDO::getSort)); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + default DeliveryExpressDO selectByCode(String code) { | ||
| 36 | + return selectOne(new LambdaQueryWrapper<DeliveryExpressDO>() | ||
| 37 | + .eq(DeliveryExpressDO::getCode, code)); | ||
| 38 | + } | ||
| 10 | } | 39 | } |
| 11 | 40 | ||
| 12 | 41 |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/delivery/DeliveryExpressService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.trade.service.delivery; | ||
| 2 | + | ||
| 3 | +import java.util.*; | ||
| 4 | +import javax.validation.*; | ||
| 5 | + | ||
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 7 | +import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressCreateReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressExportReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressPageReqVO; | ||
| 10 | +import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressUpdateReqVO; | ||
| 11 | +import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 快递公司 Service 接口 | ||
| 15 | + * | ||
| 16 | + * @author jason | ||
| 17 | + */ | ||
| 18 | +public interface DeliveryExpressService { | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 创建快递公司 | ||
| 22 | + * | ||
| 23 | + * @param createReqVO 创建信息 | ||
| 24 | + * @return 编号 | ||
| 25 | + */ | ||
| 26 | + Long createDeliveryExpress(@Valid DeliveryExpressCreateReqVO createReqVO); | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 更新快递公司 | ||
| 30 | + * | ||
| 31 | + * @param updateReqVO 更新信息 | ||
| 32 | + */ | ||
| 33 | + void updateDeliveryExpress(@Valid DeliveryExpressUpdateReqVO updateReqVO); | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 删除快递公司 | ||
| 37 | + * | ||
| 38 | + * @param id 编号 | ||
| 39 | + */ | ||
| 40 | + void deleteDeliveryExpress(Long id); | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * 获得快递公司 | ||
| 44 | + * | ||
| 45 | + * @param id 编号 | ||
| 46 | + * @return 快递公司 | ||
| 47 | + */ | ||
| 48 | + DeliveryExpressDO getDeliveryExpress(Long id); | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * 获得快递公司列表 | ||
| 52 | + * | ||
| 53 | + * @param ids 编号 | ||
| 54 | + * @return 快递公司列表 | ||
| 55 | + */ | ||
| 56 | + List<DeliveryExpressDO> getDeliveryExpressList(Collection<Long> ids); | ||
| 57 | + | ||
| 58 | + /** | ||
| 59 | + * 获得快递公司分页 | ||
| 60 | + * | ||
| 61 | + * @param pageReqVO 分页查询 | ||
| 62 | + * @return 快递公司分页 | ||
| 63 | + */ | ||
| 64 | + PageResult<DeliveryExpressDO> getDeliveryExpressPage(DeliveryExpressPageReqVO pageReqVO); | ||
| 65 | + | ||
| 66 | + /** | ||
| 67 | + * 获得快递公司列表, 用于 Excel 导出 | ||
| 68 | + * | ||
| 69 | + * @param exportReqVO 查询条件 | ||
| 70 | + * @return 快递公司列表 | ||
| 71 | + */ | ||
| 72 | + List<DeliveryExpressDO> getDeliveryExpressList(DeliveryExpressExportReqVO exportReqVO); | ||
| 73 | + | ||
| 74 | +} |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/delivery/DeliveryExpressServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.trade.service.delivery; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressCreateReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressExportReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressPageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressUpdateReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.trade.convert.delivery.DeliveryExpressConvert; | ||
| 9 | +import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO; | ||
| 10 | +import cn.iocoder.yudao.module.trade.dal.mysql.delivery.DeliveryExpressMapper; | ||
| 11 | +import org.springframework.stereotype.Service; | ||
| 12 | +import javax.annotation.Resource; | ||
| 13 | +import org.springframework.validation.annotation.Validated; | ||
| 14 | + | ||
| 15 | +import java.util.*; | ||
| 16 | + | ||
| 17 | + | ||
| 18 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 19 | +import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.*; | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * 快递公司 Service 实现类 | ||
| 23 | + * | ||
| 24 | + * @author jason | ||
| 25 | + */ | ||
| 26 | +@Service | ||
| 27 | +@Validated | ||
| 28 | +public class DeliveryExpressServiceImpl implements DeliveryExpressService { | ||
| 29 | + | ||
| 30 | + @Resource | ||
| 31 | + private DeliveryExpressMapper deliveryExpressMapper; | ||
| 32 | + | ||
| 33 | + @Override | ||
| 34 | + public Long createDeliveryExpress(DeliveryExpressCreateReqVO createReqVO) { | ||
| 35 | + //校验编码是否唯一 | ||
| 36 | + validateExpressCodeUnique(createReqVO.getCode(), null); | ||
| 37 | + // 插入 | ||
| 38 | + DeliveryExpressDO deliveryExpress = DeliveryExpressConvert.INSTANCE.convert(createReqVO); | ||
| 39 | + deliveryExpressMapper.insert(deliveryExpress); | ||
| 40 | + // 返回 | ||
| 41 | + return deliveryExpress.getId(); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + @Override | ||
| 45 | + public void updateDeliveryExpress(DeliveryExpressUpdateReqVO updateReqVO) { | ||
| 46 | + // 校验存在 | ||
| 47 | + validateDeliveryExpressExists(updateReqVO.getId()); | ||
| 48 | + //校验编码是否唯一 | ||
| 49 | + validateExpressCodeUnique(updateReqVO.getCode(), updateReqVO.getId()); | ||
| 50 | + // 更新 | ||
| 51 | + DeliveryExpressDO updateObj = DeliveryExpressConvert.INSTANCE.convert(updateReqVO); | ||
| 52 | + deliveryExpressMapper.updateById(updateObj); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + @Override | ||
| 56 | + public void deleteDeliveryExpress(Long id) { | ||
| 57 | + // 校验存在 | ||
| 58 | + validateDeliveryExpressExists(id); | ||
| 59 | + // 删除 | ||
| 60 | + deliveryExpressMapper.deleteById(id); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + private void validateExpressCodeUnique(String code, Long id) { | ||
| 64 | + DeliveryExpressDO express = deliveryExpressMapper.selectByCode(code); | ||
| 65 | + if (express == null) { | ||
| 66 | + return; | ||
| 67 | + } | ||
| 68 | + // 如果 id 为空,说明不用比较是否为相同 id 的快递公司 | ||
| 69 | + if (id == null) { | ||
| 70 | + throw exception(EXPRESS_CODE_DUPLICATE); | ||
| 71 | + } | ||
| 72 | + if (!express.getId().equals(id)) { | ||
| 73 | + throw exception(EXPRESS_CODE_DUPLICATE); | ||
| 74 | + } | ||
| 75 | + } | ||
| 76 | + private void validateDeliveryExpressExists(Long id) { | ||
| 77 | + if (deliveryExpressMapper.selectById(id) == null) { | ||
| 78 | + throw exception(DELIVERY_EXPRESS_NOT_EXISTS); | ||
| 79 | + } | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + @Override | ||
| 83 | + public DeliveryExpressDO getDeliveryExpress(Long id) { | ||
| 84 | + return deliveryExpressMapper.selectById(id); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + @Override | ||
| 88 | + public List<DeliveryExpressDO> getDeliveryExpressList(Collection<Long> ids) { | ||
| 89 | + return deliveryExpressMapper.selectBatchIds(ids); | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + @Override | ||
| 93 | + public PageResult<DeliveryExpressDO> getDeliveryExpressPage(DeliveryExpressPageReqVO pageReqVO) { | ||
| 94 | + return deliveryExpressMapper.selectPage(pageReqVO); | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + @Override | ||
| 98 | + public List<DeliveryExpressDO> getDeliveryExpressList(DeliveryExpressExportReqVO exportReqVO) { | ||
| 99 | + return deliveryExpressMapper.selectList(exportReqVO); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | +} |