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

This commit is contained in:
GYJ
2025-01-06 13:25:13 +08:00
37 changed files with 287 additions and 210 deletions

View File

@@ -10,16 +10,21 @@ import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
/** /**
* 方法调用统一切面处理 * 方法调用统一切面处理
*/ */
@Aspect @Aspect
@Component @Component
@Slf4j @Slf4j
@Profile({"dev"})
public class AppApiMethodAspect { public class AppApiMethodAspect {
@Pointcut("!execution(public * (com.sqx.modules.sys.controller.SysLoginController).*(..)) " + @Pointcut("!execution(public * (com.sqx.modules.sys.controller.SysLoginController).*(..)) " +

View File

@@ -292,6 +292,7 @@ public class UserController {
int dyCount = userService.queryUserCount(type, date, "抖音", qdCode); int dyCount = userService.queryUserCount(type, date, "抖音", qdCode);
int giveMemberCount = userService.userMessage(date, type, qdCode, 1); int giveMemberCount = userService.userMessage(date, type, qdCode, 1);
int moneyMemberCount = userService.userMessage(date, type, qdCode, 2); int moneyMemberCount = userService.userMessage(date, type, qdCode, 2);
// int memberCount = userVipService.userMessage(date, type, qdCode, null);
int memberCount = userService.userMessage(date, type, qdCode, null); int memberCount = userService.userMessage(date, type, qdCode, null);
int userCount = sumUserCount - memberCount; int userCount = sumUserCount - memberCount;
Map<String, Integer> result = new HashMap<>(); Map<String, Integer> result = new HashMap<>();

View File

@@ -113,15 +113,15 @@ public class AppController {
if (count > 0) { if (count > 0) {
errMsg = "支付宝信息修改失败: 一个支付宝账号仅可绑定一个用户"; errMsg = "支付宝信息修改失败: 一个支付宝账号仅可绑定一个用户";
} }
if (StrUtil.isNotBlank(userInfo.getCertName()) && !certName.equals(userInfo.getCertName())) { if (errMsg == null && StrUtil.isNotBlank(userInfo.getCertName()) && !certName.equals(userInfo.getCertName())) {
errMsg = "支付宝信息修改失败: 姓名与实名认证信息不相符"; errMsg = "支付宝信息修改失败: 姓名与实名认证信息不相符";
} }
if (!DataLimitUtil.isAccessAllowed(zhiFuBao+certName, Integer.parseInt(commonRepository.findOne(924).getValue()), "month")) { if (errMsg == null && !DataLimitUtil.isAccessAllowed(zhiFuBao+certName, Integer.parseInt(commonRepository.findOne(924).getValue()), "month")) {
errMsg = "支付宝信息修改失败: 相同支付宝账号每月可绑定次数已用完"; errMsg = "支付宝信息修改失败: 相同支付宝账号每月可绑定次数已用完";
} }
if (!ApiAccessLimitUtil.isAccessAllowed(userId.toString(), "updateZFB", Integer.parseInt(commonRepository.findOne(925).getValue()), "month")) { if (errMsg == null && !ApiAccessLimitUtil.isAccessAllowed(userId.toString(), "updateZFB", Integer.parseInt(commonRepository.findOne(925).getValue()), "month")) {
errMsg = "支付宝信息修改失败: 每月可修改次数已用完,请联系管理员"; errMsg = "支付宝信息修改失败: 每月可修改次数已用完,请联系管理员";
} }
@@ -133,42 +133,48 @@ public class AppController {
} }
String authErrMsg = null;
if (StrUtil.isNotBlank(certNum) && !certNum.equals(userInfo.getCertNo())) { if (StrUtil.isNotBlank(certNum) && !certNum.equals(userInfo.getCertNo())) {
if (StrUtil.isNotBlank(userEntity.getZhiFuBaoName()) && !certName.equals(userEntity.getZhiFuBaoName())) { if (StrUtil.isNotBlank(userEntity.getZhiFuBaoName()) && !certName.equals(userEntity.getZhiFuBaoName())) {
errMsg = "实名修改失败: 姓名与绑定支付宝信息不相符"; authErrMsg = "实名修改失败: 姓名与绑定支付宝信息不相符";
} }
if (!IdcardUtil.isValidCard(certNum)) { if (authErrMsg == null && !IdcardUtil.isValidCard(certNum)) {
errMsg = "实名修改失败: 身份证号码有误"; authErrMsg = "实名修改失败: 身份证号码有误";
} }
Integer idCount = userInfoService.countCertCount(certName, certNum); if (authErrMsg == null) {
if (idCount > 1) { Integer idCount = userInfoService.countCertCount(certName, certNum);
errMsg = "实名修改失败: 此实名信息已存在"; if (idCount > 1) {
authErrMsg = "实名修改失败: 此实名信息已存在";
}
} }
if (!ApiAccessLimitUtil.isAccessAllowed(String.valueOf(userId), "updateAuthCertInfo", 1, "month")) { if (authErrMsg == null && !ApiAccessLimitUtil.isAccessAllowed(String.valueOf(userId), "updateAuthCertInfo", 1, "month")) {
errMsg = "实名修改失败: 每月可修改次数已用完,请联系管理员"; authErrMsg = "实名修改失败: 账号每月可修改次数已用完,请联系管理员";
} }
try { if (authErrMsg == null && !ApiAccessLimitUtil.isAccessAllowed(certName, "updateAuthCertInfoByIdCard", 1, "month")) {
aliService.authCertNo(certName, certNum); authErrMsg = "实名修改失败: 此身份证信息次月已绑定过,请联系管理员";
}catch (Exception e) {
ApiAccessLimitUtil.removeKey(String.valueOf(userId), "updateAuthCertInfo");
errMsg = "实名修改失败: 身份证信息不匹配";
} }
if (errMsg != null && errMsg.contains("实名修改失败")) { if (authErrMsg == null) {
return Result.error(errMsg); try {
aliService.authCertNo(certName, certNum);
userInfo.setCertName(certName);
userInfo.setCertNo(certNum);
userInfo.setUpdateTime(DateUtil.date());
userInfoService.update(userInfo, new LambdaQueryWrapper<UserInfo>().eq(UserInfo::getUserId, userId));
}catch (Exception e) {
ApiAccessLimitUtil.removeKey(String.valueOf(userId), "updateAuthCertInfo");
ApiAccessLimitUtil.removeKey(certName, "updateAuthCertInfoByIdCard");
authErrMsg = "实名修改失败: 身份证信息不匹配";
}
} }
userInfo.setCertName(certName);
userInfo.setCertNo(certNum);
userInfo.setUpdateTime(DateUtil.date());
userInfoService.update(userInfo, new LambdaQueryWrapper<UserInfo>().eq(UserInfo::getUserId, userId));
} }
if (errMsg != null) { if (errMsg != null || authErrMsg != null) {
return Result.error(errMsg); authErrMsg = authErrMsg == null ? "" : authErrMsg;
return Result.error(errMsg == null ? authErrMsg : errMsg + " " + authErrMsg);
} }
return Result.success(); return Result.success();
// 去除首绑支付宝奖励 // 去除首绑支付宝奖励

View File

@@ -4,16 +4,15 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import java.io.Serializable;
import java.util.Date;
/** /**
* *
* @TableName invite_achievement * @TableName invite_achievement
@@ -26,7 +25,7 @@ public class InviteAchievement implements Serializable {
/** /**
* *
*/ */
@TableId @TableId(type = IdType.ID_WORKER)
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long id; private Long id;

View File

@@ -30,7 +30,7 @@ public class UserEntity implements Serializable {
*/ */
@Excel(name = "用户id", orderNum = "1") @Excel(name = "用户id", orderNum = "1")
@ApiModelProperty("用户id") @ApiModelProperty("用户id")
@TableId(value = "user_id") @TableId(type = IdType.ID_WORKER)
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long userId; private Long userId;
/** /**

View File

@@ -1,10 +1,10 @@
package com.sqx.modules.app.entity; package com.sqx.modules.app.entity;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import lombok.Data;
/** /**
* *
@@ -16,7 +16,7 @@ public class UserInfo implements Serializable {
/** /**
* *
*/ */
@TableId @TableId(type = IdType.ID_WORKER)
private Long id; private Long id;
/** /**

View File

@@ -25,7 +25,7 @@ public class UserMoney implements Serializable {
* 主键id * 主键id
*/ */
@ApiModelProperty("主键id") @ApiModelProperty("主键id")
@TableId @TableId(type = IdType.ID_WORKER)
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long id; private Long id;

View File

@@ -1,8 +1,7 @@
package com.sqx.modules.app.entity; package com.sqx.modules.app.entity;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
//import com.amazonaws.services.dynamodbv2.xspec.L; import com.baomidou.mybatisplus.annotation.IdType;
//import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
@@ -12,7 +11,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
//import lombok.NoArgsConstructor;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
@@ -26,7 +24,7 @@ public class UserMoneyDetails implements Serializable {
* 钱包详情id * 钱包详情id
*/ */
@ApiModelProperty("钱包详情id") @ApiModelProperty("钱包详情id")
@TableId @TableId(type = IdType.ID_WORKER)
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long id; private Long id;
/** /**

View File

@@ -44,6 +44,7 @@ import com.sqx.common.utils.Result;
import com.sqx.modules.app.dao.AuthCertNoDTO; import com.sqx.modules.app.dao.AuthCertNoDTO;
import com.sqx.modules.app.dao.MsgDao; import com.sqx.modules.app.dao.MsgDao;
import com.sqx.modules.app.dao.UserDao; import com.sqx.modules.app.dao.UserDao;
import com.sqx.modules.app.dao.UserVipDao;
import com.sqx.modules.app.entity.*; import com.sqx.modules.app.entity.*;
import com.sqx.modules.app.service.*; import com.sqx.modules.app.service.*;
import com.sqx.modules.app.utils.JwtUtils; import com.sqx.modules.app.utils.JwtUtils;
@@ -82,11 +83,9 @@ import weixin.popular.util.JsonUtil;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.stream.Collectors;
/** /**
* 用户 * 用户
@@ -124,15 +123,17 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
private SysUserService sysUserService; private SysUserService sysUserService;
private final AliService aliService; private final AliService aliService;
private final UserInfoService userInfoService; private final UserInfoService userInfoService;
private final UserVipDao userVipDao;
@Value("${spring.profiles.active}") @Value("${spring.profiles.active}")
private String profiles; private String profiles;
private ReentrantReadWriteLock reentrantReadWriteLock = new ReentrantReadWriteLock(true); private ReentrantReadWriteLock reentrantReadWriteLock = new ReentrantReadWriteLock(true);
public UserServiceImpl(@Lazy AliService aliService, UserInfoService userInfoService) { public UserServiceImpl(@Lazy AliService aliService, UserInfoService userInfoService, UserVipDao userVipDao) {
this.aliService = aliService; this.aliService = aliService;
this.userInfoService = userInfoService; this.userInfoService = userInfoService;
this.userVipDao = userVipDao;
} }
@Override @Override
@@ -1419,7 +1420,34 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
@Override @Override
public int userMessage(String date, int type, String qdCode, Integer vipType) { public int userMessage(String date, int type, String qdCode, Integer vipType) {
return baseMapper.userMessage(date, type, qdCode, vipType); DateTime dateTime;
if (type == 0) {
dateTime = DateUtil.beginOfDay(DateUtil.parseDate(date));
}else if (type == 1) {
dateTime = DateUtil.beginOfMonth(DateUtil.parseDate(date));
}else {
dateTime = DateUtil.beginOfYear(DateUtil.parseDate(date));
}
LambdaQueryWrapper<UserEntity> queryWrapper = new LambdaQueryWrapper<UserEntity>()
.ge(UserEntity::getCreateTime, dateTime);
if (StrUtil.isNotBlank(qdCode)) {
queryWrapper.eq(UserEntity::getQdCode, qdCode);
}
Set<Long> useridList = baseMapper.selectList(queryWrapper.select(UserEntity::getUserId))
.stream().map(UserEntity::getUserId).collect(Collectors.toSet());
if (useridList.isEmpty()) {
return 0;
}
LambdaQueryWrapper<UserVip> vipLambdaQueryWrapper = new LambdaQueryWrapper<UserVip>().in(UserVip::getUserId, useridList)
.eq(UserVip::getIsVip, 2);
if (vipType != null) {
vipLambdaQueryWrapper.eq(UserVip::getVipType, vipType);
}
return userVipDao.selectCount(vipLambdaQueryWrapper);
} }

View File

@@ -48,18 +48,10 @@ public class AppCourseController extends AbstractController {
@Login @Login
@GetMapping("/courseSets") @GetMapping("/courseSets")
@ApiOperation("根据id查询短剧集数列表") @ApiOperation("根据id查询短剧集数列表")
public Result courseSets(@RequestAttribute("userId") Long userId, Long courseId) { public Result courseSets(@RequestAttribute("userId") Long userId, Long courseId, Integer sort) {
return courseDetailsService.courseSets(userId, courseId); return courseDetailsService.courseSets(userId, courseId,sort);
} }
@Login
@GetMapping("/courseDetails")
@ApiOperation("查询短剧 内容")
public Result courseDetails(@RequestAttribute("userId") Long userId, Long courseId, Integer sort) {
return courseDetailsService.courseDetails(userId, courseId, sort);
}
@Login @Login
@GetMapping("/selectCourseDetailsById") @GetMapping("/selectCourseDetailsById")
@ApiOperation("根据id查询短剧详情") @ApiOperation("根据id查询短剧详情")

View File

@@ -23,10 +23,7 @@ public interface CourseDetailsDao extends BaseMapper<CourseDetails> {
* @param wholesalePrice 10集价格 * @param wholesalePrice 10集价格
*/ */
@Cacheable(cacheNames = "courseSets" ,key = "#courseId") @Cacheable(cacheNames = "courseSets" ,key = "#courseId")
List<CourseDetailsSetVo> courseSets(@Param("courseId") Long courseId, Integer isPrice, BigDecimal price, BigDecimal wholesalePrice); List<CourseDetailsSetVo> courseSets(@Param("courseId") Long courseId, @Param("collect") Long collect, Integer isPrice, BigDecimal price, BigDecimal wholesalePrice);
List<CourseDetailsVo> courseDetails(@Param("courseId") Long courseId, @Param("collect") Long collect,
@Param("starSort") Integer starSort, @Param("endSort") Integer endSort);
List<CourseDetails> findByCourseId(@Param("id") Long id, @Param("userId") Long userId); List<CourseDetails> findByCourseId(@Param("id") Long id, @Param("userId") Long userId);

View File

@@ -27,7 +27,7 @@ public class Course implements Serializable {
/** /**
* 短剧id * 短剧id
*/ */
@TableId @TableId(type = IdType.ID_WORKER)
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long courseId; private Long courseId;

View File

@@ -5,8 +5,6 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import java.io.Serializable; import java.io.Serializable;
@@ -26,7 +24,7 @@ public class CourseCollect implements Serializable {
/** /**
* 收藏id * 收藏id
*/ */
@TableId @TableId(type = IdType.ID_WORKER)
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long courseCollectId; private Long courseCollectId;

View File

@@ -23,7 +23,7 @@ public class CourseDetails implements Serializable {
/** /**
* 短剧目录id * 短剧目录id
*/ */
@TableId @TableId(type = IdType.ID_WORKER)
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long courseDetailsId; private Long courseDetailsId;

View File

@@ -22,7 +22,7 @@ public class CourseUser implements Serializable {
/** /**
* 我的短剧id * 我的短剧id
*/ */
@TableId @TableId(type = IdType.ID_WORKER)
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long courseUserId; private Long courseUserId;

View File

@@ -20,9 +20,8 @@ public interface CourseDetailsService extends IService<CourseDetails> {
* @param courseId * @param courseId
* @return * @return
*/ */
Result courseSets(Long userId, Long courseId); Result courseSets(Long userId, Long courseId, Integer sort);
Result courseDetails(Long userId, Long courseId, Integer sort);
Result selectCourseDetailsById(Long id,String token,String courseDetailsId); Result selectCourseDetailsById(Long id,String token,String courseDetailsId);

View File

@@ -34,7 +34,6 @@ import com.sqx.modules.course.entity.CourseUser;
import com.sqx.modules.course.service.CourseDetailsService; import com.sqx.modules.course.service.CourseDetailsService;
import com.sqx.modules.course.vo.CourseDetailsIn; import com.sqx.modules.course.vo.CourseDetailsIn;
import com.sqx.modules.course.vo.CourseDetailsSetVo; import com.sqx.modules.course.vo.CourseDetailsSetVo;
import com.sqx.modules.course.vo.CourseDetailsVo;
import com.sqx.modules.orders.dao.OrdersDao; import com.sqx.modules.orders.dao.OrdersDao;
import com.sqx.modules.orders.service.OrdersService; import com.sqx.modules.orders.service.OrdersService;
import com.sqx.modules.redisService.impl.RedisServiceImpl; import com.sqx.modules.redisService.impl.RedisServiceImpl;
@@ -53,7 +52,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.concurrent.atomic.AtomicReference;
@Service @Service
@Slf4j @Slf4j
@@ -146,7 +145,7 @@ public class CourseDetailsServiceImpl extends ServiceImpl<CourseDetailsDao, Cour
} else { } else {
course.setViewCounts(course.getViewCounts() + 1); course.setViewCounts(course.getViewCounts() + 1);
} }
if (ApiAccessLimitUtil.isAccessAllowed("setCourseView:" + course.getCourseId(), "updateAuthCertInfo", 1, 600)) { if (ApiAccessLimitUtil.isAccessAllowed(course.getCourseId().toString(), "updateWeekCourseView", 1, 600)) {
int courseViewCount = redisServiceImpl.getCourseWeekViewCount(course.getCourseId()); int courseViewCount = redisServiceImpl.getCourseWeekViewCount(course.getCourseId());
course.setWeekView(courseViewCount); course.setWeekView(courseViewCount);
} }
@@ -154,104 +153,80 @@ public class CourseDetailsServiceImpl extends ServiceImpl<CourseDetailsDao, Cour
} }
@Override @Override
public Result courseSets(Long userId, Long courseId) { public Result courseSets(Long userId, Long courseId, Integer sort) {
CourseCollect courseCollect = courseCollectDao.selectOne(new QueryWrapper<CourseCollect>().eq("course_id", courseId) //观看记录
.eq("user_id", userId).eq("classify", 3).last("limit 1")); CourseCollect courseCollect = courseCollectDao.selectOne(new QueryWrapper<CourseCollect>()
.eq("course_id", courseId).eq("user_id", userId)
.eq("classify", 3).last("limit 1"));
//是否追剧
Integer collect = courseCollectDao.selectCount(new QueryWrapper<CourseCollect>()
.eq("user_id", userId).eq("course_id", courseId)
.eq("classify", 1).last("limit 1"));
Course bean = courseDao.selectById(courseId); Course bean = courseDao.selectById(courseId);
//查询用户是否购买了整集 //查询用户是否购买了整集
CourseUser courseUser = courseUserDao.selectCourseUser(courseId, userId); CourseUser courseUser = courseUserDao.selectCourseUser(courseId, userId);
// 每天购买超过上限,获得免费时间段资格 // 每天购买超过上限,获得免费时间段资格
boolean freeWatch = checkFreeWatchPayCount(userId); boolean freeWatch = checkFreeWatchPayCount(userId);
List<CourseDetailsSetVo> courseDetailsSetVos;
if (freeWatch || courseUser != null) {
courseDetailsSetVos = baseMapper.courseSets(courseId, 2, null, null);
} else {
// courseDetailsSetVos = baseMapper.courseSets(courseId, 1, bean.getPrice(), bean.getWholesalePrice());
courseDetailsSetVos = baseMapper.courseSets(courseId, 2, bean.getPrice(), bean.getWholesalePrice());
//查询用户是否单独购买了集
Set<Long> detailsId = courseUserDao.selectUserCourseDetailsId(courseId, userId);
if (courseCollect != null) {
for (CourseDetailsSetVo s : courseDetailsSetVos) {
if (s.getCourseDetailsId().equals(courseCollect.getCourseDetailsId())) {
s.setCurrent(1);
break;
}
}
} else {
courseDetailsSetVos.get(0).setCurrent(1);
}
if (CollectionUtil.isNotEmpty(detailsId)) {
courseDetailsSetVos = courseDetailsSetVos.stream()
.peek(s -> {
if (detailsId.contains(s.getCourseDetailsId())) {
s.setIsPrice(2);
}
})
.collect(Collectors.toList());
}
}
Map<String, Object> map = new HashMap<>();
map.put("title", bean.getTitle());
map.put("list", courseDetailsSetVos);
return new Result().put("data", map);
}
@Override
public Result courseDetails(Long userId, Long courseId, Integer sort) {
Course bean = courseDao.selectById(courseId);
Integer detailCount = baseMapper.countCourseByCourseId(courseId);
if (detailCount == null || detailCount.equals(0)) {
return Result.error("暂无可看剧集,请观看其它影片。");
}
int startSort = 0; int startSort = 0;
int endSort = 5; int endSort = 5;
if (sort == null) { if (sort == null) {
CourseCollect courseCollect = courseCollectDao.selectOne(new QueryWrapper<CourseCollect>().eq("course_id", courseId)
.eq("user_id", userId).eq("classify", 3).last("limit 1"));
if (courseCollect != null) { if (courseCollect != null) {
CourseDetails courseDetails = baseMapper.selectOne(new QueryWrapper<CourseDetails>() CourseDetails courseDetails = baseMapper.selectOne(new QueryWrapper<CourseDetails>()
.eq("course_details_id", courseCollect.getCourseDetailsId()).eq("course_id", courseCollect.getCourseId()).last("limit 1")); .eq("course_details_id", courseCollect.getCourseDetailsId()).eq("course_id", courseCollect.getCourseId()).last("limit 1"));
sort = courseDetails.getSort(); sort = courseDetails.getSort();
} }
} }
List<CourseDetailsSetVo> courseDetailsSetVos;
if (freeWatch || courseUser != null) {
courseDetailsSetVos = baseMapper.courseSets(courseId, collect == null ? 0L : 1L, 2, null, null);
} else {
courseDetailsSetVos = baseMapper.courseSets(courseId, collect == null ? 0L : 1L, 1, bean.getPrice(), bean.getWholesalePrice());
}
if (sort != null && sort > 2) { if (sort != null && sort > 2) {
startSort = sort - 3; startSort = sort - 3;
endSort = sort + 3; endSort = sort + 3;
if (detailCount < endSort) { if (courseDetailsSetVos.size() < endSort) {
startSort = detailCount - 5; startSort = courseDetailsSetVos.size() - 5;
endSort = detailCount + 1; endSort = courseDetailsSetVos.size() + 1;
} }
} }
//查询用户是否购买了整 //已购买剧
CourseUser courseUser = courseUserDao.selectCourseUser(courseId, userId);
boolean freeWatch = true;
if (courseUser == null) {
// 每天购买超过上限,获得免费时间段资格
freeWatch = checkFreeWatchPayCount(userId);
}
Integer collect = courseCollectDao.selectCount(new QueryWrapper<CourseCollect>()
.eq("user_id", userId).eq("course_id", courseId)
.eq("classify", 1).last("limit 1"));
Set<Long> detailsId = new HashSet<>(); Set<Long> detailsId = new HashSet<>();
//全剧免费
if ((!freeWatch)) { if ((!freeWatch)) {
detailsId = courseUserDao.selectUserCourseDetailsId(courseId, userId); detailsId = courseUserDao.selectUserCourseDetailsId(courseId, userId);
} }
List<CourseDetailsVo> courseDetailsVos = baseMapper.courseDetails(courseId, collect == null ? 0L : 1L, startSort, endSort); AtomicReference<CourseDetailsSetVo> current = new AtomicReference<>(new CourseDetailsSetVo());
Set<Long> finalDetailsId = detailsId; Set<Long> finalDetailsId = detailsId;
courseDetailsVos.stream().forEach(s -> { int finalStartSort = startSort;
int finalEndSort = endSort;
courseDetailsSetVos.parallelStream().forEach(s -> {
//当前
if (courseCollect != null && s.getCourseDetailsId().equals(courseCollect.getCourseDetailsId())) {
s.setCurrent(1);
current.set(s);
}
// 不免费 3集以后 (已买的不为空 并不在已买的包含) // 不免费 3集以后 (已买的不为空 并不在已买的包含)
// if (!freeWatch && s.getSort() > 3 && (CollectionUtil.isEmpty(finalDetailsId) || !finalDetailsId.contains(s.getCourseDetailsId()))) { if (!freeWatch && s.getSort() > 3 && (CollectionUtil.isEmpty(finalDetailsId) || !finalDetailsId.contains(s.getCourseDetailsId()))) {
// s.setVideoUrl(null); s.setVideoUrl(null);
// } }
CourseCollect isGood = courseCollectDao.selectOne(new QueryWrapper<CourseCollect>() if (s.getSort() > finalStartSort && s.getSort() < finalEndSort) {
.eq("user_id", userId).eq("course_details_id", s.getCourseDetailsId()).eq("classify", 2).last("limit 1")); CourseCollect isGood = courseCollectDao.selectOne(new QueryWrapper<CourseCollect>()
s.setIsGood(isGood == null ? 0 : 1); .eq("user_id", userId).eq("course_details_id", s.getCourseDetailsId()).eq("classify", 2).last("limit 1"));
s.setIsGood(isGood == null ? 0 : 1);
}
}); });
if (courseCollect == null) {
courseDetailsSetVos.get(0).setCurrent(1);
current.set(courseDetailsSetVos.get(0));
}
ThreadUtil.execAsync(() -> { ThreadUtil.execAsync(() -> {
setCourseView(bean); setCourseView(bean);
}); });
return new Result().put("data", courseDetailsVos); Map<String, Object> map = new HashMap<>();
map.put("current", current.get());
map.put("title", bean.getTitle());
map.put("list", courseDetailsSetVos);
return new Result().put("data", map);
} }
@Override @Override

View File

@@ -15,4 +15,25 @@ public class CourseDetailsSetVo {
private BigDecimal wholesalePrice; private BigDecimal wholesalePrice;
private BigDecimal countPrice; private BigDecimal countPrice;
private Integer sort; private Integer sort;
/**
* 封面图
*/
private String titleImg;
/**
* 视频地址
*/
private String videoUrl;
/**
* 点赞数
*/
private Integer goodNum;
/**
* 是否已追
*/
private Long isCollect;
/**
* 是否点赞
*/
private Integer isGood;
} }

View File

@@ -1,8 +1,6 @@
package com.sqx.modules.discSpinning.entity; package com.sqx.modules.discSpinning.entity;
import com.baomidou.mybatisplus.annotation.FieldStrategy; import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model; import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
@@ -20,6 +18,7 @@ import java.math.BigDecimal;
@TableName("disc_spinning_record") @TableName("disc_spinning_record")
public class DiscSpinningRecord extends Model<DiscSpinningRecord> { public class DiscSpinningRecord extends Model<DiscSpinningRecord> {
//主键 //主键
@TableId(type = IdType.ID_WORKER)
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long id; private Long id;
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)

View File

@@ -1,5 +1,7 @@
package com.sqx.modules.invite.entity; package com.sqx.modules.invite.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data; import lombok.Data;
@@ -18,6 +20,7 @@ public class InviteMoney implements Serializable {
/** /**
* 邀请收益钱包id * 邀请收益钱包id
*/ */
@TableId(type = IdType.ID_WORKER)
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long id; private Long id;

View File

@@ -204,7 +204,7 @@ public class InviteServiceImpl extends ServiceImpl<InviteDao, Invite> implements
// 金币 // 金币
int money = Integer.parseInt(commonInfoService.findOne(911).getValue()); int money = Integer.parseInt(commonInfoService.findOne(911).getValue());
if (money > 0 && userEntity.getUserId() != 1) { if (money > 0 && userEntity.getUserId() != 1) {
userMoneyService.updateMoney(1, userEntity.getUserId(), money); // userMoneyService.updateMoney(1, userEntity.getUserId(), money);
UserMoneyDetails userMoneyDetails = new UserMoneyDetails(); UserMoneyDetails userMoneyDetails = new UserMoneyDetails();
userMoneyDetails.setUserId(userEntity.getUserId()); userMoneyDetails.setUserId(userEntity.getUserId());
userMoneyDetails.setType(1); userMoneyDetails.setType(1);
@@ -220,8 +220,9 @@ public class InviteServiceImpl extends ServiceImpl<InviteDao, Invite> implements
// 更新邀请人钱包 // 更新邀请人钱包
UserMoney userMoney = userMoneyService.selectUserMoneyByUserId(userEntity.getUserId()); UserMoney userMoney = userMoneyService.selectUserMoneyByUserId(userEntity.getUserId());
userMoney.setMoney(userMoney.getMoney() == null ? BigDecimal.valueOf(money) : userMoney.getMoney().add(BigDecimal.valueOf(money)));
userMoney.setInviteIncomeCoin(userMoney.getInviteIncomeCoin() == null ? new BigDecimal(money) : userMoney.getInviteIncomeCoin().add(new BigDecimal(money))); userMoney.setInviteIncomeCoin(userMoney.getInviteIncomeCoin() == null ? new BigDecimal(money) : userMoney.getInviteIncomeCoin().add(new BigDecimal(money)));
userMoneyService.update(userMoney, new LambdaQueryWrapper<UserMoney>().eq(UserMoney::getUserId, userMoney.getUserId()).eq(UserMoney::getId, userMoney.getId())); userMoneyService.update(null, new LambdaQueryWrapper<UserMoney>().eq(UserMoney::getUserId, userMoney.getUserId()).eq(UserMoney::getId, userMoney.getId()));
} }
//助力活动 //助力活动

View File

@@ -134,10 +134,10 @@ public class OrdersController extends AbstractController {
//日 //日
Double dayMoney = ordersService.selectOrdersMoney(1, 1, 1, dateTime, courseId, sysUserId); Double dayMoney = ordersService.selectOrdersMoney(1, 1, 1, dateTime, courseId, sysUserId);
Map<String, Double> result = new HashMap<>(); Map<String, Double> result = new HashMap<>();
result.put("sumMoney", sumMoney); result.put("sumMoney", sumMoney == null ? 0 : sumMoney);
result.put("yearMoney", yearMoney); result.put("yearMoney", yearMoney == null ? 0 : yearMoney);
result.put("monthMoney", monthMoney); result.put("monthMoney", monthMoney == null ? 0 : monthMoney);
result.put("dayMoney", dayMoney); result.put("dayMoney", dayMoney == null ? 0 : dayMoney);
return Result.success().put("data", result); return Result.success().put("data", result);
} }
@@ -151,12 +151,12 @@ public class OrdersController extends AbstractController {
//渠道 //渠道
Double qdMoney = ordersService.selectFenXiaoMoney(3, sysUserId, flag, time); Double qdMoney = ordersService.selectFenXiaoMoney(3, sysUserId, flag, time);
//总分销 //总分销
Double sumMoney = ordersService.selectFenXiaoMoney(4, sysUserId, flag, time); // Double sumMoney = ordersService.selectFenXiaoMoney(4, sysUserId, flag, time);
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result.put("oneMoney", oneMoney); result.put("oneMoney", oneMoney);
result.put("twoMoney", twoMoney); result.put("twoMoney", twoMoney);
result.put("qdMoney", qdMoney); result.put("qdMoney", qdMoney);
result.put("sumMoney", sumMoney); result.put("sumMoney", oneMoney + twoMoney + qdMoney);
return Result.success().put("data", result); return Result.success().put("data", result);
} }

View File

@@ -23,7 +23,7 @@ public class Orders implements Serializable {
/** /**
* 订单id * 订单id
*/ */
@TableId @TableId(type = IdType.ID_WORKER)
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long ordersId; private Long ordersId;

View File

@@ -9,6 +9,7 @@ import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* @author fang * @author fang
@@ -46,4 +47,6 @@ public interface CashOutDao extends BaseMapper<CashOut> {
BigDecimal selectSumMoney(@Param("userId") Long userId, @Param("state") Integer state); BigDecimal selectSumMoney(@Param("userId") Long userId, @Param("state") Integer state);
List<CashOut> selectSumByUserIdList(ArrayList<Long> userIdList, Integer state); List<CashOut> selectSumByUserIdList(ArrayList<Long> userIdList, Integer state);
List<CashOut> countByUserIdList(Set<Long> userIdList);
} }

View File

@@ -25,7 +25,7 @@ public class CashOut implements Serializable {
/** /**
* 申请提现id * 申请提现id
*/ */
@TableId(type = IdType.INPUT) @TableId(type = IdType.ID_WORKER)
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private long id; private long id;

View File

@@ -24,7 +24,7 @@ public class PayDetails implements Serializable {
/** /**
* 充值记录id * 充值记录id
*/ */
@TableId(type = IdType.INPUT) @TableId(type = IdType.ID_WORKER)
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long id; private Long id;

View File

@@ -118,7 +118,7 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
} }
PageHelper.startPage(page, limit); PageHelper.startPage(page, limit);
List<CashOut> cashOutList = list(queryWrapper); List<CashOut> cashOutList = list(queryWrapper.orderByDesc(CashOut::getId));
if (!isApp) { if (!isApp) {
ArrayList<Long> userIdList = new ArrayList<>(); ArrayList<Long> userIdList = new ArrayList<>();
@@ -594,7 +594,56 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
public PageUtils auditPage(Map<String, Object> params) { public PageUtils auditPage(Map<String, Object> params) {
PageHelper.startPage(ParamPageUtils.getPageNum(params), ParamPageUtils.getPageSize(params)); PageHelper.startPage(ParamPageUtils.getPageNum(params), ParamPageUtils.getPageSize(params));
CashOut cashOut = BeanUtil.toBean(params, CashOut.class); CashOut cashOut = BeanUtil.toBean(params, CashOut.class);
List<CashOut> page = baseMapper.selectCashOutPage(cashOut, false);
LambdaQueryWrapper<CashOut> queryWrapper = new LambdaQueryWrapper<>();
if (cashOut.getUserId() != null) {
queryWrapper.eq(CashOut::getUserId, cashOut.getUserId());
}
if (StrUtil.isNotBlank(cashOut.getUserName())) {
queryWrapper.like(CashOut::getUserName, cashOut.getUserName());
}
if (StrUtil.isNotBlank(cashOut.getZhifubaoName())) {
queryWrapper.like(CashOut::getZhifubaoName, cashOut.getZhifubaoName());
}
if (StrUtil.isNotBlank(cashOut.getZhifubao())) {
queryWrapper.like(CashOut::getZhifubao, cashOut.getZhifubao());
}
if (cashOut.getUserType() != null) {
queryWrapper.eq(CashOut::getUserType, cashOut.getUserType());
}
if (cashOut.getState() != null) {
queryWrapper.eq(CashOut::getState, cashOut.getState());
}
if (StrUtil.isNotBlank(cashOut.getStartTime()) && StrUtil.isNotBlank(cashOut.getEndTime())) {
queryWrapper.between(CashOut::getCreateAt, cashOut.getStartTime(), cashOut.getEndTime());
}else if (StrUtil.isNotBlank(cashOut.getStartTime())) {
queryWrapper.ge(CashOut::getCreateAt, cashOut.getStartTime());
}else if (StrUtil.isNotBlank(cashOut.getEndTime())) {
queryWrapper.le(CashOut::getCreateAt, cashOut.getEndTime());
}
List<CashOut> page;
if (queryWrapper.isEmptyOfWhere()) {
page = list();
}else {
page = list(queryWrapper);
}
if (!page.isEmpty()) {
Set<Long> userIdList = page.stream().map(CashOut::getUserId).collect(Collectors.toSet());
Map<Long, CashOut> countInfoMap = cashOutDao.countByUserIdList(userIdList).stream().collect(Collectors.toMap(CashOut::getUserId, item -> item));
page.forEach(item -> {
CashOut countInfo = countInfoMap.get(item.getUserId());
if (countInfo != null) {
item.setTotal(countInfo.getTotal());
item.setCount(countInfo.getCount());
item.setVerifyCount(countInfo.getVerifyCount());
item.setVerifyTotal(countInfo.getVerifyTotal());
}
});
}
PageInfo<CashOut> pageInfo = new PageInfo<>(page); PageInfo<CashOut> pageInfo = new PageInfo<>(page);
return PageUtils.page(pageInfo); return PageUtils.page(pageInfo);
} }

View File

@@ -1,9 +1,6 @@
package com.sqx.modules.sys.entity; package com.sqx.modules.sys.entity;
import com.baomidou.mybatisplus.annotation.FieldStrategy; import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.sqx.common.validator.group.AddGroup; import com.sqx.common.validator.group.AddGroup;
@@ -29,7 +26,7 @@ public class SysUserEntity implements Serializable {
/** /**
* 用户ID * 用户ID
*/ */
@TableId @TableId(type = IdType.ID_WORKER)
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long userId; private Long userId;

View File

@@ -1,5 +1,7 @@
package com.sqx.modules.taskCenter.entity; package com.sqx.modules.taskCenter.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model; import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@@ -16,6 +18,7 @@ import lombok.Data;
@TableName("task_center_record") @TableName("task_center_record")
@ApiModel(value = "任务领取记录 实体类") @ApiModel(value = "任务领取记录 实体类")
public class TaskCenterRecord extends Model<TaskCenterRecord> { public class TaskCenterRecord extends Model<TaskCenterRecord> {
@TableId(type = IdType.ID_WORKER)
@ApiModelProperty(value = "id",hidden = true) @ApiModelProperty(value = "id",hidden = true)
private Long id; private Long id;
@ApiModelProperty(value = "用户id",hidden = true) @ApiModelProperty(value = "用户id",hidden = true)

View File

@@ -1,15 +1,15 @@
package com.sqx.modules.userSign.entity; package com.sqx.modules.userSign.entity;
import java.util.Date; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.Date;
/** /**
* 用户签到表(UserSignRecord)表实体类 * 用户签到表(UserSignRecord)表实体类
* *
@@ -20,6 +20,7 @@ import lombok.Data;
@TableName("user_sign_record") @TableName("user_sign_record")
@ApiModel(value = "用户签到表 实体类") @ApiModel(value = "用户签到表 实体类")
public class UserSignRecord extends Model<UserSignRecord> { public class UserSignRecord extends Model<UserSignRecord> {
@TableId(type = IdType.ID_WORKER)
@ApiModelProperty("id") @ApiModelProperty("id")
private Long id; private Long id;
@ApiModelProperty("用户id") @ApiModelProperty("用户id")

View File

@@ -22,7 +22,7 @@ spring:
# sharding-jdbc 配置 # sharding-jdbc 配置
shardingsphere: shardingsphere:
# 显示sharding-jdbc改写的sql语句 # 显示sharding-jdbc改写的sql语句
show-sql: true show-sql: false
center-tables-data-node: duanju.%s center-tables-data-node: duanju.%s
# 区域表的数据源节点 # 区域表的数据源节点

View File

@@ -22,7 +22,7 @@ spring:
# sharding-jdbc 配置 # sharding-jdbc 配置
shardingsphere: shardingsphere:
# 显示sharding-jdbc改写的sql语句 # 显示sharding-jdbc改写的sql语句
show-sql: true show-sql: false
center-tables-data-node: duanju.%s center-tables-data-node: duanju.%s
# 区域表的数据源节点 # 区域表的数据源节点

View File

@@ -18,7 +18,7 @@
<file>logs/duanju.log</file> <file>logs/duanju.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--生成日志文件名称--> <!--生成日志文件名称-->
<fileNamePattern>logs/duanju.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern> <fileNamePattern>logs/%d{yyyy-MM-dd}/duanju.%i.log.gz</fileNamePattern>
<!--日志文件保留天数--> <!--日志文件保留天数-->
<MaxHistory>30</MaxHistory> <MaxHistory>30</MaxHistory>
<maxFileSize>100MB</maxFileSize> <maxFileSize>100MB</maxFileSize>

View File

@@ -5,15 +5,16 @@
<select id="selectUserPage" resultType="com.sqx.modules.app.entity.UserEntity"> <select id="selectUserPage" resultType="com.sqx.modules.app.entity.UserEntity">
select u.*,v.is_vip as member,v.end_time as endTime,v.vip_type as vipType, -- select u.*,v.is_vip as member,v.end_time as endTime,v.vip_type as vipType,
select u.*,1 as member,
s.username as sysUserName s.username as sysUserName
from tb_user u from tb_user u
left join user_vip v on v.user_id=u.user_id -- left join user_vip v on v.user_id=u.user_id
left join sys_user s on s.qd_code=u.qd_code left join sys_user s on s.qd_code=u.qd_code
where s.sys_user_id is null where s.sys_user_id is null
<if test="vipType!=null"> <!-- <if test="vipType!=null">-->
and v.vip_type = #{vipType} <!-- and v.vip_type = #{vipType}-->
</if> <!-- </if>-->
<if test="search!=null and search!=''"> <if test="search!=null and search!=''">
and (u.user_id=#{search} or u.phone = #{search} or u.user_name =#{search} ) and (u.user_id=#{search} or u.phone = #{search} or u.user_name =#{search} )
</if> </if>
@@ -32,15 +33,15 @@
<if test="sysPhone!=null and sysPhone!=''"> <if test="sysPhone!=null and sysPhone!=''">
and u.sys_phone=#{sysPhone} and u.sys_phone=#{sysPhone}
</if> </if>
<if test="status!=null and status!=0"> <!-- <if test="status!=null and status!=0">-->
and u.status=#{status} <!-- and u.status=#{status}-->
</if> <!-- </if>-->
<if test="member!=null and member!=-1 and member!=1"> <!-- <if test="member!=null and member!=-1 and member!=1">-->
and v.is_vip=#{member} <!-- and v.is_vip=#{member}-->
</if> <!-- </if>-->
<if test="member!=null and member==1"> <!-- <if test="member!=null and member==1">-->
and (v.is_vip=1 or v.is_vip is null) <!-- and (v.is_vip=1 or v.is_vip is null)-->
</if> <!-- </if>-->
<if test="inviterCode!=null and inviterCode!=''"> <if test="inviterCode!=null and inviterCode!=''">
and u.inviter_code like concat("%",#{inviterCode},"%") and u.inviter_code like concat("%",#{inviterCode},"%")
</if> </if>

View File

@@ -6,32 +6,21 @@
select c.course_id as courseId select c.course_id as courseId
, c.course_details_id as courseDetailsId , c.course_details_id as courseDetailsId
, c.course_details_name as courseDetailsName , c.course_details_name as courseDetailsName
, c.video_url as videoUrl
, c.price as countPrice , c.price as countPrice
, c.sort as sort , c.sort as sort
, ifnull(#{price}, 0) as price , ifnull(#{price}, 0) as price
, ifnull(#{wholesalePrice}, 0) as wholesalePrice , ifnull(#{wholesalePrice}, 0) as wholesalePrice
, IF(#{isPrice} = 1, c.is_price, 2) AS isPrice , IF(#{isPrice} = 1, c.is_price, 2) AS isPrice
, c.title_img as titleImg
, c.good_num as goodNum
, c.sort as sort
, IF(#{collect} = 1, 1, 0) AS isCollect
from course_details c from course_details c
where c.course_id = #{courseId} where c.course_id = #{courseId}
order by c.sort asc order by c.sort asc
</select> </select>
<select id="courseDetails" resultType="com.sqx.modules.course.vo.CourseDetailsVo">
select c.course_id as courseId
, c.course_details_id as courseDetailsId
, c.course_details_name as courseDetailsName
, c.title_img as titleImg
, c.video_url as videoUrl
, c.good_num as goodNum
, c.sort as sort
, IF(#{collect} = 1, 1, 0) AS isCollect
from course_details c
where c.course_id = #{courseId}
and sort &gt; #{starSort}
and sort &lt; #{endSort}
order by c.sort asc
</select>
<!--查找指定短剧的目录 按照顺序数字升序--> <!--查找指定短剧的目录 按照顺序数字升序-->
<select id="findByCourseId" resultType="com.sqx.modules.course.entity.CourseDetails"> <select id="findByCourseId" resultType="com.sqx.modules.course.entity.CourseDetails">
select select

View File

@@ -205,7 +205,8 @@
</select> </select>
<select id="selectOrdersMoney" resultType="Double"> <select id="selectOrdersMoney" resultType="Double">
select ifnull(sum(pay_money),0.00) from orders where 1=1 select sum(pay_money) from orders
where 1=1
<if test="sysUserId!=null"> <if test="sysUserId!=null">
and sys_user_id=#{sysUserId} and sys_user_id=#{sysUserId}
</if> </if>
@@ -232,16 +233,13 @@
<select id="selectFenXiaoMoney" resultType="Double"> <select id="selectFenXiaoMoney" resultType="Double">
select select
<if test="type==1"> <if test="type==1">
ifnull(sum(one_money),0.00) sum(ifnull(one_money,0.00))
</if> </if>
<if test="type==2"> <if test="type==2">
ifnull(sum(two_money),0.00) sum(ifnull(two_money,0.00))
</if> </if>
<if test="type==3"> <if test="type==3">
ifnull(sum(qd_money),0.00) sum(ifnull(qd_money,0.00))
</if>
<if test="type==4">
ifnull(sum(one_money),0.00)+ifnull(sum(two_money),0.00)+ifnull(sum(qd_money),0.00)
</if> </if>
from orders from orders
where status=1 where status=1

View File

@@ -61,10 +61,24 @@
GROUP BY GROUP BY
user_id user_id
</select> </select>
<select id="countByUserIdList" resultType="com.sqx.modules.pay.entity.CashOut">
SELECT user_id as userId,
ROUND(SUM(CASE WHEN state = 1 THEN money ELSE 0 END), 2) AS total,
COUNT(CASE WHEN state = 1 THEN 1 END) AS count,
ROUND(SUM(CASE WHEN state = 3 THEN money ELSE 0 END), 2) AS verifyTotal,
COUNT(CASE WHEN state = 3 THEN 1 END) AS verifyCount
FROM cash_out
GROUP BY user_id;
</select>
<select id="selectCashOutPage" resultType="com.sqx.modules.pay.entity.CashOut"> <select id="selectCashOutPage" resultType="com.sqx.modules.pay.entity.CashOut">
SELECT c.*, SELECT c.*,
ifnull(u.user_name,"用户不存在") as userName, ifnull(u.user_name,"用户不存在") as userName
s.username as sysUserName # s.username as sysUserName
<if test="isApp == false"> <if test="isApp == false">
,ifnull(t.total,0.00) as total, ,ifnull(t.total,0.00) as total,
ifnull(t.count,0) as count, ifnull(t.count,0) as count,
@@ -73,7 +87,7 @@
</if> </if>
FROM cash_out c FROM cash_out c
left join tb_user u on c.user_id = u.user_id left join tb_user u on c.user_id = u.user_id
left join sys_user s on s.user_id= c.sys_user_id # left join sys_user s on s.user_id= c.sys_user_id
<if test="isApp == false"> <if test="isApp == false">
left join (select user_id,ROUND(sum(money),2) as total,count(*) as count from cash_out where state = 1 GROUP BY user_id) t on c.user_id = t.user_id left join (select user_id,ROUND(sum(money),2) as total,count(*) as count from cash_out where state = 1 GROUP BY user_id) t on c.user_id = t.user_id
left join (select user_id,ROUND(sum(money),2) as total,count(*) as count from cash_out where state = 3 GROUP BY user_id) t1 on c.user_id = t1.user_id left join (select user_id,ROUND(sum(money),2) as total,count(*) as count from cash_out where state = 3 GROUP BY user_id) t1 on c.user_id = t1.user_id
@@ -91,9 +105,9 @@
<if test="cashOut.sysUserId!=null"> <if test="cashOut.sysUserId!=null">
and c.sys_user_id = #{cashOut.sysUserId} and c.sys_user_id = #{cashOut.sysUserId}
</if> </if>
<if test="cashOut.sysUserName!=null and cashOut.sysUserName!=''"> <!-- <if test="cashOut.sysUserName!=null and cashOut.sysUserName!=''">-->
and s.username = #{cashOut.sysUserName} <!-- and s.username = #{cashOut.sysUserName}-->
</if> <!-- </if>-->
<if test="cashOut.userType!=null"> <if test="cashOut.userType!=null">
and c.user_type = #{cashOut.userType} and c.user_type = #{cashOut.userType}
</if> </if>