Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master merge #10

Merged
merged 3 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions douyu-live-user-interface/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,12 @@
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.douyu.live.user.constants;

import lombok.Getter;

/**
* @author liuguanyi
* * @date 2025/1/3
*/
@Getter
enum CacheAsyncDeleteCode {

USER_INFO_DELETE(0, "用户基础信息删除"),
USER_TAG_DELETE(1, "用户标签删除");

int code;
String desc;

CacheAsyncDeleteCode(int code, String desc) {
this.code = code;
this.desc = desc;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.douyu.live.user.constants;

import lombok.Getter;

/**
* @author liuguanyi
* * @date 2025/1/3
*/
@Getter
public class UserTagFieldNameConstants {

public static final String TAG_INFO_01 = "tag_info_01";
public static final String TAG_INFO_02 = "tag_info_02";
public static final String TAG_INFO_03 = "tag_info_03";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.douyu.live.user.constants;

import lombok.Getter;

/**
* @author liuguanyi
* * @date 2025/1/3
*/
@Getter
public enum UserTagsEnum {

IS_RICH((long) Math.pow(2, 0), "是否是有钱用户", "tag_info_01"),
IS_VIP((long) Math.pow(2, 1), "是否是VIP用户", "tag_info_01"),
IS_OLD_USER((long) Math.pow(2, 2), "是否是老用户", "tag_info_01");

long tag;
String desc;
String fieldName;

UserTagsEnum(long tag, String desc, String fieldName) {
this.tag = tag;
this.desc = desc;
this.fieldName = fieldName;
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package com.douyu.live.user.dto;

import lombok.Data;

import java.util.Date;

/**
* @author luiguanyi
* * @date 2024/12/16
*/
@Data
public class UserDTO {
private Long userId;
private String nickName;
Expand All @@ -18,99 +21,4 @@ public class UserDTO {
private Date createTime;
private Date updateTime;

@Override
public String toString() {
return "UserDTO{" +
"userId=" + userId +
", nickName='" + nickName + '\'' +
", trueName='" + trueName + '\'' +
", avatar='" + avatar + '\'' +
", sex=" + sex +
", workCity=" + workCity +
", bornCity=" + bornCity +
", bornDate=" + bornDate +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}

public Long getUserId() {
return userId;
}

public void setUserId(Long userId) {
this.userId = userId;
}

public String getNickName() {
return nickName;
}

public void setNickName(String nickName) {
this.nickName = nickName;
}

public String getTrueName() {
return trueName;
}

public void setTrueName(String trueName) {
this.trueName = trueName;
}

public String getAvatar() {
return avatar;
}

public void setAvatar(String avatar) {
this.avatar = avatar;
}

public Integer getSex() {
return sex;
}

public void setSex(Integer sex) {
this.sex = sex;
}

public Integer getWorkCity() {
return workCity;
}

public void setWorkCity(Integer workCity) {
this.workCity = workCity;
}

public Integer getBornCity() {
return bornCity;
}

public void setBornCity(Integer bornCity) {
this.bornCity = bornCity;
}

public Date getBornDate() {
return bornDate;
}

public void setBornDate(Date bornDate) {
this.bornDate = bornDate;
}

public Date getCreateTime() {
return createTime;
}

public void setCreateTime(Date createTime) {
this.createTime = createTime;
}

public Date getUpdateTime() {
return updateTime;
}

public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.douyu.live.user.interfaces.rpc;


import com.douyu.live.user.constants.UserTagsEnum;

/**
* 用户标签rpc
* @author liuguanyi
* * @date 2025/1/3
*/
public interface IUserTagRpc {
/**
* 设置标签
*
* @param userId
* @param userTagsEnum
* @return
*/
boolean setTag(Long userId, UserTagsEnum userTagsEnum);
/**
* 取消标签
*
* @param userId
* @param userTagsEnum
* @return
*/
boolean cancelTag(Long userId,UserTagsEnum userTagsEnum);
/**
* 是否包含某个标签
*
* @param userId
* @param userTagsEnum
* @return
*/
boolean containTag(Long userId,UserTagsEnum userTagsEnum);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.douyu.live.user.provider.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.douyu.live.user.provider.dao.po.UserTagPO;
import org.apache.ibatis.annotations.Mapper;

/**
* 用户标签mapper
* @author liuguanyi
* * @date 2025/1/3
*/
@Mapper
public interface IUserTagMapper extends BaseMapper<UserTagPO> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.douyu.live.user.provider.dao.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;

import java.util.Date;

/**
* @author liuguanyi
* * @date 2025/1/3
*/
@Data
public class UserTagPO {
/**
* 用户id
*/
@TableId(type = IdType.INPUT)
private Long userId;

/**
* 标签记录字段
*/
@TableField(value = "tag_info_01")
private Long tagInfo01;

/**
* 标签记录字段
*/
@TableField(value = "tag_info_02")
private Long tagInfo02;

/**
* 标签记录字段
*/
@TableField(value = "tag_info_03")
private Long tagInfo03;

/**
* 创建时间
*/
private Date createTime;

/**
* 更新时间
*/
private Date updateTime;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.douyu.live.user.provider.rpc;

import com.douyu.live.user.constants.UserTagsEnum;
import com.douyu.live.user.interfaces.rpc.IUserTagRpc;
import com.douyu.live.user.provider.service.IUserTagService;
import jakarta.annotation.Resource;
import org.apache.dubbo.config.annotation.DubboService;

/**
* @author liuguanyi
* * @date 2025/1/3
*/
@DubboService
public class UserTagRpcImpl implements IUserTagRpc {
@Resource
private IUserTagService userTagService;

@Override
public boolean setTag(Long userId, UserTagsEnum userTagsEnum) {
return userTagService.setTag(userId, userTagsEnum);
}

@Override
public boolean cancelTag(Long userId, UserTagsEnum
userTagsEnum) {
return userTagService.cancelTag(userId, userTagsEnum);
}

@Override
public boolean containTag(Long userId, UserTagsEnum userTagsEnum) {
return userTagService.containTag(userId, userTagsEnum);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.douyu.live.user.provider.service;

import com.douyu.live.user.constants.UserTagsEnum;

/**
* 用户标签service
* @author liuguanyi
* * @date 2025/1/3
*/
public interface IUserTagService {
/**
* 设置标签 只能设置成功一次
*
* @param userId
* @param userTagsEnum
* @return
*/
boolean setTag(Long userId, UserTagsEnum userTagsEnum);
/**
* 取消标签
*
* @param userId
* @param userTagsEnum
* @return
*/
boolean cancelTag(Long userId,UserTagsEnum userTagsEnum);
/**
* 是否包含某个标签
*
* @param userId
* @param userTagsEnum
* @return
*/
boolean containTag(Long userId,UserTagsEnum userTagsEnum);
}
Loading