This commit is contained in:
77
2024-04-24 00:37:29 +08:00
parent 9aa4bd3044
commit 417d2a8ff7
5 changed files with 51 additions and 7 deletions

View File

@@ -11,6 +11,9 @@ public class HomeUserVo {
@Schema(description = "是否可以查看头像,当不可以查看的时候头像和图片是空") @Schema(description = "是否可以查看头像,当不可以查看的时候头像和图片是空")
private Boolean showAvatarBool = true; private Boolean showAvatarBool = true;
@Schema(description = "最近登录时间")
private String lastLoginTime;
@Schema(description = "用户ID") @Schema(description = "用户ID")
private Long userId; private Long userId;
@Schema(description = "用户编号") @Schema(description = "用户编号")

View File

@@ -0,0 +1,20 @@
package com.ruoyi.xq.enums.image;
import lombok.Getter;
@Getter
public enum ImagesEnums {
VIP_LOG("xq/images/logs/"),
CONSUMER_LOG("xq/images/logs/"),
SYSTEM_LOG("xq/images/logs/"),
LOGO_LOG("xq/images/logs/"),
;
private final String path;
ImagesEnums(String path) {
this.path = path;
}
}

View File

@@ -125,6 +125,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements Use
if(userId.equals(currentUserId)){ if(userId.equals(currentUserId)){
return result; return result;
} }
User currentUser = this.getById(currentUserId);
// TODO 登录时间
boolean star = userStarService.existsStar(currentUserId, userId); boolean star = userStarService.existsStar(currentUserId, userId);
result.setStar(star); result.setStar(star);
UserStatus userStatus = userStatusService.getByUserId(userId); UserStatus userStatus = userStatusService.getByUserId(userId);

View File

@@ -14,6 +14,9 @@ import com.ruoyi.xq.dto.app.account.WxTransLogListVo;
import com.ruoyi.xq.dto.app.account.WxTransLogQuery; import com.ruoyi.xq.dto.app.account.WxTransLogQuery;
import com.ruoyi.xq.dto.common.user.MinUser; import com.ruoyi.xq.dto.common.user.MinUser;
import com.ruoyi.xq.enums.account.WxTransLogCateEnum; import com.ruoyi.xq.enums.account.WxTransLogCateEnum;
import com.ruoyi.xq.enums.common.SystemConfigEnum;
import com.ruoyi.xq.enums.image.ImagesEnums;
import com.ruoyi.xq.manager.SystemConfigManager;
import com.ruoyi.xq.mapper.WxTransLogMapper; import com.ruoyi.xq.mapper.WxTransLogMapper;
import com.ruoyi.xq.service.UserService; import com.ruoyi.xq.service.UserService;
import com.ruoyi.xq.service.WxTransLogService; import com.ruoyi.xq.service.WxTransLogService;
@@ -38,6 +41,8 @@ import java.util.stream.Collectors;
public class WxTransLogServiceImpl extends ServiceImpl<WxTransLogMapper,WxTransLog> implements WxTransLogService { public class WxTransLogServiceImpl extends ServiceImpl<WxTransLogMapper,WxTransLog> implements WxTransLogService {
@Autowired @Autowired
private UserService userService; private UserService userService;
@Autowired
private SystemConfigManager systemConfigManager;
@Override @Override
public Page<WxTransLogListVo> pageApp(PageQuery pageQuery, WxTransLogQuery query) { public Page<WxTransLogListVo> pageApp(PageQuery pageQuery, WxTransLogQuery query) {
@@ -46,6 +51,7 @@ public class WxTransLogServiceImpl extends ServiceImpl<WxTransLogMapper,WxTransL
if(CollectionUtils.isEmpty(records)){ if(CollectionUtils.isEmpty(records)){
return PageConvert.convertEmpty(page); return PageConvert.convertEmpty(page);
} }
String cosDomain = systemConfigManager.getSystemConfig(SystemConfigEnum.COS_DOMAIN);
List<Long> userIdList = records.stream().map(WxTransLog::getTarUserId).filter(Objects::nonNull).collect(Collectors.toList()); List<Long> userIdList = records.stream().map(WxTransLog::getTarUserId).filter(Objects::nonNull).collect(Collectors.toList());
List<User> users = userService.listByIds(userIdList); List<User> users = userService.listByIds(userIdList);
Map<Long, User> userMap = users.stream().collect(Collectors.toMap(User::getId, Function.identity())); Map<Long, User> userMap = users.stream().collect(Collectors.toMap(User::getId, Function.identity()));
@@ -59,11 +65,22 @@ public class WxTransLogServiceImpl extends ServiceImpl<WxTransLogMapper,WxTransL
res.setContent(record.getRemark()); res.setContent(record.getRemark());
res.setCreateTime(record.getCreateTime()); res.setCreateTime(record.getCreateTime());
res.setChangeValue(record.getChangeValue()); res.setChangeValue(record.getChangeValue());
User user = userMap.get(record.getTarUserId()); if(WxTransLogCateEnum.CONSUMER.getCode().equals(record.getCateId())){
if(user != null){ User user = userMap.get(record.getTarUserId());
res.setSourceUserId(user.getId()); if(user != null){
res.setSourceNickname(user.getNickname()); res.setSourceUserId(user.getId());
res.setSourceImg(user.getAvatar()); res.setSourceNickname(user.getNickname());
res.setSourceImg(user.getAvatar());
}
}else if(WxTransLogCateEnum.VIP_GIVE.getCode().equals(record.getCateId())){
res.setSourceImg(cosDomain + ImagesEnums.VIP_LOG.getPath());
}else if(WxTransLogCateEnum.ORDER.getCode().equals(record.getCateId())){
res.setSourceImg(cosDomain + ImagesEnums.CONSUMER_LOG.getPath());
}else if(WxTransLogCateEnum.SYSTEM.getCode().equals(record.getCateId())){
res.setSourceImg(cosDomain + ImagesEnums.SYSTEM_LOG.getPath());
}
if(res.getSourceImg() == null){
res.setSourceImg(cosDomain + ImagesEnums.LOGO_LOG.getPath());
} }
vo.add(res); vo.add(res);
} }

View File

@@ -95,8 +95,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t1.education, t1.profession, if(t2.card_num_auth = 1, 1, 0) as cardNumAuthBool t1.education, t1.profession, if(t2.card_num_auth = 1, 1, 0) as cardNumAuthBool
from xq_user t1 from xq_user t1
join xq_user_auth t2 on t1.id = t2.user_id join xq_user_auth t2 on t1.id = t2.user_id
where t1.type = 0 and t1.status = 0 and t1.finish_base_status = 1 join xq_user_status t3 on t1.id = t3.user_id
and exists(select 1 from xq_user_vip p1 where p1.user_id = t1.id and p1.vip_status = 1 and p1.vip_timeout &lt;= now()) join xq_user_login t4 on t1.id = t4.user_id
where t1.type = 0 and t1.status = 0 and t1.finish_base_status = 1 and t1.open_vip = 1 and t3.push_vip = 1
order by t4.last_login_time desc
</select> </select>
<select id="getMinUserById" resultType="com.ruoyi.xq.dto.common.user.MinUser"> <select id="getMinUserById" resultType="com.ruoyi.xq.dto.common.user.MinUser">
select t1.id,t1.usercode select t1.id,t1.usercode