Browse Source

Merge branch 'milestone-20250723-wwl' into wuweili/feature-20250715095139-抽奖众筹

dev
willy 3 weeks ago
parent
commit
10f7894397
  1. BIN
      lottery-system/.idea/.cache/.Apifox_Helper/.toolWindow.db
  2. 30
      lottery-system/lottery-service/src/main/java/com/lottery/admin/service/Impl/AdminPrizeServiceImpl.java
  3. 8
      lottery-system/lottery-service/src/main/java/com/lottery/admin/service/Impl/AdminUserServiceImpl.java
  4. 20
      lottery-system/lottery-service/src/main/java/com/lottery/admin/service/Impl/FundingServiceImpl.java
  5. 16
      lottery-system/lottery-service/src/main/java/com/lottery/api/service/Impl/ApiFundingServiceImpl.java
  6. 35
      lottery-system/lottery-service/src/main/resources/application-dev.yml
  7. 36
      lottery-system/lottery-service/src/main/resources/application-prod.yml
  8. 73
      lottery-system/lottery-service/src/main/resources/application.yml

BIN
lottery-system/.idea/.cache/.Apifox_Helper/.toolWindow.db

30
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.utils.ConvertBeanUtil;
import com.lottery.vo.PageInfo; import com.lottery.vo.PageInfo;
import com.lottery.vo.PrizeVo; import com.lottery.vo.PrizeVo;
import org.apache.ibatis.annotations.Lang;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -124,10 +125,14 @@ public class AdminPrizeServiceImpl extends ServiceImpl<AdminPrizeMapper, Prize>
Long gradeId = prizeDto.getGradeId(); Long gradeId = prizeDto.getGradeId();
Grade grade = adminGradeMapper.selectById(gradeId); Grade grade = adminGradeMapper.selectById(gradeId);
Long l = adminPrizeMapper.selectByName(prizeDto.getPrizeName());
if (l != null) {
return Result.failure("奖品名已存在");
}
//LambdaUpdateWrapper<Prize> 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 // 2. 检查是否是修改现有奖品需要传入prizeId
// 1. 查询原奖品信息 // 1. 查询原奖品信息
@ -151,19 +156,18 @@ public class AdminPrizeServiceImpl extends ServiceImpl<AdminPrizeMapper, Prize>
// 3. 如果修改后的等级和原等级不同检查目标等级是否已有奖品 // 3. 如果修改后的等级和原等级不同检查目标等级是否已有奖品
if (!targetGrade.getId().equals(originalPrize.getGradeId())) { if (!targetGrade.getId().equals(originalPrize.getGradeId())) {
LambdaQueryWrapper<Prize> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Prize> 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) { if (this.count(wrapper) > 0) {
return Result.failure("目标等级已有奖品,不能修改"); // 目标等级已有奖品不能修改 return Result.failure("目标等级已有奖品,不能修改"); // 目标等级已有奖品不能修改
} }
} }
//
// // 4. 检查奖品名称是否重复排除自己
// LambdaQueryWrapper<Prize> nameCheckWrapper = new LambdaQueryWrapper<>();
// nameCheckWrapper.eq(Prize::getPrizeName, prizeDto.getPrizeName())
// .ne(Prize::getId, prizeDto.getId());
// if (this.count(nameCheckWrapper) > 0) {
// return false; // 奖品名称已存在
// }
// 4. 检查奖品名称是否重复排除自己
LambdaQueryWrapper<Prize> nameCheckWrapper = new LambdaQueryWrapper<>();
nameCheckWrapper.eq(Prize::getPrizeName, prizeDto.getPrizeName())
.ne(Prize::getId, prizeDto.getId());
if (this.count(nameCheckWrapper) > 0) {
return Result.failure("奖品名称已存在"); // 奖品名称已存在
}
// LambdaQueryWrapper<Prize> wrapper = new LambdaQueryWrapper<>(); // LambdaQueryWrapper<Prize> wrapper = new LambdaQueryWrapper<>();
// wrapper.eq(Prize::getGradeId, grade.getId()); // wrapper.eq(Prize::getGradeId, grade.getId());

