diff --git a/lottery-system/.idea/.cache/.Apifox_Helper/.toolWindow.db b/lottery-system/.idea/.cache/.Apifox_Helper/.toolWindow.db index fee1a05..490d0d1 100644 Binary files a/lottery-system/.idea/.cache/.Apifox_Helper/.toolWindow.db and b/lottery-system/.idea/.cache/.Apifox_Helper/.toolWindow.db differ diff --git a/lottery-system/lottery-service/src/main/java/com/lottery/admin/service/Impl/AdminPrizeServiceImpl.java b/lottery-system/lottery-service/src/main/java/com/lottery/admin/service/Impl/AdminPrizeServiceImpl.java index 0e3d9e2..b073dd6 100644 --- a/lottery-system/lottery-service/src/main/java/com/lottery/admin/service/Impl/AdminPrizeServiceImpl.java +++ b/lottery-system/lottery-service/src/main/java/com/lottery/admin/service/Impl/AdminPrizeServiceImpl.java @@ -14,6 +14,7 @@ import com.lottery.result.Result; import com.lottery.utils.ConvertBeanUtil; import com.lottery.vo.PageInfo; import com.lottery.vo.PrizeVo; +import org.apache.ibatis.annotations.Lang; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -124,10 +125,14 @@ public class AdminPrizeServiceImpl extends ServiceImpl Long gradeId = prizeDto.getGradeId(); Grade grade = adminGradeMapper.selectById(gradeId); - Long l = adminPrizeMapper.selectByName(prizeDto.getPrizeName()); - if (l != null) { - return Result.failure("奖品名已存在"); - } + //LambdaUpdateWrapper lambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + //lambdaUpdateWrapper.eq(Prize::getPrizeName, prizeDto.getPrizeName()).ne(Prize::getId, prizeDto.getId()); + //this.update(null, lambdaUpdateWrapper); + + //Long l = adminPrizeMapper.selectByName(prizeDto.getPrizeName()); + //if (l != null){ + // return Result.failure("奖品名已存在"); + //} // 2. 检查是否是修改现有奖品(需要传入prizeId) // 1. 查询原奖品信息 @@ -151,19 +156,18 @@ public class AdminPrizeServiceImpl extends ServiceImpl // 3. 如果修改后的等级和原等级不同,检查目标等级是否已有奖品 if (!targetGrade.getId().equals(originalPrize.getGradeId())) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(Prize::getGradeId, targetGrade.getId()); + wrapper.eq(Prize::getGradeId, targetGrade.getId()).eq(Prize::getIs_del, 0); if (this.count(wrapper) > 0) { return Result.failure("目标等级已有奖品,不能修改"); // 目标等级已有奖品,不能修改 } } -// -// // 4. 检查奖品名称是否重复(排除自己) -// LambdaQueryWrapper nameCheckWrapper = new LambdaQueryWrapper<>(); -// nameCheckWrapper.eq(Prize::getPrizeName, prizeDto.getPrizeName()) -// .ne(Prize::getId, prizeDto.getId()); -// if (this.count(nameCheckWrapper) > 0) { -// return false; // 奖品名称已存在 -// } + // 4. 检查奖品名称是否重复(排除自己) + LambdaQueryWrapper nameCheckWrapper = new LambdaQueryWrapper<>(); + nameCheckWrapper.eq(Prize::getPrizeName, prizeDto.getPrizeName()) + .ne(Prize::getId, prizeDto.getId()); + if (this.count(nameCheckWrapper) > 0) { + return Result.failure("奖品名称已存在"); // 奖品名称已存在 + } // LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); // wrapper.eq(Prize::getGradeId, grade.getId()); 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 73fcb2e..66dc7c7 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 @@ -185,9 +185,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() @@ -198,8 +198,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 f797211..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,27 @@ 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 + markerTwoVirtual< 0){ + return Result.failure("所设置市场助力值不能小于0"); + } + fundingMapper.setVirtual(activityId, stock, addTotal); return Result.success("设置虚拟次数成功"); } diff --git a/lottery-system/lottery-service/src/main/java/com/lottery/api/service/Impl/ApiFundingServiceImpl.java b/lottery-system/lottery-service/src/main/java/com/lottery/api/service/Impl/ApiFundingServiceImpl.java index 45f8773..26ad88e 100644 --- a/lottery-system/lottery-service/src/main/java/com/lottery/api/service/Impl/ApiFundingServiceImpl.java +++ b/lottery-system/lottery-service/src/main/java/com/lottery/api/service/Impl/ApiFundingServiceImpl.java @@ -181,6 +181,22 @@ public class ApiFundingServiceImpl implements ApiIFundingService { if(rootNode.path("code").asInt() == 401){ return Result.failure("登录凭证错误"); } + + //市场二的总的助力次数 + Integer markerTwoTotal = fundingMapper.searchMarketTotal(fundingRecordDto.getActivityId(), fundingRecordDto.getMarketSign()); + if (markerTwoTotal == null) { + markerTwoTotal = 0; // 默认值 + } + //市场二的虚拟次数 + Integer markerTwoVirtual = fundingMapper.searchVirtual(fundingRecordDto.getActivityId(), fundingRecordDto.getMarketSign()); + if (markerTwoVirtual == null) { + markerTwoVirtual = 0; // 默认值 + } + Integer Show = markerTwoTotal + markerTwoVirtual; + + if((Show+1)>1500){ + return Result.failure(200,"美股实时数据助力成功!"); + } // 提取 username String username = rootNode.path("data").path("username").asText(); String jwcode = rootNode.path("data").path("jwcode").asText(); 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