Commit b3c1be108cbf4723d053981eb6d21a434f6f2096
1 parent
5ffea937
mall + trade:
1、增加门店自提的 mock 接口
Showing
4 changed files
with
135 additions
and
0 deletions
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/AppDeliverConfigController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.trade.controller.app.delivery; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 4 | +import cn.iocoder.yudao.module.trade.controller.app.delivery.vo.config.AppDeliveryConfigRespVO; | ||
| 5 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 6 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 7 | +import org.springframework.validation.annotation.Validated; | ||
| 8 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 10 | +import org.springframework.web.bind.annotation.RestController; | ||
| 11 | + | ||
| 12 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 13 | + | ||
| 14 | +@Tag(name = "用户 App - 配送配置") | ||
| 15 | +@RestController | ||
| 16 | +@RequestMapping("/trade/delivery/config") | ||
| 17 | +@Validated | ||
| 18 | +public class AppDeliverConfigController { | ||
| 19 | + | ||
| 20 | + @GetMapping("/get") | ||
| 21 | + @Operation(summary = "获得配送配置") | ||
| 22 | + public CommonResult<AppDeliveryConfigRespVO> getDeliveryConfig() { | ||
| 23 | + return success(new AppDeliveryConfigRespVO().setPickUpEnable(true).setTencentLbsKey("123456")); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | +} |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/AppDeliverPickUpStoreController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.trade.controller.app.delivery; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.util.RandomUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 5 | +import cn.iocoder.yudao.module.trade.controller.app.delivery.vo.pickup.AppDeliveryPickUpStoreRespVO; | ||
| 6 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 7 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 8 | +import org.springframework.validation.annotation.Validated; | ||
| 9 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 10 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 11 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 12 | +import org.springframework.web.bind.annotation.RestController; | ||
| 13 | + | ||
| 14 | +import java.util.ArrayList; | ||
| 15 | +import java.util.List; | ||
| 16 | +import java.util.Random; | ||
| 17 | + | ||
| 18 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 19 | + | ||
| 20 | +@Tag(name = "用户 App - 门店自提") | ||
| 21 | +@RestController | ||
| 22 | +@RequestMapping("/trade/delivery/pick-up-store") | ||
| 23 | +@Validated | ||
| 24 | +public class AppDeliverPickUpStoreController { | ||
| 25 | + | ||
| 26 | + @GetMapping("/list") | ||
| 27 | + @Operation(summary = "获得自提门店列表") | ||
| 28 | + public CommonResult<List<AppDeliveryPickUpStoreRespVO>> getDeliveryPickUpStoreList( | ||
| 29 | + @RequestParam(value = "latitude", required = false) Double latitude, | ||
| 30 | + @RequestParam(value = "longitude", required = false) Double longitude) { | ||
| 31 | + List<AppDeliveryPickUpStoreRespVO> list = new ArrayList<>(); | ||
| 32 | + Random random = new Random(); | ||
| 33 | + for (int i = 0; i < 10; i++) { | ||
| 34 | + AppDeliveryPickUpStoreRespVO store = new AppDeliveryPickUpStoreRespVO(); | ||
| 35 | + store.setId(random.nextLong()); | ||
| 36 | + store.setName(RandomUtil.randomString(10)); | ||
| 37 | + store.setLogo("https://www.iocoder.cn/" + (i + 1) + ".png"); | ||
| 38 | + store.setPhone("15601691300"); | ||
| 39 | + store.setAreaId(random.nextInt(100000)); | ||
| 40 | + store.setAreaName(RandomUtil.randomString(10)); | ||
| 41 | + store.setDetailAddress(RandomUtil.randomString(10)); | ||
| 42 | + store.setLatitude(random.nextDouble() * 10); | ||
| 43 | + store.setLongitude(random.nextDouble() * 10); | ||
| 44 | + store.setDistance(random.nextInt(1000)); | ||
| 45 | + | ||
| 46 | + list.add(store); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + return success(list); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | +} |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/vo/config/AppDeliveryConfigRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.trade.controller.app.delivery.vo.config; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +// TODO 芋艿:后续要实现下,配送配置 | ||
| 7 | +@Schema(description = "用户 App - 配送配置 Response VO") | ||
| 8 | +@Data | ||
| 9 | +public class AppDeliveryConfigRespVO { | ||
| 10 | + | ||
| 11 | + @Schema(description = "腾讯地图 KEY", required = true, example = "123456") | ||
| 12 | + private String tencentLbsKey; | ||
| 13 | + | ||
| 14 | + @Schema(description = "是否开启自提", required = true, example = "true") | ||
| 15 | + private Boolean pickUpEnable; | ||
| 16 | + | ||
| 17 | +} |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/delivery/vo/pickup/AppDeliveryPickUpStoreRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.trade.controller.app.delivery.vo.pickup; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +@Schema(description = "用户 App - 自提门店 Response VO") | ||
| 7 | +@Data | ||
| 8 | +public class AppDeliveryPickUpStoreRespVO { | ||
| 9 | + | ||
| 10 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23128") | ||
| 11 | + private Long id; | ||
| 12 | + | ||
| 13 | + @Schema(description = "门店名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") | ||
| 14 | + private String name; | ||
| 15 | + | ||
| 16 | + @Schema(description = "门店 logo", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.png") | ||
| 17 | + private String logo; | ||
| 18 | + | ||
| 19 | + @Schema(description = "门店手机", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601892312") | ||
| 20 | + private String phone; | ||
| 21 | + | ||
| 22 | + @Schema(description = "区域编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18733") | ||
| 23 | + private Integer areaId; | ||
| 24 | + | ||
| 25 | + @Schema(description = "地区名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "上海上海市普陀区") | ||
| 26 | + private String areaName; | ||
| 27 | + | ||
| 28 | + @Schema(description = "门店详细地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "复旦大学路 188 号") | ||
| 29 | + private String detailAddress; | ||
| 30 | + | ||
| 31 | + @Schema(description = "纬度", requiredMode = Schema.RequiredMode.REQUIRED, example = "5.88") | ||
| 32 | + private Double latitude; | ||
| 33 | + | ||
| 34 | + @Schema(description = "经度", requiredMode = Schema.RequiredMode.REQUIRED, example = "6.99") | ||
| 35 | + private Double longitude; | ||
| 36 | + | ||
| 37 | + @Schema(description = "距离,单位:米", example = "100") // 只有在用户传递了经纬度时,才进行计算 | ||
| 38 | + private Integer distance; | ||
| 39 | + | ||
| 40 | +} |