websocket优化

This commit is contained in:
2025-11-03 11:45:08 +08:00
parent e9f5e0fa03
commit 373528b432
15 changed files with 20 additions and 41 deletions

View File

@ -8,12 +8,9 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.listener.PatternTopic;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
import java.util.List;
@Configuration
public class RedisConfig {

View File

@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.dromara.bigscreen.service.IAsyncMessageHandlerService;
import org.dromara.bigscreen.service.impl.InitOnStartWebSocketServer;
import org.dromara.common.websocket.dto.WebSocketMessageDto;
import org.dromara.common.websocket.holder.WebSocketSessionHolder;
import org.dromara.common.websocket.utils.WebSocketUtils;

View File

@ -5,10 +5,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.dromara.bigscreen.service.impl.InitOnStartWebSocketServer;
import org.dromara.common.redis.utils.RedisUtils;
import org.dromara.drone.domain.DroProjectDrone;
import org.dromara.drone.service.IDroProjectDroneService;
import org.dromara.websocket.websocket.service.InitOnStartWebSocketServer;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.redis.listener.PatternTopic;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
@ -132,8 +133,8 @@ public class RedisSubscribeManager {
}
// @Scheduled(cron = "0/10 * * * * ?")
@JobExecutor(name = "ueWsConnect")
@Scheduled(cron = "0/10 * * * * ?")
// @JobExecutor(name = "ueWsConnect")
public void ueWsConnect() {
try {
int onlineCount = InitOnStartWebSocketServer.getOnlineCount();

View File

@ -11,6 +11,7 @@ import org.dromara.common.websocket.holder.WebSocketSessionHolder;
import org.dromara.common.websocket.utils.WebSocketUtils;
import org.dromara.drone.domain.DroProjectDrone;
import org.dromara.drone.mapper.DroProjectDroneMapper;
import org.dromara.websocket.websocket.service.InitOnStartWebSocketServer;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.scheduling.annotation.Async;

View File

@ -6,7 +6,7 @@ import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.dromara.bigscreen.service.impl.InitOnStartWebSocketServer;
import org.dromara.websocket.websocket.service.InitOnStartWebSocketServer;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;

View File

@ -1,6 +1,7 @@
package org.dromara.mobileAttendanceMachine;
import lombok.extern.log4j.Log4j2;
import org.dromara.websocket.websocket.service.DeviceWebSocketServer;
import org.springframework.stereotype.Service;
/**

View File

@ -1,15 +0,0 @@
package org.dromara.mobileAttendanceMachine;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
//@Configuration
public class WebSocketConfig {
@Bean
public ServerEndpointExporter serverEndpointExporter() {
return new ServerEndpointExporter();
}
}

View File

@ -1,4 +1,4 @@
package org.dromara.bigscreen.config;// 路径com.ruoyi.framework.config.WebSocketConfig
package org.dromara.websocket.websocket.config;// 路径com.ruoyi.framework.config.WebSocketConfig
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

View File

@ -1,4 +1,4 @@
package org.dromara.mobileAttendanceMachine;
package org.dromara.websocket.websocket.service;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
@ -7,6 +7,7 @@ import jakarta.websocket.server.ServerEndpoint;
import lombok.extern.log4j.Log4j2;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.SpringUtils;
import org.dromara.mobileAttendanceMachine.KqjEntity;
import org.dromara.project.service.IBusAttendanceMachineService;
import org.springframework.stereotype.Component;

View File

@ -1,23 +1,11 @@
package org.dromara.bigscreen.service.impl;// 路径com.ruoyi.web.websocket.InitOnStartWebSocketServer
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import jakarta.annotation.Resource;
package org.dromara.websocket.websocket.service;// 路径com.ruoyi.web.websocket.InitOnStartWebSocketServer
import jakarta.websocket.*;
import jakarta.websocket.server.ServerEndpoint;
import lombok.extern.slf4j.Slf4j;
import org.dromara.bigscreen.manager.RedisSubscribeManager;
import org.dromara.common.redis.utils.RedisUtils;
import org.dromara.drone.domain.DroProjectDrone;
import org.dromara.drone.service.IDroProjectDroneService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
/**

View File

@ -41,7 +41,7 @@ public class XzdCsContractChangeBo extends BaseEntity {
/**
* 单据编码
*/
@NotBlank(message = "单据编码不能为空", groups = { AddGroup.class, EditGroup.class })
@NotBlank(message = "单据编码不能为空", groups = { EditGroup.class })
private String docCode;
/**

View File

@ -40,7 +40,7 @@ public class XzdCsContractSuspendBo extends BaseEntity {
/**
* 单据编码
*/
@NotBlank(message = "单据编码不能为空", groups = { AddGroup.class, EditGroup.class })
@NotBlank(message = "单据编码不能为空", groups = { EditGroup.class })
private String receiptsCode;
/**

View File

@ -107,7 +107,7 @@ public class XzdCsContractChangeVo implements Serializable {
*/
@ExcelProperty(value = "组织")
private Long organization;
@Translation(type = TransConstant.XZD_KHXX_ID_TO_NAME, mapper = "organization")
@Translation(type = TransConstant.DEPT_ID_TO_NAME, mapper = "organization")
private String organizationName;
/**

View File

@ -15,6 +15,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.dromara.common.utils.BatchNumberGenerator;
import org.dromara.system.domain.vo.SysDeptVo;
import org.dromara.system.service.ISysDeptService;
import org.dromara.system.service.ISysUserService;
@ -167,6 +168,8 @@ public class XzdCsContractChangeServiceImpl extends ServiceImpl<XzdCsContractCha
@Transactional(rollbackFor = Exception.class)
public Boolean insertByBo(XzdCsContractChangeBo bo) {
XzdCsContractChange add = MapstructUtils.convert(bo, XzdCsContractChange.class);
String banBen = BatchNumberGenerator.generateBatchNumber("ZHFWHTBG-");
add.setDocCode(banBen);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {

View File

@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.dromara.common.utils.BatchNumberGenerator;
import org.dromara.system.domain.vo.SysDeptVo;
import org.dromara.system.service.impl.SysDeptServiceImpl;
import org.dromara.system.service.impl.SysOssServiceImpl;
@ -122,6 +123,8 @@ public class XzdCsContractSuspendServiceImpl extends ServiceImpl<XzdCsContractSu
@Override
public Boolean insertByBo(XzdCsContractSuspendBo bo) {
XzdCsContractSuspend add = MapstructUtils.convert(bo, XzdCsContractSuspend.class);
String banBen = BatchNumberGenerator.generateBatchNumber("ZHFWHTZZ-");
add.setReceiptsCode(banBen);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {