Переглянути джерело

1、总后台红包信息,核销卷信息,优惠卷信息进行展示

yys 3 днів тому
батько
коміт
ff559cb12b

+ 17 - 0
fs-admin/src/main/java/com/fs/live/controller/LiveDataController.java

@@ -12,7 +12,9 @@ import com.fs.company.domain.CompanyUser;
 import com.fs.framework.web.service.TokenService;
 import com.fs.live.domain.LiveData;
 import com.fs.live.param.LiveDataParam;
+import com.fs.live.service.ILiveConsoleOpLogService;
 import com.fs.live.service.ILiveDataService;
+import com.fs.live.vo.LiveUserClaimRecordVo;
 import com.fs.live.vo.LiveUserFirstVo;
 import com.fs.live.vo.LiveUserDetailExportVO;
 import com.github.pagehelper.PageHelper;
@@ -33,6 +35,8 @@ public class LiveDataController extends BaseController {
     private ILiveDataService liveDataService;
     @Autowired
     private TokenService tokenService;
+    @Autowired
+    private ILiveConsoleOpLogService liveConsoleOpLogService;
 
     /**
      * 直播数据页面卡片数据
@@ -190,4 +194,17 @@ public class LiveDataController extends BaseController {
         return util.exportExcel(list, "直播间用户详情数据");
     }
 
+    /**
+     * 查询用户在指定直播间的领取记录(已领取;券类含核销状态)
+     * @param liveId 直播间ID
+     * @param userId 用户ID
+     * @return 领取记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('liveData:liveData:query')")
+    @GetMapping("/getUserClaimRecords")
+    public R getUserClaimRecords(@RequestParam Long liveId, @RequestParam Long userId) {
+        List<LiveUserClaimRecordVo> records = liveConsoleOpLogService.listUserClaimRecords(liveId, userId);
+        return R.ok().put("data", records != null ? records : java.util.Collections.emptyList());
+    }
+
 }

+ 7 - 0
fs-service/src/main/java/com/fs/live/service/ILiveConsoleOpLogService.java

@@ -4,6 +4,7 @@ import com.fs.live.domain.LiveConsoleOpLog;
 import com.fs.live.domain.LiveConsoleOpLogUser;
 import com.fs.live.domain.LiveCoupon;
 import com.fs.live.vo.LiveConsoleOpLogRecordVo;
+import com.fs.live.vo.LiveUserClaimRecordVo;
 
 import java.util.List;
 
@@ -53,6 +54,12 @@ public interface ILiveConsoleOpLogService {
      */
     List<LiveConsoleOpLogRecordVo> listUserOpLogRecords(Long liveId, Long userId);
 
+    /**
+     * 管理端:查询用户在指定直播间的已领取记录
+     * <p>领取判定与 {@link #listUserOpLogRecords} 一致;券类关联 live_coupon_user 返回核销状态(非领取状态)。</p>
+     */
+    List<LiveUserClaimRecordVo> listUserClaimRecords(Long liveId, Long userId);
+
     /**
      * 查询指定直播间某次优惠券发放对应的最新展示留存 ID
      */

+ 241 - 0
fs-service/src/main/java/com/fs/live/service/impl/LiveConsoleOpLogServiceImpl.java

@@ -25,6 +25,7 @@ import com.fs.live.service.ILiveLotteryConfService;
 import com.fs.live.service.ILiveRedConfService;
 import com.fs.live.utils.LiveCompletionConfigUtils;
 import com.fs.live.vo.LiveConsoleOpLogRecordVo;
+import com.fs.live.vo.LiveUserClaimRecordVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
@@ -768,4 +769,244 @@ public class LiveConsoleOpLogServiceImpl implements ILiveConsoleOpLogService {
         return StringUtils.isNotEmpty(typeLabel)
                 && (typeLabel.contains("核销") || typeLabel.contains("核销券"));
     }
+
+    /**
+     * 管理端已领取明细:与 App listUserOpLogRecords 同一套领取判定,券类再关联 live_coupon_user 核销状态。
+     */
+    @Override
+    public List<LiveUserClaimRecordVo> listUserClaimRecords(Long liveId, Long userId) {
+        List<LiveConsoleOpLogRecordVo> opRecords = listUserOpLogRecords(liveId, userId);
+        if (opRecords == null || opRecords.isEmpty()) {
+            return Collections.emptyList();
+        }
+        List<LiveConsoleOpLogRecordVo> claimed = opRecords.stream()
+                .filter(r -> r.getStatus() != null && r.getStatus() == LiveConsoleOpLogRecordVo.STATUS_CLAIMED)
+                .collect(Collectors.toList());
+        if (claimed.isEmpty()) {
+            return Collections.emptyList();
+        }
+
+        List<LiveConsoleOpLogUser> relations = liveConsoleOpLogUserMapper.selectByLiveIdAndUserId(liveId, userId);
+        Map<Long, List<Long>> couponUserIdsByOpLogId = buildCouponUserIdsByOpLogId(relations);
+        Map<Long, LiveCouponUser> couponUserMap = loadCouponUserMap(couponUserIdsByOpLogId);
+
+        List<LiveUserClaimRecordVo> result = new ArrayList<>();
+        for (LiveConsoleOpLogRecordVo opRecord : claimed) {
+            if (opRecord == null || opRecord.getOpType() == null) {
+                continue;
+            }
+            if (isCouponClaimOpType(opRecord.getOpType())) {
+                result.addAll(buildCouponClaimRows(opRecord, couponUserIdsByOpLogId, couponUserMap, liveId, userId));
+            } else {
+                result.add(buildNonCouponClaimRow(opRecord));
+            }
+        }
+        return result;
+    }
+
+    private boolean isCouponClaimOpType(int opType) {
+        return opType == LiveConsoleOpLog.OP_COUPON_SHOW
+                || opType == LiveConsoleOpLog.OP_VERIFY_COUPON_SHOW
+                || opType == LiveConsoleOpLog.OP_COMPLETION_COUPON
+                || opType == LiveConsoleOpLog.OP_WATCH_REWARD_COUPON;
+    }
+
+    private Map<Long, List<Long>> buildCouponUserIdsByOpLogId(List<LiveConsoleOpLogUser> relations) {
+        Map<Long, List<Long>> map = new HashMap<>();
+        if (relations == null || relations.isEmpty()) {
+            return map;
+        }
+        for (LiveConsoleOpLogUser relation : relations) {
+            if (relation == null || relation.getOpLogId() == null || relation.getCouponUserId() == null) {
+                continue;
+            }
+            map.computeIfAbsent(relation.getOpLogId(), key -> new ArrayList<>()).add(relation.getCouponUserId());
+        }
+        return map;
+    }
+
+    private Map<Long, LiveCouponUser> loadCouponUserMap(Map<Long, List<Long>> couponUserIdsByOpLogId) {
+        Map<Long, LiveCouponUser> map = new HashMap<>();
+        if (couponUserIdsByOpLogId == null || couponUserIdsByOpLogId.isEmpty()) {
+            return map;
+        }
+        List<Long> ids = couponUserIdsByOpLogId.values().stream()
+                .filter(Objects::nonNull)
+                .flatMap(List::stream)
+                .filter(Objects::nonNull)
+                .distinct()
+                .collect(Collectors.toList());
+        if (ids.isEmpty()) {
+            return map;
+        }
+        // 详情查询带核销人姓名,与优惠券用户列表页一致
+        List<com.fs.live.vo.LiveCouponUserDetailVo> details =
+                liveCouponUserService.selectLiveCouponUserDetailByIds(ids);
+        if (details == null || details.isEmpty()) {
+            return map;
+        }
+        for (com.fs.live.vo.LiveCouponUserDetailVo detail : details) {
+            if (detail == null || detail.getId() == null) {
+                continue;
+            }
+            LiveCouponUser couponUser = new LiveCouponUser();
+            couponUser.setId(detail.getId());
+            couponUser.setCouponId(detail.getCouponId());
+            couponUser.setUserId(detail.getUserId());
+            couponUser.setCouponTitle(detail.getCouponTitle());
+            couponUser.setCouponPrice(detail.getCouponPrice());
+            couponUser.setCreateTime(detail.getCreateTime());
+            couponUser.setUseTime(detail.getUseTime());
+            couponUser.setStatus(detail.getStatus());
+            couponUser.setVerifyTime(detail.getVerifyTime());
+            couponUser.setVerifyUserId(detail.getVerifyUserId());
+            couponUser.setVerifyUserName(detail.getVerifyUserName());
+            couponUser.setIsDel(0);
+            map.put(detail.getId(), couponUser);
+        }
+        return map;
+    }
+
+    private LiveUserClaimRecordVo buildNonCouponClaimRow(LiveConsoleOpLogRecordVo opRecord) {
+        LiveUserClaimRecordVo vo = new LiveUserClaimRecordVo();
+        vo.setOpLogId(opRecord.getId());
+        vo.setOpType(opRecord.getOpType());
+        vo.setOpTypeName(LiveUserClaimRecordVo.resolveOpTypeName(opRecord.getOpType()));
+        vo.setBizId(opRecord.getBizId());
+        vo.setBizName(opRecord.getBizName());
+        vo.setCreateTime(opRecord.getCreateTime());
+        vo.setCouponCount(opRecord.getCouponCount() != null && opRecord.getCouponCount() > 0
+                ? opRecord.getCouponCount() : 1);
+        return vo;
+    }
+
+    /**
+     * 券类按 live_coupon_user 展开为多行,保证核销状态与领取明细一致;无绑定记录时兜底查本场领取券。
+     */
+    private List<LiveUserClaimRecordVo> buildCouponClaimRows(LiveConsoleOpLogRecordVo opRecord,
+                                                            Map<Long, List<Long>> couponUserIdsByOpLogId,
+                                                            Map<Long, LiveCouponUser> couponUserMap,
+                                                            Long liveId, Long userId) {
+        List<LiveCouponUser> couponUsers = resolveCouponUsersForClaim(
+                opRecord, couponUserIdsByOpLogId, couponUserMap, liveId, userId);
+        if (couponUsers.isEmpty()) {
+            // 已判定领取但暂无券明细时,仍返回留存行,核销状态留空
+            LiveUserClaimRecordVo vo = buildNonCouponClaimRow(opRecord);
+            return Collections.singletonList(vo);
+        }
+        List<LiveUserClaimRecordVo> rows = new ArrayList<>(couponUsers.size());
+        for (LiveCouponUser couponUser : couponUsers) {
+            LiveUserClaimRecordVo vo = new LiveUserClaimRecordVo();
+            vo.setOpLogId(opRecord.getId());
+            vo.setOpType(opRecord.getOpType());
+            vo.setOpTypeName(LiveUserClaimRecordVo.resolveOpTypeName(opRecord.getOpType()));
+            vo.setBizId(opRecord.getBizId());
+            vo.setBizName(StringUtils.isNotEmpty(couponUser.getCouponTitle())
+                    ? couponUser.getCouponTitle() : opRecord.getBizName());
+            vo.setCreateTime(couponUser.getCreateTime() != null
+                    ? couponUser.getCreateTime() : opRecord.getCreateTime());
+            vo.setCouponCount(1);
+            vo.setCouponUserId(couponUser.getId());
+            vo.setCouponPrice(couponUser.getCouponPrice());
+            vo.setVerifyStatus(couponUser.getStatus());
+            vo.setVerifyStatusName(LiveUserClaimRecordVo.resolveVerifyStatusName(couponUser.getStatus()));
+            vo.setVerifyTime(couponUser.getVerifyTime() != null
+                    ? couponUser.getVerifyTime() : couponUser.getUseTime());
+            vo.setVerifyUserName(couponUser.getVerifyUserName());
+            rows.add(vo);
+        }
+        return rows;
+    }
+
+    private List<LiveCouponUser> resolveCouponUsersForClaim(LiveConsoleOpLogRecordVo opRecord,
+                                                           Map<Long, List<Long>> couponUserIdsByOpLogId,
+                                                           Map<Long, LiveCouponUser> couponUserMap,
+                                                           Long liveId, Long userId) {
+        List<LiveCouponUser> result = new ArrayList<>();
+        List<Long> boundIds = couponUserIdsByOpLogId != null
+                ? couponUserIdsByOpLogId.get(opRecord.getId()) : null;
+        if (boundIds != null && !boundIds.isEmpty()) {
+            for (Long id : boundIds) {
+                LiveCouponUser couponUser = couponUserMap.get(id);
+                if (couponUser == null) {
+                    com.fs.live.vo.LiveCouponUserDetailVo detail =
+                            liveCouponUserService.selectLiveCouponUserDetailById(id);
+                    if (detail != null) {
+                        couponUser = new LiveCouponUser();
+                        couponUser.setId(detail.getId());
+                        couponUser.setCouponId(detail.getCouponId());
+                        couponUser.setUserId(detail.getUserId());
+                        couponUser.setCouponTitle(detail.getCouponTitle());
+                        couponUser.setCouponPrice(detail.getCouponPrice());
+                        couponUser.setCreateTime(detail.getCreateTime());
+                        couponUser.setUseTime(detail.getUseTime());
+                        couponUser.setStatus(detail.getStatus());
+                        couponUser.setVerifyTime(detail.getVerifyTime());
+                        couponUser.setVerifyUserId(detail.getVerifyUserId());
+                        couponUser.setVerifyUserName(detail.getVerifyUserName());
+                        couponUser.setIsDel(0);
+                    }
+                }
+                if (couponUser != null && (couponUser.getIsDel() == null || couponUser.getIsDel() == 0)) {
+                    result.add(couponUser);
+                }
+            }
+            if (!result.isEmpty()) {
+                return result;
+            }
+        }
+        // 兜底:与 listUserOpLogRecords 一致,按本场 type + couponId 对齐领取券
+        return loadFallbackCouponUsers(opRecord, liveId, userId);
+    }
+
+    private List<LiveCouponUser> loadFallbackCouponUsers(LiveConsoleOpLogRecordVo opRecord,
+                                                        Long liveId, Long userId) {
+        if (opRecord == null || opRecord.getOpType() == null || userId == null) {
+            return Collections.emptyList();
+        }
+        String type = resolveCouponUserType(opRecord.getOpType(), liveId);
+        if (StringUtils.isEmpty(type)) {
+            return Collections.emptyList();
+        }
+        Long couponId = resolveCouponIdForOpRecord(opRecord);
+        LiveCouponUser query = new LiveCouponUser();
+        query.setUserId(userId.intValue());
+        query.setType(type);
+        query.setIsDel(0);
+        if (couponId != null) {
+            query.setCouponId(couponId);
+        }
+        List<LiveCouponUser> list = liveCouponUserService.selectLiveCouponUserList(query);
+        return list != null ? list : Collections.emptyList();
+    }
+
+    private String resolveCouponUserType(int opType, Long liveId) {
+        if (liveId == null) {
+            return null;
+        }
+        if (opType == LiveConsoleOpLog.OP_COUPON_SHOW || opType == LiveConsoleOpLog.OP_VERIFY_COUPON_SHOW) {
+            return LIVE_COUPON_USER_TYPE_PREFIX + liveId;
+        }
+        if (opType == LiveConsoleOpLog.OP_COMPLETION_COUPON) {
+            return COMPLETION_COUPON_USER_TYPE_PREFIX + liveId;
+        }
+        // 观看奖励优惠券 type 无直播间维度,不做跨场兜底
+        return null;
+    }
+
+    private Long resolveCouponIdForOpRecord(LiveConsoleOpLogRecordVo opRecord) {
+        if (opRecord == null || opRecord.getOpType() == null || opRecord.getBizId() == null) {
+            return null;
+        }
+        int opType = opRecord.getOpType();
+        if (opType == LiveConsoleOpLog.OP_COMPLETION_COUPON
+                || opType == LiveConsoleOpLog.OP_WATCH_REWARD_COUPON) {
+            return opRecord.getBizId();
+        }
+        if (opType == LiveConsoleOpLog.OP_COUPON_SHOW || opType == LiveConsoleOpLog.OP_VERIFY_COUPON_SHOW) {
+            LiveCouponIssue issue = liveCouponIssueService.selectLiveCouponIssueById(opRecord.getBizId());
+            return issue != null ? issue.getCouponId() : null;
+        }
+        return null;
+    }
 }

