diff --git a/order/order-application/pom.xml b/order/order-application/pom.xml index 42d90ee09..2f80d4ffb 100644 --- a/order/order-application/pom.xml +++ b/order/order-application/pom.xml @@ -15,89 +15,16 @@ cn.iocoder.mall - common-framework + order-rest 1.0-SNAPSHOT cn.iocoder.mall - mall-spring-boot - 1.0-SNAPSHOT - - - cn.iocoder.mall - order-service-impl - 1.0-SNAPSHOT - - - cn.iocoder.mall - system-sdk - 1.0-SNAPSHOT - - - cn.iocoder.mall - user-sdk + order-rpc 1.0-SNAPSHOT - - - org.springframework.boot - spring-boot-starter-web - - - - io.springfox - springfox-swagger2 - - - com.github.xiaoymin - swagger-bootstrap-ui - - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-sentinel - - - - - de.codecentric - spring-boot-admin-starter-client - - - - org.springframework.boot - spring-boot-starter-actuator - - - - io.micrometer - micrometer-registry-prometheus - - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - - org.springframework.boot - spring-boot-maven-plugin - - - diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/OrderApplication.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/OrderApplication.java index 6928ec3ff..ed0d910a0 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/OrderApplication.java +++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/OrderApplication.java @@ -3,24 +3,35 @@ package cn.iocoder.mall.order.application; import org.apache.catalina.connector.Connector; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.context.config.ConfigFileApplicationListener; import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer; import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory; import org.springframework.context.annotation.Bean; +/** + * @author xiaofeng + */ @SpringBootApplication(scanBasePackages = {"cn.iocoder.mall.order"}) public class OrderApplication { - public static void main(String[] args) { - SpringApplication.run(OrderApplication.class, args); - } + /** + * 设置需要读取的配置文件的名字。 基于 {@link org.springframework.boot.context.config.ConfigFileApplicationListener#CONFIG_NAME_PROPERTY} + * 实现。 + */ + private static final String CONFIG_NAME_VALUE = "biz,rest,rpc,application"; + public static void main(String[] args) { + // 设置环境变量 + System.setProperty(ConfigFileApplicationListener.CONFIG_NAME_PROPERTY, CONFIG_NAME_VALUE); + SpringApplication.run(OrderApplication.class, args); + } /** - * 解决异常信息: - * java.lang.IllegalArgumentException: - * Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986 + * 解决异常信息: java.lang.IllegalArgumentException: Invalid character found in the request target. + * The valid characters are defined in RFC 7230 and RFC 3986 + * * @return */ @Bean @@ -36,5 +47,4 @@ public class OrderApplication { } - -} \ No newline at end of file +} diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminOrderReturnController.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminOrderReturnController.java deleted file mode 100644 index d7591408c..000000000 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminOrderReturnController.java +++ /dev/null @@ -1,57 +0,0 @@ -package cn.iocoder.mall.order.application.controller.admins; - -import cn.iocoder.common.framework.util.HttpUtil; -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.order.api.OrderReturnService; -import cn.iocoder.mall.order.api.bo.OrderReturnListBO; -import cn.iocoder.mall.order.api.dto.OrderReturnQueryDTO; -import cn.iocoder.mall.order.application.convert.OrderReturnConvert; -import cn.iocoder.mall.order.application.po.admin.OrderReturnQueryPO; -import io.swagger.annotations.Api; -import org.apache.dubbo.config.annotation.Reference; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; - -/** - * 订单退货 - * - * @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 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); - } -} diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminsOrderController.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminsOrderController.java deleted file mode 100644 index 7dd025655..000000000 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/admins/AdminsOrderController.java +++ /dev/null @@ -1,101 +0,0 @@ -package cn.iocoder.mall.order.application.controller.admins; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.order.api.OrderService; -import cn.iocoder.mall.order.api.bo.OrderItemBO; -import cn.iocoder.mall.order.api.bo.OrderPageBO; -import cn.iocoder.mall.order.api.bo.OrderRecipientBO; -import cn.iocoder.mall.order.api.dto.OrderItemUpdateDTO; -import cn.iocoder.mall.order.api.dto.OrderLogisticsUpdateDTO; -import cn.iocoder.mall.order.api.dto.OrderQueryDTO; -import cn.iocoder.mall.order.application.convert.OrderConvertAPP; -import cn.iocoder.mall.order.application.convert.OrderDeliveryConvert; -import cn.iocoder.mall.order.application.po.admin.OrderDeliverPO; -import cn.iocoder.mall.order.application.po.admin.OrderItemUpdatePO; -import cn.iocoder.mall.order.application.po.admin.OrderLogisticsPO; -import cn.iocoder.mall.order.application.po.admin.OrderPageQueryPO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.apache.dubbo.config.annotation.Reference; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -/** - * 订单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 getOrderPage(@Validated OrderPageQueryPO orderPageQueryVO) { - OrderQueryDTO orderQueryDTO = OrderConvertAPP.INSTANCE.convert(orderPageQueryVO); - return orderService.getOrderPage(orderQueryDTO); - } - - @GetMapping("order_items") - @ApiOperation("订单列表") - public CommonResult> getOrderItems(@RequestParam("orderId") Integer orderId) { - return orderService.getOrderItems(orderId); - } - - @GetMapping("order_recipient_info") - @ApiOperation("订单收件人信息") - public CommonResult getOrderRecipientBO(@RequestParam("orderId") Integer orderId) { - return orderService.getOrderRecipientBO(orderId); - } - - @PostMapping("order_deliver") - @ApiOperation("订单发货") - public CommonResult 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); - } -} diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderCommentController.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderCommentController.java deleted file mode 100644 index e908c5e16..000000000 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderCommentController.java +++ /dev/null @@ -1,78 +0,0 @@ -package cn.iocoder.mall.order.application.controller.users; - -import cn.iocoder.common.framework.constant.MallConstants; -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.order.api.OrderCommentReplyService; -import cn.iocoder.mall.order.api.OrderCommentService; -import cn.iocoder.mall.order.api.bo.OrderCommentCreateBO; -import cn.iocoder.mall.order.api.bo.OrderCommentInfoAndMerchantReplyBO; -import cn.iocoder.mall.order.api.bo.OrderCommentPageBO; -import cn.iocoder.mall.order.api.bo.OrderCommentStateInfoPageBO; -import cn.iocoder.mall.order.api.dto.OrderCommentCreateDTO; -import cn.iocoder.mall.order.api.dto.OrderCommentPageDTO; -import cn.iocoder.mall.order.api.dto.OrderCommentStateInfoPageDTO; -import cn.iocoder.mall.user.sdk.annotation.RequiresLogin; -import cn.iocoder.mall.user.sdk.context.UserSecurityContextHolder; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.apache.dubbo.config.annotation.Reference; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -/** - * - * 订单评论 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 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 getOrderCommentPage(@Validated OrderCommentPageDTO orderCommentPageDTO){ - return success(orderCommentService.getOrderCommentPage(orderCommentPageDTO)); - } - - @GetMapping("order_comment_info_merchant_reply") - @ApiOperation(value = "获取评论和商家回复") - public CommonResult 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 getOrderCommentStateInfoPage(@Validated OrderCommentStateInfoPageDTO orderCommentStateInfoPageDTO){ - //Integer userId = UserSecurityContextHolder.getContext().getUserId(); - //orderCommentStateInfoPageDTO.setUserId(userId); - return success(orderCommentService.getOrderCommentStateInfoPage(orderCommentStateInfoPageDTO)); - } - - -} diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderCommentReplyController.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderCommentReplyController.java deleted file mode 100644 index 37c147b65..000000000 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderCommentReplyController.java +++ /dev/null @@ -1,47 +0,0 @@ -package cn.iocoder.mall.order.application.controller.users; - -import cn.iocoder.common.framework.constant.MallConstants; -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.order.api.OrderCommentReplyService; -import cn.iocoder.mall.order.api.bo.OrderCommentReplyCreateBO; -import cn.iocoder.mall.order.api.bo.OrderCommentReplyPageBO; -import cn.iocoder.mall.order.api.dto.OrderCommentReplyCreateDTO; -import cn.iocoder.mall.order.api.dto.OrderCommentReplyPageDTO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.apache.dubbo.config.annotation.Reference; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - - -/** - * - * 评论回复模块 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 createOrderCommentReply(@RequestBody @Validated OrderCommentReplyCreateDTO orderCommentReplyCreateDTO){ - return success(orderCommentReplyService.createOrderCommentReply(orderCommentReplyCreateDTO)); - } - - @GetMapping("order_comment_reply_page") - //@RequiresLogin - @ApiOperation(value = "分页获取评论回复") - public CommonResult getOrderCommentReplyPage(@Validated OrderCommentReplyPageDTO orderCommentReplyCreateDTO){ - return success(orderCommentReplyService.getOrderCommentReplyPage(orderCommentReplyCreateDTO)); - } -} diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderController.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderController.java deleted file mode 100644 index 2d53ae44d..000000000 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderController.java +++ /dev/null @@ -1,152 +0,0 @@ -package cn.iocoder.mall.order.application.controller.users; - -import cn.iocoder.common.framework.util.HttpUtil; -import cn.iocoder.common.framework.util.ServiceExceptionUtil; -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.system.api.DataDictService; -import cn.iocoder.mall.system.api.bo.datadict.DataDictBO; -import cn.iocoder.mall.order.api.CartService; -import cn.iocoder.mall.order.api.OrderService; -import cn.iocoder.mall.order.api.bo.*; -import cn.iocoder.mall.order.api.constant.DictKeyConstants; -import cn.iocoder.mall.order.api.constant.OrderErrorCodeEnum; -import cn.iocoder.mall.order.api.dto.CalcOrderPriceDTO; -import cn.iocoder.mall.order.api.dto.OrderCreateDTO; -import cn.iocoder.mall.order.api.dto.OrderQueryDTO; -import cn.iocoder.mall.order.application.convert.CartConvert; -import cn.iocoder.mall.order.application.convert.OrderConvertAPP; -import cn.iocoder.mall.order.application.po.user.OrderCreatePO; -import cn.iocoder.mall.order.application.vo.UsersOrderConfirmCreateVO; -import cn.iocoder.mall.promotion.api.CouponService; -import cn.iocoder.mall.promotion.api.bo.CouponCardAvailableBO; -import cn.iocoder.mall.user.sdk.annotation.RequiresLogin; -import cn.iocoder.mall.user.sdk.context.UserSecurityContextHolder; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.apache.dubbo.config.annotation.Reference; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -/** - * 订单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 getOrderPage(@Validated OrderQueryDTO orderQueryDTO) { - Integer userId = UserSecurityContextHolder.getContext().getUserId(); - orderQueryDTO.setUserId(userId); - return orderService.getOrderPage(orderQueryDTO); - } - - @PostMapping("create_order") - @RequiresLogin - @ApiOperation("创建订单") - public CommonResult 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 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 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 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 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 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 orderInfo(@RequestParam("orderId") Integer orderId) { - Integer userId = UserSecurityContextHolder.getContext().getUserId(); - CommonResult commonResult = orderService.info(userId, orderId); - - OrderInfoBO orderInfoBO = commonResult.getData(); - if (orderInfoBO != null) { - CommonResult dictResult = dataDictService - .getDataDict(DictKeyConstants.ORDER_STATUS, orderInfoBO.getStatus()); - orderInfoBO.setStatusText(dictResult.getData().getDisplayName()); - } - return commonResult; - } - -} diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderLogisticsController.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderLogisticsController.java deleted file mode 100644 index 918b92ac2..000000000 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderLogisticsController.java +++ /dev/null @@ -1,85 +0,0 @@ -package cn.iocoder.mall.order.application.controller.users; - -import cn.iocoder.common.framework.util.ServiceExceptionUtil; -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.system.api.DataDictService; -import cn.iocoder.mall.system.api.bo.datadict.DataDictBO; -import cn.iocoder.mall.order.api.OrderLogisticsService; -import cn.iocoder.mall.order.api.bo.OrderLogisticsInfoBO; -import cn.iocoder.mall.order.api.bo.OrderLogisticsInfoWithOrderBO; -import cn.iocoder.mall.order.api.constant.DictKeyConstants; -import cn.iocoder.mall.order.api.constant.OrderErrorCodeEnum; -import cn.iocoder.mall.user.sdk.context.UserSecurityContextHolder; -import org.apache.dubbo.config.annotation.Reference; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.springframework.util.CollectionUtils; -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.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -/** - * 订单物流 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 logistics(@RequestParam("logisticsId") Integer logisticsId) { - return orderLogisticsService.getLogisticsInfo(logisticsId); - } - - @GetMapping("info_order") - @ApiOperation("物流详细 - 返回订单所关联的所有物流信息(订单用的)") - public CommonResult logisticsInfoWithOrder(@RequestParam("orderId") Integer orderId) { - Integer userId = UserSecurityContextHolder.getContext().getUserId(); - CommonResult commonResult = orderLogisticsService.getOrderLogisticsInfo(userId, orderId); - if (commonResult.isSuccess()) { - OrderLogisticsInfoWithOrderBO orderLogisticsInfoBO = commonResult.getData(); - List logisticsList = orderLogisticsInfoBO.getLogistics(); - - // 获取字典值 - Set dictValues = logisticsList.stream().map(o -> o.getLogistics()).collect(Collectors.toSet()); - if (!CollectionUtils.isEmpty(dictValues)) { - CommonResult> dictResult = dataDictService - .getDataDictList(DictKeyConstants.ORDER_LOGISTICS_COMPANY, dictValues); - - if (dictResult.isError()) { - // 错误情况 - return ServiceExceptionUtil.error(OrderErrorCodeEnum.DICT_SERVER_INVOKING_FAIL.getCode()); - } - - // 转换结果字典值 - Map 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; - } -} diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderReturnController.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderReturnController.java deleted file mode 100644 index ff5503dbc..000000000 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/OrderReturnController.java +++ /dev/null @@ -1,65 +0,0 @@ -package cn.iocoder.mall.order.application.controller.users; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.system.api.DataDictService; -import cn.iocoder.mall.system.api.bo.datadict.DataDictBO; -import cn.iocoder.mall.order.api.OrderReturnService; -import cn.iocoder.mall.order.api.bo.OrderReturnInfoBO; -import cn.iocoder.mall.order.api.constant.DictKeyConstants; -import cn.iocoder.mall.order.api.dto.OrderReturnApplyDTO; -import cn.iocoder.mall.order.application.convert.OrderReturnConvert; -import cn.iocoder.mall.order.application.po.user.OrderReturnApplyPO; -import org.apache.dubbo.config.annotation.Reference; -import io.swagger.annotations.ApiOperation; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -/** - * 订单退款/售后流程 - * - * @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> 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 orderApplyInfo(@RequestParam("orderId") Integer orderId) { - CommonResult commonResult = orderReturnService.orderApplyInfo(orderId); - - // 转换 字典值 - if (commonResult.isSuccess()) { - CommonResult dataDictResult = dataDictService.getDataDict( - DictKeyConstants.ORDER_RETURN_SERVICE_TYPE, - commonResult.getData().getReturnInfo().getServiceType()); - - if (dataDictResult.isSuccess()) { - commonResult.getData().getReturnInfo().setServiceTypeText(dataDictResult.getData().getDisplayName()); - } - } - - return commonResult; - } -} diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/UsersCartController.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/UsersCartController.java deleted file mode 100644 index 5e021055c..000000000 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/UsersCartController.java +++ /dev/null @@ -1,143 +0,0 @@ -package cn.iocoder.mall.order.application.controller.users; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.order.api.CartService; -import cn.iocoder.mall.order.api.OrderService; -import cn.iocoder.mall.order.api.bo.CalcOrderPriceBO; -import cn.iocoder.mall.order.api.bo.CalcSkuPriceBO; -import cn.iocoder.mall.order.api.bo.CartItemBO; -import cn.iocoder.mall.order.api.dto.CalcOrderPriceDTO; -import cn.iocoder.mall.order.application.convert.CartConvert; -import cn.iocoder.mall.order.application.vo.UsersCalcSkuPriceVO; -import cn.iocoder.mall.order.application.vo.UsersCartDetailVO; -import cn.iocoder.mall.order.application.vo.UsersOrderConfirmCreateVO; -import cn.iocoder.mall.promotion.api.CouponService; -import cn.iocoder.mall.promotion.api.bo.CouponCardAvailableBO; -import cn.iocoder.mall.user.sdk.context.UserSecurityContextHolder; -import org.apache.dubbo.config.annotation.Reference; -import org.springframework.web.bind.annotation.*; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Set; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -@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 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 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 updateSelected(@RequestParam("skuIds") Set skuIds, // TODO 芋艿,先暂用这个 VO 。等促销活动出来后,做调整 - @RequestParam("selected") Boolean selected) { - // 添加到购物车 - cartService.updateSelected(UserSecurityContextHolder.getContext().getUserId(), skuIds, selected); - // 获得目前购物车明细 - return getCartDetail(); - } - - @GetMapping("count") - public CommonResult count() { - return success(cartService.count(UserSecurityContextHolder.getContext().getUserId())); - } - - @GetMapping("/list") - public CommonResult list() { // TODO 芋艿,先暂用这个 VO 。等促销活动出来后,做调整 - return getCartDetail(); - } - - private CommonResult getCartDetail() { - // 获得购物车中选中的 - List 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 getConfirmCreateOrder(@RequestParam(value = "couponCardId", required = false) Integer couponCardId) { - Integer userId = UserSecurityContextHolder.getContext().getUserId(); - // 获得购物车中选中的 - List 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 couponCards = couponService.getCouponCardList(userId, - CartConvert.INSTANCE.convertList(calcOrderPrice.getItemGroups())); - // 执行数据拼装 - return success(CartConvert.INSTANCE.convert(calcOrderPrice).setCouponCards(couponCards)); - } - - private CalcOrderPriceBO list0(List 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 calcSkuPrice(@RequestParam("skuId") Integer skuId) { - // 计算 sku 的价格 - CalcSkuPriceBO calcSkuPrice = cartService.calcSkuPrice(skuId); - return success(CartConvert.INSTANCE.convert2(calcSkuPrice)); - } - - public CommonResult confirmOrder() { - // 查询购物车列表(选中的) -// cartService.list(userId, true); - // 查询确认订单信息的明细 - - return null; - } - -} diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/convert/CartConvert.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/convert/CartConvert.java deleted file mode 100644 index eec491ebe..000000000 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/convert/CartConvert.java +++ /dev/null @@ -1,40 +0,0 @@ -package cn.iocoder.mall.order.application.convert; - -import cn.iocoder.mall.order.api.bo.CalcOrderPriceBO; -import cn.iocoder.mall.order.api.bo.CalcSkuPriceBO; -import cn.iocoder.mall.order.application.vo.UsersCalcSkuPriceVO; -import cn.iocoder.mall.order.application.vo.UsersCartDetailVO; -import cn.iocoder.mall.order.application.vo.UsersOrderConfirmCreateVO; -import cn.iocoder.mall.promotion.api.dto.CouponCardSpuDTO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -@Mapper -public interface CartConvert { - - CartConvert INSTANCE = Mappers.getMapper(CartConvert.class); - - UsersOrderConfirmCreateVO convert(CalcOrderPriceBO calcOrderPriceBO); - - UsersCartDetailVO convert2(CalcOrderPriceBO calcOrderPriceBO); - - UsersCalcSkuPriceVO convert2(CalcSkuPriceBO calcSkuPriceBO); - - default List convertList(List itemGroups) { - List 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; - } - -} diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/convert/OrderConvertAPP.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/convert/OrderConvertAPP.java deleted file mode 100644 index 98703be0e..000000000 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/convert/OrderConvertAPP.java +++ /dev/null @@ -1,54 +0,0 @@ -package cn.iocoder.mall.order.application.convert; - -import cn.iocoder.mall.order.api.bo.CartItemBO; -import cn.iocoder.mall.order.api.dto.*; -import cn.iocoder.mall.order.application.po.admin.OrderItemUpdatePO; -import cn.iocoder.mall.order.application.po.admin.OrderLogisticsPO; -import cn.iocoder.mall.order.application.po.admin.OrderPageQueryPO; -import cn.iocoder.mall.order.application.po.user.OrderCreatePO; -import org.mapstruct.Mapper; -import org.mapstruct.Mappings; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -/** - * 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 convert(List cartItems); - - default OrderCreateDTO createOrderCreateDTO(Integer userId, Integer userAddressId, String remark, String ip, - List cartItems, Integer couponCardId) { - return new OrderCreateDTO() - .setUserId(userId) - .setUserAddressId(userAddressId) - .setRemark(remark) - .setIp(ip) - .setOrderItems(this.convert(cartItems)) - .setCouponCardId(couponCardId); - } - -} diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/convert/OrderDeliveryConvert.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/convert/OrderDeliveryConvert.java deleted file mode 100644 index 777126121..000000000 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/convert/OrderDeliveryConvert.java +++ /dev/null @@ -1,20 +0,0 @@ -package cn.iocoder.mall.order.application.convert; - -import cn.iocoder.mall.order.api.dto.OrderDeliveryDTO; -import cn.iocoder.mall.order.application.po.admin.OrderDeliverPO; -import org.mapstruct.Mapper; -import org.mapstruct.Mappings; -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); -} diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/convert/OrderReturnConvert.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/convert/OrderReturnConvert.java deleted file mode 100644 index 71f25954f..000000000 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/convert/OrderReturnConvert.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.iocoder.mall.order.application.convert; - -import cn.iocoder.mall.order.api.dto.OrderReturnApplyDTO; -import cn.iocoder.mall.order.api.dto.OrderReturnQueryDTO; -import cn.iocoder.mall.order.application.po.admin.OrderReturnQueryPO; -import cn.iocoder.mall.order.application.po.user.OrderReturnApplyPO; -import org.mapstruct.Mapper; -import org.mapstruct.Mappings; -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); -} diff --git a/order/order-application/src/main/resources/application.yaml b/order/order-application/src/main/resources/application.yaml index a602900ae..17a49c062 100644 --- a/order/order-application/src/main/resources/application.yaml +++ b/order/order-application/src/main/resources/application.yaml @@ -1,32 +1,7 @@ spring: + # Application 的配置项 application: name: order-application - - # Spring Cloud 配置项 - cloud: - # Spring Cloud Sentinel 配置项 - sentinel: - transport: - dashboard: s1.iocoder.cn:12088 # Sentinel Dashboard 服务地址 - eager: true # 项目启动时,直接连接到 Sentinel - -# server -server: - port: 18088 - servlet: - context-path: /order-api/ - -swagger: - enable: true # 暂时不去掉 - title: 订单子系统 - description: 订单子系统 - version: 1.0.0 - base-package: cn.iocoder.mall.order.application.controller - -management: - endpoints: - web: - exposure: - include: health,info,env,metrics,prometheus - metrics: - enabled: true + # Profile 的配置项 + profiles: + active: local diff --git a/order/order-biz-api/pom.xml b/order/order-biz-api/pom.xml new file mode 100644 index 000000000..b024bd6de --- /dev/null +++ b/order/order-biz-api/pom.xml @@ -0,0 +1,24 @@ + + + + onemall + cn.iocoder.mall + 1.0-SNAPSHOT + + 4.0.0 + + order-biz-api + + + + + cn.iocoder.mall + common-framework + 1.0-SNAPSHOT + + + + + diff --git a/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/package-info.java b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/package-info.java new file mode 100644 index 000000000..6c1bb4730 --- /dev/null +++ b/order/order-biz-api/src/main/java/cn/iocoder/mall/order/biz/package-info.java @@ -0,0 +1,6 @@ +/** + * 该项目,主要用于暴露一些共享的枚举类等。 + * + * 例如说,RPC 接口提供错误码给调用方 + */ +package cn.iocoder.mall.order.biz; diff --git a/order/order-biz/pom.xml b/order/order-biz/pom.xml new file mode 100644 index 000000000..3a30bd194 --- /dev/null +++ b/order/order-biz/pom.xml @@ -0,0 +1,73 @@ + + + + onemall + cn.iocoder.mall + 1.0-SNAPSHOT + + 4.0.0 + + order-biz + + + + cn.iocoder.mall + order-biz-api + 1.0-SNAPSHOT + + + + + org.springframework.boot + spring-boot-starter + + + + + mysql + mysql-connector-java + + + org.springframework + spring-tx + + + org.springframework + spring-jdbc + + + com.alibaba + druid-spring-boot-starter + + + + cn.iocoder.mall + mall-spring-boot-starter-mybatis + 1.0-SNAPSHOT + + + + + org.mapstruct + mapstruct + + + org.mapstruct + mapstruct-jdk8 + + + org.projectlombok + lombok + + + + com.alibaba + fastjson + + + + + + diff --git a/order/order-biz/src/main/resources/biz.yaml b/order/order-biz/src/main/resources/biz.yaml new file mode 100644 index 000000000..ba156c62e --- /dev/null +++ b/order/order-biz/src/main/resources/biz.yaml @@ -0,0 +1,19 @@ +spring: + # 数据源配置项 + datasource: + url: jdbc:mysql://s1.iocoder.cn:3306/mall_system?useSSL=false&useUnicode=true&characterEncoding=UTF-8 + driver-class-name: com.mysql.jdbc.Driver + username: root + password: 3WLiVUBEwTbvAfsh + +# MyBatis Plus 配置项 +mybatis-plus: + configuration: + map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。 + global-config: + db-config: + id-type: auto + logic-delete-value: 1 # 逻辑已删除值(默认为 1) + logic-not-delete-value: 0 # 逻辑未删除值(默认为 0) + mapper-locations: classpath*:mapper/*.xml + type-aliases-package: cn.iocoder.mall.system.biz.dataobject diff --git a/order/order-rest/pom.xml b/order/order-rest/pom.xml new file mode 100644 index 000000000..150c7d471 --- /dev/null +++ b/order/order-rest/pom.xml @@ -0,0 +1,41 @@ + + + + order + cn.iocoder.mall + 1.0-SNAPSHOT + + 4.0.0 + + order-rest + 提供 order 服务的 Rest 接口的实现,提供对外调用 + + + + + cn.iocoder.mall + order-biz + 1.0-SNAPSHOT + + + + cn.iocoder.mall + mall-spring-boot-starter-web + 1.0-SNAPSHOT + + + cn.iocoder.mall + mall-spring-boot-starter-security + 1.0-SNAPSHOT + + + cn.iocoder.mall + mall-spring-boot-starter-swagger + 1.0-SNAPSHOT + + + + + diff --git a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/admins/AdminOrderReturnController.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/admins/AdminOrderReturnController.java new file mode 100644 index 000000000..e0a2e3ba6 --- /dev/null +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/admins/AdminOrderReturnController.java @@ -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 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); +// } +} diff --git a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/admins/AdminsOrderController.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/admins/AdminsOrderController.java new file mode 100644 index 000000000..fa2eb03d6 --- /dev/null +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/admins/AdminsOrderController.java @@ -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 getOrderPage(@Validated OrderPageQueryPO orderPageQueryVO) { +// OrderQueryDTO orderQueryDTO = OrderConvertAPP.INSTANCE.convert(orderPageQueryVO); +// return orderService.getOrderPage(orderQueryDTO); +// } +// +// @GetMapping("order_items") +// @ApiOperation("订单列表") +// public CommonResult> getOrderItems(@RequestParam("orderId") Integer orderId) { +// return orderService.getOrderItems(orderId); +// } +// +// @GetMapping("order_recipient_info") +// @ApiOperation("订单收件人信息") +// public CommonResult getOrderRecipientBO(@RequestParam("orderId") Integer orderId) { +// return orderService.getOrderRecipientBO(orderId); +// } +// +// @PostMapping("order_deliver") +// @ApiOperation("订单发货") +// public CommonResult 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); +// } +} diff --git a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderCommentController.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderCommentController.java new file mode 100644 index 000000000..d13a233e7 --- /dev/null +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderCommentController.java @@ -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 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 getOrderCommentPage(@Validated OrderCommentPageDTO orderCommentPageDTO){ +// return success(orderCommentService.getOrderCommentPage(orderCommentPageDTO)); +// } +// +// @GetMapping("order_comment_info_merchant_reply") +// @ApiOperation(value = "获取评论和商家回复") +// public CommonResult 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 getOrderCommentStateInfoPage(@Validated OrderCommentStateInfoPageDTO orderCommentStateInfoPageDTO){ +// //Integer userId = UserSecurityContextHolder.getContext().getUserId(); +// //orderCommentStateInfoPageDTO.setUserId(userId); +// return success(orderCommentService.getOrderCommentStateInfoPage(orderCommentStateInfoPageDTO)); +// } + + +} diff --git a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderCommentReplyController.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderCommentReplyController.java new file mode 100644 index 000000000..b9787a203 --- /dev/null +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderCommentReplyController.java @@ -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 createOrderCommentReply(@RequestBody @Validated OrderCommentReplyCreateDTO orderCommentReplyCreateDTO){ +// return success(orderCommentReplyService.createOrderCommentReply(orderCommentReplyCreateDTO)); +// } +// +// @GetMapping("order_comment_reply_page") +// //@RequiresLogin +// @ApiOperation(value = "分页获取评论回复") +// public CommonResult getOrderCommentReplyPage(@Validated OrderCommentReplyPageDTO orderCommentReplyCreateDTO){ +// return success(orderCommentReplyService.getOrderCommentReplyPage(orderCommentReplyCreateDTO)); +// } +} diff --git a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderController.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderController.java new file mode 100644 index 000000000..ab0d08c95 --- /dev/null +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderController.java @@ -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 getOrderPage(@Validated OrderQueryDTO orderQueryDTO) { +// Integer userId = UserSecurityContextHolder.getContext().getUserId(); +// orderQueryDTO.setUserId(userId); +// return orderService.getOrderPage(orderQueryDTO); +// } +// +// @PostMapping("create_order") +// @RequiresLogin +// @ApiOperation("创建订单") +// public CommonResult 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 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 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 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 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 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 orderInfo(@RequestParam("orderId") Integer orderId) { +// Integer userId = UserSecurityContextHolder.getContext().getUserId(); +// CommonResult commonResult = orderService.info(userId, orderId); +// +// OrderInfoBO orderInfoBO = commonResult.getData(); +// if (orderInfoBO != null) { +// CommonResult dictResult = dataDictService +// .getDataDict(DictKeyConstants.ORDER_STATUS, orderInfoBO.getStatus()); +// orderInfoBO.setStatusText(dictResult.getData().getDisplayName()); +// } +// return commonResult; +// } + +} diff --git a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderLogisticsController.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderLogisticsController.java new file mode 100644 index 000000000..43bfd8bfd --- /dev/null +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderLogisticsController.java @@ -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 logistics(@RequestParam("logisticsId") Integer logisticsId) { +// return orderLogisticsService.getLogisticsInfo(logisticsId); +// } +// +// @GetMapping("info_order") +// @ApiOperation("物流详细 - 返回订单所关联的所有物流信息(订单用的)") +// public CommonResult logisticsInfoWithOrder(@RequestParam("orderId") Integer orderId) { +// Integer userId = UserSecurityContextHolder.getContext().getUserId(); +// CommonResult commonResult = orderLogisticsService.getOrderLogisticsInfo(userId, orderId); +// if (commonResult.isSuccess()) { +// OrderLogisticsInfoWithOrderBO orderLogisticsInfoBO = commonResult.getData(); +// List logisticsList = orderLogisticsInfoBO.getLogistics(); +// +// // 获取字典值 +// Set dictValues = logisticsList.stream().map(o -> o.getLogistics()).collect(Collectors.toSet()); +// if (!CollectionUtils.isEmpty(dictValues)) { +// CommonResult> dictResult = dataDictService +// .getDataDictList(DictKeyConstants.ORDER_LOGISTICS_COMPANY, dictValues); +// +// if (dictResult.isError()) { +// // 错误情况 +// return ServiceExceptionUtil.error(OrderErrorCodeEnum.DICT_SERVER_INVOKING_FAIL.getCode()); +// } +// +// // 转换结果字典值 +// Map 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; +// } +} diff --git a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderReturnController.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderReturnController.java new file mode 100644 index 000000000..d9ea9dfdd --- /dev/null +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/OrderReturnController.java @@ -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> 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 orderApplyInfo(@RequestParam("orderId") Integer orderId) { +// CommonResult commonResult = orderReturnService.orderApplyInfo(orderId); +// +// // 转换 字典值 +// if (commonResult.isSuccess()) { +// CommonResult dataDictResult = dataDictService.getDataDict( +// DictKeyConstants.ORDER_RETURN_SERVICE_TYPE, +// commonResult.getData().getReturnInfo().getServiceType()); +// +// if (dataDictResult.isSuccess()) { +// commonResult.getData().getReturnInfo().setServiceTypeText(dataDictResult.getData().getDisplayName()); +// } +// } +// +// return commonResult; +// } +} diff --git a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/UsersCartController.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/UsersCartController.java new file mode 100644 index 000000000..9b8b4e16a --- /dev/null +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/controller/users/UsersCartController.java @@ -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 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 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 updateSelected(@RequestParam("skuIds") Set skuIds, // TODO 芋艿,先暂用这个 VO 。等促销活动出来后,做调整 +// @RequestParam("selected") Boolean selected) { +// // 添加到购物车 +// cartService.updateSelected(UserSecurityContextHolder.getContext().getUserId(), skuIds, selected); +// // 获得目前购物车明细 +// return getCartDetail(); +// } +// +// @GetMapping("count") +// public CommonResult count() { +// return success(cartService.count(UserSecurityContextHolder.getContext().getUserId())); +// } +// +// @GetMapping("/list") +// public CommonResult list() { // TODO 芋艿,先暂用这个 VO 。等促销活动出来后,做调整 +// return getCartDetail(); +// } +// +// private CommonResult getCartDetail() { +// // 获得购物车中选中的 +// List 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 getConfirmCreateOrder(@RequestParam(value = "couponCardId", required = false) Integer couponCardId) { +// Integer userId = UserSecurityContextHolder.getContext().getUserId(); +// // 获得购物车中选中的 +// List 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 couponCards = couponService.getCouponCardList(userId, +// CartConvert.INSTANCE.convertList(calcOrderPrice.getItemGroups())); +// // 执行数据拼装 +// return success(CartConvert.INSTANCE.convert(calcOrderPrice).setCouponCards(couponCards)); +// } +// +// private CalcOrderPriceBO list0(List 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 calcSkuPrice(@RequestParam("skuId") Integer skuId) { +// // 计算 sku 的价格 +// CalcSkuPriceBO calcSkuPrice = cartService.calcSkuPrice(skuId); +// return success(CartConvert.INSTANCE.convert2(calcSkuPrice)); +// } +// +// public CommonResult confirmOrder() { +// // 查询购物车列表(选中的) +//// cartService.list(userId, true); +// // 查询确认订单信息的明细 +// +// return null; +// } + +} diff --git a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/convert/CartConvert.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/convert/CartConvert.java new file mode 100644 index 000000000..432f602c4 --- /dev/null +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/convert/CartConvert.java @@ -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 convertList(List itemGroups) { +// List 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; +// } + +} diff --git a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/convert/OrderConvertAPP.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/convert/OrderConvertAPP.java new file mode 100644 index 000000000..67deea991 --- /dev/null +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/convert/OrderConvertAPP.java @@ -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 convert(List cartItems); +// +// default OrderCreateDTO createOrderCreateDTO(Integer userId, Integer userAddressId, +// String remark, String ip, +// List cartItems, Integer couponCardId) { +// return new OrderCreateDTO() +// .setUserId(userId) +// .setUserAddressId(userAddressId) +// .setRemark(remark) +// .setIp(ip) +// .setOrderItems(this.convert(cartItems)) +// .setCouponCardId(couponCardId); +// } + +} diff --git a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/convert/OrderDeliveryConvert.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/convert/OrderDeliveryConvert.java new file mode 100644 index 000000000..d6c8d6ec5 --- /dev/null +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/convert/OrderDeliveryConvert.java @@ -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); +} diff --git a/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/convert/OrderReturnConvert.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/convert/OrderReturnConvert.java new file mode 100644 index 000000000..90997321d --- /dev/null +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/convert/OrderReturnConvert.java @@ -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); +} diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/po/admin/OrderDeliverPO.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/admin/OrderDeliverRequest.java similarity index 90% rename from order/order-application/src/main/java/cn/iocoder/mall/order/application/po/admin/OrderDeliverPO.java rename to order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/admin/OrderDeliverRequest.java index f91264987..2a7326da8 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/po/admin/OrderDeliverPO.java +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/admin/OrderDeliverRequest.java @@ -1,13 +1,12 @@ -package cn.iocoder.mall.order.application.po.admin; +package cn.iocoder.mall.order.rest.request.admin; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; import java.io.Serializable; import java.util.List; +import javax.validation.constraints.NotNull; +import lombok.Data; +import lombok.experimental.Accessors; /** * 订单发货 @@ -18,7 +17,7 @@ import java.util.List; @Data @Accessors(chain = true) @ApiModel(description = "订单发货PO") -public class OrderDeliverPO implements Serializable { +public class OrderDeliverRequest implements Serializable { /** * 订单编号 diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/po/admin/OrderItemUpdatePO.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/admin/OrderItemUpdateRequest.java similarity index 90% rename from order/order-application/src/main/java/cn/iocoder/mall/order/application/po/admin/OrderItemUpdatePO.java rename to order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/admin/OrderItemUpdateRequest.java index dac2b7e15..263bc3bec 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/po/admin/OrderItemUpdatePO.java +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/admin/OrderItemUpdateRequest.java @@ -1,13 +1,12 @@ -package cn.iocoder.mall.order.application.po.admin; +package cn.iocoder.mall.order.rest.request.admin; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - +import java.io.Serializable; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; -import java.io.Serializable; +import lombok.Data; +import lombok.experimental.Accessors; /** * 订单 item 更新 @@ -18,7 +17,7 @@ import java.io.Serializable; @Data @Accessors(chain = true) @ApiModel("订单item更新") -public class OrderItemUpdatePO implements Serializable { +public class OrderItemUpdateRequest implements Serializable { /** * 编号 diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/po/admin/OrderLogisticsPO.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/admin/OrderLogisticsRequest.java similarity index 92% rename from order/order-application/src/main/java/cn/iocoder/mall/order/application/po/admin/OrderLogisticsPO.java rename to order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/admin/OrderLogisticsRequest.java index 1661562f4..80df6f660 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/po/admin/OrderLogisticsPO.java +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/admin/OrderLogisticsRequest.java @@ -1,13 +1,12 @@ -package cn.iocoder.mall.order.application.po.admin; +package cn.iocoder.mall.order.rest.request.admin; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - +import java.io.Serializable; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; -import java.io.Serializable; +import lombok.Data; +import lombok.experimental.Accessors; /** * 订单物流 @@ -18,7 +17,7 @@ import java.io.Serializable; @Data @Accessors(chain = true) @ApiModel("订单物流信息") -public class OrderLogisticsPO implements Serializable { +public class OrderLogisticsRequest implements Serializable { /** * 订单 id diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/po/admin/OrderPageQueryPO.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/admin/OrderPageQueryRequest.java similarity index 94% rename from order/order-application/src/main/java/cn/iocoder/mall/order/application/po/admin/OrderPageQueryPO.java rename to order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/admin/OrderPageQueryRequest.java index 70ea5a0ee..d56338c4e 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/po/admin/OrderPageQueryPO.java +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/admin/OrderPageQueryRequest.java @@ -1,14 +1,13 @@ -package cn.iocoder.mall.order.application.po.admin; +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; -import java.io.Serializable; -import java.util.Date; - /** * 订单 page 查询 vo * @@ -18,7 +17,7 @@ import java.util.Date; @Data @Accessors(chain = true) @ApiModel("订单查询") -public class OrderPageQueryPO implements Serializable { +public class OrderPageQueryRequest implements Serializable { /** * id diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/po/admin/OrderPagePO.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/admin/OrderPageRequest.java similarity index 86% rename from order/order-application/src/main/java/cn/iocoder/mall/order/application/po/admin/OrderPagePO.java rename to order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/admin/OrderPageRequest.java index 8a8a4a068..8200e491d 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/po/admin/OrderPagePO.java +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/admin/OrderPageRequest.java @@ -1,13 +1,12 @@ -package cn.iocoder.mall.order.application.po.admin; +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 lombok.Data; -import lombok.experimental.Accessors; - import java.io.Serializable; import java.util.List; +import lombok.Data; +import lombok.experimental.Accessors; /** * 订单分页 vo @@ -18,7 +17,7 @@ import java.util.List; @Data @Accessors(chain = true) @ApiModel("订单VO") -public class OrderPagePO implements Serializable { +public class OrderPageRequest implements Serializable { /** * 分页 diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/po/admin/OrderReturnQueryPO.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/admin/OrderReturnQueryRequest.java similarity index 90% rename from order/order-application/src/main/java/cn/iocoder/mall/order/application/po/admin/OrderReturnQueryPO.java rename to order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/admin/OrderReturnQueryRequest.java index b1b496b32..d4c89d137 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/po/admin/OrderReturnQueryPO.java +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/admin/OrderReturnQueryRequest.java @@ -1,13 +1,12 @@ -package cn.iocoder.mall.order.application.po.admin; +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; -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.util.Date; - /** * 订单退货 查询 po * @@ -16,7 +15,7 @@ import java.util.Date; */ @Data @Accessors(chain = true) -public class OrderReturnQueryPO implements Serializable { +public class OrderReturnQueryRequest implements Serializable { /** * diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/po/user/OrderCreatePO.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/users/OrderCreateRequest.java similarity index 90% rename from order/order-application/src/main/java/cn/iocoder/mall/order/application/po/user/OrderCreatePO.java rename to order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/users/OrderCreateRequest.java index 4c193fbc3..678918fd6 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/po/user/OrderCreatePO.java +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/users/OrderCreateRequest.java @@ -1,13 +1,12 @@ -package cn.iocoder.mall.order.application.po.user; - -import lombok.Data; -import lombok.experimental.Accessors; +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 java.io.Serializable; -import java.util.List; +import lombok.Data; +import lombok.experimental.Accessors; /** * 订单创建 @@ -17,7 +16,7 @@ import java.util.List; */ @Data @Accessors(chain = true) -public class OrderCreatePO implements Serializable { +public class OrderCreateRequest implements Serializable { /** * 收件手机号 diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/po/user/OrderReturnApplyPO.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/users/OrderReturnApplyRequest.java similarity index 89% rename from order/order-application/src/main/java/cn/iocoder/mall/order/application/po/user/OrderReturnApplyPO.java rename to order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/users/OrderReturnApplyRequest.java index 64cad4de9..a34c2455c 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/po/user/OrderReturnApplyPO.java +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/request/users/OrderReturnApplyRequest.java @@ -1,11 +1,10 @@ -package cn.iocoder.mall.order.application.po.user; - -import lombok.Data; -import lombok.experimental.Accessors; +package cn.iocoder.mall.order.rest.request.users; +import java.io.Serializable; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; -import java.io.Serializable; +import lombok.Data; +import lombok.experimental.Accessors; /** * 订单售后 @@ -15,7 +14,7 @@ import java.io.Serializable; */ @Data @Accessors(chain = true) -public class OrderReturnApplyPO implements Serializable { +public class OrderReturnApplyRequest implements Serializable { /** * 订单编号 diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/UsersCalcSkuPriceVO.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/response/UsersCalcSkuPriceResponse.java similarity index 68% rename from order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/UsersCalcSkuPriceVO.java rename to order/order-rest/src/main/java/cn/iocoder/mall/order/rest/response/UsersCalcSkuPriceResponse.java index d8826ed7e..6cf7ed411 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/UsersCalcSkuPriceVO.java +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/response/UsersCalcSkuPriceResponse.java @@ -1,6 +1,5 @@ -package cn.iocoder.mall.order.application.vo; +package cn.iocoder.mall.order.rest.response; -import cn.iocoder.mall.promotion.api.bo.PromotionActivityBO; import io.swagger.annotations.ApiModel; import lombok.Data; import lombok.experimental.Accessors; @@ -8,20 +7,20 @@ import lombok.experimental.Accessors; @ApiModel("计算商品 SKU 价格结果 VO") @Data @Accessors(chain = true) -public class UsersCalcSkuPriceVO { +public class UsersCalcSkuPriceResponse { /** * 满减送促销活动 * * TODO 芋艿,后续改成 VO */ - private PromotionActivityBO fullPrivilege; +// private PromotionActivityBO fullPrivilege; /** * 电视和折扣促销活动 * * TODO 芋艿,后续改成 VO */ - private PromotionActivityBO timeLimitedDiscount; +// private PromotionActivityBO timeLimitedDiscount; /** * 原价格,单位:分。 */ diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/UsersCartDetailVO.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/response/UsersCartDetailResponse.java similarity index 91% rename from order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/UsersCartDetailVO.java rename to order/order-rest/src/main/java/cn/iocoder/mall/order/rest/response/UsersCartDetailResponse.java index c34696f1a..68e30c5c0 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/UsersCartDetailVO.java +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/response/UsersCartDetailResponse.java @@ -1,17 +1,14 @@ -package cn.iocoder.mall.order.application.vo; +package cn.iocoder.mall.order.rest.response; -import cn.iocoder.mall.product.api.bo.ProductAttrAndValuePairBO; -import cn.iocoder.mall.promotion.api.bo.PromotionActivityBO; import io.swagger.annotations.ApiModel; +import java.util.List; import lombok.Data; import lombok.experimental.Accessors; -import java.util.List; - @ApiModel(value = "购物车明细 VO") @Data @Accessors(chain = true) -public class UsersCartDetailVO { +public class UsersCartDetailResponse { /** * 商品分组数组 @@ -34,7 +31,7 @@ public class UsersCartDetailVO { /** * 优惠活动 */ - private PromotionActivityBO activity; // TODO 芋艿,偷懒 +// private PromotionActivityBO activity; // TODO 芋艿,偷懒 /** * 促销减少的金额 * @@ -69,7 +66,7 @@ public class UsersCartDetailVO { /** * 规格值数组 */ - private List attrs; // TODO 后面改下 +// private List attrs; // TODO 后面改下 /** * 价格,单位:分 */ @@ -92,7 +89,7 @@ public class UsersCartDetailVO { /** * 优惠活动 */ - private PromotionActivityBO activity; +// private PromotionActivityBO activity; /** * 原始单价,单位:分。 */ diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/UsersOrderConfirmCreateVO.java b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/response/UsersOrderConfirmCreateResponse.java similarity index 90% rename from order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/UsersOrderConfirmCreateVO.java rename to order/order-rest/src/main/java/cn/iocoder/mall/order/rest/response/UsersOrderConfirmCreateResponse.java index 21c0379c7..d16970dd0 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/UsersOrderConfirmCreateVO.java +++ b/order/order-rest/src/main/java/cn/iocoder/mall/order/rest/response/UsersOrderConfirmCreateResponse.java @@ -1,16 +1,12 @@ -package cn.iocoder.mall.order.application.vo; +package cn.iocoder.mall.order.rest.response; -import cn.iocoder.mall.product.api.bo.ProductAttrAndValuePairBO; -import cn.iocoder.mall.promotion.api.bo.CouponCardAvailableBO; -import cn.iocoder.mall.promotion.api.bo.PromotionActivityBO; +import java.util.List; import lombok.Data; import lombok.experimental.Accessors; -import java.util.List; - @Data @Accessors(chain = true) -public class UsersOrderConfirmCreateVO { +public class UsersOrderConfirmCreateResponse { /** * 商品分组数组 @@ -23,7 +19,7 @@ public class UsersOrderConfirmCreateVO { /** * 优惠劵列表 TODO 芋艿,后续改改 */ - private List couponCards; +// private List couponCards; /** * 优惠劵优惠金额 */ @@ -42,7 +38,7 @@ public class UsersOrderConfirmCreateVO { */ // TODO 芋艿,目前只会有【满减送】的情况,未来有新的促销方式,可能需要改成数组 // TODO 芋艿,后面改成 VO - private PromotionActivityBO activity; +// private PromotionActivityBO activity; /** * 商品数组 */ @@ -70,7 +66,7 @@ public class UsersOrderConfirmCreateVO { /** * 规格值数组 */ - private List attrs; // TODO 后面改下 +// private List attrs; // TODO 后面改下 /** * 价格,单位:分 */ diff --git a/order/order-rest/src/main/resources/rest.yaml b/order/order-rest/src/main/resources/rest.yaml new file mode 100644 index 000000000..460ca2af0 --- /dev/null +++ b/order/order-rest/src/main/resources/rest.yaml @@ -0,0 +1,12 @@ +# 服务器的配置项 +server: + port: 18088 + servlet: + context-path: /order-api/ + +# Swagger 配置项 +swagger: + title: 订单子系统 + description: 订单子系统 + version: 1.0.0 + base-package: cn.iocoder.mall.order.rest.controller diff --git a/order/order-rpc-api/pom.xml b/order/order-rpc-api/pom.xml new file mode 100644 index 000000000..d8c4aa5f7 --- /dev/null +++ b/order/order-rpc-api/pom.xml @@ -0,0 +1,36 @@ + + + + order + cn.iocoder.mall + 1.0-SNAPSHOT + + 4.0.0 + + order-rpc-api + + + + + cn.iocoder.mall + order-biz-api + 1.0-SNAPSHOT + + + + + javax.validation + validation-api + + + org.projectlombok + lombok + + + + + + + diff --git a/order/order-rpc-api/src/main/java/cn/iocoder/mall/order/rpc/package-info.java b/order/order-rpc-api/src/main/java/cn/iocoder/mall/order/rpc/package-info.java new file mode 100644 index 000000000..5f974723b --- /dev/null +++ b/order/order-rpc-api/src/main/java/cn/iocoder/mall/order/rpc/package-info.java @@ -0,0 +1,4 @@ +/** + * 提供 order 服务的 RPC 接口的定义,提供内部调用 + */ +package cn.iocoder.mall.order.rpc; diff --git a/order/order-rpc/pom.xml b/order/order-rpc/pom.xml new file mode 100644 index 000000000..bc7aac411 --- /dev/null +++ b/order/order-rpc/pom.xml @@ -0,0 +1,42 @@ + + + + order + cn.iocoder.mall + 1.0-SNAPSHOT + + 4.0.0 + + order-rpc + + + + + cn.iocoder.mall + order-rpc-api + 1.0-SNAPSHOT + + + cn.iocoder.mall + order-biz + 1.0-SNAPSHOT + + + + + com.alibaba.cloud + spring-cloud-starter-dubbo + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + + + diff --git a/order/order-rpc/src/main/java/cn/iocoder/mall/order/rpc/package-info.java b/order/order-rpc/src/main/java/cn/iocoder/mall/order/rpc/package-info.java new file mode 100644 index 000000000..ac5570aeb --- /dev/null +++ b/order/order-rpc/src/main/java/cn/iocoder/mall/order/rpc/package-info.java @@ -0,0 +1,4 @@ +/** + * 提供 order 服务的 RPC 接口的实现,提供内部调用 + */ +package cn.iocoder.mall.order.rpc; diff --git a/order/order-rpc/src/main/resources/rpc-local.yaml b/order/order-rpc/src/main/resources/rpc-local.yaml new file mode 100644 index 000000000..e056170af --- /dev/null +++ b/order/order-rpc/src/main/resources/rpc-local.yaml @@ -0,0 +1,14 @@ +spring: + # Spring Cloud 配置项 + cloud: + nacos: + # Spring Cloud Nacos Discovery 配置项 + discovery: + server-addr: s1.iocoder.cn:8848 # Nacos 服务器地址 + namespace: local # Nacos 命名空间 + +# Dubbo 配置项 +dubbo: + # Dubbo 注册中心 + registry: + address: spring-cloud://s1.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 diff --git a/order/order-rpc/src/main/resources/rpc-test.yaml b/order/order-rpc/src/main/resources/rpc-test.yaml new file mode 100644 index 000000000..d3d0e9e69 --- /dev/null +++ b/order/order-rpc/src/main/resources/rpc-test.yaml @@ -0,0 +1,14 @@ +spring: + # Spring Cloud 配置项 + cloud: + nacos: + # Spring Cloud Nacos Discovery 配置项 + discovery: + server-addr: s1.iocoder.cn:8848 # Nacos 服务器地址 + namespace: test # Nacos 命名空间 + +# Dubbo 配置项 +dubbo: + # Dubbo 注册中心 + registry: + address: spring-cloud://s1.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 diff --git a/order/order-rpc/src/main/resources/rpc.yaml b/order/order-rpc/src/main/resources/rpc.yaml new file mode 100644 index 000000000..8c8b6b591 --- /dev/null +++ b/order/order-rpc/src/main/resources/rpc.yaml @@ -0,0 +1,40 @@ +# Dubbo 配置项 +dubbo: + # Spring Cloud Alibaba Dubbo 专属配置 + cloud: + subscribed-services: '' # 设置订阅的应用列表,默认为 * 订阅所有应用 + # Dubbo 提供者的协议 + protocol: + name: dubbo + port: -1 + # Dubbo 提供服务的扫描基础包 + scan: + base-packages: cn.iocoder.mall.order.rpc.rpc + # Dubbo 服务提供者的配置 + provider: + filter: -exception + SystemLogRPC: + version: 1.0.0 + OAuth2RPC: + version: 1.0.0 + AuthorizationRPC: + version: 1.0.0 + AdminRPC: + version: 1.0.0 + UserRPC: + version: 1.0.0 + UserAddressRPC: + version: 1.0.0 + + # Dubbo 服务消费者的配置 + consumer: + SystemLogRPC: # 用于 AccessLogInterceptor 等拦截器,记录 HTTP API 请求的访问日志 + version: 1.0.0 + OAuth2RPC: # 用于 AccountAuthInterceptor 拦截器,执行认证 + version: 1.0.0 + AuthorizationRPC: # 用于 AccountAuthInterceptor 拦截器,执行鉴权(权限验证) + version: 1.0.0 + AdminRPC: + version: 1.0.0 + UserRPC: + version: 1.0.0 diff --git a/order/pom.xml b/order/pom.xml index 3fe0dbfaf..26cf50f5d 100644 --- a/order/pom.xml +++ b/order/pom.xml @@ -13,8 +13,12 @@ pom order-application - order-service-api - order-service-impl + order-biz + order-biz-api + order-rest + order-rpc + order-rpc-api + diff --git a/pom.xml b/pom.xml index c9f253210..95aded6bf 100644 --- a/pom.xml +++ b/pom.xml @@ -15,7 +15,7 @@ 1.0-SNAPSHOT product - + order user common system @@ -25,7 +25,12 @@ mall-dependencies - mall-cache + order-biz + order/order-biz + order/order-biz-api + order/order-rpc + order/order-rpc-api + order-rest pom diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/ProductCategoryMapper.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/ProductCategoryMapper.java index 7c9ac8fae..93843e69e 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/ProductCategoryMapper.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dao/product/ProductCategoryMapper.java @@ -3,6 +3,7 @@ package cn.iocoder.mall.product.biz.dao.product; import cn.iocoder.mall.product.biz.dataobject.product.ProductBrandDO; import cn.iocoder.mall.product.biz.dataobject.product.ProductCategoryDO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Update; import org.springframework.stereotype.Repository; /** diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductCategoryDO.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductCategoryDO.java index 94cab4e03..118850000 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductCategoryDO.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/dataobject/product/ProductCategoryDO.java @@ -1,6 +1,7 @@ package cn.iocoder.mall.product.biz.dataobject.product; import cn.iocoder.mall.mybatis.dataobject.DeletableDO; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.experimental.Accessors; @@ -9,6 +10,7 @@ import lombok.experimental.Accessors; */ @Data @Accessors(chain = true) +@TableName("product_category") public class ProductCategoryDO extends DeletableDO { /** diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/ProductCategoryService.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/ProductCategoryService.java index 624ae9689..e05b48b98 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/ProductCategoryService.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/ProductCategoryService.java @@ -5,6 +5,8 @@ import cn.iocoder.mall.product.biz.dto.category.ProductCategoryAddDTO; import cn.iocoder.mall.product.biz.dto.category.ProductCategoryDeleteDTO; import cn.iocoder.mall.product.biz.dto.category.ProductCategoryUpdateDTO; import cn.iocoder.mall.product.biz.dto.category.ProductCategoryUpdateStatusDTO; + +import javax.validation.Valid; import java.util.List; @@ -26,26 +28,26 @@ public interface ProductCategoryService { * @param productCategoryAddDTO * @return */ - ProductCategoryBO addProductCategory(ProductCategoryAddDTO productCategoryAddDTO); + ProductCategoryBO addProductCategory(@Valid ProductCategoryAddDTO productCategoryAddDTO); /** * 更新商品分类 * @param productCategoryUpdateDTO * @return */ - Boolean updateProductCategory(ProductCategoryUpdateDTO productCategoryUpdateDTO); + Boolean updateProductCategory(@Valid ProductCategoryUpdateDTO productCategoryUpdateDTO); /** * 更新商品分类状态 * @param productCategoryUpdateStatusDTO * @return */ - Boolean updateProductCategoryStatus(ProductCategoryUpdateStatusDTO productCategoryUpdateStatusDTO); + Boolean updateProductCategoryStatus(@Valid ProductCategoryUpdateStatusDTO productCategoryUpdateStatusDTO); /** * 删除商品分类 * @param productCategoryDeleteDTO * @return */ - Boolean deleteProductCategory(ProductCategoryDeleteDTO productCategoryDeleteDTO); + Boolean deleteProductCategory(@Valid ProductCategoryDeleteDTO productCategoryDeleteDTO); } diff --git a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/impl/ProductCategoryServiceImpl.java b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/impl/ProductCategoryServiceImpl.java index 180bbbe82..6a9e63cab 100644 --- a/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/impl/ProductCategoryServiceImpl.java +++ b/product/product-biz/src/main/java/cn/iocoder/mall/product/biz/service/product/impl/ProductCategoryServiceImpl.java @@ -49,7 +49,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { * @return */ @Override - public ProductCategoryBO addProductCategory(@Valid ProductCategoryAddDTO productCategoryAddDTO) { + public ProductCategoryBO addProductCategory(ProductCategoryAddDTO productCategoryAddDTO) { // 校验父分类 validParent(productCategoryAddDTO.getPid()); // 保存到数据库 @@ -69,7 +69,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { * @return */ @Override - public Boolean updateProductCategory(@Valid ProductCategoryUpdateDTO productCategoryUpdateDTO) { + public Boolean updateProductCategory(ProductCategoryUpdateDTO productCategoryUpdateDTO) { // 校验当前分类是否存在 if (productCategoryMapper.selectById(productCategoryUpdateDTO.getId()) == null) { throw ServiceExceptionUtil.exception(PRODUCT_CATEGORY_NOT_EXISTS); @@ -98,7 +98,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { * @return */ @Override - public Boolean updateProductCategoryStatus(@Valid ProductCategoryUpdateStatusDTO productCategoryUpdateStatusDTO) { + public Boolean updateProductCategoryStatus(ProductCategoryUpdateStatusDTO productCategoryUpdateStatusDTO) { Integer productCategoryId = productCategoryUpdateStatusDTO.getId(); Integer status = productCategoryUpdateStatusDTO.getStatus(); // 校验商品分类是否存在 @@ -128,7 +128,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { * @return */ @Override - public Boolean deleteProductCategory(@Valid ProductCategoryDeleteDTO productCategoryDeleteDTO) { + public Boolean deleteProductCategory(ProductCategoryDeleteDTO productCategoryDeleteDTO) { Integer productCategoryId = productCategoryDeleteDTO.getId(); // 校验分类是否存在 ProductCategoryDO productCategory = productCategoryMapper.selectById(productCategoryId); @@ -148,10 +148,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService { } // TODO 伟帆 补充只有不存在商品才可以删除 // 标记删除商品分类 - ProductCategoryDO updateProductCategory = new ProductCategoryDO() - .setId(productCategoryId); - updateProductCategory.setDeleted(DeletedStatusEnum.DELETED_YES.getValue()); - productCategoryMapper.updateById(updateProductCategory); + productCategoryMapper.deleteById(productCategoryId); // TODO 伟帆 操作日志 return true; } diff --git a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/admins/AdminsProductCategoryController.java b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/admins/AdminsProductCategoryController.java index 3ce92f8de..c2246e1d7 100644 --- a/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/admins/AdminsProductCategoryController.java +++ b/product/product-rest/src/main/java/cn/iocoder/mall/product/rest/controller/admins/AdminsProductCategoryController.java @@ -69,7 +69,7 @@ public class AdminsProductCategoryController { @PostMapping("/add") @ApiOperation(value = "创建商品分类") - public CommonResult add(@RequestBody AdminsProductCategoryAddRequest adminsProductCategoryAddRequest) { + public CommonResult add(AdminsProductCategoryAddRequest adminsProductCategoryAddRequest) { // 转换 ProductCategoryAddDTO 对象 ProductCategoryAddDTO productCategoryAddDTO = ProductCategoryConvert.INSTANCE.convertToAddDTO(AdminSecurityContextHolder.getContext().getAdminId(), adminsProductCategoryAddRequest); // 创建商品分类 @@ -80,7 +80,7 @@ public class AdminsProductCategoryController { @PostMapping("/update") @ApiOperation(value = "更新商品分类") - public CommonResult update(@RequestBody AdminsProductCategoryUpdateRequest adminsProductCategoryUpdateRequest) { + public CommonResult update(AdminsProductCategoryUpdateRequest adminsProductCategoryUpdateRequest) { // 创建 ProductCategoryUpdateDTO 对象 ProductCategoryUpdateDTO productCategoryUpdateDTO = ProductCategoryConvert.INSTANCE.convertToUpdateDTO(AdminSecurityContextHolder.getContext().getAdminId(), adminsProductCategoryUpdateRequest); // 更新商品分类 @@ -89,7 +89,7 @@ public class AdminsProductCategoryController { @PostMapping("/update_status") @ApiOperation(value = "更新商品分类状态") - public CommonResult updateStatus(@RequestBody AdminsProductCategoryUpdateStatusRequest adminsProductCategoryUpdateStatusRequest) { + public CommonResult updateStatus(AdminsProductCategoryUpdateStatusRequest adminsProductCategoryUpdateStatusRequest) { // 创建 ProductCategoryUpdateStatusDTO 对象 ProductCategoryUpdateStatusDTO productCategoryUpdateStatusDTO = ProductCategoryConvert.INSTANCE.convertToUpdateStatusDTO(AdminSecurityContextHolder.getContext().getAdminId(), adminsProductCategoryUpdateStatusRequest); diff --git a/product/product-rpc/src/main/resources/rpc.yaml b/product/product-rpc/src/main/resources/rpc.yaml index e056da380..48d16c48a 100644 --- a/product/product-rpc/src/main/resources/rpc.yaml +++ b/product/product-rpc/src/main/resources/rpc.yaml @@ -2,7 +2,7 @@ dubbo: # Spring Cloud Alibaba Dubbo 专属配置 cloud: - subscribed-services: '' # 设置订阅的应用列表,默认为 * 订阅所有应用 + subscribed-services: 'system-application' # 设置订阅的应用列表,默认为 * 订阅所有应用 # Dubbo 提供者的协议 protocol: name: dubbo diff --git a/promotion/promotion-application/pom.xml b/promotion/promotion-application/pom.xml index d6bb18129..784fbe036 100644 --- a/promotion/promotion-application/pom.xml +++ b/promotion/promotion-application/pom.xml @@ -53,6 +53,10 @@ system-sdk 1.0-SNAPSHOT + + cn.iocoder.mall + mall-spring-boot-starter-mybatis + @@ -93,6 +97,18 @@ spring-boot-starter-test test + + cn.iocoder.mall + mall-spring-boot-starter-security + 1.0-SNAPSHOT + compile + + + cn.iocoder.mall + mall-spring-boot-starter-security + 1.0-SNAPSHOT + compile + diff --git a/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsBannerController.java b/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsBannerController.java index 30ca5e58c..7b20fc96c 100644 --- a/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsBannerController.java +++ b/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsBannerController.java @@ -1,7 +1,6 @@ package cn.iocoder.mall.promotion.application.controller.admins; import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.system.sdk.context.AdminSecurityContextHolder; import cn.iocoder.mall.promotion.api.BannerService; import cn.iocoder.mall.promotion.api.bo.BannerPageBO; import cn.iocoder.mall.promotion.api.dto.BannerAddDTO; @@ -10,6 +9,7 @@ import cn.iocoder.mall.promotion.api.dto.BannerUpdateDTO; import cn.iocoder.mall.promotion.application.convert.BannerConvert; import cn.iocoder.mall.promotion.application.vo.admins.AdminsBannerPageVO; import cn.iocoder.mall.promotion.application.vo.admins.AdminsBannerVO; +import cn.iocoder.mall.security.core.context.AdminSecurityContextHolder; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; diff --git a/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsCouponController.java b/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsCouponController.java index 476ae30fc..3a22f90f4 100644 --- a/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsCouponController.java +++ b/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsCouponController.java @@ -2,7 +2,6 @@ package cn.iocoder.mall.promotion.application.controller.admins; import cn.iocoder.common.framework.util.DateUtil; import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.system.sdk.context.AdminSecurityContextHolder; import cn.iocoder.mall.promotion.api.CouponService; import cn.iocoder.mall.promotion.api.bo.CouponTemplateBO; import cn.iocoder.mall.promotion.api.bo.CouponTemplatePageBO; @@ -12,6 +11,7 @@ import cn.iocoder.mall.promotion.api.dto.CouponTemplatePageDTO; import cn.iocoder.mall.promotion.application.convert.CouponTemplateConvert; import cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplatePageVO; import cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplateVO; +import cn.iocoder.mall.security.core.context.AdminSecurityContextHolder; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; diff --git a/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsProductRecommendController.java b/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsProductRecommendController.java index 4737a85c1..8670c7b81 100644 --- a/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsProductRecommendController.java +++ b/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsProductRecommendController.java @@ -1,7 +1,6 @@ package cn.iocoder.mall.promotion.application.controller.admins; import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.system.sdk.context.AdminSecurityContextHolder; import cn.iocoder.mall.product.api.ProductSpuService; import cn.iocoder.mall.product.api.bo.ProductSpuBO; import cn.iocoder.mall.promotion.api.ProductRecommendService; @@ -13,6 +12,7 @@ import cn.iocoder.mall.promotion.api.dto.ProductRecommendUpdateDTO; import cn.iocoder.mall.promotion.application.convert.ProductRecommendConvert; import cn.iocoder.mall.promotion.application.vo.admins.AdminsProductRecommendPageVO; import cn.iocoder.mall.promotion.application.vo.admins.AdminsProductRecommendVO; +import cn.iocoder.mall.security.core.context.AdminSecurityContextHolder; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; diff --git a/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersCouponController.java b/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersCouponController.java index dce496e1a..cb4f095cf 100644 --- a/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersCouponController.java +++ b/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/users/UsersCouponController.java @@ -11,7 +11,7 @@ import cn.iocoder.mall.promotion.application.convert.CouponTemplateConvert; import cn.iocoder.mall.promotion.application.vo.users.UsersCouponCardPageVO; import cn.iocoder.mall.promotion.application.vo.users.UsersCouponCardVO; import cn.iocoder.mall.promotion.application.vo.users.UsersCouponTemplateVO; -import cn.iocoder.mall.user.sdk.context.UserSecurityContextHolder; +import cn.iocoder.mall.security.core.context.UserSecurityContextHolder; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; diff --git a/promotion/promotion-service-impl/pom.xml b/promotion/promotion-service-impl/pom.xml index f6fb32b5f..49b3d9bf7 100644 --- a/promotion/promotion-service-impl/pom.xml +++ b/promotion/promotion-service-impl/pom.xml @@ -90,6 +90,18 @@ spring-boot-starter-test test + + cn.iocoder.mall + mall-spring-boot-starter-mybatis + 1.0-SNAPSHOT + compile + + + cn.iocoder.mall + mall-spring-boot-starter-mybatis + 1.0-SNAPSHOT + compile + diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/BannerDO.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/BannerDO.java index 9e2cc22b9..49f4091c3 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/BannerDO.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/BannerDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.promotion.biz.dataobject; -import cn.iocoder.common.framework.dataobject.DeletableDO; +import cn.iocoder.mall.mybatis.dataobject.DeletableDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponCardDO.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponCardDO.java index 4a41d6291..e4803d5f3 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponCardDO.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponCardDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.promotion.biz.dataobject; -import cn.iocoder.common.framework.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.dataobject.BaseDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponCodeDO.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponCodeDO.java index 61ee2c9cc..d090227ab 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponCodeDO.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponCodeDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.promotion.biz.dataobject; -import cn.iocoder.common.framework.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.dataobject.BaseDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponTemplateDO.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponTemplateDO.java index 37f5284bc..6d3a20406 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponTemplateDO.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/CouponTemplateDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.promotion.biz.dataobject; -import cn.iocoder.common.framework.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.dataobject.BaseDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/ProductRecommendDO.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/ProductRecommendDO.java index 8b245aa5a..0294450ab 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/ProductRecommendDO.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/ProductRecommendDO.java @@ -1,6 +1,7 @@ package cn.iocoder.mall.promotion.biz.dataobject; -import cn.iocoder.common.framework.dataobject.DeletableDO; + +import cn.iocoder.mall.mybatis.dataobject.DeletableDO; import cn.iocoder.mall.promotion.api.constant.ProductRecommendTypeEnum; import lombok.Data; import lombok.experimental.Accessors; diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/PromotionActivityDO.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/PromotionActivityDO.java index aa274796b..d729a0ee0 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/PromotionActivityDO.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/PromotionActivityDO.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.promotion.biz.dataobject; -import cn.iocoder.common.framework.dataobject.BaseDO; +import cn.iocoder.mall.mybatis.dataobject.BaseDO; import lombok.Data; import lombok.experimental.Accessors; diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/mybatis/TestHandler.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/mybatis/TestHandler.java index d8a87c9d2..f36c8ba77 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/mybatis/TestHandler.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/mybatis/TestHandler.java @@ -1,6 +1,6 @@ package cn.iocoder.mall.promotion.biz.mybatis; -import cn.iocoder.common.framework.mybatis.JSONTypeHandler; +import cn.iocoder.mall.mybatis.type.JSONTypeHandler; import cn.iocoder.mall.promotion.biz.dataobject.PromotionActivityDO; public class TestHandler extends JSONTypeHandler { diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/BannerServiceImpl.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/BannerServiceImpl.java index e16287bab..0c1f6d867 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/BannerServiceImpl.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/BannerServiceImpl.java @@ -1,8 +1,8 @@ package cn.iocoder.mall.promotion.biz.service; import cn.iocoder.common.framework.constant.CommonStatusEnum; -import cn.iocoder.common.framework.constant.DeletedStatusEnum; import cn.iocoder.common.framework.util.ServiceExceptionUtil; +import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum; import cn.iocoder.mall.promotion.api.BannerService; import cn.iocoder.mall.promotion.api.bo.BannerBO; import cn.iocoder.mall.promotion.api.bo.BannerPageBO; diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/ProductRecommendServiceImpl.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/ProductRecommendServiceImpl.java index e3e6a940c..f9817416b 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/ProductRecommendServiceImpl.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/ProductRecommendServiceImpl.java @@ -1,8 +1,8 @@ package cn.iocoder.mall.promotion.biz.service; import cn.iocoder.common.framework.constant.CommonStatusEnum; -import cn.iocoder.common.framework.constant.DeletedStatusEnum; import cn.iocoder.common.framework.util.ServiceExceptionUtil; +import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum; import cn.iocoder.mall.product.api.ProductSpuService; import cn.iocoder.mall.promotion.api.ProductRecommendService; import cn.iocoder.mall.promotion.api.bo.ProductRecommendBO; diff --git a/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/request/authorization/AuthorizationCheckPermissionsRequest.java b/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/request/authorization/AuthorizationCheckPermissionsRequest.java index 1dd1b51b0..e618b135a 100644 --- a/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/request/authorization/AuthorizationCheckPermissionsRequest.java +++ b/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/request/authorization/AuthorizationCheckPermissionsRequest.java @@ -4,6 +4,7 @@ import lombok.Data; import lombok.experimental.Accessors; import javax.validation.constraints.NotNull; +import java.io.Serializable; import java.util.List; /** @@ -11,7 +12,7 @@ import java.util.List; */ @Data @Accessors(chain = true) -public class AuthorizationCheckPermissionsRequest { +public class AuthorizationCheckPermissionsRequest implements Serializable { @NotNull(message = "账号不能为空") private Integer accountId; diff --git a/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/request/oauth2/OAuth2AccessTokenAuthenticateRequest.java b/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/request/oauth2/OAuth2AccessTokenAuthenticateRequest.java index 240f9f7d7..81fccf98c 100644 --- a/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/request/oauth2/OAuth2AccessTokenAuthenticateRequest.java +++ b/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/request/oauth2/OAuth2AccessTokenAuthenticateRequest.java @@ -4,13 +4,14 @@ import lombok.Data; import lombok.experimental.Accessors; import javax.validation.constraints.NotNull; +import java.io.Serializable; /** * OAuth2 模块 - 访问令牌认证 Request */ @Data @Accessors(chain = true) -public class OAuth2AccessTokenAuthenticateRequest { +public class OAuth2AccessTokenAuthenticateRequest implements Serializable { @NotNull(message = "访问令牌不能为空") private String accessToken; diff --git a/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/request/systemlog/AccessLogAddRequest.java b/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/request/systemlog/AccessLogAddRequest.java index b58cfa6f0..1cf91c23b 100644 --- a/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/request/systemlog/AccessLogAddRequest.java +++ b/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/request/systemlog/AccessLogAddRequest.java @@ -4,6 +4,7 @@ import lombok.Data; import lombok.experimental.Accessors; import javax.validation.constraints.NotNull; +import java.io.Serializable; import java.util.Date; /** @@ -11,7 +12,7 @@ import java.util.Date; */ @Data @Accessors(chain = true) -public class AccessLogAddRequest { +public class AccessLogAddRequest implements Serializable { /** * 用户编号 - 空 diff --git a/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/request/systemlog/ExceptionLogAddRequest.java b/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/request/systemlog/ExceptionLogAddRequest.java index 8a1e3adf8..920fdef31 100644 --- a/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/request/systemlog/ExceptionLogAddRequest.java +++ b/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/request/systemlog/ExceptionLogAddRequest.java @@ -4,6 +4,7 @@ import lombok.Data; import lombok.experimental.Accessors; import javax.validation.constraints.NotNull; +import java.io.Serializable; import java.util.Date; /** @@ -11,7 +12,7 @@ import java.util.Date; */ @Data @Accessors(chain = true) -public class ExceptionLogAddRequest { +public class ExceptionLogAddRequest implements Serializable { /** * 账号编号 diff --git a/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/response/admin/AdminResponse.java b/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/response/admin/AdminResponse.java index bb29aac0a..8de29ee01 100644 --- a/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/response/admin/AdminResponse.java +++ b/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/response/admin/AdminResponse.java @@ -3,12 +3,14 @@ package cn.iocoder.mall.system.rpc.response.admin; import lombok.Data; import lombok.experimental.Accessors; +import java.io.Serializable; + /** * Admin 模块 - Admin 信息 Response */ @Data @Accessors(chain = true) -public class AdminResponse { +public class AdminResponse implements Serializable { /** * 管理员编号 diff --git a/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/response/oauth2/OAuth2AccessTokenResponse.java b/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/response/oauth2/OAuth2AccessTokenResponse.java index 176034c5c..eb397077a 100644 --- a/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/response/oauth2/OAuth2AccessTokenResponse.java +++ b/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/response/oauth2/OAuth2AccessTokenResponse.java @@ -3,6 +3,7 @@ package cn.iocoder.mall.system.rpc.response.oauth2; import lombok.Data; import lombok.experimental.Accessors; +import java.io.Serializable; import java.util.Date; /** @@ -10,7 +11,7 @@ import java.util.Date; */ @Data @Accessors(chain = true) -public class OAuth2AccessTokenResponse { +public class OAuth2AccessTokenResponse implements Serializable { /** * 访问令牌 diff --git a/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/response/user/UserResponse.java b/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/response/user/UserResponse.java index 4fae0b885..8e3c06688 100644 --- a/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/response/user/UserResponse.java +++ b/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/response/user/UserResponse.java @@ -3,12 +3,14 @@ package cn.iocoder.mall.system.rpc.response.user; import lombok.Data; import lombok.experimental.Accessors; +import java.io.Serializable; + /** * User 模块 - User 信息 Response */ @Data @Accessors(chain = true) -public class UserResponse { +public class UserResponse implements Serializable { /** * 用户编号