1.迁移application代码

2.更改实体后缀为request、response
This commit is contained in:
xiaofeng
2020-05-08 23:12:48 +08:00
parent 956bdb5396
commit 249dc086c6
38 changed files with 766 additions and 943 deletions

View File

@@ -0,0 +1,47 @@
package cn.iocoder.mall.order.rest.controller.admins;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 订单退货
*
* @author Sin
* @time 2019-05-06 21:31
*/
@RestController
@RequestMapping("admins/order_return")
@Api("订单退货(admins api)")
public class AdminOrderReturnController {
// @Reference(validation = "true", version = "${dubbo.provider.OrderReturnService.version}")
// private OrderReturnService orderReturnService;
//
// @GetMapping("list")
// public CommonResult<OrderReturnListBO> list(@Validated OrderReturnQueryPO queryPO) {
// OrderReturnQueryDTO queryDTO = OrderReturnConvert.INSTANCE.convert(queryPO);
// return orderReturnService.orderReturnList(queryDTO);
// }
//
// @PostMapping("agree")
// public CommonResult agree(@RequestParam("id") Integer id) {
// return orderReturnService.orderReturnAgree(id);
// }
//
// @PostMapping("refuse")
// public CommonResult refuse(@RequestParam("id") Integer id) {
// return orderReturnService.orderReturnRefuse(id);
// }
//
// @PostMapping("confirm_receipt")
// public CommonResult confirmReceipt(@RequestParam("id") Integer id) {
// return orderReturnService.confirmReceipt(id);
// }
//
// @PostMapping("confirm_refund")
// public CommonResult confirmRefund(HttpServletRequest request, @RequestParam("id") Integer id) {
// String ip = HttpUtil.getIp(request);
// return orderReturnService.refund(id, ip);
// }
}

View File

@@ -0,0 +1,83 @@
package cn.iocoder.mall.order.rest.controller.admins;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 订单API(admins)
*
* @author Sin
* @time 2019-03-24 10:22
*/
@RestController
@RequestMapping("admins/order")
@Api(value = "订单 API(admins)")
public class AdminsOrderController {
// @Reference(validation = "true", version = "${dubbo.provider.OrderService.version}")
// private OrderService orderService;
//
// @GetMapping("page")
// @ApiOperation("订单列表")
// public CommonResult<OrderPageBO> getOrderPage(@Validated OrderPageQueryPO orderPageQueryVO) {
// OrderQueryDTO orderQueryDTO = OrderConvertAPP.INSTANCE.convert(orderPageQueryVO);
// return orderService.getOrderPage(orderQueryDTO);
// }
//
// @GetMapping("order_items")
// @ApiOperation("订单列表")
// public CommonResult<List<OrderItemBO>> getOrderItems(@RequestParam("orderId") Integer orderId) {
// return orderService.getOrderItems(orderId);
// }
//
// @GetMapping("order_recipient_info")
// @ApiOperation("订单收件人信息")
// public CommonResult<OrderRecipientBO> getOrderRecipientBO(@RequestParam("orderId") Integer orderId) {
// return orderService.getOrderRecipientBO(orderId);
// }
//
// @PostMapping("order_deliver")
// @ApiOperation("订单发货")
// public CommonResult<OrderRecipientBO> orderDeliver(@RequestBody @Validated OrderDeliverPO orderDeliverPO) {
// return orderService.orderDelivery(OrderDeliveryConvert.INSTANCE.convert(orderDeliverPO));
// }
//
// @PutMapping("update_remark")
// @ApiOperation("更新-更新订单备注")
// public CommonResult updateRemark(@RequestParam("orderId") Integer orderId,
// @RequestParam("remark") String remark) {
// return orderService.updateOrderRemake(orderId, remark);
// }
//
// @PutMapping("cancel_order")
// @ApiOperation("取消订单")
// public CommonResult cancelOrder(
// @RequestParam("orderId") Integer orderId,
// @RequestParam("reasons") Integer reasons,
// @RequestParam(value = "otherReasons", required = false) String otherReasons) {
// return orderService.cancelOrder(orderId, reasons, otherReasons);
// }
//
// @PutMapping("order_item/update_pay_amount")
// @ApiOperation("更新-订单item实付金额")
// public CommonResult updateOrderItemPayAmount(@RequestParam("orderId") Integer orderId,
// @RequestParam("orderItemId") Integer orderItemId,
// @RequestParam("payAmount") Integer payAmount) {
// return orderService.updateOrderItemPayAmount(orderId, orderItemId, payAmount);
// }
//
// @PutMapping("order_item/update")
// @ApiOperation("更新-订单item")
// public CommonResult updateOrderItem(@RequestBody @Validated OrderItemUpdatePO orderItemUpdateVO) {
// OrderItemUpdateDTO dto = OrderConvertAPP.INSTANCE.convert(orderItemUpdateVO);
// return orderService.updateOrderItem(dto);
// }
//
// @PutMapping("logistics/update")
// @ApiOperation("更新-订单物流")
// public CommonResult updateLogistics(@RequestBody @Validated OrderLogisticsPO orderLogisticsVO) {
// OrderLogisticsUpdateDTO dto = OrderConvertAPP.INSTANCE.convert(orderLogisticsVO);
// return orderService.updateLogistics(dto);
// }
}

View File

