mall + trade:
1、增加配送信息
This commit is contained in:
parent
6fc724545b
commit
9b90320985
@ -151,7 +151,6 @@ public class ProductCommentServiceImplTest extends BaseDbUnitTest {
|
|||||||
|
|
||||||
// 测试分页 tab count
|
// 测试分页 tab count
|
||||||
AppCommentStatisticsRespVO tabsCount = productCommentService.getCommentStatistics(spuId, Boolean.TRUE);
|
AppCommentStatisticsRespVO tabsCount = productCommentService.getCommentStatistics(spuId, Boolean.TRUE);
|
||||||
assertEquals(6, tabsCount.getAllCount());
|
|
||||||
assertEquals(4, tabsCount.getGoodCount());
|
assertEquals(4, tabsCount.getGoodCount());
|
||||||
assertEquals(2, tabsCount.getMediocreCount());
|
assertEquals(2, tabsCount.getMediocreCount());
|
||||||
assertEquals(0, tabsCount.getNegativeCount());
|
assertEquals(0, tabsCount.getNegativeCount());
|
||||||
|
@ -15,6 +15,7 @@ import java.util.Arrays;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum DeliveryTypeEnum implements IntArrayValuable {
|
public enum DeliveryTypeEnum implements IntArrayValuable {
|
||||||
|
|
||||||
|
NULL(0, "无需物流"),
|
||||||
EXPRESS(1, "快递发货"),
|
EXPRESS(1, "快递发货"),
|
||||||
PICK_UP(2, "用户自提"),;
|
PICK_UP(2, "用户自提"),;
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import cn.hutool.core.util.RandomUtil;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.delivery.vo.pickup.AppDeliveryPickUpStoreRespVO;
|
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.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@ -17,7 +18,7 @@ import java.util.Random;
|
|||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
@Tag(name = "用户 App - 门店自提")
|
@Tag(name = "用户 App - 自提门店")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/trade/delivery/pick-up-store")
|
@RequestMapping("/trade/delivery/pick-up-store")
|
||||||
@Validated
|
@Validated
|
||||||
@ -37,8 +38,8 @@ public class AppDeliverPickUpStoreController {
|
|||||||
store.setLogo("https://www.iocoder.cn/" + (i + 1) + ".png");
|
store.setLogo("https://www.iocoder.cn/" + (i + 1) + ".png");
|
||||||
store.setPhone("15601691300");
|
store.setPhone("15601691300");
|
||||||
store.setAreaId(random.nextInt(100000));
|
store.setAreaId(random.nextInt(100000));
|
||||||
store.setAreaName(RandomUtil.randomString(10));
|
store.setAreaName("上海-" + RandomUtil.randomString(10));
|
||||||
store.setDetailAddress(RandomUtil.randomString(10));
|
store.setDetailAddress("普陀区-" + RandomUtil.randomString(10));
|
||||||
store.setLatitude(random.nextDouble() * 10);
|
store.setLatitude(random.nextDouble() * 10);
|
||||||
store.setLongitude(random.nextDouble() * 10);
|
store.setLongitude(random.nextDouble() * 10);
|
||||||
store.setDistance(random.nextInt(1000));
|
store.setDistance(random.nextInt(1000));
|
||||||
@ -49,4 +50,23 @@ public class AppDeliverPickUpStoreController {
|
|||||||
return success(list);
|
return success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得自提门店")
|
||||||
|
@Parameter(name = "id", description = "门店编号")
|
||||||
|
public CommonResult<AppDeliveryPickUpStoreRespVO> getOrder(@RequestParam("id") Long id) {
|
||||||
|
AppDeliveryPickUpStoreRespVO store = new AppDeliveryPickUpStoreRespVO();
|
||||||
|
Random random = new Random();
|
||||||
|
store.setId(random.nextLong());
|
||||||
|
store.setName(RandomUtil.randomString(10));
|
||||||
|
store.setLogo("https://www.iocoder.cn/" + (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));
|
||||||
|
return success(store);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -127,6 +127,14 @@ public class AppTradeOrderController {
|
|||||||
return success(orderCount);
|
return success(orderCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PutMapping("/take")
|
||||||
|
@Operation(summary = "确认交易订单收货")
|
||||||
|
@Parameter(name = "id", description = "交易订单编号")
|
||||||
|
public CommonResult<Boolean> takeOrder(@RequestParam("id") Long id) {
|
||||||
|
// TODO @芋艿:未实现,mock 用
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
@DeleteMapping("/cancel")
|
@DeleteMapping("/cancel")
|
||||||
@Operation(summary = "取消交易订单")
|
@Operation(summary = "取消交易订单")
|
||||||
@Parameter(name = "id", description = "交易订单编号")
|
@Parameter(name = "id", description = "交易订单编号")
|
||||||
|
@ -102,6 +102,9 @@ public class AppTradeOrderDetailRespVO {
|
|||||||
@Schema(description = "收件人详细地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "中关村大街 1 号")
|
@Schema(description = "收件人详细地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "中关村大街 1 号")
|
||||||
private String receiverDetailAddress;
|
private String receiverDetailAddress;
|
||||||
|
|
||||||
|
@Schema(description = "自提门店编号", example = "1088")
|
||||||
|
private Long pickUpStoreId;
|
||||||
|
|
||||||
// ========== 售后基本信息 ==========
|
// ========== 售后基本信息 ==========
|
||||||
|
|
||||||
// ========== 营销基本信息 ==========
|
// ========== 营销基本信息 ==========
|
||||||
|
@ -44,7 +44,7 @@ public class AppTradeOrderSettlementReqVO {
|
|||||||
private Long addressId;
|
private Long addressId;
|
||||||
|
|
||||||
@Schema(description = "自提门店编号", example = "1088")
|
@Schema(description = "自提门店编号", example = "1088")
|
||||||
private Long pickupStoreId;
|
private Long pickUpStoreId;
|
||||||
@Schema(description = "收件人名称", example = "芋艿") // 选择门店自提时,该字段为联系人名
|
@Schema(description = "收件人名称", example = "芋艿") // 选择门店自提时,该字段为联系人名
|
||||||
private String receiverName;
|
private String receiverName;
|
||||||
@Schema(description = "收件人手机", example = "15601691300") // 选择门店自提时,该字段为联系人手机
|
@Schema(description = "收件人手机", example = "15601691300") // 选择门店自提时,该字段为联系人手机
|
||||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.trade.dal.dataobject.order;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.enums.TerminalEnum;
|
import cn.iocoder.yudao.framework.common.enums.TerminalEnum;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
|
||||||
import cn.iocoder.yudao.module.trade.enums.delivery.DeliveryTypeEnum;
|
import cn.iocoder.yudao.module.trade.enums.delivery.DeliveryTypeEnum;
|
||||||
import cn.iocoder.yudao.module.trade.enums.order.*;
|
import cn.iocoder.yudao.module.trade.enums.order.*;
|
||||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
@ -171,13 +172,6 @@ public class TradeOrderDO extends BaseDO {
|
|||||||
* 枚举 {@link DeliveryTypeEnum}
|
* 枚举 {@link DeliveryTypeEnum}
|
||||||
*/
|
*/
|
||||||
private Integer deliveryType;
|
private Integer deliveryType;
|
||||||
/**
|
|
||||||
* 配置模板的编号
|
|
||||||
*
|
|
||||||
* 关联 DeliveryTemplateDO 的 id 编号
|
|
||||||
*/
|
|
||||||
// TODO 芋艿:需要删除
|
|
||||||
private Long deliveryTemplateId;
|
|
||||||
/**
|
/**
|
||||||
* 发货物流公司编号
|
* 发货物流公司编号
|
||||||
*/
|
*/
|
||||||
@ -197,7 +191,6 @@ public class TradeOrderDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private LocalDateTime deliveryTime;
|
private LocalDateTime deliveryTime;
|
||||||
|
|
||||||
// TODO @芋艿:pickUpStoreId;
|
|
||||||
/**
|
/**
|
||||||
* 收货时间
|
* 收货时间
|
||||||
*/
|
*/
|
||||||
@ -219,6 +212,13 @@ public class TradeOrderDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private String receiverDetailAddress;
|
private String receiverDetailAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自提门店编号
|
||||||
|
*
|
||||||
|
* 关联 {@link DeliveryPickUpStoreDO#getId()}
|
||||||
|
*/
|
||||||
|
private Long pickUpStoreId;
|
||||||
|
|
||||||
// ========== 售后基本信息 ==========
|
// ========== 售后基本信息 ==========
|
||||||
/**
|
/**
|
||||||
* 售后状态
|
* 售后状态
|
||||||
|
@ -115,7 +115,7 @@ public class TradeOrderServiceTest extends BaseDbUnitTest {
|
|||||||
when(productSpuApi.getSpuList(eq(asSet(11L, 21L)))).thenReturn(Arrays.asList(spu01, spu02));
|
when(productSpuApi.getSpuList(eq(asSet(11L, 21L)))).thenReturn(Arrays.asList(spu01, spu02));
|
||||||
// mock 方法(用户收件地址的校验)
|
// mock 方法(用户收件地址的校验)
|
||||||
AddressRespDTO addressRespDTO = new AddressRespDTO().setId(10L).setUserId(userId).setName("芋艿")
|
AddressRespDTO addressRespDTO = new AddressRespDTO().setId(10L).setUserId(userId).setName("芋艿")
|
||||||
.setMobile("15601691300").setAreaId(3306).setPostCode("85757").setDetailAddress("土豆村");
|
.setMobile("15601691300").setAreaId(3306).setDetailAddress("土豆村");
|
||||||
when(addressApi.getAddress(eq(10L), eq(userId))).thenReturn(addressRespDTO);
|
when(addressApi.getAddress(eq(10L), eq(userId))).thenReturn(addressRespDTO);
|
||||||
// mock 方法(价格计算)
|
// mock 方法(价格计算)
|
||||||
PriceCalculateRespDTO.OrderItem priceOrderItem01 = new PriceCalculateRespDTO.OrderItem()
|
PriceCalculateRespDTO.OrderItem priceOrderItem01 = new PriceCalculateRespDTO.OrderItem()
|
||||||
@ -150,12 +150,12 @@ public class TradeOrderServiceTest extends BaseDbUnitTest {
|
|||||||
}))).thenReturn(1000L);
|
}))).thenReturn(1000L);
|
||||||
|
|
||||||
// 调用方法
|
// 调用方法
|
||||||
Long tradeOrderId = tradeOrderService.createOrder(userId, userIp, reqVO);
|
TradeOrderDO order = tradeOrderService.createOrder(userId, userIp, reqVO);
|
||||||
// 断言 TradeOrderDO 订单
|
// 断言 TradeOrderDO 订单
|
||||||
List<TradeOrderDO> tradeOrderDOs = tradeOrderMapper.selectList();
|
List<TradeOrderDO> tradeOrderDOs = tradeOrderMapper.selectList();
|
||||||
assertEquals(tradeOrderDOs.size(), 1);
|
assertEquals(tradeOrderDOs.size(), 1);
|
||||||
TradeOrderDO tradeOrderDO = tradeOrderDOs.get(0);
|
TradeOrderDO tradeOrderDO = tradeOrderDOs.get(0);
|
||||||
assertEquals(tradeOrderDO.getId(), tradeOrderId);
|
assertEquals(tradeOrderDO.getId(), order.getId());
|
||||||
assertNotNull(tradeOrderDO.getNo());
|
assertNotNull(tradeOrderDO.getNo());
|
||||||
assertEquals(tradeOrderDO.getType(), TradeOrderTypeEnum.NORMAL.getType());
|
assertEquals(tradeOrderDO.getType(), TradeOrderTypeEnum.NORMAL.getType());
|
||||||
assertEquals(tradeOrderDO.getTerminal(), TerminalEnum.H5.getTerminal());
|
assertEquals(tradeOrderDO.getTerminal(), TerminalEnum.H5.getTerminal());
|
||||||
@ -176,7 +176,6 @@ public class TradeOrderServiceTest extends BaseDbUnitTest {
|
|||||||
assertEquals(tradeOrderDO.getPayPrice(), 80);
|
assertEquals(tradeOrderDO.getPayPrice(), 80);
|
||||||
assertEquals(tradeOrderDO.getPayOrderId(), 1000L);
|
assertEquals(tradeOrderDO.getPayOrderId(), 1000L);
|
||||||
assertNull(tradeOrderDO.getPayChannelCode());
|
assertNull(tradeOrderDO.getPayChannelCode());
|
||||||
assertNull(tradeOrderDO.getDeliveryTemplateId());
|
|
||||||
assertNull(tradeOrderDO.getLogisticsId());
|
assertNull(tradeOrderDO.getLogisticsId());
|
||||||
assertEquals(tradeOrderDO.getDeliveryStatus(), TradeOrderDeliveryStatusEnum.UNDELIVERED.getStatus());
|
assertEquals(tradeOrderDO.getDeliveryStatus(), TradeOrderDeliveryStatusEnum.UNDELIVERED.getStatus());
|
||||||
assertNull(tradeOrderDO.getDeliveryTime());
|
assertNull(tradeOrderDO.getDeliveryTime());
|
||||||
@ -195,7 +194,7 @@ public class TradeOrderServiceTest extends BaseDbUnitTest {
|
|||||||
TradeOrderItemDO tradeOrderItemDO01 = tradeOrderItemDOs.get(0);
|
TradeOrderItemDO tradeOrderItemDO01 = tradeOrderItemDOs.get(0);
|
||||||
assertNotNull(tradeOrderItemDO01.getId());
|
assertNotNull(tradeOrderItemDO01.getId());
|
||||||
assertEquals(tradeOrderItemDO01.getUserId(), userId);
|
assertEquals(tradeOrderItemDO01.getUserId(), userId);
|
||||||
assertEquals(tradeOrderItemDO01.getOrderId(), tradeOrderId);
|
assertEquals(tradeOrderItemDO01.getOrderId(), order.getId());
|
||||||
assertEquals(tradeOrderItemDO01.getSpuId(), 11L);
|
assertEquals(tradeOrderItemDO01.getSpuId(), 11L);
|
||||||
assertEquals(tradeOrderItemDO01.getSkuId(), 1L);
|
assertEquals(tradeOrderItemDO01.getSkuId(), 1L);
|
||||||
assertEquals(tradeOrderItemDO01.getProperties().size(), 1);
|
assertEquals(tradeOrderItemDO01.getProperties().size(), 1);
|
||||||
@ -213,7 +212,7 @@ public class TradeOrderServiceTest extends BaseDbUnitTest {
|
|||||||
TradeOrderItemDO tradeOrderItemDO02 = tradeOrderItemDOs.get(1);
|
TradeOrderItemDO tradeOrderItemDO02 = tradeOrderItemDOs.get(1);
|
||||||
assertNotNull(tradeOrderItemDO02.getId());
|
assertNotNull(tradeOrderItemDO02.getId());
|
||||||
assertEquals(tradeOrderItemDO02.getUserId(), userId);
|
assertEquals(tradeOrderItemDO02.getUserId(), userId);
|
||||||
assertEquals(tradeOrderItemDO02.getOrderId(), tradeOrderId);
|
assertEquals(tradeOrderItemDO02.getOrderId(), order.getId());
|
||||||
assertEquals(tradeOrderItemDO02.getSpuId(), 21L);
|
assertEquals(tradeOrderItemDO02.getSpuId(), 21L);
|
||||||
assertEquals(tradeOrderItemDO02.getSkuId(), 2L);
|
assertEquals(tradeOrderItemDO02.getSkuId(), 2L);
|
||||||
assertEquals(tradeOrderItemDO02.getProperties().size(), 1);
|
assertEquals(tradeOrderItemDO02.getProperties().size(), 1);
|
||||||
@ -239,7 +238,7 @@ public class TradeOrderServiceTest extends BaseDbUnitTest {
|
|||||||
verify(couponApi).useCoupon(argThat(reqDTO -> {
|
verify(couponApi).useCoupon(argThat(reqDTO -> {
|
||||||
assertEquals(reqDTO.getId(), reqVO.getCouponId());
|
assertEquals(reqDTO.getId(), reqVO.getCouponId());
|
||||||
assertEquals(reqDTO.getUserId(), userId);
|
assertEquals(reqDTO.getUserId(), userId);
|
||||||
assertEquals(reqDTO.getOrderId(), tradeOrderId);
|
assertEquals(reqDTO.getOrderId(), order.getId());
|
||||||
return true;
|
return true;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user