diff --git a/cart/cart-application/pom.xml b/cart/cart-application/pom.xml deleted file mode 100644 index 4043c93b7..000000000 --- a/cart/cart-application/pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - cart - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - cart-application - - - - - cn.iocoder.mall - common-framework - 1.0-SNAPSHOT - - - - cn.iocoder.mall - user-sdk - 1.0-SNAPSHOT - - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-test - test - - - - com.alibaba - dubbo - - - com.alibaba.boot - dubbo-spring-boot-starter - - - - org.apache.curator - curator-framework - - - - io.springfox - springfox-swagger2 - - - io.springfox - springfox-swagger-ui - - - - org.springframework.boot - spring-boot-devtools - true - - - - - diff --git a/cart/cart-application/src/main/java/cn/iocoder/mall/cart/application/CartApplication.java b/cart/cart-application/src/main/java/cn/iocoder/mall/cart/application/CartApplication.java deleted file mode 100644 index c65c010b8..000000000 --- a/cart/cart-application/src/main/java/cn/iocoder/mall/cart/application/CartApplication.java +++ /dev/null @@ -1,13 +0,0 @@ -package cn.iocoder.mall.cart.application; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication(scanBasePackages = {"cn.iocoder.mall.cart"}) -public class CartApplication { - - public static void main(String[] args) { - SpringApplication.run(CartApplication.class, args); - } - -} diff --git a/cart/cart-application/src/main/java/cn/iocoder/mall/cart/application/config/MVCConfiguration.java b/cart/cart-application/src/main/java/cn/iocoder/mall/cart/application/config/MVCConfiguration.java deleted file mode 100644 index c1c5c7bcc..000000000 --- a/cart/cart-application/src/main/java/cn/iocoder/mall/cart/application/config/MVCConfiguration.java +++ /dev/null @@ -1,42 +0,0 @@ -package cn.iocoder.mall.cart.application.config; - -import cn.iocoder.common.framework.config.GlobalExceptionHandler; -import cn.iocoder.common.framework.servlet.CorsFilter; -import org.springframework.boot.web.servlet.FilterRegistrationBean; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; -import org.springframework.web.servlet.config.annotation.*; - -@EnableWebMvc -@Configuration -@Import(value = {GlobalExceptionHandler.class}) // 统一全局返回 -public class MVCConfiguration implements WebMvcConfigurer { - -// @Autowired -// private SecurityInterceptor securityInterceptor; - -// @Reference -// private OAuth2Service oauth2Service; - - @Override - public void addInterceptors(InterceptorRegistry registry) { -// registry.addInterceptor(securityInterceptor); - } - - @Override - public void addResourceHandlers(ResourceHandlerRegistry registry) { - // 解决 swagger-ui.html 的访问,参考自 https://stackoverflow.com/questions/43545540/swagger-ui-no-mapping-found-for-http-request 解决 - registry.addResourceHandler("swagger-ui.html**").addResourceLocations("classpath:/META-INF/resources/swagger-ui.html"); - registry.addResourceHandler("webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); - } - - @Bean - public FilterRegistrationBean corsFilter() { - FilterRegistrationBean registrationBean = new FilterRegistrationBean<>(); - registrationBean.setFilter(new CorsFilter()); - registrationBean.addUrlPatterns("/*"); - return registrationBean; - } - -} diff --git a/cart/cart-application/src/main/java/cn/iocoder/mall/cart/application/config/SwaggerConfiguration.java b/cart/cart-application/src/main/java/cn/iocoder/mall/cart/application/config/SwaggerConfiguration.java deleted file mode 100644 index d52f167cf..000000000 --- a/cart/cart-application/src/main/java/cn/iocoder/mall/cart/application/config/SwaggerConfiguration.java +++ /dev/null @@ -1,36 +0,0 @@ -package cn.iocoder.mall.cart.application.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import springfox.documentation.builders.ApiInfoBuilder; -import springfox.documentation.builders.PathSelectors; -import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.service.ApiInfo; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2; - -@Configuration -@EnableSwagger2 -public class SwaggerConfiguration { - - @Bean - public Docket createRestApi() { - return new Docket(DocumentationType.SWAGGER_2) - .apiInfo(apiInfo()) - .select() - .apis(RequestHandlerSelectors.basePackage("cn.iocoder.mall.biz.application.controller")) - .paths(PathSelectors.any()) - .build(); - } - - private ApiInfo apiInfo() { - return new ApiInfoBuilder() - .title("购物车子系统") - .description("购物车子系统") - .termsOfServiceUrl("http://www.iocoder.cn") - .version("1.0.0") - .build(); - } - -} diff --git a/cart/cart-application/src/main/resources/application.yaml b/cart/cart-application/src/main/resources/application.yaml deleted file mode 100644 index c925f363d..000000000 --- a/cart/cart-application/src/main/resources/application.yaml +++ /dev/null @@ -1,9 +0,0 @@ -spring: - application: - name: cart-application - -# server -server: - port: 18086 - servlet: - context-path: /cart-api/ diff --git a/cart/cart-service-api/pom.xml b/cart/cart-service-api/pom.xml deleted file mode 100644 index d301868b7..000000000 --- a/cart/cart-service-api/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - cart - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - cart-service-api - - - - cn.iocoder.mall - common-framework - 1.0-SNAPSHOT - - - - javax.validation - validation-api - - - - org.mapstruct - mapstruct - - - org.mapstruct - mapstruct-jdk8 - - - org.projectlombok - lombok - - - - diff --git a/cart/cart-service-api/src/main/java/cn/iocoder/mall/cart/api/CartService.java b/cart/cart-service-api/src/main/java/cn/iocoder/mall/cart/api/CartService.java deleted file mode 100644 index 47a6a8311..000000000 --- a/cart/cart-service-api/src/main/java/cn/iocoder/mall/cart/api/CartService.java +++ /dev/null @@ -1,4 +0,0 @@ -package cn.iocoder.mall.cart.api; - -public interface CartService { -} diff --git a/cart/cart-service-api/src/main/java/cn/iocoder/mall/cart/api/constant/CartErrorCodeEnum.java b/cart/cart-service-api/src/main/java/cn/iocoder/mall/cart/api/constant/CartErrorCodeEnum.java deleted file mode 100644 index 0dae7880b..000000000 --- a/cart/cart-service-api/src/main/java/cn/iocoder/mall/cart/api/constant/CartErrorCodeEnum.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.mall.cart.api.constant; - -/** - * 错误码枚举类 - * - * 购物车系统,使用 1-005-000-000 段 - */ -public enum CartErrorCodeEnum { - - ; - - private final int code; - private final String message; - - CartErrorCodeEnum(int code, String message) { - this.code = code; - this.message = message; - } - - public int getCode() { - return code; - } - - public String getMessage() { - return message; - } - -} diff --git a/cart/cart-service-impl/pom.xml b/cart/cart-service-impl/pom.xml deleted file mode 100644 index 96e609cee..000000000 --- a/cart/cart-service-impl/pom.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - cart - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - cart-service-impl - - - - com.alibaba - dubbo - - - cn.iocoder.mall - cart-service-api - 1.0-SNAPSHOT - - - - mysql - mysql-connector-java - - - org.springframework.boot - spring-boot-starter-jdbc - - - - org.mybatis.spring.boot - mybatis-spring-boot-starter - - - - com.google.guava - guava - - - - com.xuxueli - xxl-job-core - - - - org.apache.rocketmq - rocketmq-spring-boot-starter - - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - - diff --git a/cart/cart-service-impl/src/main/java/cn/iocoder/mall/cart/biz/config/DatabaseConfiguration.java b/cart/cart-service-impl/src/main/java/cn/iocoder/mall/cart/biz/config/DatabaseConfiguration.java deleted file mode 100644 index 375a47b3e..000000000 --- a/cart/cart-service-impl/src/main/java/cn/iocoder/mall/cart/biz/config/DatabaseConfiguration.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.iocoder.mall.cart.biz.config; - -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -@Configuration -@MapperScan("cn.iocoder.mall.cart.biz.dao") // 扫描对应的 Mapper 接口 -@EnableTransactionManagement(proxyTargetClass = true) // 启动事务管理。为什么使用 proxyTargetClass 参数,参见 https://blog.csdn.net/huang_550/article/details/76492600 -public class DatabaseConfiguration { - - // 数据源,使用 HikariCP - -} diff --git a/cart/cart-service-impl/src/main/java/cn/iocoder/mall/cart/biz/config/ServiceExceptionConfiguration.java b/cart/cart-service-impl/src/main/java/cn/iocoder/mall/cart/biz/config/ServiceExceptionConfiguration.java deleted file mode 100644 index 40263e309..000000000 --- a/cart/cart-service-impl/src/main/java/cn/iocoder/mall/cart/biz/config/ServiceExceptionConfiguration.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.iocoder.mall.cart.biz.config; - -import cn.iocoder.common.framework.util.ServiceExceptionUtil; -import cn.iocoder.mall.cart.api.constant.CartErrorCodeEnum; -import org.springframework.boot.context.event.ApplicationReadyEvent; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.event.EventListener; - -@Configuration -public class ServiceExceptionConfiguration { - - @EventListener(ApplicationReadyEvent.class) // 可参考 https://www.cnblogs.com/ssslinppp/p/7607509.html - public void initMessages() { - for (CartErrorCodeEnum item : CartErrorCodeEnum.values()) { - ServiceExceptionUtil.put(item.getCode(), item.getMessage()); - } - } - -} diff --git a/cart/cart-service-impl/src/main/java/cn/iocoder/mall/cart/biz/package-info.java b/cart/cart-service-impl/src/main/java/cn/iocoder/mall/cart/biz/package-info.java deleted file mode 100644 index 5fcec432d..000000000 --- a/cart/cart-service-impl/src/main/java/cn/iocoder/mall/cart/biz/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package cn.iocoder.mall.cart.biz; diff --git a/cart/cart-service-impl/src/main/resources/config/application.yaml b/cart/cart-service-impl/src/main/resources/config/application.yaml deleted file mode 100644 index fc176627c..000000000 --- a/cart/cart-service-impl/src/main/resources/config/application.yaml +++ /dev/null @@ -1,44 +0,0 @@ -spring: - # datasource - datasource: - url: jdbc:mysql://180.167.213.26:13306/mall_cart?useSSL=false&useUnicode=true&characterEncoding=UTF-8 - driver-class-name: com.mysql.jdbc.Driver - username: root - password: ${MALL_MYSQL_PASSWORD} - -# mybatis -mybatis: - config-location: classpath:mybatis-config.xml - mapper-locations: classpath:mapper/*.xml - type-aliases-package: cn.iocoder.mall.cart.biz.dataobject - -# dubbo -dubbo: - application: - name: cart-service - registry: - address: zookeeper://127.0.0.1:2181 - protocol: - port: -1 - name: dubbo - scan: - base-packages: cn.iocoder.mall.cart.biz.service - -# xxl-job -#xxl: -# job: -# admin: -# addresses: http://127.0.0.1:8080/xxl-job-admin -# executor: -# appname: cart-job-executor -# ip: -# port: 0 -# logpath: /Users/yunai/logs/xxl-job/ -# logretentiondays: 1 -# accessToken: - -# rocketmq -#rocketmq: -# name-server: 127.0.0.1:9876 -# producer: -# group: cart-producer-group diff --git a/cart/pom.xml b/cart/pom.xml deleted file mode 100644 index dc05e2d77..000000000 --- a/cart/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - mall-parent - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - cart - pom - - cart-application - cart-service-api - cart-service-impl - - - - 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 new file mode 100644 index 000000000..4408f8746 --- /dev/null +++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/UsersCartController.java @@ -0,0 +1,22 @@ +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; + +public class UsersCartController { + + // TODO 注入 + private CartService cartService; + // TODO 注入 + private OrderService orderService; + + public CommonResult confirmOrder() { + // 查询购物车列表(选中的) +// cartService.list(userId, true); + // 查询确认订单信息的明细 + + return null; + } + +} diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/UsersOrderController.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/UsersOrderController.java index ee74edeb1..8032ebdd9 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/UsersOrderController.java +++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/controller/users/UsersOrderController.java @@ -6,7 +6,6 @@ import cn.iocoder.mall.order.api.bo.OrderCreateBO; import cn.iocoder.mall.order.api.bo.OrderPageBO; import cn.iocoder.mall.order.api.dto.OrderCreateDTO; import cn.iocoder.mall.order.api.dto.OrderQueryDTO; -import cn.iocoder.mall.order.api.dto.OrderUserPageDTO; import cn.iocoder.mall.order.application.convert.OrderConvertAPP; import cn.iocoder.mall.order.application.po.user.OrderCreatePO; import cn.iocoder.mall.user.sdk.context.UserSecurityContextHolder; diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/FeeMessageVO.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/FeeMessageVO.java new file mode 100644 index 000000000..6270e5849 --- /dev/null +++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/FeeMessageVO.java @@ -0,0 +1,26 @@ +package cn.iocoder.mall.order.application.vo; + +public class FeeMessageVO { + + /** + * 总价 + */ + private Integer originalTotal; + /** + * 优惠总价 + * + * 注意,满多少元包邮,不算在优惠中。 + */ + private Integer discountTotal; + /** + * 邮费 + */ + private Integer postageTotal; + /** + * 最终价格 + * + * 计算公式 = 总价 - 优惠总价 + 邮费 + */ + private Integer presentTotal; + +} diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/UsersCartItemVO.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/UsersCartItemVO.java new file mode 100644 index 000000000..586ea85f7 --- /dev/null +++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/UsersCartItemVO.java @@ -0,0 +1,5 @@ +package cn.iocoder.mall.order.application.vo; + +public class UsersCartItemVO { + +} diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/UsersCartListVO.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/UsersCartListVO.java new file mode 100644 index 000000000..861c22ec6 --- /dev/null +++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/vo/UsersCartListVO.java @@ -0,0 +1,11 @@ +package cn.iocoder.mall.order.application.vo; + +import java.util.List; + +public class UsersCartListVO { + + private List items; + + private FeeMessageVO feeMessage; + +} diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/CartService.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/CartService.java new file mode 100644 index 000000000..d6d5750a7 --- /dev/null +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/CartService.java @@ -0,0 +1,99 @@ +package cn.iocoder.mall.order.api; + +import cn.iocoder.common.framework.vo.CommonResult; +import cn.iocoder.mall.order.api.bo.CartBO; +import cn.iocoder.mall.order.api.bo.CartItemBO; +import cn.iocoder.mall.order.api.bo.OrderCreateBO; +import org.springframework.lang.Nullable; + +import java.util.List; + +public interface CartService { + + // ========== 购物车 Item 的逻辑 ========== + + /** + * 添加商品至购物车 + * + * @param userId 用户编号 + * @param skuId 商品 SKU 编号 + * @param quantity 数量 + * @return 是否成功 + */ + CommonResult add(Integer userId, Integer skuId, Integer quantity); + + /** + * 购物车更新商品数量 + * + * @param userId 用户编号 + * @param skuId 商品 SKU 编号 + * @param quantity 数量 + * @return 是否成功 + */ + CommonResult updateQuantity(Integer userId, Integer skuId, Integer quantity); + + /** + * 购物车更新商品是否选中 + * + * @param userId 用户编号 + * @param skuId 商品 SKU 编号 + * @return 是否成功 + */ + CommonResult updateSelected(Integer userId, Integer skuId); + + /** + * 购物车删除商品 + * + * @param userId 用户编号 + * @param skuIds 商品 SKU 编号的数组 + * + * @return 是否成功 + */ + CommonResult delete(Integer userId, List skuIds); + + /** + * 清空购物车 + * + * @param userId 用户编号 + * @return 是否成功 + */ + CommonResult deleteAll(Integer userId); + + /** + * 查询用户在购物车中的商品数量 + * + * @param userId 用户编号 + * @return 商品数量 + */ + CommonResult count(Integer userId, String nobody, Integer shopId); + + /** + * 显示买家购物车中的商品列表,并根据 selected 进行过滤。 + * + * @param userId 用户编号 + * @param selected 是否选中。若为空,则不进行筛选 + * @return 购物车中商品列表信息 + */ + List list(Integer userId, @Nullable Boolean selected); + + // ========== 购物车与订单相关的逻辑 ========== + + /** + * 获得购物车明细 + * + * TODO 芋艿,可能放在 Controller 更合适 + * + * @param userId 用户编号 + * @return 购物车明细 + */ + CommonResult details(Integer userId); + + /** + * 基于购物车创建订单 + * + * @param userId 用户编号 + * @return 订单信息 + */ + CommonResult createOrder(Integer userId); + +} diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderService.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderService.java index 53e99e776..681c412a8 100644 --- a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderService.java +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/OrderService.java @@ -1,10 +1,7 @@ package cn.iocoder.mall.order.api; import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.order.api.bo.OrderCreateBO; -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.bo.*; import cn.iocoder.mall.order.api.dto.*; import java.util.List; @@ -41,6 +38,14 @@ public interface OrderService { */ CommonResult getOrderRecipientBO(Integer orderId); + /** + * 计算订单金额,返回计算结果 + * + * @param calcOrderPriceDTO 计算订单金额 DTO + * @return 计算订单金额结果 + */ + CalcOrderPriceBO calcOrderPrice(CalcOrderPriceDTO calcOrderPriceDTO); + /** * 订单 - 创建 * diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/CalcOrderPriceBO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/CalcOrderPriceBO.java new file mode 100644 index 000000000..d163a384e --- /dev/null +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/CalcOrderPriceBO.java @@ -0,0 +1,99 @@ +package cn.iocoder.mall.order.api.bo; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + * 计算订单价格结果 BO + */ +@Data +@Accessors(chain = true) +public class CalcOrderPriceBO { + + /** + * 商品分组数组 + */ + private List itemGroups; + /** + * 邮费信息 + */ + private Postage postage; + /** + * 费用 + */ + private Fee fee; + + /** + * 商品分组 + * + * 多个商品,参加同一个活动,从而形成分组。 + */ + @Data + @Accessors(chain = true) + public static class ItemGroup { + + // TODO 优惠活动 + private Object activity; + /** + * 商品数组 + */ + private List items; + + } + + @Data + @Accessors(chain = true) + public static class Item { + + // TODO 信息要相当完整 + + + } + + /** + * 费用(合计) + */ + @Data + @Accessors(chain = true) + public static class Fee { + + /** + * 总价 + */ + private Integer originalTotal; + /** + * 优惠总价 + * + * 注意,满多少元包邮,不算在优惠中。 + */ + private Integer discountTotal; + /** + * 邮费 + */ + private Integer postageTotal; + /** + * 最终价格 + * + * 计算公式 = 总价 - 优惠总价 + 邮费 + */ + private Integer presentTotal; + + } + + /** + * 邮费信息 + */ + @Data + @Accessors(chain = true) + public static class Postage { + + /** + * 需要满足多少钱,可以包邮。单位:分 + */ + private Integer threshold; + + } + +} diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/CartBO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/CartBO.java new file mode 100644 index 000000000..077878d32 --- /dev/null +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/CartBO.java @@ -0,0 +1,24 @@ +package cn.iocoder.mall.order.api.bo; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + * 购物车明细 BO + */ +@Data +@Accessors(chain = true) +public class CartBO { + + /** + * 商品分组数组 + */ + private List itemGroups; + /** + * 费用 + */ + private FeeMessageBO fee; + +} diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/CartItemBO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/CartItemBO.java new file mode 100644 index 000000000..5bad8655c --- /dev/null +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/CartItemBO.java @@ -0,0 +1,15 @@ +package cn.iocoder.mall.order.api.bo; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 购物车的商品信息 DO + */ +@Data +@Accessors(chain = true) +public class CartItemBO { + + + +} diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/CartItemGroupBO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/CartItemGroupBO.java new file mode 100644 index 000000000..0ee268219 --- /dev/null +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/CartItemGroupBO.java @@ -0,0 +1,21 @@ +package cn.iocoder.mall.order.api.bo; + +import java.util.List; + +/** + * 商品分组 BO + * + * 主要目的是,多个商品, + */ +public class CartItemGroupBO { + + /** + * TODO 芋艿,活动 + */ + private Object activity; + /** + * 商品数组 + */ + private List items; + +} diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/FeeDetailBO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/FeeDetailBO.java new file mode 100644 index 000000000..d45dd09ec --- /dev/null +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/FeeDetailBO.java @@ -0,0 +1,4 @@ +package cn.iocoder.mall.order.api.bo; + +public class FeeDetailBO { +} diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/FeeMessageBO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/FeeMessageBO.java new file mode 100644 index 000000000..0712a1cb3 --- /dev/null +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/FeeMessageBO.java @@ -0,0 +1,26 @@ +package cn.iocoder.mall.order.api.bo; + +public class FeeMessageBO { + + /** + * 总价 + */ + private Integer originalTotal; + /** + * 优惠总价 + * + * 注意,满多少元包邮,不算在优惠中。 + */ + private Integer discountTotal; + /** + * 邮费 + */ + private Integer postageTotal; + /** + * 最终价格 + * + * 计算公式 = 总价 - 优惠总价 + 邮费 + */ + private Integer presentTotal; + +} diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/MerchantItemGroup.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/MerchantItemGroup.java new file mode 100644 index 000000000..ca18bc775 --- /dev/null +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/MerchantItemGroup.java @@ -0,0 +1,19 @@ +package cn.iocoder.mall.order.api.bo; + +import java.util.List; + +/** + * 商家商品分组 + */ +public class MerchantItemGroup { + + /** + * 商品分组数组 + */ + private List itemGroups; + /** + * 运费详情 + */ + private PostageDetailBO postageDetail; + +} diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/PostageDetailBO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/PostageDetailBO.java new file mode 100644 index 000000000..c9eaed233 --- /dev/null +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/bo/PostageDetailBO.java @@ -0,0 +1,14 @@ +package cn.iocoder.mall.order.api.bo; + +public class PostageDetailBO { + +// "description": "有品甄选商品,即有品配送和第三方商家发货的商品,2018年1月1日起,单笔订单满99元免运费,不满99元收10元运费。", +// "leftTotal": "0.00", +// "merchantName": "有品配送", +// "postFee": "0.00", +// "postage": "10.00", +// "postageType": 0, +// "selCount": 14, +// "threshold": "99.00" + +} diff --git a/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/CalcOrderPriceDTO.java b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/CalcOrderPriceDTO.java new file mode 100644 index 000000000..69b3bbd86 --- /dev/null +++ b/order/order-service-api/src/main/java/cn/iocoder/mall/order/api/dto/CalcOrderPriceDTO.java @@ -0,0 +1,41 @@ +package cn.iocoder.mall.order.api.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + * 计算订单价格 DTO + */ +@Data +@Accessors(chain = true) +public class CalcOrderPriceDTO { + + /** + * 商品数组 + */ + private List items; + + @Data + @Accessors(chain = true) + private static class Item { + + /** + * SKU 编号 + */ + private Integer skuId; + /** + * 数量 + */ + private Integer quantity; + /** + * 是否选中 + * + * 注意下,目前只有在购物车的时候,才可能出现该属性为 false 。其它情况下,都会为 true 为主。 + */ + private Boolean selected; + + } + +} diff --git a/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/CartItemDO.java b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/CartItemDO.java new file mode 100644 index 000000000..9f164a553 --- /dev/null +++ b/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/CartItemDO.java @@ -0,0 +1,100 @@ +package cn.iocoder.mall.order.biz.dataobject; + +import cn.iocoder.common.framework.dataobject.BaseDO; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.Date; + +/** + * 购物车的商品信息 + */ +@Data +@Accessors(chain = true) +public class CartItemDO extends BaseDO { + + // ========= 基础字段 BEGIN ========= + + /** + * 编号,唯一自增。 + */ + private Integer id; + /** + * 状态 + * + * 1-正常 + * 2-主动删除 + * 3-下单删除 + */ + private Integer status; + /** + * 商品在购物车中的删除时间 + */ + private Date deleteTime; + /** + * 是否选中 + */ + private Boolean selected; + + // ========= 基础字段 END ========= + + // ========= 买家信息 BEGIN ========= + + /** + * 用户编号 + */ + private Integer userId; +// /** +// * 会话 key +// */ +// private String nobody; + + // ========= 买家信息 END ========= + + // ========= 商品信息 BEGIN ========= + + /** + * 商品 SPU 编号 + */ + private Integer spuId; + /** + * 商品 SKU 编号 + */ + private Integer skuId; + /** + * 商品购买数量 + */ + private Integer quantity; + + // TODO 冗余字段 + + + // ========= 商品信息 END ========= + + // ========= 交易信息 BEGIN ========= + + /** + * 订单编号 + */ + private String orderId; + /** + * 订单创建时间 + */ + private Date orderCreateTime; + + // ========= 交易信息 BEGIN ========= + + // ========= 优惠信息 BEGIN ========= + +// /** +// * 商品营销活动编号 +// */ +// private Integer activityId; +// /** +// * 商品营销活动类型 +// */ +// private Integer activityType; + + // ========= 优惠信息 END ========= + +} diff --git a/pom.xml b/pom.xml index b0189b4e6..5c5481e3c 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,6 @@ ops pay promotion - cart pom