用户列表报错修复

This commit is contained in:
张松 2025-01-06 10:15:29 +08:00
parent f9e32bff7b
commit f45341c550
2 changed files with 35 additions and 6 deletions

View File

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

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.MsgDao;
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.service.*;
import com.sqx.modules.app.utils.JwtUtils;
@ -82,11 +83,9 @@ import weixin.popular.util.JsonUtil;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
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 final AliService aliService;
private final UserInfoService userInfoService;
private final UserVipDao userVipDao;
@Value("${spring.profiles.active}")
private String profiles;
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.userInfoService = userInfoService;
this.userVipDao = userVipDao;
}
@Override
@ -1419,7 +1420,34 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
@Override
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);
}