@@ -0,0 +1,61 @@
package cn.iocoder.mall.order.rest.controller.users;
import cn.iocoder.common.framework.constant.MallConstants;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
*
* 订单评论 Api(user)
*
* @author wtz
* @time 2019-05-27 20:46
*/
@RestController
@RequestMapping(MallConstants.ROOT_PATH_USER + "/order_comment")
@Api("用户评论模块")
public class OrderCommentController {
// @Reference(validation = "true", version = "${dubbo.provider.OrderCommentService.version}")
// private OrderCommentService orderCommentService;
//
// @Reference(validation = "true", version = "${dubbo.provider.OrderCommentReplyService.version}")
// private OrderCommentReplyService orderCommentReplyService;
//
//
// @PostMapping("create_order_comment")
// //@RequiresLogin
// @ApiOperation(value = "创建订单评论")
// public CommonResult<OrderCommentCreateBO> createOrderComment(@RequestBody @Validated OrderCommentCreateDTO orderCommentCreateDTO) {
// Integer userId = UserSecurityContextHolder.getContext().getUserId();
// orderCommentCreateDTO.setUserId(userId);
// return success(orderCommentService.createOrderComment(orderCommentCreateDTO));
// }
//
// @GetMapping("order_comment_page")
// @ApiOperation(value = "获取评论分页")
// public CommonResult<OrderCommentPageBO> getOrderCommentPage(@Validated OrderCommentPageDTO orderCommentPageDTO){
// return success(orderCommentService.getOrderCommentPage(orderCommentPageDTO));
// }
//
// @GetMapping("order_comment_info_merchant_reply")
// @ApiOperation(value = "获取评论和商家回复")
// public CommonResult<OrderCommentInfoAndMerchantReplyBO> geOrderCommentInfoAndMerchantReply(@RequestParam("commentId") Integer commentId){
// OrderCommentInfoAndMerchantReplyBO orderCommentInfoAndMerchantReplyBO=new OrderCommentInfoAndMerchantReplyBO();
// orderCommentInfoAndMerchantReplyBO.setOrderCommentInfoBO(orderCommentService.getOrderCommentInfo(commentId));
// orderCommentInfoAndMerchantReplyBO.setOrderCommentMerchantReplyBOS(orderCommentReplyService.getOrderCommentMerchantReply(commentId));
// return success(orderCommentInfoAndMerchantReplyBO);
// }
//
// @GetMapping
// //@RequiresLogin
// @ApiOperation(value = "获取订单评论状态分页")
// public CommonResult<OrderCommentStateInfoPageBO> getOrderCommentStateInfoPage(@Validated OrderCommentStateInfoPageDTO orderCommentStateInfoPageDTO){
// //Integer userId = UserSecurityContextHolder.getContext().getUserId();
// //orderCommentStateInfoPageDTO.setUserId(userId);
// return success(orderCommentService.getOrderCommentStateInfoPage(orderCommentStateInfoPageDTO));
// }
}

View File

@@ -0,0 +1,37 @@
package cn.iocoder.mall.order.rest.controller.users;
import cn.iocoder.common.framework.constant.MallConstants;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
*
* 评论回复模块 Api(user)
*
* @author wtz
* @time 2019-05-31 18:00
*/
@RestController
@RequestMapping(MallConstants.ROOT_PATH_USER + "/order_comment_reply")
@Api("用户评论回复模块 ")
public class OrderCommentReplyController {
// @Reference(validation = "true", version = "${dubbo.provider.OrderCommentService.version}")
// private OrderCommentReplyService orderCommentReplyService;
//
// @PostMapping("create_order_comment_reply")
// //@RequiresLogin
// @ApiOperation(value = "创建订单回复")
// public CommonResult<OrderCommentReplyCreateBO> createOrderCommentReply(@RequestBody @Validated OrderCommentReplyCreateDTO orderCommentReplyCreateDTO){
// return success(orderCommentReplyService.createOrderCommentReply(orderCommentReplyCreateDTO));
// }
//
// @GetMapping("order_comment_reply_page")
// //@RequiresLogin
// @ApiOperation(value = "分页获取评论回复")
// public CommonResult<OrderCommentReplyPageBO> getOrderCommentReplyPage(@Validated OrderCommentReplyPageDTO orderCommentReplyCreateDTO){
// return success(orderCommentReplyService.getOrderCommentReplyPage(orderCommentReplyCreateDTO));
// }
}

View File

