|
@@ -22,6 +22,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
@@ -240,7 +241,6 @@ public class ReceiveDataService {
|
|
|
}else {
|
|
|
log.info(electricField.getStationCode()+ "-" +equipmentType.getMessage() + "-" + equipmentId+"无数据,不进行任何操作");
|
|
|
}
|
|
|
-
|
|
|
} catch (Exception e) {
|
|
|
log.info(electricField.getName()+equipmentType.getMessage()+"接数程序异常");
|
|
|
e.printStackTrace();
|
|
@@ -269,6 +269,10 @@ public class ReceiveDataService {
|
|
|
body = EntityUtils.toString(responseEntity, StandardCharsets.UTF_8);
|
|
|
}catch (RuntimeException | IOException e){
|
|
|
e.printStackTrace();
|
|
|
+ log.info("请求异常");
|
|
|
+ log.info("所用线程"+Thread.currentThread().getName());
|
|
|
+ log.info("停止请求数据");
|
|
|
+ Thread.currentThread().stop();
|
|
|
}
|
|
|
return body;
|
|
|
}
|
|
@@ -309,4 +313,18 @@ public class ReceiveDataService {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
+ public void stop(){
|
|
|
+ Thread thread = new Thread(() -> {
|
|
|
+ while (Thread.currentThread().isInterrupted()) {
|
|
|
+ log.info("停止请求数据");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ thread.start();
|
|
|
+ try {
|
|
|
+ Thread.sleep(1);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ thread.interrupt();
|
|
|
+ }
|
|
|
}
|