From a32c0b25bd8d00c8011276c7d07546e54d2f4cfc Mon Sep 17 00:00:00 2001 From: hudingrong <1649576115@qq.com> Date: Thu, 9 May 2024 14:56:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E5=90=88=E5=88=86=E5=BA=93=E5=88=86?= =?UTF-8?q?=E8=A1=A8=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 10 ++ .../data/log/log-info-2024-05-07.0.log | 75 ++++++++++ xfg-frame-archetype-lite-app/pom.xml | 8 ++ .../src/main/resources/application-dev.yml | 75 +++++++--- .../raffle_activity_account_flow_mapper.xml | 130 ++++++++++++++++++ .../mapper/raffle_activity_account_mapper.xml | 130 ++++++++++++++++++ .../mapper/raffle_activity_count_mapper.xml | 99 +++++++++++++ .../mybatis/mapper/raffle_activity_mapper.xml | 38 +++++ .../mapper/raffle_activity_order_mapper.xml | 38 +++++ .../infrastructure/RaffleActivityDaoTest.java | 33 +++++ .../RaffleActivityOrderDaoTest.java | 71 ++++++++++ .../entity/RaffleActivityAccountEntity.java | 70 ++++++++++ .../RaffleActivityAccountFlowEntity.java | 70 ++++++++++ .../entity/RaffleActivityCountEntity.java | 50 +++++++ .../model/entity/RaffleActivityEntity.java | 80 +++++++++++ .../entity/RaffleActivityOrderEntity.java | 65 +++++++++ .../service/AbstractRaffleStrategy.java | 1 - .../pom.xml | 4 + .../dao/IRaffleActivityAccountDao.java | 30 ++++ .../dao/IRaffleActivityAccountFlowDao.java | 30 ++++ .../dao/IRaffleActivityCountDao.java | 25 ++++ .../persistent/dao/IRaffleActivityDao.java | 17 +++ .../dao/IRaffleActivityOrderDao.java | 26 ++++ .../persistent/po/RaffleActivity.java | 79 +++++++++++ .../persistent/po/RaffleActivityOrder.java | 66 +++++++++ xfg-frame-archetype-lite-types/pom.xml | 17 --- 26 files changed, 1302 insertions(+), 35 deletions(-) create mode 100644 xfg-frame-archetype-lite-app/data/log/log-info-2024-05-07.0.log create mode 100644 xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/raffle_activity_account_flow_mapper.xml create mode 100644 xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/raffle_activity_account_mapper.xml create mode 100644 xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/raffle_activity_count_mapper.xml create mode 100644 xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/raffle_activity_mapper.xml create mode 100644 xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/raffle_activity_order_mapper.xml create mode 100644 xfg-frame-archetype-lite-app/src/test/java/cn/bugstack/test/infrastructure/RaffleActivityDaoTest.java create mode 100644 xfg-frame-archetype-lite-app/src/test/java/cn/bugstack/test/infrastructure/RaffleActivityOrderDaoTest.java create mode 100644 xfg-frame-archetype-lite-domain/src/main/java/cn/bugstack/domain/strategy/model/entity/RaffleActivityAccountEntity.java create mode 100644 xfg-frame-archetype-lite-domain/src/main/java/cn/bugstack/domain/strategy/model/entity/RaffleActivityAccountFlowEntity.java create mode 100644 xfg-frame-archetype-lite-domain/src/main/java/cn/bugstack/domain/strategy/model/entity/RaffleActivityCountEntity.java create mode 100644 xfg-frame-archetype-lite-domain/src/main/java/cn/bugstack/domain/strategy/model/entity/RaffleActivityEntity.java create mode 100644 xfg-frame-archetype-lite-domain/src/main/java/cn/bugstack/domain/strategy/model/entity/RaffleActivityOrderEntity.java create mode 100644 xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IRaffleActivityAccountDao.java create mode 100644 xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IRaffleActivityAccountFlowDao.java create mode 100644 xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IRaffleActivityCountDao.java create mode 100644 xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IRaffleActivityDao.java create mode 100644 xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IRaffleActivityOrderDao.java create mode 100644 xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/po/RaffleActivity.java create mode 100644 xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/po/RaffleActivityOrder.java diff --git a/pom.xml b/pom.xml index 9dcd188..9841582 100644 --- a/pom.xml +++ b/pom.xml @@ -106,6 +106,16 @@ redisson-spring-boot-starter 3.23.4 + + org.jeasy + easy-random-core + 4.3.0 + + + cn.bugstack.middleware + db-router-spring-boot-starter + 1.0.2 + diff --git a/xfg-frame-archetype-lite-app/data/log/log-info-2024-05-07.0.log b/xfg-frame-archetype-lite-app/data/log/log-info-2024-05-07.0.log new file mode 100644 index 0000000..96f1577 --- /dev/null +++ b/xfg-frame-archetype-lite-app/data/log/log-info-2024-05-07.0.log @@ -0,0 +1,75 @@ +24-05-07.16:28:36.475 [main ] INFO RaffleActivityOrderDaoTest - Starting RaffleActivityOrderDaoTest using Java 1.8.0_241 on Hudingrong with PID 38892 (started by 86189 in E:\resource\market_platform\xfg-frame-archetype-lite\xfg-frame-archetype-lite-app) +24-05-07.16:28:36.476 [main ] INFO RaffleActivityOrderDaoTest - The following 1 profile is active: "dev" +24-05-07.16:28:37.915 [main ] INFO RepositoryConfigurationDelegate - Multiple Spring Data modules found, entering strict repository configuration mode +24-05-07.16:28:37.924 [main ] INFO RepositoryConfigurationDelegate - Bootstrapping Spring Data Redis repositories in DEFAULT mode. +24-05-07.16:28:38.005 [main ] INFO RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 47 ms. Found 0 Redis repository interfaces. +24-05-07.16:28:42.428 [main ] INFO Version - Redisson 3.23.4 +24-05-07.16:28:44.991 [redisson-netty-2-4] INFO MasterPubSubConnectionPool - 1 connections initialized for 120.78.91.227/120.78.91.227:6379 +24-05-07.16:28:45.552 [redisson-netty-2-23] INFO MasterConnectionPool - 10 connections initialized for 120.78.91.227/120.78.91.227:6379 +24-05-07.16:28:48.252 [main ] INFO EndpointLinksResolver - Exposing 1 endpoint(s) beneath base path '/actuator' +24-05-07.16:28:48.334 [main ] INFO RaffleActivityOrderDaoTest - Started RaffleActivityOrderDaoTest in 12.326 seconds (JVM running for 13.798) +24-05-07.16:28:48.711 [main ] INFO HikariDataSource - Retail_HikariCP - Starting... +24-05-07.16:28:50.007 [scheduling-1 ] INFO UpdateAwardStockJob - 定时任务,更新奖品消耗库存【延迟队列获取,降低对数据库的更新频次,不要产生竞争】 +24-05-07.16:28:50.062 [scheduling-1 ] INFO StrategyRepository - 队列数据:null +24-05-07.16:28:51.892 [main ] INFO HikariDataSource - Retail_HikariCP - Start completed. +24-05-07.16:28:52.289 [main ] INFO HikariDataSource - Retail_HikariCP - Starting... +24-05-07.16:28:53.018 [main ] INFO HikariDataSource - Retail_HikariCP - Start completed. +24-05-07.16:36:38.086 [main ] INFO RaffleActivityOrderDaoTest - Starting RaffleActivityOrderDaoTest using Java 1.8.0_241 on Hudingrong with PID 34028 (started by 86189 in E:\resource\market_platform\xfg-frame-archetype-lite\xfg-frame-archetype-lite-app) +24-05-07.16:36:38.087 [main ] INFO RaffleActivityOrderDaoTest - The following 1 profile is active: "dev" +24-05-07.16:36:39.290 [main ] INFO RepositoryConfigurationDelegate - Multiple Spring Data modules found, entering strict repository configuration mode +24-05-07.16:36:39.295 [main ] INFO RepositoryConfigurationDelegate - Bootstrapping Spring Data Redis repositories in DEFAULT mode. +24-05-07.16:36:39.354 [main ] INFO RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 40 ms. Found 0 Redis repository interfaces. +24-05-07.16:36:43.691 [main ] INFO Version - Redisson 3.23.4 +24-05-07.16:36:46.378 [redisson-netty-2-4] INFO MasterPubSubConnectionPool - 1 connections initialized for 120.78.91.227/120.78.91.227:6379 +24-05-07.16:36:46.782 [redisson-netty-2-23] INFO MasterConnectionPool - 10 connections initialized for 120.78.91.227/120.78.91.227:6379 +24-05-07.16:36:49.586 [main ] INFO EndpointLinksResolver - Exposing 1 endpoint(s) beneath base path '/actuator' +24-05-07.16:36:49.673 [main ] INFO RaffleActivityOrderDaoTest - Started RaffleActivityOrderDaoTest in 12.123 seconds (JVM running for 14.194) +24-05-07.16:36:50.011 [scheduling-1 ] INFO UpdateAwardStockJob - 定时任务,更新奖品消耗库存【延迟队列获取,降低对数据库的更新频次,不要产生竞争】 +24-05-07.16:36:50.085 [main ] INFO HikariDataSource - Retail_HikariCP - Starting... +24-05-07.16:36:50.101 [scheduling-1 ] INFO StrategyRepository - 队列数据:null +24-05-07.16:36:53.730 [main ] INFO HikariDataSource - Retail_HikariCP - Start completed. +24-05-07.16:37:50.180 [main ] INFO RaffleActivityOrderDaoTest - Starting RaffleActivityOrderDaoTest using Java 1.8.0_241 on Hudingrong with PID 38788 (started by 86189 in E:\resource\market_platform\xfg-frame-archetype-lite\xfg-frame-archetype-lite-app) +24-05-07.16:37:50.182 [main ] INFO RaffleActivityOrderDaoTest - The following 1 profile is active: "dev" +24-05-07.16:37:51.774 [main ] INFO RepositoryConfigurationDelegate - Multiple Spring Data modules found, entering strict repository configuration mode +24-05-07.16:37:51.779 [main ] INFO RepositoryConfigurationDelegate - Bootstrapping Spring Data Redis repositories in DEFAULT mode. +24-05-07.16:37:51.828 [main ] INFO RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 29 ms. Found 0 Redis repository interfaces. +24-05-07.16:37:56.621 [main ] INFO Version - Redisson 3.23.4 +24-05-07.16:37:59.245 [redisson-netty-2-6] INFO MasterPubSubConnectionPool - 1 connections initialized for 120.78.91.227/120.78.91.227:6379 +24-05-07.16:37:59.597 [redisson-netty-2-23] INFO MasterConnectionPool - 10 connections initialized for 120.78.91.227/120.78.91.227:6379 +24-05-07.16:38:02.317 [main ] INFO EndpointLinksResolver - Exposing 1 endpoint(s) beneath base path '/actuator' +24-05-07.16:38:02.403 [main ] INFO RaffleActivityOrderDaoTest - Started RaffleActivityOrderDaoTest in 12.817 seconds (JVM running for 14.966) +24-05-07.16:38:02.737 [main ] INFO HikariDataSource - Retail_HikariCP - Starting... +24-05-07.16:38:05.006 [scheduling-1 ] INFO UpdateAwardStockJob - 定时任务,更新奖品消耗库存【延迟队列获取,降低对数据库的更新频次,不要产生竞争】 +24-05-07.16:38:05.058 [scheduling-1 ] INFO StrategyRepository - 队列数据:null +24-05-07.16:38:06.195 [main ] INFO HikariDataSource - Retail_HikariCP - Start completed. +24-05-07.16:38:06.504 [main ] INFO RaffleActivityOrderDaoTest - 测试结果:[{"state":"not_used"},{"state":"not_used"},{"state":"not_used"}] +24-05-07.16:45:04.970 [main ] INFO RaffleActivityOrderDaoTest - Starting RaffleActivityOrderDaoTest using Java 1.8.0_241 on Hudingrong with PID 18144 (started by 86189 in E:\resource\market_platform\xfg-frame-archetype-lite\xfg-frame-archetype-lite-app) +24-05-07.16:45:04.972 [main ] INFO RaffleActivityOrderDaoTest - The following 1 profile is active: "dev" +24-05-07.16:45:06.441 [main ] INFO RepositoryConfigurationDelegate - Multiple Spring Data modules found, entering strict repository configuration mode +24-05-07.16:45:06.446 [main ] INFO RepositoryConfigurationDelegate - Bootstrapping Spring Data Redis repositories in DEFAULT mode. +24-05-07.16:45:06.523 [main ] INFO RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 45 ms. Found 0 Redis repository interfaces. +24-05-07.16:45:10.946 [main ] INFO Version - Redisson 3.23.4 +24-05-07.16:45:13.625 [redisson-netty-2-4] INFO MasterPubSubConnectionPool - 1 connections initialized for 120.78.91.227/120.78.91.227:6379 +24-05-07.16:45:14.677 [redisson-netty-2-23] INFO MasterConnectionPool - 10 connections initialized for 120.78.91.227/120.78.91.227:6379 +24-05-07.16:45:17.461 [main ] INFO EndpointLinksResolver - Exposing 1 endpoint(s) beneath base path '/actuator' +24-05-07.16:45:17.568 [main ] INFO RaffleActivityOrderDaoTest - Started RaffleActivityOrderDaoTest in 13.107 seconds (JVM running for 15.544) +24-05-07.16:45:18.029 [main ] INFO HikariDataSource - Retail_HikariCP - Starting... +24-05-07.16:45:20.009 [scheduling-1 ] INFO UpdateAwardStockJob - 定时任务,更新奖品消耗库存【延迟队列获取,降低对数据库的更新频次,不要产生竞争】 +24-05-07.16:45:20.056 [scheduling-1 ] INFO StrategyRepository - 队列数据:null +24-05-07.16:45:21.130 [main ] INFO HikariDataSource - Retail_HikariCP - Start completed. +24-05-07.16:45:21.405 [main ] INFO RaffleActivityOrderDaoTest - 测试结果:[{"state":"not_used"},{"state":"not_used"},{"state":"not_used"}] +24-05-07.16:45:35.779 [main ] INFO RaffleActivityDaoTest - Starting RaffleActivityDaoTest using Java 1.8.0_241 on Hudingrong with PID 39208 (started by 86189 in E:\resource\market_platform\xfg-frame-archetype-lite\xfg-frame-archetype-lite-app) +24-05-07.16:45:35.781 [main ] INFO RaffleActivityDaoTest - The following 1 profile is active: "dev" +24-05-07.16:45:37.256 [main ] INFO RepositoryConfigurationDelegate - Multiple Spring Data modules found, entering strict repository configuration mode +24-05-07.16:45:37.260 [main ] INFO RepositoryConfigurationDelegate - Bootstrapping Spring Data Redis repositories in DEFAULT mode. +24-05-07.16:45:37.311 [main ] INFO RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 33 ms. Found 0 Redis repository interfaces. +24-05-07.16:45:42.066 [main ] INFO Version - Redisson 3.23.4 +24-05-07.16:45:44.699 [redisson-netty-2-5] INFO MasterPubSubConnectionPool - 1 connections initialized for 120.78.91.227/120.78.91.227:6379 +24-05-07.16:45:45.567 [redisson-netty-2-23] INFO MasterConnectionPool - 10 connections initialized for 120.78.91.227/120.78.91.227:6379 +24-05-07.16:45:48.270 [main ] INFO EndpointLinksResolver - Exposing 1 endpoint(s) beneath base path '/actuator' +24-05-07.16:45:48.365 [main ] INFO RaffleActivityDaoTest - Started RaffleActivityDaoTest in 13.439 seconds (JVM running for 14.808) +24-05-07.16:45:48.642 [main ] INFO HikariDataSource - Retail_HikariCP - Starting... +24-05-07.16:45:50.016 [scheduling-1 ] INFO UpdateAwardStockJob - 定时任务,更新奖品消耗库存【延迟队列获取,降低对数据库的更新频次,不要产生竞争】 +24-05-07.16:45:50.065 [scheduling-1 ] INFO StrategyRepository - 队列数据:null +24-05-07.16:45:51.714 [main ] INFO HikariDataSource - Retail_HikariCP - Start completed. +24-05-07.16:45:51.958 [main ] INFO RaffleActivityDaoTest - 测试结果:{"state":"0"} diff --git a/xfg-frame-archetype-lite-app/pom.xml b/xfg-frame-archetype-lite-app/pom.xml index a185abe..ac8c3d9 100644 --- a/xfg-frame-archetype-lite-app/pom.xml +++ b/xfg-frame-archetype-lite-app/pom.xml @@ -82,6 +82,14 @@ org.redisson redisson-spring-boot-starter + + org.jeasy + easy-random-core + + + cn.bugstack.middleware + db-router-spring-boot-starter + diff --git a/xfg-frame-archetype-lite-app/src/main/resources/application-dev.yml b/xfg-frame-archetype-lite-app/src/main/resources/application-dev.yml index 193fdbf..9b435e9 100644 --- a/xfg-frame-archetype-lite-app/src/main/resources/application-dev.yml +++ b/xfg-frame-archetype-lite-app/src/main/resources/application-dev.yml @@ -20,23 +20,6 @@ app: # 跨域,开发阶段可以设置为 * 不限制 cross-origin: '*' -# 数据库配置;启动时配置数据库资源信息 -spring: - datasource: - username: root - password: eIRZoTNHLXZXm4^V* - url: jdbc:mysql://120.78.91.227:3306/big_market?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=UTC&useSSL=true - driver-class-name: com.mysql.cj.jdbc.Driver - hikari: - pool-name: Retail_HikariCP - minimum-idle: 15 #最小空闲连接数量 - idle-timeout: 180000 #空闲连接存活最大时间,默认600000(10分钟) - maximum-pool-size: 25 #连接池最大连接数,默认是10 - auto-commit: true #此属性控制从池返回的连接的默认自动提交行为,默认值:true - max-lifetime: 18 #此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟 - connection-timeout: 30000 #数据库连接超时时间,默认30秒,即30000 - connection-test-query: SELECT 1 - type: com.zaxxer.hikari.HikariDataSource # redis配置 redis: sdk: @@ -54,3 +37,61 @@ logging: level: root: info config: classpath:logback-spring.xml + + +# 多数据源路由配置,库数量 * 表数量 为2的次幂,如2库4表 +# mysql 5.x 配置 driver-class-name: com.mysql.jdbc.Driver mysql-connector-java 5.1.34 +# mysql 8.x 配置 driver-class-name: com.mysql.cj.jdbc.Driver mysql-connector-java 8.0.22 +mini-db-router: + jdbc: + datasource: + dbCount: 2 + tbCount: 4 + default: db00 + routerKey: userId + list: db01,db02 + db00: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://120.78.91.227:3306/big_market?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=UTC&useSSL=true + username: root + password: eIRZoTNHLXZXm4^V* + type-class-name: com.zaxxer.hikari.HikariDataSource + pool: + pool-name: Retail_HikariCP + minimum-idle: 15 #最小空闲连接数量 + idle-timeout: 180000 #空闲连接存活最大时间,默认600000(10分钟) + maximum-pool-size: 25 #连接池最大连接数,默认是10 + auto-commit: true #此属性控制从池返回的连接的默认自动提交行为,默认值:true + max-lifetime: 1800000 #此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟 + connection-timeout: 30000 #数据库连接超时时间,默认30秒,即30000 + connection-test-query: SELECT 1 + db01: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://120.78.91.227:3306/big_market_01?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=UTC&useSSL=true + username: root + password: eIRZoTNHLXZXm4^V* + type-class-name: com.zaxxer.hikari.HikariDataSource + pool: + pool-name: Retail_HikariCP + minimum-idle: 15 #最小空闲连接数量 + idle-timeout: 180000 #空闲连接存活最大时间,默认600000(10分钟) + maximum-pool-size: 25 #连接池最大连接数,默认是10 + auto-commit: true #此属性控制从池返回的连接的默认自动提交行为,默认值:true + max-lifetime: 1800000 #此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟 + connection-timeout: 30000 #数据库连接超时时间,默认30秒,即30000 + connection-test-query: SELECT 1 + db02: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://120.78.91.227:3306/big_market_02?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=UTC&useSSL=true + username: root + password: eIRZoTNHLXZXm4^V* + type-class-name: com.zaxxer.hikari.HikariDataSource + pool: + pool-name: Retail_HikariCP + minimum-idle: 15 #最小空闲连接数量 + idle-timeout: 180000 #空闲连接存活最大时间,默认600000(10分钟) + maximum-pool-size: 25 #连接池最大连接数,默认是10 + auto-commit: true #此属性控制从池返回的连接的默认自动提交行为,默认值:true + max-lifetime: 1800000 #此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟 + connection-timeout: 30000 #数据库连接超时时间,默认30秒,即30000 + connection-test-query: SELECT 1 diff --git a/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/raffle_activity_account_flow_mapper.xml b/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/raffle_activity_account_flow_mapper.xml new file mode 100644 index 0000000..865f82c --- /dev/null +++ b/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/raffle_activity_account_flow_mapper.xml @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + id,user_id,activity_id, + total_count,day_count,month_count, + flow_id,flow_channel,biz_id, + create_time,update_time + + + + + + delete from raffle_activity_account_flow + where id = #{id,jdbcType=INTEGER} + + + insert into raffle_activity_account_flow + ( id,user_id,activity_id + ,total_count,day_count,month_count + ,flow_id,flow_channel,biz_id + ,create_time,update_time) + values (#{id,jdbcType=INTEGER},#{user_id,jdbcType=VARCHAR},#{activity_id,jdbcType=BIGINT} + ,#{total_count,jdbcType=INTEGER},#{day_count,jdbcType=INTEGER},#{month_count,jdbcType=INTEGER} + ,#{flow_id,jdbcType=VARCHAR},#{flow_channel,jdbcType=VARCHAR},#{biz_id,jdbcType=VARCHAR} + ,#{create_time,jdbcType=TIMESTAMP},#{update_time,jdbcType=TIMESTAMP}) + + + insert into raffle_activity_account_flow + + id, + user_id, + activity_id, + total_count, + day_count, + month_count, + flow_id, + flow_channel, + biz_id, + create_time, + update_time, + + + #{id,jdbcType=INTEGER}, + #{user_id,jdbcType=VARCHAR}, + #{activity_id,jdbcType=BIGINT}, + #{total_count,jdbcType=INTEGER}, + #{day_count,jdbcType=INTEGER}, + #{month_count,jdbcType=INTEGER}, + #{flow_id,jdbcType=VARCHAR}, + #{flow_channel,jdbcType=VARCHAR}, + #{biz_id,jdbcType=VARCHAR}, + #{create_time,jdbcType=TIMESTAMP}, + #{update_time,jdbcType=TIMESTAMP}, + + + + update raffle_activity_account_flow + + + user_id = #{user_id,jdbcType=VARCHAR}, + + + activity_id = #{activity_id,jdbcType=BIGINT}, + + + total_count = #{total_count,jdbcType=INTEGER}, + + + day_count = #{day_count,jdbcType=INTEGER}, + + + month_count = #{month_count,jdbcType=INTEGER}, + + + flow_id = #{flow_id,jdbcType=VARCHAR}, + + + flow_channel = #{flow_channel,jdbcType=VARCHAR}, + + + biz_id = #{biz_id,jdbcType=VARCHAR}, + + + create_time = #{create_time,jdbcType=TIMESTAMP}, + + + update_time = #{update_time,jdbcType=TIMESTAMP}, + + + where id = #{id,jdbcType=INTEGER} + + + update raffle_activity_account_flow + set + user_id = #{user_id,jdbcType=VARCHAR}, + activity_id = #{activity_id,jdbcType=BIGINT}, + total_count = #{total_count,jdbcType=INTEGER}, + day_count = #{day_count,jdbcType=INTEGER}, + month_count = #{month_count,jdbcType=INTEGER}, + flow_id = #{flow_id,jdbcType=VARCHAR}, + flow_channel = #{flow_channel,jdbcType=VARCHAR}, + biz_id = #{biz_id,jdbcType=VARCHAR}, + create_time = #{create_time,jdbcType=TIMESTAMP}, + update_time = #{update_time,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=INTEGER} + + diff --git a/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/raffle_activity_account_mapper.xml b/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/raffle_activity_account_mapper.xml new file mode 100644 index 0000000..c3a38d9 --- /dev/null +++ b/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/raffle_activity_account_mapper.xml @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + id,user_id,activity_id, + total_count,total_count_surplus,day_count, + day_count_surplus,month_count,month_count_surplus, + create_time,update_time + + + + + + delete from raffle_activity_account + where id = #{id,jdbcType=BIGINT} + + + insert into raffle_activity_account + ( id,user_id,activity_id + ,total_count,total_count_surplus,day_count + ,day_count_surplus,month_count,month_count_surplus + ,create_time,update_time) + values (#{id,jdbcType=BIGINT},#{user_id,jdbcType=VARCHAR},#{activity_id,jdbcType=BIGINT} + ,#{total_count,jdbcType=INTEGER},#{total_count_surplus,jdbcType=INTEGER},#{day_count,jdbcType=INTEGER} + ,#{day_count_surplus,jdbcType=INTEGER},#{month_count,jdbcType=INTEGER},#{month_count_surplus,jdbcType=INTEGER} + ,#{create_time,jdbcType=TIMESTAMP},#{update_time,jdbcType=TIMESTAMP}) + + + insert into raffle_activity_account + + id, + user_id, + activity_id, + total_count, + total_count_surplus, + day_count, + day_count_surplus, + month_count, + month_count_surplus, + create_time, + update_time, + + + #{id,jdbcType=BIGINT}, + #{user_id,jdbcType=VARCHAR}, + #{activity_id,jdbcType=BIGINT}, + #{total_count,jdbcType=INTEGER}, + #{total_count_surplus,jdbcType=INTEGER}, + #{day_count,jdbcType=INTEGER}, + #{day_count_surplus,jdbcType=INTEGER}, + #{month_count,jdbcType=INTEGER}, + #{month_count_surplus,jdbcType=INTEGER}, + #{create_time,jdbcType=TIMESTAMP}, + #{update_time,jdbcType=TIMESTAMP}, + + + + update raffle_activity_account + + + user_id = #{user_id,jdbcType=VARCHAR}, + + + activity_id = #{activity_id,jdbcType=BIGINT}, + + + total_count = #{total_count,jdbcType=INTEGER}, + + + total_count_surplus = #{total_count_surplus,jdbcType=INTEGER}, + + + day_count = #{day_count,jdbcType=INTEGER}, + + + day_count_surplus = #{day_count_surplus,jdbcType=INTEGER}, + + + month_count = #{month_count,jdbcType=INTEGER}, + + + month_count_surplus = #{month_count_surplus,jdbcType=INTEGER}, + + + create_time = #{create_time,jdbcType=TIMESTAMP}, + + + update_time = #{update_time,jdbcType=TIMESTAMP}, + + + where id = #{id,jdbcType=BIGINT} + + + update raffle_activity_account + set + user_id = #{user_id,jdbcType=VARCHAR}, + activity_id = #{activity_id,jdbcType=BIGINT}, + total_count = #{total_count,jdbcType=INTEGER}, + total_count_surplus = #{total_count_surplus,jdbcType=INTEGER}, + day_count = #{day_count,jdbcType=INTEGER}, + day_count_surplus = #{day_count_surplus,jdbcType=INTEGER}, + month_count = #{month_count,jdbcType=INTEGER}, + month_count_surplus = #{month_count_surplus,jdbcType=INTEGER}, + create_time = #{create_time,jdbcType=TIMESTAMP}, + update_time = #{update_time,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=BIGINT} + + diff --git a/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/raffle_activity_count_mapper.xml b/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/raffle_activity_count_mapper.xml new file mode 100644 index 0000000..4b41ad2 --- /dev/null +++ b/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/raffle_activity_count_mapper.xml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + id,activity_count_id,total_count, + day_count,month_count,create_time, + update_time + + + + + + delete from raffle_activity_count + where id = #{id,jdbcType=BIGINT} + + + insert into raffle_activity_count + ( id,activity_count_id,total_count + ,day_count,month_count,create_time + ,update_time) + values (#{id,jdbcType=BIGINT},#{activity_count_id,jdbcType=BIGINT},#{total_count,jdbcType=INTEGER} + ,#{day_count,jdbcType=INTEGER},#{month_count,jdbcType=INTEGER},#{create_time,jdbcType=TIMESTAMP} + ,#{update_time,jdbcType=TIMESTAMP}) + + + insert into raffle_activity_count + + id, + activity_count_id, + total_count, + day_count, + month_count, + create_time, + update_time, + + + #{id,jdbcType=BIGINT}, + #{activity_count_id,jdbcType=BIGINT}, + #{total_count,jdbcType=INTEGER}, + #{day_count,jdbcType=INTEGER}, + #{month_count,jdbcType=INTEGER}, + #{create_time,jdbcType=TIMESTAMP}, + #{update_time,jdbcType=TIMESTAMP}, + + + + update raffle_activity_count + + + activity_count_id = #{activity_count_id,jdbcType=BIGINT}, + + + total_count = #{total_count,jdbcType=INTEGER}, + + + day_count = #{day_count,jdbcType=INTEGER}, + + + month_count = #{month_count,jdbcType=INTEGER}, + + + create_time = #{create_time,jdbcType=TIMESTAMP}, + + + update_time = #{update_time,jdbcType=TIMESTAMP}, + + + where id = #{id,jdbcType=BIGINT} + + + update raffle_activity_count + set + activity_count_id = #{activity_count_id,jdbcType=BIGINT}, + total_count = #{total_count,jdbcType=INTEGER}, + day_count = #{day_count,jdbcType=INTEGER}, + month_count = #{month_count,jdbcType=INTEGER}, + create_time = #{create_time,jdbcType=TIMESTAMP}, + update_time = #{update_time,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=BIGINT} + + diff --git a/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/raffle_activity_mapper.xml b/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/raffle_activity_mapper.xml new file mode 100644 index 0000000..6d50148 --- /dev/null +++ b/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/raffle_activity_mapper.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + id,activity_id,activity_name, + activity_desc,begin_date_time,end_date_time, + stock_count,stock_count_surplus,activity_count_id, + strategy_id,state,create_time, + update_time + + + + + diff --git a/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/raffle_activity_order_mapper.xml b/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/raffle_activity_order_mapper.xml new file mode 100644 index 0000000..fa5ce3b --- /dev/null +++ b/xfg-frame-archetype-lite-app/src/main/resources/mybatis/mapper/raffle_activity_order_mapper.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + id,user_id,activity_id, + activity_name,strategy_id,order_id, + order_time,state,create_time, + update_time + + + insert into raffle_activity_order(user_id, activity_id, activity_name, strategy_id, order_id, order_time, state, create_time, update_time) + values(#{userId}, #{activityId}, #{activityName}, #{strategyId}, #{orderId}, #{orderTime}, #{state}, now(), now()) + + + + + diff --git a/xfg-frame-archetype-lite-app/src/test/java/cn/bugstack/test/infrastructure/RaffleActivityDaoTest.java b/xfg-frame-archetype-lite-app/src/test/java/cn/bugstack/test/infrastructure/RaffleActivityDaoTest.java new file mode 100644 index 0000000..4f7ae9e --- /dev/null +++ b/xfg-frame-archetype-lite-app/src/test/java/cn/bugstack/test/infrastructure/RaffleActivityDaoTest.java @@ -0,0 +1,33 @@ +package cn.bugstack.test.infrastructure; + +import cn.bugstack.infrastructure.persistent.dao.IRaffleActivityDao; +import cn.bugstack.infrastructure.persistent.po.RaffleActivity; +import com.alibaba.fastjson2.JSON; +import lombok.extern.slf4j.Slf4j; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.annotation.Resource; + +/** + * @author Fuzhengwei bugstack.cn @小傅哥 + * @description 抽奖活动配置Dao测试 + * @create 2024-03-09 11:30 + */ +@Slf4j +@RunWith(SpringRunner.class) +@SpringBootTest +public class RaffleActivityDaoTest { + + @Resource + private IRaffleActivityDao raffleActivityDao; + + @Test + public void test_queryRaffleActivityByActivityId() { + RaffleActivity raffleActivity = raffleActivityDao.queryRaffleActivityByActivityId(100301L); + log.info("测试结果:{}", JSON.toJSONString(raffleActivity)); + } + +} diff --git a/xfg-frame-archetype-lite-app/src/test/java/cn/bugstack/test/infrastructure/RaffleActivityOrderDaoTest.java b/xfg-frame-archetype-lite-app/src/test/java/cn/bugstack/test/infrastructure/RaffleActivityOrderDaoTest.java new file mode 100644 index 0000000..3d552d9 --- /dev/null +++ b/xfg-frame-archetype-lite-app/src/test/java/cn/bugstack/test/infrastructure/RaffleActivityOrderDaoTest.java @@ -0,0 +1,71 @@ +package cn.bugstack.test.infrastructure; + +import cn.bugstack.infrastructure.persistent.dao.IRaffleActivityOrderDao; +import cn.bugstack.infrastructure.persistent.po.RaffleActivityOrder; +import com.alibaba.fastjson.JSON; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.RandomStringUtils; +import org.jeasy.random.EasyRandom; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +/** + * @author Fuzhengwei bugstack.cn @小傅哥 + * @description 抽奖活动订单测试 + * @create 2024-03-09 10:51 + */ +@Slf4j +@RunWith(SpringRunner.class) +@SpringBootTest +public class RaffleActivityOrderDaoTest { + + @Resource + private IRaffleActivityOrderDao raffleActivityOrderDao; + + private final EasyRandom easyRandom = new EasyRandom(); + + @Test + public void test_insert_random() { + for (int i = 0; i < 5; i++) { + RaffleActivityOrder raffleActivityOrder = new RaffleActivityOrder(); + // EasyRandom 可以通过指定对象类的方式,随机生成对象值。如;easyRandom.nextObject(String.class)、easyRandom.nextObject(RaffleActivityOrder.class) + raffleActivityOrder.setUserId(easyRandom.nextObject(String.class)); + raffleActivityOrder.setActivityId(100301L); + raffleActivityOrder.setActivityName("测试活动"); + raffleActivityOrder.setStrategyId(100006L); + raffleActivityOrder.setOrderId(RandomStringUtils.randomNumeric(12)); + raffleActivityOrder.setOrderTime(new Date()); + raffleActivityOrder.setState("not_used"); + // 插入数据 + raffleActivityOrderDao.insert(raffleActivityOrder); + } + } + + @Test + public void test_insert() { + RaffleActivityOrder raffleActivityOrder = new RaffleActivityOrder(); + raffleActivityOrder.setUserId("xiaofuge"); + raffleActivityOrder.setActivityId(100301L); + raffleActivityOrder.setActivityName("测试活动"); + raffleActivityOrder.setStrategyId(100006L); + raffleActivityOrder.setOrderId(RandomStringUtils.randomNumeric(12)); + raffleActivityOrder.setOrderTime(new Date()); + raffleActivityOrder.setState("not_used"); + // 插入数据 + raffleActivityOrderDao.insert(raffleActivityOrder); + } + + @Test + public void test_queryRaffleActivityOrderByUserId() { + String userId = "xiaofuge"; + List raffleActivityOrders = raffleActivityOrderDao.queryRaffleActivityOrderByUserId(userId); + log.info("测试结果:{}", JSON.toJSONString(raffleActivityOrders)); + } + +} diff --git a/xfg-frame-archetype-lite-domain/src/main/java/cn/bugstack/domain/strategy/model/entity/RaffleActivityAccountEntity.java b/xfg-frame-archetype-lite-domain/src/main/java/cn/bugstack/domain/strategy/model/entity/RaffleActivityAccountEntity.java new file mode 100644 index 0000000..950b924 --- /dev/null +++ b/xfg-frame-archetype-lite-domain/src/main/java/cn/bugstack/domain/strategy/model/entity/RaffleActivityAccountEntity.java @@ -0,0 +1,70 @@ +package cn.bugstack.domain.strategy.model.entity; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 抽奖活动账户表 + * @TableName raffle_activity_account + */ +@Data +public class RaffleActivityAccountEntity implements Serializable { + /** + * 自增ID + */ + private Long id; + + /** + * 用户ID + */ + private String user_id; + + /** + * 活动ID + */ + private Long activity_id; + + /** + * 总次数 + */ + private Integer total_count; + + /** + * 总次数-剩余 + */ + private Integer total_count_surplus; + + /** + * 日次数 + */ + private Integer day_count; + + /** + * 日次数-剩余 + */ + private Integer day_count_surplus; + + /** + * 月次数 + */ + private Integer month_count; + + /** + * 月次数-剩余 + */ + private Integer month_count_surplus; + + /** + * 创建时间 + */ + private Date create_time; + + /** + * 更新时间 + */ + private Date update_time; + + private static final long serialVersionUID = 1L; +} diff --git a/xfg-frame-archetype-lite-domain/src/main/java/cn/bugstack/domain/strategy/model/entity/RaffleActivityAccountFlowEntity.java b/xfg-frame-archetype-lite-domain/src/main/java/cn/bugstack/domain/strategy/model/entity/RaffleActivityAccountFlowEntity.java new file mode 100644 index 0000000..b8e8e9a --- /dev/null +++ b/xfg-frame-archetype-lite-domain/src/main/java/cn/bugstack/domain/strategy/model/entity/RaffleActivityAccountFlowEntity.java @@ -0,0 +1,70 @@ +package cn.bugstack.domain.strategy.model.entity; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 抽奖活动账户流水表 + * @TableName raffle_activity_account_flow + */ +@Data +public class RaffleActivityAccountFlowEntity implements Serializable { + /** + * 自增ID + */ + private Integer id; + + /** + * 用户ID + */ + private String user_id; + + /** + * 活动ID + */ + private Long activity_id; + + /** + * 总次数 + */ + private Integer total_count; + + /** + * 日次数 + */ + private Integer day_count; + + /** + * 月次数 + */ + private Integer month_count; + + /** + * 流水ID - 生成的唯一ID + */ + private String flow_id; + + /** + * 流水渠道(activity-活动领取、sale-购买、redeem-兑换、free-免费赠送) + */ + private String flow_channel; + + /** + * 业务ID(外部透传,活动ID、订单ID) + */ + private String biz_id; + + /** + * 创建时间 + */ + private Date create_time; + + /** + * 更新时间 + */ + private Date update_time; + + private static final long serialVersionUID = 1L; +} diff --git a/xfg-frame-archetype-lite-domain/src/main/java/cn/bugstack/domain/strategy/model/entity/RaffleActivityCountEntity.java b/xfg-frame-archetype-lite-domain/src/main/java/cn/bugstack/domain/strategy/model/entity/RaffleActivityCountEntity.java new file mode 100644 index 0000000..5ef2665 --- /dev/null +++ b/xfg-frame-archetype-lite-domain/src/main/java/cn/bugstack/domain/strategy/model/entity/RaffleActivityCountEntity.java @@ -0,0 +1,50 @@ +package cn.bugstack.domain.strategy.model.entity; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 抽奖活动次数配置表 + * @TableName raffle_activity_count + */ +@Data +public class RaffleActivityCountEntity implements Serializable { + /** + * 自增ID + */ + private Long id; + + /** + * 活动次数编号 + */ + private Long activity_count_id; + + /** + * 总次数 + */ + private Integer total_count; + + /** + * 日次数 + */ + private Integer day_count; + + /** + * 月次数 + */ + private Integer month_count; + + /** + * 创建时间 + */ + private Date create_time; + + /** + * 更新时间 + */ + private Date update_time; + + private static final long serialVersionUID = 1L; +} diff --git a/xfg-frame-archetype-lite-domain/src/main/java/cn/bugstack/domain/strategy/model/entity/RaffleActivityEntity.java b/xfg-frame-archetype-lite-domain/src/main/java/cn/bugstack/domain/strategy/model/entity/RaffleActivityEntity.java new file mode 100644 index 0000000..7ebb8e7 --- /dev/null +++ b/xfg-frame-archetype-lite-domain/src/main/java/cn/bugstack/domain/strategy/model/entity/RaffleActivityEntity.java @@ -0,0 +1,80 @@ +package cn.bugstack.domain.strategy.model.entity; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 抽奖活动表 + * @TableName raffle_activity + */ +@Data +public class RaffleActivityEntity implements Serializable { + /** + * 自增ID + */ + private Long id; + + /** + * 活动ID + */ + private Long activity_id; + + /** + * 活动名称 + */ + private String activity_name; + + /** + * 活动描述 + */ + private String activity_desc; + + /** + * 开始时间 + */ + private Date begin_date_time; + + /** + * 结束时间 + */ + private Date end_date_time; + + /** + * 库存总量 + */ + private Integer stock_count; + + /** + * 剩余库存 + */ + private Integer stock_count_surplus; + + /** + * 活动参与次数配置 + */ + private Long activity_count_id; + + /** + * 抽奖策略ID + */ + private Long strategy_id; + + /** + * 活动状态 + */ + private String state; + + /** + * 创建时间 + */ + private Date create_time; + + /** + * 更新时间 + */ + private Date update_time; + + private static final long serialVersionUID = 1L; +} diff --git a/xfg-frame-archetype-lite-domain/src/main/java/cn/bugstack/domain/strategy/model/entity/RaffleActivityOrderEntity.java b/xfg-frame-archetype-lite-domain/src/main/java/cn/bugstack/domain/strategy/model/entity/RaffleActivityOrderEntity.java new file mode 100644 index 0000000..24718ce --- /dev/null +++ b/xfg-frame-archetype-lite-domain/src/main/java/cn/bugstack/domain/strategy/model/entity/RaffleActivityOrderEntity.java @@ -0,0 +1,65 @@ +package cn.bugstack.domain.strategy.model.entity; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 抽奖活动单 + * @TableName raffle_activity_order + */ +@Data +public class RaffleActivityOrderEntity implements Serializable { + /** + * 自增ID + */ + private Long id; + + /** + * 用户ID + */ + private String user_id; + + /** + * 活动ID + */ + private Long activity_id; + + /** + * 活动名称 + */ + private String activity_name; + + /** + * 抽奖策略ID + */ + private Long strategy_id; + + /** + * 订单ID + */ + private String order_id; + + /** + * 下单时间 + */ + private Date order_time; + + /** + * 订单状态(not_used、used、expire) + */ + private String state; + + /** + * 创建时间 + */ + private Date create_time; + + /** + * 更新时间 + */ + private Date update_time; + + private static final long serialVersionUID = 1L; +} diff --git a/xfg-frame-archetype-lite-domain/src/main/java/cn/bugstack/domain/strategy/service/AbstractRaffleStrategy.java b/xfg-frame-archetype-lite-domain/src/main/java/cn/bugstack/domain/strategy/service/AbstractRaffleStrategy.java index cbb673b..ab7416f 100644 --- a/xfg-frame-archetype-lite-domain/src/main/java/cn/bugstack/domain/strategy/service/AbstractRaffleStrategy.java +++ b/xfg-frame-archetype-lite-domain/src/main/java/cn/bugstack/domain/strategy/service/AbstractRaffleStrategy.java @@ -4,7 +4,6 @@ import cn.bugstack.domain.strategy.model.entity.RaffleAwardEntity; import cn.bugstack.domain.strategy.model.entity.RaffleFactorEntity; import cn.bugstack.domain.strategy.model.entity.StrategyAwardEntity; import cn.bugstack.domain.strategy.repository.IStrategyRepository; -import cn.bugstack.domain.strategy.service.IRaffleStrategy; import cn.bugstack.domain.strategy.service.armory.IStrategyDispatch; import cn.bugstack.domain.strategy.service.rule.chain.factory.DefaultChainFactory; import cn.bugstack.domain.strategy.service.rule.tree.factory.DefaultTreeFactory; diff --git a/xfg-frame-archetype-lite-infrastructure/pom.xml b/xfg-frame-archetype-lite-infrastructure/pom.xml index f8dd732..99e8360 100644 --- a/xfg-frame-archetype-lite-infrastructure/pom.xml +++ b/xfg-frame-archetype-lite-infrastructure/pom.xml @@ -23,6 +23,10 @@ redisson-spring-boot-starter 3.23.4 + + cn.bugstack.middleware + db-router-spring-boot-starter + cn.bugstack diff --git a/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IRaffleActivityAccountDao.java b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IRaffleActivityAccountDao.java new file mode 100644 index 0000000..804cc79 --- /dev/null +++ b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IRaffleActivityAccountDao.java @@ -0,0 +1,30 @@ +package cn.bugstack.infrastructure.persistent.dao; + +import cn.bugstack.domain.strategy.model.entity.RaffleActivityAccountEntity; +import cn.bugstack.domain.strategy.model.entity.RaffleActivityAccountFlowEntity; +import cn.bugstack.middleware.db.router.annotation.DBRouterStrategy; +import org.apache.ibatis.annotations.Mapper; + +/** +* @author 86189 +* @description 针对表【raffle_activity_account(抽奖活动账户表)】的数据库操作Mapper +* @createDate 2024-04-30 15:37:45 +* @Entity generator.domain.RaffleActivityAccount +*/ +@Mapper +@DBRouterStrategy(splitTable = true) +public interface IRaffleActivityAccountDao { + + int deleteByPrimaryKey(Long id); + + int insert(RaffleActivityAccountEntity record); + + int insertSelective(RaffleActivityAccountFlowEntity record); + + RaffleActivityAccountFlowEntity selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(RaffleActivityAccountFlowEntity record); + + int updateByPrimaryKey(RaffleActivityAccountFlowEntity record); + +} diff --git a/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IRaffleActivityAccountFlowDao.java b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IRaffleActivityAccountFlowDao.java new file mode 100644 index 0000000..b7485cd --- /dev/null +++ b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IRaffleActivityAccountFlowDao.java @@ -0,0 +1,30 @@ +package cn.bugstack.infrastructure.persistent.dao; + + +import cn.bugstack.domain.strategy.model.entity.RaffleActivityAccountFlowEntity; +import cn.bugstack.middleware.db.router.annotation.DBRouterStrategy; +import org.apache.ibatis.annotations.Mapper; + +/** +* @author 86189 +* @description 针对表【raffle_activity_account_flow(抽奖活动账户流水表)】的数据库操作Mapper +* @createDate 2024-04-30 15:38:45 +* @Entity generator1.domain.RaffleActivityAccountFlow +*/ +@Mapper +@DBRouterStrategy(splitTable = true) +public interface IRaffleActivityAccountFlowDao { + + int deleteByPrimaryKey(Long id); + + int insert(RaffleActivityAccountFlowEntity record); + + int insertSelective(RaffleActivityAccountFlowEntity record); + + RaffleActivityAccountFlowEntity selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(RaffleActivityAccountFlowEntity record); + + int updateByPrimaryKey(RaffleActivityAccountFlowEntity record); + +} diff --git a/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IRaffleActivityCountDao.java b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IRaffleActivityCountDao.java new file mode 100644 index 0000000..03e6a51 --- /dev/null +++ b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IRaffleActivityCountDao.java @@ -0,0 +1,25 @@ +package cn.bugstack.infrastructure.persistent.dao; + +import cn.bugstack.domain.strategy.model.entity.RaffleActivityCountEntity; + +/** +* @author 86189 +* @description 针对表【raffle_activity_count(抽奖活动次数配置表)】的数据库操作Mapper +* @createDate 2024-05-07 15:48:51 +* @Entity generator2.domain.RaffleActivityCount +*/ +public interface IRaffleActivityCountDao { + + int deleteByPrimaryKey(Long id); + + int insert(RaffleActivityCountEntity record); + + int insertSelective(RaffleActivityCountEntity record); + + RaffleActivityCountEntity selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(RaffleActivityCountEntity record); + + int updateByPrimaryKey(RaffleActivityCountEntity record); + +} diff --git a/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IRaffleActivityDao.java b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IRaffleActivityDao.java new file mode 100644 index 0000000..ec2c143 --- /dev/null +++ b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IRaffleActivityDao.java @@ -0,0 +1,17 @@ +package cn.bugstack.infrastructure.persistent.dao; + +import cn.bugstack.domain.strategy.model.entity.RaffleActivityEntity; +import cn.bugstack.infrastructure.persistent.po.RaffleActivity; +import org.apache.ibatis.annotations.Mapper; + +/** +* @author 86189 +* @description 针对表【raffle_activity(抽奖活动表)】的数据库操作Mapper +* @createDate 2024-05-07 15:49:10 +* @Entity generator.domain.RaffleActivity +*/ +@Mapper +public interface IRaffleActivityDao { + + RaffleActivity queryRaffleActivityByActivityId(Long activityId); +} diff --git a/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IRaffleActivityOrderDao.java b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IRaffleActivityOrderDao.java new file mode 100644 index 0000000..e0b1202 --- /dev/null +++ b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/dao/IRaffleActivityOrderDao.java @@ -0,0 +1,26 @@ +package cn.bugstack.infrastructure.persistent.dao; + +import cn.bugstack.infrastructure.persistent.po.RaffleActivityOrder; +import cn.bugstack.middleware.db.router.annotation.DBRouter; +import cn.bugstack.middleware.db.router.annotation.DBRouterStrategy; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** +* @author 86189 +* @description 针对表【raffle_activity_order(抽奖活动单)】的数据库操作Mapper +* @createDate 2024-04-30 15:40:40 +* @Entity generator2.domain.RaffleActivityOrder +*/ +@Mapper +@DBRouterStrategy(splitTable = true) +public interface IRaffleActivityOrderDao { + + @DBRouter(key = "userId") + void insert(RaffleActivityOrder raffleActivityOrder); + + @DBRouter + List queryRaffleActivityOrderByUserId(String userId); + +} diff --git a/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/po/RaffleActivity.java b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/po/RaffleActivity.java new file mode 100644 index 0000000..dc2bf25 --- /dev/null +++ b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/po/RaffleActivity.java @@ -0,0 +1,79 @@ +package cn.bugstack.infrastructure.persistent.po; + +import lombok.Data; + +import java.util.Date; + +/** + * @description: + * @author: hdr + * @PACKAGE_NAME: cn.bugstack.infrastructure.persistent.po + * @DATE: 2024/5/7 + */ +@Data +public class RaffleActivity { + /** + * 自增ID + */ + private Long id; + + /** + * 活动ID + */ + private Long activityId; + + /** + * 活动名称 + */ + private String activityName; + + /** + * 活动描述 + */ + private String activityDesc; + + /** + * 开始时间 + */ + private Date beginDateTime; + + /** + * 结束时间 + */ + private Date endDateTime; + + /** + * 库存总量 + */ + private Integer stockCount; + + /** + * 剩余库存 + */ + private Integer stockCountSurplus; + + /** + * 活动参与次数配置 + */ + private Long activityCountId; + + /** + * 抽奖策略ID + */ + private Long strategyId; + + /** + * 活动状态 + */ + private String state; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; +} diff --git a/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/po/RaffleActivityOrder.java b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/po/RaffleActivityOrder.java new file mode 100644 index 0000000..86fec34 --- /dev/null +++ b/xfg-frame-archetype-lite-infrastructure/src/main/java/cn/bugstack/infrastructure/persistent/po/RaffleActivityOrder.java @@ -0,0 +1,66 @@ +package cn.bugstack.infrastructure.persistent.po; + +import lombok.Data; + +import java.util.Date; + +/** + * @description: + * @author: hdr + * @PACKAGE_NAME: cn.bugstack.infrastructure.persistent.po + * @DATE: 2024/5/7 + */ +@Data +public class RaffleActivityOrder { + + /** + * 自增ID + */ + private Long id; + + /** + * 用户ID + */ + private String userId; + + /** + * 活动ID + */ + private Long activityId; + + /** + * 活动名称 + */ + private String activityName; + + /** + * 抽奖策略ID + */ + private Long strategyId; + + /** + * 订单ID + */ + private String orderId; + + /** + * 下单时间 + */ + private Date orderTime; + + /** + * 订单状态(not_used、used、expire) + */ + private String state; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; + +} diff --git a/xfg-frame-archetype-lite-types/pom.xml b/xfg-frame-archetype-lite-types/pom.xml index a49af17..142f60c 100644 --- a/xfg-frame-archetype-lite-types/pom.xml +++ b/xfg-frame-archetype-lite-types/pom.xml @@ -30,23 +30,6 @@ org.apache.commons commons-lang3 - - - - cn.bugstack - xfg-frame-market-api - - - xfg-frame-archetype-lite - cn.bugstack - compile - - - cn.bugstack - xfg-frame-archetype-lite-domain - 1.0-SNAPSHOT - compile - -- GitLab