-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from javaKing-lgy/master-merge
Master merge
- Loading branch information
Showing
11 changed files
with
277 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...live-user-interface/src/main/java/com/douyu/live/user/constants/CacheAsyncDeleteCode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
...user-interface/src/main/java/com/douyu/live/user/constants/UserTagFieldNameConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | ||
} |
25 changes: 25 additions & 0 deletions
25
douyu-live-user-interface/src/main/java/com/douyu/live/user/constants/UserTagsEnum.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
douyu-live-user-interface/src/main/java/com/douyu/live/user/interfaces/rpc/IUserTagRpc.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
...e-user-provider/src/main/java/com/douyu/live/user/provider/dao/mapper/IUserTagMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> { | ||
} |
50 changes: 50 additions & 0 deletions
50
douyu-live-user-provider/src/main/java/com/douyu/live/user/provider/dao/po/UserTagPO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
douyu-live-user-provider/src/main/java/com/douyu/live/user/provider/rpc/UserTagRpcImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...ive-user-provider/src/main/java/com/douyu/live/user/provider/service/IUserTagService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
Oops, something went wrong.