+ 2 - 20
fs-service/src/main/java/com/fs/live/service/impl/LiveDataServiceImpl.java

@@ -1181,25 +1181,7 @@ public class LiveDataServiceImpl implements ILiveDataService {
             // 公司和销售信息
             exportVO.setCompanyName(userDetail.getCompanyName());
             exportVO.setSalesName(userDetail.getSalesName());
-
-            if(userDetail.getSignTime1()!=null){
-                exportVO.setSignFirst("已打卡");
-            }else {
-                exportVO.setSignFirst("未打卡");
-            }
-
-            if(userDetail.getSignTime2()!=null){
-                exportVO.setSignSecond("已打卡");
-            }else {
-                exportVO.setSignSecond("未打卡");
-            }
-
-            if(userDetail.getSignTime3()!=null){
-                exportVO.setSignThird("已打卡");
-            }else {
-                exportVO.setSignThird("未打卡");
-            }
-
+            exportVO.setLiveBelongName(userDetail.getLiveBelongName());
 
             exportList.add(exportVO);
         }
@@ -1246,7 +1228,7 @@ public class LiveDataServiceImpl implements ILiveDataService {
             // 公司和销售信息
             exportVO.setCompanyName(userDetail.getCompanyName());
             exportVO.setSalesName(userDetail.getSalesName());
-
+            exportVO.setLiveBelongName(userDetail.getLiveBelongName());
 
             exportList.add(exportVO);
         }

