yuhongqi 2 hete
szülő
commit
fe165b9fa3

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

@@ -84,11 +84,11 @@ public class LiveGoodsController extends BaseController
     @PreAuthorize("@ss.hasPermi('live:liveGoods:add')")
     @Log(title = "直播商品", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody Map<String, Object> payload)
+    public R add(@RequestBody Map<String, Object> payload)
     {
         LoginUser loginUser = SecurityUtils.getLoginUser();
         CompanyUser user = loginUser.getUser();
-        return toAjax(liveGoodsService.insertLiveGoods(payload,user));
+        return liveGoodsService.insertLiveGoods(payload,user);
     }
 
     /**

+ 19 - 2
fs-live-app/src/main/java/com/fs/app/controller/FsStoreController.java

@@ -3,13 +3,17 @@ package com.fs.app.controller;
 import com.fs.app.annotation.Login;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.his.domain.FsStoreProduct;
 import com.fs.his.service.IFsStoreService;
+import com.fs.live.domain.LiveGoods;
 import com.fs.live.service.ILiveGoodsService;
 import com.fs.live.vo.FsStoreLiveVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 
@@ -29,16 +33,17 @@ public class FsStoreController extends AppBaseController
     private ILiveGoodsService liveGoodsService;
 
     /**
-     * 获取店铺管理详细信息
+     * 获取店铺管理详细信息(下面小黄车的商品)
      */
     @Login
     @GetMapping("/{storeId}")
-    public AjaxResult getInfo(@PathVariable("storeId") Long storeId,@RequestParam String key)
+    public AjaxResult getInfo(@PathVariable("storeId") Long storeId,@RequestParam String key,@RequestParam String liveId)
     {
         Map<String, Object> params = new HashMap<>();
         params.put("storeId", storeId);
         params.put("userId", getUserId());
         params.put("productName", key);
+        params.put("liveId", liveId);
         FsStoreLiveVO fsStore = fsStoreService.selectFsStoreLiveByMap(params);
         if (Objects.nonNull(fsStore)) {
             fsStore.setGoodsList(liveGoodsService.selectLiveGoodsListByMap(params));
@@ -47,6 +52,18 @@ public class FsStoreController extends AppBaseController
         return AjaxResult.success(fsStore);
     }
 
+    /**
+     * 获取店铺所有产品
+     */
+    @Login
+    @GetMapping
+    public TableDataInfo getStoreProducts(LiveGoods storeId)
+    {
+        startPage();
+        List<FsStoreProduct> list = liveGoodsService.selectStoreProducts(storeId);
+        return getDataTable(list);
+    }
+
 
 
 }

+ 1 - 1
fs-live-app/src/main/java/com/fs/app/controller/LiveAfterSalesController.java

@@ -84,8 +84,8 @@ public class LiveAfterSalesController extends  AppBaseController {
     @GetMapping("/getStoreAfterSalesList")
     @ApiOperation(value = "获取售后列表", notes = "获取售后列表")
     public R getStoreAfterSalesList(LiveAfterSalesListUParam param) {
-        PageHelper.startPage(param.getPageNum(), param.getPageSize());
         param.setUserId(Long.parseLong(getUserId()));
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
         List<LiveAfterSalesListUVO> list=storeAfterSalesService.selectLiveAfterSalesListUVO(param);
         PageInfo<LiveAfterSalesListUVO> listPageInfo=new PageInfo<>(list);
         return R.ok().put("data",listPageInfo);

+ 0 - 2
fs-live-app/src/main/java/com/fs/app/controller/LiveDataController.java

@@ -73,7 +73,6 @@ public class LiveDataController extends AppBaseController{
      * */
     @Login
     @PostMapping("/collectStore")
-    @RepeatSubmit
     public R collectStore(@RequestParam Long storeId) {
         return R.ok(liveDataService.collectStore(Long.parseLong(getUserId()), storeId));
     }
@@ -83,7 +82,6 @@ public class LiveDataController extends AppBaseController{
      * */
     @Login
     @PostMapping("/collectGoods")
-    @RepeatSubmit
     public R collectProduct(@RequestParam Long goodId) {
         return R.ok(liveDataService.collectProduct(Long.parseLong(getUserId()), goodId));
     }

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

@@ -35,12 +35,10 @@ public class LiveWatchUserController extends BaseController
 
 
     @GetMapping("/watchUserList")
-    public TableDataInfo watchUserList(@RequestParam Long liveId) {
-        Map<String, Object> params = new HashMap<>();
-        params.put("liveId", liveId);
-
+    public TableDataInfo watchUserList(LiveWatchUser param) {
+        param.setOnline(0);
         startPage();
-        List<LiveWatchUserVO> onLineUserList = liveWatchUserService.selectWatchUserList(params).stream().filter(liveWatchUserVO -> liveWatchUserVO.getOnline() == 1).collect(Collectors.toList());
+        List<LiveWatchUserVO> onLineUserList = liveWatchUserService.selectOnlineUserList(param);
         return getDataTable(onLineUserList);
     }
 

+ 2 - 2
fs-live-app/src/main/java/com/fs/app/controller/UserController.java

@@ -73,8 +73,8 @@ public class UserController extends AppBaseController {
 	@Autowired
 	private IFsUserNewTaskService userNewTaskService;
 
-	private static final String APP_ID = "wx703c4bd07bbd1695";
-	private static final String APP_SECRET = "034f5cc8d9b5151f9d25da9628541e35";
+	private static final String APP_ID = "wxd70f99287830cb51";
+	private static final String APP_SECRET = "51129ad15e25fb63b4e6c025df56a541";
 
 
 	@ApiOperation("课程短链公众号登录")

+ 9 - 0
fs-service/src/main/java/com/fs/live/mapper/LiveGoodsMapper.java

@@ -122,4 +122,13 @@ public interface LiveGoodsMapper extends BaseMapper<LiveGoods>{
 
     @Select("select store_id from live_goods where live_id = #{liveId} limit 1")
     Long getStoreIdByLiveId(Long liveId);
+
+    @Select("<script>" +
+            "select * from fs_store_product " +
+            "<where>" +
+            "       <if test=\"storeId != null  and storeId != ''\"> and store_id = #{storeId}</if>\n" +
+            "       <if test=\"keywords != null  and keywords != ''\"> and product_name like CONCAT('%',#{keywords},'%') </if>  " +
+            "</where>" +
+            "</script>")
+    List<FsStoreProduct> selectStoreProducts(LiveGoods param);
 }

+ 5 - 0
fs-service/src/main/java/com/fs/live/mapper/LiveWatchUserMapper.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.fs.live.domain.LiveWatchUser;
 import com.fs.live.vo.LiveWatchUserVO;
 import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 
 import java.util.List;
 import java.util.Map;
@@ -86,4 +87,8 @@ public interface LiveWatchUserMapper extends BaseMapper<LiveWatchUser>{
      * @return LiveWatchUserVO
      */
     LiveWatchUserVO selectWatchUserByLiveIdAndUserId(@Param("liveId") Long liveId, @Param("userId") Long userId);
+
+
+
+    List<LiveWatchUserVO> selectOnlineUserList(LiveWatchUser param);
 }

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

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.domain.entity.SysUser;
 import com.fs.company.domain.CompanyUser;
+import com.fs.his.domain.FsStoreProduct;
 import com.fs.live.domain.LiveGoods;
 import com.fs.live.vo.LiveGoodsListVo;
 import com.fs.live.vo.LiveGoodsVo;
@@ -72,7 +73,7 @@ public interface ILiveGoodsService extends IService<LiveGoods>{
      * @param payload 包含 直播间和商品信息ids
      * @return 结果
      */
-    int insertLiveGoods(Map<String, Object> payload, CompanyUser user);
+    R insertLiveGoods(Map<String, Object> payload, CompanyUser user);
 
     //FsStore getStoreByLiveId(Long liveId);
 
@@ -109,4 +110,6 @@ public interface ILiveGoodsService extends IService<LiveGoods>{
     List<LiveGoodsVo> selectLiveGoodsListByMap(Map<String, Object> params);
 
     Long getStoreIdByLiveId(Long liveId);
+
+    List<FsStoreProduct> selectStoreProducts(LiveGoods storeId);
 }

+ 2 - 0
fs-service/src/main/java/com/fs/live/service/ILiveWatchUserService.java

@@ -98,4 +98,6 @@ public interface ILiveWatchUserService extends IService<LiveWatchUser>{
      * @return LiveWatchUserVO
      */
     LiveWatchUserVO selectWatchUserByLiveIdAndUserId(Long liveId, Long userId);
+
+    List<LiveWatchUserVO> selectOnlineUserList(LiveWatchUser param);
 }

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

@@ -143,15 +143,18 @@ public class LiveGoodsServiceImpl extends ServiceImpl<LiveGoodsMapper, LiveGoods
      * @return 结果
      */
     @Override
-    public int insertLiveGoods(Map<String, Object> payload, CompanyUser user) {
+    public R insertLiveGoods(Map<String, Object> payload, CompanyUser user) {
         Long liveId = Long.valueOf((String) payload.get("liveId"));
         String productsId = (String) payload.get("productsId");
         List<String> productIdList = new ArrayList<>(Arrays.asList(productsId.split(",")));
         if (productIdList.isEmpty()) {
-            return 0;
+            return R.error("请选择商品");
         }
         //  查询商品信息列表(假设返回 List<StoreProduct>)
         List<FsStoreProduct> productInfoList = fsStoreProductMapper.selectFsStoreProductByProductIds(productIdList);
+        if (productInfoList.stream().map(FsStoreProduct::getStoreId).collect(Collectors.toSet()).size() > 1) {
+            return R.error("商品来自不同的店铺,请重新选择商品");
+        }
 
         //  转换为 LiveGoods 并批量插入
         List<LiveGoods> liveGoodsList = productInfoList.stream()
@@ -172,7 +175,8 @@ public class LiveGoodsServiceImpl extends ServiceImpl<LiveGoodsMapper, LiveGoods
                 .collect(Collectors.toList());
 //
 //        // 批量插入
-        return baseMapper.insertLiveGoodsList(liveGoodsList);
+        baseMapper.insertLiveGoodsList(liveGoodsList);
+        return R.ok();
     }
 
     @Override
@@ -236,4 +240,9 @@ public class LiveGoodsServiceImpl extends ServiceImpl<LiveGoodsMapper, LiveGoods
     public Long getStoreIdByLiveId(Long liveId) {
         return baseMapper.getStoreIdByLiveId(liveId);
     }
+
+    @Override
+    public List<FsStoreProduct> selectStoreProducts(LiveGoods param) {
+        return baseMapper.selectStoreProducts(param);
+    }
 }

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

@@ -401,7 +401,7 @@ public class LiveServiceImpl extends ServiceImpl<LiveMapper, Live> implements IL
             return R.error("您未通过审核");
         }
         if (exist.getIsShow() != 1) {
-            return R.error("您未拥有直播权限");
+            return R.error("直播已下架");
         }
         String rtmpPushUrl = generateRtmpPushUrl("rtmp://200149.push.tlivecloud.com", "live", exist.getLiveId().toString());
         String hlvPlayUrl = generateHlvPlayUrl("http://live.test.ifeiyu100.com", "live", exist.getLiveId().toString());
@@ -411,6 +411,7 @@ public class LiveServiceImpl extends ServiceImpl<LiveMapper, Live> implements IL
         exist.setStatus(2);
         exist.setUpdateTime(new Date());
         exist.setFinishTime( null);
+        exist.setStartTime(LocalDateTime.now());
         liveMapper.updateLive(exist);
 
         return R.ok();

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

@@ -11,6 +11,7 @@ import com.fs.live.vo.LiveWatchUserVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -184,4 +185,9 @@ public class LiveWatchUserServiceImpl extends ServiceImpl<LiveWatchUserMapper, L
         return baseMapper.selectWatchUserByLiveIdAndUserId(liveId, userId);
     }
 
+    @Override
+    public List<LiveWatchUserVO> selectOnlineUserList(LiveWatchUser param) {
+        return baseMapper.selectOnlineUserList(param);
+    }
+
 }

+ 1 - 0
fs-service/src/main/resources/mapper/live/LiveGoodsMapper.xml

@@ -216,6 +216,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         left join live_user_favorite uf on uf.product_id = g.goods_id and uf.user_id = #{params.userId}
         where g.store_id = #{params.storeId} and g.status = 1
         <if test="params.productName != null "> and p.product_name like concat('%',#{params.productName},'%')</if>
+        <if test="params.liveId != null "> and g.live_id = #{params.liveId}</if>
     </select>
 
 </mapper>

+ 8 - 0
fs-service/src/main/resources/mapper/live/LiveWatchUserMapper.xml

@@ -68,6 +68,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where lwu.live_id = #{liveId} and lwu.user_id = #{userId}
     </select>
 
+    <select id="selectOnlineUserList" parameterType="LiveWatchUser" resultType="com.fs.live.vo.LiveWatchUserVO">
+        select * from live_watch_user
+        <where>
+        <if test="liveId != null "> and live_id = #{liveId}</if>
+        <if test="online != null "> and online = #{online}</if>
+        </where>
+    </select>
+
     <insert id="insertLiveWatchUser" parameterType="LiveWatchUser" useGeneratedKeys="true" keyProperty="id">
         insert into live_watch_user
         <trim prefix="(" suffix=")" suffixOverrides=",">