细节优化,添加工号字段

This commit is contained in:
easonzhu 2025-04-27 10:29:28 +08:00
parent 9c3877e937
commit 57baf86fbf
10 changed files with 58 additions and 19 deletions

View File

@ -1,11 +1,14 @@
package com.syzb.advisor.entity;
import com.syzb.rbac.entity.UserLogin;
import java.io.Serializable;
public class AdvisorBasic implements Serializable {
private static final long serialVersionUID = 1L;
public Integer id;
public Integer userId;
public String workNo;
public String name;
public String showName;
public String avatar;
@ -20,9 +23,12 @@ public class AdvisorBasic implements Serializable {
public AdvisorBasic() {
}
public AdvisorBasic(AdvisorInfo advisorInfo, String deptName) {
public AdvisorBasic(AdvisorInfo advisorInfo, String deptName, UserLogin user) {
this.id = advisorInfo.getId();
this.userId = advisorInfo.getUserId();
if (user != null) {
this.workNo = user.getUpId();
}
this.name = advisorInfo.getName();
this.showName = advisorInfo.getShowName();
this.avatar = advisorInfo.getAvatar();
@ -43,6 +49,14 @@ public class AdvisorBasic implements Serializable {
this.userId = userId;
}
public String getWorkNo() {
return workNo;
}
public void setWorkNo(String workNo) {
this.workNo = workNo;
}
public String getProfile() {
return profile;
}

View File

@ -107,34 +107,39 @@ public class AdvisorInfoService {
);
public Map<Integer, AdvisorBasic> getAdvisorMap() {
Map<Integer, UserLogin> userIdLoginMap = userService.getUserUserIdLoginMap();
return cacheService.get(ADVISOR_INFO, AdvisorInfoKey.ADVISOR_MAP, () -> {
List<AdvisorInfo> advisorList = advisorInfoMapper.selectList(Wrappers.emptyWrapper());
return advisorList.stream().collect(Collectors.toMap(AdvisorInfo::getId, advisor ->
new AdvisorBasic(advisor, deptService.getDeptNameByAdvisorId(advisor.getId()))));
new AdvisorBasic(advisor, deptService.getDeptNameByAdvisorId(advisor.getId()), userIdLoginMap.get(advisor.getUserId()))));
});
}
public Map<Integer, AdvisorBasicVO> getAdvisorVoMap() {
Map<Integer, UserLogin> userIdLoginMap = userService.getUserUserIdLoginMap();
return cacheService.get(ADVISOR_INFO, AdvisorInfoKey.ADVISOR_VO_MAP, () -> {
List<AdvisorInfo> advisorList = advisorInfoMapper.selectList(Wrappers.emptyWrapper());
return advisorList.stream().collect(Collectors.toMap(AdvisorInfo::getId, advisor ->
new AdvisorBasicVO(new AdvisorBasic(advisor, deptService.getDeptNameByAdvisorId(advisor.getId())))));
new AdvisorBasicVO(new AdvisorBasic(advisor, deptService.getDeptNameByAdvisorId(advisor.getId()), userIdLoginMap.get(advisor.getUserId())))));
});
}
public Map<Integer, AdvisorBasic> getUserIdAdvisorMap() {
Map<Integer, UserLogin> userIdLoginMap = userService.getUserUserIdLoginMap();
return cacheService.get(ADVISOR_INFO, AdvisorInfoKey.USER_ADVISOR_MAP, () -> {
List<AdvisorInfo> advisorList = advisorInfoMapper.selectList(Wrappers.emptyWrapper());
return advisorList.stream().filter(advisor -> advisor.getUserId() != null).collect(Collectors.toMap(AdvisorInfo::getUserId, advisor ->
new AdvisorBasic(advisor, deptService.getDeptNameByAdvisorId(advisor.getId()))));
new AdvisorBasic(advisor, deptService.getDeptNameByAdvisorId(advisor.getId()), userIdLoginMap.get(advisor.getUserId()))));
});
}
public Map<String, List<AdvisorBasic>> getDeptIdAdvisorMap() {
Map<Integer, UserLogin> userIdLoginMap = userService.getUserUserIdLoginMap();
return cacheService.get(ADVISOR_INFO, AdvisorInfoKey.USER_ADVISOR_DEPT_MAP, () -> {
List<AdvisorInfo> advisorList = advisorInfoMapper.selectList(Wrappers.emptyWrapper());
return advisorList.stream().filter(advisor -> StrUtil.isNotBlank(advisor.getDeptId())).map(advisor ->
new AdvisorBasic(advisor, deptService.getDeptNameByAdvisorId(advisor.getId()))).collect(Collectors.groupingBy(AdvisorBasic::getDeptId));
new AdvisorBasic(advisor, deptService.getDeptNameByAdvisorId(advisor.getId()), userIdLoginMap.get(advisor.getUserId())))
.collect(Collectors.groupingBy(AdvisorBasic::getDeptId));
});
}

View File

