mall + trade:

1、增加门店自提的 mock 接口
This commit is contained in:
YunaiV 2023-06-29 00:24:45 +08:00
parent 5ffea93731
commit b3c1be108c
4 changed files with 135 additions and 0 deletions

View File

@ -0,0 +1,26 @@
package cn.iocoder.yudao.module.trade.controller.app.delivery;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.trade.controller.app.delivery.vo.config.AppDeliveryConfigRespVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "用户 App - 配送配置")
@RestController
@RequestMapping("/trade/delivery/config")
@Validated
public class AppDeliverConfigController {
@GetMapping("/get")
@Operation(summary = "获得配送配置")
public CommonResult<AppDeliveryConfigRespVO> getDeliveryConfig() {
return success(new AppDeliveryConfigRespVO().setPickUpEnable(true).setTencentLbsKey("123456"));
}
}

View File

@ -0,0 +1,52 @@
package cn.iocoder.yudao.module.trade.controller.app.delivery;
import cn.hutool.core.util.RandomUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.trade.controller.app.delivery.vo.pickup.AppDeliveryPickUpStoreRespVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
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 java.util.List;
import java.util.Random;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "用户 App - 门店自提")
@RestController
@RequestMapping("/trade/delivery/pick-up-store")
@Validated
public class AppDeliverPickUpStoreController {
@GetMapping("/list")
@Operation(summary = "获得自提门店列表")
public CommonResult<List<AppDeliveryPickUpStoreRespVO>> getDeliveryPickUpStoreList(
@RequestParam(value = "latitude", required = false) Double latitude,
@RequestParam(value = "longitude", required = false) Double longitude) {
List<AppDeliveryPickUpStoreRespVO> 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);
}
}

View File

@ -0,0 +1,17 @@
package cn.iocoder.yudao.module.trade.controller.app.delivery.vo.config;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
// TODO 芋艿后续要实现下配送配置
@Schema(description = "用户 App - 配送配置 Response VO")
@Data
public class AppDeliveryConfigRespVO {
@Schema(description = "腾讯地图 KEY", required = true, example = "123456")
private String tencentLbsKey;
@Schema(description = "是否开启自提", required = true, example = "true")
private Boolean pickUpEnable;
}

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.module.trade.controller.app.delivery.vo.pickup;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "用户 App - 自提门店 Response VO")
@Data
public class AppDeliveryPickUpStoreRespVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23128")
private Long id;
@Schema(description = "门店名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
private String name;
@Schema(description = "门店 logo", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.png")
private String logo;
@Schema(description = "门店手机", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601892312")
private String phone;
@Schema(description = "区域编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18733")
private Integer areaId;
@Schema(description = "地区名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "上海上海市普陀区")
private String areaName;
@Schema(description = "门店详细地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "复旦大学路 188 号")
private String detailAddress;
@Schema(description = "纬度", requiredMode = Schema.RequiredMode.REQUIRED, example = "5.88")
private Double latitude;
@Schema(description = "经度", requiredMode = Schema.RequiredMode.REQUIRED, example = "6.99")
private Double longitude;
@Schema(description = "距离,单位:米", example = "100") // 只有在用户传递了经纬度时才进行计算
private Integer distance;
}