diff --git a/.idea/encodings.xml b/.idea/encodings.xml index 389dff5..ec240c8 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -26,6 +26,7 @@ + diff --git a/common/service-util/src/main/java/com/atguigu/ssyx/common/CodeGet.java b/common/service-util/src/main/java/com/atguigu/ssyx/common/CodeGet.java index c88b688..2a2d09a 100644 --- a/common/service-util/src/main/java/com/atguigu/ssyx/common/CodeGet.java +++ b/common/service-util/src/main/java/com/atguigu/ssyx/common/CodeGet.java @@ -19,7 +19,7 @@ public class CodeGet { // 全局配置 GlobalConfig gc = new GlobalConfig(); // TODO 需要修改路径名称 - gc.setOutputDir("G:\\File\\Java\\ssyx\\ssyx-parent\\service\\service-activity" + "/src/main/java"); + gc.setOutputDir("G:\\File\\Java\\ssyx\\ssyx-parent\\service\\service-order" + "/src/main/java"); gc.setServiceName("%sService"); // 去掉Service接口的首字母I gc.setAuthor("bunny"); @@ -29,7 +29,7 @@ public class CodeGet { // 3、数据源配置 DataSourceConfig dsc = new DataSourceConfig(); // TODO 需要修改数据库 - dsc.setUrl("jdbc:mysql://106.15.251.123:3305/shequ-activity?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true"); + dsc.setUrl("jdbc:mysql://106.15.251.123:3305/shequ-order?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true"); dsc.setDriverName("com.mysql.cj.jdbc.Driver"); dsc.setUsername("root"); dsc.setPassword("02120212"); @@ -40,7 +40,7 @@ public class CodeGet { PackageConfig pc = new PackageConfig(); pc.setParent("com.atguigu.ssyx"); // TODO 需要修改模块名 - pc.setModuleName("activity"); + pc.setModuleName("order"); pc.setController("controller"); pc.setService("service"); pc.setMapper("mapper"); @@ -59,7 +59,7 @@ public class CodeGet { private static StrategyConfig getStrategyConfig() { StrategyConfig strategy = new StrategyConfig(); // TODO 要生成的表 - strategy.setInclude("seckill_time"); + strategy.setInclude("cart_info", "order_item", "order_info", "order_deliver"); strategy.setNaming(NamingStrategy.underline_to_camel);// 数据库表映射到实体的命名策略 strategy.setColumnNaming(NamingStrategy.underline_to_camel);// 数据库表字段映射到实体的命名策略 strategy.setEntityLombokModel(true); // lombok 模型 @Accessors(chain = true) setter链式操作 diff --git a/service/pom.xml b/service/pom.xml index d7d0cc5..1abe627 100644 --- a/service/pom.xml +++ b/service/pom.xml @@ -21,6 +21,7 @@ service-user service-home service-cart + service-order diff --git a/service/service-order/pom.xml b/service/service-order/pom.xml new file mode 100644 index 0000000..0d9e8cc --- /dev/null +++ b/service/service-order/pom.xml @@ -0,0 +1,27 @@ + + 4.0.0 + + com.atguigu + service + 1.0-SNAPSHOT + + + service-order + jar + + service-order + https://maven.apache.org + + + UTF-8 + + + + + com.atguigu + service-product-client + 1.0-SNAPSHOT + + + diff --git a/service/service-order/src/main/java/com/atguigu/ssyx/order/ServiceOrderApplication.java b/service/service-order/src/main/java/com/atguigu/ssyx/order/ServiceOrderApplication.java new file mode 100644 index 0000000..300f4e5 --- /dev/null +++ b/service/service-order/src/main/java/com/atguigu/ssyx/order/ServiceOrderApplication.java @@ -0,0 +1,22 @@ +package com.atguigu.ssyx.order; + +import org.springframework.boot.SpringApplication; +import org.springframework.cloud.client.SpringCloudApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@SpringCloudApplication +@ComponentScan(basePackages = { + "com.atguigu.ssyx.common", + "com.atguigu.ssyx.order" +}) +@EnableTransactionManagement +@EnableDiscoveryClient +@EnableFeignClients(basePackages = {"com.atguigu.ssyx.client"}) +public class ServiceOrderApplication { + public static void main(String[] args) { + SpringApplication.run(ServiceOrderApplication.class, args); + } +} \ No newline at end of file diff --git a/service/service-order/src/main/java/com/atguigu/ssyx/order/controller/OrderDeliverController.java b/service/service-order/src/main/java/com/atguigu/ssyx/order/controller/OrderDeliverController.java new file mode 100644 index 0000000..cdfb971 --- /dev/null +++ b/service/service-order/src/main/java/com/atguigu/ssyx/order/controller/OrderDeliverController.java @@ -0,0 +1,21 @@ +package com.atguigu.ssyx.order.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 订单配送表 前端控制器 + *

+ * + * @author bunny + * @since 2024-04-10 + */ +@RestController +@RequestMapping("/order/order-deliver") +public class OrderDeliverController { + +} + diff --git a/service/service-order/src/main/java/com/atguigu/ssyx/order/controller/OrderInfoController.java b/service/service-order/src/main/java/com/atguigu/ssyx/order/controller/OrderInfoController.java new file mode 100644 index 0000000..7e7190e --- /dev/null +++ b/service/service-order/src/main/java/com/atguigu/ssyx/order/controller/OrderInfoController.java @@ -0,0 +1,28 @@ +package com.atguigu.ssyx.order.controller; + + +import com.atguigu.ssyx.common.result.Result; +import com.atguigu.ssyx.order.service.OrderInfoService; +import com.atguigu.ssyx.vo.order.OrderConfirmVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Api(value = "Order管理", tags = "Order管理") +@RestController +@RequestMapping("/api/order") +public class OrderInfoController { + @Autowired + private OrderInfoService orderInfoService; + + @ApiOperation("确认订单") + @GetMapping("auth/confirmOrder") + public Result confirm() { + OrderConfirmVo vo = orderInfoService.confirmOrder(); + return Result.success(vo); + } +} + diff --git a/service/service-order/src/main/java/com/atguigu/ssyx/order/controller/OrderItemController.java b/service/service-order/src/main/java/com/atguigu/ssyx/order/controller/OrderItemController.java new file mode 100644 index 0000000..68d3d31 --- /dev/null +++ b/service/service-order/src/main/java/com/atguigu/ssyx/order/controller/OrderItemController.java @@ -0,0 +1,21 @@ +package com.atguigu.ssyx.order.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 订单项信息 前端控制器 + *

+ * + * @author bunny + * @since 2024-04-10 + */ +@RestController +@RequestMapping("/order/order-item") +public class OrderItemController { + +} + diff --git a/service/service-order/src/main/java/com/atguigu/ssyx/order/mapper/OrderDeliverMapper.java b/service/service-order/src/main/java/com/atguigu/ssyx/order/mapper/OrderDeliverMapper.java new file mode 100644 index 0000000..a1a3355 --- /dev/null +++ b/service/service-order/src/main/java/com/atguigu/ssyx/order/mapper/OrderDeliverMapper.java @@ -0,0 +1,16 @@ +package com.atguigu.ssyx.order.mapper; + +import com.atguigu.ssyx.model.order.OrderDeliver; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 订单配送表 Mapper 接口 + *

+ * + * @author bunny + * @since 2024-04-10 + */ +public interface OrderDeliverMapper extends BaseMapper { + +} diff --git a/service/service-order/src/main/java/com/atguigu/ssyx/order/mapper/OrderInfoMapper.java b/service/service-order/src/main/java/com/atguigu/ssyx/order/mapper/OrderInfoMapper.java new file mode 100644 index 0000000..34e797f --- /dev/null +++ b/service/service-order/src/main/java/com/atguigu/ssyx/order/mapper/OrderInfoMapper.java @@ -0,0 +1,16 @@ +package com.atguigu.ssyx.order.mapper; + +import com.atguigu.ssyx.model.order.OrderInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 订单 Mapper 接口 + *

+ * + * @author bunny + * @since 2024-04-10 + */ +public interface OrderInfoMapper extends BaseMapper { + +} diff --git a/service/service-order/src/main/java/com/atguigu/ssyx/order/mapper/OrderItemMapper.java b/service/service-order/src/main/java/com/atguigu/ssyx/order/mapper/OrderItemMapper.java new file mode 100644 index 0000000..20fe82d --- /dev/null +++ b/service/service-order/src/main/java/com/atguigu/ssyx/order/mapper/OrderItemMapper.java @@ -0,0 +1,16 @@ +package com.atguigu.ssyx.order.mapper; + +import com.atguigu.ssyx.model.order.OrderItem; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 订单项信息 Mapper 接口 + *

+ * + * @author bunny + * @since 2024-04-10 + */ +public interface OrderItemMapper extends BaseMapper { + +} diff --git a/service/service-order/src/main/java/com/atguigu/ssyx/order/service/OrderDeliverService.java b/service/service-order/src/main/java/com/atguigu/ssyx/order/service/OrderDeliverService.java new file mode 100644 index 0000000..68fe31f --- /dev/null +++ b/service/service-order/src/main/java/com/atguigu/ssyx/order/service/OrderDeliverService.java @@ -0,0 +1,16 @@ +package com.atguigu.ssyx.order.service; + +import com.atguigu.ssyx.model.order.OrderDeliver; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 订单配送表 服务类 + *

+ * + * @author bunny + * @since 2024-04-10 + */ +public interface OrderDeliverService extends IService { + +} diff --git a/service/service-order/src/main/java/com/atguigu/ssyx/order/service/OrderInfoService.java b/service/service-order/src/main/java/com/atguigu/ssyx/order/service/OrderInfoService.java new file mode 100644 index 0000000..465df07 --- /dev/null +++ b/service/service-order/src/main/java/com/atguigu/ssyx/order/service/OrderInfoService.java @@ -0,0 +1,15 @@ +package com.atguigu.ssyx.order.service; + +import com.atguigu.ssyx.model.order.OrderInfo; +import com.atguigu.ssyx.vo.order.OrderConfirmVo; +import com.baomidou.mybatisplus.extension.service.IService; + +public interface OrderInfoService extends IService { + + /** + * * 确认订单 + * + * @return 订单确认内容 + */ + OrderConfirmVo confirmOrder(); +} diff --git a/service/service-order/src/main/java/com/atguigu/ssyx/order/service/OrderItemService.java b/service/service-order/src/main/java/com/atguigu/ssyx/order/service/OrderItemService.java new file mode 100644 index 0000000..f7f9fa1 --- /dev/null +++ b/service/service-order/src/main/java/com/atguigu/ssyx/order/service/OrderItemService.java @@ -0,0 +1,16 @@ +package com.atguigu.ssyx.order.service; + +import com.atguigu.ssyx.model.order.OrderItem; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 订单项信息 服务类 + *

+ * + * @author bunny + * @since 2024-04-10 + */ +public interface OrderItemService extends IService { + +} diff --git a/service/service-order/src/main/java/com/atguigu/ssyx/order/service/impl/OrderDeliverServiceImpl.java b/service/service-order/src/main/java/com/atguigu/ssyx/order/service/impl/OrderDeliverServiceImpl.java new file mode 100644 index 0000000..5c9509e --- /dev/null +++ b/service/service-order/src/main/java/com/atguigu/ssyx/order/service/impl/OrderDeliverServiceImpl.java @@ -0,0 +1,20 @@ +package com.atguigu.ssyx.order.service.impl; + +import com.atguigu.ssyx.model.order.OrderDeliver; +import com.atguigu.ssyx.order.mapper.OrderDeliverMapper; +import com.atguigu.ssyx.order.service.OrderDeliverService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 订单配送表 服务实现类 + *

+ * + * @author bunny + * @since 2024-04-10 + */ +@Service +public class OrderDeliverServiceImpl extends ServiceImpl implements OrderDeliverService { + +} diff --git a/service/service-order/src/main/java/com/atguigu/ssyx/order/service/impl/OrderInfoServiceImpl.java b/service/service-order/src/main/java/com/atguigu/ssyx/order/service/impl/OrderInfoServiceImpl.java new file mode 100644 index 0000000..1b8ae32 --- /dev/null +++ b/service/service-order/src/main/java/com/atguigu/ssyx/order/service/impl/OrderInfoServiceImpl.java @@ -0,0 +1,22 @@ +package com.atguigu.ssyx.order.service.impl; + +import com.atguigu.ssyx.model.order.OrderInfo; +import com.atguigu.ssyx.order.mapper.OrderInfoMapper; +import com.atguigu.ssyx.order.service.OrderInfoService; +import com.atguigu.ssyx.vo.order.OrderConfirmVo; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +@Service +public class OrderInfoServiceImpl extends ServiceImpl implements OrderInfoService { + + /** + * * 确认订单 + * + * @return 订单确认内容 + */ + @Override + public OrderConfirmVo confirmOrder() { + return null; + } +} diff --git a/service/service-order/src/main/java/com/atguigu/ssyx/order/service/impl/OrderItemServiceImpl.java b/service/service-order/src/main/java/com/atguigu/ssyx/order/service/impl/OrderItemServiceImpl.java new file mode 100644 index 0000000..86181ab --- /dev/null +++ b/service/service-order/src/main/java/com/atguigu/ssyx/order/service/impl/OrderItemServiceImpl.java @@ -0,0 +1,20 @@ +package com.atguigu.ssyx.order.service.impl; + +import com.atguigu.ssyx.model.order.OrderItem; +import com.atguigu.ssyx.order.mapper.OrderItemMapper; +import com.atguigu.ssyx.order.service.OrderItemService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 订单项信息 服务实现类 + *

+ * + * @author bunny + * @since 2024-04-10 + */ +@Service +public class OrderItemServiceImpl extends ServiceImpl implements OrderItemService { + +} diff --git a/service/service-order/src/main/resources/application-dev.yml b/service/service-order/src/main/resources/application-dev.yml new file mode 100644 index 0000000..eea30e8 --- /dev/null +++ b/service/service-order/src/main/resources/application-dev.yml @@ -0,0 +1,28 @@ +server: + port: 8209 + +bunny: + datasource: + host: 106.15.251.123 + port: 3305 + sqlData: shequ-order + username: root + password: "02120212" + + redis: + host: 47.120.65.66 + port: 6379 + database: 3 + password: "02120212" + + rabbitmq: + # host: 192.168.1.4 + host: 192.168.3.98 + port: 5672 + username: bunny + password: "02120212" + + nacos: + server-addr: z-bunny.cn:8848 + discovery: + namespace: ssyx \ No newline at end of file diff --git a/service/service-order/src/main/resources/application.yml b/service/service-order/src/main/resources/application.yml new file mode 100644 index 0000000..2f93bc1 --- /dev/null +++ b/service/service-order/src/main/resources/application.yml @@ -0,0 +1,68 @@ +server: + port: 8209 +spring: + application: + name: service-order + profiles: + active: dev + + datasource: + type: com.zaxxer.hikari.HikariDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://${bunny.datasource.host}:${bunny.datasource.port}/${bunny.datasource.sqlData}?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true + username: ${bunny.datasource.username} + password: ${bunny.datasource.password} + + redis: + host: ${bunny.redis.host} + port: ${bunny.redis.port} + database: ${bunny.redis.database} + password: ${bunny.redis.password} + lettuce: + pool: + max-active: 20 #最大连接数 + max-wait: -1 #最大阻塞等待时间(负数表示没限制) + max-idle: 5 #最大空闲 + min-idle: 0 #最小空闲 + + rabbitmq: + host: ${bunny.rabbitmq.host} + port: ${bunny.rabbitmq.port} + username: ${bunny.rabbitmq.username} + password: ${bunny.rabbitmq.password} + publisher-confirm-type: CORRELATED + publisher-returns: true + listener: + simple: + prefetch: 1 + concurrency: 3 + acknowledge-mode: manual + retry: + enabled: true # 开启消费者失败重试 + initial-interval: 1000ms # 初始失败等待时长 + multiplier: 1 # 下次失败等待时间被树,下次等待时长 multiplier * last-interval + max-attempts: 3 # 最大重试次数 + stateless: true # true 无状态 false 有状态。如果业务中包含事务,这里改为false + + cloud: + sentinel: + log: + dir: logs/${spring.application.name}/sentinel + nacos: + discovery: + namespace: ${bunny.nacos.discovery.namespace} + server-addr: ${bunny.nacos.server-addr} + + jackson: + date-format: yyyy-MM-dd HH:mm:ss + time-zone: GMT+8 + +logging: + level: + com.atguigu.ssyx.order.mapper: debug + com.atguigu.ssyx.order.controller: info + com.atguigu.ssyx.order.service: info + pattern: + dateformat: HH:mm:ss:SSS + file: + path: "logs/${spring.application.name}" diff --git a/service/service-order/src/main/resources/banner.txt b/service/service-order/src/main/resources/banner.txt new file mode 100644 index 0000000..cc77fc2 --- /dev/null +++ b/service/service-order/src/main/resources/banner.txt @@ -0,0 +1,16 @@ +-----------------▄██-█▄--------- +-----------------███▄██▄-------- +-----------------███████-------- +-----------------▀███████------- +-------------------██████▄▄----- +-------------------█████████▄--- +-------------------██████▄████-- +-------▄███████████████████████- +-----▄███████████████████████▀-- +---▄██████████████████████------ +---███████████████████████------ +---███████████████████████------ +-▄▄██████████████████████▀------ +-█████████████████▀█████-------- +-▀██████████████▀▀-▀█████▄------ +-------▀▀▀▀▀▀▀▀▀------▀▀▀▀------ \ No newline at end of file diff --git a/service/service-order/src/main/resources/favicon.ico b/service/service-order/src/main/resources/favicon.ico new file mode 100644 index 0000000..1ba397c Binary files /dev/null and b/service/service-order/src/main/resources/favicon.ico differ diff --git a/service/service-order/src/main/resources/mapper/OrderDeliverMapper.xml b/service/service-order/src/main/resources/mapper/OrderDeliverMapper.xml new file mode 100644 index 0000000..61ce827 --- /dev/null +++ b/service/service-order/src/main/resources/mapper/OrderDeliverMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/service/service-order/src/main/resources/mapper/OrderInfoMapper.xml b/service/service-order/src/main/resources/mapper/OrderInfoMapper.xml new file mode 100644 index 0000000..93f237a --- /dev/null +++ b/service/service-order/src/main/resources/mapper/OrderInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/service/service-order/src/main/resources/mapper/OrderItemMapper.xml b/service/service-order/src/main/resources/mapper/OrderItemMapper.xml new file mode 100644 index 0000000..3f5763c --- /dev/null +++ b/service/service-order/src/main/resources/mapper/OrderItemMapper.xml @@ -0,0 +1,5 @@ + + + + +