@@ -0,0 +1,123 @@
package cn.iocoder.mall.order.rest.controller.users;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 订单API(users)
*
* @author Sin
* @time 2019-03-24 11:24
*/
@RestController
@RequestMapping("users/order")
@Api(description = "用户订单") // TODO FROM 芋艿 to 小范description 已经废弃啦
public class OrderController {
// @Reference(validation = "true", version = "${dubbo.provider.OrderReturnService.version}")
// private OrderService orderService;
//
// @Reference(validation = "true", version = "${dubbo.provider.CartService.version}")
// private CartService cartService;
//
// @Reference(validation = "true", version = "${dubbo.consumer.DataDictService.version}")
// private DataDictService dataDictService;
//
// @Reference(validation = "true", version = "${dubbo.consumer.CouponService.version}")
// private CouponService couponService;
//
// @GetMapping("order_page")
// @RequiresLogin
// @ApiOperation("订单分页")
// public CommonResult<OrderPageBO> getOrderPage(@Validated OrderQueryDTO orderQueryDTO) {
// Integer userId = UserSecurityContextHolder.getContext().getUserId();
// orderQueryDTO.setUserId(userId);
// return orderService.getOrderPage(orderQueryDTO);
// }
//
// @PostMapping("create_order")
// @RequiresLogin
// @ApiOperation("创建订单")
// public CommonResult<OrderCreateBO> createOrder(@RequestBody @Validated OrderCreatePO orderCreatePO,
// HttpServletRequest request) {
// Integer userId = UserSecurityContextHolder.getContext().getUserId();
// OrderCreateDTO orderCreateDTO = OrderConvertAPP.INSTANCE.convert(orderCreatePO);
// orderCreateDTO.setUserId(userId).setIp(HttpUtil.getIp(request));
// return orderService.createOrder(orderCreateDTO);
// }
//
// @PostMapping("create_order_from_cart")
// @RequiresLogin
// @ApiOperation("创建订单购物车")
// public CommonResult<OrderCreateBO> createOrderFromCart(@RequestParam("userAddressId") Integer userAddressId,
// @RequestParam(value = "couponCardId", required = false) Integer couponCardId,
// @RequestParam(value = "remark", required = false) String remark,
// HttpServletRequest request) {
// Integer userId = UserSecurityContextHolder.getContext().getUserId();
// // 获得购物车中选中的商品
// List<CartItemBO> cartItems = cartService.list(userId, true);
// if (cartItems.isEmpty()) {
// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_CREATE_CART_IS_EMPTY.getCode());
// }
// // 创建 OrderCreateDTO 对象
// OrderCreateDTO orderCreateDTO = OrderConvertAPP.INSTANCE.createOrderCreateDTO(userId, userAddressId,
// remark, HttpUtil.getIp(request),
// cartItems, couponCardId);
// // 创建订单
// CommonResult<OrderCreateBO> createResult = orderService.createOrder(orderCreateDTO);
// if (createResult.isError()) {
// return CommonResult.error(createResult);
// }
// // 清空购物车 // TODO 芋艿,需要标记删除的原因,即结果为创建为某个订单。
// cartService.deleteList(userId, cartItems.stream().map(CartItemBO::getSkuId).collect(Collectors.toList()));
// // 返回结果
// return createResult;
// }
//
// @GetMapping("confirm_create_order")
// @RequiresLogin
// @ApiOperation("确认创建订单")
// public CommonResult<UsersOrderConfirmCreateVO> getConfirmCreateOrder(@RequestParam("skuId") Integer skuId,
// @RequestParam("quantity") Integer quantity,
// @RequestParam(value = "couponCardId", required = false) Integer couponCardId) {
// Integer userId = UserSecurityContextHolder.getContext().getUserId();
// // 创建 CalcOrderPriceDTO 对象,并执行价格计算
// CalcOrderPriceDTO calcOrderPriceDTO = new CalcOrderPriceDTO()
// .setUserId(userId)
// .setItems(Collections.singletonList(new CalcOrderPriceDTO.Item(skuId, quantity, true)))
// .setCouponCardId(couponCardId);
// CalcOrderPriceBO calcOrderPrice = cartService.calcOrderPrice(calcOrderPriceDTO);
// // 获得优惠劵
// List<CouponCardAvailableBO> couponCards = couponService.getCouponCardList(userId,
// CartConvert.INSTANCE.convertList(calcOrderPrice.getItemGroups()));
// // 执行数据拼装
// return success(CartConvert.INSTANCE.convert(calcOrderPrice).setCouponCards(couponCards));
// }
//
// @PostMapping("confirm_receiving")
// @RequiresLogin
// @ApiOperation("确认收货")
// public CommonResult confirmReceiving(@RequestParam("orderId") Integer orderId) {
// Integer userId = UserSecurityContextHolder.getContext().getUserId();
// return orderService.confirmReceiving(userId, orderId);
// }
//
// @GetMapping("info")
// @RequiresLogin
// @ApiOperation("订单详情")
// public CommonResult<OrderInfoBO> orderInfo(@RequestParam("orderId") Integer orderId) {
// Integer userId = UserSecurityContextHolder.getContext().getUserId();
// CommonResult<OrderInfoBO> commonResult = orderService.info(userId, orderId);
//
// OrderInfoBO orderInfoBO = commonResult.getData();
// if (orderInfoBO != null) {
// CommonResult<DataDictBO> dictResult = dataDictService
// .getDataDict(DictKeyConstants.ORDER_STATUS, orderInfoBO.getStatus());
// orderInfoBO.setStatusText(dictResult.getData().getDisplayName());
// }
// return commonResult;
// }
}

View File

@@ -0,0 +1,65 @@
package cn.iocoder.mall.order.rest.controller.users;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 订单物流 controller
*
* @author Sin
* @time 2019-04-12 22:24
*/
@RestController
@RequestMapping("users/order_logistics")
@Api(description = "订单物流信息")
public class OrderLogisticsController {
// @Reference(validation = "true", version = "${dubbo.provider.OrderLogisticsService.version}")
// private OrderLogisticsService orderLogisticsService;
//
// @Reference(validation = "true", version = "${dubbo.consumer.DataDictService.version}")
// private DataDictService dataDictService;
//
// @GetMapping("info")
// @ApiOperation("物流详细 - 物流通用")
// public CommonResult<OrderLogisticsInfoBO> logistics(@RequestParam("logisticsId") Integer logisticsId) {
// return orderLogisticsService.getLogisticsInfo(logisticsId);
// }
//
// @GetMapping("info_order")
// @ApiOperation("物流详细 - 返回订单所关联的所有物流信息(订单用的)")
// public CommonResult<OrderLogisticsInfoWithOrderBO> logisticsInfoWithOrder(@RequestParam("orderId") Integer orderId) {
// Integer userId = UserSecurityContextHolder.getContext().getUserId();
// CommonResult<OrderLogisticsInfoWithOrderBO> commonResult = orderLogisticsService.getOrderLogisticsInfo(userId, orderId);
// if (commonResult.isSuccess()) {
// OrderLogisticsInfoWithOrderBO orderLogisticsInfoBO = commonResult.getData();
// List<OrderLogisticsInfoWithOrderBO.Logistics> logisticsList = orderLogisticsInfoBO.getLogistics();
//
// // 获取字典值
// Set<Integer> dictValues = logisticsList.stream().map(o -> o.getLogistics()).collect(Collectors.toSet());
// if (!CollectionUtils.isEmpty(dictValues)) {
// CommonResult<List<DataDictBO>> dictResult = dataDictService
// .getDataDictList(DictKeyConstants.ORDER_LOGISTICS_COMPANY, dictValues);
//
// if (dictResult.isError()) {
// // 错误情况
// return ServiceExceptionUtil.error(OrderErrorCodeEnum.DICT_SERVER_INVOKING_FAIL.getCode());
// }
//
// // 转换结果字典值
// Map<String, DataDictBO> dataDictBOMap = dictResult.getData()
// .stream().collect(Collectors.toMap(o -> o.getValue(), o -> o));
//
// logisticsList.stream().map(o -> {
// String dicValue = o.getLogistics().toString();
// if (dataDictBOMap.containsKey(dicValue)) {
// o.setLogisticsText(dataDictBOMap.get(dicValue).getDisplayName());
// }
// return o;
// }).collect(Collectors.toList());
// }
// }
// return commonResult;
// }
}

