websocket优化
This commit is contained in:
		@ -8,12 +8,9 @@ import org.springframework.context.annotation.Configuration;
 | 
				
			|||||||
import org.springframework.context.annotation.Lazy;
 | 
					import org.springframework.context.annotation.Lazy;
 | 
				
			||||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
 | 
					import org.springframework.data.redis.connection.RedisConnectionFactory;
 | 
				
			||||||
import org.springframework.data.redis.core.StringRedisTemplate;
 | 
					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.RedisMessageListenerContainer;
 | 
				
			||||||
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
 | 
					import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@Configuration
 | 
					@Configuration
 | 
				
			||||||
public class RedisConfig {
 | 
					public class RedisConfig {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
				
			|||||||
import jakarta.annotation.Resource;
 | 
					import jakarta.annotation.Resource;
 | 
				
			||||||
import lombok.extern.slf4j.Slf4j;
 | 
					import lombok.extern.slf4j.Slf4j;
 | 
				
			||||||
import org.dromara.bigscreen.service.IAsyncMessageHandlerService;
 | 
					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.dto.WebSocketMessageDto;
 | 
				
			||||||
import org.dromara.common.websocket.holder.WebSocketSessionHolder;
 | 
					import org.dromara.common.websocket.holder.WebSocketSessionHolder;
 | 
				
			||||||
import org.dromara.common.websocket.utils.WebSocketUtils;
 | 
					import org.dromara.common.websocket.utils.WebSocketUtils;
 | 
				
			||||||
 | 
				
			|||||||
@ -5,10 +5,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
				
			|||||||
import jakarta.annotation.PostConstruct;
 | 
					import jakarta.annotation.PostConstruct;
 | 
				
			||||||
import jakarta.annotation.Resource;
 | 
					import jakarta.annotation.Resource;
 | 
				
			||||||
import lombok.extern.slf4j.Slf4j;
 | 
					import lombok.extern.slf4j.Slf4j;
 | 
				
			||||||
import org.dromara.bigscreen.service.impl.InitOnStartWebSocketServer;
 | 
					
 | 
				
			||||||
import org.dromara.common.redis.utils.RedisUtils;
 | 
					import org.dromara.common.redis.utils.RedisUtils;
 | 
				
			||||||
import org.dromara.drone.domain.DroProjectDrone;
 | 
					import org.dromara.drone.domain.DroProjectDrone;
 | 
				
			||||||
import org.dromara.drone.service.IDroProjectDroneService;
 | 
					import org.dromara.drone.service.IDroProjectDroneService;
 | 
				
			||||||
 | 
					import org.dromara.websocket.websocket.service.InitOnStartWebSocketServer;
 | 
				
			||||||
import org.springframework.context.annotation.Lazy;
 | 
					import org.springframework.context.annotation.Lazy;
 | 
				
			||||||
import org.springframework.data.redis.listener.PatternTopic;
 | 
					import org.springframework.data.redis.listener.PatternTopic;
 | 
				
			||||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
 | 
					import org.springframework.data.redis.listener.RedisMessageListenerContainer;
 | 
				