+ 101 - 0
fs-service/src/main/java/com/fs/live/vo/LiveUserClaimRecordVo.java

@@ -0,0 +1,101 @@
+package com.fs.live.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 管理端:用户在指定直播间的已领取记录
+ * <p>基于中控留存领取判定(与 App 直播领取一致),券类额外关联 live_coupon_user 核销状态。</p>
+ */
+@Data
+public class LiveUserClaimRecordVo {
+
+    /** 留存记录ID */
+    private Long opLogId;
+
+    /** 操作类型(同 LiveConsoleOpLog.opType) */
+    private Integer opType;
+
+    /** 领取类型名称 */
+    private String opTypeName;
+
+    /** 业务ID */
+    private Long bizId;
+
+    /** 名称(券标题/红包名等) */
+    private String bizName;
+
+    /** 领取时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    /** 领取数量(一条留存多张券时) */
+    private Integer couponCount;
+
+    /** 用户优惠券记录ID(券类才有) */
+    private Long couponUserId;
+
+    /** 券面值(券类才有) */
+    private BigDecimal couponPrice;
+
+    /**
+     * 核销状态(券类才有):0未核销 1已核销 2已过期
+     * <p>与 live_coupon_user.status 一致,非领取状态。</p>
+     */
+    private Integer verifyStatus;
+
+    /** 核销状态名称 */
+    private String verifyStatusName;
+
+    /** 核销时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date verifyTime;
+
+    /** 核销人 */
+    private String verifyUserName;
+
+    public static String resolveOpTypeName(Integer opType) {
+        if (opType == null) {
+            return "未知";
+        }
+        switch (opType) {
+            case 1:
+                return "优惠券";
+            case 2:
+                return "核销券";
+            case 5:
+                return "红包";
+            case 6:
+                return "抽奖";
+            case 7:
+                return "完课积分";
+            case 8:
+                return "完课优惠券";
+            case 9:
+                return "观看奖励积分";
+            case 10:
+                return "观看奖励优惠券";
+            case 11:
+                return "签到红包";
+            default:
+                return "类型" + opType;
+        }
+    }
+
+    public static String resolveVerifyStatusName(Integer status) {
+        if (status == null) {
+            return null;
+        }
+        switch (status) {
+            case 1:
+                return "已核销";
+            case 2:
+                return "已过期";
+            default:
+                return "未核销";
+        }
+    }
+}

