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

直播代码 业绩归属和初次化链接

yuhongqi 1 hónapja
szülő
commit
1dc4721c62

+ 40 - 0
fs-company/src/main/java/com/fs/company/controller/live/LiveProfitController.java

@@ -0,0 +1,40 @@
+package com.fs.company.controller.live;
+
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.R;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.live.service.ILiveUserFirstEntryService;
+import com.fs.live.vo.LiveUserFirstProfit;
+import org.checkerframework.checker.units.qual.A;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
+import java.util.List;
+
+import static com.github.pagehelper.page.PageMethod.startPage;
+
+/**
+ * 业绩归属控制类Controller
+ *
+ * @author fs
+ * @date 2025-09-08
+ */
+@RestController
+@RequestMapping("/live/liveProfit")
+public class LiveProfitController extends BaseController {
+
+    @Autowired
+    private ILiveUserFirstEntryService liveUserFirstEntryService;
+
+    @GetMapping("/list")
+    public TableDataInfo list() {
+        startPage();
+        List<LiveUserFirstProfit> list = liveUserFirstEntryService.selectLiveProfitList();
+        return getDataTable(list);
+    }
+
+}

+ 3 - 3
fs-live-app/src/main/java/com/fs/app/controller/LiveController.java

@@ -79,7 +79,7 @@ public class LiveController extends AppBaseController {
 		return R.ok().put("data", vo);
 	}
 
-	@Login
+//	@Login
 	@ApiOperation("直播间")
 	@GetMapping("/live")
 	@ApiResponse(code = 200, message = "", response = LiveVo.class)
@@ -102,7 +102,7 @@ public class LiveController extends AppBaseController {
 		return R.ok().put("data", liveVo).put("storeId", storeId);
 	}
 
-	@Login
+//	@Login
 	@ApiOperation("直播间列表")
 	@GetMapping("/liveList")
 	@ApiResponse(code = 200, message = "", response = LiveInfoVo.class)
@@ -123,7 +123,7 @@ public class LiveController extends AppBaseController {
 
 
 
-	@Login
+//	@Login
 	@ApiOperation("聊天记录(最新30条)")
 	@GetMapping("/msgList")
 	@ApiResponse(code = 200, message = "", response = LiveInfoVo.class)

+ 8 - 2
fs-live-app/src/main/java/com/fs/app/websocket/service/WebSocketServer.java

@@ -64,8 +64,14 @@ public class WebSocketServer {
         long liveId = (long) userProperties.get("liveId");
         long userId = (long) userProperties.get("userId");
         long userType = (long) userProperties.get("userType");
-        long companyId = (long) userProperties.get("companyId");
-        long companyUserId = (long) userProperties.get("companyUserId");
+        long companyId = 0L;
+        long companyUserId = 0L;
+        if (!Objects.isNull(userProperties.get("companyId"))) {
+            companyId = (long) userProperties.get("companyId");
+        }
+        if (!Objects.isNull(userProperties.get("companyUserId"))) {
+            companyUserId = (long) userProperties.get("companyUserId");
+        }
 
         if (liveService.getById(liveId) == null) {
             throw new BaseException("未找到直播间");

+ 4 - 0
fs-service/src/main/java/com/fs/live/mapper/LiveUserFirstEntryMapper.java

@@ -4,6 +4,7 @@ import java.util.Date;
 import java.util.List;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.fs.live.domain.LiveUserFirstEntry;
+import com.fs.live.vo.LiveUserFirstProfit;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
@@ -64,4 +65,7 @@ public interface LiveUserFirstEntryMapper extends BaseMapper<LiveUserFirstEntry>
 
     @Select("select count(*) from live_user_first_entry where user_id=#{userId} and DATE(entry_date)=DATE(#{now})")
     int selectTodayEntry(@Param("userId") long userId,@Param("now") Date now);
+
+
+    List<LiveUserFirstProfit> selectLiveProfitList();
 }

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

@@ -3,6 +3,7 @@ package com.fs.live.service;
 import java.util.List;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fs.live.domain.LiveUserFirstEntry;
+import com.fs.live.vo.LiveUserFirstProfit;
 
 /**
  * 用户每日首次进入直播间记录Service接口
@@ -60,4 +61,9 @@ public interface ILiveUserFirstEntryService extends IService<LiveUserFirstEntry>
     int deleteLiveUserFirstEntryById(Long id);
 
     int selectTodayEntry(long userId);
+
+    /**
+     * 业绩归属
+     */
+    List<LiveUserFirstProfit> selectLiveProfitList();
 }

+ 3 - 3
fs-service/src/main/java/com/fs/live/service/impl/LiveServiceImpl.java

@@ -486,8 +486,8 @@ public class LiveServiceImpl extends ServiceImpl<LiveMapper, Live> implements IL
         if (exist.getIsShow() != 1) {
             return R.error("直播已下架");
         }
-        String rtmpPushUrl = generateRtmpPushUrl("rtmp://200149.push.tlivecloud.com", "live", exist.getLiveId().toString());
-        String hlvPlayUrl = generateHlvPlayUrl("https://live.test.ifeiyu100.com", "live", exist.getLiveId().toString());
+        String rtmpPushUrl = generateRtmpPushUrl("rtmp://204600.push.tlivecloud.com", "live", exist.getLiveId().toString());
+        String hlvPlayUrl = generateHlvPlayUrl("http://fbylive.hyljcourse.com", "live", exist.getLiveId().toString());
         Date now = new Date();
         exist.setRtmpUrl(rtmpPushUrl);
         exist.setFlvHlsUrl(hlvPlayUrl);
@@ -724,7 +724,7 @@ public class LiveServiceImpl extends ServiceImpl<LiveMapper, Live> implements IL
                 liveId +
                 ".flv?" +
                 "txSecret=" +
-                Md5Util.MD5("NiMfMYG5HQxZQ5bk88ri" + liveId + to16Hex(now)) +
+                Md5Util.MD5("yh8DYMfk3QfwhrDxPKaC" + liveId + to16Hex(now)) +
                 "&" +
                 "txTime=" +
                 to16Hex(now);

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

@@ -1,9 +1,11 @@
 package com.fs.live.service.impl;
 
+import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 import com.fs.common.utils.DateUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fs.live.vo.LiveUserFirstProfit;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.fs.live.mapper.LiveUserFirstEntryMapper;
@@ -98,4 +100,9 @@ public class LiveUserFirstEntryServiceImpl extends ServiceImpl<LiveUserFirstEntr
         Date now = DateUtils.getNowDate();
         return baseMapper.selectTodayEntry(userId, now);
     }
+
+    @Override
+    public List<LiveUserFirstProfit> selectLiveProfitList() {
+        return baseMapper.selectLiveProfitList();
+    }
 }

+ 50 - 0
fs-service/src/main/java/com/fs/live/vo/LiveUserFirstProfit.java

@@ -0,0 +1,50 @@
+package com.fs.live.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fs.common.annotation.Excel;
+import com.fs.common.core.domain.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 用户每日首次进入直播间记录对象 live_user_first_entry
+ *
+ * @author fs
+ * @date 2025-09-04
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class LiveUserFirstProfit extends BaseEntity{
+
+    /** 主键ID */
+    private Long orderId;
+
+
+    private String orderCode;
+
+
+    private String userName;
+
+
+    private String userPhone;
+
+
+    private BigDecimal totalPrice;
+    private BigDecimal payPrice;
+
+    /** 支付状态 待支付 1已支付 */
+    @Excel(name = "支付状态 待支付 1已支付")
+    private String isPay;
+
+    /** 订单状态(-1 : 申请退款 -2 : 退货成功 0:已取消 1:待支付 2:待发货;3:待收货;4:待评价;5:已完成) */
+    @Excel(name = "订单状态", readConverterExp = "-=1,:=,申=请退款,-=2,:=,退=货成功,1=:待支付,2=:待发货;3:待收货;4:待评价;5:已完成")
+    private Integer status;
+
+    private Long companyUserId;
+    private String companyUserName;
+    private String companyName;
+
+}

+ 20 - 0
fs-service/src/main/resources/mapper/live/LiveUserFirstEntryMapper.xml

@@ -37,6 +37,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where id = #{id}
     </select>
 
+    <select id="selectLiveProfitList"  resultType="com.fs.live.vo.LiveUserFirstProfit">
+        SELECT
+            lo.order_id,lo.order_code,lo.user_name,lo.user_phone,lo.total_price,lo.pay_price,lo.is_pay,lo.status,
+            cu.user_id AS company_user_id,
+            cu.nick_name AS company_user_name,
+            c.company_name
+        FROM
+            live_order lo
+                LEFT JOIN
+            live_user_first_entry lufe
+            ON lo.user_id = lufe.user_id
+                AND DATE(lo.create_time) = lufe.entry_date
+            LEFT JOIN
+            company_user cu
+        ON lufe.company_user_id = cu.user_id
+            left join company c on cu.company_id = c.company_id
+        ORDER BY
+            lo.create_time DESC
+    </select>
+
     <insert id="insertLiveUserFirstEntry" parameterType="LiveUserFirstEntry" useGeneratedKeys="true" keyProperty="id">
         insert into live_user_first_entry
         <trim prefix="(" suffix=")" suffixOverrides=",">