diff --git a/lottery-system/lottery-service/src/main/java/com/lottery/admin/service/Impl/AdminUserServiceImpl.java b/lottery-system/lottery-service/src/main/java/com/lottery/admin/service/Impl/AdminUserServiceImpl.java index 4a9533b..82d2d2f 100644 --- a/lottery-system/lottery-service/src/main/java/com/lottery/admin/service/Impl/AdminUserServiceImpl.java +++ b/lottery-system/lottery-service/src/main/java/com/lottery/admin/service/Impl/AdminUserServiceImpl.java @@ -179,9 +179,9 @@ public class AdminUserServiceImpl extends ServiceImpl imp try { // 1. 解析Excel List userDtos = EasyExcel.read(file.getInputStream()) - .head(UserImportDto.class) + .head(UserImportDto.class) // 映射到 DTO 对象 .sheet() - .doReadSync(); + .doReadSync(); // 同步读取所有数据,适用于读取量小的场景 // 2. 获取已存在的精网号及其删除状态 Map existingUserMap = adminUserMapper.selectAllUserCodesWithDelStatus() @@ -192,8 +192,8 @@ public class AdminUserServiceImpl extends ServiceImpl imp (existing, replacement) -> existing )); - List usersToAdd = new ArrayList<>(); - List usersToUpdate = new ArrayList<>(); + List usersToAdd = new ArrayList<>(); //新增用户列表 + List usersToUpdate = new ArrayList<>(); //待更新的用户列表 Set processedCodes = new HashSet<>(); // 用于当前文件内的去重 for (int i = 0; i < userDtos.size(); i++) { diff --git a/lottery-system/lottery-service/src/main/java/com/lottery/admin/service/Impl/FundingServiceImpl.java b/lottery-system/lottery-service/src/main/java/com/lottery/admin/service/Impl/FundingServiceImpl.java index 8560e1b..3c89c38 100644 --- a/lottery-system/lottery-service/src/main/java/com/lottery/admin/service/Impl/FundingServiceImpl.java +++ b/lottery-system/lottery-service/src/main/java/com/lottery/admin/service/Impl/FundingServiceImpl.java @@ -135,11 +135,12 @@ public class FundingServiceImpl implements IFundingService { Integer two = fundingActivityDto.getMarketTwo(); Integer activityId = activity.getId(); - Integer time = 0; + Integer time = 15; Integer addTotal = 0; fundingMapper.addDate(time,one, addTotal, activityId); fundingMapper.addDate(time,two, addTotal, activityId); + return Result.success("添加活动成功"); } @@ -299,12 +300,24 @@ public class FundingServiceImpl implements IFundingService { if(marketCount ==null || marketCount == 0){ return Result.failure("所要设置市场不存在"); } + //查询当前总的助力数 Integer total = fundingMapper.searchMarketTotal(activityId,stock); - if(total + addTotal > 1500){ + if(total == null ){ + total = 0; + } + //市场二的虚拟次数 + Integer markerTwoVirtual = fundingMapper.searchVirtual(activityId, stock); + if(markerTwoVirtual == null ){ + markerTwoVirtual = 0; + } + //查询当前的虚拟 + Integer virtual = fundingMapper.searchVirtual(activityId, stock); + if(total + addTotal+markerTwoVirtual > 1500){ return Result.failure("所在市场助力值最大1500"); } - if(total + addTotal < 0){ + + if(total + addTotal + markerTwoVirtual< 0){ return Result.failure("所设置市场助力值不能小于0"); } diff --git a/lottery-system/lottery-service/src/main/resources/application-dev.yml b/lottery-system/lottery-service/src/main/resources/application-dev.yml new file mode 100644 index 0000000..77666aa --- /dev/null +++ b/lottery-system/lottery-service/src/main/resources/application-dev.yml @@ -0,0 +1,35 @@ +spring: + config: + activate: + on-profile: dev + + # ========== 数据源配置 (MySQL) ========== + datasource: + url: jdbc:mysql://39.101.133.168:3306/link?useSSL=false&allowPublicKeyRetrieval=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai + username: link + password: tEhdERkaGprEA7nT + driver-class-name: com.mysql.cj.jdbc.Driver + + hikari: + maximum-pool-size: 20 # 默认一般是 10,根据并发量调整 + connection-timeout: 30000 # 连接超时时间(毫秒),默认 30s + idle-timeout: 600000 # 空闲连接超时时间(默认 10 分钟) + max-lifetime: 1800000 # 连接最大生命周期(默认 30 分钟) + leak-detection-threshold: 5000 # 连接泄漏检测(毫秒,建议 5s) + +# ========== Redis 配置 ========== + redis: + host: 39.98.127.73 + port: 7001 + password: 2TOVfFeJ0pyi9Wtj + database: 1 # 默认DB索引 + jedis: + pool: + max-active: 100 # 最大连接数 + max-wait: 300 # 最大等待时间 + max-idle: 20 # 最大空闲连接 + min-idle: 10 # 最小空闲连接 + + + + diff --git a/lottery-system/lottery-service/src/main/resources/application-prod.yml b/lottery-system/lottery-service/src/main/resources/application-prod.yml new file mode 100644 index 0000000..a94c1e2 --- /dev/null +++ b/lottery-system/lottery-service/src/main/resources/application-prod.yml @@ -0,0 +1,36 @@ +spring: + config: + activate: + on-profile: prod + + # ========== 数据源配置 (MySQL) ========== + datasource: + url: jdbc:mysql://18.143.76.3:3306/activty?useSSL=false&allowPublicKeyRetrieval=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai + username: activty + password: LnAcwpp5ayps5xnc + driver-class-name: com.mysql.cj.jdbc.Driver + + hikari: + maximum-pool-size: 20 # 默认一般是 10,根据并发量调整 + connection-timeout: 30000 # 连接超时时间(毫秒),默认 30s + idle-timeout: 600000 # 空闲连接超时时间(默认 10 分钟) + max-lifetime: 1800000 # 连接最大生命周期(默认 30 分钟) + leak-detection-threshold: 5000 # 连接泄漏检测(毫秒,建议 5s) + + # ========== Redis 配置 ========== + redis: + host: 18.143.76.3 + port: 10703 + password: Ngc0FYUTA6h3wC5J + database: 8 # 默认DB索引 + jedis: + pool: + max-active: 100 # 最大连接数 + max-wait: 300 # 最大等待时间 + max-idle: 20 # 最大空闲连接 + min-idle: 10 # 最小空闲连接 + + + + + diff --git a/lottery-system/lottery-service/src/main/resources/application.yml b/lottery-system/lottery-service/src/main/resources/application.yml index c24c958..ef374a5 100644 --- a/lottery-system/lottery-service/src/main/resources/application.yml +++ b/lottery-system/lottery-service/src/main/resources/application.yml @@ -1,43 +1,14 @@ -server: - port: 12699 # 服务端口 - forward-headers-strategy: native # 全局生效 spring: - # ========== 数据源配置 (MySQL) ========== - datasource: - url: jdbc:mysql://39.101.133.168:3306/link?useSSL=false&allowPublicKeyRetrieval=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai - username: link - password: tEhdERkaGprEA7nT - driver-class-name: com.mysql.cj.jdbc.Driver - - hikari: - maximum-pool-size: 20 # 默认一般是 10,根据并发量调整 - connection-timeout: 30000 # 连接超时时间(毫秒),默认 30s - idle-timeout: 600000 # 空闲连接超时时间(默认 10 分钟) - max-lifetime: 1800000 # 连接最大生命周期(默认 30 分钟) - leak-detection-threshold: 5000 # 连接泄漏检测(毫秒,建议 5s) - -# ========== Redis 配置 ========== - redis: - host: 39.98.127.73 - port: 7001 - password: 2TOVfFeJ0pyi9Wtj - database: 1 # 默认DB索引 - jedis: - pool: - max-active: 100 # 最大连接数 - max-wait: 300 # 最大等待时间 - max-idle: 20 # 最大空闲连接 - min-idle: 10 # 最小空闲连接 - - -# ========== MyBatis 配置(如果使用MyBatis代替JPA) ========== -mybatis: - mapper-locations: classpath:mapper/*.xml # XML映射文件路径 - type-aliases-package: com.lottery.entity # 实体类包路径 - configuration: - map-underscore-to-camel-case: true # 开启驼峰命名转换 - log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 打印SQL日志 + # 基础配置 (所有环境通用) + profiles: + active: dev + # Jackson 基础配置 + jackson: + date-format: yyyy-MM-dd HH:mm:ss + time-zone: GMT+8 + +# 日志基础配置 logging: config: classpath:logback-spring.xml level: @@ -45,18 +16,26 @@ logging: org.springframework: WARN com.link: INFO -# ========== 自定义配置(示例) ========== + # MyBatis 基础配置 + +mybatis: + mapper-locations: classpath:mapper/*.xml + type-aliases-package: com.lottery.entity + configuration: + map-underscore-to-camel-case: true + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + +# 基础配置 (所有环境通用) +server: + port: 12699 + forward-headers-strategy: native + +# 自定义基础配置 lottery: jwt: - #用户端JWT - user-secret-key: willier_need_at_least_32_chars_secure_key_12345 + user-secret-key: willier_need_at_least_32_chars_secure_key_12345 # 基础密钥,生产环境应覆盖 user-ttl: 7200000 user-token-name: token + max-draw-times: 3 - max-draw-times: 3 # 用户每日最大抽奖次数 - - spring: - jackson: - date-format: yyyy-MM-dd HH:mm:ss - time-zone: GMT+8