Forráskód Böngészése

1、数据权限分级:总后台可查看所有数据,销售端只能看到归属客户的数据
直播数据、核销数据(发送、领取、使用状态、核销人、核销时间、手动核销),直播记录(参考看课记录)

yys 1 hete
szülő
commit
abc9c43f41

+ 7 - 2
fs-admin/src/main/java/com/fs/live/controller/LiveAfterSalesController.java

@@ -78,8 +78,13 @@ public class LiveAfterSalesController extends BaseController
         if(liveAfterSales==null) return R.error("售后记录不存在");
         List<LiveAfterSalesItem> list = liveAfterSalesItemService.selectLiveAfterSalesItemByAfterId(id);
         List<LiveAfterSalesLogs> logList = liveAfterSalesLogsService.selectLiveAfterSalesLogsByAfterId(id);
-        FsUser user=userService.selectFsUserById(liveAfterSales.getUserId());
-        user.setPhone(ParseUtils.parsePhone(user.getPhone()));
+        FsUser user = null;
+        if (liveAfterSales.getUserId() != null) {
+            user = userService.selectFsUserById(liveAfterSales.getUserId());
+            if (user != null) {
+                user.setPhone(ParseUtils.parsePhone(user.getPhone()));
+            }
+        }
         LiveOrder liveOrder = orderService.selectLiveOrderByOrderId(String.valueOf(liveAfterSales.getOrderId()));
         return R.ok().put("afterSales",liveAfterSales).put("items",list).put("logs",logList).put("user",user).put("order",liveOrder);
 

+ 105 - 0
fs-admin/src/main/java/com/fs/live/controller/LiveWatchLogController.java