8
lottery-system/lottery-service/src/main/java/com/lottery/admin/service/Impl/AdminUserServiceImpl.java

@ -185,9 +185,9 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, User> imp
try { try {
// 1. 解析Excel // 1. 解析Excel
List<UserImportDto> userDtos = EasyExcel.read(file.getInputStream()) List<UserImportDto> userDtos = EasyExcel.read(file.getInputStream())
.head(UserImportDto.class)
.head(UserImportDto.class) // 映射到 DTO 对象
.sheet() .sheet()
.doReadSync();
.doReadSync(); // 同步读取所有数据适用于读取量小的场景
// 2. 获取已存在的精网号及其删除状态 // 2. 获取已存在的精网号及其删除状态
Map<String, Integer> existingUserMap = adminUserMapper.selectAllUserCodesWithDelStatus() Map<String, Integer> existingUserMap = adminUserMapper.selectAllUserCodesWithDelStatus()
@ -198,8 +198,8 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, User> imp
(existing, replacement) -> existing (existing, replacement) -> existing
)); ));
List<User> usersToAdd = new ArrayList<>();
List<User> usersToUpdate = new ArrayList<>();
List<User> usersToAdd = new ArrayList<>(); //新增用户列表
List<User> usersToUpdate = new ArrayList<>(); //待更新的用户列表
Set<String> processedCodes = new HashSet<>(); // 用于当前文件内的去重 Set<String> processedCodes = new HashSet<>(); // 用于当前文件内的去重
for (int i = 0; i < userDtos.size(); i++) { for (int i = 0; i < userDtos.size(); i++) {

20
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 two = fundingActivityDto.getMarketTwo();
Integer activityId = activity.getId(); Integer activityId = activity.getId();
Integer time = 0;
Integer time = 15;
Integer addTotal = 0; Integer addTotal = 0;
fundingMapper.addDate(time,one, addTotal, activityId); fundingMapper.addDate(time,one, addTotal, activityId);
fundingMapper.addDate(time,two, addTotal, activityId); fundingMapper.addDate(time,two, addTotal, activityId);
return Result.success("添加活动成功"); return Result.success("添加活动成功");
} }
@ -299,12 +300,27 @@ public class FundingServiceImpl implements IFundingService {
if(marketCount ==null || marketCount == 0){ if(marketCount ==null || marketCount == 0){
return Result.failure("所要设置市场不存在"); return Result.failure("所要设置市场不存在");
} }
//查询当前总的助力数 //查询当前总的助力数
Integer total = fundingMapper.searchMarketTotal(activityId,stock); 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"); return Result.failure("所在市场助力值最大1500");
} }
if(total + addTotal + markerTwoVirtual< 0){
return Result.failure("所设置市场助力值不能小于0");
}
fundingMapper.setVirtual(activityId, stock, addTotal); fundingMapper.setVirtual(activityId, stock, addTotal);
return Result.success("设置虚拟次数成功"); return Result.success("设置虚拟次数成功");
} }

16
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){ if(rootNode.path("code").asInt() == 401){
return Result.failure("登录凭证错误"); 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 // 提取 username
String username = rootNode.path("data").path("username").asText(); String username = rootNode.path("data").path("username").asText();
String jwcode = rootNode.path("data").path("jwcode").asText(); String jwcode = rootNode.path("data").path("jwcode").asText();

35
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 # 最小空闲连接

36
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 # 最小空闲连接

73
lottery-system/lottery-service/src/main/resources/application.yml

@ -1,43 +1,14 @@
server:
port: 12699 # 服务端口
forward-headers-strategy: native # 全局生效
spring: 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: logging:
config: classpath:logback-spring.xml config: classpath:logback-spring.xml
level: level:
@ -45,18 +16,26 @@ logging:
org.springframework: WARN org.springframework: WARN
com.link: INFO 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: lottery:
jwt: 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-ttl: 7200000
user-token-name: token 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
Loading…
Cancel
Save