123
This commit is contained in:
@@ -4,6 +4,7 @@ public class RedisConstant {
|
||||
public static final String REDIS_P = "cai-";
|
||||
public static final String SYSTEM_CONFIG = REDIS_P + "system-config";
|
||||
public static final String CITY_CACHE_REDIS = REDIS_P + "city";
|
||||
public static final String CITY_CACHE_ALL_REDIS = REDIS_P + "cityAll";
|
||||
public static final String DYNAMIC_TOTAL_CACHE_REDIS = REDIS_P + "synamicTotal:%s:%s";
|
||||
public static final String CODE_REDIS = REDIS_P + "code:%s:%s";
|
||||
public static final String USER_GREET_TOTAL_REDIS = REDIS_P + "userGreetTotal:%s:%s";
|
||||
|
||||
@@ -76,7 +76,8 @@ public class User implements Serializable {
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private Long city;
|
||||
private Integer cityId;
|
||||
private String city;
|
||||
/**
|
||||
* 资料是否完成 0 未完成 1已完成
|
||||
*/
|
||||
|
||||
@@ -10,7 +10,7 @@ public class UserUpdateReq {
|
||||
@Schema(description = "用户ID",accessMode = Schema.AccessMode.READ_ONLY)
|
||||
private Long userId;
|
||||
@Schema(description = "城市")
|
||||
private Long city;
|
||||
private Integer cityId;
|
||||
@Schema(description = "昵称")
|
||||
private String nickname;
|
||||
@Schema(description = "生日")
|
||||
|
||||
@@ -17,5 +17,5 @@ public class AnchorListQuery {
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "城市(同城查询使用)")
|
||||
private String city;
|
||||
private Integer cityId;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import lombok.Data;
|
||||
@Schema(description = "群打招呼用户搜索")
|
||||
public class GreetQuery {
|
||||
@Schema(description = "城市")
|
||||
private Long city;
|
||||
private Integer cityId;
|
||||
@Schema(description = "搜索类型 1=活跃 2=同城")
|
||||
private Integer type = 1;
|
||||
}
|
||||
|
||||
@@ -1,34 +1,44 @@
|
||||
package com.ruoyi.cai.dto.app.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Schema(description = "主播列表信息")
|
||||
public class AnchorListVo {
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
@Schema(description = "主播头像")
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 性别 0 未知 1 女 2 男
|
||||
*/
|
||||
@Schema(description = "性别")
|
||||
private Integer gender;
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private Long city;
|
||||
@Schema(description = "城市ID")
|
||||
private Integer cityId;
|
||||
@Schema(description = "城市")
|
||||
private String city;
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
@Schema(description = "昵称")
|
||||
private String nickname;
|
||||
/**
|
||||
* 用户号/ID号
|
||||
*/
|
||||
@Schema(description = "蜜瓜号")
|
||||
private String usercode;
|
||||
/**
|
||||
* 用户评分
|
||||
*/
|
||||
@Schema(description = "评分")
|
||||
private BigDecimal giveScore;
|
||||
}
|
||||
|
||||
@@ -54,8 +54,10 @@ public class CurrentUserInfoVo {
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
@Schema(description = "城市ID")
|
||||
private Integer cityId;
|
||||
@Schema(description = "城市")
|
||||
private Long city;
|
||||
private String city;
|
||||
/**
|
||||
* 是否是播主 0 否 1 是
|
||||
*/
|
||||
|
||||
@@ -26,8 +26,11 @@ public class DynamicVo {
|
||||
/**
|
||||
* 城市ID
|
||||
*/
|
||||
@Schema(description = "城市")
|
||||
@Schema(description = "城市ID")
|
||||
private Integer cityId;
|
||||
|
||||
@Schema(description = "城市")
|
||||
private String city;
|
||||
/**
|
||||
* 是否有附件 0 没有 1 有
|
||||
*/
|
||||
|
||||
@@ -4,8 +4,6 @@ package com.ruoyi.cai.dto.app.vo.user;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class UserBaseVo {
|
||||
|
||||
@@ -23,8 +21,10 @@ public class UserBaseVo {
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
@Schema(description = "城市ID")
|
||||
private Integer cityId;
|
||||
@Schema(description = "城市")
|
||||
private Long city;
|
||||
private Integer city;
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
|
||||
@@ -25,6 +25,10 @@ public class UserInfoVo {
|
||||
private String nickname;
|
||||
@Schema(description = "头像")
|
||||
private String avatar;
|
||||
@Schema(description = "城市")
|
||||
private String city;
|
||||
@Schema(description = "城市ID")
|
||||
private Integer cityId;
|
||||
|
||||
/**
|
||||
* 价格,默认50彩币
|
||||
|
||||
@@ -45,6 +45,8 @@ public class CurrentUserManager {
|
||||
private AccountBankcardService accountBankcardService;
|
||||
@Resource
|
||||
private ImUserRefClient userClient;
|
||||
@Autowired
|
||||
private CitysService citysService;
|
||||
|
||||
public CurrentUserInfoVo currentInfo() {
|
||||
Long userId = LoginHelper.getUserId();
|
||||
@@ -122,8 +124,9 @@ public class CurrentUserManager {
|
||||
throw new ServiceException("性别不可以修改");
|
||||
}
|
||||
}
|
||||
if(res.getCity() != null){
|
||||
update.set(User::getCity,res.getCity());
|
||||
if(res.getCityId() != null){
|
||||
update.set(User::getCityId,res.getCityId());
|
||||
update.set(User::getCity,citysService.getByCityId(res.getCityId()));
|
||||
updateFlag=true;
|
||||
}
|
||||
if(StringUtils.isNotEmpty(res.getAvatar())){
|
||||
|
||||
@@ -15,4 +15,5 @@ public interface CitysService extends IService<Citys> {
|
||||
|
||||
Map<Long,String> all();
|
||||
|
||||
String getByCityId(Integer cityId);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class AnchorServiceImpl extends ServiceImpl<AnchorMapper, Anchor> impleme
|
||||
@Override
|
||||
public Page<AnchorListVo> pageApp(PageQuery pageQuery, AnchorListQuery query) {
|
||||
if(query.getType() != null && query.getType() != 3){
|
||||
query.setCity(null);
|
||||
query.setCityId(null);
|
||||
}
|
||||
return baseMapper.pageApp(pageQuery.build(),query);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -29,9 +30,16 @@ public class CitysServiceImpl extends ServiceImpl<CitysMapper, Citys> implements
|
||||
@Autowired
|
||||
private StringRedisTemplate redisTemplate;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
List<Citys> list = this.list();
|
||||
Map<Long, String> map = list.stream().collect(Collectors.toMap(Citys::getId, Citys::getName));
|
||||
redisTemplate.opsForHash().putAll(RedisConstant.CITY_CACHE_REDIS, map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Long, String> all() {
|
||||
String value = redisTemplate.opsForValue().get(RedisConstant.CITY_CACHE_REDIS);
|
||||
String value = redisTemplate.opsForValue().get(RedisConstant.CITY_CACHE_ALL_REDIS);
|
||||
if(value != null){
|
||||
return JSON.parseObject(value, new TypeReference<LinkedHashMap<Long, String>>(){});
|
||||
}
|
||||
@@ -40,4 +48,21 @@ public class CitysServiceImpl extends ServiceImpl<CitysMapper, Citys> implements
|
||||
redisTemplate.opsForValue().set(RedisConstant.CITY_CACHE_REDIS,JSON.toJSONString(map),30, TimeUnit.DAYS);
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getByCityId(Integer cityId){
|
||||
if(cityId == null || cityId == 0){
|
||||
return null;
|
||||
}
|
||||
Object val = redisTemplate.opsForHash().get(RedisConstant.CITY_CACHE_REDIS, cityId);
|
||||
if(val != null){
|
||||
return String.valueOf(val);
|
||||
}
|
||||
Citys city = this.getById(cityId);
|
||||
if(city == null){
|
||||
return null;
|
||||
}
|
||||
redisTemplate.opsForHash().put(RedisConstant.CITY_CACHE_REDIS, cityId, city.getName());
|
||||
return city.getName();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,6 +88,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
||||
}
|
||||
|
||||
}
|
||||
vo.setCity(user.getCity());
|
||||
vo.setCityId(user.getCityId());
|
||||
vo.setFansNum(userFollowService.getFansNumByUserId(userId));
|
||||
vo.setStar(userFollowService.checkStar(currentUserId, userId));
|
||||
vo.setAlbumList(userAlbumService.getUserAlbum(userId, user.getIsAnchor()));
|
||||
|
||||
@@ -14,14 +14,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="giveScore" column="give_score"/>
|
||||
<result property="serviceCount" column="service_count"/>
|
||||
<result property="serviceTime" column="service_time"/>
|
||||
<result property="giftInviteRate" column="gift_invite_rate"/>
|
||||
<result property="videoRate" column="video_rate"/>
|
||||
<result property="giftRate" column="gift_rate"/>
|
||||
<result property="recommendStatus" column="recommend_status"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="jifen" column="jifen"/>
|
||||
<result property="lastJifen" column="last_jifen"/>
|
||||
</resultMap>
|
||||
<select id="pageAdmin" resultType="com.ruoyi.cai.dto.admin.vo.AnchorAdminVo">
|
||||
select
|
||||
@@ -30,13 +27,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
left join cai_user t2 on t1.user_id = t2.id
|
||||
</select>
|
||||
<select id="pageApp" resultType="com.ruoyi.cai.dto.app.vo.AnchorListVo">
|
||||
select t1.avatar,t1.gender,t1.city,t1.nickname,t1.usercode,t2.give_score
|
||||
select t1.avatar,t1.gender,t1.city,t1.nickname,t1.usercode,t1.city_id,t1.city,t2.give_score
|
||||
from cai_user t1
|
||||
join cai_anchor t2 on t1.id = t2.user_id
|
||||
join cai_user_online t3 on t1.id = t3.user_id
|
||||
where t1.status = 0 and t1.is_anchor = 1
|
||||
<if test="query.city != null and query.city != ''">
|
||||
and t1.city = #{query.city}
|
||||
<if test="query.cityId != null and query.cityId != ''">
|
||||
and t1.city_id = #{query.cityId}
|
||||
</if>
|
||||
<if test="query.type != null">
|
||||
<if test="query.type == 1">
|
||||
|
||||
@@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</where>
|
||||
</select>
|
||||
<select id="pageApp" resultType="com.ruoyi.cai.dto.app.vo.user.UserListVo">
|
||||
select t1.avatar,t1.gender,t1.city,t1.nickname,t1.usercode,t1.age,t2.last_live_time
|
||||
select t1.avatar,t1.gender,t1.city,t1.city_id,t1.nickname,t1.usercode,t1.age,t2.last_live_time
|
||||
from cai_user t1
|
||||
join cai_user_online t2 on t1.id = t2.user_id
|
||||
where t1.status = 0
|
||||
@@ -43,12 +43,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
order by t2.last_live_time desc
|
||||
</select>
|
||||
<select id="greetPageApp" resultType="com.ruoyi.cai.dto.app.vo.user.UserListVo">
|
||||
select t1.avatar,t1.gender,t1.city,t1.nickname,t1.usercode,t1.age,t2.last_live_time
|
||||
select t1.avatar,t1.gender,t1.city,t1.city_id,t1.nickname,t1.usercode,t1.age,t2.last_live_time
|
||||
from cai_user t1
|
||||
join cai_user_online t2 on t1.id = t2.user_id
|
||||
where t1.status = 0
|
||||
<if test="query.city != null and query.city != ''">
|
||||
and t1.city = #{query.city}
|
||||
<if test="query.cityId != null and query.cityId != ''">
|
||||
and t1.city_id = #{query.cityId}
|
||||
</if>
|
||||
order by t2.last_live_time desc
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user