Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.sqx.common.aspect;
|
||||
|
||||
import com.sqx.common.annotation.Debounce;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.common.utils.SpelUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
@@ -76,7 +77,7 @@ public class DebounceAspect {
|
||||
return joinPoint.proceed();
|
||||
}
|
||||
// 在防抖间隔内,不执行目标方法,直接返回
|
||||
return null;
|
||||
return Result.error("请求频繁,请重试");
|
||||
}
|
||||
|
||||
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 null;
|
||||
return Result.error("请求频繁,请重试");
|
||||
}
|
||||
|
||||
public void cleanExpiredRecords() {
|
||||
|
||||
@@ -208,8 +208,5 @@ public class UserEntity implements Serializable {
|
||||
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());
|
||||
baseMapper.updateById(userInfo);
|
||||
return getResult(userInfo.getDesensitizationInfo());
|
||||
return getResult(userInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -972,7 +972,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
if (userEntity != null) {
|
||||
inviteService.saveBody(userInfo.getUserId(), userEntity);
|
||||
}
|
||||
return getResult(userInfo.getDesensitizationInfo());
|
||||
return getResult(userInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,6 @@ public interface CourseCollectDao extends BaseMapper<CourseCollect> {
|
||||
|
||||
|
||||
List<Course> selectClassify1In3(@Param("userId") Long userId);
|
||||
List<Course> selectClassify1In2(@Param("userId") Long userId);
|
||||
List<Course> selectClassify1ByUserId(@Param("userId") Long userId);
|
||||
List<Course> selectClassify2(@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) {
|
||||
PageHelper.startPage(page, limit);
|
||||
List<Course> courses = new ArrayList<>();
|
||||
//收藏
|
||||
if (classify.equals(1)) {
|
||||
//查 收藏记录
|
||||
//收藏记录
|
||||
courses = baseMapper.selectClassify1In3(userId);
|
||||
}else if (classify.equals(2)){
|
||||
courses = baseMapper.selectClassify1In2(userId);
|
||||
//点赞
|
||||
courses = baseMapper.selectClassify2(userId);
|
||||
} else {
|
||||
courses = baseMapper.selectClassify1ByUserId(userId);
|
||||
}
|
||||
if (CollectionUtil.isEmpty(courses)) {
|
||||
return Result.success().put("data", PageUtils.page(new PageInfo<>(courses), true));
|
||||
//观看历史
|
||||
courses = baseMapper.selectClassify3ByUserId(userId);
|
||||
}
|
||||
|
||||
//剧id
|
||||
Set<Long> courseIdList = new HashSet<>();
|
||||
//详情id
|
||||
Set<Long> courseDetailIds = new HashSet<>();
|
||||
//剧集-观看记录时间
|
||||
Map<Long,String> upTime = new HashMap<>();
|
||||
courses.forEach(s -> {
|
||||
if (s == null) {
|
||||
return;
|
||||
}
|
||||
courseIdList.add(s.getCourseId());
|
||||
courseDetailIds.add(s.getCourseDetailsId());
|
||||
upTime.put(s.getCourseId(),s.getUpdateTime());
|
||||
});
|
||||
List<Course> courseList = courseIdList.isEmpty() ? new ArrayList<>() :
|
||||
courseDao.selectList(new LambdaQueryWrapper<Course>().in(Course::getCourseId, courseIdList));
|
||||
@@ -170,20 +172,20 @@ public class CourseCollectServiceImpl extends ServiceImpl<CourseCollectDao, Cour
|
||||
courseDetailsService.list(new LambdaQueryWrapper<CourseDetails>().in(CourseDetails::getCourseDetailsId, courseDetailIds));
|
||||
Map<Long, CourseDetails> courseDetailsMap = courseDetails1.stream()
|
||||
.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)) {
|
||||
for (Course course : courseList) {
|
||||
// course.setCourseClassification(courseClassificationDao.selectById(course.getClassifyId()));
|
||||
CourseDetails courseDetails = courseDetailsMap.getOrDefault(course.getCourseId(), null);
|
||||
course.setCourseDetailsCount(courseDetailsDao.countCourseByCourseId(course.getCourseId()));
|
||||
if (courseDetails != null) {
|
||||
course.setCourseDetailsName(courseDetails.getCourseDetailsName());
|
||||
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);
|
||||
return Result.success().put("data", PageUtils.page(pageInfo, true));
|
||||
|
||||
@@ -88,7 +88,7 @@ public class WuyouController {
|
||||
return Result.error("订单已支付");
|
||||
}
|
||||
if (redisService.setCreateOrderFlagAndCheckLimit(order.getUserId(), orderId)) {
|
||||
userService.addBlackUser(order.getUserId(), "一分钟频繁下单超12次");
|
||||
userService.addBlackUser(order.getUserId(), "一分钟频繁下单超22次");
|
||||
}
|
||||
|
||||
PayDetails payDetails = payDetailsDao.selectByOrderId(order.getOrdersNo());
|
||||
|
||||
@@ -354,6 +354,6 @@ public class RedisServiceImpl implements RedisService {
|
||||
redisTemplate.opsForSet().add(key, orderId.toString());
|
||||
redisUtils.expire(key, 60);
|
||||
Set<String> members = redisTemplate.opsForSet().members(key);
|
||||
return members != null && members.size() > 12;
|
||||
return members != null && members.size() > 22;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user