+ 4 - 16
fs-service/src/main/java/com/fs/live/vo/LiveUserDetailExportVO.java

@@ -16,15 +16,6 @@ public class LiveUserDetailExportVO {
     @Excel(name = "用户ID")
     private Long userId;
 
-    @Excel(name = "打卡1")
-    private String signFirst;
-
-    @Excel(name = "打卡2")
-    private String signSecond;
-
-    @Excel(name = "打卡3")
-    private String signThird;
-
     /** 用户名称 */
     @Excel(name = "用户名称")
     private String userName;
@@ -37,10 +28,6 @@ public class LiveUserDetailExportVO {
     @Excel(name = "回放观看时长(分钟)")
     private String playbackWatchDuration;
 
-//    /** 总观看时长(分钟) */
-//    @Excel(name = "总观看时长(分钟)")
-//    private String totalWatchDuration;
-
     /** 订单数 */
     @Excel(name = "订单数")
     private Integer orderCount;
@@ -49,6 +36,10 @@ public class LiveUserDetailExportVO {
     @Excel(name = "订单金额(元)")
     private String orderAmount;
 
+    /** 直播归属销售 */
+    @Excel(name = "直播归属")
+    private String liveBelongName;
+
     /** 销售 */
     @Excel(name = "邀请销售")
     private String salesName;
@@ -57,10 +48,7 @@ public class LiveUserDetailExportVO {
     @Excel(name = "销售公司")
     private String companyName;
 
-
-
     /** 是否完课 */
-//    @Excel(name = "是否完课")
     private String isCompleted;
 
 }

+ 4 - 1
fs-service/src/main/java/com/fs/live/vo/LiveUserDetailVo.java

@@ -37,7 +37,10 @@ public class LiveUserDetailVo {
     /** 分公司的销售是谁 */
     private String salesName;
 
-    // 签到时间
+    /** 直播归属销售(fs_user.bind_company_user_id) */
+    private String liveBelongName;
+
+    // 签到时间(兼容旧 SQL,页面不再展示)
     private Date signTime1;
     private Date signTime2;
     private Date signTime3;

+ 21 - 7
fs-service/src/main/resources/mapper/live/LiveDataMapper.xml

@@ -539,8 +539,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             COALESCE(SUM(CASE WHEN lwu.live_flag = 0 AND lwu.replay_flag = 1 THEN lwu.online_seconds ELSE 0 END), 0) AS playbackWatchDuration,
             COALESCE(order_info.orderCount, 0) AS orderCount,
             COALESCE(order_info.orderAmount, 0) AS orderAmount,
-            COALESCE(c.company_name, '') AS companyName,
-            COALESCE(cu.user_name, '') AS salesName
+            COALESCE(c.company_name, cu_company.company_name, '') AS companyName,
+            COALESCE(cu.nick_name, cu.user_name, '') AS salesName,
+            CASE
+                WHEN bind_cu.user_id IS NULL THEN ''
+                ELSE CONCAT_WS('-', COALESCE(bind_cu.nick_name, bind_cu.user_name, ''), bind_cu.user_id)
+            END AS liveBelongName
         FROM live_watch_user lwu
         LEFT JOIN fs_user u ON lwu.user_id = u.user_id
         LEFT JOIN (
@@ -552,9 +556,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             WHERE live_id = #{liveId} AND user_id IS NOT NULL AND user_id != ''
             GROUP BY user_id
         ) order_info ON lwu.user_id = order_info.user_id
-        left join live_user_first_entry lufe on lwu.live_id = lufe.live_id and lwu.user_id = lufe.user_id
-        LEFT JOIN company c ON lufe.company_id = c.company_id
+        LEFT JOIN live_user_first_entry lufe ON lwu.live_id = lufe.live_id AND lwu.user_id = lufe.user_id
         LEFT JOIN company_user cu ON lufe.company_user_id = cu.user_id
+        LEFT JOIN company c ON lufe.company_id = c.company_id
+        LEFT JOIN company cu_company ON cu.company_id = cu_company.company_id
+        LEFT JOIN company_user bind_cu ON u.bind_company_user_id = bind_cu.user_id
         WHERE lwu.live_id = #{liveId}
         <if test="companyId != null">
             and lufe.company_id = #{companyId}
@@ -562,7 +568,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="companyUserId != null">
             and lufe.company_user_id = #{companyUserId}
         </if>
-        GROUP BY u.user_id, u.nick_name, u.nickname, order_info.orderCount, order_info.orderAmount, c.company_name, cu.user_name
+        GROUP BY u.user_id, u.nick_name, u.nickname, order_info.orderCount, order_info.orderAmount,
+                 c.company_name, cu_company.company_name, cu.nick_name, cu.user_name,
+                 bind_cu.user_id, bind_cu.nick_name, bind_cu.user_name
         ORDER BY order_info.orderAmount DESC, liveWatchDuration DESC
     </select>
     <select id="selectLiveUserDetailListBySqlNew" resultType="com.fs.live.vo.LiveUserDetailVo">
@@ -573,8 +581,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             COALESCE(SUM(CASE WHEN lwu.live_flag = 0 AND lwu.replay_flag = 1 THEN lwu.online_seconds ELSE 0 END), 0) AS playbackWatchDuration,
             COALESCE(MAX(order_info.orderCount), 0) AS orderCount,
             COALESCE(MAX(order_info.orderAmount), 0) AS orderAmount,
-            COALESCE(MAX(c.company_name), '') AS companyName,
-            COALESCE(MAX(cu.user_name), '') AS salesName,
+            COALESCE(MAX(c.company_name), MAX(cu_company.company_name), '') AS companyName,
+            COALESCE(MAX(cu.nick_name), MAX(cu.user_name), '') AS salesName,
+            CASE
+                WHEN MAX(bind_cu.user_id) IS NULL THEN ''
+                ELSE CONCAT_WS('-', COALESCE(MAX(bind_cu.nick_name), MAX(bind_cu.user_name), ''), MAX(bind_cu.user_id))
+            END AS liveBelongName,
             MAX(sign_info.signTime1) AS signTime1,
             MAX(sign_info.signTime2) AS signTime2,
             MAX(sign_info.signTime3) AS signTime3
@@ -601,6 +613,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             )
                  LEFT JOIN company c ON fucu.company_id = c.company_id
                  LEFT JOIN company_user cu ON fucu.company_user_id = cu.user_id
+                 LEFT JOIN company cu_company ON cu.company_id = cu_company.company_id
+                 LEFT JOIN company_user bind_cu ON u.bind_company_user_id = bind_cu.user_id
                  LEFT JOIN (
             SELECT
                 user_id,