| | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.ard.alarm.stealelec.domain.ArdAlarmStealelec; |
| | | import com.ard.utils.http.HttpUtils; |
| | | import com.ard.utils.mqtt.MqttConsumer; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | @Slf4j(topic = "stealAlarm") |
| | | @Service |
| | | public class StealElecAlarmService { |
| | | @Resource |
| | | RestTemplate restTemplate; |
| | | |
| | | @Value("${spring.stealelec.url}") |
| | | private String stealElecUrl; |
| | | @Value("${spring.stealelec.enabled}") |
| | |
| | | if (!enabled) { |
| | | return; |
| | | } |
| | | String allAlarmData = restTemplate.getForObject(stealElecUrl, String.class); |
| | | String allAlarmData = HttpUtils.sendGet(stealElecUrl); |
| | | //剔除所有\符号 |
| | | String message = allAlarmData.replaceAll("\\\\", ""); |
| | | //剔除整个字符串首尾双引号 |