@@ -0,0 +1,105 @@
+package com.fs.live.controller;
+
+import java.util.List;
+
+import com.fs.live.vo.LiveWatchLogListVO;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.live.domain.LiveWatchLog;
+import com.fs.live.service.ILiveWatchLogService;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 直播看课记录Controller(管理端,展示全部)
+ *
+ * @author fs
+ * @date 2026-07-20
+ */
+@RestController
+@RequestMapping("/live/liveWatchLog")
+public class LiveWatchLogController extends BaseController
+{
+    @Autowired
+    private ILiveWatchLogService liveWatchLogService;
+
+    /**
+     * 查询直播看课记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('live:liveWatchLog:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(LiveWatchLog liveWatchLog)
+    {
+        startPage();
+        List<LiveWatchLogListVO> list = liveWatchLogService.selectLiveWatchLogListInfo(liveWatchLog);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出直播看课记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('live:liveWatchLog:export')")
+    @Log(title = "直播看课记录", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(LiveWatchLog liveWatchLog)
+    {
+        List<LiveWatchLogListVO> list = liveWatchLogService.selectLiveWatchLogListInfo(liveWatchLog);
+        ExcelUtil<LiveWatchLogListVO> util = new ExcelUtil<LiveWatchLogListVO>(LiveWatchLogListVO.class);
+        return util.exportExcel(list, "直播看课记录数据");
+    }
+
+    /**
+     * 获取直播看课记录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('live:liveWatchLog:query')")
+    @GetMapping(value = "/{logId}")
+    public AjaxResult getInfo(@PathVariable("logId") Long logId)
+    {
+        return AjaxResult.success(liveWatchLogService.selectLiveWatchLogByLogId(logId));
+    }
+
+    /**
+     * 新增直播看课记录
+     */
+    @PreAuthorize("@ss.hasPermi('live:liveWatchLog:add')")
+    @Log(title = "直播看课记录", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody LiveWatchLog liveWatchLog)
+    {
+        return toAjax(liveWatchLogService.insertLiveWatchLog(liveWatchLog));
+    }
+
+    /**
+     * 修改直播看课记录
+     */
+    @PreAuthorize("@ss.hasPermi('live:liveWatchLog:edit')")
+    @Log(title = "直播看课记录", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody LiveWatchLog liveWatchLog)
+    {
+        return toAjax(liveWatchLogService.updateLiveWatchLog(liveWatchLog));
+    }
+
+    /**
+     * 删除直播看课记录
+     */
+    @PreAuthorize("@ss.hasPermi('live:liveWatchLog:remove')")
+    @Log(title = "直播看课记录", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{logIds}")
+    public AjaxResult remove(@PathVariable Long[] logIds)
+    {
+        return toAjax(liveWatchLogService.deleteLiveWatchLogByLogIds(logIds));
+    }
+}

+ 7 - 2
fs-company/src/main/java/com/fs/company/controller/live/LiveAfterSalesController.java

@@ -101,8 +101,13 @@ public class LiveAfterSalesController extends BaseController
         if(liveAfterSales==null) return R.error("售后记录不存在");
         List<LiveAfterSalesItem> list = liveAfterSalesItemService.selectLiveAfterSalesItemByAfterId(id);
         List<LiveAfterSalesLogs> logList = liveAfterSalesLogsService.selectLiveAfterSalesLogsByAfterId(id);
-        FsUser user=userService.selectFsUserById(liveAfterSales.getUserId());
-        user.setPhone(ParseUtils.parsePhone(user.getPhone()));
+        FsUser user = null;
+        if (liveAfterSales.getUserId() != null) {
+            user = userService.selectFsUserById(liveAfterSales.getUserId());
+            if (user != null) {
+                user.setPhone(ParseUtils.parsePhone(user.getPhone()));
+            }
+        }
         LiveOrder liveOrder = orderService.selectLiveOrderByOrderId(String.valueOf(liveAfterSales.getOrderId()));
         return R.ok().put("afterSales",liveAfterSales).put("items",list).put("logs",logList).put("user",user).put("order",liveOrder);
 

+ 22 - 15
fs-company/src/main/java/com/fs/company/controller/live/LiveWatchLogController.java

@@ -2,10 +2,9 @@ package com.fs.company.controller.live;
 
 import java.util.List;
 
-import com.fs.common.core.domain.R;
-import com.fs.common.utils.ServletUtils;
+import com.fs.company.domain.CompanyUser;
 import com.fs.framework.security.LoginUser;
-import com.fs.framework.service.TokenService;
+import com.fs.framework.security.SecurityUtils;
 import com.fs.live.vo.LiveWatchLogListVO;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -38,39 +37,47 @@ public class LiveWatchLogController extends BaseController
 {
     @Autowired
     private ILiveWatchLogService liveWatchLogService;
-    @Autowired
-    private TokenService tokenService;
+
     /**
-     * 查询直播看课记录列表
+     * 查询直播看课记录列表(仅当前销售)
      */
     @PreAuthorize("@ss.hasPermi('live:liveWatchLog:list')")
     @GetMapping("/list")
     public TableDataInfo list(LiveWatchLog liveWatchLog)
     {
+        applyCurrentSalesScope(liveWatchLog);
         startPage();
-        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
-        if(null == loginUser) {
-           throw new RuntimeException("用户信息错误");
-        }
-        Long companyId = loginUser.getCompany().getCompanyId();
-        liveWatchLog.setCompanyId(companyId);
         List<LiveWatchLogListVO> list = liveWatchLogService.selectLiveWatchLogListInfo(liveWatchLog);
         return getDataTable(list);
     }
 
     /**
-     * 导出直播看课记录列表
+     * 导出直播看课记录列表(仅当前销售)
      */
     @PreAuthorize("@ss.hasPermi('live:liveWatchLog:export')")
     @Log(title = "直播看课记录", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(LiveWatchLog liveWatchLog)
     {
-        List<LiveWatchLog> list = liveWatchLogService.selectLiveWatchLogList(liveWatchLog);
-        ExcelUtil<LiveWatchLog> util = new ExcelUtil<LiveWatchLog>(LiveWatchLog.class);
+        applyCurrentSalesScope(liveWatchLog);
+        List<LiveWatchLogListVO> list = liveWatchLogService.selectLiveWatchLogListInfo(liveWatchLog);
+        ExcelUtil<LiveWatchLogListVO> util = new ExcelUtil<LiveWatchLogListVO>(LiveWatchLogListVO.class);
         return util.exportExcel(list, "直播看课记录数据");
     }
 
+    /**
+     * 公司端仅展示当前登录销售数据
+     */
+    private void applyCurrentSalesScope(LiveWatchLog liveWatchLog) {
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        if (loginUser == null || loginUser.getUser() == null || loginUser.getCompany() == null) {
+            throw new RuntimeException("用户信息错误");
+        }
+        CompanyUser user = loginUser.getUser();
+        liveWatchLog.setCompanyId(loginUser.getCompany().getCompanyId());
+        liveWatchLog.setCompanyUserId(user.getUserId());
+    }
+
     /**
      * 获取直播看课记录详细信息
      */

+ 6 - 0
fs-service/src/main/java/com/fs/live/vo/LiveWatchLogListVO.java

@@ -111,6 +111,12 @@ public class LiveWatchLogListVO {
      */
     private String companyUserName;
 
+    /**
+     * 公司名称
+     */
+    @Excel(name = "公司名称")
+    private String companyName;
+
     /**
      * 企微用户
      */

+ 2 - 0
fs-service/src/main/resources/mapper/live/LiveWatchLogMapper.xml

@@ -225,6 +225,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         t4.avatar as qwExternalAvatar,
         t5.nick_name as companyUserName,
         t6.qw_user_name,
+        t7.company_name as companyName,
         t1.*
         from live_watch_log t1
         left join fs_user t2 on t1.user_id = t2.user_id
@@ -232,6 +233,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         left join qw_external_contact t4 on t4.id = t1.external_contact_id
         left join company_user t5 on t5.user_id = t1.company_user_id
         left join qw_user t6 on t6.id = t1.qw_user_id
+        left join company t7 on t7.company_id = t1.company_id
         <where>
             <if test="userId != null "> and t1.user_id = #{userId}</if>
             <if test="liveId != null "> and t1.live_id = #{liveId}</if>