You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.0 KiB
Java
38 lines
1.0 KiB
Java
1 year ago
|
package com.glxp.api.service.inout;
|
||
|
|
||
|
import com.glxp.api.constant.SocketMsgType;
|
||
|
import com.glxp.api.controller.sync.SpsSyncWebSocket;
|
||
|
import com.glxp.api.entity.sync.SocketMsgEntity;
|
||
|
import com.glxp.api.req.inout.FilterStatDataRequest;
|
||
|
import lombok.RequiredArgsConstructor;
|
||
|
import lombok.extern.slf4j.Slf4j;
|
||
|
import org.springframework.beans.factory.annotation.Value;
|
||
|
import org.springframework.stereotype.Service;
|
||
|
|
||
|
import javax.annotation.Resource;
|
||
|
|
||
|
/**
|
||
|
* @author : zhangsan
|
||
|
* @date : 2024/5/23 15:11
|
||
|
* @modyified By :
|
||
|
*/
|
||
|
@Slf4j
|
||
|
@Service
|
||
|
@RequiredArgsConstructor
|
||
|
public class IoStatDataService {
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
@Value("${WEBSOCKET_TOKEN}")
|
||
|
private String socketToken;
|
||
|
|
||
|
@Resource
|
||
|
SpsSyncWebSocket spsSyncWebSocket;
|
||
|
public void getData(FilterStatDataRequest statDataRequest) {
|
||
|
//推送
|
||
|
SocketMsgEntity socketMsgEntity = SocketMsgEntity.builder().content(statDataRequest).type(SocketMsgType.STAT_DATA).remark("我胡乱说的").build();
|
||
|
spsSyncWebSocket.sendMessage(socketMsgEntity, "1:" + socketToken);
|
||
|
}
|
||
|
}
|