Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package com.sqx.common.aspect;
|
package com.sqx.common.aspect;
|
||||||
|
|
||||||
import com.sqx.common.annotation.Debounce;
|
import com.sqx.common.annotation.Debounce;
|
||||||
|
import com.sqx.common.utils.Result;
|
||||||
import com.sqx.common.utils.SpelUtil;
|
import com.sqx.common.utils.SpelUtil;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.aspectj.lang.ProceedingJoinPoint;
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
@@ -76,7 +77,7 @@ public class DebounceAspect {
|
|||||||
return joinPoint.proceed();
|
return joinPoint.proceed();
|
||||||
}
|
}
|
||||||
// 在防抖间隔内,不执行目标方法,直接返回
|
// 在防抖间隔内,不执行目标方法,直接返回
|
||||||
return null;
|
return Result.error("请求频繁,请重试");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object debounceForSpecificValue(ProceedingJoinPoint joinPoint, String methodSignature, long interval, TimeUnit timeUnit, Object targetValue) throws Throwable {
|
private Object debounceForSpecificValue(ProceedingJoinPoint joinPoint, String methodSignature, long interval, TimeUnit timeUnit, Object targetValue) throws Throwable {
|
||||||
@@ -89,7 +90,7 @@ public class DebounceAspect {
|
|||||||
return joinPoint.proceed();
|
return joinPoint.proceed();
|
||||||
}
|
}
|
||||||
// 在防抖间隔内,不执行目标方法,直接返回
|
// 在防抖间隔内,不执行目标方法,直接返回
|
||||||
return null;
|
return Result.error("请求频繁,请重试");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cleanExpiredRecords() {
|
public void cleanExpiredRecords() {
|
||||||
|
|||||||
@@ -208,8 +208,5 @@ public class UserEntity implements Serializable {
|
|||||||
private Integer vipType;
|
private Integer vipType;
|
||||||
|
|
||||||
|
|
||||||
public UserEntity getDesensitizationInfo() {
|
|
||||||
this.setPassword(null);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -915,7 +915,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
|||||||
}
|
}
|
||||||
userInfo.setUpdateTime(DateUtil.date().toString());
|
userInfo.setUpdateTime(DateUtil.date().toString());
|
||||||
baseMapper.updateById(userInfo);
|
baseMapper.updateById(userInfo);
|
||||||
return getResult(userInfo.getDesensitizationInfo());
|
return getResult(userInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -972,7 +972,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
|||||||
if (userEntity != null) {
|
if (userEntity != null) {
|
||||||
inviteService.saveBody(userInfo.getUserId(), userEntity);
|
inviteService.saveBody(userInfo.getUserId(), userEntity);
|
||||||
}
|
}
|
||||||
return getResult(userInfo.getDesensitizationInfo());
|
return getResult(userInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -20,6 +20,6 @@ public interface CourseCollectDao extends BaseMapper<CourseCollect> {
|
|||||||
|
|
||||||
|
|
||||||
List<Course> selectClassify1In3(@Param("userId") Long userId);
|
List<Course> selectClassify1In3(@Param("userId") Long userId);
|
||||||
List<Course> selectClassify1In2(@Param("userId") Long userId);
|
List<Course> selectClassify2(@Param("userId") Long userId);
|
||||||
List<Course> selectClassify1ByUserId(@Param("userId") Long userId);
|
List<Course> selectClassify3ByUserId(@Param("userId") Long userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,28 +140,30 @@ public class CourseCollectServiceImpl extends ServiceImpl<CourseCollectDao, Cour
|
|||||||
public Result selectByUserId(Integer page, Integer limit, Long userId, Integer classify) {
|
public Result selectByUserId(Integer page, Integer limit, Long userId, Integer classify) {
|
||||||
PageHelper.startPage(page, limit);
|
PageHelper.startPage(page, limit);
|
||||||
List<Course> courses = new ArrayList<>();
|
List<Course> courses = new ArrayList<>();
|
||||||
//收藏
|
|
||||||
if (classify.equals(1)) {
|
if (classify.equals(1)) {
|
||||||
//查 收藏记录
|
//收藏记录
|
||||||
courses = baseMapper.selectClassify1In3(userId);
|
courses = baseMapper.selectClassify1In3(userId);
|
||||||
}else if (classify.equals(2)){
|
}else if (classify.equals(2)){
|
||||||
courses = baseMapper.selectClassify1In2(userId);
|
//点赞
|
||||||
|
courses = baseMapper.selectClassify2(userId);
|
||||||
} else {
|
} else {
|
||||||
courses = baseMapper.selectClassify1ByUserId(userId);
|
//观看历史
|
||||||
}
|
courses = baseMapper.selectClassify3ByUserId(userId);
|
||||||
if (CollectionUtil.isEmpty(courses)) {
|
|
||||||
return Result.success().put("data", PageUtils.page(new PageInfo<>(courses), true));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//剧id
|
//剧id
|
||||||
Set<Long> courseIdList = new HashSet<>();
|
Set<Long> courseIdList = new HashSet<>();
|
||||||
//详情id
|
//详情id
|
||||||
Set<Long> courseDetailIds = new HashSet<>();
|
Set<Long> courseDetailIds = new HashSet<>();
|
||||||
|
//剧集-观看记录时间
|
||||||
|
Map<Long,String> upTime = new HashMap<>();
|
||||||
courses.forEach(s -> {
|
courses.forEach(s -> {
|
||||||
if (s == null) {
|
if (s == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
courseIdList.add(s.getCourseId());
|
courseIdList.add(s.getCourseId());
|
||||||
courseDetailIds.add(s.getCourseDetailsId());
|
courseDetailIds.add(s.getCourseDetailsId());
|
||||||
|
upTime.put(s.getCourseId(),s.getUpdateTime());
|
||||||
});
|
});
|
||||||
List<Course> courseList = courseIdList.isEmpty() ? new ArrayList<>() :
|
List<Course> courseList = courseIdList.isEmpty() ? new ArrayList<>() :
|
||||||
courseDao.selectList(new LambdaQueryWrapper<Course>().in(Course::getCourseId, courseIdList));
|
courseDao.selectList(new LambdaQueryWrapper<Course>().in(Course::getCourseId, courseIdList));
|
||||||
@@ -170,21 +172,21 @@ public class CourseCollectServiceImpl extends ServiceImpl<CourseCollectDao, Cour
|
|||||||
courseDetailsService.list(new LambdaQueryWrapper<CourseDetails>().in(CourseDetails::getCourseDetailsId, courseDetailIds));
|
courseDetailsService.list(new LambdaQueryWrapper<CourseDetails>().in(CourseDetails::getCourseDetailsId, courseDetailIds));
|
||||||
Map<Long, CourseDetails> courseDetailsMap = courseDetails1.stream()
|
Map<Long, CourseDetails> courseDetailsMap = courseDetails1.stream()
|
||||||
.collect(Collectors.toMap(CourseDetails::getCourseId, item -> item, (key1, key2) -> key1));
|
.collect(Collectors.toMap(CourseDetails::getCourseId, item -> item, (key1, key2) -> key1));
|
||||||
// List<CourseDetails> courseDetails2 = courseIdList.isEmpty() ? new ArrayList<>() : courseDetailsDao.countByCourseId(courseIdList);
|
|
||||||
// Map<Long, Integer> countMap = courseDetails2.stream()
|
|
||||||
// .collect(Collectors.toMap(CourseDetails::getCourseId, CourseDetails::getCourseDetailsCount));
|
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(courseList)) {
|
if (CollectionUtil.isNotEmpty(courseList)) {
|
||||||
for (Course course : courseList) {
|
for (Course course : courseList) {
|
||||||
// course.setCourseClassification(courseClassificationDao.selectById(course.getClassifyId()));
|
|
||||||
CourseDetails courseDetails = courseDetailsMap.getOrDefault(course.getCourseId(), null);
|
CourseDetails courseDetails = courseDetailsMap.getOrDefault(course.getCourseId(), null);
|
||||||
course.setCourseDetailsCount(courseDetailsDao.countCourseByCourseId(course.getCourseId()));
|
course.setCourseDetailsCount(courseDetailsDao.countCourseByCourseId(course.getCourseId()));
|
||||||
if (courseDetails != null) {
|
if (courseDetails != null) {
|
||||||
course.setCourseDetailsName(courseDetails.getCourseDetailsName());
|
course.setCourseDetailsName(courseDetails.getCourseDetailsName());
|
||||||
course.setCourseDetailsId(courseDetails.getCourseDetailsId());
|
course.setCourseDetailsId(courseDetails.getCourseDetailsId());
|
||||||
}
|
}
|
||||||
|
if (upTime.containsKey(course.getCourseId())) {
|
||||||
|
course.setUpdateTime(upTime.get(course.getCourseId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
courseList.sort(Comparator.comparing(Course::getUpdateTime).reversed());
|
||||||
|
}
|
||||||
PageInfo<Course> pageInfo = new PageInfo<>(courseList);
|
PageInfo<Course> pageInfo = new PageInfo<>(courseList);
|
||||||
return Result.success().put("data", PageUtils.page(pageInfo, true));
|
return Result.success().put("data", PageUtils.page(pageInfo, true));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class WuyouController {
|
|||||||
return Result.error("订单已支付");
|
return Result.error("订单已支付");
|
||||||
}
|
}
|
||||||
if (redisService.setCreateOrderFlagAndCheckLimit(order.getUserId(), orderId)) {
|
if (redisService.setCreateOrderFlagAndCheckLimit(order.getUserId(), orderId)) {
|
||||||
userService.addBlackUser(order.getUserId(), "一分钟频繁下单超12次");
|
userService.addBlackUser(order.getUserId(), "一分钟频繁下单超22次");
|
||||||
}
|
}
|
||||||
|
|
||||||
PayDetails payDetails = payDetailsDao.selectByOrderId(order.getOrdersNo());
|
PayDetails payDetails = payDetailsDao.selectByOrderId(order.getOrdersNo());
|
||||||
|
|||||||
@@ -354,6 +354,6 @@ public class RedisServiceImpl implements RedisService {
|
|||||||
redisTemplate.opsForSet().add(key, orderId.toString());
|
redisTemplate.opsForSet().add(key, orderId.toString());
|
||||||
redisUtils.expire(key, 60);
|
redisUtils.expire(key, 60);
|
||||||
Set<String> members = redisTemplate.opsForSet().members(key);
|
Set<String> members = redisTemplate.opsForSet().members(key);
|
||||||
return members != null && members.size() > 12;
|
return members != null && members.size() > 22;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,34 +33,34 @@
|
|||||||
<select id="selectClassify1In3" resultType="com.sqx.modules.course.entity.Course">
|
<select id="selectClassify1In3" resultType="com.sqx.modules.course.entity.Course">
|
||||||
SELECT
|
SELECT
|
||||||
c1.course_id as courseId,
|
c1.course_id as courseId,
|
||||||
c1.course_details_id as courseDetailsId
|
c1.course_details_id as courseDetailsId,
|
||||||
|
c1.update_time as updateTime
|
||||||
FROM
|
FROM
|
||||||
`course_collect` c1
|
`course_collect` c1
|
||||||
INNER JOIN course_collect c2 ON c1.course_id = c2.course_id AND c2.user_id = #{userId} AND c2.classify = 1
|
INNER JOIN course_collect c2 ON c1.course_id = c2.course_id AND c2.user_id = #{userId} AND c2.classify = 1
|
||||||
WHERE
|
WHERE
|
||||||
c1.classify = 3
|
c1.classify = 3
|
||||||
AND c1.user_id = #{userId}
|
AND c1.user_id = #{userId}
|
||||||
order by c1.update_time desc
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectClassify1In2" resultType="com.sqx.modules.course.entity.Course">
|
<select id="selectClassify2" resultType="com.sqx.modules.course.entity.Course">
|
||||||
SELECT
|
SELECT
|
||||||
c1.course_id as courseId,
|
c1.course_id as courseId,
|
||||||
c1.course_details_id as courseDetailsId
|
c1.course_details_id as courseDetailsId,
|
||||||
|
c1.update_time as updateTime
|
||||||
FROM
|
FROM
|
||||||
`course_collect` c1
|
`course_collect` c1
|
||||||
WHERE
|
WHERE
|
||||||
c1.classify = 2
|
c1.classify = 2
|
||||||
AND c1.user_id = #{userId}
|
AND c1.user_id = #{userId}
|
||||||
order by c1.update_time desc
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectClassify1ByUserId" resultType="com.sqx.modules.course.entity.Course">
|
<select id="selectClassify3ByUserId" resultType="com.sqx.modules.course.entity.Course">
|
||||||
SELECT c1.course_id as courseId,
|
SELECT c1.course_id as courseId,
|
||||||
c1.course_details_id as courseDetailsId
|
c1.course_details_id as courseDetailsId,
|
||||||
|
c1.update_time as updateTime
|
||||||
FROM `course_collect` c1
|
FROM `course_collect` c1
|
||||||
WHERE c1.classify = 3
|
WHERE c1.classify = 3
|
||||||
AND c1.user_id = #{userId}
|
AND c1.user_id = #{userId}
|
||||||
order by c1.update_time desc
|
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user