			||||||
@ -132,8 +133,8 @@ public class RedisSubscribeManager {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//    @Scheduled(cron = "0/10 * * * * ?")
 | 
					    @Scheduled(cron = "0/10 * * * * ?")
 | 
				
			||||||
    @JobExecutor(name = "ueWsConnect")
 | 
					//    @JobExecutor(name = "ueWsConnect")
 | 
				
			||||||
    public void ueWsConnect() {
 | 
					    public void ueWsConnect() {
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            int onlineCount = InitOnStartWebSocketServer.getOnlineCount();
 | 
					            int onlineCount = InitOnStartWebSocketServer.getOnlineCount();
 | 
				
			||||||
 | 
				
			|||||||
@ -11,6 +11,7 @@ import org.dromara.common.websocket.holder.WebSocketSessionHolder;
 | 
				
			|||||||
import org.dromara.common.websocket.utils.WebSocketUtils;
 | 
					import org.dromara.common.websocket.utils.WebSocketUtils;
 | 
				
			||||||
import org.dromara.drone.domain.DroProjectDrone;
 | 
					import org.dromara.drone.domain.DroProjectDrone;
 | 
				
			||||||
import org.dromara.drone.mapper.DroProjectDroneMapper;
 | 
					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.connection.Message;
 | 
				
			||||||
import org.springframework.data.redis.core.StringRedisTemplate;
 | 
					import org.springframework.data.redis.core.StringRedisTemplate;
 | 
				
			||||||
import org.springframework.scheduling.annotation.Async;
 | 
					import org.springframework.scheduling.annotation.Async;
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@ import cn.hutool.json.JSONUtil;
 | 
				
			|||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 | 
					import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 | 
				
			||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
					import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
				
			||||||
import lombok.extern.slf4j.Slf4j;
 | 
					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.exception.ServiceException;
 | 
				
			||||||
import org.dromara.common.core.utils.MapstructUtils;
 | 
					import org.dromara.common.core.utils.MapstructUtils;
 | 
				
			||||||
import org.dromara.common.core.utils.StringUtils;
 | 
					import org.dromara.common.core.utils.StringUtils;
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,7 @@
 | 
				
			|||||||
package org.dromara.mobileAttendanceMachine;
 | 
					package org.dromara.mobileAttendanceMachine;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import lombok.extern.log4j.Log4j2;
 | 
					import lombok.extern.log4j.Log4j2;
 | 
				
			||||||
 | 
					import org.dromara.websocket.websocket.service.DeviceWebSocketServer;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 | 
				
			|||||||
@ -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();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -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.Bean;
 | 
				
			||||||
import org.springframework.context.annotation.Configuration;
 | 
					import org.springframework.context.annotation.Configuration;
 | 
				
			||||||
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
 | 
					import org.springframework.web.socket.server.standard.ServerEndpointExporter;
 | 
				
			||||||
@ -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.DeserializationFeature;
 | 
				
			||||||
import com.fasterxml.jackson.databind.ObjectMapper;
 | 
					import com.fasterxml.jackson.databind.ObjectMapper;
 | 
				
			||||||
@ -7,6 +7,7 @@ import jakarta.websocket.server.ServerEndpoint;
 | 
				
			|||||||
import lombok.extern.log4j.Log4j2;
 | 
					import lombok.extern.log4j.Log4j2;
 | 
				
			||||||
import org.dromara.common.core.exception.ServiceException;
 | 
					import org.dromara.common.core.exception.ServiceException;
 | 
				
			||||||
import org.dromara.common.core.utils.SpringUtils;
 | 
					import org.dromara.common.core.utils.SpringUtils;
 | 
				
			||||||
 | 
					import org.dromara.mobileAttendanceMachine.KqjEntity;
 | 
				
			||||||
import org.dromara.project.service.IBusAttendanceMachineService;
 | 
					import org.dromara.project.service.IBusAttendanceMachineService;
 | 
				
			||||||
import org.springframework.stereotype.Component;
 | 
					import org.springframework.stereotype.Component;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1,23 +1,11 @@
 | 
				
			|||||||
package org.dromara.bigscreen.service.impl;// 路径:com.ruoyi.web.websocket.InitOnStartWebSocketServer
 | 
					package org.dromara.websocket.websocket.service;// 路径:com.ruoyi.web.websocket.InitOnStartWebSocketServer
 | 
				
			||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
					 | 
				
			||||||
import jakarta.annotation.Resource;
 | 
					 | 
				
			||||||
import jakarta.websocket.*;
 | 
					import jakarta.websocket.*;
 | 
				
			||||||
import jakarta.websocket.server.ServerEndpoint;
 | 
					import jakarta.websocket.server.ServerEndpoint;
 | 
				
			||||||
import lombok.extern.slf4j.Slf4j;
 | 
					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 org.springframework.stereotype.Component;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
import java.util.HashSet;
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
import java.util.Map;
 | 
					import java.util.Map;
 | 
				
			||||||
import java.util.Set;
 | 
					 | 
				
			||||||
import java.util.concurrent.ConcurrentHashMap;
 | 
					import java.util.concurrent.ConcurrentHashMap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@ -41,7 +41,7 @@ public class XzdCsContractChangeBo extends BaseEntity {
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 单据编码
 | 
					     * 单据编码
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @NotBlank(message = "单据编码不能为空", groups = { AddGroup.class, EditGroup.class })
 | 
					    @NotBlank(message = "单据编码不能为空", groups = { EditGroup.class })
 | 
				
			||||||
    private String docCode;
 | 
					    private String docCode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
@ -40,7 +40,7 @@ public class XzdCsContractSuspendBo extends BaseEntity {
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 单据编码
 | 
					     * 单据编码
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @NotBlank(message = "单据编码不能为空", groups = { AddGroup.class, EditGroup.class })
 | 
					    @NotBlank(message = "单据编码不能为空", groups = { EditGroup.class })
 | 
				
			||||||
    private String receiptsCode;
 | 
					    private String receiptsCode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
@ -107,7 +107,7 @@ public class XzdCsContractChangeVo implements Serializable {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    @ExcelProperty(value = "组织")
 | 
					    @ExcelProperty(value = "组织")
 | 
				
			||||||
    private Long organization;
 | 
					    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;
 | 
					    private String organizationName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
@ -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.conditions.query.LambdaQueryWrapper;
 | 
				
			||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 | 
					import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 | 
				
			||||||
import lombok.RequiredArgsConstructor;
 | 
					import lombok.RequiredArgsConstructor;
 | 
				
			||||||
 | 
					import org.dromara.common.utils.BatchNumberGenerator;
 | 
				
			||||||
import org.dromara.system.domain.vo.SysDeptVo;
 | 
					import org.dromara.system.domain.vo.SysDeptVo;
 | 
				
			||||||
import org.dromara.system.service.ISysDeptService;
 | 
					import org.dromara.system.service.ISysDeptService;
 | 
				
			||||||
import org.dromara.system.service.ISysUserService;
 | 
					import org.dromara.system.service.ISysUserService;
 | 
				
			||||||
@ -167,6 +168,8 @@ public class XzdCsContractChangeServiceImpl extends ServiceImpl<XzdCsContractCha
 | 
				
			|||||||
    @Transactional(rollbackFor = Exception.class)
 | 
					    @Transactional(rollbackFor = Exception.class)
 | 
				
			||||||
    public Boolean insertByBo(XzdCsContractChangeBo bo) {
 | 
					    public Boolean insertByBo(XzdCsContractChangeBo bo) {
 | 
				
			||||||
        XzdCsContractChange add = MapstructUtils.convert(bo, XzdCsContractChange.class);
 | 
					        XzdCsContractChange add = MapstructUtils.convert(bo, XzdCsContractChange.class);
 | 
				
			||||||
 | 
					        String banBen = BatchNumberGenerator.generateBatchNumber("ZHFWHTBG-");
 | 
				
			||||||
 | 
					        add.setDocCode(banBen);
 | 
				
			||||||
        validEntityBeforeSave(add);
 | 
					        validEntityBeforeSave(add);
 | 
				
			||||||
        boolean flag = baseMapper.insert(add) > 0;
 | 
					        boolean flag = baseMapper.insert(add) > 0;
 | 
				
			||||||
        if (flag) {
 | 
					        if (flag) {
 | 
				
			||||||
 | 
				
			|||||||
@ -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.conditions.query.LambdaQueryWrapper;
 | 
				
			||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 | 
					import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 | 
				
			||||||
import lombok.RequiredArgsConstructor;
 | 
					import lombok.RequiredArgsConstructor;
 | 
				
			||||||
 | 
					import org.dromara.common.utils.BatchNumberGenerator;
 | 
				
			||||||
import org.dromara.system.domain.vo.SysDeptVo;
 | 
					import org.dromara.system.domain.vo.SysDeptVo;
 | 
				
			||||||
import org.dromara.system.service.impl.SysDeptServiceImpl;
 | 
					import org.dromara.system.service.impl.SysDeptServiceImpl;
 | 
				
			||||||
import org.dromara.system.service.impl.SysOssServiceImpl;
 | 
					import org.dromara.system.service.impl.SysOssServiceImpl;
 | 
				
			||||||
@ -122,6 +123,8 @@ public class XzdCsContractSuspendServiceImpl extends ServiceImpl<XzdCsContractSu
 | 
				
			|||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public Boolean insertByBo(XzdCsContractSuspendBo bo) {
 | 
					    public Boolean insertByBo(XzdCsContractSuspendBo bo) {
 | 
				
			||||||
        XzdCsContractSuspend add = MapstructUtils.convert(bo, XzdCsContractSuspend.class);
 | 
					        XzdCsContractSuspend add = MapstructUtils.convert(bo, XzdCsContractSuspend.class);
 | 
				
			||||||
 | 
					        String banBen = BatchNumberGenerator.generateBatchNumber("ZHFWHTZZ-");
 | 
				
			||||||
 | 
					        add.setReceiptsCode(banBen);
 | 
				
			||||||
        validEntityBeforeSave(add);
 | 
					        validEntityBeforeSave(add);
 | 
				
			||||||
        boolean flag = baseMapper.insert(add) > 0;
 | 
					        boolean flag = baseMapper.insert(add) > 0;
 | 
				
			||||||
        if (flag) {
 | 
					        if (flag) {
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user