Переглянути джерело

从判断计算机名修改为判断系统名称。

lighter 4 роки тому
батько
коміт
5132c72c74

+ 24 - 0
HELP.md

@@ -0,0 +1,24 @@
+# Getting Started
+
+### Reference Documentation
+
+For further reference, please consider the following sections:
+
+* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
+* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.4.1/maven-plugin/reference/html/)
+* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.4.1/maven-plugin/reference/html/#build-image)
+* [Spring Web](https://docs.spring.io/spring-boot/docs/2.4.1/reference/htmlsingle/#boot-features-developing-web-applications)
+* [Spring for RabbitMQ](https://docs.spring.io/spring-boot/docs/2.4.1/reference/htmlsingle/#boot-features-amqp)
+* [WebSocket](https://docs.spring.io/spring-boot/docs/2.4.1/reference/htmlsingle/#boot-features-websockets)
+* [Spring Boot DevTools](https://docs.spring.io/spring-boot/docs/2.4.1/reference/htmlsingle/#using-boot-devtools)
+
+### Guides
+
+The following guides illustrate how to use some features concretely:
+
+* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)
+* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)
+* [Building REST services with Spring](https://spring.io/guides/tutorials/bookmarks/)
+* [Messaging with RabbitMQ](https://spring.io/guides/gs/messaging-rabbitmq/)
+* [Using WebSocket to build an interactive web application](https://spring.io/guides/gs/messaging-stomp-websocket/)
+

+ 4 - 8
src/main/java/thyyxxk/webserver/scheduled/FetchAccessTokenTask.java

@@ -2,6 +2,7 @@ package thyyxxk.webserver.scheduled;
 
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.logging.log4j.util.PropertiesUtil;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 import org.springframework.web.client.RestTemplate;
@@ -25,14 +26,9 @@ public class FetchAccessTokenTask {
 
     @Scheduled(fixedRate = 6900 * 1000)
     public void getAccessToken() {
-        try {
-            InetAddress addr = InetAddress.getLocalHost();
-            String address=addr.getHostName();
-            if ("THYYXXK-DJ".equals(address)) {
-                return;
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
+        String osName = PropertiesUtil.getSystemProperties().getProperty("os.name");
+        if ("Windows 10".equals(osName)) {
+            return;
         }
         RestTemplate restTemplate = new RestTemplate();
         String httpRes = restTemplate.getForObject(USERINFO_ACCESS_TOKEN_URL, String.class);

+ 4 - 8
src/main/java/thyyxxk/webserver/scheduled/FetchClockinDataTask.java

@@ -3,6 +3,7 @@ package thyyxxk.webserver.scheduled;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.logging.log4j.util.PropertiesUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
@@ -33,14 +34,9 @@ public class FetchClockinDataTask {
 
     @Scheduled(cron = "0 0 8 ? * *")
     public void queryClockInData() {
-        try {
-            InetAddress addr = InetAddress.getLocalHost();
-            String address=addr.getHostName();
-            if ("THYYXXK-DJ".equals(address)) {
-                return;
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
+        String osName = PropertiesUtil.getSystemProperties().getProperty("os.name");
+        if ("Windows 10".equals(osName)) {
+            return;
         }
         final String yesterday = getYesterdayDate();
         ClockinPojo param = new ClockinPojo();

+ 4 - 8
src/main/java/thyyxxk/webserver/scheduled/QueryNotifiedPatients.java

@@ -2,6 +2,7 @@ package thyyxxk.webserver.scheduled;
 
 import com.alibaba.fastjson.JSON;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.logging.log4j.util.PropertiesUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
@@ -29,14 +30,9 @@ public class QueryNotifiedPatients {
 
     @Scheduled(fixedRate = 6000)
     public void query() {
-        try {
-            InetAddress addr = InetAddress.getLocalHost();
-            String address=addr.getHostName();
-            if ("THYYXXK-DJ".equals(address)) {
-                return;
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
+        String osName = PropertiesUtil.getSystemProperties().getProperty("os.name");
+        if ("Windows 10".equals(osName)) {
+            return;
         }
         ConcurrentMap<Integer, String> map = PatientSidContainer.getInstance().getSidPatientsMap();
         if (map.isEmpty()) return;

+ 4 - 10
src/main/java/thyyxxk/webserver/scheduled/ResetPatientNum.java

@@ -1,12 +1,11 @@
 package thyyxxk.webserver.scheduled;
 
+import org.apache.logging.log4j.util.PropertiesUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 import thyyxxk.webserver.dao.his.triage.TriageDao;
 
-import java.net.InetAddress;
-
 @Component
 public class ResetPatientNum {
     private final TriageDao dao;
@@ -18,14 +17,9 @@ public class ResetPatientNum {
 
     @Scheduled(cron = "0 0 0 * * ?")
     public void resetPatientNum() {
-        try {
-            InetAddress addr = InetAddress.getLocalHost();
-            String address=addr.getHostName();
-            if ("THYYXXK-DJ".equals(address)) {
-                return;
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
+        String osName = PropertiesUtil.getSystemProperties().getProperty("os.name");
+        if ("Windows 10".equals(osName)) {
+            return;
         }
         dao.resetPatientNum();
     }