新增自提门店管理

This commit is contained in:
jason 2023-05-30 21:18:30 +08:00
parent f8db53896f
commit 894b19b8ec
14 changed files with 596 additions and 30 deletions

View File

@ -389,18 +389,18 @@ CREATE TABLE `trade_delivery_express_template_charge` (
-- ----------------------------
DROP TABLE IF EXISTS `trade_delivery_pick_up_store`;
CREATE TABLE `trade_delivery_pick_up_store` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号自增',
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
`name` varchar(64) NOT NULL COMMENT '门店名称',
`introduction` varchar(256) COMMENT '门店简介',
`phone` varchar(16) NOT NULL COMMENT '门店手机',
`area_id` int NOT NULL COMMENT '区域id',
`area_id` int NOT NULL COMMENT '区域编号',
`detail_address` varchar(256) NOT NULL COMMENT '门店详细地址',
`logo` varchar(256) NOT NULL COMMENT '门店logo',
`logo` varchar(256) NOT NULL COMMENT '门店 logo',
`opening_time` time NOT NULL COMMENT '营业开始时间',
`closing_time` time NOT NULL COMMENT '营业结束时间',
`latitude` varchar(128) NOT NULL COMMENT '纬度',
`longitude` varchar(128) NOT NULL COMMENT '经度',
`status` tinyint NOT NULL DEFAULT 0 COMMENT '门店状态0正常 1停用',
`latitude` double NOT NULL COMMENT '纬度',
`longitude` double NOT NULL COMMENT '经度',
`status` tinyint NOT NULL DEFAULT 0 COMMENT '门店状态',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
@ -427,25 +427,6 @@ CREATE TABLE `trade_delivery_pick_up_store_staff` (
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB COMMENT='自提门店店员';
-- ----------------------------
-- Table structure for trade_delivery_pick_up_store_staff
-- ----------------------------
DROP TABLE IF EXISTS `trade_delivery_pick_up_store_staff`;
CREATE TABLE `trade_delivery_pick_up_store_staff` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号自增',
`admin_user_id` bigint NOT NULL COMMENT '管理员用户id',
store_id bigint NOT NULL COMMENT '自提门店编号',
`status` tinyint NOT NULL DEFAULT 0 COMMENT '状态0正常 1停用',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB COMMENT='自提门店店员';
-- ----------------------------
-- Table structure for trade_delivery_express
-- ----------------------------
@ -541,3 +522,15 @@ INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`id`, `sort`, `label`, `value`,
INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1236, 1, '按重量', '2', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:46:58', '1', '2023-05-21 22:46:58', b'0');
INSERT INTO `ruoyi-vue-pro`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1235, 0, '按件', '1', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:46:40', '1', '2023-05-21 22:46:40', b'0');
COMMIT;
-- ----------------------------
-- 门店管理 菜单
-- ----------------------------
BEGIN;
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 (2179, '门店管理', '', 2, 1, 2166, 'pick-up-store', '', 'mall/trade/delivery/pickUpStore/index', 'PickUpStore', 0, b'1', b'1', b'1', '1', '2023-05-25 10:50:00', '1', '2023-05-25 10:50:00', b'0');
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 (2180, '自提门店查询', 'trade:delivery:pick-up-store:query', 3, 1, 2179, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-25 10:53:29', '', '2023-05-25 10:53:29', b'0');
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 (2181, '自提门店创建', 'trade:delivery:pick-up-store:create', 3, 2, 2179, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-25 10:53:29', '', '2023-05-25 10:53:29', b'0');
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 (2182, '自提门店更新', 'trade:delivery:pick-up-store:update', 3, 3, 2179, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-25 10:53:29', '', '2023-05-25 10:53:29', b'0');
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 (2183, '自提门店删除', 'trade:delivery:pick-up-store:delete', 3, 4, 2179, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-25 10:53:29', '', '2023-05-25 10:53:29', b'0');
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 (2184, '自提门店导出', 'trade:delivery:pick-up-store:export', 3, 5, 2179, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-25 10:53:29', '', '2023-05-25 10:53:29', b'0');
COMMIT;

View File

@ -0,0 +1,98 @@
package cn.iocoder.yudao.module.trade.controller.admin.delivery;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.*;
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.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - 自提门店")
@RestController
@RequestMapping("/trade/delivery/pick-up-store")
@Validated
public class DeliveryPickUpStoreController {
@Resource
private DeliveryPickUpStoreService deliveryPickUpStoreService;
@PostMapping("/create")
@Operation(summary = "创建自提门店")
@PreAuthorize("@ss.hasPermission('trade:delivery:pick-up-store:create')")
public CommonResult<Long> createDeliveryPickUpStore(@Valid @RequestBody DeliveryPickUpStoreCreateReqVO createReqVO) {
return success(deliveryPickUpStoreService.createDeliveryPickUpStore(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新自提门店")
@PreAuthorize("@ss.hasPermission('trade:delivery:pick-up-store:update')")
public CommonResult<Boolean> updateDeliveryPickUpStore(@Valid @RequestBody DeliveryPickUpStoreUpdateReqVO updateReqVO) {
deliveryPickUpStoreService.updateDeliveryPickUpStore(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除自提门店")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('trade:delivery:pick-up-store:delete')")
public CommonResult<Boolean> deleteDeliveryPickUpStore(@RequestParam("id") Long id) {
deliveryPickUpStoreService.deleteDeliveryPickUpStore(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得自提门店")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('trade:delivery:pick-up-store:query')")
public CommonResult<DeliveryPickUpStoreRespVO> getDeliveryPickUpStore(@RequestParam("id") Long id) {
DeliveryPickUpStoreDO deliveryPickUpStore = deliveryPickUpStoreService.getDeliveryPickUpStore(id);
return success(DeliveryPickUpStoreConvert.INSTANCE.convert(deliveryPickUpStore));
}
@GetMapping("/list")
@Operation(summary = "获得自提门店列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('trade:delivery:pick-up-store:query')")
public CommonResult<List<DeliveryPickUpStoreRespVO>> getDeliveryPickUpStoreList(@RequestParam("ids") Collection<Long> ids) {
List<DeliveryPickUpStoreDO> list = deliveryPickUpStoreService.getDeliveryPickUpStoreList(ids);
return success(DeliveryPickUpStoreConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@Operation(summary = "获得自提门店分页")
@PreAuthorize("@ss.hasPermission('trade:delivery:pick-up-store:query')")
public CommonResult<PageResult<DeliveryPickUpStoreRespVO>> getDeliveryPickUpStorePage(@Valid DeliveryPickUpStorePageReqVO pageVO) {
PageResult<DeliveryPickUpStoreDO> pageResult = deliveryPickUpStoreService.getDeliveryPickUpStorePage(pageVO);
return success(DeliveryPickUpStoreConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出自提门店 Excel")
@PreAuthorize("@ss.hasPermission('trade:delivery:pick-up-store:export')")
@OperateLog(type = EXPORT)
public void exportDeliveryPickUpStoreExcel(@Valid DeliveryPickUpStoreExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
List<DeliveryPickUpStoreDO> list = deliveryPickUpStoreService.getDeliveryPickUpStoreList(exportReqVO);
// 导出 Excel
List<DeliveryPickUpStoreExcelVO> datas = DeliveryPickUpStoreConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "自提门店.xls", "数据", DeliveryPickUpStoreExcelVO.class, datas);
}
}

View File

@ -0,0 +1,68 @@
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.framework.common.validation.Mobile;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalTime;
/**
* 自提门店 Base VO提供给添加修改详细的子 VO 使用
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/
@Data
public class DeliveryPickUpStoreBaseVO {
@Schema(description = "门店名称", required = true, example = "李四")
@NotBlank(message = "门店名称不能为空")
private String name;
@Schema(description = "门店简介")
private String introduction;
@Schema(description = "门店手机", required = true)
@NotBlank(message = "门店手机不能为空")
@Mobile
private String phone;
@Schema(description = "区域编号", required = true, example = "18733")
@NotNull(message = "区域编号不能为空")
private Integer areaId;
@Schema(description = "门店详细地址", required = true)
@NotBlank(message = "门店详细地址不能为空")
private String detailAddress;
@Schema(description = "门店 logo", required = true)
@NotBlank(message = "门店 logo 不能为空")
private String logo;
@Schema(description = "营业开始时间", required = true)
@NotNull(message = "营业开始时间不能为空")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm")
private LocalTime openingTime;
@Schema(description = "营业结束时间", required = true)
@NotNull(message = "营业结束时间不能为空")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm")
private LocalTime closingTime;
@Schema(description = "纬度", required = true)
@NotNull(message = "纬度不能为空")
private Double latitude;
@Schema(description = "经度", required = true)
@NotNull(message = "经度不能为空")
private Double longitude;
@Schema(description = "门店状态", required = true, example = "1")
@NotNull(message = "门店状态不能为空")
@InEnum(CommonStatusEnum.class)
private Integer status;
}

View File

@ -0,0 +1,14 @@
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 自提门店创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DeliveryPickUpStoreCreateReqVO extends DeliveryPickUpStoreBaseVO {
}

View File

@ -0,0 +1,57 @@
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class DeliveryPickUpStoreExcelVO {
@ExcelProperty("编号")
private Long id;
@ExcelProperty("门店名称")
private String name;
@ExcelProperty("门店简介")
private String introduction;
@ExcelProperty("门店手机")
private String phone;
@ExcelProperty("门店所在区域")
private String areaName;
@ExcelProperty("门店详细地址")
private String detailAddress;
@ExcelProperty("门店logo")
private String logo;
/**
* easy-excel 好像暂时不支持 LocalTime. 转成string
*/
@ExcelProperty("营业开始时间")
private String openingTime;
@ExcelProperty("营业结束时间")
private String closingTime;
@ExcelProperty("纬度")
private String latitude;
@ExcelProperty("经度")
private String longitude;
@ExcelProperty(value = "状态", converter = DictConvert.class)
@DictFormat(DictTypeConstants.COMMON_STATUS)
private Integer status;
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 自提门店 Excel 导出 Request VO参数和 DeliveryPickUpStorePageReqVO 是一致的")
@Data
public class DeliveryPickUpStoreExportReqVO {
@Schema(description = "门店名称", example = "李四")
private String name;
@Schema(description = "门店手机")
private String phone;
@Schema(description = "区域id", example = "18733")
private Integer areaId;
@Schema(description = "门店状态", example = "1")
@InEnum(CommonStatusEnum.class)
private Integer status;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import lombok.*;
import java.time.LocalTime;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_HOUR_MINUTE_SECOND;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 自提门店分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DeliveryPickUpStorePageReqVO extends PageParam {
@Schema(description = "门店名称", example = "李四")
private String name;
@Schema(description = "门店手机")
private String phone;
@Schema(description = "区域编号", example = "18733")
private Integer areaId;
@Schema(description = "门店状态", example = "1")
@InEnum(CommonStatusEnum.class)
private Integer status;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,19 @@
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 自提门店 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DeliveryPickUpStoreRespVO extends DeliveryPickUpStoreBaseVO {
@Schema(description = "编号", required = true, example = "23128")
private Long id;
@Schema(description = "创建时间", required = true)
private LocalDateTime createTime;
}

View File

@ -0,0 +1,18 @@
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 自提门店更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DeliveryPickUpStoreUpdateReqVO extends DeliveryPickUpStoreBaseVO {
@Schema(description = "编号", required = true, example = "23128")
@NotNull(message = "编号不能为空")
private Long id;
}

View File

@ -0,0 +1,43 @@
package cn.iocoder.yudao.module.trade.convert.delivery;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
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.DeliveryPickUpStoreExcelVO;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreRespVO;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreUpdateReqVO;
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Named;
import org.mapstruct.factory.Mappers;
@Mapper
public interface DeliveryPickUpStoreConvert {
DeliveryPickUpStoreConvert INSTANCE = Mappers.getMapper(DeliveryPickUpStoreConvert.class);
DeliveryPickUpStoreDO convert(DeliveryPickUpStoreCreateReqVO bean);
DeliveryPickUpStoreDO convert(DeliveryPickUpStoreUpdateReqVO bean);
DeliveryPickUpStoreRespVO convert(DeliveryPickUpStoreDO bean);
List<DeliveryPickUpStoreRespVO> convertList(List<DeliveryPickUpStoreDO> list);
PageResult<DeliveryPickUpStoreRespVO> convertPage(PageResult<DeliveryPickUpStoreDO> page);
List<DeliveryPickUpStoreExcelVO> convertList02(List<DeliveryPickUpStoreDO> list);
@Mapping(source = "areaId", target = "areaName", qualifiedByName = "convertAreaIdToName")
DeliveryPickUpStoreExcelVO convert2(DeliveryPickUpStoreDO bean);
@Named("convertAreaIdToName")
default String convertAreaIdToName(Integer areaId) {
return AreaUtils.format(areaId);
}
}

View File

@ -20,7 +20,7 @@ import java.time.LocalTime;
public class DeliveryPickUpStoreDO extends BaseDO {
/**
* 编号自增
* 编号
*/
@TableId
private Long id;
@ -41,7 +41,7 @@ public class DeliveryPickUpStoreDO extends BaseDO {
private String phone;
/**
* 区域 id
* 区域编号
*/
private Integer areaId;
@ -59,20 +59,20 @@ public class DeliveryPickUpStoreDO extends BaseDO {
* 营业开始时间
*/
private LocalTime openingTime;
/**
* 营业结束时间
*/
private LocalTime closingTime;
// TODO @Jason应该是 double
/**
* 纬度
*/
private String latitude;
private Double latitude;
/**
* 经度
*/
private String longitude;
private Double longitude;
/**
* 门店状态

View File

@ -1,11 +1,37 @@
package cn.iocoder.yudao.module.trade.dal.mysql.delivery;
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.delivery.vo.pickup.DeliveryPickUpStoreExportReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStorePageReqVO;
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface DeliveryPickUpStoreMapper extends BaseMapperX<DeliveryPickUpStoreDO> {
default PageResult<DeliveryPickUpStoreDO> selectPage(DeliveryPickUpStorePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<DeliveryPickUpStoreDO>()
.likeIfPresent(DeliveryPickUpStoreDO::getName, reqVO.getName())
.eqIfPresent(DeliveryPickUpStoreDO::getPhone, reqVO.getPhone())
.eqIfPresent(DeliveryPickUpStoreDO::getAreaId, reqVO.getAreaId())
.eqIfPresent(DeliveryPickUpStoreDO::getStatus, reqVO.getStatus())
.betweenIfPresent(DeliveryPickUpStoreDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(DeliveryPickUpStoreDO::getId));
}
default List<DeliveryPickUpStoreDO> selectList(DeliveryPickUpStoreExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<DeliveryPickUpStoreDO>()
.likeIfPresent(DeliveryPickUpStoreDO::getName, reqVO.getName())
.eqIfPresent(DeliveryPickUpStoreDO::getPhone, reqVO.getPhone())
.eqIfPresent(DeliveryPickUpStoreDO::getAreaId, reqVO.getAreaId())
.eqIfPresent(DeliveryPickUpStoreDO::getStatus, reqVO.getStatus())
.betweenIfPresent(DeliveryPickUpStoreDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(DeliveryPickUpStoreDO::getId));
}
}

View File

@ -0,0 +1,72 @@
package cn.iocoder.yudao.module.trade.service.delivery;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreCreateReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreExportReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStorePageReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreUpdateReqVO;
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
/**
* 自提门店 Service 接口
*
* @author jason
*/
public interface DeliveryPickUpStoreService {
/**
* 创建自提门店
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createDeliveryPickUpStore(@Valid DeliveryPickUpStoreCreateReqVO createReqVO);
/**
* 更新自提门店
*
* @param updateReqVO 更新信息
*/
void updateDeliveryPickUpStore(@Valid DeliveryPickUpStoreUpdateReqVO updateReqVO);
/**
* 删除自提门店
*
* @param id 编号
*/
void deleteDeliveryPickUpStore(Long id);
/**
* 获得自提门店
*
* @param id 编号
* @return 自提门店
*/
DeliveryPickUpStoreDO getDeliveryPickUpStore(Long id);
/**
* 获得自提门店列表
*
* @param ids 编号
* @return 自提门店列表
*/
List<DeliveryPickUpStoreDO> getDeliveryPickUpStoreList(Collection<Long> ids);
/**
* 获得自提门店分页
*
* @param pageReqVO 分页查询
* @return 自提门店分页
*/
PageResult<DeliveryPickUpStoreDO> getDeliveryPickUpStorePage(DeliveryPickUpStorePageReqVO pageReqVO);
/**
* 获得自提门店列表, 用于 Excel 导出
*
* @param exportReqVO 查询条件
* @return 自提门店列表
*/
List<DeliveryPickUpStoreDO> getDeliveryPickUpStoreList(DeliveryPickUpStoreExportReqVO exportReqVO);
}

View File

@ -0,0 +1,84 @@
package cn.iocoder.yudao.module.trade.service.delivery;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreCreateReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreExportReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStorePageReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreUpdateReqVO;
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.dal.mysql.delivery.DeliveryPickUpStoreMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.*;
/**
* 自提门店 Service 实现类
*
* @author jason
*/
@Service
@Validated
public class DeliveryPickUpStoreServiceImpl implements DeliveryPickUpStoreService {
@Resource
private DeliveryPickUpStoreMapper deliveryPickUpStoreMapper;
@Override
public Long createDeliveryPickUpStore(DeliveryPickUpStoreCreateReqVO createReqVO) {
// 插入
DeliveryPickUpStoreDO deliveryPickUpStore = DeliveryPickUpStoreConvert.INSTANCE.convert(createReqVO);
deliveryPickUpStoreMapper.insert(deliveryPickUpStore);
// 返回
return deliveryPickUpStore.getId();
}
@Override
public void updateDeliveryPickUpStore(DeliveryPickUpStoreUpdateReqVO updateReqVO) {
// 校验存在
validateDeliveryPickUpStoreExists(updateReqVO.getId());
// 更新
DeliveryPickUpStoreDO updateObj = DeliveryPickUpStoreConvert.INSTANCE.convert(updateReqVO);
deliveryPickUpStoreMapper.updateById(updateObj);
}
@Override
public void deleteDeliveryPickUpStore(Long id) {
// 校验存在
validateDeliveryPickUpStoreExists(id);
// 删除
deliveryPickUpStoreMapper.deleteById(id);
}
private void validateDeliveryPickUpStoreExists(Long id) {
if (deliveryPickUpStoreMapper.selectById(id) == null) {
throw exception(PICK_UP_STORE_NOT_EXISTS);
}
}
@Override
public DeliveryPickUpStoreDO getDeliveryPickUpStore(Long id) {
return deliveryPickUpStoreMapper.selectById(id);
}
@Override
public List<DeliveryPickUpStoreDO> getDeliveryPickUpStoreList(Collection<Long> ids) {
return deliveryPickUpStoreMapper.selectBatchIds(ids);
}
@Override
public PageResult<DeliveryPickUpStoreDO> getDeliveryPickUpStorePage(DeliveryPickUpStorePageReqVO pageReqVO) {
return deliveryPickUpStoreMapper.selectPage(pageReqVO);
}
@Override
public List<DeliveryPickUpStoreDO> getDeliveryPickUpStoreList(DeliveryPickUpStoreExportReqVO exportReqVO) {
return deliveryPickUpStoreMapper.selectList(exportReqVO);
}
}