修改bug
This commit is contained in:
parent
3fb0972dd0
commit
9d5b1e109d
@ -183,8 +183,8 @@ tenant:
|
|||||||
- sys_tenant_extend
|
- sys_tenant_extend
|
||||||
- red_packet
|
- red_packet
|
||||||
- red_packet_receive
|
- red_packet_receive
|
||||||
- commission_template
|
- sys_commission_template
|
||||||
- commission_rate_range
|
- sys_commission_rate_range
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,53 +114,51 @@ public class VlogUploadController extends BaseInfoProperties {
|
|||||||
log.info("腾讯云 SearchMedia API 调用成功,总记录数: {}", resp.getTotalCount());
|
log.info("腾讯云 SearchMedia API 调用成功,总记录数: {}", resp.getTotalCount());
|
||||||
|
|
||||||
// 处理响应结果
|
// 处理响应结果
|
||||||
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
result.put("total", resp.getTotalCount());
|
||||||
|
result.put("current", vlogBO.getCurrent());
|
||||||
|
result.put("size", vlogBO.getSize());
|
||||||
|
result.put("pages", (resp.getTotalCount() + vlogBO.getSize() - 1) / vlogBO.getSize()); // 总页数
|
||||||
|
|
||||||
List<Map<String, Object>> mediaList = new ArrayList<>();
|
List<Map<String, Object>> mediaList = new ArrayList<>();
|
||||||
if (resp.getMediaInfoSet() != null) {
|
if (resp.getMediaInfoSet() != null) {
|
||||||
for (MediaInfo mediaInfo : resp.getMediaInfoSet()) {
|
for (MediaInfo mediaInfo : resp.getMediaInfoSet()) {
|
||||||
Map<String, Object> mediaMap = new HashMap<>();
|
Map<String, Object> mediaMap = new HashMap<>();
|
||||||
|
// 基础信息
|
||||||
MediaBasicInfo basicInfo = mediaInfo.getBasicInfo();
|
MediaBasicInfo basicInfo = mediaInfo.getBasicInfo();
|
||||||
|
mediaMap.put("fileId", mediaInfo.getFileId());
|
||||||
// 1. 映射字段(与表结构一致)
|
mediaMap.put("name", basicInfo.getName());
|
||||||
String fileId = mediaInfo.getFileId();
|
mediaMap.put("description", basicInfo.getDescription());
|
||||||
mediaMap.put("vloger_id", vlogBO.getVlogerId());
|
mediaMap.put("createTime", basicInfo.getCreateTime());
|
||||||
mediaMap.put("url", basicInfo.getMediaUrl());
|
mediaMap.put("updateTime", basicInfo.getUpdateTime());
|
||||||
mediaMap.put("cover", basicInfo.getCoverUrl());
|
mediaMap.put("expireTime", basicInfo.getExpireTime());
|
||||||
mediaMap.put("title", basicInfo.getName());
|
mediaMap.put("classId", basicInfo.getClassId());
|
||||||
mediaMap.put("create_time", basicInfo.getCreateTime());
|
mediaMap.put("className", basicInfo.getClassName());
|
||||||
mediaMap.put("update_time", basicInfo.getUpdateTime());
|
mediaMap.put("classPath", basicInfo.getClassPath());
|
||||||
|
mediaMap.put("coverUrl", basicInfo.getCoverUrl());
|
||||||
|
mediaMap.put("type", basicInfo.getType());
|
||||||
|
mediaMap.put("mediaUrl", basicInfo.getMediaUrl());
|
||||||
mediaMap.put("status", basicInfo.getStatus());
|
mediaMap.put("status", basicInfo.getStatus());
|
||||||
mediaMap.put("file_id", fileId);
|
mediaMap.put("storageRegion", basicInfo.getStorageRegion());
|
||||||
mediaMap.put("first_frame_img", vlogBO.getFirstFrameImg());
|
mediaMap.put("category", basicInfo.getCategory());
|
||||||
|
mediaMap.put("storageClass", basicInfo.getStorageClass());
|
||||||
|
mediaMap.put("tagSet", basicInfo.getTagSet());
|
||||||
|
|
||||||
|
// 获取视频统计信息
|
||||||
|
Map<String, Object> statistics = vlogService.getVlogStatistics(mediaInfo.getFileId());
|
||||||
|
mediaMap.putAll(statistics);
|
||||||
|
|
||||||
// 2. 点赞数和评论数从Redis获取
|
// 获取视频上传者信息
|
||||||
String likeCountsStr = redis.get(REDIS_VLOG_BE_LIKED_COUNTS + ":" + fileId);
|
Map<String, String> uploaderInfo = vlogService.getVlogUploaderInfo(mediaInfo.getFileId());
|
||||||
Integer likeCounts = 0;
|
if (uploaderInfo != null) {
|
||||||
if (StringUtils.isNotBlank(likeCountsStr)) {
|
mediaMap.put("nickname", uploaderInfo.get("name"));
|
||||||
try {
|
mediaMap.put("mobile", uploaderInfo.get("phone"));
|
||||||
likeCounts = Integer.valueOf(likeCountsStr);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
log.warn("Redis中视频{}的点赞数格式错误: {}", fileId, likeCountsStr);
|
|
||||||
likeCounts = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mediaMap.put("like_counts", likeCounts);
|
|
||||||
|
|
||||||
String commentCountsStr = redis.get(REDIS_VLOG_COMMENT_COUNTS + ":" + fileId);
|
|
||||||
Integer commentCounts = 0;
|
|
||||||
if (StringUtils.isNotBlank(commentCountsStr)) {
|
|
||||||
try {
|
|
||||||
commentCounts = Integer.valueOf(commentCountsStr);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
log.warn("Redis中视频{}的评论数格式错误: {}", fileId, commentCountsStr);
|
|
||||||
commentCounts = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mediaMap.put("comments_counts", commentCounts);
|
|
||||||
|
|
||||||
mediaList.add(mediaMap);
|
mediaList.add(mediaMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
result.put("records", mediaList);
|
||||||
|
|
||||||
// 构建Page对象
|
// 构建Page对象
|
||||||
Page<Map<String, Object>> page = new Page<>();
|
Page<Map<String, Object>> page = new Page<>();
|
||||||
|
@ -43,6 +43,11 @@ public class AccountDetailServiceImpl implements IAccountDetailService {
|
|||||||
endTime = queryBO.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
endTime = queryBO.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 记录查询参数日志
|
||||||
|
log.info("查询账户明细,参数:memberId={}, accountId={}, changeType={}, source={}, startTime={}, endTime={}",
|
||||||
|
queryBO.getMemberId(), queryBO.getAccountId(), queryBO.getChangeType(),
|
||||||
|
queryBO.getSource(), startTime, endTime);
|
||||||
|
|
||||||
// 查询数据
|
// 查询数据
|
||||||
IPage<AccountDetailVO> result = accountChangeRecordMapper.selectAccountDetailPage(
|
IPage<AccountDetailVO> result = accountChangeRecordMapper.selectAccountDetailPage(
|
||||||
page, queryBO.getMemberId(), queryBO.getAccountId(),
|
page, queryBO.getMemberId(), queryBO.getAccountId(),
|
||||||
@ -61,6 +66,7 @@ public class AccountDetailServiceImpl implements IAccountDetailService {
|
|||||||
record.setUserTypeDesc(UserTypeEnum.getDesc(userType));
|
record.setUserTypeDesc(UserTypeEnum.getDesc(userType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.info("查询账户明细完成,共查询到{}条记录", result.getTotal());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,113 @@
|
|||||||
|
package com.wzj.soopin.member.utils;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
|
import org.dromara.common.core.domain.model.LoginUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户类型工具类
|
||||||
|
*/
|
||||||
|
public class UserTypeUtils {
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class UserInfo {
|
||||||
|
private Long userId;
|
||||||
|
private Integer userType; // 1-租户 2-会员
|
||||||
|
private String userTypeDesc;
|
||||||
|
private Long memberId; // 会员ID,如果是会员用户
|
||||||
|
private Long tenantId; // 租户ID,如果是租户用户
|
||||||
|
private Long accountId; // 账户ID,用于查询
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前登录用户信息
|
||||||
|
*/
|
||||||
|
public static UserInfo getCurrentUserInfo() {
|
||||||
|
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||||
|
if (loginUser == null) {
|
||||||
|
throw new RuntimeException("用户未登录");
|
||||||
|
}
|
||||||
|
|
||||||
|
UserInfo userInfo = new UserInfo();
|
||||||
|
userInfo.setUserId(loginUser.getUserId());
|
||||||
|
|
||||||
|
String userType = loginUser.getUserType();
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(userType)) {
|
||||||
|
if ("member".equalsIgnoreCase(userType) || "2".equals(userType)) {
|
||||||
|
// 会员用户
|
||||||
|
userInfo.setUserType(2);
|
||||||
|
userInfo.setUserTypeDesc("会员");
|
||||||
|
userInfo.setMemberId(loginUser.getUserId());
|
||||||
|
userInfo.setAccountId(loginUser.getUserId());
|
||||||
|
} else if ("tenant".equalsIgnoreCase(userType) || "1".equals(userType)) {
|
||||||
|
// 租户用户
|
||||||
|
userInfo.setUserType(1);
|
||||||
|
userInfo.setUserTypeDesc("租户");
|
||||||
|
userInfo.setTenantId(loginUser.getUserId());
|
||||||
|
userInfo.setAccountId(loginUser.getUserId());
|
||||||
|
} else {
|
||||||
|
// 默认按会员处理
|
||||||
|
userInfo.setUserType(2);
|
||||||
|
userInfo.setUserTypeDesc("会员");
|
||||||
|
userInfo.setMemberId(loginUser.getUserId());
|
||||||
|
userInfo.setAccountId(loginUser.getUserId());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 如果没有用户类型信息,默认按会员处理
|
||||||
|
userInfo.setUserType(2);
|
||||||
|
userInfo.setUserTypeDesc("会员");
|
||||||
|
userInfo.setMemberId(loginUser.getUserId());
|
||||||
|
userInfo.setAccountId(loginUser.getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
|
return userInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断当前用户是否为会员
|
||||||
|
*/
|
||||||
|
public static boolean isMember() {
|
||||||
|
UserInfo userInfo = getCurrentUserInfo();
|
||||||
|
return userInfo.getUserType() == 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断当前用户是否为租户
|
||||||
|
*/
|
||||||
|
public static boolean isTenant() {
|
||||||
|
UserInfo userInfo = getCurrentUserInfo();
|
||||||
|
return userInfo.getUserType() == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前用户的会员ID(如果是会员)
|
||||||
|
*/
|
||||||
|
public static Long getCurrentMemberId() {
|
||||||
|
UserInfo userInfo = getCurrentUserInfo();
|
||||||
|
if (userInfo.getUserType() != 2) {
|
||||||
|
throw new RuntimeException("当前用户不是会员");
|
||||||
|
}
|
||||||
|
return userInfo.getMemberId();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前用户的租户ID(如果是租户)
|
||||||
|
*/
|
||||||
|
public static Long getCurrentTenantId() {
|
||||||
|
UserInfo userInfo = getCurrentUserInfo();
|
||||||
|
if (userInfo.getUserType() != 1) {
|
||||||
|
throw new RuntimeException("当前用户不是租户");
|
||||||
|
}
|
||||||
|
return userInfo.getTenantId();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前用户的账户ID
|
||||||
|
*/
|
||||||
|
public static Long getCurrentAccountId() {
|
||||||
|
UserInfo userInfo = getCurrentUserInfo();
|
||||||
|
return userInfo.getAccountId();
|
||||||
|
}
|
||||||
|
}
|
@ -82,17 +82,22 @@ public class CommissionSectionController {
|
|||||||
return R.ok(true);
|
return R.ok(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 批量新增分成比例区间 */
|
/** 批量新增或修改分成比例区间 */
|
||||||
@Operation(summary = "批量新增分成比例区间")
|
@Operation(summary = "批量新增或修改分成比例区间")
|
||||||
@Log(title = "分成比例区间", businessType = BusinessType.INSERT)
|
@Log(title = "分成比例区间", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/batch")
|
@PostMapping("/batch")
|
||||||
public R<Boolean> batchAdd(@RequestBody CommissionSectionBatchAddDTO dto) {
|
public R<Boolean> batchAddOrUpdate(@RequestBody CommissionSectionBatchAddDTO dto) {
|
||||||
// 反序列化字符串为List<CommissionSectionBo>
|
// 反序列化字符串为List<CommissionSectionBo>
|
||||||
List<CommissionSectionBo> list = cn.hutool.json.JSONUtil.toList(dto.getTemplateList(), CommissionSectionBo.class);
|
List<CommissionSectionBo> list = cn.hutool.json.JSONUtil.toList(dto.getTemplateList(), CommissionSectionBo.class);
|
||||||
// 给每个bo设置templateId
|
// 给每个bo设置templateId
|
||||||
for (CommissionSectionBo bo : list) {
|
for (CommissionSectionBo bo : list) {
|
||||||
bo.setTemplateId(dto.getTemplateId());
|
bo.setTemplateId(dto.getTemplateId());
|
||||||
commissionSectionService.insertByBo(bo);
|
// 判断是否有ID,有ID则修改,没有ID则新增
|
||||||
|
if (bo.getId() != null) {
|
||||||
|
commissionSectionService.updateByBo(bo);
|
||||||
|
} else {
|
||||||
|
commissionSectionService.insertByBo(bo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return R.ok(true);
|
return R.ok(true);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ import java.time.LocalDateTime;
|
|||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName("commission_rate_range")
|
@TableName("sys_commission_rate_range")
|
||||||
@Schema(name = "CommissionSection", description = "分成比例区间表")
|
@Schema(name = "CommissionSection", description = "分成比例区间表")
|
||||||
public class CommissionSection extends BaseAudit {
|
public class CommissionSection extends BaseAudit {
|
||||||
/** 主键,自增ID */
|
/** 主键,自增ID */
|
||||||
|
@ -19,7 +19,7 @@ import java.time.LocalDateTime;
|
|||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName("commission_template")
|
@TableName("sys_commission_template")
|
||||||
@Schema(name = "CommissionTemplate", description = "分成比例模板表")
|
@Schema(name = "CommissionTemplate", description = "分成比例模板表")
|
||||||
public class CommissionTemplate extends BaseAudit {
|
public class CommissionTemplate extends BaseAudit {
|
||||||
/** 主键,自增ID */
|
/** 主键,自增ID */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user