View File

@@ -0,0 +1,53 @@
package cn.iocoder.mall.order.rest.controller.users;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 订单退款/售后流程
*
* @author Sin
* @time 2019-04-25 22:04
*/
@RestController
@RequestMapping("users/order_return")
public class OrderReturnController {
// @Reference(validation = "true", version = "${dubbo.provider.OrderReturnService.version}")
// private OrderReturnService orderReturnService;
//
// @Reference(validation = "true", version = "${dubbo.consumer.DataDictService.version}")
// private DataDictService dataDictService;
//
// @GetMapping("reason")
// @ApiOperation("原因")
// public CommonResult<List<DataDictBO>> orderReturnReason() {
// return dataDictService.getDataDict(DictKeyConstants.ORDER_RETURN_REASON);
// }
//
// @PostMapping("apply")
// @ApiOperation("订单售后")
// public CommonResult orderReturnApply(@RequestBody OrderReturnApplyPO orderReturnApplyPO) {
// OrderReturnApplyDTO applyDTO = OrderReturnConvert.INSTANCE.convert(orderReturnApplyPO);
// return orderReturnService.orderReturnApply(applyDTO);
// }
//
// @GetMapping("info")
// @ApiOperation("订单售后详细")
// public CommonResult<OrderReturnInfoBO> orderApplyInfo(@RequestParam("orderId") Integer orderId) {
// CommonResult<OrderReturnInfoBO> commonResult = orderReturnService.orderApplyInfo(orderId);
//
// // 转换 字典值
// if (commonResult.isSuccess()) {
// CommonResult<DataDictBO> dataDictResult = dataDictService.getDataDict(
// DictKeyConstants.ORDER_RETURN_SERVICE_TYPE,
// commonResult.getData().getReturnInfo().getServiceType());
//
// if (dataDictResult.isSuccess()) {
// commonResult.getData().getReturnInfo().setServiceTypeText(dataDictResult.getData().getDisplayName());
// }
// }
//
// return commonResult;
// }
}

View File

@@ -0,0 +1,122 @@
package cn.iocoder.mall.order.rest.controller.users;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("users/cart")
public class UsersCartController {
// @Reference(validation = "true", version = "${dubbo.provider.CartService.version}")
// private CartService cartService;
//
// @Reference(validation = "true", version = "${dubbo.provider.OrderService.version}")
// private OrderService orderService;
//
// @Reference(validation = "true", version = "${dubbo.consumer.CouponService.version}")
// private CouponService couponService;
//
// @PostMapping("add")
// public CommonResult<Integer> add(@RequestParam("skuId") Integer skuId,
// @RequestParam("quantity") Integer quantity) {
// // 添加到购物车
// cartService.add(UserSecurityContextHolder.getContext().getUserId(), skuId, quantity);
// // 获得目前购物车商品总数量
// return success(cartService.count(UserSecurityContextHolder.getContext().getUserId()));
// }
//
// @PostMapping("update_quantity")
// public CommonResult<UsersCartDetailVO> updateQuantity(@RequestParam("skuId") Integer skuId, // TODO 芋艿,先暂用这个 VO 。等促销活动出来后,做调整
// @RequestParam("quantity") Integer quantity) {
// // 添加到购物车
// cartService.updateQuantity(UserSecurityContextHolder.getContext().getUserId(),
// skuId, quantity);
// // 获得目前购物车明细
// return getCartDetail();
// }
//
// @PostMapping("update_selected")
// public CommonResult<UsersCartDetailVO> updateSelected(@RequestParam("skuIds") Set<Integer> skuIds, // TODO 芋艿,先暂用这个 VO 。等促销活动出来后,做调整
// @RequestParam("selected") Boolean selected) {
// // 添加到购物车
// cartService.updateSelected(UserSecurityContextHolder.getContext().getUserId(), skuIds, selected);
// // 获得目前购物车明细
// return getCartDetail();
// }
//
// @GetMapping("count")
// public CommonResult<Integer> count() {
// return success(cartService.count(UserSecurityContextHolder.getContext().getUserId()));
// }
//
// @GetMapping("/list")
// public CommonResult<UsersCartDetailVO> list() { // TODO 芋艿,先暂用这个 VO 。等促销活动出来后,做调整
// return getCartDetail();
// }
//
// private CommonResult<UsersCartDetailVO> getCartDetail() {
// // 获得购物车中选中的
// List<CartItemBO> cartItems = cartService.list(UserSecurityContextHolder.getContext().getUserId(), null);
// // 购物车为空时,构造空的 UsersOrderConfirmCreateVO 返回
// if (cartItems.isEmpty()) {
// UsersCartDetailVO result = new UsersCartDetailVO();
// result.setItemGroups(Collections.emptyList());
// result.setFee(new UsersCartDetailVO.Fee(0, 0, 0, 0));
// return success(result);
// }
// // 计算商品价格
// CalcOrderPriceBO calcOrder = list0(cartItems, null);
// // 执行数据拼装
// return success(CartConvert.INSTANCE.convert2(calcOrder));
// }
//
// @GetMapping("/confirm_create_order")
// public CommonResult<UsersOrderConfirmCreateVO> getConfirmCreateOrder(@RequestParam(value = "couponCardId", required = false) Integer couponCardId) {
// Integer userId = UserSecurityContextHolder.getContext().getUserId();
// // 获得购物车中选中的
// List<CartItemBO> cartItems = cartService.list(userId, true);
// // 购物车为空时,构造空的 UsersOrderConfirmCreateVO 返回
// if (cartItems.isEmpty()) {
// UsersOrderConfirmCreateVO result = new UsersOrderConfirmCreateVO();
// result.setItemGroups(Collections.emptyList());
// result.setFee(new UsersOrderConfirmCreateVO.Fee(0, 0, 0, 0));
// return success(result);
// }
// // 计算商品价格
// CalcOrderPriceBO calcOrderPrice = list0(cartItems, couponCardId);
// // 获得优惠劵
// List<CouponCardAvailableBO> couponCards = couponService.getCouponCardList(userId,
// CartConvert.INSTANCE.convertList(calcOrderPrice.getItemGroups()));
// // 执行数据拼装
// return success(CartConvert.INSTANCE.convert(calcOrderPrice).setCouponCards(couponCards));
// }
//
// private CalcOrderPriceBO list0(List<CartItemBO> cartItems, Integer couponCardId) {
// // 创建计算的 DTO
// CalcOrderPriceDTO calcOrderPriceDTO = new CalcOrderPriceDTO()
// .setUserId(UserSecurityContextHolder.getContext().getUserId())
// .setItems(new ArrayList<>(cartItems.size()))
// .setCouponCardId(couponCardId);
// for (CartItemBO item : cartItems) {
// calcOrderPriceDTO.getItems().add(new CalcOrderPriceDTO.Item(item.getSkuId(), item.getQuantity(), item.getSelected()));
// }
// // 执行计算
// return cartService.calcOrderPrice(calcOrderPriceDTO);
// }
//
// @GetMapping("/calc_sku_price")
// public CommonResult<UsersCalcSkuPriceVO> calcSkuPrice(@RequestParam("skuId") Integer skuId) {
// // 计算 sku 的价格
// CalcSkuPriceBO calcSkuPrice = cartService.calcSkuPrice(skuId);
// return success(CartConvert.INSTANCE.convert2(calcSkuPrice));
// }
//
// public CommonResult<Object> confirmOrder() {
// // 查询购物车列表(选中的)
//// cartService.list(userId, true);
// // 查询确认订单信息的明细
//
// return null;
// }
}

