From 25c50f7ea97fb8a73ecc45a70ac2cca15054f867 Mon Sep 17 00:00:00 2001 From: jihaipeng <3204568531@qq.com> Date: Wed, 23 Jul 2025 18:38:42 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=99=9A=E6=8B=9F?= =?UTF-8?q?=E6=AC=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.idea/.cache/.Apifox_Helper/.toolWindow.db | Bin 212992 -> 212992 bytes .../admin/service/Impl/FundingServiceImpl.java | 5 ++++- .../api/service/Impl/ApiFundingServiceImpl.java | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/lottery-system/.idea/.cache/.Apifox_Helper/.toolWindow.db b/lottery-system/.idea/.cache/.Apifox_Helper/.toolWindow.db index fee1a05bb2fec9db83ebb87b551af77f8b6591a2..490d0d11c05c794b3b9b0863680a05836ec5b635 100644 GIT binary patch delta 273 zcmZo@;B9E&ogmF9IZ?)$QF3F#l6WC@sZ9*>adNt{fik~j6s7B>Hf@|3AiQyb54%L8 z7rUshs4g!Mi1P9_u>)xa5SZK;r7+zvn@MEyf?5fgz`SB_PiM!>#PGmO|4henAIJQ3 zPiL?4lY@&?4GNRnWyrP^v%{*Nki=8ta(>-%@N+QEka>63KiaoP{8Zte- z(*kX6ZS<2WOHy?ci;5B}?Hc9TCMVX5PG>7&QVtV-3-$t*4b zIbibPdfUy4HIJDE*ya8)$lsCsC!Z_tAwNl8d9y&nE4j(FQ7Vk=laB*Qw#m`aD$P0b P+jHhKZqJ#|G-Uw*u5egK delta 87 zcmZo@;B9E&ogmF9K2gS*QG8>Tncto>pK*K6e5NT20Hj48A^-pY 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..8560e1b 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 @@ -301,9 +301,12 @@ public class FundingServiceImpl implements IFundingService { } //查询当前总的助力数 Integer total = fundingMapper.searchMarketTotal(activityId,stock); - if(total + addTotal >= 1500){ + if(total + addTotal > 1500){ return Result.failure("所在市场助力值最大1500"); } + if(total + addTotal < 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(); From 2de97be96772d12a851617935cb54d5c5f4e2848 Mon Sep 17 00:00:00 2001 From: jihaipeng <3204568531@qq.com> Date: Thu, 24 Jul 2025 13:45:01 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=8C=BA=E5=88=86=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=AD=A3=E5=BC=8F=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/service/Impl/AdminUserServiceImpl.java | 8 +-- .../admin/service/Impl/FundingServiceImpl.java | 19 +++++- .../src/main/resources/application-dev.yml | 35 +++++++++++ .../src/main/resources/application-prod.yml | 36 +++++++++++ .../src/main/resources/application.yml | 73 ++++++++-------------- 5 files changed, 117 insertions(+), 54 deletions(-) create mode 100644 lottery-system/lottery-service/src/main/resources/application-dev.yml create mode 100644 lottery-system/lottery-service/src/main/resources/application-prod.yml 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 From 6fa2b91b69b4f656bfc0d0711523e33f6cce0761 Mon Sep 17 00:00:00 2001 From: lihuilin Date: Fri, 25 Jul 2025 11:09:22 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=A5=96=E5=93=81bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/service/Impl/AdminPrizeServiceImpl.java | 30 ++++++++++++---------- 1 file changed, 17 insertions(+), 13 deletions(-) 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());