| | |
| | | package com.mes.energy.service.impl; |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.energy.entity.EnergyConsumption; |
| | | import com.mes.energy.mapper.EnergyConsumptionMapper; |
| | | import com.mes.energy.service.EnergyConsumptionService; |
| | | import com.mes.tools.WebSocketServer; |
| | | import cn.hutool.json.JSONObject; |
| | | import com.mes.websocket.WebSocketServer; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class EnergyConsumptionServiceImpl extends ServiceImpl<EnergyConsumptionMapper, EnergyConsumption> implements EnergyConsumptionService { |
| | |
| | | message.set("type", "energy_update"); |
| | | message.set("data", consumption); |
| | | |
| | | ArrayList<WebSocketServer> servers = WebSocketServer.sessionMap.get("energy"); |
| | | List<WebSocketServer> servers = WebSocketServer.SESSIONMAP.get("energy"); |
| | | if (servers != null) { |
| | | for (WebSocketServer server : servers) { |
| | | server.sendMessage(message.toString()); |
| | | server.sendToWeb("",message.toString()); |
| | | } |
| | | } |
| | | } |