View File

@@ -0,0 +1,30 @@
package cn.iocoder.mall.order.rest.convert;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@Mapper
public interface CartConvert {
CartConvert INSTANCE = Mappers.getMapper(CartConvert.class);
// UsersOrderConfirmCreateVO convert(CalcOrderPriceBO calcOrderPriceBO);
//
// UsersCartDetailVO convert2(CalcOrderPriceBO calcOrderPriceBO);
//
// UsersCalcSkuPriceVO convert2(CalcSkuPriceBO calcSkuPriceBO);
//
// default List<CouponCardSpuDTO> convertList(List<CalcOrderPriceBO.ItemGroup> itemGroups) {
// List<CouponCardSpuDTO> items = new ArrayList<>();
// itemGroups.forEach(itemGroup -> items.addAll(itemGroup.getItems().stream().map(
// item -> new CouponCardSpuDTO()
// .setSpuId(item.getSpu().getId())
// .setSkuId(item.getId())
// .setCategoryId(item.getSpu().getCid())
// .setPrice(item.getBuyPrice())
// .setQuantity(item.getBuyQuantity()))
// .collect(Collectors.toList())));
// return items;
// }
}

View File

@@ -0,0 +1,46 @@
package cn.iocoder.mall.order.rest.convert;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* application 订单 convert
*
* TODO 这种方式 文件名不能一样哈!
*
* @author Sin
* @time 2019-03-24 10:45
*/
@Mapper
public interface OrderConvertAPP {
OrderConvertAPP INSTANCE = Mappers.getMapper(OrderConvertAPP.class);
// @Mappings({})
// OrderQueryDTO convert(OrderPageQueryPO orderPageQueryVO);
//
// @Mappings({})
// OrderLogisticsUpdateDTO convert(OrderLogisticsPO orderLogisticsVO);
//
// @Mappings({})
// OrderItemUpdateDTO convert(OrderItemUpdatePO orderItemUpdateVO);
//
// @Mappings({})
// OrderCreateDTO convert(OrderCreatePO orderCreatePO);
//
// @Mappings({})
// List<OrderCreateDTO.OrderItem> convert(List<CartItemBO> cartItems);
//
// default OrderCreateDTO createOrderCreateDTO(Integer userId, Integer userAddressId,
// String remark, String ip,
// List<CartItemBO> cartItems, Integer couponCardId) {
// return new OrderCreateDTO()
// .setUserId(userId)
// .setUserAddressId(userAddressId)
// .setRemark(remark)
// .setIp(ip)
// .setOrderItems(this.convert(cartItems))
// .setCouponCardId(couponCardId);
// }
}

View File

@@ -0,0 +1,17 @@
package cn.iocoder.mall.order.rest.convert;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* @author Sin
* @time 2019-04-05 17:00
*/
@Mapper
public interface OrderDeliveryConvert {
OrderDeliveryConvert INSTANCE = Mappers.getMapper(OrderDeliveryConvert.class);
// @Mappings({})
// OrderDeliveryDTO convert(OrderDeliverPO orderDeliverPO);
}

View File

