Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
张松 2025-01-07 10:45:19 +08:00
commit 5624342d71
5 changed files with 13 additions and 18 deletions

View File

@ -37,9 +37,6 @@ import java.util.*;
@ConfigurationProperties(prefix = "spring.shardingsphere") @ConfigurationProperties(prefix = "spring.shardingsphere")
public class ShardingConfig { public class ShardingConfig {
@Value("${spring.profiles.active}")
private String activeProfile;
/** /**
* 读取数据源信息 * 读取数据源信息
*/ */

View File

@ -126,8 +126,6 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
private final UserVipDao userVipDao; private final UserVipDao userVipDao;
private final InviteAchievementService inviteAchievementService; private final InviteAchievementService inviteAchievementService;
@Value("${spring.profiles.active}")
private String profiles;
private ReentrantReadWriteLock reentrantReadWriteLock = new ReentrantReadWriteLock(true); private ReentrantReadWriteLock reentrantReadWriteLock = new ReentrantReadWriteLock(true);

View File

@ -226,6 +226,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, Course> implements
map.put("dyEpisodeId", ""); map.put("dyEpisodeId", "");
map.put("wxCourseDetailsId", ""); map.put("wxCourseDetailsId", "");
map.putAll(countMap); map.putAll(countMap);
map.put("courseId", courseId + "");
} }
PageUtils pageUtils = PageUtils.page(pageInfo); PageUtils pageUtils = PageUtils.page(pageInfo);
// setCache(cacheKey, JSONUtil.toJsonStr(pageUtils)); // setCache(cacheKey, JSONUtil.toJsonStr(pageUtils));
@ -1299,10 +1300,10 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, Course> implements
if ("start".equals(type)) { if ("start".equals(type)) {
//开始播放 //开始播放
courseDetailsDao.updateViewCount(details.getCourseId(),details.getCourseDetailsId(), 1); courseDetailsDao.updateViewCount(details.getCourseId(), details.getCourseDetailsId(), 1);
} else if ("end".equals(type)) { } else if ("end".equals(type)) {
//播放完成 //播放完成
courseDetailsDao.updateViewCount(details.getCourseId(),details.getCourseDetailsId(), 2); courseDetailsDao.updateViewCount(details.getCourseId(), details.getCourseDetailsId(), 2);
} }
return Result.success(); return Result.success();

View File

@ -10,6 +10,7 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -20,6 +21,7 @@ import java.util.List;
@Component @Component
@EnableScheduling @EnableScheduling
@Profile({"prod"})
public class SpinningTask3 { public class SpinningTask3 {
@Resource @Resource
@ -27,16 +29,11 @@ public class SpinningTask3 {
@Resource @Resource
private DiscSpinningRecordService recordService; private DiscSpinningRecordService recordService;
@Value("${spring.profiles.active}")
private String profiles;
private Logger logger = LoggerFactory.getLogger(getClass()); private Logger logger = LoggerFactory.getLogger(getClass());
@Scheduled(cron = "0 0/5 * * * ? ") @Scheduled(cron = "0 0/1 * * * ? ")
public void record() { public void record() {
if (!"prod".equals(profiles)) {
return;
}
record("1"); record("1");
} }

View File

@ -669,11 +669,13 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
List<Orders> orders = baseMapper.selectOrdersByOrdersNo(ordersNo, status, userId, courseId, List<Orders> orders = baseMapper.selectOrdersByOrdersNo(ordersNo, status, userId, courseId,
flag, time, userName, ordersType, TimeCompleteUtils.completeStartTime(startTime), TimeCompleteUtils.completeEndTime(endTime), sysUserId, qdCode, sysUserName); flag, time, userName, ordersType, TimeCompleteUtils.completeStartTime(startTime), TimeCompleteUtils.completeEndTime(endTime), sysUserId, qdCode, sysUserName);
Set<Long> courseIds = orders.stream().map(Orders::getCourseId).collect(Collectors.toSet()); Set<Long> courseIds = orders.stream().map(Orders::getCourseId).collect(Collectors.toSet());
List<Course> courses = courseDao.selectBatchIds(courseIds); if(CollUtil.isNotEmpty(courseIds)) {
Map<Long, String> map = courses.stream().collect(Collectors.toMap(Course::getCourseId, Course::getTitle)); List<Course> courses = courseDao.selectBatchIds(courseIds);
orders.parallelStream().forEach(s -> { Map<Long, String> map = courses.stream().collect(Collectors.toMap(Course::getCourseId, Course::getTitle));
s.setTitle(map.get(s.getCourseId())); orders.parallelStream().forEach(s -> {
}); s.setTitle(map.get(s.getCourseId()));
});
}
PageInfo<Orders> pageInfo = new PageInfo<>(orders); PageInfo<Orders> pageInfo = new PageInfo<>(orders);
return Result.success().put("data", PageUtils.page(pageInfo)); return Result.success().put("data", PageUtils.page(pageInfo));
} }