yangys
2024-05-18 c9b04383c77f91ac309e37e70783edcf8a9298b5
websocket代码整理
已修改4个文件
15 ■■■■■ 文件已修改
smart-man-boot/src/main/java/com/qianwen/smartman/common/websocket/realtime/RealTimeDataJsonMessageHandler.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/common/websocket/realtime/RealTimeDataJsonSubscriptionFilter.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-starter-websocket/src/main/java/com/qianwen/core/websocket/holder/JsonMessageHandlerHolder.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-starter-websocket/src/main/java/com/qianwen/core/websocket/message/AbstractJsonWebSocketMessage.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smart-man-boot/src/main/java/com/qianwen/smartman/common/websocket/realtime/RealTimeDataJsonMessageHandler.java
@@ -24,11 +24,7 @@
    public void handle(WebSocketSession session, RealTimeDataRequestJsonWebSocketMessage message) {
        List<String> workstationIdList = message.getWorkstationIdList();
        List<OrderWorkstation> workstationInProcess = this.orderWorkstationService.getWorkstationInProcess(workstationIdList.stream().map(Long::valueOf).collect(Collectors.toSet()));
        Map<Long, String> orderWorkstationMap = (Map) workstationInProcess.stream().collect(Collectors.toMap((v0) -> {
            return v0.getWorkstationId();
        }, (v0) -> {
            return v0.getOrderCode();
        }));
        Map<Long, String> orderWorkstationMap = workstationInProcess.stream().collect(Collectors.toMap(OrderWorkstation::getWorkstationId, OrderWorkstation::getOrderCode));
        if (Func.isNotEmpty(workstationIdList)) {
            for (String workstationId : workstationIdList) {
                RealTimeDaraResponseJsonWebSocketMessage jsonWebSocketMessage = new RealTimeDaraResponseJsonWebSocketMessage();
smart-man-boot/src/main/java/com/qianwen/smartman/common/websocket/realtime/RealTimeDataJsonSubscriptionFilter.java
@@ -11,7 +11,7 @@
@Component
public class RealTimeDataJsonSubscriptionFilter implements SubscriptionSessionFilter<RealTimeDataRequestJsonWebSocketMessage> {
    private static Map<String, RealTimeDataRequestJsonWebSocketMessage> map = new HashMap();
    private static Map<String, RealTimeDataRequestJsonWebSocketMessage> map = new HashMap<>();
    public String type() {
        return "realTimeData";
@@ -23,7 +23,7 @@
    public List<String> onResponse(String messageText) {
        RealTimeDaraResponseJsonWebSocketMessage responseMessage = (RealTimeDaraResponseJsonWebSocketMessage) JSONObject.parseObject(messageText, RealTimeDaraResponseJsonWebSocketMessage.class);
        return (List) map.keySet().stream().filter(key -> {
        return map.keySet().stream().filter(key -> {
            return map.get(key).getWorkstationIdList() == null || map.get(key).getWorkstationIdList().isEmpty() || (map.get(key).getWorkstationIdList().contains(responseMessage.getId()) && responseMessage.getType().equals(map.get(key).getType()));
        }).collect(Collectors.toList());
    }
smart-starter-websocket/src/main/java/com/qianwen/core/websocket/holder/JsonMessageHandlerHolder.java
@@ -5,7 +5,7 @@
import com.qianwen.core.websocket.handler.JsonMessageHandler;
public final class JsonMessageHandlerHolder {
    private static final Map<String, JsonMessageHandler> MESSAGE_HANDLER_MAP = new ConcurrentHashMap();
    private static final Map<String, JsonMessageHandler> MESSAGE_HANDLER_MAP = new ConcurrentHashMap<>();
    private JsonMessageHandlerHolder() {
    }
smart-starter-websocket/src/main/java/com/qianwen/core/websocket/message/AbstractJsonWebSocketMessage.java
@@ -3,8 +3,7 @@
public abstract class AbstractJsonWebSocketMessage implements JsonWebSocketMessage {
    private final String type;
    /* JADX INFO: Access modifiers changed from: protected */
    public AbstractJsonWebSocketMessage(String type) {
    protected AbstractJsonWebSocketMessage(String type) {
        this.type = type;
    }