@@ -0,0 +1,22 @@
package cn.iocoder.mall.order.rest.convert;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* 订单退货
*
* @author Sin
* @time 2019-04-25 21:54
*/
@Mapper
public interface OrderReturnConvert {
OrderReturnConvert INSTANCE = Mappers.getMapper(OrderReturnConvert.class);
// @Mappings({})
// OrderReturnApplyDTO convert(OrderReturnApplyPO orderReturnApplyPO);
//
// @Mappings({})
// OrderReturnQueryDTO convert(OrderReturnQueryPO orderReturnQueryPO);
}

View File

@@ -0,0 +1,46 @@
package cn.iocoder.mall.order.rest.request.admin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.List;
import javax.validation.constraints.NotNull;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 订单发货
*
* @author Sin
* @time 2019-04-05 16:55
*/
@Data
@Accessors(chain = true)
@ApiModel(description = "订单发货PO")
public class OrderDeliverRequest implements Serializable {
/**
* 订单编号
*/
@ApiModelProperty("订单id")
@NotNull(message = "orderId不能为空")
private Integer orderId;
/**
* 物流 (字典)
*/
@ApiModelProperty("物流商家")
@NotNull(message = "必须选择商家")
private Integer logistics;
/**
* 物流编号
*/
@ApiModelProperty("物流单号")
@NotNull(message = "没有物流单号")
private String logisticsNo;
/**
* 订单 items
*/
@ApiModelProperty("订单items")
@NotNull(message = "没有选择发货的商品")
private List<Integer> orderItemIds;
}

View File

@@ -0,0 +1,48 @@
package cn.iocoder.mall.order.rest.request.admin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 订单 item 更新
*
* @author Sin
* @time 2019-03-24 11:16
*/
@Data
@Accessors(chain = true)
@ApiModel("订单item更新")
public class OrderItemUpdateRequest implements Serializable {
/**
* 编号
*/
@NotNull(message = "id不能为空!")
@ApiModelProperty("编号(orderItemId)")
private Integer id;
/**
* 商品编号
*/
@NotNull(message = "商品id不能为空!")
@ApiModelProperty("商品id")
private Integer skuId;
/**
* 数量
*/
@NotNull(message = "数量不能为空!")
@Size(max = 9999, min = 1, message = "商品数量 1 ~ 9999")
@ApiModelProperty("商品数量")
private Integer quantity;
/**
* 金额(分)
*/
@NotNull(message = "商品金额")
@Size(max = 99999999, min = 0, message = "商品金额 0 ~ 99999999")
@ApiModelProperty("商品金额")
private Integer price;
}

View File

@@ -0,0 +1,60 @@
package cn.iocoder.mall.order.rest.request.admin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 订单物流
*
* @author Sin
* @time 2019-03-24 11:01
*/
@Data
@Accessors(chain = true)
@ApiModel("订单物流信息")
public class OrderLogisticsRequest implements Serializable {
/**
* 订单 id
*/
@NotNull(message = "订单id不能为空!")
@ApiModelProperty("物流id")
private Integer id;
/**
* 收件区域编号
*/
@NotNull(message = "区域编号不能为空!")
@ApiModelProperty("区域编号")
private String areaNo;
/**
* 收件人名称
*/
@NotNull(message = "收件人姓名不能为空!")
@ApiModelProperty("收件人姓名")
private String name;
/**
* 收件手机号
*/
@NotNull(message = "手机号不能为空!")
@Size(max = 11, min = 11, message = "手机号在11位!")
@ApiModelProperty("手机号")
private String mobile;
/**
* 收件详细地址
*/
@NotNull(message = "收件详细地址不能为空")
@Size(max = 250, min = 5, message = "收件地址应该在 5 ~ 250 个字符之间")
@ApiModelProperty("手机地址")
private String address;
/**
* 物流编号
*/
@ApiModelProperty("物流订号")
private String logisticsNo;
}

View File

@@ -0,0 +1,73 @@
package cn.iocoder.mall.order.rest.request.admin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
/**
* 订单 page 查询 vo
*
* @author Sin
* @time 2019-03-24 10:40
*/
@Data
@Accessors(chain = true)
@ApiModel("订单查询")
public class OrderPageQueryRequest implements Serializable {
/**
* id
*/
@ApiModelProperty("订单id")
private Integer id;
/**
* 订单号
*/
@ApiModelProperty("订单号")
private String orderNo;
/**
* 用户 id
*/
@ApiModelProperty("用户id")
private Integer userId;
/**
* 付款时间(待发货)
*/
@ApiModelProperty("start付款时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startPaymentTime;
@ApiModelProperty("end付款时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endPaymentTime;
/**
* 创建时间
*/
@ApiModelProperty("start订单创建时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startCreateTime;
@ApiModelProperty("end订单创建时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endCreateTime;
/**
* 结束时间
*/
@ApiModelProperty("start成交时间")
private Date startClosingTime;
@ApiModelProperty("end成交时间")
private Date endClosingTime;
/**
* 删除状态
*/
@ApiModelProperty("订单状态")
private Integer status;
@ApiModelProperty("删除状态")
private Integer deleted;
@ApiModelProperty("分页pageNo")
private Integer pageNo;
@ApiModelProperty("每页大小")
private Integer pageSize;
}

View File

@@ -0,0 +1,37 @@
package cn.iocoder.mall.order.rest.request.admin;
import cn.iocoder.mall.order.api.bo.OrderBO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.List;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 订单分页 vo
*
* @author Sin
* @time 2019-03-27 21:23
*/
@Data
@Accessors(chain = true)
@ApiModel("订单VO")
public class OrderPageRequest implements Serializable {
/**
* 分页
*/
@ApiModelProperty("分页下表当前")
private Integer pageNo;
/**
* 总条数
*/
@ApiModelProperty("总条数")
private Integer total;
/**
* 订单 list
*/
@ApiModelProperty("订单信息")
private List<OrderBO> orders;
}

View File

@@ -0,0 +1,61 @@
package cn.iocoder.mall.order.rest.request.admin;
import java.io.Serializable;
import java.util.Date;
import javax.validation.constraints.NotNull;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
/**
* 订单退货 查询 po
*
* @author Sin
* @time 2019-05-06 21:36
*/
@Data
@Accessors(chain = true)
public class OrderReturnQueryRequest implements Serializable {
/**
*
* 订单id
*/
private Integer orderId;
/**
* 订单编号
*/
private Integer orderNo;
/**
* 服务号
*/
private String serviceNumber;
/**
* 创建时间 - 开始
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startCreateTime;
/**
* 创建时间 - 结束
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endCreateTime;
/**
* 状态
*/
private Integer status;
///
/// 分页信息
/**
* 分页 index
*/
@NotNull
private Integer index;
/**
* 分页大小
*/
@NotNull
private Integer pageSize;
}

View File

@@ -0,0 +1,58 @@
package cn.iocoder.mall.order.rest.request.users;
import java.io.Serializable;
import java.util.List;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 订单创建
*
* @author Sin
* @time 2019-03-16 14:42
*/
@Data
@Accessors(chain = true)
public class OrderCreateRequest implements Serializable {
/**
* 收件手机号
*/
@NotNull(message = "用户地址id不能为空!")
private Integer userAddressId;
/**
* 优惠劵编号
*/
private Integer couponCardId;
/**
* 备注
*/
private String remark;
///
/// order item
@NotNull()
@Size(max = 1000, min = 1, message = "用户订单中没有商品!")
private List<OrderItem> orderItems;
@Data
@Accessors(chain = true)
public static class OrderItem {
/**
* 商品编号
*/
@NotNull
private Integer skuId;
/**
* 数量
*/
@NotNull
@Max(value = 1000)
private Integer quantity;
}
}

View File

@@ -0,0 +1,47 @@
package cn.iocoder.mall.order.rest.request.users;
import java.io.Serializable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 订单售后
*
* @author Sin
* @time 2019-04-25 20:59
*/
@Data
@Accessors(chain = true)
public class OrderReturnApplyRequest implements Serializable {
/**
* 订单编号
*/
@NotNull(message = "orderId 不能为空!")
private Integer orderId;
/**
* 退款类型
*
* - 1、退货退款
* - 2、退款
*/
@NotNull(message = "退货类型不能为空!")
private Integer returnType;
/**
* 退货原因(字典值)
*
* {@link cn.iocoder.mall.order.biz.constants.OrderReturnReasonEnum}
*/
@NotNull(message = "必须选择退货原因")
private Integer reason;
/**
* 原因(如果选择其他,原因保存在这)
*
* {@link cn.iocoder.mall.order.biz.constants.OrderReturnReasonEnum#REASON_000}
*/
@Size(max = 200)
private String describe;
}

View File

@@ -0,0 +1,33 @@
package cn.iocoder.mall.order.rest.response;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.experimental.Accessors;
@ApiModel("计算商品 SKU 价格结果 VO")
@Data
@Accessors(chain = true)
public class UsersCalcSkuPriceResponse {
/**
* 满减送促销活动
*
* TODO 芋艿,后续改成 VO
*/
// private PromotionActivityBO fullPrivilege;
/**
* 电视和折扣促销活动
*
* TODO 芋艿,后续改成 VO
*/
// private PromotionActivityBO timeLimitedDiscount;
/**
* 原价格,单位:分。
*/
private Integer originalPrice;
/**
* 最终价格,单位:分。
*/
private Integer buyPrice;
}

View File

@@ -0,0 +1,209 @@
package cn.iocoder.mall.order.rest.response;
import io.swagger.annotations.ApiModel;
import java.util.List;
import lombok.Data;
import lombok.experimental.Accessors;
@ApiModel(value = "购物车明细 VO")
@Data
@Accessors(chain = true)
public class UsersCartDetailResponse {
/**
* 商品分组数组
*/
private List<ItemGroup> itemGroups;
/**
* 费用
*/
private Fee fee;
/**
* 商品分组
*
* 多个商品,参加同一个活动,从而形成分组。
*/
@Data
@Accessors(chain = true)
public static class ItemGroup {
/**
* 优惠活动
*/
// private PromotionActivityBO activity; // TODO 芋艿,偷懒
/**
* 促销减少的金额
*
* 1. 若未参与促销活动,或不满足促销条件,返回 null
* 2. 该金额,已经分摊到每个 Item 的 discountTotal ,需要注意。
*/
private Integer activityDiscountTotal;
/**
* 商品数组
*/
private List<Sku> items;
}
@Data
@Accessors(chain = true)
public static class Sku {
// SKU 自带信息
/**
* sku 编号
*/
private Integer id;
/**
* SPU 信息
*/
private Spu spu;
/**
* 图片地址
*/
private String picURL;
/**
* 规格值数组
*/
// private List<ProductAttrAndValuePairBO> attrs; // TODO 后面改下
/**
* 价格,单位:分
*/
private Integer price;
/**
* 库存数量
*/
private Integer quantity;
// 非 SKU 自带信息
/**
* 购买数量
*/
private Integer buyQuantity;
/**
* 是否选中
*/
private Boolean selected;
/**
* 优惠活动
*/
// private PromotionActivityBO activity;
/**
* 原始单价,单位:分。
*/
private Integer originPrice;
/**
* 购买单价,单位:分
*/
private Integer buyPrice;
/**
* 最终价格,单位:分。
*/
private Integer presentPrice;
/**
* 购买总金额,单位:分
*
* 用途类似 {@link #presentTotal}
*/
private Integer buyTotal;
/**
* 优惠总金额,单位:分。
*/
private Integer discountTotal;
/**
* 最终总金额,单位:分。
*
* 注意presentPrice * quantity 不一定等于 presentTotal 。
* 因为,存在无法整除的情况。
* 举个例子presentPrice = 8.33 quantity = 3 的情况presentTotal 有可能是 24.99 ,也可能是 25 。
* 所以,需要存储一个该字段。
*/
private Integer presentTotal;
}
@Data
@Accessors(chain = true)
public static class Spu {
/**
* SPU 编号
*/
private Integer id;
// ========== 基本信息 =========
/**
* SPU 名字
*/
private String name;
/**
* 分类编号
*/
private Integer cid;
/**
* 商品主图地址
*
* 数组,以逗号分隔
*
* 建议尺寸800*800像素你可以拖拽图片调整顺序最多上传15张
*/
private List<String> picUrls;
}
/**
* 费用(合计)
*/
@Data
@Accessors(chain = true)
public static class Fee {
/**
* 购买总价
*/
private Integer buyTotal;
/**
* 优惠总价
*
* 注意,满多少元包邮,不算在优惠中。
*/
private Integer discountTotal;
/**
* 邮费
*/
private Integer postageTotal;
/**
* 最终价格
*
* 计算公式 = 总价 - 优惠总价 + 邮费
*/
private Integer presentTotal;
public Fee() {
}
public Fee(Integer buyTotal, Integer discountTotal, Integer postageTotal, Integer presentTotal) {
this.buyTotal = buyTotal;
this.discountTotal = discountTotal;
this.postageTotal = postageTotal;
this.presentTotal = presentTotal;
}
}
/**
* 邮费信息 TODO 芋艿,未完成
*/
@Data
@Accessors(chain = true)
public static class Postage {
/**
* 需要满足多少钱,可以包邮。单位:分
*/
private Integer threshold;
}
}

View File

@@ -0,0 +1,201 @@
package cn.iocoder.mall.order.rest.response;
import java.util.List;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class UsersOrderConfirmCreateResponse {
/**
* 商品分组数组
*/
private List<ItemGroup> itemGroups;
/**
* 费用
*/
private Fee fee;
/**
* 优惠劵列表 TODO 芋艿,后续改改
*/
// private List<CouponCardAvailableBO> couponCards;
/**
* 优惠劵优惠金额
*/
private Integer couponCardDiscountTotal;
/**
* 商品分组
*
* 多个商品,参加同一个活动,从而形成分组。
*/
@Data
@Accessors(chain = true)
public static class ItemGroup {
/**
* 优惠活动
*/
// TODO 芋艿,目前只会有【满减送】的情况,未来有新的促销方式,可能需要改成数组
// TODO 芋艿,后面改成 VO
// private PromotionActivityBO activity;
/**
* 商品数组
*/
private List<Sku> items;
}
@Data
@Accessors(chain = true)
public static class Sku {
// SKU 自带信息
/**
* sku 编号
*/
private Integer id;
/**
* SPU 信息
*/
private Spu spu;
/**
* 图片地址
*/
private String picURL;
/**
* 规格值数组
*/
// private List<ProductAttrAndValuePairBO> attrs; // TODO 后面改下
/**
* 价格,单位:分
*/
private Integer price;
/**
* 库存数量
*/
private Integer quantity;
// 非 SKU 自带信息
/**
* 购买数量
*/
private Integer buyQuantity;
/**
* 原始单价,单位:分。
*/
private Integer originPrice;
/**
* 购买单价,单位:分
*/
private Integer buyPrice;
/**
* 最终价格,单位:分。
*/
private Integer presentPrice;
/**
* 购买总金额,单位:分
*
* 用途类似 {@link #presentTotal}
*/
private Integer buyTotal;
/**
* 优惠总金额,单位:分。
*/
private Integer discountTotal;
/**
* 最终总金额,单位:分。
*
* 注意presentPrice * quantity 不一定等于 presentTotal 。
* 因为,存在无法整除的情况。
* 举个例子presentPrice = 8.33 quantity = 3 的情况presentTotal 有可能是 24.99 ,也可能是 25 。
* 所以,需要存储一个该字段。
*/
private Integer presentTotal;
}
@Data
@Accessors(chain = true)
public static class Spu {
/**
* SPU 编号
*/
private Integer id;
// ========== 基本信息 =========
/**
* SPU 名字
*/
private String name;
/**
* 分类编号
*/
private Integer cid;
/**
* 商品主图地址
*
* 数组,以逗号分隔
*
* 建议尺寸800*800像素你可以拖拽图片调整顺序最多上传15张
*/
private List<String> picUrls;
}
/**
* 费用(合计)
*/
@Data
@Accessors(chain = true)
public static class Fee {
/**
* 购买总价
*/
private Integer buyTotal;
/**
* 优惠总价
*
* 注意,满多少元包邮,不算在优惠中。
*/
private Integer discountTotal;
/**
* 邮费
*/
private Integer postageTotal;
/**
* 最终价格
*
* 计算公式 = 总价 - 优惠总价 + 邮费
*/
private Integer presentTotal;
public Fee() {
}
public Fee(Integer buyTotal, Integer discountTotal, Integer postageTotal, Integer presentTotal) {
this.buyTotal = buyTotal;
this.discountTotal = discountTotal;
this.postageTotal = postageTotal;
this.presentTotal = presentTotal;
}
}
/**
* 邮费信息
*/
@Data
@Accessors(chain = true)
public static class Postage {
/**
* 需要满足多少钱,可以包邮。单位:分
*/
private Integer threshold;
}
}

View File

@@ -1,8 +1,8 @@
# 服务器的配置项
server:
port: 18083
port: 18088
servlet:
context-path: /system-api/
context-path: /order-api/
# Swagger 配置项
swagger: