Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

# Conflicts:
#	svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/label/PatientLableService.java
yeshijie 3 years ago
parent
commit
5c4695410d

+ 0 - 16
svr/svr-cloud-device/pom.xml

@ -25,23 +25,7 @@
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
        </dependency>
        <!-- 支持Tomcat启动 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>

+ 43 - 0
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/endpoint/HvDeviceController.java

@ -2,11 +2,16 @@ package com.yihu.jw.care.endpoint;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@ -25,6 +30,44 @@ public class HvDeviceController {
    private static Logger logger = LoggerFactory.getLogger(HvDeviceController.class);
    /**
     * 消息订阅
     *
     * 980001	资源信息变更通知	1
     980002	报警实时信息	2
     980003	报警处理信息	3
     980004	故障实时信息	4
     980005	故障处理信息	5
     980006	设备在离线消息	6
     980007	监控点在离线消息	7
     980008	监测实时信息	8
     */
    @ApiOperation("消息通知接收")
    @RequestMapping(value = "messageNotification",method = {RequestMethod.POST,RequestMethod.GET})
    public String messageNotification(
            HttpServletRequest request) {
        try {
            String str = getRequestBodyData(request);
            logger.info("======================:"+str);
            return success();
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"Device data incoming failure");
        }
    }
    /**
     * 获取request中body数据
     */
    public static String getRequestBodyData(HttpServletRequest request) throws IOException {
        BufferedReader bufferReader = new BufferedReader(request.getReader());
        StringBuilder sb = new StringBuilder();
        String line = null;
        while ((line = bufferReader.readLine()) != null) {
            sb.append(line);
        }
        return sb.toString();
    }
    /**
     * 返回接口处理结果

+ 37 - 10
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/util/ArtemisPostTest.java

@ -115,13 +115,14 @@ public class ArtemisPostTest {
		 980007	监控点在离线消息	7
		 980008	监测实时信息	8
     */
	public static void subscription_info(){
	public static void subscription_info(String msgType){
		String url = "/api/firepro/v1/subscription/info";
		//消息类型	msgType	String	是
		//回调URL	postUrl	String	是
		JSONObject jsonBody = new JSONObject();
		jsonBody.put("msgType", 1);
		jsonBody.put("postUrl", 3);
		jsonBody.put("msgType", msgType);
		jsonBody.put("postUrl", "http://ehr.yihu.com/wlyy/aqg/hvdevice/messageNotification");
		//http://ehr.yihu.com/wlyy/aqg/device/byOnlineStatus
		//http://ehr.yihu.com/wlyy/aqg
		String body = jsonBody.toJSONString();
		String StringeResult = callPostStringApi(url,body);
@ -154,27 +155,53 @@ public class ArtemisPostTest {
		System.out.println("StringeResult结果示例: "+StringeResult);
	}
	/**
	 * 查询订阅
	 */
	public void subscription_list(){
		String url = "/api/firepro/v1/subscription/list";
	 * 设备监测信息查询
     */
	public static void getMonitor(){
		String url = "/api/firepro/v1/getMonitor";
		JSONObject jsonBody = new JSONObject();
		jsonBody.put("pageNo", 1);
		jsonBody.put("pageSize", 3);
		jsonBody.put("pageSize", 10);
		jsonBody.put("flagId", "");
		jsonBody.put("offset", 0);
		String body = jsonBody.toJSONString();
		String StringeResult = callPostStringApi(url,body);
		System.out.println("StringeResult结果示例: "+StringeResult);
	}
	public static void main(String[] args) {
		String url = "/api/firepro/v1/getCompany";
	/**
	 * 查询订阅
	 */
	public void subscription_list(){
		String url = "/api/firepro/v1/subscription/list";
		JSONObject jsonBody = new JSONObject();
		jsonBody.put("pageNo", 1);
		jsonBody.put("pageSize", 3);
		String body = jsonBody.toJSONString();
		String StringeResult = callPostStringApi(url,body);
		System.out.println("StringeResult结果示例: "+StringeResult);
	}
	public static void main(String[] args) {
//		String url = "/api/firepro/v1/getCompany";
//		JSONObject jsonBody = new JSONObject();
//		jsonBody.put("pageNo", 1);
//		jsonBody.put("pageSize", 3);
//		String body = jsonBody.toJSONString();
//		String StringeResult = callPostStringApi(url,body);
//		System.out.println("StringeResult结果示例: "+StringeResult);
//		callPostImgStringApi();
		getMonitor();
//		subscription_info("980001");
//		subscription_info("980002");
//		subscription_info("980003");
//		subscription_info("980004");
//		subscription_info("980005");
//		subscription_info("980006");
//		subscription_info("980007");
//		subscription_info("980008");
	}
}

+ 1 - 1
svr/svr-cloud-device/src/main/resources/application.yml

@ -3,7 +3,7 @@ server:
  port: 9112
spring:
  application:
      name:  svr-cloud-device-skj
      name:  svr-cloud-device
  aop:
    proxy-target-class: true
  datasource: