Selaa lähdekoodia

feat:合并同步master代码冲突代码调整

caoliqin 1 kuukausi sitten
vanhempi
commit
54134d5a3b
55 muutettua tiedostoa jossa 75 lisäystä ja 4471 poistoa
  1. 0 141
      fs-live-app/src/main/java/com/fs/app/config/ProductionWordFilter.java
  2. 0 119
      fs-live-app/src/main/java/com/fs/app/controller/AppBaseController.java
  3. 0 97
      fs-live-app/src/main/java/com/fs/app/controller/CaptchaController.java
  4. 0 85
      fs-live-app/src/main/java/com/fs/app/controller/CommonController.java
  5. 0 69
      fs-live-app/src/main/java/com/fs/app/controller/FsStoreController.java
  6. 0 105
      fs-live-app/src/main/java/com/fs/app/controller/LiveAfterSalesController.java
  7. 0 139
      fs-live-app/src/main/java/com/fs/app/controller/LiveCartController.java
  8. 0 115
      fs-live-app/src/main/java/com/fs/app/controller/LiveDataController.java
  9. 0 13
      fs-live-app/src/main/java/com/fs/app/controller/LiveGiftController.java
  10. 0 131
      fs-live-app/src/main/java/com/fs/app/controller/LiveGoodsController.java
  11. 0 48
      fs-live-app/src/main/java/com/fs/app/controller/LiveLotteryController.java
  12. 0 89
      fs-live-app/src/main/java/com/fs/app/controller/LiveMsgController.java
  13. 0 250
      fs-live-app/src/main/java/com/fs/app/controller/LiveOrderController.java
  14. 0 97
      fs-live-app/src/main/java/com/fs/app/controller/LiveOrderLogsController.java
  15. 0 104
      fs-live-app/src/main/java/com/fs/app/controller/LiveOrderPaymentController.java
  16. 0 30
      fs-live-app/src/main/java/com/fs/app/controller/LiveRedController.java
  17. 0 97
      fs-live-app/src/main/java/com/fs/app/controller/LiveUserFavoriteController.java
  18. 0 97
      fs-live-app/src/main/java/com/fs/app/controller/LiveUserFollowController.java
  19. 0 60
      fs-live-app/src/main/java/com/fs/app/controller/LiveUserGiftController.java
  20. 0 97
      fs-live-app/src/main/java/com/fs/app/controller/LiveUserLikeController.java
  21. 0 98
      fs-live-app/src/main/java/com/fs/app/controller/LiveWatchUserController.java
  22. 0 148
      fs-live-app/src/main/java/com/fs/app/controller/UserAddressController.java
  23. 0 546
      fs-live-app/src/main/java/com/fs/app/controller/UserController.java
  24. 0 18
      fs-live-app/src/main/java/com/fs/app/param/FsAddressParseParam.java
  25. 0 59
      fs-live-app/src/main/java/com/fs/app/param/FsUserAddressAddEditParam.java
  26. 0 32
      fs-live-app/src/main/java/com/fs/app/param/FsUserEditPhoneParam.java
  27. 0 19
      fs-live-app/src/main/java/com/fs/app/param/FsUserLoginByWeChatParam.java
  28. 0 26
      fs-live-app/src/main/java/com/fs/app/param/FsUserLoginParam.java
  29. 0 304
      fs-live-app/src/main/java/com/fs/app/task/Task.java
  30. 0 23
      fs-live-app/src/main/java/com/fs/app/vo/CityVO.java
  31. 0 97
      fs-live-app/src/main/java/com/fs/app/websocket/auth/AuthHandler.java
  32. 0 85
      fs-live-app/src/main/java/com/fs/app/websocket/auth/WebSocketConfigurator.java
  33. 0 18
      fs-live-app/src/main/java/com/fs/app/websocket/constant/AttrConstant.java
  34. 0 53
      fs-live-app/src/main/java/com/fs/app/websocket/constant/NickNameConstant.java
  35. 0 268
      fs-live-app/src/main/java/com/fs/app/websocket/handle/LiveChatHandler.java
  36. 0 97
      fs-live-app/src/main/java/com/fs/app/websocket/service/NettyServerRunner.java
  37. 0 454
      fs-live-app/src/main/java/com/fs/app/websocket/service/WebSocketServer.java
  38. 0 1
      fs-live-app/src/main/java/com/fs/framework/aspectj/LiveWatchUserAspect.java
  39. 5 6
      fs-live-app/src/main/java/com/fs/framework/aspectj/LogAspect.java
  40. 3 4
      fs-live-app/src/main/java/com/fs/framework/config/DataSourceConfig.java
  41. 4 4
      fs-live-app/src/main/java/com/fs/framework/config/DruidConfig.java
  42. 0 2
      fs-live-app/src/main/java/com/fs/framework/config/MyBatisConfig.java
  43. 1 3
      fs-live-app/src/main/java/com/fs/framework/config/SecurityConfig.java
  44. 1 2
      fs-live-app/src/main/java/com/fs/framework/config/SwaggerConfig.java
  45. 0 1
      fs-live-app/src/main/java/com/fs/live/param/TestMoneyParam.java
  46. 1 1
      fs-live-app/src/main/java/com/fs/live/redis/RedisConfiguration.java
  47. 5 5
      fs-live-app/src/main/java/com/fs/live/task/LiveCompletionPointsTask.java
  48. 2 2
      fs-live-app/src/main/java/com/fs/live/task/Task.java
  49. 4 4
      fs-live-app/src/main/java/com/fs/live/utils/CityTreeUtil.java
  50. 1 1
      fs-live-app/src/main/java/com/fs/live/utils/VerifyUtils.java
  51. 1 1
      fs-live-app/src/main/java/com/fs/live/utils/WebSocketRateLimiter.java
  52. 6 6
      fs-live-app/src/main/java/com/fs/live/websocket/auth/AuthHandler.java
  53. 41 41
      fs-live-app/src/main/java/com/fs/live/websocket/service/WebSocketServer.java
  54. 0 57
      fs-live-app/src/main/resources/application-druid.yml
  55. 0 2
      fs-service/src/main/java/com/fs/his/domain/FsUser.java

+ 0 - 141
fs-live-app/src/main/java/com/fs/app/config/ProductionWordFilter.java

@@ -1,141 +0,0 @@
-package com.fs.app.config;
-
-import com.fs.common.utils.spring.SpringUtils;
-import com.fs.live.service.ILiveSensitiveWordsService;
-import lombok.Getter;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.*;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-
-@Component
-public class ProductionWordFilter implements InitializingBean {
-
-    @Autowired
-    private ILiveSensitiveWordsService liveSensitiveWordsService;
-
-
-    private static class TrieNode {
-        @Getter
-        private final Map<Character, TrieNode> children = new HashMap<>();
-        private boolean isEndOfWord;
-
-        public boolean isEndOfWord() {
-            return isEndOfWord;
-        }
-
-        public void setEndOfWord(boolean endOfWord) {
-            isEndOfWord = endOfWord;
-        }
-
-    }
-    @Getter
-    private static class MatchResult {
-        private final String word;
-        private final int endIndex;
-
-        public MatchResult(String word, int endIndex) {
-            this.word = word;
-            this.endIndex = endIndex;
-        }
-
-        public int getLength() {
-            return word.length();
-        }
-    }
-
-    @Getter
-    public static class FilterResult {
-        private final String filteredText;
-        private final Set<String> matchedWords;
-        private final int replacedCount;
-
-        public FilterResult(String filteredText, Set<String> matchedWords, int replacedCount) {
-            this.filteredText = filteredText;
-            this.matchedWords = matchedWords;
-            this.replacedCount = replacedCount;
-        }
-
-    }
-
-    private TrieNode root = new TrieNode();
-    private List<String> wordSources;
-    private final ScheduledExecutorService executor;
-
-    public ProductionWordFilter(List<String> wordSources) {
-        this.wordSources = wordSources;
-        this.executor = Executors.newSingleThreadScheduledExecutor();
-    }
-
-    @Override
-    public void afterPropertiesSet() {
-        reload();
-        executor.scheduleWithFixedDelay(this::reload, 1, 1, TimeUnit.HOURS);
-    }
-
-    public synchronized void reload() {
-        wordSources = liveSensitiveWordsService.selectAllWords();
-        TrieNode newRoot = new TrieNode();
-        wordSources.stream()
-                .flatMap(source -> loadWords(source).stream())
-                .forEach(word -> addWord(newRoot, word));
-        this.root = newRoot;
-    }
-
-    public FilterResult filter(String text) {
-        StringBuilder result = new StringBuilder();
-        Set<String> foundWords = new HashSet<>();
-        int replacedCount = 0;
-
-        for (int i = 0; i < text.length(); ) {
-            MatchResult match = findNextMatch(text, i);
-            if (match != null) {
-                foundWords.add(match.getWord());
-                result.append(StringUtils.repeat("", match.getLength()));
-                replacedCount++;
-                i = match.getEndIndex();
-            } else {
-                result.append(text.charAt(i));
-                i++;
-            }
-        }
-
-        return new FilterResult(result.toString(), foundWords, replacedCount);
-    }
-
-
-    private MatchResult findNextMatch(String text, int start) {
-        TrieNode current = root;
-        for (int i = start; i < text.length(); i++) {
-            char c = text.charAt(i);
-            if (!current.getChildren().containsKey(c)) {
-                return null;
-            }
-            current = current.getChildren().get(c);
-            if (current.isEndOfWord()) {
-                return new MatchResult(text.substring(start, i + 1), i + 1);
-            }
-        }
-        return null;
-    }
-
-    private void addWord(TrieNode root, String word) {
-        TrieNode node = root;
-        for (char c : word.toCharArray()) {
-            node = node.getChildren().computeIfAbsent(c, k -> new TrieNode());
-        }
-        node.setEndOfWord(true);
-    }
-
-    private List<String> loadWords(String source) {
-        // 示例:实际应从 source(如 URL 或文件路径)读取
-        return Collections.singletonList(source); // 替换为真实逻辑
-    }
-
-
-}

+ 0 - 119
fs-live-app/src/main/java/com/fs/app/controller/AppBaseController.java

@@ -1,119 +0,0 @@
-package com.fs.app.controller;
-
-
-import com.fs.live.utils.JwtUtils;
-import com.fs.common.constant.HttpStatus;
-import com.fs.common.core.domain.AjaxResult;
-import com.fs.common.core.page.PageDomain;
-import com.fs.common.core.page.TableDataInfo;
-import com.fs.common.core.page.TableSupport;
-import com.fs.common.core.redis.RedisCache;
-import com.fs.common.utils.ServletUtils;
-import com.fs.common.utils.StringUtils;
-import com.fs.common.utils.sql.SqlUtil;
-import com.github.pagehelper.PageHelper;
-import com.github.pagehelper.PageInfo;
-import io.jsonwebtoken.Claims;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import java.util.List;
-
-
-public class AppBaseController {
-	@Autowired
-	JwtUtils jwtUtils;
-
-	public String getUserId()
-	{
-		String headValue =  ServletUtils.getRequest().getHeader("AppToken");
-		if (StringUtils.isEmpty(headValue))
-			headValue = ServletUtils.getRequest().getParameter("APPToken");
-		Claims claims=jwtUtils.getClaimByToken(headValue);
-		String userId = claims.getSubject().toString();
-		return userId;
-	}
-
-	/**
-	 * 响应请求分页数据
-	 */
-	@SuppressWarnings({ "rawtypes", "unchecked" })
-	protected TableDataInfo getDataTable(List<?> list)
-	{
-		TableDataInfo rspData = new TableDataInfo();
-		rspData.setCode(HttpStatus.SUCCESS);
-		rspData.setMsg("查询成功");
-		rspData.setRows(list);
-		rspData.setTotal(new PageInfo(list).getTotal());
-		return rspData;
-	}
-
-	/**
-	 * 设置请求分页数据
-	 */
-	protected void startPage()
-	{
-		PageDomain pageDomain = TableSupport.buildPageRequest();
-		Integer pageNum = pageDomain.getPageNum();
-		Integer pageSize = pageDomain.getPageSize();
-		if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
-		{
-			String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
-			Boolean reasonable = pageDomain.getReasonable();
-			PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
-		}
-	}
-
-	/**
-	 * 响应返回结果
-	 *
-	 * @param rows 影响行数
-	 * @return 操作结果
-	 */
-	protected AjaxResult toAjax(int rows)
-	{
-		return rows > 0 ? AjaxResult.success() : AjaxResult.error();
-	}
-
-	/**
-	 * 响应返回结果
-	 *
-	 * @param result 结果
-	 * @return 操作结果
-	 */
-	protected AjaxResult toAjax(boolean result)
-	{
-		return result ? success() : error();
-	}
-
-	/**
-	 * 返回成功
-	 */
-	public AjaxResult success()
-	{
-		return AjaxResult.success();
-	}
-
-	/**
-	 * 返回失败消息
-	 */
-	public AjaxResult error()
-	{
-		return AjaxResult.error();
-	}
-
-	/**
-	 * 返回成功消息
-	 */
-	public AjaxResult success(String message)
-	{
-		return AjaxResult.success(message);
-	}
-
-	/**
-	 * 返回失败消息
-	 */
-	public AjaxResult error(String message)
-	{
-		return AjaxResult.error(message);
-	}
-}

+ 0 - 97
fs-live-app/src/main/java/com/fs/app/controller/CaptchaController.java

@@ -1,97 +0,0 @@
-package com.fs.app.controller;
-
-import com.fs.common.constant.Constants;
-import com.fs.common.core.domain.AjaxResult;
-import com.fs.common.core.redis.RedisCache;
-import com.fs.common.utils.sign.Base64;
-import com.fs.common.utils.uuid.IdUtils;
-import com.fs.system.service.ISysConfigService;
-import com.google.code.kaptcha.Producer;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.util.FastByteArrayOutputStream;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-import javax.imageio.ImageIO;
-import javax.servlet.http.HttpServletResponse;
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import java.util.concurrent.TimeUnit;
-
-/**
- * 验证码操作处理
- *
-
- */
-@RestController
-public class CaptchaController
-{
-    @Resource(name = "captchaProducer")
-    private Producer captchaProducer;
-
-    @Resource(name = "captchaProducerMath")
-    private Producer captchaProducerMath;
-
-    @Autowired
-    private RedisCache redisCache;
-
-    // 验证码类型
-    @Value("${fs.captchaType}")
-    private String captchaType;
-
-    @Autowired
-    private ISysConfigService configService;
-    /**
-     * 生成验证码
-     */
-    @GetMapping("/captchaImage")
-    public AjaxResult getCode(HttpServletResponse response) throws IOException
-    {
-        AjaxResult ajax = AjaxResult.success();
-        boolean captchaOnOff = configService.selectCaptchaOnOff();
-        ajax.put("captchaOnOff", captchaOnOff);
-        if (!captchaOnOff)
-        {
-            return ajax;
-        }
-
-        // 保存验证码信息
-        String uuid = IdUtils.simpleUUID();
-        String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
-
-        String capStr = null, code = null;
-        BufferedImage image = null;
-
-        // 生成验证码
-        if ("math".equals(captchaType))
-        {
-            String capText = captchaProducerMath.createText();
-            capStr = capText.substring(0, capText.lastIndexOf("@"));
-            code = capText.substring(capText.lastIndexOf("@") + 1);
-            image = captchaProducerMath.createImage(capStr);
-        }
-        else if ("char".equals(captchaType))
-        {
-            capStr = code = captchaProducer.createText();
-            image = captchaProducer.createImage(capStr);
-        }
-
-        redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
-        // 转换流信息写出
-        FastByteArrayOutputStream os = new FastByteArrayOutputStream();
-        try
-        {
-            ImageIO.write(image, "jpg", os);
-        }
-        catch (IOException e)
-        {
-            return AjaxResult.error(e.getMessage());
-        }
-
-        ajax.put("uuid", uuid);
-        ajax.put("img", Base64.encode(os.toByteArray()));
-        return ajax;
-    }
-}

+ 0 - 85
fs-live-app/src/main/java/com/fs/app/controller/CommonController.java

@@ -1,85 +0,0 @@
-package com.fs.app.controller;
-
-
-import com.alibaba.fastjson.JSON;
-import com.fs.app.utils.CityTreeUtil;
-import com.fs.app.vo.CityVO;
-import com.fs.app.websocket.bean.SendMsgVo;
-import com.fs.app.websocket.service.WebSocketServer;
-import com.fs.common.core.domain.R;
-import com.fs.company.service.ICompanyWxChatService;
-import com.fs.his.domain.FsCity;
-import com.fs.his.service.IFsCityService;
-import com.fs.system.service.ISysDictDataService;
-import com.fs.system.vo.DictVO;
-import com.fs.wxUser.domain.CompanyWxUser;
-import com.fs.wxUser.service.ICompanyWxUserService;
-import com.google.common.collect.Lists;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import jdk.nashorn.internal.ir.annotations.Ignore;
-import lombok.AllArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.Arrays;
-import java.util.List;
-
-
-@Slf4j
-@Api("公共接口")
-@RestController
-@AllArgsConstructor
-@Ignore
-@RequestMapping(value="/app/common")
-public class CommonController {
-
-    private final WebSocketServer webSocketServer;
-    private final ICompanyWxUserService companyWxUserService;
-    private final ICompanyWxChatService companyWxChatService;
-
-    @Autowired
-    private IFsCityService cityService;
-
-    @Autowired
-    private ISysDictDataService dictDataService;
-
-    @GetMapping("/testSend")
-    public R testSend(Long userId, String msg) throws Exception{
-        return R.ok();
-    }
-
-    @GetMapping("/testGet")
-    public R testGet( ) throws Exception{
-        return R.ok();
-    }
-
-    @ApiOperation("获取城市数据")
-    @GetMapping("/getCitys")
-    @Cacheable("cityData")
-    public R getCitys(){
-        List<FsCity> list=cityService.selectFsCityList(new FsCity());
-        List<CityVO> cityVOS = Lists.newArrayList();
-        for (FsCity city : list){
-            CityVO cityVO = new CityVO();
-            cityVO.setV(city.getCityId());
-            cityVO.setN(city.getCityName());
-            cityVO.setPid(city.getParentId());
-            cityVOS.add(cityVO);
-        }
-        return R.ok().put("data", CityTreeUtil.list2TreeConverter(cityVOS, "0"));
-
-    }
-
-    @ApiOperation("获取数据字典")
-    @GetMapping("/getDictByKey")
-    @Cacheable(value="dicts", key="#key")
-    public R getDictByKey(@RequestParam(value = "key", required = false) String key){
-        List<DictVO> dicts=dictDataService.selectDictDataListByType(key);
-        return R.ok().put("data",dicts);
-    }
-
-
-}

+ 0 - 69
fs-live-app/src/main/java/com/fs/app/controller/FsStoreController.java

@@ -1,69 +0,0 @@
-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;
-
-/**
- * 店铺管理Controller
- *
- * @author fs
- * @date 2023-06-15
- */
-@RestController
-@RequestMapping("/app/live/store")
-public class FsStoreController extends AppBaseController
-{
-    @Autowired
-    private IFsStoreService fsStoreService;
-    @Autowired
-    private ILiveGoodsService liveGoodsService;
-
-    /**
-     * 获取店铺管理详细信息(下面小黄车的商品)
-     */
-    @Login
-    @GetMapping("/{storeId}")
-    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));
-        }
-
-        return AjaxResult.success(fsStore);
-    }
-
-    /**
-     * 获取店铺所有产品
-     */
-    @Login
-    @GetMapping
-    public TableDataInfo getStoreProducts(LiveGoods storeId)
-    {
-        startPage();
-        List<FsStoreProduct> list = liveGoodsService.selectStoreProducts(storeId);
-        return getDataTable(list);
-    }
-
-
-
-}

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

@@ -1,105 +0,0 @@
-package com.fs.app.controller;
-
-
-import com.fs.app.annotation.Login;
-import com.fs.common.annotation.RepeatSubmit;
-import com.fs.common.core.domain.R;
-import com.fs.common.utils.ParseUtils;
-import com.fs.live.domain.LiveAfterSales;
-import com.fs.live.domain.LiveAfterSalesItem;
-import com.fs.live.domain.LiveOrder;
-import com.fs.live.param.LiveAfterSalesApplyParam;
-import com.fs.live.param.LiveAfterSalesDeliveryParam;
-import com.fs.live.param.LiveAfterSalesListUParam;
-import com.fs.live.param.LiveAfterSalesRevokeParam;
-import com.fs.live.service.ILiveAfterSalesItemService;
-import com.fs.live.service.ILiveAfterSalesService;
-import com.fs.live.service.ILiveOrderItemService;
-import com.fs.live.service.ILiveOrderService;
-import com.fs.live.vo.LiveAfterSalesListUVO;
-import com.fs.live.vo.LiveOrderItemListUVO;
-import com.github.pagehelper.PageHelper;
-import com.github.pagehelper.PageInfo;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.text.ParseException;
-import java.util.List;
-
-
-@Api("售后接口")
-@RestController
-@RequestMapping(value="/app/live/storeAfterSales")
-public class LiveAfterSalesController extends  AppBaseController {
-
-    @Autowired
-    private ILiveAfterSalesService storeAfterSalesService;
-
-    @Autowired
-    private ILiveAfterSalesItemService salesItemService;
-    @Autowired
-    private ILiveOrderItemService itemService;
-    @Autowired
-    private ILiveOrderService orderService;
-    @Login
-    @ApiOperation("获取订单项列表")
-    @GetMapping("/getStoreOrderItems")
-    public R getStoreOrderItems(@RequestParam("orderId") Long orderId, HttpServletRequest request){
-        List<LiveOrderItemListUVO> list=itemService.selectLiveOrderItemListUVOByOrderId(orderId);
-        LiveOrder order=orderService.selectLiveOrderByOrderId(String.valueOf(orderId));
-        order.setUserPhone(ParseUtils.parsePhone(order.getUserPhone()));
-        order.setUserAddress(ParseUtils.parseIdCard(order.getUserAddress()));
-        return R.ok().put("order", order).put("items",list);
-    }
-
-
-    @Login
-    @PostMapping("/applyAfterSales")
-    @ApiOperation(value = "申请售后", notes = "申请售后")
-    @RepeatSubmit
-    public R applyAfterSales(@RequestBody LiveAfterSalesApplyParam param) {
-        return storeAfterSalesService.applyAfterSales(getUserId(), param);
-    }
-    @Login
-    @PostMapping("/revoke")
-    @ApiOperation(value = "撤销售后", notes = "撤销售后")
-    @RepeatSubmit
-    public R revoke(@RequestBody LiveAfterSalesRevokeParam param) throws ParseException {
-        return storeAfterSalesService.revoke(getUserId(), param);
-    }
-    @Login
-    @PostMapping("/addDelivery")
-    @ApiOperation(value = "提交物流信息", notes = "提交物流信息")
-    public R addDelivery(@Validated @RequestBody LiveAfterSalesDeliveryParam param) {
-        param.setUserId(Long.parseLong(getUserId()));
-        return storeAfterSalesService.addDelivery(param);
-    }
-
-
-    @Login
-    @GetMapping("/getStoreAfterSalesList")
-    @ApiOperation(value = "获取售后列表", notes = "获取售后列表")
-    public R getStoreAfterSalesList(LiveAfterSalesListUParam param) {
-        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);
-    }
-    @Login
-    @GetMapping("/getStoreAfterSalesById")
-    @ApiOperation(value = "获取售后详情", notes = "获取售后详情")
-    public R getStoreAfterSalesById(@RequestParam("id") Long id) {
-        LiveAfterSales sales=storeAfterSalesService.selectLiveAfterSalesById(id);
-        LiveAfterSalesItem map=new LiveAfterSalesItem();
-        map.setAfterSalesId(id);
-        List<LiveAfterSalesItem>  items=salesItemService.selectLiveAfterSalesItemList(map);
-        LiveOrder order=orderService.selectLiveOrderByOrderId(String.valueOf(sales.getOrderId()));
-        return R.ok().put("sales",sales).put("items", items).put("order",order);
-    }
-
-}

+ 0 - 139
fs-live-app/src/main/java/com/fs/app/controller/LiveCartController.java

@@ -1,139 +0,0 @@
-package com.fs.app.controller;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.fs.app.annotation.Login;
-import com.fs.common.annotation.Excel;
-import com.fs.common.annotation.Log;
-import com.fs.common.annotation.RepeatSubmit;
-import com.fs.common.core.controller.BaseController;
-import com.fs.common.core.domain.AjaxResult;
-import com.fs.common.core.domain.R;
-import com.fs.common.core.page.TableDataInfo;
-import com.fs.common.enums.BusinessType;
-import com.fs.common.utils.poi.ExcelUtil;
-import com.fs.live.domain.LiveCart;
-import com.fs.live.service.ILiveCartService;
-import com.fs.live.vo.LiveCartVo;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * 购物车Controller
- *
- * @author fs
- * @date 2025-07-08
- */
-@RestController
-@RequestMapping("/live/liveCart")
-@Api(tags = "购物车管理")
-public class LiveCartController extends AppBaseController
-{
-    @Autowired
-    private ILiveCartService liveCartService;
-
-    /**
-     * 查询购物车列表
-     */
-//    @PreAuthorize("@ss.hasPermi('live:liveCart:list')")
-    @GetMapping("/list")
-    @ApiOperation("查询购物车列表")
-    @Login
-    public TableDataInfo list(LiveCart liveCart)
-    {
-        liveCart.setUserId(String.valueOf(getUserId()));
-        startPage();
-        List<LiveCartVo> list = liveCartService.selectLiveCartListVo(liveCart);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出购物车列表
-     */
-//    @PreAuthorize("@ss.hasPermi('live:liveCart:export')")
-    @Log(title = "购物车", businessType = BusinessType.EXPORT)
-    @GetMapping("/export")
-    @ApiOperation("导出购物车列表")
-    @Login
-    public AjaxResult export(LiveCart liveCart)
-    {
-        List<LiveCart> list = liveCartService.selectLiveCartList(liveCart);
-        ExcelUtil<LiveCart> util = new ExcelUtil<LiveCart>(LiveCart.class);
-        return util.exportExcel(list, "购物车数据");
-    }
-
-    /**
-     * 获取购物车详细信息
-     */
-//    @PreAuthorize("@ss.hasPermi('live:liveCart:query')")
-    @GetMapping(value = "/{cardId}")
-    @ApiOperation("获取购物车详细信息")
-    @ApiImplicitParam(name = "cardId", value = "购物车ID", required = true, dataType = "Long", paramType = "path")
-    @Login
-    public AjaxResult getInfo(@PathVariable("cardId") Long cardId)
-    {
-        return AjaxResult.success(liveCartService.selectLiveCartByCartId(cardId));
-    }
-
-    /**
-     * 新增购物车
-     */
-//    @PreAuthorize("@ss.hasPermi('live:liveCart:add')")
-    @PostMapping
-    @ApiOperation("新增购物车")
-    @Login
-    @RepeatSubmit
-    public AjaxResult add(@RequestBody @ApiParam("购物车信息") LiveCart liveCart)
-    {
-        liveCart.setUserId(String.valueOf(getUserId()));
-        return toAjax(liveCartService.insertLiveCart(liveCart));
-    }
-
-    /**
-     * 修改购物车
-     */
-//    @PreAuthorize("@ss.hasPermi('live:liveCart:edit')")
-    @PostMapping("/update")
-    @ApiOperation("修改购物车")
-    @Login
-    @RepeatSubmit
-    public AjaxResult edit(@RequestBody @ApiParam("购物车信息") LiveCart liveCart)
-    {
-        liveCart.setUserId(String.valueOf(getUserId()));
-        return toAjax(liveCartService.updateLiveCart(liveCart));
-    }
-
-    /**
-     * 删除购物车
-     */
-//    @PreAuthorize("@ss.hasPermi('live:liveCart:remove')")
-	@PostMapping("/delete")
-    @ApiOperation("删除购物车")
-    @ApiImplicitParam(name = "cardIds", value = "购物车ID数组", required = true, dataType = "Long", paramType = "path")
-    @Login
-    public AjaxResult remove(@RequestBody Long[] cardIds)
-    {
-        return toAjax(liveCartService.deleteByCartIds(cardIds, Long.valueOf(getUserId())));
-    }
-
-    @GetMapping("/checked")
-    @ApiOperation("查询购物车列表")
-    @Login
-    public TableDataInfo getChecked(LiveCart liveCart)
-    {
-        liveCart.setUserId(String.valueOf(getUserId()));
-        startPage();
-        List<LiveCartVo> list = liveCartService.getChecked(liveCart);
-        return getDataTable(list);
-    }
-
-
-
-}

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

@@ -1,115 +0,0 @@
-package com.fs.app.controller;
-
-import com.fs.app.annotation.Login;
-import com.fs.common.annotation.RepeatSubmit;
-import com.fs.common.core.domain.R;
-import com.fs.live.domain.LiveData;
-import com.fs.live.service.ILiveDataService;
-import com.fs.live.service.ILiveWatchUserService;
-import com.fs.live.vo.LiveWatchUserVO;
-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;
-
-@RestController
-@RequestMapping("/app/live/liveData")
-public class LiveDataController extends AppBaseController{
-
-    @Autowired
-    private ILiveDataService liveDataService;
-
-    @Autowired
-    private ILiveWatchUserService liveWatchUserService;
-    /**
-     * 查询直播数据列表
-     * */
-//    @Login
-    @GetMapping("/list")
-    public List<LiveData> list(LiveData liveData) {
-        return liveDataService.selectLiveDataList(liveData);
-    }
-
-    /**
-     * 查询直播数据详情
-     * */
-//    @Login
-    @GetMapping("/get/{liveId}")
-    public R getLiveData(@PathVariable("liveId") Long liveId) {
-        return R.ok().put("liveData", liveDataService.selectLiveDataByLiveId(liveId));
-    }
-
-    /**
-     * 点赞
-     * */
-//    @Login
-    @GetMapping("/like/{liveId}")
-    public R like(@PathVariable("liveId") Long liveId) {
-        return liveDataService.updateLikeByLiveId(liveId,  Long.parseLong(getUserId()));
-    }
-
-    @GetMapping("/like")
-    public R likeWithUserId(@RequestParam Long liveId,@RequestParam Long userId) {
-        return liveDataService.updateLikeByLiveId(liveId,  userId);
-    }
-
-    /**
-     * 收藏
-     * */
-//    @Login
-    @GetMapping("/collect/{liveId}")
-    public R collect(@PathVariable("liveId") Long liveId) {
-        return R.ok(liveDataService.collect(liveId,  Long.parseLong(getUserId())));
-    }
-
-    /**
-     * 关注
-     * */
-//    @Login
-    @GetMapping("/follow/{liveId}")
-    public R follow(@PathVariable("liveId") Long liveId) {
-        return R.ok(liveDataService.follow(liveId,  Long.parseLong(getUserId())));
-    }
-
-    /**
-     * 收藏/取消收藏店铺
-     * */
-//    @Login
-    @PostMapping("/collectStore")
-    public R collectStore(@RequestParam Long storeId) {
-        return R.ok(liveDataService.collectStore(Long.parseLong(getUserId()), storeId));
-    }
-
-    /**
-     * 收藏/取消收藏商品
-     * */
-//    @Login
-    @PostMapping("/collectGoods")
-    public R collectProduct(@RequestParam Long goodId) {
-        return R.ok(liveDataService.collectProduct(Long.parseLong(getUserId()), goodId));
-    }
-
-    /**
-     * 获取直播内数据
-     * */
-    @GetMapping("/getLiveViewData/{liveId}")
-    public R getLiveViewData(@PathVariable Long liveId) {
-        Map<String,Object> liveViewData =liveDataService.getLiveViewData(liveId);
-        return R.ok(liveViewData);
-    }
-
-    /**
-     * 获取发言最多的三个用户
-     * */
-    @GetMapping("/getRecentLiveViewers/{liveId}")
-    public R getRecentLiveViewers(@PathVariable  Long liveId) {
-        Map<String, Object> params = new HashMap<>();
-        params.put("liveId", liveId);
-        List<LiveWatchUserVO> recentLiveViewers = liveWatchUserService.selectWatchUserList(params);
-        return R.ok().put("recentLiveViewers", recentLiveViewers);
-    }
-
-
-}

+ 0 - 13
fs-live-app/src/main/java/com/fs/app/controller/LiveGiftController.java

@@ -1,13 +0,0 @@
-package com.fs.app.controller;
-
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-@RequestMapping("/app/live/liveGift")
-public class LiveGiftController {
-
-    /**
-     * 送礼物
-     * */
-}

+ 0 - 131
fs-live-app/src/main/java/com/fs/app/controller/LiveGoodsController.java

@@ -1,131 +0,0 @@
-package com.fs.app.controller;
-
-import com.fs.common.annotation.Log;
-import com.fs.common.core.controller.BaseController;
-import com.fs.common.core.domain.AjaxResult;
-import com.fs.common.core.domain.R;
-import com.fs.common.core.page.TableDataInfo;
-import com.fs.common.enums.BusinessType;
-import com.fs.common.utils.poi.ExcelUtil;
-import com.fs.his.service.IFsStoreProductService;
-import com.fs.live.domain.LiveGoods;
-import com.fs.live.service.ILiveGoodsService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * 直播商品Controller
- *
- * @author fs
- * @date 2025-07-08
- */
-@RestController
-@RequestMapping("/app/live/liveGoods")
-public class LiveGoodsController extends BaseController
-{
-    @Autowired
-    private ILiveGoodsService liveGoodsService;
-
-    @Autowired
-    private IFsStoreProductService fsStoreProductService;
-
-    /**
-     * 查询直播商品列表
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveGoods:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(LiveGoods liveGoods)
-    {
-        startPage();
-        List<LiveGoods> list = liveGoodsService.selectLiveGoodsList(liveGoods);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出直播商品列表
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveGoods:export')")
-    @Log(title = "直播商品", businessType = BusinessType.EXPORT)
-    @GetMapping("/export")
-    public AjaxResult export(LiveGoods liveGoods)
-    {
-        List<LiveGoods> list = liveGoodsService.selectLiveGoodsList(liveGoods);
-        ExcelUtil<LiveGoods> util = new ExcelUtil<LiveGoods>(LiveGoods.class);
-        return util.exportExcel(list, "直播商品数据");
-    }
-
-    /**
-     * 获取直播商品详细信息
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveGoods:query')")
-    @GetMapping(value = "/{goodsId}")
-    public AjaxResult getInfo(@PathVariable("goodsId") Long goodsId)
-    {
-        return AjaxResult.success(liveGoodsService.selectLiveGoodsByGoodsId(goodsId));
-    }
-
-    /**
-     * 新增直播商品
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveGoods:add')")
-    @Log(title = "直播商品", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody LiveGoods liveGoods)
-    {
-        return toAjax(liveGoodsService.insertLiveGoods(liveGoods));
-    }
-
-    /**
-     * 修改直播商品
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveGoods:edit')")
-    @Log(title = "直播商品", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public R edit(@RequestBody LiveGoods liveGoods)
-    {
-        return liveGoodsService.updateLiveGoods(liveGoods);
-    }
-
-    /**
-     * 删除直播商品
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveGoods:remove')")
-    @Log(title = "直播商品", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{goodsIds}")
-    public AjaxResult remove(@PathVariable Long[] goodsIds)
-    {
-        return toAjax(liveGoodsService.deleteLiveGoodsByGoodsIds(goodsIds));
-    }
-
-    /**
-     * 获取直播店铺
-     * */
-    @GetMapping("/liveStore/{liveId}")
-    public R liveGoodsStore(@PathVariable Long liveId,@RequestParam String key)
-    {
-        return liveGoodsService.getStoreByLiveId(liveId, key);
-    }
-
-    /**
-     *商品详情
-     */
-    @GetMapping("/liveGoodsDetail/{productId}")
-    public R liveGoodsDetail(@PathVariable Long productId)
-    {
-        return R.ok().put("data",fsStoreProductService.selectFsStoreProductById(productId));
-    }
-
-    /**
-     *当前正在展示的商品
-     */
-    @GetMapping("/showGoods/{liveId}")
-    public R showGoods(@PathVariable Long liveId)
-    {
-        return liveGoodsService.showGoods(liveId);
-    }
-
-
-}

+ 0 - 48
fs-live-app/src/main/java/com/fs/app/controller/LiveLotteryController.java

@@ -1,48 +0,0 @@
-package com.fs.app.controller;
-
-import com.fs.app.annotation.Login;
-import com.fs.common.core.domain.R;
-import com.fs.live.param.LotteryPO;
-import com.fs.live.param.RedPO;
-import com.fs.live.service.ILiveLotteryConfService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-@RequestMapping("/app/live/liveLottery")
-public class LiveLotteryController extends AppBaseController{
-
-    @Autowired
-    private ILiveLotteryConfService liveLotteryConfService;
-
-    /**
-     * 参与抽奖
-     * */
-    @RequestMapping("/participate")
-    public String participate(Long liveId, Long userId,Long lotteryId) {
-        return null;
-    }
-
-    /**
-     * 参与抽奖
-     * */
-    @Login
-    @PostMapping("/claim")
-    public R claim(@RequestBody LotteryPO lottery) {
-        lottery.setUserId(Long.parseLong(getUserId()));
-        return liveLotteryConfService.claimLotteryPacket(lottery);
-    }
-
-    /**
-     * 查询抽奖信息
-     * */
-    @Login
-    @PostMapping("/detail")
-    public R detail(@RequestBody LotteryPO lottery) {
-        return liveLotteryConfService.detail(lottery);
-    }
-
-}

+ 0 - 89
fs-live-app/src/main/java/com/fs/app/controller/LiveMsgController.java

@@ -1,89 +0,0 @@
-package com.fs.app.controller;
-
-import com.fs.common.annotation.Log;
-import com.fs.common.core.controller.BaseController;
-import com.fs.common.core.domain.AjaxResult;
-import com.fs.common.core.page.TableDataInfo;
-import com.fs.common.enums.BusinessType;
-import com.fs.common.utils.poi.ExcelUtil;
-import com.fs.live.domain.LiveMsg;
-import com.fs.live.service.ILiveMsgService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * 直播讨论Controller
- *
- * @author fs
- * @date 2025-01-17
- */
-@RestController
-@RequestMapping("/app/live/liveMsg")
-public class LiveMsgController extends BaseController
-{
-    @Autowired
-    private ILiveMsgService liveMsgService;
-
-    /**
-     * 查询直播讨论列表
-     */
-    @GetMapping("/list")
-    public TableDataInfo list(LiveMsg liveMsg)
-    {
-        startPage();
-        List<LiveMsg> list = liveMsgService.selectLiveMsgList(liveMsg);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出直播讨论列表
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveMsg:export')")
-    @Log(title = "直播讨论", businessType = BusinessType.EXPORT)
-    @GetMapping("/export")
-    public AjaxResult export(LiveMsg liveMsg)
-    {
-        List<LiveMsg> list = liveMsgService.selectLiveMsgList(liveMsg);
-        ExcelUtil<LiveMsg> util = new ExcelUtil<LiveMsg>(LiveMsg.class);
-        return util.exportExcel(list, "直播讨论数据");
-    }
-
-
-
-    /**
-     * 新增直播讨论
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveMsg:add')")
-    @Log(title = "直播讨论", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody LiveMsg liveMsg)
-    {
-        return toAjax(liveMsgService.insertLiveMsg(liveMsg));
-    }
-
-    /**
-     * 修改直播讨论
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveMsg:edit')")
-    @Log(title = "直播讨论", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody LiveMsg liveMsg)
-    {
-        return toAjax(liveMsgService.updateLiveMsg(liveMsg));
-    }
-
-    /**
-     * 删除直播讨论
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveMsg:remove')")
-    @Log(title = "直播讨论", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{msgIds}")
-    public AjaxResult remove(@PathVariable Long[] msgIds)
-    {
-        return toAjax(liveMsgService.deleteLiveMsgByMsgIds(msgIds));
-    }
-
-}

+ 0 - 250
fs-live-app/src/main/java/com/fs/app/controller/LiveOrderController.java

@@ -1,250 +0,0 @@
-package com.fs.app.controller;
-
-import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.core.util.StrUtil;
-import com.fs.app.annotation.Login;
-import com.fs.app.utils.JwtUtils;
-import com.fs.common.annotation.Log;
-import com.fs.common.annotation.RepeatSubmit;
-import com.fs.common.core.domain.AjaxResult;
-import com.fs.common.core.domain.R;
-import com.fs.common.core.page.TableDataInfo;
-import com.fs.common.enums.BusinessType;
-import com.fs.common.exception.CustomException;
-import com.fs.common.utils.StringUtils;
-import com.fs.common.utils.poi.ExcelUtil;
-import com.fs.course.param.FsUserLiveOrderPayUParam;
-import com.fs.his.domain.FsStoreOrder;
-import com.fs.his.dto.ExpressInfoDTO;
-import com.fs.his.enums.ShipperCodeEnum;
-import com.fs.his.param.FsStoreOrderCancelParam;
-import com.fs.his.param.LiveOrderCancelParam;
-import com.fs.his.service.IFsExpressService;
-import com.fs.live.domain.LiveOrder;
-import com.fs.live.enums.LiveOrderCancleReason;
-import com.fs.live.param.LiveOrderConfirmParam;
-import com.fs.live.service.ILiveOrderService;
-import com.fs.live.vo.LiveOrderListVo;
-import com.github.pagehelper.PageHelper;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-import java.util.Map;
-
-import static com.fs.his.utils.PhoneUtil.decryptPhone;
-import static com.github.pagehelper.page.PageMethod.startPage;
-
-/**
- * 订单Controller
- *
- * @author fs
- * @date 2025-07-08
- */
-@RestController
-@RequestMapping("/app/live/liveOrder")
-public class LiveOrderController extends AppBaseController
-{
-    @Autowired
-    private ILiveOrderService liveOrderService;
-
-
-    @Autowired
-    private IFsExpressService expressService;
-    @Autowired
-    private JwtUtils jwtUtils;
-
-    /**
-     * 查询订单列表
-     */
-    @Login
-    @GetMapping("/list")
-    public TableDataInfo list(LiveOrder liveOrder)
-    {
-        PageHelper.startPage(liveOrder.getPageNum(), liveOrder.getPageSize());
-        liveOrder.setUserId(getUserId());
-        List<LiveOrderListVo> list = liveOrderService.selectLiveOrderListVo(liveOrder);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出订单列表
-     */
-    @Log(title = "订单", businessType = BusinessType.EXPORT)
-    @GetMapping("/export")
-    public AjaxResult export(LiveOrder liveOrder)
-    {
-        List<LiveOrder> list = liveOrderService.selectLiveOrderList(liveOrder);
-        ExcelUtil<LiveOrder> util = new ExcelUtil<LiveOrder>(LiveOrder.class);
-        return util.exportExcel(list, "订单数据");
-    }
-
-    /**
-     * 获取订单详细信息
-     */
-    @Login
-    @GetMapping(value = "/info/{orderId}")
-    public AjaxResult getInfo(@PathVariable("orderId") String orderId)
-    {
-        return AjaxResult.success(liveOrderService.selectLiveOrderByOrderId(orderId));
-    }
-
-    @ApiOperation("确认订单")
-    @PostMapping("/confirm")
-    public R confirm(@Validated @RequestBody LiveOrderConfirmParam param, HttpServletRequest request){
-        param.setUserId(Long.parseLong(getUserId()));
-        return liveOrderService.confirmOrder(param);
-    }
-
-    @PostMapping("/buy")
-    @ApiOperation("购物车购买")
-    @Login
-    @RepeatSubmit
-    public R buy(@RequestBody LiveOrder liveOrder)
-    {
-        liveOrder.setUserId(getUserId());
-        return liveOrderService.buy(liveOrder);
-    }
-
-    /**
-     * 新增订单
-     */
-    @Login
-    @Log(title = "订单", businessType = BusinessType.INSERT)
-    @PostMapping("/create")
-    @RepeatSubmit
-    public R add(@RequestBody LiveOrder liveOrder)
-    {
-        liveOrder.setUserId(getUserId());
-        return liveOrderService.createLiveOrder(liveOrder);
-    }
-
-    /**
-     * 修改订单
-     */
-    @Login
-    @Log(title = "订单", businessType = BusinessType.UPDATE)
-    @PutMapping("/update")
-    @RepeatSubmit
-    public R edit(@RequestBody LiveOrder liveOrder)
-    {
-        return R.ok().put("orderId",liveOrder.getOrderId());
-    }
-
-
-    /**
-     * 查看物流状态
-     * */
-    @Login
-    @GetMapping(value = "/getExpress/{id}")
-    public R getExpress(@PathVariable("id") String id)
-    {
-        LiveOrder order=liveOrderService.selectLiveOrderByOrderId(id);
-        ExpressInfoDTO expressInfoDTO=null;
-        if(StringUtils.isNotEmpty(order.getDeliverySn())){
-            String lastFourNumber = "";
-            if (order.getDeliveryCode().equals(ShipperCodeEnum.SF.getValue())) {
-
-                lastFourNumber = order.getUserPhone();
-                if (lastFourNumber.length() == 11) {
-                    lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
-                }else if (lastFourNumber.length()>11){
-                    String jm = decryptPhone(lastFourNumber);
-                    lastFourNumber = StrUtil.sub(jm, jm.length(), -4);
-                }
-            }
-            expressInfoDTO=expressService.getExpressInfo(order.getOrderCode(),order.getDeliveryCode(),order.getDeliverySn(),lastFourNumber);
-
-            if((expressInfoDTO.getStateEx()!=null&&expressInfoDTO.getStateEx().equals("0"))&&(expressInfoDTO.getState()!=null&&expressInfoDTO.getState().equals("0"))){
-                lastFourNumber = "19923690275";
-                if (order.getDeliveryCode().equals(ShipperCodeEnum.SF.getValue())) {
-                    if (lastFourNumber.length() == 11) {
-                        lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
-                    }
-                }
-
-                expressInfoDTO=expressService.getExpressInfo(order.getOrderCode(),order.getDeliveryCode(),order.getDeliverySn(),lastFourNumber);
-
-            }
-        }
-        return R.ok().put("data",expressInfoDTO);
-    }
-
-    /**
-     * 支付订单
-     * */
-    @PostMapping(value = "/pay")
-    public void pay(LiveOrder liveOrder)
-    {
-       liveOrderService.handlePay(liveOrder);
-    }
-
-    @Login
-    @ApiOperation("支付宝支付")
-    @PostMapping("/aliPayment")
-    @RepeatSubmit
-    public R aliPayment(@Validated @RequestBody FsUserLiveOrderPayUParam param)
-    {
-        param.setUserId(Long.parseLong(getUserId()));
-        return liveOrderService.aliPayment(param);
-    }
-
-    @Login
-    @ApiOperation("微信支付")
-    @PostMapping("/weChatPayment")
-    @RepeatSubmit
-    public R payment(@Validated @RequestBody FsUserLiveOrderPayUParam param)
-    {
-        param.setUserId(Long.parseLong(getUserId()));
-        return liveOrderService.wxPayment(param);
-    }
-
-    /**
-     * 订单确认
-     * */
-    @Login
-    @GetMapping(value = "/updateConfirm/{orderId}/{type}")
-    @RepeatSubmit
-    public R cancelConfirm(@PathVariable String orderId,@PathVariable String type)
-    {
-        LiveOrder byId = liveOrderService.getById(orderId);
-        List<Map<String, String>> allCodeDescMap = null;
-        if (type.equals("0"))
-            allCodeDescMap = LiveOrderCancleReason.getAllCodeDescMap();
-        return R.ok().put("reason",allCodeDescMap).put("data",byId);
-    }
-
-    /**
-     *正在购买的用户
-     * */
-    @GetMapping(value = "/liveOrderUser/{liveId}")
-    public R liveOrderUser(@PathVariable  String liveId)
-    {
-        return liveOrderService.liveOrderUser(liveId);
-    }
-
-    @Login
-    @ApiOperation("取消订单")
-    @PostMapping("/cancelOrder")
-    public R cancelOrder(@Validated @RequestBody LiveOrderCancelParam param, HttpServletRequest request){
-        LiveOrder order=liveOrderService.selectLiveOrderByOrderId(String.valueOf(param.getOrderId()));
-        if (ObjectUtil.isNull(order)) {
-            throw new CustomException("订单不存在");
-        }
-        return liveOrderService.cancelOrder(order);
-
-    }
-
-    @Login
-    @ApiOperation("完成订单")
-    @PostMapping("/finishOrder")
-    public R finishOrder(@Validated @RequestBody LiveOrderCancelParam param, HttpServletRequest request){
-        return liveOrderService.finishOrder(param.getOrderId());
-    }
-
-
-
-}

+ 0 - 97
fs-live-app/src/main/java/com/fs/app/controller/LiveOrderLogsController.java

@@ -1,97 +0,0 @@
-package com.fs.app.controller;
-
-import com.fs.common.annotation.Log;
-import com.fs.common.core.controller.BaseController;
-import com.fs.common.core.domain.AjaxResult;
-import com.fs.common.core.page.TableDataInfo;
-import com.fs.common.enums.BusinessType;
-import com.fs.common.utils.poi.ExcelUtil;
-import com.fs.live.domain.LiveOrderLogs;
-import com.fs.live.service.ILiveOrderLogsService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * 订单操作记录Controller
- *
- * @author fs
- * @date 2025-07-08
- */
-@RestController
-@RequestMapping("/live/liveOrderLogs")
-public class LiveOrderLogsController extends BaseController
-{
-    @Autowired
-    private ILiveOrderLogsService liveOrderLogsService;
-
-    /**
-     * 查询订单操作记录列表
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveOrderLogs:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(LiveOrderLogs liveOrderLogs)
-    {
-        startPage();
-        List<LiveOrderLogs> list = liveOrderLogsService.selectLiveOrderLogsList(liveOrderLogs);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出订单操作记录列表
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveOrderLogs:export')")
-    @Log(title = "订单操作记录", businessType = BusinessType.EXPORT)
-    @GetMapping("/export")
-    public AjaxResult export(LiveOrderLogs liveOrderLogs)
-    {
-        List<LiveOrderLogs> list = liveOrderLogsService.selectLiveOrderLogsList(liveOrderLogs);
-        ExcelUtil<LiveOrderLogs> util = new ExcelUtil<LiveOrderLogs>(LiveOrderLogs.class);
-        return util.exportExcel(list, "订单操作记录数据");
-    }
-
-    /**
-     * 获取订单操作记录详细信息
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveOrderLogs:query')")
-    @GetMapping(value = "/{logsId}")
-    public AjaxResult getInfo(@PathVariable("logsId") String logsId)
-    {
-        return AjaxResult.success(liveOrderLogsService.selectLiveOrderLogsByLogsId(logsId));
-    }
-
-    /**
-     * 新增订单操作记录
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveOrderLogs:add')")
-    @Log(title = "订单操作记录", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody LiveOrderLogs liveOrderLogs)
-    {
-        return toAjax(liveOrderLogsService.insertLiveOrderLogs(liveOrderLogs));
-    }
-
-    /**
-     * 修改订单操作记录
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveOrderLogs:edit')")
-    @Log(title = "订单操作记录", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody LiveOrderLogs liveOrderLogs)
-    {
-        return toAjax(liveOrderLogsService.updateLiveOrderLogs(liveOrderLogs));
-    }
-
-    /**
-     * 删除订单操作记录
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveOrderLogs:remove')")
-    @Log(title = "订单操作记录", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{logsIds}")
-    public AjaxResult remove(@PathVariable String[] logsIds)
-    {
-        return toAjax(liveOrderLogsService.deleteLiveOrderLogsByLogsIds(logsIds));
-    }
-}

+ 0 - 104
fs-live-app/src/main/java/com/fs/app/controller/LiveOrderPaymentController.java

@@ -1,104 +0,0 @@
-package com.fs.app.controller;
-
-import java.util.List;
-
-import com.fs.live.domain.LiveOrderPayment;
-import com.fs.live.service.ILiveOrderPaymentService;
-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.common.utils.poi.ExcelUtil;
-import com.fs.common.core.page.TableDataInfo;
-
-/**
- * 支付明细Controller
- *
- * @author fs
- * @date 2025-08-07
- */
-@RestController
-@RequestMapping("/app/payment")
-public class LiveOrderPaymentController extends BaseController
-{
-    @Autowired
-    private ILiveOrderPaymentService liveOrderPaymentService;
-
-    /**
-     * 查询支付明细列表
-     */
-    @PreAuthorize("@ss.hasPermi('app:payment:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(LiveOrderPayment liveOrderPayment)
-    {
-        startPage();
-        List<LiveOrderPayment> list = liveOrderPaymentService.selectLiveOrderPaymentList(liveOrderPayment);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出支付明细列表
-     */
-    @PreAuthorize("@ss.hasPermi('app:payment:export')")
-    @Log(title = "支付明细", businessType = BusinessType.EXPORT)
-    @GetMapping("/export")
-    public AjaxResult export(LiveOrderPayment liveOrderPayment)
-    {
-        List<LiveOrderPayment> list = liveOrderPaymentService.selectLiveOrderPaymentList(liveOrderPayment);
-        ExcelUtil<LiveOrderPayment> util = new ExcelUtil<LiveOrderPayment>(LiveOrderPayment.class);
-        return util.exportExcel(list, "支付明细数据");
-    }
-
-    /**
-     * 获取支付明细详细信息
-     */
-    @PreAuthorize("@ss.hasPermi('app:payment:query')")
-    @GetMapping(value = "/{paymentId}")
-    public AjaxResult getInfo(@PathVariable("paymentId") Long paymentId)
-    {
-        return AjaxResult.success(liveOrderPaymentService.selectLiveOrderPaymentByPaymentId(paymentId));
-    }
-
-    /**
-     * 新增支付明细
-     */
-    @PreAuthorize("@ss.hasPermi('app:payment:add')")
-    @Log(title = "支付明细", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody LiveOrderPayment liveOrderPayment)
-    {
-        return toAjax(liveOrderPaymentService.insertLiveOrderPayment(liveOrderPayment));
-    }
-
-    /**
-     * 修改支付明细
-     */
-    @PreAuthorize("@ss.hasPermi('app:payment:edit')")
-    @Log(title = "支付明细", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody LiveOrderPayment liveOrderPayment)
-    {
-        return toAjax(liveOrderPaymentService.updateLiveOrderPayment(liveOrderPayment));
-    }
-
-    /**
-     * 删除支付明细
-     */
-    @PreAuthorize("@ss.hasPermi('app:payment:remove')")
-    @Log(title = "支付明细", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{paymentIds}")
-    public AjaxResult remove(@PathVariable Long[] paymentIds)
-    {
-        return toAjax(liveOrderPaymentService.deleteLiveOrderPaymentByPaymentIds(paymentIds));
-    }
-}

+ 0 - 30
fs-live-app/src/main/java/com/fs/app/controller/LiveRedController.java

@@ -1,30 +0,0 @@
-package com.fs.app.controller;
-
-import com.fs.app.annotation.Login;
-import com.fs.common.core.domain.R;
-import com.fs.live.param.RedPO;
-import com.fs.live.service.ILiveRedConfService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-@RequestMapping("/app/live/liveRed")
-public class LiveRedController extends AppBaseController{
-
-    @Autowired
-    private ILiveRedConfService liveRedConfService;
-
-    /**
-     * 领取红包
-     * */
-    @Login
-    @PostMapping("/claim")
-    public R claim(@RequestBody RedPO red) {
-        red.setUserId(Long.parseLong(getUserId()));
-        return liveRedConfService.claimRedPacket(red);
-    }
-
-}

+ 0 - 97
fs-live-app/src/main/java/com/fs/app/controller/LiveUserFavoriteController.java

@@ -1,97 +0,0 @@
-package com.fs.app.controller;
-
-import com.fs.common.annotation.Log;
-import com.fs.common.core.controller.BaseController;
-import com.fs.common.core.domain.AjaxResult;
-import com.fs.common.core.page.TableDataInfo;
-import com.fs.common.enums.BusinessType;
-import com.fs.common.utils.poi.ExcelUtil;
-import com.fs.live.domain.LiveUserFavorite;
-import com.fs.live.service.ILiveUserFavoriteService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * 用户直播收藏Controller
- *
- * @author fs
- * @date 2025-07-11
- */
-@RestController
-@RequestMapping("/app/live/liveUserFavorite")
-public class LiveUserFavoriteController extends BaseController
-{
-    @Autowired
-    private ILiveUserFavoriteService liveUserFavoriteService;
-
-    /**
-     * 查询用户直播收藏列表
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveUserFavorite:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(LiveUserFavorite liveUserFavorite)
-    {
-        startPage();
-        List<LiveUserFavorite> list = liveUserFavoriteService.selectLiveUserFavoriteList(liveUserFavorite);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出用户直播收藏列表
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveUserFavorite:export')")
-    @Log(title = "用户直播收藏", businessType = BusinessType.EXPORT)
-    @GetMapping("/export")
-    public AjaxResult export(LiveUserFavorite liveUserFavorite)
-    {
-        List<LiveUserFavorite> list = liveUserFavoriteService.selectLiveUserFavoriteList(liveUserFavorite);
-        ExcelUtil<LiveUserFavorite> util = new ExcelUtil<LiveUserFavorite>(LiveUserFavorite.class);
-        return util.exportExcel(list, "用户直播收藏数据");
-    }
-
-    /**
-     * 获取用户直播收藏详细信息
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveUserFavorite:query')")
-    @GetMapping(value = "/{favoriteId}")
-    public AjaxResult getInfo(@PathVariable("favoriteId") Long favoriteId)
-    {
-        return AjaxResult.success(liveUserFavoriteService.selectLiveUserFavoriteByFavoriteId(favoriteId));
-    }
-
-    /**
-     * 新增用户直播收藏
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveUserFavorite:add')")
-    @Log(title = "用户直播收藏", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody LiveUserFavorite liveUserFavorite)
-    {
-        return toAjax(liveUserFavoriteService.insertLiveUserFavorite(liveUserFavorite));
-    }
-
-    /**
-     * 修改用户直播收藏
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveUserFavorite:edit')")
-    @Log(title = "用户直播收藏", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody LiveUserFavorite liveUserFavorite)
-    {
-        return toAjax(liveUserFavoriteService.updateLiveUserFavorite(liveUserFavorite));
-    }
-
-    /**
-     * 删除用户直播收藏
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveUserFavorite:remove')")
-    @Log(title = "用户直播收藏", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{favoriteIds}")
-    public AjaxResult remove(@PathVariable Long[] favoriteIds)
-    {
-        return toAjax(liveUserFavoriteService.deleteLiveUserFavoriteByFavoriteIds(favoriteIds));
-    }
-}

+ 0 - 97
fs-live-app/src/main/java/com/fs/app/controller/LiveUserFollowController.java

@@ -1,97 +0,0 @@
-package com.fs.app.controller;
-
-import com.fs.common.annotation.Log;
-import com.fs.common.core.controller.BaseController;
-import com.fs.common.core.domain.AjaxResult;
-import com.fs.common.core.page.TableDataInfo;
-import com.fs.common.enums.BusinessType;
-import com.fs.common.utils.poi.ExcelUtil;
-import com.fs.live.domain.LiveUserFollow;
-import com.fs.live.service.ILiveUserFollowService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * 用户直播关注Controller
- *
- * @author fs
- * @date 2025-07-11
- */
-@RestController
-@RequestMapping("/app/live/liveUserFollow")
-public class LiveUserFollowController extends BaseController
-{
-    @Autowired
-    private ILiveUserFollowService liveUserFollowService;
-
-    /**
-     * 查询用户直播关注列表
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveUserFollow:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(LiveUserFollow liveUserFollow)
-    {
-        startPage();
-        List<LiveUserFollow> list = liveUserFollowService.selectLiveUserFollowList(liveUserFollow);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出用户直播关注列表
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveUserFollow:export')")
-    @Log(title = "用户直播关注", businessType = BusinessType.EXPORT)
-    @GetMapping("/export")
-    public AjaxResult export(LiveUserFollow liveUserFollow)
-    {
-        List<LiveUserFollow> list = liveUserFollowService.selectLiveUserFollowList(liveUserFollow);
-        ExcelUtil<LiveUserFollow> util = new ExcelUtil<LiveUserFollow>(LiveUserFollow.class);
-        return util.exportExcel(list, "用户直播关注数据");
-    }
-
-    /**
-     * 获取用户直播关注详细信息
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveUserFollow:query')")
-    @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
-        return AjaxResult.success(liveUserFollowService.selectLiveUserFollowById(id));
-    }
-
-    /**
-     * 新增用户直播关注
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveUserFollow:add')")
-    @Log(title = "用户直播关注", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody LiveUserFollow liveUserFollow)
-    {
-        return toAjax(liveUserFollowService.insertLiveUserFollow(liveUserFollow));
-    }
-
-    /**
-     * 修改用户直播关注
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveUserFollow:edit')")
-    @Log(title = "用户直播关注", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody LiveUserFollow liveUserFollow)
-    {
-        return toAjax(liveUserFollowService.updateLiveUserFollow(liveUserFollow));
-    }
-
-    /**
-     * 删除用户直播关注
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveUserFollow:remove')")
-    @Log(title = "用户直播关注", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
-        return toAjax(liveUserFollowService.deleteLiveUserFollowByIds(ids));
-    }
-}

+ 0 - 60
fs-live-app/src/main/java/com/fs/app/controller/LiveUserGiftController.java

@@ -1,60 +0,0 @@
-package com.fs.app.controller;
-
-import com.fs.app.annotation.Login;
-import com.fs.common.core.redis.RedisCache;
-import com.fs.his.domain.FsUser;
-import com.fs.his.service.IFsUserService;
-import com.fs.live.domain.LiveGift;
-import com.fs.live.domain.LiveUserGift;
-import com.fs.live.service.ILiveGiftService;
-import com.fs.live.service.ILiveUserGiftService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-@RestController
-@RequestMapping("/app/live/liveUserGift")
-public class LiveUserGiftController extends AppBaseController{
-
-    @Autowired
-    private ILiveUserGiftService liveUserGiftService;
-
-    @Autowired
-    private ILiveGiftService liveGiftService;
-
-    @Autowired
-    private RedisCache redisCache;
-
-    @Autowired
-    private IFsUserService  fsUserService;
-
-    /**
-     *给直播间送礼物
-     */
-    @Login
-    @PostMapping("/send")
-    @Transactional
-    public String send(@RequestBody LiveUserGift liveUserGift) {
-        liveUserGift.setUserId(Long.parseLong(getUserId()));
-        long giftValue;
-        List<LiveGift> liveGifts = redisCache.getCacheList("liveGift");
-        LiveGift liveGift = liveGifts.stream().filter(gift ->
-                gift.getGiftId().equals(liveUserGift.getGiftId()))
-                .findFirst().orElse(null);
-        if (liveGift == null) {
-            return "礼物信息不存在";
-        }else{
-            giftValue = liveGift.getPrice().longValue() * liveUserGift.getCn();
-        }
-        FsUser user=fsUserService.selectFsUserByUserId(liveUserGift.getUserId());
-        if (user.getIntegral() < giftValue) {
-            return "账户余额不足";
-        }
-        user.setIntegral(user.getIntegral() - giftValue);
-        fsUserService.updateFsUser(user);
-        return liveUserGiftService.save(liveUserGift)?"赠送礼物成功":"赠送礼物失败";
-    }
-
-}

+ 0 - 97
fs-live-app/src/main/java/com/fs/app/controller/LiveUserLikeController.java

@@ -1,97 +0,0 @@
-package com.fs.app.controller;
-
-import com.fs.common.annotation.Log;
-import com.fs.common.core.controller.BaseController;
-import com.fs.common.core.domain.AjaxResult;
-import com.fs.common.core.page.TableDataInfo;
-import com.fs.common.enums.BusinessType;
-import com.fs.common.utils.poi.ExcelUtil;
-import com.fs.live.domain.LiveUserLike;
-import com.fs.live.service.ILiveUserLikeService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * 用户直播赞Controller
- *
- * @author fs
- * @date 2025-07-11
- */
-@RestController
-@RequestMapping("/app/live/liveUserLike")
-public class LiveUserLikeController extends BaseController
-{
-    @Autowired
-    private ILiveUserLikeService liveUserLikeService;
-
-    /**
-     * 查询用户直播赞列表
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveUserLike:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(LiveUserLike liveUserLike)
-    {
-        startPage();
-        List<LiveUserLike> list = liveUserLikeService.selectLiveUserLikeList(liveUserLike);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出用户直播赞列表
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveUserLike:export')")
-    @Log(title = "用户直播赞", businessType = BusinessType.EXPORT)
-    @GetMapping("/export")
-    public AjaxResult export(LiveUserLike liveUserLike)
-    {
-        List<LiveUserLike> list = liveUserLikeService.selectLiveUserLikeList(liveUserLike);
-        ExcelUtil<LiveUserLike> util = new ExcelUtil<LiveUserLike>(LiveUserLike.class);
-        return util.exportExcel(list, "用户直播赞数据");
-    }
-
-    /**
-     * 获取用户直播赞详细信息
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveUserLike:query')")
-    @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
-        return AjaxResult.success(liveUserLikeService.selectLiveUserLikeById(id));
-    }
-
-    /**
-     * 新增用户直播赞
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveUserLike:add')")
-    @Log(title = "用户直播赞", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody LiveUserLike liveUserLike)
-    {
-        return toAjax(liveUserLikeService.insertLiveUserLike(liveUserLike));
-    }
-
-    /**
-     * 修改用户直播赞
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveUserLike:edit')")
-    @Log(title = "用户直播赞", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody LiveUserLike liveUserLike)
-    {
-        return toAjax(liveUserLikeService.updateLiveUserLike(liveUserLike));
-    }
-
-    /**
-     * 删除用户直播赞
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveUserLike:remove')")
-    @Log(title = "用户直播赞", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
-        return toAjax(liveUserLikeService.deleteLiveUserLikeByIds(ids));
-    }
-}

+ 0 - 98
fs-live-app/src/main/java/com/fs/app/controller/LiveWatchUserController.java

@@ -1,98 +0,0 @@
-package com.fs.app.controller;
-
-import com.fs.common.annotation.Log;
-import com.fs.common.core.controller.BaseController;
-import com.fs.common.core.domain.AjaxResult;
-import com.fs.common.core.page.TableDataInfo;
-import com.fs.common.enums.BusinessType;
-import com.fs.common.utils.poi.ExcelUtil;
-import com.fs.live.domain.LiveWatchUser;
-import com.fs.live.service.ILiveWatchUserService;
-import com.fs.live.vo.LiveWatchUserVO;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * 直播间观看用户Controller
- *
- * @author fs
- * @date 2025-01-18
- */
-@RestController
-@RequestMapping("/app/live/liveWatchUser")
-public class LiveWatchUserController extends BaseController
-{
-    @Autowired
-    private ILiveWatchUserService liveWatchUserService;
-
-
-
-
-    @GetMapping("/watchUserList")
-    public TableDataInfo watchUserList(LiveWatchUser param) {
-        param.setOnline(0);
-        List<LiveWatchUserVO> onLineUserList = liveWatchUserService.selectOnlineUserList(param);
-        return getDataTable(onLineUserList);
-    }
-
-
-    /**
-     * 获取直播间观看用户详细信息
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveWatchUser:query')")
-    @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
-        return AjaxResult.success(liveWatchUserService.selectLiveWatchUserById(id));
-    }
-
-    /**
-     * 新增直播间观看用户
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveWatchUser:add')")
-    @Log(title = "直播间观看用户", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody LiveWatchUser liveWatchUser)
-    {
-        return toAjax(liveWatchUserService.insertLiveWatchUser(liveWatchUser));
-    }
-
-    /**
-     * 修改直播间观看用户
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveWatchUser:edit')")
-    @Log(title = "直播间观看用户", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody LiveWatchUser liveWatchUser)
-    {
-        return toAjax(liveWatchUserService.updateLiveWatchUser(liveWatchUser));
-    }
-
-    /**
-     * 删除直播间观看用户
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveWatchUser:remove')")
-    @Log(title = "直播间观看用户", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
-        return toAjax(liveWatchUserService.deleteLiveWatchUserByIds(ids));
-    }
-
-    /**
-     * 修改直播间用户禁言状态
-     */
-    @PreAuthorize("@ss.hasPermi('live:liveWatchUser:edit')")
-    @Log(title = "直播间观看用户", businessType = BusinessType.UPDATE)
-    @PutMapping("/changeUserState")
-    public AjaxResult changeUserState(@RequestParam Long liveId, @RequestParam Long userId) {
-        return toAjax(liveWatchUserService.changeUserState(liveId, userId));
-    }
-
-}

+ 0 - 148
fs-live-app/src/main/java/com/fs/app/controller/UserAddressController.java

@@ -1,148 +0,0 @@
-package com.fs.app.controller;
-
-
-import cn.hutool.core.bean.BeanUtil;
-import com.fs.app.annotation.Login;
-import com.fs.app.param.FsAddressParseParam;
-import com.fs.app.param.FsUserAddressAddEditParam;
-import com.fs.common.annotation.RepeatSubmit;
-import com.fs.common.core.domain.R;
-import com.fs.his.domain.FsUserAddress;
-import com.fs.his.service.IFsCityService;
-import com.fs.his.service.IFsExpressService;
-import com.fs.his.service.IFsUserAddressService;
-import com.fs.his.service.IFsUserIntegralLogsService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.validation.Valid;
-import java.util.List;
-
-import static com.fs.his.utils.PhoneUtil.decryptPhone;
-
-
-@Api("地址接口")
-@RestController
-@RequestMapping(value="/app/userAddress")
-public class UserAddressController extends  AppBaseController {
-
-
-    @Autowired
-    private IFsUserAddressService addressService;
-
-    @Autowired
-    private IFsCityService cityService;
-    @Autowired
-    private IFsExpressService expressService;
-    @Autowired
-    private IFsUserIntegralLogsService fsUserIntegralLogsService;
-
-
-
-
-    @Login
-    @ApiOperation("获取地址列表")
-    @GetMapping("/getAddressList")
-    public R getAddressList(HttpServletRequest request){
-        try {
-            FsUserAddress map=new FsUserAddress();
-            map.setUserId(Long.parseLong(getUserId()));
-            map.setIsDel(0);
-            List<FsUserAddress> list=addressService.selectFsUserAddressList(map);
-            for (FsUserAddress fsUserAddress : list) {
-
-                if (fsUserAddress.getPhone()!=null&&fsUserAddress.getPhone().length()>11&&!fsUserAddress.getPhone().matches("\\d+")){
-                    fsUserAddress.setPhone(decryptPhone(fsUserAddress.getPhone()));
-                }
-            }
-            return R.ok().put("data",list);
-        } catch (Exception e){
-            return R.error("操作异常");
-        }
-    }
-    @Login
-    @ApiOperation("获取地址信息")
-    @GetMapping("/getAddressById")
-    public R getAddressById(@RequestParam("addressId")Long addressId, HttpServletRequest request){
-        FsUserAddress address=addressService.selectFsUserAddressByAddressId(addressId);
-
-        if (address.getPhone()!=null&&address.getPhone().length()>11&&!address.getPhone().matches("\\d+")){
-            address.setPhone(decryptPhone(address.getPhone()));
-        }
-        if(!address.getUserId().equals(Long.parseLong(getUserId()))){
-            return R.error("非法操作");
-        }
-        return R.ok().put("data",address);
-    }
-    @Login
-    @RepeatSubmit
-    @ApiOperation("添加地址")
-    @PostMapping("/addAddress")
-    public R addAddress(@Valid @RequestBody FsUserAddressAddEditParam address, HttpServletRequest request){
-        //处理地址数量 最大20个
-        Integer count=addressService.selectFsUserAddressCountsByUserId(Long.parseLong(getUserId()));
-        if(count>10){
-            return R.error("最多可创建10个地址");
-        }
-        if(address.getIsDefault()==1){
-            //处理默认地址
-            addressService.clearIsDefalut(Long.parseLong(getUserId()));
-        }
-        FsUserAddress userAddress=new FsUserAddress();
-        BeanUtil.copyProperties(address, userAddress);
-        address.setPhone(address.getPhone().trim());
-        userAddress.setUserId(Long.parseLong(getUserId()));
-        addressService.insertFsUserAddress(userAddress);
-        fsUserIntegralLogsService.addUserAddressIntegral(Long.parseLong(getUserId()),userAddress.getAddressId());
-        return R.ok("操作成功");
-    }
-
-    @Login
-    @ApiOperation("编辑地址")
-    @PostMapping("/editAddress")
-    public R editAddress(@Valid @RequestBody FsUserAddressAddEditParam address, HttpServletRequest request){
-        if(address.getIsDefault()==1){
-            //处理默认地址
-            addressService.clearIsDefalut(Long.parseLong(getUserId()));
-        }
-        FsUserAddress userAddress=new FsUserAddress();
-        BeanUtil.copyProperties(address, userAddress);
-        addressService.updateFsUserAddress(userAddress);
-        return R.ok("操作成功");
-    }
-
-    @Login
-    @ApiOperation("删除地址")
-    @PostMapping("/delAddress")
-    public R delAddress(@RequestBody FsUserAddressAddEditParam address, HttpServletRequest request){
-        addressService.deleteFsUserAddressByAddressId(address.getAddressId());
-        return R.ok("操作成功");
-    }
-
-    @Login
-    @ApiOperation("地址解析")
-    @PostMapping("/parseAddress")
-    public R parseAddress(@RequestBody FsAddressParseParam param){
-        return expressService.parseAddress(param.getContent());
-    }
-
-    @Login
-    @ApiOperation("获取默认地址信息")
-    @GetMapping("/getAddressByDefault")
-    public R getAddressByDefault( HttpServletRequest request){
-        FsUserAddress address=addressService.selectFsUserAddressByDefault(Long.parseLong(getUserId()));
-        if (address!=null&&address.getPhone()!=null&&address.getPhone().length()>11&&!address.getPhone().matches("\\d+")){
-            address.setPhone(decryptPhone(address.getPhone()));
-        }
-        if (null!=address){
-            if(!address.getUserId().equals(Long.parseLong(getUserId()))){
-                return R.error("非法操作");
-            }
-        }
-        return R.ok().put("data",address);
-    }
-
-}

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

@@ -1,546 +0,0 @@
-package com.fs.app.controller;
-
-
-import cn.hutool.core.date.DateTime;
-import com.fs.app.annotation.Login;
-import com.fs.app.param.FsUserEditPhoneParam;
-import com.fs.app.param.FsUserLoginByWeChatParam;
-import com.fs.app.param.FsUserLoginParam;
-import com.fs.app.param.LoginParam;
-import com.fs.app.utils.WxUtil;
-import com.fs.app.websocket.constant.NickNameConstant;
-import com.fs.common.annotation.RepeatSubmit;
-import com.fs.common.constant.Constants;
-import com.fs.common.core.domain.AjaxResult;
-import com.fs.common.core.domain.R;
-import com.fs.common.core.redis.RedisCache;
-import com.fs.common.exception.user.CaptchaException;
-import com.fs.common.exception.user.CaptchaExpireException;
-import com.fs.common.utils.MessageUtils;
-import com.fs.common.utils.StringUtils;
-import com.fs.common.utils.sign.Md5Utils;
-import com.fs.company.domain.CompanyUser;
-import com.fs.company.service.ICompanyPostService;
-import com.fs.company.service.ICompanyUserService;
-import com.fs.framework.manager.AsyncManager;
-import com.fs.framework.manager.factory.AsyncFactory;
-import com.fs.his.domain.FsUser;
-import com.fs.his.domain.FsUserAddress;
-import com.fs.his.mapper.FsUserMapper;
-import com.fs.his.service.IFsUserNewTaskService;
-import com.fs.his.service.IFsUserService;
-import com.fs.his.vo.FsUserRegisterParam;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import lombok.AllArgsConstructor;
-import me.chanjar.weixin.common.bean.WxOAuth2UserInfo;
-import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
-import me.chanjar.weixin.common.error.WxErrorException;
-import me.chanjar.weixin.mp.api.WxMpService;
-import me.chanjar.weixin.mp.api.WxMpUserService;
-import me.chanjar.weixin.mp.bean.result.WxMpUser;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.*;
-import java.util.concurrent.TimeUnit;
-
-import static com.fs.his.utils.PhoneUtil.decryptPhoneMk;
-import static com.fs.his.utils.PhoneUtil.encryptPhone;
-
-
-@Api("用户接口")
-@RestController
-@AllArgsConstructor
-@RequestMapping(value="/app/user")
-public class UserController extends AppBaseController {
-	private final ICompanyPostService postService;
-	private final ICompanyUserService companyUserService;
-	private final RedisCache redisCache;
-	private final WxMpService wxMpService;
-	private final IFsUserService userService;
-
-	private final Logger logger = LoggerFactory.getLogger(this.getClass());
-
-	@Autowired
-	private FsUserMapper userMapper;
-	@Autowired
-	private IFsUserNewTaskService userNewTaskService;
-
-	private static final String APP_ID = "wxd70f99287830cb51";
-	private static final String APP_SECRET = "51129ad15e25fb63b4e6c025df56a541";
-
-
-	@ApiOperation("课程短链公众号登录")
-	@PostMapping("/loginByMp")
-	public R loginByMp( @RequestBody LoginParam param) {
-		if (StringUtils.isBlank(param.getCode())) {
-			return R.error("code不存在");
-		}
-		try{
-			WxOAuth2AccessToken wxMpOAuth2AccessToken = wxMpService.getOAuth2Service().getAccessToken(param.getCode());
-			WxOAuth2UserInfo wxMpUser = wxMpService.getOAuth2Service().getUserInfo(wxMpOAuth2AccessToken, null);
-			WxMpUserService wxMpUserService = wxMpService.getUserService();
-			WxMpUser userInfo = wxMpUserService.userInfo(wxMpUser.getOpenid());
-			if (!userInfo.getSubscribe()){
-				return R.error("请关注公众号进行登录");
-			}
-			FsUser user=userService.selectFsUserByUnionid(param.getUnionId());
-			if(user!=null){
-				FsUser userMap=new FsUser();
-				userMap.setUserId(user.getUserId());
-				userMap.setNickName(wxMpUser.getNickname());
-				userMap.setAvatar(wxMpUser.getHeadImgUrl());
-				userMap.setMpOpenId(wxMpUser.getOpenid());
-				userMap.setUpdateTime(new DateTime());
-				userService.updateFsUser(userMap);
-			}
-			else{
-				//写入
-				user=new FsUser();
-				user.setNickName(wxMpUser.getNickname());
-				user.setAvatar(wxMpUser.getHeadImgUrl());
-				user.setStatus(1);
-				user.setSex(wxMpUser.getSex());
-				user.setMpOpenId(wxMpUser.getOpenid());
-				user.setUnionId(wxMpUser.getUnionId());
-				user.setCreateTime(new Date());
-				userService.insertFsUser(user);
-			}
-			String token = jwtUtils.generateToken(user.getUserId());
-			redisCache.setCacheObject("token:"+user.getUserId(),token,604800, TimeUnit.SECONDS);
-			Map<String,Object> map=new HashMap<>();
-			map.put("token",token);
-			map.put("user",user);
-			return R.ok(map);
-		}
-		catch (WxErrorException e){
-			if(e.getError().getErrorCode()==40163){
-				return R.error(40163,e.getError().getErrorMsg());
-			}
-			else{
-				return R.error("授权失败,"+e.getMessage());
-			}
-		}
-
-	}
-
-
-	/**
-	 * 获取用户信息
-	 */
-	@Login
-	@ApiOperation("获取用户信息")
-	@GetMapping("/getUserInfo")
-	public R getUserInfo(){
-		try {
-			CompanyUser companyUser=companyUserService.selectCompanyUserById(Long.parseLong(getUserId()));
-			List<String> postList=postService.selectPostNameListByUserId(Long.parseLong(getUserId()));
-			if(companyUser==null){
-				return R.error(40001,"用户不存在");
-			}
-			if(companyUser.getStatus().equals("1")){
-				return R.error(40002,"用户已停用");
-			}
-			return R.ok().put("user",companyUser).put("post",postList);
-		} catch (Exception e){
-
-			return R.error("操作异常");
-		}
-	}
-	@Login
-	@ApiOperation("获取用户信息ByUserId")
-	@GetMapping("/getUserInfoByUserId")
-	public R getUserInfoByUserId(
-			@ApiParam(required = true, name = "userId", value = "用户ID") @RequestParam(value = "userId", required = false) Long userId,
-			HttpServletRequest request){
-		try {
-			CompanyUser user=companyUserService.selectCompanyUserById(userId);
-			List<String> postList=postService.selectPostNameListByUserId(userId);
-			if(user==null){
-				return R.error(40001,"用户不存在");
-			}
-			if(user.getStatus().equals("1")){
-				return R.error(40002,"用户已停用");
-			}
-			return R.ok().put("user",user).put("post",postList);
-		} catch (Exception e){
-
-			return R.error("操作异常");
-		}
-	}
-
-//	@Login
-	@ApiOperation("获取用户名称")
-	@GetMapping("/getUserNickName")
-	public R getUserInfoByUserId(@RequestParam(value = "userId") Long userId){
-		try {
-			FsUser user=userMapper.selectFsUserByUserId(userId);
-			if(user==null){
-				return R.error(40001,"用户不存在");
-			}
-			return R.ok().put("nickName", user.getNickName());
-		} catch (Exception e){
-			return R.error("操作异常");
-		}
-	}
-
-	@ApiOperation("检测是否登录")
-	@GetMapping("/checkLogin")
-	public R checkLogin(HttpServletRequest request){
-		if(StringUtils.isEmpty(getUserId())){
-			//未登录
-			return R.error("未登录");
-		}
-		else{
-			//登录
-			String token = jwtUtils.generateToken(Long.parseLong(getUserId()));
-			Map<String,Object> map=new HashMap<>();
-			map.put("token",token);
-			return R.ok("认证成功").put("userId",getUserId()).put("token",token);
-		}
-	}
-
-	@ApiOperation("注册app用户")
-	@PostMapping("/register")
-	@RepeatSubmit
-	public R registerDoctor(@Validated @RequestBody FsUserRegisterParam param){
-		FsUser fsUser = findUserByPhone(param.getPhone());
-
-//        if (fsUser == null) {
-//            // 尝试使用加密后的手机号查询
-//            fsUser = userService.selectFsUserByPhone(encryptPhone(param.getPhone()));
-//        }
-
-		if (fsUser != null && org.apache.commons.lang3.StringUtils.isNotEmpty(fsUser.getPassword())) {
-			return R.error("此账号已经注册");
-		}
-
-		FsUser user = new FsUser();
-		if (fsUser != null) {
-			// 更新已有用户的密码
-			user.setUserId(fsUser.getUserId());
-			user.setPassword(Md5Utils.hash(param.getPassword()));
-			user.setUpdateTime(new DateTime());
-			userService.updateFsUser(user);
-			return R.ok("注册成功");
-		} else {
-			// 创建新用户
-			user.setPhone(param.getPhone());
-			user.setNickName("app用户" + param.getPhone().substring(param.getPhone().length() - 4));
-			user.setStatus(1);
-			user.setAvatar("https://cos.his.cdwjyyh.com/fs/20240926/420728ee06e54575ba82665dedb4756b.png");
-			user.setPassword(Md5Utils.hash(param.getPassword()));
-			user.setCreateTime(new Date());
-
-			if (userService.insertFsUser(user) > 0) {
-				return R.ok("注册成功");
-			} else {
-				return R.error("注册失败");
-			}
-		}
-
-	}
-
-
-	/**
-	 * app登录
-	 * */
-	@ApiOperation("登录")
-	@PostMapping("/loginByApp")
-	@Transactional
-	public R login(@Validated @RequestBody FsUserLoginParam param) {
-		int loginType = param.getLoginType();
-		switch (loginType) {
-			case 1:
-				return handleLoginType1(param); // 手机密码登录
-			case 3:
-				return handleLoginType3(param);
-			default:
-				return R.error("请选择正确的登陆类型!");
-		}
-	}
-
-	@ApiOperation("获取用户收货地址")
-	@GetMapping(value = "/getUserAddr/{userId}")
-	public AjaxResult getUserAddr(@PathVariable("userId") Long userId)
-	{
-		List<FsUserAddress> fsUserAddresses = userService.selectFsUserAddressByUserId(userId);
-		for (FsUserAddress fsUserAddress : fsUserAddresses) {
-			if (fsUserAddress.getPhone()!=null&&fsUserAddress.getPhone()!=""){
-				if (fsUserAddress.getPhone().length()>11){
-					fsUserAddress.setPhone(decryptPhoneMk(fsUserAddress.getPhone()));
-				}else {
-					fsUserAddress.setPhone(fsUserAddress.getPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
-				}
-			}
-		}
-
-		return AjaxResult.success(fsUserAddresses);
-	}
-
-	@ApiOperation("微信登录")
-	@PostMapping("/loginByWeChat")
-	@Transactional
-	public R loginByWeChat(@Validated @RequestBody FsUserLoginByWeChatParam param) {
-		try {
-			if (org.apache.commons.lang3.StringUtils.isBlank(param.getCode())) {
-				return R.error("code不存在");
-			}
-			logger.info("zyp app微信登录,param:{}", param);
-			Map result = WxUtil.getAccessToken(param.getCode(),APP_ID,APP_SECRET);
-			String accessToken = result.get("access_token").toString();
-			String unionid = result.get("unionid").toString();
-
-			String openid = result.get("openid").toString();
-
-			Map userInfo = WxUtil.getUserInfo(accessToken, openid);
-
-			String nickname = userInfo.get("nickname").toString();
-			Integer sex = (Integer) userInfo.get("sex");
-			String avatar = userInfo.get("headimgurl").toString();
-			FsUser user = userService.selectFsUserByUnionid(unionid);
-
-			Map<String, Object> map = new HashMap<>();
-			if (user == null) {
-				user = new FsUser();
-				user.setLoginDevice(param.getLoginDevice()!=null ? param.getLoginDevice() : null);
-				user.setSource(param.getSource()!=null ? param.getSource() : null);
-				user.setNickName(nickname);
-				user.setAvatar(avatar);
-				if (sex!=0){
-					user.setSex(sex);
-				}
-				user.setUnionId(unionid);
-				user.setCreateTime(new Date());
-				user.setStatus(1);
-				if (org.apache.commons.lang3.StringUtils.isNotEmpty(param.getJpushId())) {
-					user.setJpushId(param.getJpushId());
-				}
-				userService.insertFsUser(user);
-				map.put("isNew", true);
-				map.put("unionid",unionid);
-//				if (org.apache.commons.lang3.StringUtils.isNotEmpty(param.getJpushId())) {
-//					try {
-//						//发送注册优惠券
-//						fsUserCouponService.sendRegisterCoupon(user);
-//					} catch (Exception e) {
-//						logger.error("发送注册优惠券失败:{}",e.getMessage());
-//					}
-//				}
-				return R.ok(map);
-			} else {
-				if (org.apache.commons.lang3.StringUtils.isNotEmpty(param.getJpushId())) {
-					updateExistingUserJpushId(user, param.getJpushId());
-//					try {
-//						//发送注册优惠券
-//						fsUserCouponService.sendRegisterCoupon(user);
-//					} catch (Exception e) {
-//						logger.error("发送注册优惠券失败:{}",e.getMessage());
-//					}
-				}
-				if (org.apache.commons.lang3.StringUtils.isEmpty(user.getPhone())) {
-					map.put("isNew", true);
-					map.put("unionid",user.getUnionId());
-					return R.ok(map);
-				}
-			}
-			if (user.getStatus()==0&& org.apache.commons.lang3.StringUtils.isNotEmpty(param.getSource())&&!param.getSource().equals("iOS")){
-				return R.error("登录失败,账户被禁用");
-			}
-			int isFirstLogin = userNewTaskService.performTaskOne(user.getUserId());
-			String token = jwtUtils.generateToken(user.getUserId());
-			redisCache.setCacheObject("userToken:" + user.getUserId(), token, 604800, TimeUnit.SECONDS);
-			map.put("token", token);
-			map.put("user", user);
-			map.put("isFirst",isFirstLogin);
-			return R.ok(map);
-		}catch (Exception e){
-			logger.error("zyp 登录失败:{}", e.getMessage());
-			return R.error("登录失败");
-		}
-
-	}
-
-	@ApiOperation("绑定手机号")
-	@PostMapping("/setIPhoneNumber")
-	public R setIPhoneNumber(@Validated @RequestBody FsUserEditPhoneParam param) {
-		FsUser userMap = findUserByPhone(param.getPhone());
-		if (userMap != null) {
-			if (org.apache.commons.lang3.StringUtils.isNotEmpty(userMap.getAppleKey()) && !param.getAppleKey().equals(userMap.getAppleKey())) {
-				return R.error("该手机号已绑定其他账号");
-			}
-			if (param.getSimExist() == 0 && !Md5Utils.hash(param.getPassword()).equals(userMap.getPassword())) {
-				return R.error("密码不正确");
-			}
-		} else {
-			userMap = createNewAppleUser(param, param.getPhone());
-		}
-
-		userMap.setLoginDevice(param.getLoginDevice());
-		userMap.setSource(param.getSource());
-		if (userMap.getNickName().equals("匿名用户**")) {
-			userMap.setNickName("苹果用户" + param.getPhone().substring(param.getPhone().length() - 4));
-		}
-		userMap.setAppleKey(param.getAppleKey());
-		if (userService.updateFsUser(userMap)>0){
-			return generateTokenAndReturn(userMap);
-		}
-		return R.error("绑定手机号失败");
-	}
-
-	@ApiOperation("绑定手机号")
-	@PostMapping("/setPhone")
-	public R setPhone(@Validated @RequestBody FsUserEditPhoneParam param) {
-		FsUser user = userService.selectFsUserByUnionid(param.getUnionId());
-		if (user == null) {
-			return R.error("用户数据不存在");
-		}
-		FsUser userMap = findUserByPhone(param.getPhone());
-		if (userMap != null) {
-			return R.error("该手机号已绑定其他账号");
-		}
-		user.setPhone(param.getPhone());
-		user.setLoginDevice(param.getLoginDevice() != null ? param.getLoginDevice() : null );
-		user.setSource(param.getSource()!= null ? param.getSource() : null);
-		userMap = new FsUser();
-		userMap.setLoginDevice(param.getLoginDevice());
-		userMap.setSource(param.getSource());
-		if (user.getNickName().equals("匿名用户**")) {
-			userMap.setNickName("匿名用户" + param.getPhone().substring(param.getPhone().length() - 4));
-		}
-		userMap.setUserId(user.getUserId());
-		userMap.setPhone(param.getPhone());
-		if (userService.updateFsUser(userMap)>0){
-			return generateTokenAndReturn(user);
-		}
-		return R.error("绑定手机号失败");
-	}
-
-	private R handleLoginType1(FsUserLoginParam param) {
-
-		if (org.apache.commons.lang3.StringUtils.isEmpty(param.getPhone()) || org.apache.commons.lang3.StringUtils.isEmpty(param.getPassword())) {
-			return R.error("账号或密码不能为空");
-		}
-
-		FsUser user = findUserByPhone(param.getPhone());
-
-		// 校验用户是否存在及账号状态
-		if (user == null) {
-			return R.error("账号不存在,请先注册账号");
-		} else if (user.getStatus() == 0) {
-			return R.error("账号已停用");
-		} else if (org.apache.commons.lang3.StringUtils.isEmpty(user.getPassword())) {
-			return R.error("账号不存在,请先注册账号");
-		}
-
-		if (!Md5Utils.hash(param.getPassword()).equals(user.getPassword())) {
-			return R.error("密码不正确");
-		}
-
-		return generateTokenAndReturn(user);
-
-	}
-
-	private R handleLoginType3(FsUserLoginParam param) {
-		if (org.apache.commons.lang3.StringUtils.isEmpty(param.getPhone())) {
-			return R.error("获取手机号失败");
-		}
-		// 根据手机号查询用户
-		FsUser user = findUserByPhone(param.getPhone());
-		if (user == null) {
-			createNewUser(param);
-			return R.ok().put("isNew",true).put("phone",encryptPhone(param.getPhone()));
-		} else {
-			if (user.getUnionId()==null){
-				if (user.getPhone().length()<=11){
-					FsUser fsUser = new FsUser();
-					fsUser.setUserId(user.getUserId());
-					fsUser.setPhone(param.getPhone());
-					userMapper.updateFsUser(fsUser);
-					logger.info("zyp \n【手机加密】:{}",encryptPhone(param.getPhone()));
-				}
-				return R.ok().put("isNew",true).put("phone",encryptPhone(param.getPhone()));
-			}
-			/*if (org.apache.commons.lang3.StringUtils.isNotEmpty(param.getJpushId())) {
-				updateExistingUserJpushId(user, param.getJpushId());
-			}*/
-		}
-		return generateTokenAndReturn(user);
-	}
-
-	private FsUser createNewAppleUser(FsUserEditPhoneParam param, String phoneNumber) {
-		FsUser newUser = new FsUser();
-		newUser.setLoginDevice(param.getLoginDevice()!=null ? param.getLoginDevice() : null);
-		newUser.setSource(param.getSource()!=null ? param.getSource() : null);
-		newUser.setAppleKey(param.getAppleKey());
-		newUser.setPhone(param.getPhone());
-		newUser.setPassword(Md5Utils.hash(param.getPassword()));
-		newUser.setNickName("苹果用户" + param.getPhone().substring(param.getPhone().length() - 4));
-		newUser.setCreateTime(new Date());
-		newUser.setStatus(1);
-		newUser.setAvatar("https://cos.his.cdwjyyh.com/fs/20240926/420728ee06e54575ba82665dedb4756b.png");
-		if (org.apache.commons.lang3.StringUtils.isNotEmpty(param.getJpushId())) {
-			newUser.setJpushId(param.getJpushId());
-		}
-		userService.insertFsUser(newUser);
-		return newUser;
-
-	}
-
-	private void updateExistingUserJpushId(FsUser user, String jpushId) {
-		FsUser userMap = new FsUser();
-		userMap.setUserId(user.getUserId());
-		userMap.setJpushId(jpushId);
-		userService.updateFsUser(userMap);
-	}
-
-	private R generateTokenAndReturn(FsUser user) {
-		String token = jwtUtils.generateToken(user.getUserId());
-		redisCache.setCacheObject("userToken:" + user.getUserId(), token, 604800, TimeUnit.SECONDS);
-		int isFirstLogin = userNewTaskService.performTaskOne(user.getUserId());
-		Map<String, Object> map = new HashMap<>();
-		map.put("token", token);
-		map.put("user", user);
-		map.put("isFirst",isFirstLogin);
-		return R.ok(map);
-	}
-
-	private FsUser findUserByPhone(String phone) {
-		// 先根据加密手机号查询用户
-		String jiami = (encryptPhone(phone));
-		FsUser user = userMapper.selectFsUserByPhoneLimitOne(jiami);
-
-		// 如果没有找到用户,再根据手机号查询
-		if (user == null) {
-			user = userMapper.selectFsUserByPhoneLimitOne(phone);
-
-		}
-		return user;
-	}
-
-	private FsUser createNewUser(FsUserLoginParam param) {
-		FsUser newUser = new FsUser();
-		newUser.setLoginDevice(param.getLoginDevice() != null ? param.getLoginDevice() : null);
-		newUser.setSource(param.getSource() != null ? param.getSource() : null );
-		newUser.setNickName(NickNameConstant.getNickName());
-		newUser.setPhone(param.getPhone());
-		newUser.setCreateTime(new Date());
-		newUser.setStatus(1);
-		newUser.setAvatar("https://cos.his.cdwjyyh.com/fs/20240926/420728ee06e54575ba82665dedb4756b.png");
-		/*if (org.apache.commons.lang3.StringUtils.isNotEmpty(param.getJpushId())) {
-			newUser.setJpushId(param.getJpushId());
-		}*/
-		userService.insertFsUser(newUser);
-		return newUser;
-	}
-
-	//
-
-}

+ 0 - 18
fs-live-app/src/main/java/com/fs/app/param/FsAddressParseParam.java

@@ -1,18 +0,0 @@
-package com.fs.app.param;
-
-import lombok.Getter;
-import lombok.Setter;
-
-import java.io.Serializable;
-
-@Getter
-@Setter
-public class FsAddressParseParam implements Serializable {
-
-
-    private String content;
-
-
-
-
-}

+ 0 - 59
fs-live-app/src/main/java/com/fs/app/param/FsUserAddressAddEditParam.java

@@ -1,59 +0,0 @@
-package com.fs.app.param;
-
-import com.fs.common.annotation.Excel;
-import lombok.Getter;
-import lombok.Setter;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.Pattern;
-import java.io.Serializable;
-
-@Getter
-@Setter
-public class FsUserAddressAddEditParam implements Serializable {
-
-    /** ID */
-    private Long addressId;
-
-    /** 收货人姓名 */
-    @NotBlank(message = "收货人姓名不能为空")
-    private String realName;
-
-    /** 收货人电话 */
-    @NotBlank(message = "收货人电话不能为空")
-    @Pattern(regexp="^1[3456789]\\d{9}$",message="手机号格式不正确")
-    private String phone;
-
-    /** 收货人所在省 */
-    @NotBlank(message = "收货人地址不能为空")
-    private String province;
-
-    /** 收货人所在市 */
-    @NotBlank(message = "收货人地址不能为空")
-    private String city;
-
-    /** 收货人所在区 */
-    @NotBlank(message = "收货人地址不能为空")
-    private String district;
-
-    /** 城市IDS */
-    @Excel(name = "城市IDS")
-    private String cityIds;
-
-    /** 收货人详细地址 */
-    @NotBlank(message = "收货人详细地址不能为空")
-    private String detail;
-
-    /** 邮编 */
-    private String postCode;
-
-    /** 经度 */
-    private String longitude;
-
-    /** 纬度 */
-    private String latitude;
-
-    private Integer isDefault;
-
-
-}

+ 0 - 32
fs-live-app/src/main/java/com/fs/app/param/FsUserEditPhoneParam.java

@@ -1,32 +0,0 @@
-package com.fs.app.param;
-
-import lombok.Data;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-import java.io.Serializable;
-
-@Data
-public class FsUserEditPhoneParam implements Serializable {
-
-    @NotBlank(message = "手机号不能为空")
-    @Pattern(regexp="^1[3456789]\\d{9}$",message="手机号格式不正确")
-    private String phone;
-    @NotNull(message = "unionId不能为空")
-    private String unionId;
-
-    private String loginDevice; //当前登陆设备
-
-    private String jpushId;
-
-    private String source;
-
-    private String appleKey;
-
-    private String password;
-    /**
-     * 是否有SIM卡 0不存在 1存在
-     */
-    private Integer simExist;
-}

+ 0 - 19
fs-live-app/src/main/java/com/fs/app/param/FsUserLoginByWeChatParam.java

@@ -1,19 +0,0 @@
-package com.fs.app.param;
-
-import lombok.Data;
-
-import javax.validation.constraints.NotBlank;
-import java.io.Serializable;
-
-@Data
-public class FsUserLoginByWeChatParam implements Serializable {
-    private String jpushId;
-
-    @NotBlank(message = "code参数缺失")
-    private String code;
-
-    private String loginDevice;//当前登陆设备
-
-    private String source; //app来源
-
-}

+ 0 - 26
fs-live-app/src/main/java/com/fs/app/param/FsUserLoginParam.java

@@ -1,26 +0,0 @@
-package com.fs.app.param;
-
-import lombok.Data;
-
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-@Data
-public class FsUserLoginParam implements Serializable {
-    private String phone;
-
-    private String password;
-
-    @NotNull(message = "登录类型不能为空")
-    private Integer loginType;//登录类型 1密码登录  2微信登录  3手机号一键登录
-
-    private String code;
-    private String uuid;
-
-    private String jpushId;
-
-    private String openId;
-
-    private String loginDevice;
-    private String source;
-}

+ 0 - 304
fs-live-app/src/main/java/com/fs/app/task/Task.java

@@ -1,304 +0,0 @@
-package com.fs.app.task;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.fs.app.vo.LotteryVo;
-import com.fs.app.websocket.bean.SendMsgVo;
-import com.fs.app.websocket.service.WebSocketServer;
-import com.fs.common.core.domain.R;
-import com.fs.common.core.redis.RedisCache;
-import com.fs.common.utils.StringUtils;
-import com.fs.common.utils.spring.SpringUtils;
-import com.fs.his.service.IFsUserService;
-import com.fs.live.domain.*;
-import com.fs.live.mapper.LiveLotteryRegistrationMapper;
-import com.fs.live.param.LiveReplayParam;
-import com.fs.live.service.*;
-import com.fs.live.vo.LiveLotteryConfVo;
-import com.fs.live.vo.LiveLotteryProductListVo;
-import lombok.AllArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.websocket.Session;
-import java.math.BigDecimal;
-import java.time.Instant;
-import java.time.LocalDateTime;
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.stream.Collectors;
-
-@Component
-@AllArgsConstructor
-public class Task {
-
-    private final ILiveService liveService;
-
-    private final ILiveDataService liveDataService;
-
-    private final RedisCache redisCache;
-
-    @Autowired
-    private ILiveWatchUserService liveWatchUserService;
-    @Autowired
-    private IFsUserService fsUserService;
-    @Autowired
-    private ILiveRewardRecordService liveRewardRecordService;
-    @Autowired
-    private WebSocketServer webSocketServer;
-    @Autowired
-    private ILiveAutoTaskService liveAutoTaskService;
-    @Autowired
-    private ILiveLotteryConfService liveLotteryConfService;
-    @Autowired
-    private ILiveUserLotteryRecordService liveUserLotteryRecordService;
-    @Autowired
-    private LiveLotteryRegistrationMapper liveLotteryRegistrationMapper;
-    @Autowired
-    private ILiveRedConfService liveRedConfService;
-
-    @Scheduled(cron = "0 0/1 * * * ?")
-    //public void selectSopUserLogsListByTime() {
-    public void updateLiveStatusByTime() {
-        List<Live> list = liveService.list(new QueryWrapper<Live>().ne("status", 3).in("live_type", 2, 3).eq("is_audit", 1));
-        if (list.isEmpty())
-            return;
-        List<Long> liveIdLists = list.stream().map(Live::getLiveId).collect(Collectors.toList());
-        List<LiveAutoTask> liveAutoTasks = liveAutoTaskService.selectLiveAutoTaskByLiveIds(liveIdLists);
-        List<Live> activeLiveList = new ArrayList<>();
-        LocalDateTime now = LocalDateTime.now();
-        list.forEach(live -> {
-            if (live.getLiveType() != 3) {
-                if (live.getFinishTime() == null) {
-                    if (now.isAfter(live.getStartTime().minusSeconds(2L))){
-                        live.setStatus(2);
-                        activeLiveList.add( live);
-                    } else if (now.isBefore(live.getStartTime())) {
-                        live.setStatus(1);
-                    }
-                } else {
-                    if (now.isAfter(live.getStartTime().minusSeconds(2L)) && now.isBefore(live.getFinishTime())) {
-                        live.setStatus(2);
-                        activeLiveList.add( live);
-                    } else if (now.isBefore(live.getStartTime().minusSeconds(2L))) {
-                        live.setStatus(1);
-                    } else if (now.isAfter(live.getFinishTime().minusSeconds(2L))) {
-                        live.setStatus(3);
-                    }
-                }
-            } else {
-                // 直播回放只需要检测结束时间就好了
-                LiveReplayParam liveReplayParam = JSON.parseObject(live.getLiveConfig(), LiveReplayParam.class);
-                if (liveReplayParam.getIsPlaybackOpen()) {
-                    if (liveReplayParam.getFinishTime() != null) {
-                        if (now.isAfter(live.getFinishTime().minusSeconds(2L))) {
-                            live.setStatus(3);
-                        }
-                    }
-                }
-            }
-
-        });
-        String key = "live:auto_task:";
-        if(!activeLiveList.isEmpty()){
-            activeLiveList.forEach(live -> {
-                List<LiveAutoTask> collect = liveAutoTasks.stream().filter(liveAutoTask -> liveAutoTask.getLiveId().equals(live.getLiveId())).collect(Collectors.toList());
-                if (!collect.isEmpty()) {
-                    collect.forEach(liveAutoTask -> {
-                        liveAutoTask.setCreateTime(null);
-                        liveAutoTask.setUpdateTime(null);
-                        redisCache.redisTemplate.opsForZSet().add(key + live.getLiveId(), JSON.toJSONString(liveAutoTask),liveAutoTask.getAbsValue().getTime());
-                        redisCache.redisTemplate.expire(key+live.getLiveId(), 30, java.util.concurrent.TimeUnit.MINUTES);
-                    });
-                }
-            });
-        }
-
-        if(!list.isEmpty()){
-            liveService.updateBatchById(list);
-        }
-    }
-    @Scheduled(cron = "0/1 * * * * ?")
-    public void liveLotteryTask() {
-        long currentTime = Instant.now().toEpochMilli(); // 当前时间戳(毫秒)
-        String lotteryKey = "live:lottery_task:*";
-        Set<String> allLiveKeys = redisCache.redisTemplate.keys(lotteryKey);
-        if (allLiveKeys != null && !allLiveKeys.isEmpty()) {
-            for (String liveKey : allLiveKeys) {
-                Set<String> range = redisCache.redisTemplate.opsForZSet().rangeByScore(liveKey, 0, currentTime);
-                if (range == null || range.isEmpty()) {
-                    continue;
-                }
-                processLotteryTask(range);
-                redisCache.redisTemplate.opsForZSet()
-                        .removeRangeByScore(liveKey, 0, currentTime);
-            }
-        }
-
-        String redKey = "live:red_task:*";
-        allLiveKeys = redisCache.redisTemplate.keys(redKey);
-        if (allLiveKeys == null || allLiveKeys.isEmpty()) {
-            return;
-        }
-        for (String liveKey : allLiveKeys) {
-            Set<String> range = redisCache.redisTemplate.opsForZSet().rangeByScore(liveKey, 0, currentTime);
-            if (range == null || range.isEmpty()) {
-                continue;
-            }
-            updateRedStatus(range);
-            redisCache.redisTemplate.opsForZSet()
-                    .removeRangeByScore(liveKey, 0, currentTime);
-        }
-    }
-
-    private void updateRedStatus(Set<String> range) {
-        liveRedConfService.finishRedStatusBySetIds(range);
-    }
-
-    private void processLotteryTask(Set<String> range) {
-        List<LiveLotteryConfVo> liveLotteries = liveLotteryConfService.selectVoListByLotteryIds(range);
-        if(liveLotteries.isEmpty()) return;
-        Date now = new Date();
-        for (LiveLotteryConfVo liveLottery : liveLotteries) {
-            // 查询抽奖数量
-            List<LiveLotteryProductListVo> products = liveLottery.getProducts();
-            Integer totalLots = products.stream().mapToInt(liveLotteryProductListVo -> Math.toIntExact(liveLotteryProductListVo.getTotalLots())).sum();
-            if(totalLots <= 0) continue;
-            // 查询在线用户 并且参与了抽奖的用户
-            List<LiveWatchUser> liveWatchUsers = liveWatchUserService.selectLiveWatchAndRegisterUser(liveLottery.getLiveId(),liveLottery.getLotteryId(), totalLots);
-            if(liveWatchUsers.isEmpty()) continue;
-            LiveLotteryRegistration liveLotteryRegistration;
-            // 收集中奖信息
-            List<LotteryVo> lotteryVos = new ArrayList<>();
-            for (LiveLotteryProductListVo liveLotteryProductListVo : products) {
-                // 随机抽奖一个用户获取奖品
-                Long totalLotsPerProduct = liveLotteryProductListVo.getTotalLots();
-                for (int i = 0; i < totalLotsPerProduct && !liveWatchUsers.isEmpty(); i++) {
-                    // 随机选择一个用户
-                    int randomIndex = new java.util.Random().nextInt(liveWatchUsers.size());
-                    LiveWatchUser winningUser = liveWatchUsers.get(randomIndex);
-
-                    // 创建中奖记录
-                    LiveUserLotteryRecord record = new LiveUserLotteryRecord();
-                    record.setLotteryId(liveLottery.getLotteryId());
-                    record.setLiveId(liveLottery.getLiveId());
-                    record.setUserId(winningUser.getUserId());
-                    record.setProductId(liveLotteryProductListVo.getProductId());
-                    record.setCreateTime(new Date());
-
-                    // 保存中奖记录
-                    liveUserLotteryRecordService.insertLiveUserLotteryRecord(record);
-                    liveLotteryRegistration = new LiveLotteryRegistration();
-                    liveLotteryRegistration.setLotteryId(liveLottery.getLotteryId());
-                    liveLotteryRegistration.setLiveId(liveLottery.getLotteryId());
-                    liveLotteryRegistration.setUserId(winningUser.getUserId());
-                    liveLotteryRegistration.setIsWin(1L);
-                    liveLotteryRegistration.setUpdateTime(now);
-                    liveLotteryRegistration.setRizeLevel(liveLotteryProductListVo.getPrizeLevel());
-                    liveLotteryRegistrationMapper.updateLiveLotteryRegistrationNoId(liveLotteryRegistration);
-                    // 从候选列表中移除该用户,确保每人只能中奖一次
-                    liveWatchUsers.remove(randomIndex);
-                    LotteryVo lotteryVo = new LotteryVo();
-                    lotteryVo.setUserId(winningUser.getUserId());
-                    lotteryVo.setUserName(winningUser.getNickName());
-                    lotteryVo.setPrizeLevel(liveLotteryProductListVo.getPrizeLevel());
-                    lotteryVo.setProductName(liveLotteryProductListVo.getProductName());
-                    lotteryVos.add(lotteryVo);
-                }
-            }
-            SendMsgVo sendMsgVo = new SendMsgVo();
-            sendMsgVo.setLiveId(liveLottery.getLiveId());
-            sendMsgVo.setCmd("LotteryDetail");
-            sendMsgVo.setData(JSON.toJSONString(lotteryVos));
-            webSocketServer.broadcastMessage(liveLottery.getLiveId(), JSONObject.toJSONString(R.ok().put("data", sendMsgVo)));
-        }
-
-        List<Long> collect = liveLotteries.stream().map(LiveLotteryConfVo::getLotteryId).collect(Collectors.toList());
-        liveLotteryConfService.finishStatusByLotteryIds(collect);
-    }
-
-    @Scheduled(cron = "0/1 * * * * ?")
-    public void liveAutoTask() {
-        long currentTime = Instant.now().toEpochMilli(); // 当前时间戳(毫秒)
-
-        Set<String> allLiveKeys = redisCache.redisTemplate.keys("live:auto_task:*");
-        if (allLiveKeys == null || allLiveKeys.isEmpty()) {
-            return; // 没有数据,直接返回
-        }
-        // 2. 遍历每个直播间的ZSet键
-        for (String liveKey : allLiveKeys) {
-            // 3. 获取当前直播间ZSet中所有元素(按score排序)
-            // range方法:0表示第一个元素,-1表示最后一个元素,即获取全部
-            Set<String> range = redisCache.redisTemplate.opsForZSet().rangeByScore(liveKey, 0, currentTime);
-            if (range == null || range.isEmpty()) {
-                continue; // 没有数据,直接返回
-            }
-            redisCache.redisTemplate.opsForZSet()
-                    .removeRangeByScore(liveKey, 0, currentTime);
-            processAutoTask(range);
-        }
-    }
-
-    private void processAutoTask(Set<String> range) {
-        for (String liveAutoTask : range) {
-            LiveAutoTask task = JSON.parseObject(liveAutoTask, LiveAutoTask.class);
-            webSocketServer.handleAutoTask(task);
-            task.setFinishStatus(1L);
-            liveAutoTaskService.finishLiveAutoTask(task);
-        }
-    }
-
-    @Scheduled(cron = "0 0/1 * * * ?")
-    @Transactional
-    public void autoUpdateWatchReward() {
-
-        // 1.查询所有直播中的直播间
-        List<Live> lives = liveService.liveList();
-
-
-        // 2.检查是否开启观看奖励
-        List<Live> openRewardLives = lives.stream().filter(live -> StringUtils.isNotEmpty(live.getConfigJson())).collect(Collectors.toList());
-        Date now = new Date();
-
-        for (Live openRewardLive : openRewardLives) {
-            String configJson = openRewardLive.getConfigJson();
-            LiveWatchConfig config = JSON.parseObject(configJson, LiveWatchConfig.class);
-            if (config.getEnabled()) {
-                // 3.检查当前直播间的在线用户(可以传入一个时间,然后查出来当天没领取奖励的用户)
-                List<LiveWatchUser> onlineUser = liveWatchUserService.checkOnlineNoRewardUser(openRewardLive.getLiveId(), now)
-                        .stream().filter(user -> now.getTime() - user.getUpdateTime().getTime() > config.getWatchDuration() * 60 * 1000)
-                        .collect(Collectors.toList());
-                if(onlineUser.isEmpty()) continue;
-
-                List<Long> userIds = onlineUser.stream().map(LiveWatchUser::getUserId).collect(Collectors.toList());
-                // 4.保存用户领取记录
-                saveUserRewardRecord(openRewardLive.getLiveId(), userIds,config.getScoreAmount());
-                // 5.更新用户积分(芳华币
-                fsUserService.increaseIntegral(userIds,config.getScoreAmount());
-                // 6.发送websocket事件消息 通知用户自动领取成功
-                userIds.forEach(userId -> webSocketServer.sendIntegralMessage(openRewardLive.getLiveId(),userId,config.getScoreAmount()));
-
-            }
-        }
-    }
-    private void saveUserRewardRecord(Long liveId, List<Long> userIds,Long scoreAmount) {
-        for (Long userId : userIds) {
-            LiveRewardRecord record = new LiveRewardRecord();
-            record.setLiveId(liveId);
-            record.setUserId(userId);
-            record.setIncomeType(1L);
-            record.setSourceType(1L);
-            record.setSourceId(0L);
-            record.setRewardType(2L);
-            record.setNum(BigDecimal.valueOf(scoreAmount));
-            record.setRewardType(2L);
-            record.setCreateTime(new Date());
-            record.setCreateBy(String.valueOf(userId));
-            liveRewardRecordService.insertLiveRewardRecord(record);
-        }
-    }
-
-}

+ 0 - 23
fs-live-app/src/main/java/com/fs/app/vo/CityVO.java

@@ -1,23 +0,0 @@
-package com.fs.app.vo;
-
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
-
-import java.io.Serializable;
-import java.util.List;
-
-@Getter
-@Setter
-@ToString
-public class CityVO implements Serializable {
-    private static final long serialVersionUID = 1L;
-
-    private String v; //id
-
-    private String n; //名称
-
-    private String pid;
-
-    private List<CityVO> c; //子集
-}

+ 0 - 97
fs-live-app/src/main/java/com/fs/app/websocket/auth/AuthHandler.java

@@ -1,97 +0,0 @@
-package com.fs.app.websocket.auth;
-
-import com.fs.app.utils.JwtUtils;
-import com.fs.app.utils.VerifyUtils;
-import com.fs.app.websocket.constant.AttrConstant;
-import com.fs.common.utils.spring.SpringUtils;
-import io.jsonwebtoken.Claims;
-import io.netty.channel.*;
-import io.netty.handler.codec.http.*;
-import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-import java.util.Map;
-
-@Slf4j
-@Component
-@ChannelHandler.Sharable
-public class AuthHandler extends ChannelInboundHandlerAdapter {
-
-    private final JwtUtils jwtUtils = SpringUtils.getBean(JwtUtils.class);
-
-    @Override
-    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
-        if (msg instanceof FullHttpRequest) {
-            FullHttpRequest req = (FullHttpRequest) msg;
-            String uri = req.uri();
-            QueryStringDecoder decoder = new QueryStringDecoder(uri);
-            Map<String, List<String>> parameterMap = decoder.parameters();
-            if (!parameterMap.containsKey(AttrConstant.LIVE_ID)) {
-                ctx.channel().writeAndFlush(new TextWebSocketFrame("Error: invalid parameters")).addListener(ChannelFutureListener.CLOSE);
-                return;
-            }
-
-            if (!parameterMap.containsKey(AttrConstant.USER_ID)) {
-                ctx.channel().writeAndFlush(new TextWebSocketFrame("Error: invalid parameters")).addListener(ChannelFutureListener.CLOSE);
-                return;
-            }
-
-            String tokenKey = jwtUtils.getHeader();
-            if (!parameterMap.containsKey(tokenKey) && !parameterMap.containsKey(AttrConstant.SIGNATURE)) {
-                ctx.writeAndFlush(new TextWebSocketFrame("Error: invalid parameters")).addListener(ChannelFutureListener.CLOSE);
-                return;
-            }
-
-            Long liveId = Long.valueOf(parameterMap.get(AttrConstant.LIVE_ID).get(0));
-            Long userId = Long.valueOf(parameterMap.get(AttrConstant.USER_ID).get(0));
-
-            // 验证 token
-            if (parameterMap.containsKey(tokenKey)) {
-            String token = parameterMap.get(tokenKey).get(0);
-            Claims claims = jwtUtils.getClaimByToken(token);
-            if (claims == null || jwtUtils.isTokenExpired(claims.getExpiration())) {
-                ctx.channel().writeAndFlush(new TextWebSocketFrame("Error: invalid parameters")).addListener(ChannelFutureListener.CLOSE);
-                return;
-            }
-                // 将 userType 设置为 0(或根据实际业务逻辑设置)
-                ctx.channel().attr(AttrConstant.ATTR_USER_TYPE).set(0L);
-            }
-
-            // 验证签名
-            if (parameterMap.containsKey(AttrConstant.SIGNATURE)) {
-                String userTypeStr = parameterMap.get(AttrConstant.USER_TYPE).get(0);
-                String timestampStr = parameterMap.get(AttrConstant.TIMESTAMP).get(0);
-                String signatureStr = parameterMap.get(AttrConstant.SIGNATURE).get(0);
-
-                try {
-                    if (!VerifyUtils.verifySignature(liveId.toString(), userId.toString(), userTypeStr, timestampStr, signatureStr)) {
-                        ctx.channel().writeAndFlush(new TextWebSocketFrame("Error: invalid parameters")).addListener(ChannelFutureListener.CLOSE);
-                        return;
-                    }
-                    ctx.channel().attr(AttrConstant.ATTR_USER_TYPE).set(Long.parseLong(userTypeStr));
-                } catch (Exception e) {
-                    ctx.channel().writeAndFlush(new TextWebSocketFrame("Error: invalid parameters")).addListener(ChannelFutureListener.CLOSE);
-                    return;
-                }
-            }
-
-            // 将 liveId 和 userId 保存到 Channel 属性中,供后续处理使用
-            ctx.channel().attr(AttrConstant.ATTR_LIVE_ID).set(liveId);
-            ctx.channel().attr(AttrConstant.ATTR_USER_ID).set(userId);
-
-            // 继续处理 WebSocket 握手
-            ctx.pipeline().remove(this);
-            ctx.fireChannelRead(req.retain());
-        } else {
-            ctx.channel().close();
-        }
-    }
-
-    @Override
-    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
-        log.warn("webSocket 认证异常: {}", cause.getMessage(), cause);
-        ctx.close();
-    }
-}

+ 0 - 85
fs-live-app/src/main/java/com/fs/app/websocket/auth/WebSocketConfigurator.java

@@ -1,85 +0,0 @@
-package com.fs.app.websocket.auth;
-
-import com.fs.app.utils.JwtUtils;
-import com.fs.app.utils.VerifyUtils;
-import com.fs.app.websocket.constant.AttrConstant;
-import com.fs.common.exception.base.BaseException;
-import com.fs.common.utils.spring.SpringUtils;
-import io.jsonwebtoken.Claims;
-import lombok.extern.slf4j.Slf4j;
-
-import javax.crypto.Mac;
-import javax.crypto.spec.SecretKeySpec;
-import javax.websocket.HandshakeResponse;
-import javax.websocket.server.HandshakeRequest;
-import javax.websocket.server.ServerEndpointConfig;
-import java.nio.charset.StandardCharsets;
-import java.util.List;
-import java.util.Map;
-
-@Slf4j
-public class WebSocketConfigurator extends ServerEndpointConfig.Configurator {
-
-    private final JwtUtils jwtUtils = SpringUtils.getBean(JwtUtils.class);
-
-    /**
-     * 安全校验
-     * @param sec       配置
-     * @param request   请求
-     * @param response  返回
-     */
-    @Override
-    public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response) {
-        Map<String, List<String>> parameterMap = request.getParameterMap();
-        if(!parameterMap.containsKey(AttrConstant.LIVE_ID)){
-            throw new BaseException("缺少必要的参数");
-        }
-        if(!parameterMap.containsKey(AttrConstant.USER_ID)){
-            throw new BaseException("缺少必要的参数");
-        }
-
-        String tokenKey = jwtUtils.getHeader();
-        if (!parameterMap.containsKey(tokenKey) && !parameterMap.containsKey(AttrConstant.SIGNATURE)) {
-            throw new BaseException("缺少必要的参数");
-        }
-
-        Long liveId = Long.valueOf(parameterMap.get(AttrConstant.LIVE_ID).get(0));
-        Long userId = Long.valueOf(parameterMap.get(AttrConstant.USER_ID).get(0));
-
-        Map<String, Object> userProperties = sec.getUserProperties();
-        userProperties.put(AttrConstant.LIVE_ID, liveId);
-        userProperties.put(AttrConstant.USER_ID, userId);
-
-        // 验证token
-        if (parameterMap.containsKey(tokenKey)) {
-            String token = parameterMap.get(tokenKey).get(0);
-            Claims claims = jwtUtils.getClaimByToken(token);
-            if(claims == null || jwtUtils.isTokenExpired(claims.getExpiration())){
-                throw new BaseException(jwtUtils.getHeader());
-            }
-
-            userProperties.put(AttrConstant.USER_TYPE, 0L);
-        }
-
-        // 验证签名
-        if (parameterMap.containsKey(AttrConstant.SIGNATURE)) {
-            String liveIdStr = parameterMap.get(AttrConstant.LIVE_ID).get(0);
-            String userIdStr = parameterMap.get(AttrConstant.USER_ID).get(0);
-            String userTypeStr = parameterMap.get(AttrConstant.USER_TYPE).get(0);
-            String timestampStr = parameterMap.get(AttrConstant.TIMESTAMP).get(0);
-            String signatureStr = parameterMap.get(AttrConstant.SIGNATURE).get(0);
-
-            try {
-                if (!VerifyUtils.verifySignature(liveIdStr, userIdStr, userTypeStr, timestampStr, signatureStr)) {
-                    throw new BaseException("缺少必要的参数");
-                }
-
-                userProperties.put(AttrConstant.USER_TYPE, Long.parseLong(userTypeStr));
-            } catch (Exception e) {
-                log.warn("webSocket连接验签失败 msg: {}", e.getMessage(), e);
-                throw new BaseException("缺少必要的参数");
-            }
-        }
-    }
-
-}

+ 0 - 18
fs-live-app/src/main/java/com/fs/app/websocket/constant/AttrConstant.java

@@ -1,18 +0,0 @@
-package com.fs.app.websocket.constant;
-
-import io.netty.util.AttributeKey;
-
-public class AttrConstant {
-
-    // 定义变量名
-    public static final String LIVE_ID = "liveId";
-    public static final String USER_ID = "userId";
-    public static final String USER_TYPE = "userType";
-    public static final String TIMESTAMP = "timestamp";
-    public static final String SIGNATURE = "signature";
-
-    // 定义 AttributeKey 保存必要参数
-    public static final AttributeKey<Long> ATTR_LIVE_ID = AttributeKey.valueOf(LIVE_ID);
-    public static final AttributeKey<Long> ATTR_USER_ID = AttributeKey.valueOf(USER_ID);
-    public static final AttributeKey<Long> ATTR_USER_TYPE = AttributeKey.valueOf(USER_TYPE);
-}

+ 0 - 53
fs-live-app/src/main/java/com/fs/app/websocket/constant/NickNameConstant.java

@@ -1,53 +0,0 @@
-package com.fs.app.websocket.constant;
-
-import java.util.Random;
-
-public class NickNameConstant {
-    private static final String[] PREFIXES = {
-            "酷炫", "梦幻", "闪电", "狂野", "神秘", "银河", "星辰", "烈焰",
-            "冰霜", "雷霆", "疾风", "暗影", "光明", "虚空", "永恒", "混沌",
-            "暴风", "月光", "太阳", "星际", "超能", "量子", "钢铁", "黄金",
-            "钻石", "翡翠", "水晶", "火焰", "寒冰", "时空", "无敌", "战神",
-            "魔法", "精灵", "巨龙", "天使", "恶魔", "幽灵", "忍者", "武士",
-            "海盗", "猎人", "先知", "贤者", "圣光", "黑暗", "荣耀", "王者",
-            "剑圣", "刀锋", "枪神", "箭雨", "符文", "元素", "能量", "脉冲",
-            "辐射", "原子", "流星", "彗星", "宇宙", "维度", "次元", "终极",
-            "幻影", "炽焰", "寒冰", "极光", "天罚", "神罚", "天启", "末日",
-            "曙光", "黄昏", "深渊", "炼狱", "圣洁", "堕落", "不朽", "不灭",
-            "虚空", "湮灭", "创世", "灭世", "天命", "宿命", "轮回", "涅槃",
-            "玄冰", "赤焰", "青岚", "紫电", "金辉", "银翼", "黑曜", "白夜",
-            "血月", "日蚀", "月蚀", "星陨", "天穹", "地核", "海啸", "山崩",
-            "雷鸣", "电闪", "霜冻", "灼烧", "剧毒", "腐蚀", "净化", "重生",
-            "天选", "神谕", "魔咒", "诅咒", "祝福", "厄难", "幸运", "天命",
-            "狂怒", "静谧", "狂暴", "温柔", "疯狂", "理智", "混沌", "秩序",
-            "真理", "谎言", "荣耀", "耻辱", "正义", "邪恶", "自由", "束缚",
-            "新世纪","某科学的"
-    };
-
-    private static final String[] SUFFIXES = {
-            "小王子", "骑士", "王者", "使者", "探险家", "守护者", "征服者", "领主",
-            "皇帝", "霸主", "勇士", "战士", "剑客", "刀客", "枪手", "射手",
-            "法师", "巫师", "术士", "牧师", "萨满", "德鲁伊", "游侠", "盗贼",
-            "刺客", "忍者", "武僧", "格斗家", "拳王", "摔跤手", "冠军", "传奇",
-            "英雄", "大侠", "剑圣", "刀神", "枪王", "箭神", "魔导师", "大法师",
-            "先知", "贤者", "学者", "智者", "预言家", "观察者", "旅行者", "漫游者",
-            "冒险家", "寻宝者", "考古家", "科学家", "工程师", "发明家", "创造者", "毁灭者",
-            "终结者", "幸存者", "流亡者", "放逐者", "守望者", "保卫者", "执法者", "审判者",
-            "救世主", "天选者", "命运之子", "时空旅人", "梦境行者", "虚空漫步者", "星界旅者", "深渊潜行者",
-            "龙骑士", "凤凰使", "麒麟卫", "白虎将", "玄武使", "朱雀使", "青龙将", "饕餮王",
-            "混沌之主", "秩序守护", "光明化身", "黑暗化身", "时间之主", "空间之主", "命运编织者", "因果操纵者",
-            "元素领主", "能量掌控", "符文大师", "咒术宗师", "炼金术士", "机械大师", "数据黑客", "赛博行者",
-            "星际海盗", "银河商人", "黑洞探险家", "白洞观测者", "量子幽灵", "暗物质猎手", "反物质学者", "超弦理论家",
-            "神话缔造者", "传说终结者", "史诗谱写者", "传奇见证者", "不朽者", "永生者", "转世者", "轮回者",
-            "天外来客", "地心访客", "深海来客", "极地来客", "沙漠行者", "丛林猎手", "雪山隐士", "草原游牧",
-            "城市猎人", "废土幸存", "末日使者", "新纪元开创者", "文明守护者", "知识传承者", "智慧化身", "力量象征",
-            "福音战士","超电磁炮"
-    };
-
-    public static String getNickName() {
-        Random random = new Random();
-        int prefixIndex = random.nextInt(PREFIXES.length);
-        int suffixIndex = random.nextInt(SUFFIXES.length);
-        return PREFIXES[prefixIndex] + SUFFIXES[suffixIndex];
-    }
-}

+ 0 - 268
fs-live-app/src/main/java/com/fs/app/websocket/handle/LiveChatHandler.java

@@ -1,268 +0,0 @@
-package com.fs.app.websocket.handle;
-
-import com.alibaba.fastjson.JSONObject;
-import com.fs.app.websocket.bean.SendMsgVo;
-import com.fs.app.websocket.constant.AttrConstant;
-import com.fs.common.core.domain.R;
-import com.fs.common.utils.spring.SpringUtils;
-import com.fs.his.domain.FsUser;
-import com.fs.his.service.IFsUserService;
-import com.fs.live.domain.LiveMsg;
-import com.fs.live.domain.LiveWatchUser;
-import com.fs.live.service.ILiveMsgService;
-import com.fs.live.service.ILiveService;
-import com.fs.live.service.ILiveWatchUserService;
-import com.fs.live.vo.LiveWatchUserVO;
-import io.netty.channel.*;
-import io.netty.channel.group.ChannelGroup;
-import io.netty.channel.group.DefaultChannelGroup;
-import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
-import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler;
-import io.netty.util.concurrent.GlobalEventExecutor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Component;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-@Component
-@ChannelHandler.Sharable
-@Slf4j
-public class LiveChatHandler extends SimpleChannelInboundHandler<TextWebSocketFrame> {
-
-    // 容器
-    private final static ConcurrentHashMap<Long, CopyOnWriteArrayList<Channel>> adminRooms = new ConcurrentHashMap<>();
-    private final static ConcurrentHashMap<Long, ConcurrentHashMap<Long, Channel>> rooms = new ConcurrentHashMap<>();
-    private final static ConcurrentHashMap<Long, ChannelGroup> roomGroups = new ConcurrentHashMap<>();
-    private final static ILiveService liveService = SpringUtils.getBean(ILiveService.class);
-    private final static ILiveWatchUserService liveWatchUserService = SpringUtils.getBean(ILiveWatchUserService.class);
-    private final static ILiveMsgService liveMsgService = SpringUtils.getBean(ILiveMsgService.class);
-    private final static IFsUserService fsUserService = SpringUtils.getBean(IFsUserService.class);
-
-    /**
-     * 处理握手
-     * @param ctx   连接
-     * @param evt   数据
-     * @throws Exception    异常
-     */
-    @Override
-    public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
-        log.debug("事件");
-        // 处理 WebSocket 握手完成事件
-        if (evt instanceof WebSocketServerProtocolHandler.HandshakeComplete) {
-            Long userId = ctx.channel().attr(AttrConstant.ATTR_USER_ID).get();
-            Long liveId = ctx.channel().attr(AttrConstant.ATTR_LIVE_ID).get();
-            Long userType = ctx.channel().attr(AttrConstant.ATTR_USER_TYPE).get();
-
-            if (Objects.isNull(liveService.getById(liveId))) {
-                ctx.channel().writeAndFlush(new TextWebSocketFrame("Error: 未找到直播间")).addListener(ChannelFutureListener.CLOSE);
-                return;
-            }
-
-            Map<Long, Channel> room = getRoom(liveId);
-            List<Channel> adminRoom = getAdminRoom(liveId);
-            ChannelGroup roomGroup = getRoomGroup(liveId);
-            roomGroup.add(ctx.channel());
-
-            if (userType == 0) {
-                // 加入房间
-                liveWatchUserService.join(liveId, userId);
-                room.put(userId, ctx.channel());
-
-                FsUser fsUser = fsUserService.selectFsUserByUserId(userId);
-                if (Objects.isNull(fsUser)) {
-                    ctx.channel().writeAndFlush(new TextWebSocketFrame("Error: 用户信息错误")).addListener(ChannelFutureListener.CLOSE);
-                    return;
-                }
-
-                LiveWatchUserVO liveWatchUserVO = liveWatchUserService.selectWatchUserByLiveIdAndUserId(liveId, userId);
-
-                SendMsgVo sendMsgVo = new SendMsgVo();
-                sendMsgVo.setLiveId(liveId);
-                sendMsgVo.setUserId(userId);
-                sendMsgVo.setUserType(userType);
-                sendMsgVo.setCmd("entry");
-                sendMsgVo.setMsg("用户进入");
-                sendMsgVo.setData(JSONObject.toJSONString(liveWatchUserVO));
-                sendMsgVo.setNickName(fsUser.getNickName());
-                sendMsgVo.setAvatar(fsUser.getAvatar());
-
-                // 广播连接消息
-                broadcastMessage(liveId, JSONObject.toJSONString(R.ok().put("data", sendMsgVo)));
-            } else if (userType == 1) {
-                adminRoom.add(ctx.channel());
-            }
-
-            log.debug("加入webSocket liveId: {}, userId: {}, 直播间人数: {}", liveId, userId, room.size());
-        }
-    }
-
-    /**
-     * 获取房间
-     * @param liveId 直播间ID
-     * @return 容器
-     */
-    private CopyOnWriteArrayList<Channel> getAdminRoom(Long liveId) {
-        return adminRooms.computeIfAbsent(liveId, k -> new CopyOnWriteArrayList<>());
-    }
-
-    /**
-     * 获取房间
-     * @param liveId 直播间ID
-     * @return 容器
-     */
-    private ConcurrentHashMap<Long, Channel> getRoom(Long liveId) {
-        return rooms.computeIfAbsent(liveId, k -> new ConcurrentHashMap<>());
-    }
-
-    /**
-     * 获取房间用户组
-     * @param liveId 直播间ID
-     * @return  用户组
-     */
-    private ChannelGroup getRoomGroup(Long liveId) {
-        return roomGroups.computeIfAbsent(liveId, k -> new DefaultChannelGroup(GlobalEventExecutor.INSTANCE));
-    }
-
-    /**
-     * 发送广播
-     * @param liveId    直播间ID
-     * @param msg       消息
-     */
-    private void broadcastMessage(Long liveId, String msg) {
-        getRoomGroup(liveId).writeAndFlush(new TextWebSocketFrame(msg));
-    }
-
-    /**
-     * 发送指定消息
-     * @param channel   连接
-     * @param message   消息
-     */
-    private void sendMessage(Channel channel, String message) {
-        channel.writeAndFlush(new TextWebSocketFrame(message));
-    }
-
-    /**
-     * 接收消息
-     * @param channelHandlerContext 连接
-     * @param textWebSocketFrame    消息
-     * @throws Exception    异常
-     */
-    @Override
-    protected void channelRead0(ChannelHandlerContext channelHandlerContext, TextWebSocketFrame textWebSocketFrame) throws Exception {
-        log.debug("接收到消息 data: {}", textWebSocketFrame.text());
-        Long liveId = channelHandlerContext.channel().attr(AttrConstant.ATTR_LIVE_ID).get();
-        Long userType = channelHandlerContext.channel().attr(AttrConstant.ATTR_USER_TYPE).get();
-
-        SendMsgVo msg = JSONObject.parseObject( textWebSocketFrame.text(), SendMsgVo.class);
-        if(msg.isOn()) return;
-        try {
-            switch (msg.getCmd()) {
-                case "heartbeat":
-                    sendMessage(channelHandlerContext.channel(), JSONObject.toJSONString(R.ok().put("data", msg)));
-                    break;
-                case "sendMsg":
-                    LiveMsg liveMsg = new LiveMsg();
-                    liveMsg.setLiveId(msg.getLiveId());
-                    liveMsg.setUserId(msg.getUserId());
-                    liveMsg.setNickName(msg.getNickName());
-                    liveMsg.setAvatar(msg.getAvatar());
-                    liveMsg.setMsg(msg.getMsg());
-                    liveMsg.setCreateTime(new Date());
-
-                    if (userType == 0) {
-                        LiveWatchUser liveWatchUser = liveWatchUserService.getByLiveIdAndUserId(msg.getLiveId(), msg.getUserId());
-                        if(liveWatchUser.getMsgStatus() == 1){
-                            sendMessage(channelHandlerContext.channel(), JSONObject.toJSONString(R.error("你以被禁言")));
-                            return;
-                        }
-
-                        liveMsgService.save(liveMsg);
-                    }
-
-                    msg.setOn(true);
-                    msg.setData(JSONObject.toJSONString(liveMsg));
-
-                    // 广播消息
-                    broadcastMessage(liveId, JSONObject.toJSONString(R.ok().put("data", msg)));
-                    break;
-            }
-        } catch (Exception e) {
-            log.error("webSocket 消息处理失败 msg: {}", e.getMessage(), e);
-        }
-    }
-
-    /**
-     * 断开连接
-     * @param ctx   连接
-     * @throws Exception    异常
-     */
-    @Override
-    public void channelInactive(ChannelHandlerContext ctx) throws Exception {
-        log.debug("断开连接");
-        Long userId = ctx.channel().attr(AttrConstant.ATTR_USER_ID).get();
-        Long liveId = ctx.channel().attr(AttrConstant.ATTR_LIVE_ID).get();
-        Long userType = ctx.channel().attr(AttrConstant.ATTR_USER_TYPE).get();
-
-        if (Objects.isNull(userId) || Objects.isNull(liveId) || Objects.isNull(userType)) {
-            return;
-        }
-
-        Map<Long, Channel> room = getRoom(liveId);
-        List<Channel> adminRoom = getAdminRoom(liveId);
-        ChannelGroup roomGroup = getRoomGroup(liveId);
-
-        if (userType == 0) {
-            FsUser fsUser = fsUserService.selectFsUserByUserId(userId);
-            liveWatchUserService.close(liveId, userId);
-            room.remove(userId);
-
-            if (room.isEmpty()) {
-                rooms.remove(liveId);
-            }
-
-            LiveWatchUserVO liveWatchUserVO = liveWatchUserService.selectWatchUserByLiveIdAndUserId(liveId, userId);
-
-            SendMsgVo sendMsgVo = new SendMsgVo();
-            sendMsgVo.setLiveId(liveId);
-            sendMsgVo.setUserId(userId);
-            sendMsgVo.setUserType(userType);
-            sendMsgVo.setCmd("out");
-            sendMsgVo.setMsg("用户离开");
-            sendMsgVo.setData(JSONObject.toJSONString(liveWatchUserVO));
-            sendMsgVo.setNickName(fsUser.getNickName());
-            sendMsgVo.setAvatar(fsUser.getAvatar());
-
-            // 广播离开消息
-            broadcastMessage(liveId, JSONObject.toJSONString(R.ok().put("data", sendMsgVo)));
-        } else {
-            adminRoom.remove(ctx.channel());
-            if (adminRoom.isEmpty()) {
-                adminRooms.remove(liveId);
-            }
-        }
-        roomGroup.remove(ctx.channel());
-        if (roomGroup.isEmpty()) {
-            roomGroups.remove(liveId);
-        }
-
-        log.debug("断开webSocket liveId: {}, userId: {}, 直播间人数: {}", liveId, userId, room.size());
-
-    }
-
-    /**
-     * 连接异常
-     * @param ctx   连接
-     * @param cause 原因
-     * @throws Exception 异常
-     */
-    @Override
-    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
-        log.error("连接异常 msg: {}", cause.getMessage(), cause);
-        ctx.close();
-    }
-}

+ 0 - 97
fs-live-app/src/main/java/com/fs/app/websocket/service/NettyServerRunner.java

@@ -1,97 +0,0 @@
-//package com.fs.app.websocket.service;
-//
-//import com.fs.app.websocket.auth.AuthHandler;
-//import com.fs.app.websocket.handle.LiveChatHandler;
-//import io.netty.bootstrap.ServerBootstrap;
-//import io.netty.channel.*;
-//import io.netty.channel.nio.NioEventLoopGroup;
-//import io.netty.channel.socket.SocketChannel;
-//import io.netty.channel.socket.nio.NioServerSocketChannel;
-//import io.netty.handler.codec.http.HttpObjectAggregator;
-//import io.netty.handler.codec.http.HttpServerCodec;
-//import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler;
-//import lombok.extern.slf4j.Slf4j;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.boot.CommandLineRunner;
-//import org.springframework.stereotype.Component;
-//
-//import javax.annotation.PreDestroy;
-//import java.util.Objects;
-//
-//@Slf4j
-//@Component
-//public class NettyServerRunner implements CommandLineRunner {
-//
-//    private static final int port = 17114;
-//    private EventLoopGroup bossGroup;
-//    private EventLoopGroup workerGroup;
-//    private Channel serverChannel;
-//    @Autowired
-//    private AuthHandler authHandler;
-//    @Autowired
-//    private LiveChatHandler liveChatHandler;
-//
-//    @Override
-//    public void run(String... args) throws Exception {
-//        new Thread(this::startServer).start();
-//    }
-//
-//    private void startServer() {
-//        bossGroup = new NioEventLoopGroup(); // 处理连接
-//        workerGroup = new NioEventLoopGroup(); // 处理I/O
-//        try {
-//            ServerBootstrap bootstrap = new ServerBootstrap();
-//            bootstrap.group(bossGroup, workerGroup)
-//                    .channel(NioServerSocketChannel.class)
-//                    .childHandler(new ChannelInitializer<SocketChannel>() {
-//
-//                        @Override
-//                        protected void initChannel(SocketChannel socketChannel) throws Exception {
-//                            ChannelPipeline pipeline = socketChannel.pipeline();
-//                            // 编解码
-//                            pipeline.addLast(new HttpServerCodec());
-//                            // 集合消息
-//                            pipeline.addLast(new HttpObjectAggregator(65536));
-//                            // 安全校验
-//                            pipeline.addLast(authHandler);
-//                            // websocket握手
-//                            pipeline.addLast(new WebSocketServerProtocolHandler("/app/webSocket", null, true, 65536, false, true));
-//                            // 自定义聊天
-//                            pipeline.addLast(liveChatHandler);
-//                        }
-//                    })
-//                    .option(ChannelOption.SO_BACKLOG, 1024)
-//                    .childOption(ChannelOption.SO_KEEPALIVE, true);
-//
-//            ChannelFuture future = bootstrap.bind(port).sync();
-//            serverChannel = future.channel();
-//            log.info("netty server started [{}]", port);
-//            serverChannel.closeFuture().sync();
-//        } catch (Exception e) {
-//            log.error("netty server error msg: {}", e.getMessage(), e);
-//        } finally {
-//            shutdown();
-//        }
-//    }
-//
-//    @PreDestroy
-//    public void destroy() {
-//        shutdown();
-//        log.info("netty server destroy");
-//    }
-//
-//    private void shutdown() {
-//        if (Objects.nonNull(bossGroup)) {
-//            bossGroup.shutdownGracefully();
-//        }
-//
-//        if (Objects.nonNull(workerGroup)) {
-//            workerGroup.shutdownGracefully();
-//        }
-//
-//        if (Objects.nonNull(serverChannel)) {
-//            serverChannel.close();
-//        }
-//        log.info("netty server stopped");
-//    }
-//}

+ 0 - 454
fs-live-app/src/main/java/com/fs/app/websocket/service/WebSocketServer.java

@@ -1,454 +0,0 @@
-package com.fs.app.websocket.service;
-
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.fs.app.config.ProductionWordFilter;
-import com.fs.app.websocket.auth.WebSocketConfigurator;
-import com.fs.app.websocket.bean.SendMsgVo;
-import com.fs.common.core.domain.R;
-import com.fs.common.core.redis.RedisCache;
-import com.fs.common.exception.base.BaseException;
-import com.fs.common.utils.StringUtils;
-import com.fs.common.utils.spring.SpringUtils;
-import com.fs.his.domain.FsUser;
-import com.fs.his.service.IFsUserService;
-import com.fs.live.domain.*;
-import com.fs.live.service.*;
-import com.fs.live.vo.LiveGoodsVo;
-import com.fs.live.vo.LiveWatchUserVO;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.time.DateUtils;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-
-import javax.websocket.*;
-import javax.websocket.server.ServerEndpoint;
-import java.io.IOException;
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.TimeUnit;
-
-import static com.fs.common.constant.LiveKeysConstant.*;
-
-@ServerEndpoint(value = "/app/webSocket",configurator = WebSocketConfigurator.class)
-@Component
-@Slf4j
-public class WebSocketServer {
-
-    // 直播间用户session
-    private final static ConcurrentHashMap<Long, ConcurrentHashMap<Long, Session>> rooms = new ConcurrentHashMap<>();
-    // 管理端连接
-    private final static ConcurrentHashMap<Long, CopyOnWriteArrayList<Session>> adminRooms = new ConcurrentHashMap<>();
-    private final RedisCache redisCache = SpringUtils.getBean(RedisCache.class);
-    private final ILiveMsgService liveMsgService = SpringUtils.getBean(ILiveMsgService.class);
-    private final ILiveService liveService = SpringUtils.getBean(ILiveService.class);
-    private final ILiveWatchUserService liveWatchUserService = SpringUtils.getBean(ILiveWatchUserService.class);
-    private final IFsUserService fsUserService = SpringUtils.getBean(IFsUserService.class);
-    private final ILiveDataService liveDataService = SpringUtils.getBean(ILiveDataService.class);
-    private final ProductionWordFilter productionWordFilter = SpringUtils.getBean(ProductionWordFilter.class);
-    private final ILiveRedConfService liveRedConfService =  SpringUtils.getBean(ILiveRedConfService.class);
-    private final ILiveLotteryConfService liveLotteryConfService =  SpringUtils.getBean(ILiveLotteryConfService.class);
-    private final ILiveGoodsService liveGoodsService =  SpringUtils.getBean(ILiveGoodsService.class);
-    private final ILiveUserFirstEntryService liveUserFirstEntryService =  SpringUtils.getBean(ILiveUserFirstEntryService.class);
-    // 直播间在线用户缓存
-//    private static final ConcurrentHashMap<Long, Integer> liveOnlineUsers = new ConcurrentHashMap<>();
-
-
-    //建立连接成功调用
-    @OnOpen
-    public void onOpen(Session session) {
-
-        Map<String, Object> userProperties = session.getUserProperties();
-        long liveId = (long) userProperties.get("liveId");
-        long userId = (long) userProperties.get("userId");
-        long userType = (long) userProperties.get("userType");
-        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("未找到直播间");
-        }
-
-        ConcurrentHashMap<Long, Session> room = getRoom(liveId);
-        List<Session> adminRoom = getAdminRoom(liveId);
-
-        // 记录连接信息 管理员不记录
-        if (userType == 0) {
-            FsUser fsUser = fsUserService.selectFsUserByUserId(userId);
-            if (Objects.isNull(fsUser)) {
-                throw new BaseException("用户信息错误");
-            }
-
-            LiveWatchUser liveWatchUserVO = liveWatchUserService.join(liveId, userId);
-            room.put(userId, session);
-            // 直播间浏览量 +1
-            redisCache.increment(PAGE_VIEWS_KEY + liveId, 1);
-
-            // 累计观看人次 +1
-            redisCache.increment(TOTAL_VIEWS_KEY + liveId, 1);
-
-            // 记录在线人数
-            redisCache.increment(ONLINE_USERS_KEY + liveId, 1);
-            Integer currentOnline = redisCache.getCacheObject(ONLINE_USERS_KEY + liveId);
-            //最大同时在线人数
-            Integer maxOnline = redisCache.getCacheObject(MAX_ONLINE_USERS_KEY + liveId);
-            if (maxOnline == null || currentOnline > maxOnline) {
-                redisCache.setCacheObject(MAX_ONLINE_USERS_KEY + liveId, currentOnline);
-            }
-
-            // 判断是否是该直播间的首次访客(独立访客统计)
-            boolean isFirstVisit = redisCache.setIfAbsent(USER_VISIT_KEY + userId, 1, 1, TimeUnit.DAYS);
-            if (isFirstVisit) {
-
-                redisCache.increment(UNIQUE_VISITORS_KEY + liveId, 1);
-            }
-
-            // 判断是否是首次进入直播间的观众
-            boolean isFirstViewer = redisCache.setIfAbsent(UNIQUE_VIEWERS_KEY + liveId + ":" + userId, 1, 1, TimeUnit.DAYS);
-            if (isFirstViewer) {
-                redisCache.increment(UNIQUE_VIEWERS_KEY + liveId, 1);
-            }
-            LiveWatchUser liveWatchUser = liveWatchUserService.getByLiveIdAndUserId(liveId, userId);
-            liveWatchUserVO.setMsgStatus(liveWatchUser.getMsgStatus());
-            SendMsgVo sendMsgVo = new SendMsgVo();
-            sendMsgVo.setLiveId(liveId);
-            sendMsgVo.setUserId(userId);
-            sendMsgVo.setUserType(userType);
-            sendMsgVo.setCmd("entry");
-            sendMsgVo.setMsg("用户进入");
-            sendMsgVo.setData(JSONObject.toJSONString(liveWatchUserVO));
-            sendMsgVo.setNickName(fsUser.getNickName());
-            sendMsgVo.setAvatar(fsUser.getAvatar());
-            int i = liveUserFirstEntryService.selectTodayEntry(userId);
-            if (!(i > 0)) {
-                Date date = new Date();
-                LiveUserFirstEntry liveUserFirstEntry = new LiveUserFirstEntry();
-                liveUserFirstEntry.setUserId(userId);
-                liveUserFirstEntry.setLiveId(liveId);
-                liveUserFirstEntry.setCompanyId(companyId);
-                liveUserFirstEntry.setCompanyUserId(companyUserId);
-                liveUserFirstEntry.setEntryDate(date);
-                liveUserFirstEntry.setFirstEntryTime(date);
-                liveUserFirstEntry.setUpdateTime( date);
-                liveUserFirstEntryService.insertLiveUserFirstEntry(liveUserFirstEntry);
-            }
-
-            // 广播连接消息
-            broadcastMessage(liveId, JSONObject.toJSONString(R.ok().put("data", sendMsgVo)));
-        } else {
-            adminRoom.add(session);
-        }
-
-        log.debug("加入webSocket liveId: {}, userId: {}, 直播间人数: {}, 管理端人数: {}", liveId, userId, room.size(), adminRoom.size());
-    }
-
-    //关闭连接时调用
-    @OnClose
-    public void onClose(Session session) {
-        Map<String, Object> userProperties = session.getUserProperties();
-
-        long liveId = (long) userProperties.get("liveId");
-        long userId = (long) userProperties.get("userId");
-        long userType = (long) userProperties.get("userType");
-
-        ConcurrentHashMap<Long, Session> room = getRoom(liveId);
-        List<Session> adminRoom = getAdminRoom(liveId);
-        if (userType == 0) {
-            FsUser fsUser = fsUserService.selectFsUserByUserId(userId);
-            if (Objects.isNull(fsUser)) {
-                throw new BaseException("用户信息错误");
-            }
-
-            LiveWatchUser liveWatchUserVO = liveWatchUserService.close(liveId, userId);
-            room.remove(userId);
-
-            if (room.isEmpty()) {
-                rooms.remove(liveId);
-            }
-
-
-            // 直播间在线人数 -1
-            redisCache.increment(ONLINE_USERS_KEY + liveId, -1);
-            SendMsgVo sendMsgVo = new SendMsgVo();
-            sendMsgVo.setLiveId(liveId);
-            sendMsgVo.setUserId(userId);
-            sendMsgVo.setUserType(userType);
-            sendMsgVo.setCmd("out");
-            sendMsgVo.setMsg("用户离开");
-            sendMsgVo.setData(JSONObject.toJSONString(liveWatchUserVO));
-            sendMsgVo.setNickName(fsUser.getNickName());
-            sendMsgVo.setAvatar(fsUser.getAvatar());
-
-            // 广播离开消息
-            broadcastMessage(liveId, JSONObject.toJSONString(R.ok().put("data", sendMsgVo)));
-        } else {
-            adminRoom.remove(session);
-        }
-
-        log.debug("离开webSocket liveId: {}, userId: {}, 直播间人数: {}, 管理端人数: {}", liveId, userId, room.size(), adminRoom.size());
-    }
-
-    //收到客户端信息
-    @OnMessage
-    public void onMessage(Session session,String message) throws IOException {
-        Map<String, Object> userProperties = session.getUserProperties();
-
-        long liveId = (long) userProperties.get("liveId");
-        long userType = (long) userProperties.get("userType");
-
-        SendMsgVo msg = JSONObject.parseObject(message, SendMsgVo.class);
-        if(msg.isOn()) return;
-        try {
-            switch (msg.getCmd()) {
-                case "heartbeat":
-                    sendMessage(session, JSONObject.toJSONString(R.ok().put("data", msg)));
-                    break;
-                case "sendMsg":
-                    msg.setMsg(productionWordFilter.filter(msg.getMsg()).getFilteredText());
-                    if(StringUtils.isEmpty(msg.getMsg())) return;
-                    LiveMsg liveMsg = new LiveMsg();
-                    liveMsg.setLiveId(msg.getLiveId());
-                    liveMsg.setUserId(msg.getUserId());
-                    liveMsg.setNickName(msg.getNickName());
-                    liveMsg.setAvatar(msg.getAvatar());
-                    liveMsg.setMsg(msg.getMsg());
-                    liveMsg.setCreateTime(new Date());
-
-                    if (userType == 0) {
-                        LiveWatchUser liveWatchUser = liveWatchUserService.getByLiveIdAndUserId(msg.getLiveId(), msg.getUserId());
-                        if(liveWatchUser.getMsgStatus() == 1){
-                            sendMessage(session, JSONObject.toJSONString(R.error("你已被禁言")));
-                            return;
-                        }
-
-                        liveMsgService.save(liveMsg);
-                    }
-
-                    msg.setOn(true);
-                    msg.setData(JSONObject.toJSONString(liveMsg));
-
-                    // 广播消息
-                    broadcastMessage(liveId, JSONObject.toJSONString(R.ok().put("data", msg)));
-                    break;
-                case "sendGift":
-                    break;
-                case "blockUser":
-                    sendBlockMessage(liveId, msg.getUserId());
-                    break;
-                case "goods":
-                    sendGoodsMessage(msg);
-                    break;
-                case "red":
-                    processRed(liveId, msg);
-                    break;
-                case "lottery":
-                    processLottery(liveId, msg);
-                    break;
-                case "delAutoTask":
-                    if (userType == 1) {
-                        delAutoTask(liveId, DateUtils.parseDate(msg.getData(),"yyyy-MM-dd'T'HH:mm:ss.SSSZ").getTime());
-                    }
-                    break;
-            }
-        } catch (Exception e) {
-            log.error("webSocket 消息处理失败 msg: {}", e.getMessage(), e);
-        }
-    }
-
-
-
-    private void sendGoodsMessage(SendMsgVo msg) {
-        JSONObject jsonObject = JSON.parseObject(msg.getData());
-        Long goodsId = jsonObject.getLong("goodsId");
-        Long liveId = jsonObject.getLong("liveId");
-        Integer status = jsonObject.getInteger("status");
-        msg.setStatus(status);
-        LiveGoodsVo liveGoods = liveGoodsService.selectLiveGoodsVoByGoodsId(goodsId);
-        if(liveGoods == null) return;
-        msg.setLiveId(liveId);
-        msg.setData(JSONObject.toJSONString(liveGoods));
-        broadcastMessage(liveId, JSONObject.toJSONString(R.ok().put("data", msg)));
-    }
-
-    /**
-     * 处理红包变动消息
-     */
-    private void processRed(Long liveId, SendMsgVo msg) {
-        log.debug("redData: {}", msg);
-        JSONObject jsonObject = JSON.parseObject(msg.getData());
-        Integer status = jsonObject.getInteger("status");
-        msg.setStatus( status);
-        LiveRedConf liveRedConf = liveRedConfService.selectLiveRedConfByRedId(jsonObject.getLong("redId"));
-        if (Objects.nonNull(liveRedConf)) {
-            msg.setData(JSONObject.toJSONString(liveRedConf));
-            broadcastMessage(liveId, JSONObject.toJSONString(R.ok().put("data", msg)));
-        }
-    }
-
-    /**
-     * 处理抽奖变动消息
-     */
-    private void processLottery(Long liveId, SendMsgVo msg) {
-        log.debug("lotteryData: {}", msg);
-        JSONObject jsonObject = JSON.parseObject(msg.getData());
-        Integer status = jsonObject.getInteger("status");
-        msg.setStatus( status);
-        LiveLotteryConf liveLotteryConf = liveLotteryConfService.selectLiveLotteryConfByLotteryId(jsonObject.getLong("lotteryId"));
-        if (Objects.nonNull(liveLotteryConf)) {
-            msg.setData(JSONObject.toJSONString(liveLotteryConf));
-            broadcastMessage(liveId, JSONObject.toJSONString(R.ok().put("data", msg)));
-        }
-    }
-
-    //错误时调用
-    @OnError
-    public void onError(Session session, Throwable throwable) {
-        log.error("webSocKet连接错误 msg: {}", throwable.getMessage(), throwable);
-    }
-
-    /**
-     * 获取房间
-     * @param liveId 直播间ID
-     * @return 容器
-     */
-    private ConcurrentHashMap<Long, Session> getRoom(Long liveId) {
-        return rooms.computeIfAbsent(liveId, k -> new ConcurrentHashMap<>());
-    }
-
-    /**
-     * 获取管理端房间
-     * @param liveId  直播间ID
-     * @return  容器
-     */
-    private List<Session> getAdminRoom(Long liveId) {
-        return adminRooms.computeIfAbsent(liveId, k -> new CopyOnWriteArrayList<>());
-    }
-
-    //发送消息
-    public void sendMessage(Session session, String message) throws IOException {
-        session.getAsyncRemote().sendText(message);
-    }
-
-    public void sendIntegralMessage(Long liveId, Long userId,Long scoreAmount) {
-        SendMsgVo sendMsgVo = new SendMsgVo();
-        sendMsgVo.setLiveId(liveId);
-        sendMsgVo.setUserId(userId);
-        sendMsgVo.setUserType(0L);
-        sendMsgVo.setCmd("Integral");
-        sendMsgVo.setMsg("恭喜你成功获得观看奖励:" + scoreAmount + "芳华币");
-        sendMsgVo.setData(String.valueOf(scoreAmount));
-        ConcurrentHashMap<Long, Session> room = getRoom(liveId);
-        Session session = room.get(userId);
-        if(Objects.isNull( session)) return;
-        session.getAsyncRemote().sendText(JSONObject.toJSONString(R.ok().put("data", sendMsgVo)));
-    }
-
-    private void sendBlockMessage(Long liveId, Long userId) {
-        SendMsgVo sendMsgVo = new SendMsgVo();
-        sendMsgVo.setLiveId(liveId);
-        sendMsgVo.setUserId(userId);
-        sendMsgVo.setUserType(0L);
-        sendMsgVo.setCmd("blockUser");
-        sendMsgVo.setMsg("账号已被停用");
-        sendMsgVo.setData(null);
-        ConcurrentHashMap<Long, Session> room = getRoom(liveId);
-        Session session = room.get(userId);
-        if(Objects.isNull( session)) return;
-        session.getAsyncRemote().sendText(JSONObject.toJSONString(R.ok().put("data", sendMsgVo)));
-    }
-
-    /**
-     * 广播消息
-     * @param liveId   直播间ID
-     * @param message  消息内容
-     */
-    public void broadcastMessage(Long liveId, String message) {
-        ConcurrentHashMap<Long, Session> room = getRoom(liveId);
-        List<Session> adminRoom = getAdminRoom(liveId);
-
-        room.forEach((k, v) -> v.getAsyncRemote().sendText(message));
-        adminRoom.forEach(v -> v.getAsyncRemote().sendText(message));
-    }
-
-    /**
-     *定期将缓存的数据写入数据库
-     */
-    @Scheduled(fixedRate = 60000) // 每分钟执行一次
-    public void syncLiveDataToDB() {
-        List<LiveData> liveDatas = liveDataService.getAllLiveDatas(); // 获取所有正在直播的直播间数据
-        if(liveDatas == null)
-            return;
-        liveDatas.forEach(liveData ->{
-            liveData.setLikes(
-                    Optional.ofNullable(redisCache.incrementCacheValue("live:like:" + liveData.getLiveId(),0 )).orElse(0L)
-            );
-
-       /* for (Long liveId : liveIds) {
-            LiveData liveData = liveDataService.selectLiveDataByLiveId(liveId);
-            if (liveData == null) {
-                continue; // 防止空指针异常
-            }*/
-
-
-            // 从 redis 获取数据,并提供默认值,避免 NPE
-            liveData.setPageViews(
-                    Optional.ofNullable(redisCache.incrementCacheValue(PAGE_VIEWS_KEY + liveData.getLiveId(),0)).orElse(0L)
-            );
-            liveData.setTotalViews(
-                    Optional.ofNullable(redisCache.incrementCacheValue(TOTAL_VIEWS_KEY + liveData.getLiveId(),0)).orElse(0L)
-            );
-            liveData.setUniqueVisitors(
-                    /*Optional.ofNullable(redisCache.getCacheSet(UNIQUE_VISITORS_KEY + liveId))
-                            .map(Set::size)  // 获取集合大小
-                            .map(Long::valueOf)  // 转换为 Long 类型
-                            .orElse(0L)*/
-                    Optional.ofNullable(redisCache.incrementCacheValue(UNIQUE_VISITORS_KEY + liveData.getLiveId(),0)).orElse(0L)
-            );
-            liveData.setUniqueViewers(
-                    /*Optional.ofNullable(redisCache.getCacheSet(UNIQUE_VIEWERS_KEY + liveId))
-                            .map(Set::size)  // 获取集合大小
-                            .map(Long::valueOf)  // 转换为 Long 类型
-                            .orElse(0L)*/
-                    Optional.ofNullable(redisCache.incrementCacheValue(UNIQUE_VIEWERS_KEY + liveData.getLiveId(),0)).orElse(0L)
-            );
-            liveData.setPeakConcurrentViewers(
-                    Optional.ofNullable(redisCache.incrementCacheValue(MAX_ONLINE_USERS_KEY + liveData.getLiveId(),0)).orElse(0L)
-            );
-        });
-        if(!liveDatas.isEmpty())
-            liveDataService.updateBatchById(liveDatas);
-
-            /*// 更新数据库
-            liveDataService.updateLiveData(liveData);*/
-    }
-
-
-    public void handleAutoTask(LiveAutoTask task) {
-        if (task.getTaskType() == 1L) {
-            SendMsgVo msg = new SendMsgVo();
-            msg.setLiveId(task.getLiveId());
-            msg.setData(task.getContent());
-            msg.setCmd("goods");
-            try {
-                LiveGoodsVo liveGoodsVo = JSON.parseObject(task.getContent(), LiveGoodsVo.class);
-                liveGoodsService.updateLiveIsShow(liveGoodsVo.getGoodsId(), task.getLiveId());
-            } catch (Exception e) {
-                log.error("定时任务执行异常:{}", e.getMessage());
-            }
-            msg.setStatus(1);
-            broadcastMessage(task.getLiveId(), JSONObject.toJSONString(R.ok().put("data", msg)));
-        }
-    }
-    private void delAutoTask(long liveId, Long data) {
-        String key = "live:auto_task:";
-        redisCache.redisTemplate.opsForZSet().removeRangeByScore(key + liveId, data, data);
-    }
-}

+ 0 - 1
fs-live-app/src/main/java/com/fs/framework/aspectj/LiveWatchUserAspect.java

@@ -13,7 +13,6 @@ import org.springframework.core.Ordered;
 import org.springframework.core.annotation.Order;
 import org.springframework.stereotype.Component;
 
-import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
 

+ 5 - 6
fs-live-app/src/main/java/com/fs/framework/aspectj/LogAspect.java

@@ -9,7 +9,6 @@ import com.fs.common.utils.SecurityUtils;
 import com.fs.common.utils.ServletUtils;
 import com.fs.common.utils.StringUtils;
 import com.fs.common.utils.ip.IpUtils;
-
 import com.fs.framework.manager.AsyncManager;
 import com.fs.framework.manager.factory.AsyncFactory;
 import com.fs.system.domain.SysOperLog;
@@ -36,7 +35,7 @@ import java.util.Map;
 
 /**
  * 操作日志记录处理
- * 
+ *
 
  */
 @Aspect
@@ -64,7 +63,7 @@ public class LogAspect
 
     /**
      * 拦截异常操作
-     * 
+     *
      * @param joinPoint 切点
      * @param e 异常
      */
@@ -130,7 +129,7 @@ public class LogAspect
 
     /**
      * 获取注解中对方法的描述信息 用于Controller层注解
-     * 
+     *
      * @param log 日志
      * @param operLog 操作日志
      * @throws Exception
@@ -153,7 +152,7 @@ public class LogAspect
 
     /**
      * 获取请求的参数,放到log中
-     * 
+     *
      * @param operLog 操作日志
      * @throws Exception 异常
      */
@@ -210,7 +209,7 @@ public class LogAspect
 
     /**
      * 判断是否需要过滤的对象。
-     * 
+     *
      * @param o 对象信息。
      * @return 如果是需要过滤的对象,则返回true;否则返回false。
      */

+ 3 - 4
fs-live-app/src/main/java/com/fs/framework/config/DataSourceConfig.java

@@ -23,8 +23,8 @@ import java.util.Map;
 public class DataSourceConfig {
 
     @Bean
-    @ConfigurationProperties(prefix = "spring.datasource.clickhouse")
-    public DataSource clickhouseDataSource() {
+    @ConfigurationProperties(prefix = "spring.datasource.sop.druid.master")
+    public DataSource sopDataSource() {
         return new DruidDataSource();
     }
 
@@ -50,13 +50,12 @@ public class DataSourceConfig {
         targetDataSources.put(DataSourceType.SOP.name(), sopDataSource);
         return new DynamicDataSource(masterDataSource, targetDataSources);
     }
-
     /**
      * 去除监控页面底部的广告
      */
     @SuppressWarnings({ "rawtypes", "unchecked" })
     @Bean
-    @ConditionalOnProperty(name = "spring.datasource.druid.statViewServlet.enabled", havingValue = "true")
+    @ConditionalOnProperty(name = "spring.datasource.mysql.druid.statViewServlet.enabled", havingValue = "true")
     public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties)
     {
         // 获取web监控页面的参数

+ 4 - 4
fs-live-app/src/main/java/com/fs/framework/config/DruidConfig.java

@@ -30,7 +30,7 @@ package com.fs.framework.config;//package com.fs.framework.config;
 //public class DruidConfig
 //{
 //    @Bean
-//    @ConfigurationProperties("spring.datasource.druid.master")
+//    @ConfigurationProperties("spring.datasource.mysql.druid.master")
 //    public DataSource masterDataSource(DruidProperties druidProperties)
 //    {
 //        DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
@@ -38,8 +38,8 @@ package com.fs.framework.config;//package com.fs.framework.config;
 //    }
 //
 //    @Bean
-//    @ConfigurationProperties("spring.datasource.druid.slave")
-//    @ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true")
+//    @ConfigurationProperties("spring.datasource.mysql.druid.slave")
+//    @ConditionalOnProperty(prefix = "spring.datasource.mysql.druid.slave", name = "enabled", havingValue = "true")
 //    public DataSource slaveDataSource(DruidProperties druidProperties)
 //    {
 //        DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
@@ -80,7 +80,7 @@ package com.fs.framework.config;//package com.fs.framework.config;
 //     */
 //    @SuppressWarnings({ "rawtypes", "unchecked" })
 //    @Bean
-//    @ConditionalOnProperty(name = "spring.datasource.druid.statViewServlet.enabled", havingValue = "true")
+//    @ConditionalOnProperty(name = "spring.datasource.mysql.druid.statViewServlet.enabled", havingValue = "true")
 //    public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties)
 //    {
 //        // 获取web监控页面的参数

+ 0 - 2
fs-live-app/src/main/java/com/fs/framework/config/MyBatisConfig.java

@@ -1,10 +1,8 @@
 package com.fs.framework.config;
 
 import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
-import com.fs.common.utils.StringUtils;
 import org.apache.ibatis.io.VFS;
 import org.apache.ibatis.session.SqlSessionFactory;
-import org.mybatis.spring.SqlSessionFactoryBean;
 import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;

+ 1 - 3
fs-live-app/src/main/java/com/fs/framework/config/SecurityConfig.java

@@ -9,7 +9,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
 
 /**
  * spring security配置
- *
+ * 
 
  */
 @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
@@ -36,8 +36,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
     {
         http.authorizeRequests()
                 .antMatchers("/**").permitAll()
-                .antMatchers("/app/live/startLiving").permitAll()
-                .antMatchers("/app/live/startLiving").permitAll()
                 .anyRequest().authenticated()
                 .and().csrf().disable();
     }

+ 1 - 2
fs-live-app/src/main/java/com/fs/framework/config/SwaggerConfig.java

@@ -2,7 +2,6 @@ package com.fs.framework.config;
 
 import com.fs.common.config.FSConfig;
 import io.swagger.annotations.ApiOperation;
-import io.swagger.models.auth.In;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Bean;
@@ -20,7 +19,7 @@ import java.util.List;
 
 /**
  * Swagger2的接口配置
- * 
+ *
 
  */
 @Configuration

+ 0 - 1
fs-live-app/src/main/java/com/fs/live/param/TestMoneyParam.java

@@ -6,7 +6,6 @@ import lombok.ToString;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
-import java.util.List;
 
 @Getter
 @Setter

+ 1 - 1
fs-live-app/src/main/java/com/fs/live/redis/RedisConfiguration.java

@@ -1,4 +1,4 @@
-//package com.fs.live.redis;
+package com.fs.live.redis;//package com.fs.live.redis;
 //
 //
 //import org.springframework.beans.factory.annotation.Autowired;

+ 5 - 5
fs-live-app/src/main/java/com/fs/live/task/LiveCompletionPointsTask.java

@@ -48,7 +48,7 @@ public class LiveCompletionPointsTask {
         try {
             // 只查询开启了完课积分配置的直播间
             List<Live> activeLives = liveService.selectLiveListWithCompletionPointsEnabled();
-            
+
             if (activeLives == null || activeLives.isEmpty()) {
                 log.debug("当前没有开启完课积分的直播间");
                 return;
@@ -57,11 +57,11 @@ public class LiveCompletionPointsTask {
             for (Live live : activeLives) {
                 try {
                     Long liveId = live.getLiveId();
-                    
+
                     // 使用Hash结构获取该直播间所有用户的观看时长
                     String hashKey = "live:watch:duration:hash:" + liveId;
                     Map<Object, Object> userDurations = redisCache.hashEntries(hashKey);
-                    
+
                     if (userDurations == null || userDurations.isEmpty()) {
 
                         continue;
@@ -71,14 +71,14 @@ public class LiveCompletionPointsTask {
                         try {
                             Long userId = Long.parseLong(entry.getKey().toString());
                             Long duration = Long.parseLong(entry.getValue().toString());  // 从 Redis 直接获取观看时长
-                            
+
                             completionPointsRecordService.checkAndCreateCompletionRecord(liveId, userId, duration);
 
                         } catch (Exception e) {
                             log.error("处理用户完课状态失败, liveId={}, userId={}", liveId, entry.getKey(), e);
                         }
                     }
-                    
+
                 } catch (Exception e) {
                     log.error("处理直播间完课状态失败, liveId={}", live.getLiveId(), e);
                 }

+ 2 - 2
fs-live-app/src/main/java/com/fs/live/task/Task.java

@@ -931,7 +931,7 @@ public class Task {
      * @param totalVideoDuration 视频总时长(秒)
      */
     private void updateLiveWatchLogTypeByDuration(Long liveId, Long userId, Long qwUserId,
-                                                   Long exId, Long onlineSeconds, long totalVideoDuration, List<LiveWatchLog> updateLog) {
+                                                  Long exId, Long onlineSeconds, long totalVideoDuration, List<LiveWatchLog> updateLog) {
         try {
             // 查询 LiveWatchLog
             LiveWatchLog queryLog = new LiveWatchLog();
@@ -957,7 +957,7 @@ public class Task {
 //                    newLogType = 4;
 //                    needUpdate = true;
 //                } else
-                    // ③ 如果直播视频 >= 40分钟,在线时长 >= 30分钟,logType 设置为 2(完课)
+                // ③ 如果直播视频 >= 40分钟,在线时长 >= 30分钟,logType 设置为 2(完课)
                 if (totalVideoDuration >= 2400 && onlineSeconds >= 1800) { // 40分钟 = 2400秒,30分钟 = 1800秒
                     newLogType = 2;
                     log.setFinishTime(now);

+ 4 - 4
fs-live-app/src/main/java/com/fs/live/utils/CityTreeUtil.java

@@ -1,5 +1,5 @@
-package com.fs.app.utils;
-import com.fs.app.vo.CityVO;
+package com.fs.live.utils;
+import com.fs.live.vo.CityVO;
 import org.springframework.util.CollectionUtils;
 
 import java.util.ArrayList;
@@ -16,13 +16,13 @@ public class CityTreeUtil {
      * @param parentId
      * @return
      */
-    public static List<CityVO> list2TreeConverter(List<CityVO> list, String parentId) {
+    public static List<CityVO> list2TreeConverter(List<CityVO> list, int parentId) {
         List<CityVO> returnList = new ArrayList<>();
 
         for (CityVO res : list) {
             //判断对象是否为根节点
 
-            if (res.getPid().equals(parentId)) {
+            if (res.getPid() == parentId) {
                 //该节点为根节点,开始递归
 
                 //通过递归为节点设置childList

+ 1 - 1
fs-live-app/src/main/java/com/fs/live/utils/VerifyUtils.java

@@ -1,4 +1,4 @@
-package com.fs.app.utils;
+package com.fs.live.utils;
 
 import javax.crypto.Mac;
 import javax.crypto.spec.SecretKeySpec;

+ 1 - 1
fs-live-app/src/main/java/com/fs/live/utils/WebSocketRateLimiter.java

@@ -56,4 +56,4 @@ public class WebSocketRateLimiter {
     public static void removeRoomLimiter(Long liveId) {
         roomLimiters.remove(liveId);
     }
-}
+}

+ 6 - 6
fs-live-app/src/main/java/com/fs/live/websocket/auth/AuthHandler.java

@@ -53,12 +53,12 @@ public class AuthHandler extends ChannelInboundHandlerAdapter {
 
             // 验证 token
             if (parameterMap.containsKey(tokenKey)) {
-            String token = parameterMap.get(tokenKey).get(0);
-            Claims claims = jwtUtils.getClaimByToken(token);
-            if (claims == null || jwtUtils.isTokenExpired(claims.getExpiration())) {
-                ctx.channel().writeAndFlush(new TextWebSocketFrame("Error: invalid parameters")).addListener(ChannelFutureListener.CLOSE);
-                return;
-            }
+                String token = parameterMap.get(tokenKey).get(0);
+                Claims claims = jwtUtils.getClaimByToken(token);
+                if (claims == null || jwtUtils.isTokenExpired(claims.getExpiration())) {
+                    ctx.channel().writeAndFlush(new TextWebSocketFrame("Error: invalid parameters")).addListener(ChannelFutureListener.CLOSE);
+                    return;
+                }
                 // 将 userType 设置为 0(或根据实际业务逻辑设置)
                 ctx.channel().attr(AttrConstant.ATTR_USER_TYPE).set(0L);
             }

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

@@ -71,7 +71,7 @@ public class WebSocketServer {
     private final static long HEARTBEAT_TIMEOUT = 2 * 60 * 1000;
     // admin房间消息发送线程池(单线程,保证串行化)
     private final static ConcurrentHashMap<Long, ExecutorService> adminExecutors = new ConcurrentHashMap<>();
-    
+
     // 消息队列系统
     // 每个直播间的消息队列,使用优先级队列支持管理员消息插队
     private final static ConcurrentHashMap<Long, PriorityBlockingQueue<QueueMessage>> messageQueues = new ConcurrentHashMap<>();
@@ -309,12 +309,12 @@ public class WebSocketServer {
         sessionLocks.putIfAbsent(session.getId(), new ReentrantLock());
         // 初始化心跳时间
         heartbeatCache.put(session.getId(), System.currentTimeMillis());
-        
+
         // 如果有session,启动消费者线程
         ConcurrentHashMap<Long, Session> tempRoom = getRoom(liveId);
         List<Session> tempAdminRoom = getAdminRoom(liveId);
         boolean hasSession = (tempRoom != null && !tempRoom.isEmpty()) ||
-                            (tempAdminRoom != null && !tempAdminRoom.isEmpty());
+                (tempAdminRoom != null && !tempAdminRoom.isEmpty());
         if (hasSession) {
             startConsumerThread(liveId);
         }
@@ -400,7 +400,7 @@ public class WebSocketServer {
         // 清理Session相关资源
         heartbeatCache.remove(session.getId());
         sessionLocks.remove(session.getId());
-        
+
         // 检查并清理空的直播间资源
         cleanupEmptyRoom(liveId);
     }
@@ -1320,7 +1320,7 @@ public class WebSocketServer {
                 // 检查是否达到关键观看时长节点,在这些节点实时更新
                 // 关键节点:3分钟(180秒)、20分钟(1200秒)、30分钟(1800秒)
                 boolean isKeyDuration = (watchDuration == 180 || watchDuration == 1200 || watchDuration == 1800) ||
-                                       (watchDuration > 180 && watchDuration % 60 == 0); // 每分钟更新一次
+                        (watchDuration > 180 && watchDuration % 60 == 0); // 每分钟更新一次
 
                 // 使用 Redis 缓存控制更新频率,避免频繁更新数据库
                 // 策略:在关键节点立即更新,其他时候每60秒更新一次
@@ -1377,7 +1377,7 @@ public class WebSocketServer {
      * @param onlineSeconds 在线时长(秒)
      */
     private void updateLiveWatchLogTypeByDuration(Long liveId, Long userId, Long companyId,
-                                                   Long companyUserId, Long onlineSeconds) {
+                                                  Long companyUserId, Long onlineSeconds) {
         try {
             // 获取直播视频总时长(videoType = 1 的视频,使用带缓存的查询方法)
             List<LiveVideo> videos = liveVideoService.listByLiveIdWithCache(liveId, 1);
@@ -1450,7 +1450,7 @@ public class WebSocketServer {
 
             // 2. 查询是否有新的未领取完课记录
             List<LiveCompletionPointsRecord> unreceivedRecords =
-                completionPointsRecordService.getUserUnreceivedRecords(liveId, userId);
+                    completionPointsRecordService.getUserUnreceivedRecords(liveId, userId);
 
             if (unreceivedRecords == null || unreceivedRecords.isEmpty()) {
                 // 没有待领取的完课记录
@@ -1621,7 +1621,7 @@ public class WebSocketServer {
     private void startConsumerThread(Long liveId) {
         consumerRunningFlags.computeIfAbsent(liveId, k -> new AtomicBoolean(false));
         AtomicBoolean runningFlag = consumerRunningFlags.get(liveId);
-        
+
         // 如果线程已经在运行,直接返回
         if (runningFlag.get()) {
             return;
@@ -1633,16 +1633,16 @@ public class WebSocketServer {
                 Thread consumerThread = new Thread(() -> {
                     PriorityBlockingQueue<QueueMessage> queue = getMessageQueue(liveId);
                     log.info("[消息队列] 启动消费者线程, liveId={}", liveId);
-                    
+
                     while (runningFlag.get()) {
                         try {
                             // 检查是否还有session,如果没有则退出
                             ConcurrentHashMap<Long, Session> room = rooms.get(liveId);
                             List<Session> adminRoom = adminRooms.get(liveId);
-                            
-                            boolean hasSession = (room != null && !room.isEmpty()) || 
-                                                (adminRoom != null && !adminRoom.isEmpty());
-                            
+
+                            boolean hasSession = (room != null && !room.isEmpty()) ||
+                                    (adminRoom != null && !adminRoom.isEmpty());
+
                             if (!hasSession) {
                                 log.info("[消息队列] 直播间无session,停止消费者线程, liveId={}", liveId);
                                 break;
@@ -1667,13 +1667,13 @@ public class WebSocketServer {
                             log.error("[消息队列] 消费消息异常, liveId={}", liveId, e);
                         }
                     }
-                    
+
                     // 清理资源
                     runningFlag.set(false);
                     consumerThreads.remove(liveId);
                     log.info("[消息队列] 消费者线程已停止, liveId={}", liveId);
                 }, "MessageConsumer-" + liveId);
-                
+
                 consumerThread.setDaemon(true);
                 consumerThread.start();
                 consumerThreads.put(liveId, consumerThread);
@@ -1705,22 +1705,22 @@ public class WebSocketServer {
     private boolean enqueueMessage(Long liveId, String message, boolean isAdmin) {
         PriorityBlockingQueue<QueueMessage> queue = getMessageQueue(liveId);
         AtomicLong currentSize = queueSizes.computeIfAbsent(liveId, k -> new AtomicLong(0));
-        
+
         // 计算新消息的大小
         long messageSize = message != null ? message.getBytes(StandardCharsets.UTF_8).length : 0;
-        
+
         // 检查队列条数限制
         if (!isAdmin && queue.size() >= MAX_QUEUE_SIZE) {
             log.warn("[消息队列] 队列条数已满,丢弃消息, liveId={}, queueSize={}", liveId, queue.size());
             return false;
         }
-        
+
         // 检查队列大小限制(200MB)
         long newTotalSize = currentSize.get() + messageSize;
         if (newTotalSize > MAX_QUEUE_SIZE_BYTES) {
             if (!isAdmin) {
                 // 普通消息超过大小限制,直接丢弃
-                log.warn("[消息队列] 队列大小超过限制,丢弃普通消息, liveId={}, currentSize={}MB, messageSize={}KB", 
+                log.warn("[消息队列] 队列大小超过限制,丢弃普通消息, liveId={}, currentSize={}MB, messageSize={}KB",
                         liveId, currentSize.get() / (1024.0 * 1024.0), messageSize / 1024.0);
                 return false;
             } else {
@@ -1728,13 +1728,13 @@ public class WebSocketServer {
                 long needToFree = newTotalSize - MAX_QUEUE_SIZE_BYTES;
                 long freedSize = removeMessagesToFreeSpace(queue, currentSize, needToFree, true);
                 if (freedSize < needToFree) {
-                    log.warn("[消息队列] 无法释放足够空间,管理员消息可能无法入队, liveId={}, needToFree={}KB, freed={}KB", 
+                    log.warn("[消息队列] 无法释放足够空间,管理员消息可能无法入队, liveId={}, needToFree={}KB, freed={}KB",
                             liveId, needToFree / 1024.0, freedSize / 1024.0);
                     // 即使空间不足,也尝试入队(可能会超过限制,但管理员消息优先级高)
                 }
             }
         }
-        
+
         // 如果是管理员消息且队列条数已满,移除一个普通消息
         if (isAdmin && queue.size() >= MAX_QUEUE_SIZE) {
             // 由于是优先级队列,普通消息(priority=0)会在队列末尾
@@ -1758,21 +1758,21 @@ public class WebSocketServer {
                 log.warn("[消息队列] 队列条数已满且无普通消息可移除, liveId={}", liveId);
             }
         }
-        
+
         QueueMessage queueMessage = new QueueMessage(message, isAdmin);
         queue.offer(queueMessage);
         currentSize.addAndGet(messageSize);
-        
+
         // 如果有session,确保消费者线程在运行
         ConcurrentHashMap<Long, Session> room = rooms.get(liveId);
         List<Session> adminRoom = adminRooms.get(liveId);
-        boolean hasSession = (room != null && !room.isEmpty()) || 
-                            (adminRoom != null && !adminRoom.isEmpty());
-        
+        boolean hasSession = (room != null && !room.isEmpty()) ||
+                (adminRoom != null && !adminRoom.isEmpty());
+
         if (hasSession) {
             startConsumerThread(liveId);
         }
-        
+
         return true;
     }
 
@@ -1784,13 +1784,13 @@ public class WebSocketServer {
      * @param onlyRemoveNormal 是否只移除普通消息(true=只移除普通消息,false=可以移除任何消息)
      * @return 实际释放的空间(字节数)
      */
-    private long removeMessagesToFreeSpace(PriorityBlockingQueue<QueueMessage> queue, 
-                                          AtomicLong currentSize, 
-                                          long needToFree, 
-                                          boolean onlyRemoveNormal) {
+    private long removeMessagesToFreeSpace(PriorityBlockingQueue<QueueMessage> queue,
+                                           AtomicLong currentSize,
+                                           long needToFree,
+                                           boolean onlyRemoveNormal) {
         long freedSize = 0;
         List<QueueMessage> toRemove = new ArrayList<>();
-        
+
         // 收集需要移除的消息(优先移除普通消息)
         Iterator<QueueMessage> iterator = queue.iterator();
         while (iterator.hasNext() && freedSize < needToFree) {
@@ -1800,7 +1800,7 @@ public class WebSocketServer {
                 freedSize += msg.getSizeBytes();
             }
         }
-        
+
         // 如果只移除普通消息但空间还不够,可以移除管理员消息
         if (onlyRemoveNormal && freedSize < needToFree) {
             iterator = queue.iterator();
@@ -1812,19 +1812,19 @@ public class WebSocketServer {
                 }
             }
         }
-        
+
         // 移除消息并更新大小
         for (QueueMessage msg : toRemove) {
             if (queue.remove(msg)) {
                 currentSize.addAndGet(-msg.getSizeBytes());
             }
         }
-        
+
         if (freedSize > 0) {
-            log.info("[消息队列] 释放队列空间, removedCount={}, freedSize={}KB", 
+            log.info("[消息队列] 释放队列空间, removedCount={}, freedSize={}KB",
                     toRemove.size(), freedSize / 1024.0);
         }
-        
+
         return freedSize;
     }
 
@@ -1841,10 +1841,10 @@ public class WebSocketServer {
     private void cleanupEmptyRoom(Long liveId) {
         ConcurrentHashMap<Long, Session> room = rooms.get(liveId);
         List<Session> adminRoom = adminRooms.get(liveId);
-        
-        boolean hasSession = (room != null && !room.isEmpty()) || 
-                            (adminRoom != null && !adminRoom.isEmpty());
-        
+
+        boolean hasSession = (room != null && !room.isEmpty()) ||
+                (adminRoom != null && !adminRoom.isEmpty());
+
         if (!hasSession) {
             // 停止消费者线程
             stopConsumerThread(liveId);

+ 0 - 57
fs-live-app/src/main/resources/application-druid.yml

@@ -1,57 +0,0 @@
-# 数据源配置
-spring:
-    datasource:
-        type: com.alibaba.druid.pool.DruidDataSource
-        driverClassName: com.mysql.cj.jdbc.Driver
-        druid:
-            # 主库数据源
-            master:
-                url: jdbc:mysql://localhost:3306/fs-his?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
-                username: root
-                password: 19860213
-            # 从库数据源
-            slave:
-                # 从数据源开关/默认关闭
-                enabled: false
-                url:
-                username:
-                password:
-            # 初始连接数
-            initialSize: 5
-            # 最小连接池数量
-            minIdle: 10
-            # 最大连接池数量
-            maxActive: 20
-            # 配置获取连接等待超时的时间
-            maxWait: 60000
-            # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
-            timeBetweenEvictionRunsMillis: 60000
-            # 配置一个连接在池中最小生存的时间,单位是毫秒
-            minEvictableIdleTimeMillis: 300000
-            # 配置一个连接在池中最大生存的时间,单位是毫秒
-            maxEvictableIdleTimeMillis: 900000
-            # 配置检测连接是否有效
-            validationQuery: SELECT 1 FROM DUAL
-            testWhileIdle: true
-            testOnBorrow: false
-            testOnReturn: false
-            webStatFilter:
-                enabled: true
-            statViewServlet:
-                enabled: true
-                # 设置白名单,不填则允许所有访问
-                allow:
-                url-pattern: /druid/*
-                # 控制台管理用户名和密码
-                login-username: fs
-                login-password: 123456
-            filter:
-                stat:
-                    enabled: true
-                    # 慢SQL记录
-                    log-slow-sql: true
-                    slow-sql-millis: 1000
-                    merge-sql: true
-                wall:
-                    config:
-                        multi-statement-allow: true

+ 0 - 2
fs-service/src/main/java/com/fs/his/domain/FsUser.java

@@ -194,8 +194,6 @@ public class FsUser extends BaseEntity
 
     private String appOpenId;
 
-    private String appleKey; // 苹果key登陆验证
-
     public void setNickName(String nickname)
     {
         if(StringUtils.isNotEmpty(nickname)){