This commit is contained in:
张良(004796)
2024-04-25 17:59:45 +08:00
parent 1db3fdf40c
commit eabb766e11
3 changed files with 20 additions and 16 deletions

View File

@@ -9,6 +9,7 @@ public enum ImagesEnums {
CONSUMER_FAIL_LOG("xq/images/logs/consumer-fail.png"), CONSUMER_FAIL_LOG("xq/images/logs/consumer-fail.png"),
SYSTEM_LOG("xq/images/logs/system-log.png"), SYSTEM_LOG("xq/images/logs/system-log.png"),
LOGO_LOG("xq/images/logs/logo.png"), LOGO_LOG("xq/images/logs/logo.png"),
PRIVACY_IMAGE("xq/images/avatar/privacy.png"),
; ;
private final String path; private final String path;

View File

@@ -24,7 +24,9 @@ import com.ruoyi.xq.dto.app.user.vo.HomeUserVo;
import com.ruoyi.xq.dto.app.user.vo.UserAuthMinVo; import com.ruoyi.xq.dto.app.user.vo.UserAuthMinVo;
import com.ruoyi.xq.dto.common.user.MinUser; import com.ruoyi.xq.dto.common.user.MinUser;
import com.ruoyi.xq.enums.ErrorEnum; import com.ruoyi.xq.enums.ErrorEnum;
import com.ruoyi.xq.enums.common.AuditEnum;
import com.ruoyi.xq.enums.common.SystemConfigEnum; import com.ruoyi.xq.enums.common.SystemConfigEnum;
import com.ruoyi.xq.enums.image.ImagesEnums;
import com.ruoyi.xq.enums.userinfo.UserGenderEnum; import com.ruoyi.xq.enums.userinfo.UserGenderEnum;
import com.ruoyi.xq.lock.LockKey; import com.ruoyi.xq.lock.LockKey;
import com.ruoyi.xq.manager.LoginManager; import com.ruoyi.xq.manager.LoginManager;
@@ -135,13 +137,23 @@ public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements Use
UserStatus userStatus = userStatusService.getByUserId(userId); UserStatus userStatus = userStatusService.getByUserId(userId);
boolean showAvatar = this.showAvatar(LoginHelper.getUserId(), userStatus.getShowAvatar()); boolean showAvatar = this.showAvatar(LoginHelper.getUserId(), userStatus.getShowAvatar());
if(!showAvatar){ if(!showAvatar){
result.setAvatar(null); String cos = systemConfigManager.getSystemConfig(SystemConfigEnum.COS_DOMAIN);
result.setAvatar(cos + ImagesEnums.PRIVACY_IMAGE.getPath());
result.setShowAvatarBool(false); result.setShowAvatarBool(false);
result.setUserPictureList(Collections.emptyList()); result.setUserPictureList(Collections.emptyList());
} }
return result; return result;
} }
private boolean showAvatar(Long userId, Integer avatar){
if(userId == null){
return ShowAvatarUtil.showAvatar(false,false,avatar);
}
UserAuth userAuth = userAuthService.getByUserId(userId);
User user = this.getById(userId);
return ShowAvatarUtil.showAvatar(user.getOpenVip(),userAuth.getCarAuth()==1, avatar);
}
@Override @Override
public boolean updateMobileUser(UpdateMobileAdminReq bo) { public boolean updateMobileUser(UpdateMobileAdminReq bo) {
if(!PhoneUtil.isMobile(bo.getMobile())){ if(!PhoneUtil.isMobile(bo.getMobile())){
@@ -215,14 +227,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements Use
return baseMapper.pageAdmin(pageQuery.build(), bo); return baseMapper.pageAdmin(pageQuery.build(), bo);
} }
public boolean showAvatar(Long userId, Integer avatar){
if(userId == null){
return ShowAvatarUtil.showAvatar(false,false,avatar);
}
UserAuth userAuth = userAuthService.getByUserId(userId);
User user = this.getById(userId);
return ShowAvatarUtil.showAvatar(user.getOpenVip(),userAuth.getCarAuth()==1, avatar);
}
@Override @Override
public Page<HomeUserListVo> homePage(HomePageReq params) { public Page<HomeUserListVo> homePage(HomePageReq params) {
@@ -232,7 +236,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements Use
Long userId = LoginHelper.getUserId(); Long userId = LoginHelper.getUserId();
if(userId != null){ if(userId != null){
UserAuth userAuth = userAuthService.getByUserId(userId); UserAuth userAuth = userAuthService.getByUserId(userId);
card = userAuth != null && userAuth.getCarAuth() == 1; card = userAuth != null && AuditEnum.SUCCESS.getCode().equals(userAuth.getCarAuth());
User user = this.getById(userId); User user = this.getById(userId);
vip = user.getOpenVip(); vip = user.getOpenVip();
} }
@@ -251,13 +255,13 @@ public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements Use
} }
Page<HomeUserListVo> page = baseMapper.homePageApp(params.build(), params); Page<HomeUserListVo> page = baseMapper.homePageApp(params.build(), params);
List<HomeUserListVo> records = page.getRecords(); List<HomeUserListVo> records = page.getRecords();
String cosDomain = systemConfigManager.getSystemConfig(SystemConfigEnum.COS_DOMAIN);
for (HomeUserListVo record : records) { for (HomeUserListVo record : records) {
record.setBirthdayStr(BirthdayUtil.getMinBirthday(record.getBirthday())); record.setBirthdayStr(BirthdayUtil.getMinBirthday(record.getBirthday()));
record.setAge(BirthdayUtil.getAge(record.getBirthday()));
boolean showAvatarBool = ShowAvatarUtil.showAvatar(vip, card, record.getShowAvatar()); boolean showAvatarBool = ShowAvatarUtil.showAvatar(vip, card, record.getShowAvatar());
record.setShowAvatarBool(showAvatarBool); record.setShowAvatarBool(showAvatarBool);
if(!record.getShowAvatarBool()){ if(!record.getShowAvatarBool()){
record.setAvatar(null); record.setAvatar(cosDomain + ImagesEnums.PRIVACY_IMAGE.getPath());
} }
} }
return page; return page;
@@ -268,7 +272,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements Use
List<HomeUserListVo> result = baseMapper.vipHomePage(20); List<HomeUserListVo> result = baseMapper.vipHomePage(20);
for (HomeUserListVo record : result) { for (HomeUserListVo record : result) {
record.setBirthdayStr(BirthdayUtil.getMinBirthday(record.getBirthday())); record.setBirthdayStr(BirthdayUtil.getMinBirthday(record.getBirthday()));
record.setAge(BirthdayUtil.getAge(record.getBirthday()));
} }
return result; return result;
} }