@ -16,6 +16,9 @@ public class AdvisorBasicVO implements Serializable {
@ApiModelProperty("用户工号")
private String staffNo;
@ApiModelProperty("工号")
private String workNo;
@ApiModelProperty("投顾名称")
private String name;
@ -41,6 +44,7 @@ public class AdvisorBasicVO implements Serializable {
this.id = advisorBasic.id;
this.userId = advisorBasic.userId;
this.staffNo = advisorBasic.staffNo;
this.workNo = advisorBasic.workNo;
this.name = advisorBasic.name;
this.showName = advisorBasic.showName;
this.avatar = advisorBasic.avatar;
@ -73,6 +77,15 @@ public class AdvisorBasicVO implements Serializable {
this.staffNo = staffNo;
}
public String getWorkNo() {
return workNo;
}
public void setWorkNo(String workNo) {
this.workNo = workNo;
}
public String getName() {
return name;
}
@ -120,4 +133,5 @@ public class AdvisorBasicVO implements Serializable {
public void setProfile(String profile) {
this.profile = profile;
}
}

View File

@ -104,6 +104,12 @@ public class UserService {
});
}
public Map<Integer, UserLogin> getUserUserIdLoginMap() {
Map<Integer, UserLogin> userLoginMap = getUserLoginMap();
Map<Integer, UserDept> userDeptMap = getUserMap();
return userDeptMap.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> userLoginMap.get(entry.getValue().getUserId())));
}
public Map<String, List<UserDept>> getDeptUserMap() {
return cacheService.get(USER, UserKey.USER_DEPT_MAP, () -> {
List<UserDept> userList = userDeptMapper.selectList(Wrappers.emptyWrapper());

View File

@ -860,7 +860,7 @@ public class AdminVideoStatisticService {
// 填充实时在线人数
// 直播在线人数峰值
vo.setOnlineMostNum(adminVideoInteractionService.getOnlineMax(videoId));
vo.setOnlineNum(!VideoLiveStatus.HAS_ENDED.value.equals(liveStatus) ? onlineUserService.getOnlineCount(ProductType.VIDEO_SINGLE.value, videoId) : 0);
vo.setOnlineNum(!VideoLiveStatus.HAS_ENDED.value.equals(liveStatus) ? onlineUserService.getOnlineCountWithoutCache(ProductType.VIDEO_SINGLE.value, videoId) : 0);
// 直播观看
if (realStartTime == null && Objects.equals(video.getPlayType(), VideoPlayType.LIVE.value)) {
vo.setReadNum(0);

View File

@ -171,7 +171,7 @@ public class AppVideoInfoService {
if (userDept != null && userDept.getLoginId() != null) {
UserLogin userLogin = userService.getUserLoginMap().get(userDept.getLoginId());
if (userLogin != null) {
vo.setSaleUserStaffNo(userLogin.getStaffNo());
vo.setSaleUserWorkNo(userLogin.getUpId());
}
}
}

View File

@ -471,16 +471,15 @@ public class VideoCloudService {
*
* @see [https://console.cloud.tencent.com/api/explorer?Product=live&Version=2018-08-01&Action=CreateRecordTask]
*/
public String createRecordTask(String streamId) {
public String createRecordTask(String streamId, LocalDateTime endTime) {
try {
// 开启任务流录制
LocalDateTime end = LocalDateTime.now().toLocalDate().plusDays(1).atStartOfDay();
Instant instant = end.atZone(ZoneId.systemDefault()).toInstant();
Instant instant = endTime.atZone(ZoneId.systemDefault()).toInstant();
// 将Instant转换为毫秒级时间戳
long timestamp = instant.toEpochMilli();
long endTime = BigDecimal.valueOf(timestamp).divide(BigDecimal.valueOf(1000), 0, RoundingMode.HALF_UP).longValue();
long endTimestamp = BigDecimal.valueOf(timestamp).divide(BigDecimal.valueOf(1000), 0, RoundingMode.HALF_UP).longValue();
CreateRecordTaskRequest request = new CreateRecordTaskRequest();
request.setEndTime(endTime);
request.setEndTime(endTimestamp);
request.setStreamName(streamId);
request.setDomainName(config.getPushHost());
request.setAppName(config.getAppName());

View File

@ -125,7 +125,8 @@ public class VideoExternalService {
// 记录直播前观看人次
Integer preNum = adminVideoInteractionService.queryInteractionCount(id, VideoUserRecordType.READ, null, null, false);
live.setPreNum(preNum == null ? 0 : preNum);
String taskId = videoCloudService.createRecordTask(streamId);
LocalDateTime endTime = video.getEndTime().toLocalDate().plusDays(1).atStartOfDay();
String taskId = videoCloudService.createRecordTask(streamId, endTime);
live.setTaskId(taskId);
}
live.setLiveStatus(liveStatus);

View File

@ -339,7 +339,7 @@ public class VideoMessageService {
VideoCustomerVO videoCustomerVO = new VideoCustomerVO(null, 0, 0);
if (totalCount != 0) {
//获取在线人数
int onlineCount = onlineUserService.getOnlineCount(ProductType.VIDEO_SINGLE.value, videoId);
int onlineCount = onlineUserService.getOnlineCountWithoutCache(ProductType.VIDEO_SINGLE.value, videoId);
LoggerUtil.info("直播间id=" + videoId + "在线人数:" + onlineCount);
videoCustomerVO = new VideoCustomerVO(totalOnlineList, onlineCount, totalCount);
}

View File

@ -184,7 +184,7 @@ public class VideoDetailAppVO implements IVideoInfoAppVO, Serializable {
private Integer showNickname;
@ApiModelProperty("营销经理工号")
private String saleUserStaffNo;
private String saleUserWorkNo;
public VideoDetailAppVO() {
}
@ -655,11 +655,11 @@ public class VideoDetailAppVO implements IVideoInfoAppVO, Serializable {
this.showNickname = showNickname;
}
public String getSaleUserStaffNo() {
return saleUserStaffNo;
public String getSaleUserWorkNo() {
return saleUserWorkNo;
}
public void setSaleUserStaffNo(String saleUserStaffNo) {
this.saleUserStaffNo = saleUserStaffNo;
public void setSaleUserWorkNo(String saleUserWorkNo) {
this.saleUserWorkNo = saleUserWorkNo;
}
}