View File

@@ -23,8 +23,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by t1.id desc order by t1.id desc
</select> </select>
<select id="homePageApp" resultType="com.ruoyi.xq.dto.app.user.vo.HomeUserListVo"> <select id="homePageApp" resultType="com.ruoyi.xq.dto.app.user.vo.HomeUserListVo">
select t1.id as user_id, t1.avatar, t1.gender, t1.nickname, t1.birthday, t1.residence_city_name,t1.open_vip,t1.vip_type, select t1.id as user_id, t1.avatar, t1.gender, t1.nickname, t1.birthday,t1.age, t1.residence_city_name,t1.open_vip,t1.vip_type,
t1.education, t1.profession, if(t2.card_num_auth = 1, 1, 0) as card_num_auth_bool,t4.show_avatar t1.education, t1.profession, if(t2.card_num_auth = 2, 1, 0) as card_num_auth_bool,t4.show_avatar
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
join xq_user_info t3 on t1.id = t3.user_id join xq_user_info t3 on t1.id = t3.user_id
@@ -91,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if> </if>
</select> </select>
<select id="vipHomePage" resultType="com.ruoyi.xq.dto.app.user.vo.HomeUserListVo"> <select id="vipHomePage" resultType="com.ruoyi.xq.dto.app.user.vo.HomeUserListVo">
select t1.id as user_id, t1.avatar, t1.gender, t1.nickname, t1.birthday, t1.residence_city_name, select t1.id as user_id, t1.avatar, t1.gender, t1.nickname, t1.birthday, t1.age,t1.residence_city_name,
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