diff --git a/pom.xml b/pom.xml index 50f4a19..eb09e10 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,42 @@ 2.4.5 + + + org.apache.commons + commons-lang3 + 3.1 + + + org.slf4j + slf4j-api + 1.7.7 + + + com.alibaba + fastjson + RELEASE + + + + org.apache.httpcomponents + httpclient + 4.5.9 + + + + com.hikvision.ga + artemis-http-client + 1.1.7 + + + + + + + + + org.springframework.boot diff --git a/pom.xml b/pom.xml index 50f4a19..eb09e10 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,42 @@ 2.4.5 + + + org.apache.commons + commons-lang3 + 3.1 + + + org.slf4j + slf4j-api + 1.7.7 + + + com.alibaba + fastjson + RELEASE + + + + org.apache.httpcomponents + httpclient + 4.5.9 + + + + com.hikvision.ga + artemis-http-client + 1.1.7 + + + + + + + + + org.springframework.boot diff --git a/smartwell-demos.iml b/smartwell-demos.iml new file mode 100644 index 0000000..47b2113 --- /dev/null +++ b/smartwell-demos.iml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 50f4a19..eb09e10 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,42 @@ 2.4.5 + + + org.apache.commons + commons-lang3 + 3.1 + + + org.slf4j + slf4j-api + 1.7.7 + + + com.alibaba + fastjson + RELEASE + + + + org.apache.httpcomponents + httpclient + 4.5.9 + + + + com.hikvision.ga + artemis-http-client + 1.1.7 + + + + + + + + + org.springframework.boot diff --git a/smartwell-demos.iml b/smartwell-demos.iml new file mode 100644 index 0000000..47b2113 --- /dev/null +++ b/smartwell-demos.iml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/casic/config/ApiHikomConfig.java b/src/main/java/com/casic/config/ApiHikomConfig.java new file mode 100644 index 0000000..73b3550 --- /dev/null +++ b/src/main/java/com/casic/config/ApiHikomConfig.java @@ -0,0 +1,14 @@ +package com.casic.config; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +@Configuration +@Data +public class ApiHikomConfig { + @Value("${casic.hikom.host}") + private String hikomHost; + @Value("${casic.hikom.url}") + private String hikomUrl; +} diff --git a/pom.xml b/pom.xml index 50f4a19..eb09e10 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,42 @@ 2.4.5 + + + org.apache.commons + commons-lang3 + 3.1 + + + org.slf4j + slf4j-api + 1.7.7 + + + com.alibaba + fastjson + RELEASE + + + + org.apache.httpcomponents + httpclient + 4.5.9 + + + + com.hikvision.ga + artemis-http-client + 1.1.7 + + + + + + + + + org.springframework.boot diff --git a/smartwell-demos.iml b/smartwell-demos.iml new file mode 100644 index 0000000..47b2113 --- /dev/null +++ b/smartwell-demos.iml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/casic/config/ApiHikomConfig.java b/src/main/java/com/casic/config/ApiHikomConfig.java new file mode 100644 index 0000000..73b3550 --- /dev/null +++ b/src/main/java/com/casic/config/ApiHikomConfig.java @@ -0,0 +1,14 @@ +package com.casic.config; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +@Configuration +@Data +public class ApiHikomConfig { + @Value("${casic.hikom.host}") + private String hikomHost; + @Value("${casic.hikom.url}") + private String hikomUrl; +} diff --git a/src/main/java/com/casic/config/Knife4jConfiguration.java b/src/main/java/com/casic/config/Knife4jConfiguration.java new file mode 100644 index 0000000..726a42f --- /dev/null +++ b/src/main/java/com/casic/config/Knife4jConfiguration.java @@ -0,0 +1,38 @@ +//package com.casic.config; +// +//import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; +//import org.springframework.beans.factory.annotation.Value; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import springfox.documentation.builders.ApiInfoBuilder; +//import springfox.documentation.builders.PathSelectors; +//import springfox.documentation.builders.RequestHandlerSelectors; +//import springfox.documentation.spi.DocumentationType; +//import springfox.documentation.spring.web.plugins.Docket; +// +//@Configuration +//@EnableKnife4j +//public class Knife4jConfiguration { +// +// @Value(value = "${swagger.enable}") +// public boolean enable; +// @Value(value = "${swagger.groupName}") +// public String groupName; +// +// @Bean(value = "dockerBean") +// public Docket dockerBean() { +// return new Docket(DocumentationType.SWAGGER_2) +// .apiInfo(new ApiInfoBuilder() +// //描述字段支持Markdown语法 +// .description("# Knife4j RESTful APIs") +// .termsOfServiceUrl("https://doc.casic.com/") +// .version("1.0") +// .build()) +// //分组名称 +// .groupName(groupName) +// .select() +// .apis(RequestHandlerSelectors.basePackage("com.casic")) +// .paths(PathSelectors.any()).build().enable(enable); +// } +// +//} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 50f4a19..eb09e10 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,42 @@ 2.4.5 + + + org.apache.commons + commons-lang3 + 3.1 + + + org.slf4j + slf4j-api + 1.7.7 + + + com.alibaba + fastjson + RELEASE + + + + org.apache.httpcomponents + httpclient + 4.5.9 + + + + com.hikvision.ga + artemis-http-client + 1.1.7 + + + + + + + + + org.springframework.boot diff --git a/smartwell-demos.iml b/smartwell-demos.iml new file mode 100644 index 0000000..47b2113 --- /dev/null +++ b/smartwell-demos.iml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/casic/config/ApiHikomConfig.java b/src/main/java/com/casic/config/ApiHikomConfig.java new file mode 100644 index 0000000..73b3550 --- /dev/null +++ b/src/main/java/com/casic/config/ApiHikomConfig.java @@ -0,0 +1,14 @@ +package com.casic.config; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +@Configuration +@Data +public class ApiHikomConfig { + @Value("${casic.hikom.host}") + private String hikomHost; + @Value("${casic.hikom.url}") + private String hikomUrl; +} diff --git a/src/main/java/com/casic/config/Knife4jConfiguration.java b/src/main/java/com/casic/config/Knife4jConfiguration.java new file mode 100644 index 0000000..726a42f --- /dev/null +++ b/src/main/java/com/casic/config/Knife4jConfiguration.java @@ -0,0 +1,38 @@ +//package com.casic.config; +// +//import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; +//import org.springframework.beans.factory.annotation.Value; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import springfox.documentation.builders.ApiInfoBuilder; +//import springfox.documentation.builders.PathSelectors; +//import springfox.documentation.builders.RequestHandlerSelectors; +//import springfox.documentation.spi.DocumentationType; +//import springfox.documentation.spring.web.plugins.Docket; +// +//@Configuration +//@EnableKnife4j +//public class Knife4jConfiguration { +// +// @Value(value = "${swagger.enable}") +// public boolean enable; +// @Value(value = "${swagger.groupName}") +// public String groupName; +// +// @Bean(value = "dockerBean") +// public Docket dockerBean() { +// return new Docket(DocumentationType.SWAGGER_2) +// .apiInfo(new ApiInfoBuilder() +// //描述字段支持Markdown语法 +// .description("# Knife4j RESTful APIs") +// .termsOfServiceUrl("https://doc.casic.com/") +// .version("1.0") +// .build()) +// //分组名称 +// .groupName(groupName) +// .select() +// .apis(RequestHandlerSelectors.basePackage("com.casic")) +// .paths(PathSelectors.any()).build().enable(enable); +// } +// +//} \ No newline at end of file diff --git a/src/main/java/com/casic/controller/ArtemisValidController.java b/src/main/java/com/casic/controller/ArtemisValidController.java new file mode 100644 index 0000000..fcf634a --- /dev/null +++ b/src/main/java/com/casic/controller/ArtemisValidController.java @@ -0,0 +1,22 @@ +package com.casic.controller; + +import com.casic.model.HkvideoValidParam; +import com.casic.model.ResponseData; +import com.casic.util.ArtemisPostUtil; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@AllArgsConstructor +@RestController +public class ArtemisValidController { + private final ArtemisPostUtil artemisPostUtill; + + @RequestMapping("/hkvideo/getVideoUrl") + public ResponseData getVideoUrl(@RequestBody HkvideoValidParam hkvideoValidParam) { + + return artemisPostUtill.artemisPost(hkvideoValidParam); + } + +} diff --git a/pom.xml b/pom.xml index 50f4a19..eb09e10 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,42 @@ 2.4.5 + + + org.apache.commons + commons-lang3 + 3.1 + + + org.slf4j + slf4j-api + 1.7.7 + + + com.alibaba + fastjson + RELEASE + + + + org.apache.httpcomponents + httpclient + 4.5.9 + + + + com.hikvision.ga + artemis-http-client + 1.1.7 + + + + + + + + + org.springframework.boot diff --git a/smartwell-demos.iml b/smartwell-demos.iml new file mode 100644 index 0000000..47b2113 --- /dev/null +++ b/smartwell-demos.iml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/casic/config/ApiHikomConfig.java b/src/main/java/com/casic/config/ApiHikomConfig.java new file mode 100644 index 0000000..73b3550 --- /dev/null +++ b/src/main/java/com/casic/config/ApiHikomConfig.java @@ -0,0 +1,14 @@ +package com.casic.config; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +@Configuration +@Data +public class ApiHikomConfig { + @Value("${casic.hikom.host}") + private String hikomHost; + @Value("${casic.hikom.url}") + private String hikomUrl; +} diff --git a/src/main/java/com/casic/config/Knife4jConfiguration.java b/src/main/java/com/casic/config/Knife4jConfiguration.java new file mode 100644 index 0000000..726a42f --- /dev/null +++ b/src/main/java/com/casic/config/Knife4jConfiguration.java @@ -0,0 +1,38 @@ +//package com.casic.config; +// +//import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; +//import org.springframework.beans.factory.annotation.Value; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import springfox.documentation.builders.ApiInfoBuilder; +//import springfox.documentation.builders.PathSelectors; +//import springfox.documentation.builders.RequestHandlerSelectors; +//import springfox.documentation.spi.DocumentationType; +//import springfox.documentation.spring.web.plugins.Docket; +// +//@Configuration +//@EnableKnife4j +//public class Knife4jConfiguration { +// +// @Value(value = "${swagger.enable}") +// public boolean enable; +// @Value(value = "${swagger.groupName}") +// public String groupName; +// +// @Bean(value = "dockerBean") +// public Docket dockerBean() { +// return new Docket(DocumentationType.SWAGGER_2) +// .apiInfo(new ApiInfoBuilder() +// //描述字段支持Markdown语法 +// .description("# Knife4j RESTful APIs") +// .termsOfServiceUrl("https://doc.casic.com/") +// .version("1.0") +// .build()) +// //分组名称 +// .groupName(groupName) +// .select() +// .apis(RequestHandlerSelectors.basePackage("com.casic")) +// .paths(PathSelectors.any()).build().enable(enable); +// } +// +//} \ No newline at end of file diff --git a/src/main/java/com/casic/controller/ArtemisValidController.java b/src/main/java/com/casic/controller/ArtemisValidController.java new file mode 100644 index 0000000..fcf634a --- /dev/null +++ b/src/main/java/com/casic/controller/ArtemisValidController.java @@ -0,0 +1,22 @@ +package com.casic.controller; + +import com.casic.model.HkvideoValidParam; +import com.casic.model.ResponseData; +import com.casic.util.ArtemisPostUtil; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@AllArgsConstructor +@RestController +public class ArtemisValidController { + private final ArtemisPostUtil artemisPostUtill; + + @RequestMapping("/hkvideo/getVideoUrl") + public ResponseData getVideoUrl(@RequestBody HkvideoValidParam hkvideoValidParam) { + + return artemisPostUtill.artemisPost(hkvideoValidParam); + } + +} diff --git a/src/main/java/com/casic/model/HkvideoValidParam.java b/src/main/java/com/casic/model/HkvideoValidParam.java new file mode 100644 index 0000000..cd50c96 --- /dev/null +++ b/src/main/java/com/casic/model/HkvideoValidParam.java @@ -0,0 +1,13 @@ +package com.casic.model; + +import com.alibaba.fastjson.JSONObject; +import lombok.Data; + +import java.util.Map; + +@Data +public class HkvideoValidParam { + private String appKey; + private String appSecret; + private JSONObject data; +} diff --git a/pom.xml b/pom.xml index 50f4a19..eb09e10 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,42 @@ 2.4.5 + + + org.apache.commons + commons-lang3 + 3.1 + + + org.slf4j + slf4j-api + 1.7.7 + + + com.alibaba + fastjson + RELEASE + + + + org.apache.httpcomponents + httpclient + 4.5.9 + + + + com.hikvision.ga + artemis-http-client + 1.1.7 + + + + + + + + + org.springframework.boot diff --git a/smartwell-demos.iml b/smartwell-demos.iml new file mode 100644 index 0000000..47b2113 --- /dev/null +++ b/smartwell-demos.iml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/casic/config/ApiHikomConfig.java b/src/main/java/com/casic/config/ApiHikomConfig.java new file mode 100644 index 0000000..73b3550 --- /dev/null +++ b/src/main/java/com/casic/config/ApiHikomConfig.java @@ -0,0 +1,14 @@ +package com.casic.config; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +@Configuration +@Data +public class ApiHikomConfig { + @Value("${casic.hikom.host}") + private String hikomHost; + @Value("${casic.hikom.url}") + private String hikomUrl; +} diff --git a/src/main/java/com/casic/config/Knife4jConfiguration.java b/src/main/java/com/casic/config/Knife4jConfiguration.java new file mode 100644 index 0000000..726a42f --- /dev/null +++ b/src/main/java/com/casic/config/Knife4jConfiguration.java @@ -0,0 +1,38 @@ +//package com.casic.config; +// +//import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; +//import org.springframework.beans.factory.annotation.Value; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import springfox.documentation.builders.ApiInfoBuilder; +//import springfox.documentation.builders.PathSelectors; +//import springfox.documentation.builders.RequestHandlerSelectors; +//import springfox.documentation.spi.DocumentationType; +//import springfox.documentation.spring.web.plugins.Docket; +// +//@Configuration +//@EnableKnife4j +//public class Knife4jConfiguration { +// +// @Value(value = "${swagger.enable}") +// public boolean enable; +// @Value(value = "${swagger.groupName}") +// public String groupName; +// +// @Bean(value = "dockerBean") +// public Docket dockerBean() { +// return new Docket(DocumentationType.SWAGGER_2) +// .apiInfo(new ApiInfoBuilder() +// //描述字段支持Markdown语法 +// .description("# Knife4j RESTful APIs") +// .termsOfServiceUrl("https://doc.casic.com/") +// .version("1.0") +// .build()) +// //分组名称 +// .groupName(groupName) +// .select() +// .apis(RequestHandlerSelectors.basePackage("com.casic")) +// .paths(PathSelectors.any()).build().enable(enable); +// } +// +//} \ No newline at end of file diff --git a/src/main/java/com/casic/controller/ArtemisValidController.java b/src/main/java/com/casic/controller/ArtemisValidController.java new file mode 100644 index 0000000..fcf634a --- /dev/null +++ b/src/main/java/com/casic/controller/ArtemisValidController.java @@ -0,0 +1,22 @@ +package com.casic.controller; + +import com.casic.model.HkvideoValidParam; +import com.casic.model.ResponseData; +import com.casic.util.ArtemisPostUtil; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@AllArgsConstructor +@RestController +public class ArtemisValidController { + private final ArtemisPostUtil artemisPostUtill; + + @RequestMapping("/hkvideo/getVideoUrl") + public ResponseData getVideoUrl(@RequestBody HkvideoValidParam hkvideoValidParam) { + + return artemisPostUtill.artemisPost(hkvideoValidParam); + } + +} diff --git a/src/main/java/com/casic/model/HkvideoValidParam.java b/src/main/java/com/casic/model/HkvideoValidParam.java new file mode 100644 index 0000000..cd50c96 --- /dev/null +++ b/src/main/java/com/casic/model/HkvideoValidParam.java @@ -0,0 +1,13 @@ +package com.casic.model; + +import com.alibaba.fastjson.JSONObject; +import lombok.Data; + +import java.util.Map; + +@Data +public class HkvideoValidParam { + private String appKey; + private String appSecret; + private JSONObject data; +} diff --git a/src/main/java/com/casic/model/ResponseData.java b/src/main/java/com/casic/model/ResponseData.java index 245ab04..a89e24b 100644 --- a/src/main/java/com/casic/model/ResponseData.java +++ b/src/main/java/com/casic/model/ResponseData.java @@ -7,12 +7,12 @@ * @date 2022-8-12 */ @Data -public class ResponseData { +public class ResponseData { public static final String DEFAULT_SUCCESS_MESSAGE = "请求成功"; public static final String DEFAULT_ERROR_MESSAGE = "网络异常"; public static final Integer DEFAULT_SUCCESS_CODE = 200; public static final Integer DEFAULT_ERROR_CODE = 500; private Integer code; private String message; - private Object data; + private T data; } \ No newline at end of file diff --git a/pom.xml b/pom.xml index 50f4a19..eb09e10 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,42 @@ 2.4.5 + + + org.apache.commons + commons-lang3 + 3.1 + + + org.slf4j + slf4j-api + 1.7.7 + + + com.alibaba + fastjson + RELEASE + + + + org.apache.httpcomponents + httpclient + 4.5.9 + + + + com.hikvision.ga + artemis-http-client + 1.1.7 + + + + + + + + + org.springframework.boot diff --git a/smartwell-demos.iml b/smartwell-demos.iml new file mode 100644 index 0000000..47b2113 --- /dev/null +++ b/smartwell-demos.iml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/casic/config/ApiHikomConfig.java b/src/main/java/com/casic/config/ApiHikomConfig.java new file mode 100644 index 0000000..73b3550 --- /dev/null +++ b/src/main/java/com/casic/config/ApiHikomConfig.java @@ -0,0 +1,14 @@ +package com.casic.config; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +@Configuration +@Data +public class ApiHikomConfig { + @Value("${casic.hikom.host}") + private String hikomHost; + @Value("${casic.hikom.url}") + private String hikomUrl; +} diff --git a/src/main/java/com/casic/config/Knife4jConfiguration.java b/src/main/java/com/casic/config/Knife4jConfiguration.java new file mode 100644 index 0000000..726a42f --- /dev/null +++ b/src/main/java/com/casic/config/Knife4jConfiguration.java @@ -0,0 +1,38 @@ +//package com.casic.config; +// +//import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; +//import org.springframework.beans.factory.annotation.Value; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import springfox.documentation.builders.ApiInfoBuilder; +//import springfox.documentation.builders.PathSelectors; +//import springfox.documentation.builders.RequestHandlerSelectors; +//import springfox.documentation.spi.DocumentationType; +//import springfox.documentation.spring.web.plugins.Docket; +// +//@Configuration +//@EnableKnife4j +//public class Knife4jConfiguration { +// +// @Value(value = "${swagger.enable}") +// public boolean enable; +// @Value(value = "${swagger.groupName}") +// public String groupName; +// +// @Bean(value = "dockerBean") +// public Docket dockerBean() { +// return new Docket(DocumentationType.SWAGGER_2) +// .apiInfo(new ApiInfoBuilder() +// //描述字段支持Markdown语法 +// .description("# Knife4j RESTful APIs") +// .termsOfServiceUrl("https://doc.casic.com/") +// .version("1.0") +// .build()) +// //分组名称 +// .groupName(groupName) +// .select() +// .apis(RequestHandlerSelectors.basePackage("com.casic")) +// .paths(PathSelectors.any()).build().enable(enable); +// } +// +//} \ No newline at end of file diff --git a/src/main/java/com/casic/controller/ArtemisValidController.java b/src/main/java/com/casic/controller/ArtemisValidController.java new file mode 100644 index 0000000..fcf634a --- /dev/null +++ b/src/main/java/com/casic/controller/ArtemisValidController.java @@ -0,0 +1,22 @@ +package com.casic.controller; + +import com.casic.model.HkvideoValidParam; +import com.casic.model.ResponseData; +import com.casic.util.ArtemisPostUtil; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@AllArgsConstructor +@RestController +public class ArtemisValidController { + private final ArtemisPostUtil artemisPostUtill; + + @RequestMapping("/hkvideo/getVideoUrl") + public ResponseData getVideoUrl(@RequestBody HkvideoValidParam hkvideoValidParam) { + + return artemisPostUtill.artemisPost(hkvideoValidParam); + } + +} diff --git a/src/main/java/com/casic/model/HkvideoValidParam.java b/src/main/java/com/casic/model/HkvideoValidParam.java new file mode 100644 index 0000000..cd50c96 --- /dev/null +++ b/src/main/java/com/casic/model/HkvideoValidParam.java @@ -0,0 +1,13 @@ +package com.casic.model; + +import com.alibaba.fastjson.JSONObject; +import lombok.Data; + +import java.util.Map; + +@Data +public class HkvideoValidParam { + private String appKey; + private String appSecret; + private JSONObject data; +} diff --git a/src/main/java/com/casic/model/ResponseData.java b/src/main/java/com/casic/model/ResponseData.java index 245ab04..a89e24b 100644 --- a/src/main/java/com/casic/model/ResponseData.java +++ b/src/main/java/com/casic/model/ResponseData.java @@ -7,12 +7,12 @@ * @date 2022-8-12 */ @Data -public class ResponseData { +public class ResponseData { public static final String DEFAULT_SUCCESS_MESSAGE = "请求成功"; public static final String DEFAULT_ERROR_MESSAGE = "网络异常"; public static final Integer DEFAULT_SUCCESS_CODE = 200; public static final Integer DEFAULT_ERROR_CODE = 500; private Integer code; private String message; - private Object data; + private T data; } \ No newline at end of file diff --git a/src/main/java/com/casic/service/impl/AlarmServiceImple.java b/src/main/java/com/casic/service/impl/AlarmServiceImple.java index a675207..0808c47 100644 --- a/src/main/java/com/casic/service/impl/AlarmServiceImple.java +++ b/src/main/java/com/casic/service/impl/AlarmServiceImple.java @@ -35,7 +35,7 @@ page.put("total", this.baseMapper.getAlarmTotalRecord(deviceType, devcode)); List> alarmRecordList = this.baseMapper.getAlarmRecord(deviceType, devcode, pageSize * (currentIndex - 1), pageSize); page.put("rows", alarmRecordList); - responseData.setData(alarmRecordList); + responseData.setData(page); responseData.setMessage(ResponseData.DEFAULT_SUCCESS_MESSAGE); responseData.setCode(ResponseData.DEFAULT_SUCCESS_CODE); } catch (DataAccessException dae) { diff --git a/pom.xml b/pom.xml index 50f4a19..eb09e10 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,42 @@ 2.4.5 + + + org.apache.commons + commons-lang3 + 3.1 + + + org.slf4j + slf4j-api + 1.7.7 + + + com.alibaba + fastjson + RELEASE + + + + org.apache.httpcomponents + httpclient + 4.5.9 + + + + com.hikvision.ga + artemis-http-client + 1.1.7 + + + + + + + + + org.springframework.boot diff --git a/smartwell-demos.iml b/smartwell-demos.iml new file mode 100644 index 0000000..47b2113 --- /dev/null +++ b/smartwell-demos.iml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/casic/config/ApiHikomConfig.java b/src/main/java/com/casic/config/ApiHikomConfig.java new file mode 100644 index 0000000..73b3550 --- /dev/null +++ b/src/main/java/com/casic/config/ApiHikomConfig.java @@ -0,0 +1,14 @@ +package com.casic.config; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +@Configuration +@Data +public class ApiHikomConfig { + @Value("${casic.hikom.host}") + private String hikomHost; + @Value("${casic.hikom.url}") + private String hikomUrl; +} diff --git a/src/main/java/com/casic/config/Knife4jConfiguration.java b/src/main/java/com/casic/config/Knife4jConfiguration.java new file mode 100644 index 0000000..726a42f --- /dev/null +++ b/src/main/java/com/casic/config/Knife4jConfiguration.java @@ -0,0 +1,38 @@ +//package com.casic.config; +// +//import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; +//import org.springframework.beans.factory.annotation.Value; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import springfox.documentation.builders.ApiInfoBuilder; +//import springfox.documentation.builders.PathSelectors; +//import springfox.documentation.builders.RequestHandlerSelectors; +//import springfox.documentation.spi.DocumentationType; +//import springfox.documentation.spring.web.plugins.Docket; +// +//@Configuration +//@EnableKnife4j +//public class Knife4jConfiguration { +// +// @Value(value = "${swagger.enable}") +// public boolean enable; +// @Value(value = "${swagger.groupName}") +// public String groupName; +// +// @Bean(value = "dockerBean") +// public Docket dockerBean() { +// return new Docket(DocumentationType.SWAGGER_2) +// .apiInfo(new ApiInfoBuilder() +// //描述字段支持Markdown语法 +// .description("# Knife4j RESTful APIs") +// .termsOfServiceUrl("https://doc.casic.com/") +// .version("1.0") +// .build()) +// //分组名称 +// .groupName(groupName) +// .select() +// .apis(RequestHandlerSelectors.basePackage("com.casic")) +// .paths(PathSelectors.any()).build().enable(enable); +// } +// +//} \ No newline at end of file diff --git a/src/main/java/com/casic/controller/ArtemisValidController.java b/src/main/java/com/casic/controller/ArtemisValidController.java new file mode 100644 index 0000000..fcf634a --- /dev/null +++ b/src/main/java/com/casic/controller/ArtemisValidController.java @@ -0,0 +1,22 @@ +package com.casic.controller; + +import com.casic.model.HkvideoValidParam; +import com.casic.model.ResponseData; +import com.casic.util.ArtemisPostUtil; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@AllArgsConstructor +@RestController +public class ArtemisValidController { + private final ArtemisPostUtil artemisPostUtill; + + @RequestMapping("/hkvideo/getVideoUrl") + public ResponseData getVideoUrl(@RequestBody HkvideoValidParam hkvideoValidParam) { + + return artemisPostUtill.artemisPost(hkvideoValidParam); + } + +} diff --git a/src/main/java/com/casic/model/HkvideoValidParam.java b/src/main/java/com/casic/model/HkvideoValidParam.java new file mode 100644 index 0000000..cd50c96 --- /dev/null +++ b/src/main/java/com/casic/model/HkvideoValidParam.java @@ -0,0 +1,13 @@ +package com.casic.model; + +import com.alibaba.fastjson.JSONObject; +import lombok.Data; + +import java.util.Map; + +@Data +public class HkvideoValidParam { + private String appKey; + private String appSecret; + private JSONObject data; +} diff --git a/src/main/java/com/casic/model/ResponseData.java b/src/main/java/com/casic/model/ResponseData.java index 245ab04..a89e24b 100644 --- a/src/main/java/com/casic/model/ResponseData.java +++ b/src/main/java/com/casic/model/ResponseData.java @@ -7,12 +7,12 @@ * @date 2022-8-12 */ @Data -public class ResponseData { +public class ResponseData { public static final String DEFAULT_SUCCESS_MESSAGE = "请求成功"; public static final String DEFAULT_ERROR_MESSAGE = "网络异常"; public static final Integer DEFAULT_SUCCESS_CODE = 200; public static final Integer DEFAULT_ERROR_CODE = 500; private Integer code; private String message; - private Object data; + private T data; } \ No newline at end of file diff --git a/src/main/java/com/casic/service/impl/AlarmServiceImple.java b/src/main/java/com/casic/service/impl/AlarmServiceImple.java index a675207..0808c47 100644 --- a/src/main/java/com/casic/service/impl/AlarmServiceImple.java +++ b/src/main/java/com/casic/service/impl/AlarmServiceImple.java @@ -35,7 +35,7 @@ page.put("total", this.baseMapper.getAlarmTotalRecord(deviceType, devcode)); List> alarmRecordList = this.baseMapper.getAlarmRecord(deviceType, devcode, pageSize * (currentIndex - 1), pageSize); page.put("rows", alarmRecordList); - responseData.setData(alarmRecordList); + responseData.setData(page); responseData.setMessage(ResponseData.DEFAULT_SUCCESS_MESSAGE); responseData.setCode(ResponseData.DEFAULT_SUCCESS_CODE); } catch (DataAccessException dae) { diff --git a/src/main/java/com/casic/service/impl/ThirdDataServiceImpl.java b/src/main/java/com/casic/service/impl/ThirdDataServiceImpl.java index 6b23451..1e6f08a 100644 --- a/src/main/java/com/casic/service/impl/ThirdDataServiceImpl.java +++ b/src/main/java/com/casic/service/impl/ThirdDataServiceImpl.java @@ -82,9 +82,9 @@ private void checkAlarm(DataPressure dataPressure) { final Float ruleValue = this.baseMapper.getRuleValue("24"); if (ruleValue == null) return; - if (!StringUtils.isEmpty(dataPressure.getTemperature()) && !dataPressure.getTemperature().equals("null")) { - if (Float.valueOf(dataPressure.getTemperature()) > ruleValue) { - this.baseMapper.saveRecords(dataPressure.getTemperature(), new Date()); + if (!StringUtils.isEmpty(dataPressure.getPress()) && !dataPressure.getPress().equals("null")) { + if (Float.valueOf(dataPressure.getPress()) > ruleValue) { + this.baseMapper.saveRecords(dataPressure.getPress(), new Date()); } } } diff --git a/pom.xml b/pom.xml index 50f4a19..eb09e10 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,42 @@ 2.4.5 + + + org.apache.commons + commons-lang3 + 3.1 + + + org.slf4j + slf4j-api + 1.7.7 + + + com.alibaba + fastjson + RELEASE + + + + org.apache.httpcomponents + httpclient + 4.5.9 + + + + com.hikvision.ga + artemis-http-client + 1.1.7 + + + + + + + + + org.springframework.boot diff --git a/smartwell-demos.iml b/smartwell-demos.iml new file mode 100644 index 0000000..47b2113 --- /dev/null +++ b/smartwell-demos.iml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/casic/config/ApiHikomConfig.java b/src/main/java/com/casic/config/ApiHikomConfig.java new file mode 100644 index 0000000..73b3550 --- /dev/null +++ b/src/main/java/com/casic/config/ApiHikomConfig.java @@ -0,0 +1,14 @@ +package com.casic.config; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +@Configuration +@Data +public class ApiHikomConfig { + @Value("${casic.hikom.host}") + private String hikomHost; + @Value("${casic.hikom.url}") + private String hikomUrl; +} diff --git a/src/main/java/com/casic/config/Knife4jConfiguration.java b/src/main/java/com/casic/config/Knife4jConfiguration.java new file mode 100644 index 0000000..726a42f --- /dev/null +++ b/src/main/java/com/casic/config/Knife4jConfiguration.java @@ -0,0 +1,38 @@ +//package com.casic.config; +// +//import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; +//import org.springframework.beans.factory.annotation.Value; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import springfox.documentation.builders.ApiInfoBuilder; +//import springfox.documentation.builders.PathSelectors; +//import springfox.documentation.builders.RequestHandlerSelectors; +//import springfox.documentation.spi.DocumentationType; +//import springfox.documentation.spring.web.plugins.Docket; +// +//@Configuration +//@EnableKnife4j +//public class Knife4jConfiguration { +// +// @Value(value = "${swagger.enable}") +// public boolean enable; +// @Value(value = "${swagger.groupName}") +// public String groupName; +// +// @Bean(value = "dockerBean") +// public Docket dockerBean() { +// return new Docket(DocumentationType.SWAGGER_2) +// .apiInfo(new ApiInfoBuilder() +// //描述字段支持Markdown语法 +// .description("# Knife4j RESTful APIs") +// .termsOfServiceUrl("https://doc.casic.com/") +// .version("1.0") +// .build()) +// //分组名称 +// .groupName(groupName) +// .select() +// .apis(RequestHandlerSelectors.basePackage("com.casic")) +// .paths(PathSelectors.any()).build().enable(enable); +// } +// +//} \ No newline at end of file diff --git a/src/main/java/com/casic/controller/ArtemisValidController.java b/src/main/java/com/casic/controller/ArtemisValidController.java new file mode 100644 index 0000000..fcf634a --- /dev/null +++ b/src/main/java/com/casic/controller/ArtemisValidController.java @@ -0,0 +1,22 @@ +package com.casic.controller; + +import com.casic.model.HkvideoValidParam; +import com.casic.model.ResponseData; +import com.casic.util.ArtemisPostUtil; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@AllArgsConstructor +@RestController +public class ArtemisValidController { + private final ArtemisPostUtil artemisPostUtill; + + @RequestMapping("/hkvideo/getVideoUrl") + public ResponseData getVideoUrl(@RequestBody HkvideoValidParam hkvideoValidParam) { + + return artemisPostUtill.artemisPost(hkvideoValidParam); + } + +} diff --git a/src/main/java/com/casic/model/HkvideoValidParam.java b/src/main/java/com/casic/model/HkvideoValidParam.java new file mode 100644 index 0000000..cd50c96 --- /dev/null +++ b/src/main/java/com/casic/model/HkvideoValidParam.java @@ -0,0 +1,13 @@ +package com.casic.model; + +import com.alibaba.fastjson.JSONObject; +import lombok.Data; + +import java.util.Map; + +@Data +public class HkvideoValidParam { + private String appKey; + private String appSecret; + private JSONObject data; +} diff --git a/src/main/java/com/casic/model/ResponseData.java b/src/main/java/com/casic/model/ResponseData.java index 245ab04..a89e24b 100644 --- a/src/main/java/com/casic/model/ResponseData.java +++ b/src/main/java/com/casic/model/ResponseData.java @@ -7,12 +7,12 @@ * @date 2022-8-12 */ @Data -public class ResponseData { +public class ResponseData { public static final String DEFAULT_SUCCESS_MESSAGE = "请求成功"; public static final String DEFAULT_ERROR_MESSAGE = "网络异常"; public static final Integer DEFAULT_SUCCESS_CODE = 200; public static final Integer DEFAULT_ERROR_CODE = 500; private Integer code; private String message; - private Object data; + private T data; } \ No newline at end of file diff --git a/src/main/java/com/casic/service/impl/AlarmServiceImple.java b/src/main/java/com/casic/service/impl/AlarmServiceImple.java index a675207..0808c47 100644 --- a/src/main/java/com/casic/service/impl/AlarmServiceImple.java +++ b/src/main/java/com/casic/service/impl/AlarmServiceImple.java @@ -35,7 +35,7 @@ page.put("total", this.baseMapper.getAlarmTotalRecord(deviceType, devcode)); List> alarmRecordList = this.baseMapper.getAlarmRecord(deviceType, devcode, pageSize * (currentIndex - 1), pageSize); page.put("rows", alarmRecordList); - responseData.setData(alarmRecordList); + responseData.setData(page); responseData.setMessage(ResponseData.DEFAULT_SUCCESS_MESSAGE); responseData.setCode(ResponseData.DEFAULT_SUCCESS_CODE); } catch (DataAccessException dae) { diff --git a/src/main/java/com/casic/service/impl/ThirdDataServiceImpl.java b/src/main/java/com/casic/service/impl/ThirdDataServiceImpl.java index 6b23451..1e6f08a 100644 --- a/src/main/java/com/casic/service/impl/ThirdDataServiceImpl.java +++ b/src/main/java/com/casic/service/impl/ThirdDataServiceImpl.java @@ -82,9 +82,9 @@ private void checkAlarm(DataPressure dataPressure) { final Float ruleValue = this.baseMapper.getRuleValue("24"); if (ruleValue == null) return; - if (!StringUtils.isEmpty(dataPressure.getTemperature()) && !dataPressure.getTemperature().equals("null")) { - if (Float.valueOf(dataPressure.getTemperature()) > ruleValue) { - this.baseMapper.saveRecords(dataPressure.getTemperature(), new Date()); + if (!StringUtils.isEmpty(dataPressure.getPress()) && !dataPressure.getPress().equals("null")) { + if (Float.valueOf(dataPressure.getPress()) > ruleValue) { + this.baseMapper.saveRecords(dataPressure.getPress(), new Date()); } } } diff --git a/src/main/java/com/casic/util/ArtemisPostUtil.java b/src/main/java/com/casic/util/ArtemisPostUtil.java new file mode 100644 index 0000000..1de103d --- /dev/null +++ b/src/main/java/com/casic/util/ArtemisPostUtil.java @@ -0,0 +1,58 @@ +package com.casic.util; + +import com.alibaba.fastjson.JSONObject; +import com.casic.config.ApiHikomConfig; +import com.casic.model.HkvideoValidParam; +import com.casic.model.ResponseData; +import com.hikvision.artemis.sdk.ArtemisHttpUtil; +import com.hikvision.artemis.sdk.config.ArtemisConfig; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; + +/** + * 海康验证 + */ +@Component +@Slf4j +public class ArtemisPostUtil { + + @Resource + private ApiHikomConfig apiHikomConfig; + private final String contentType = "application/json"; + + public ResponseData artemisPost(HkvideoValidParam hkvideoValidParam) { + ResponseData responseData = new ResponseData(); + ArtemisConfig artemisConfig = new ArtemisConfig(); + artemisConfig.setHost(apiHikomConfig.getHikomHost());// artemis网关服务器ip端口 + artemisConfig.setAppKey(hkvideoValidParam.getAppKey()); + artemisConfig.setAppSecret(hkvideoValidParam.getAppSecret()); + Map path = new HashMap(2) { + { + put("https://", apiHikomConfig.getHikomUrl());//根据现场环境部署确认是http还是https + } + }; + String body = hkvideoValidParam.getData().toJSONString(); + try { + String result = ArtemisHttpUtil.doPostStringArtemis(artemisConfig, path, body, null, null, contentType, null);// post请求application/json类型参数 + Map resultMsg = (Map) JSONObject.parse(result); + if (resultMsg.get("msg").equals("success")) { + responseData.setCode(200); + responseData.setMessage("查询成功"); + responseData.setData(resultMsg.get("data")); + } else { + responseData.setCode(500); + responseData.setMessage("查询异常,异常信息" + resultMsg.get("data")); + } + } catch (Exception ex) { + log.info("主题:海康请求视频url出现异常,异常信息{}", ex.getMessage()); + responseData.setCode(500); + responseData.setMessage("查询异常,异常信息" + ex.getMessage()); + } + return responseData; + } + +} diff --git a/pom.xml b/pom.xml index 50f4a19..eb09e10 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,42 @@ 2.4.5 + + + org.apache.commons + commons-lang3 + 3.1 + + + org.slf4j + slf4j-api + 1.7.7 + + + com.alibaba + fastjson + RELEASE + + + + org.apache.httpcomponents + httpclient + 4.5.9 + + + + com.hikvision.ga + artemis-http-client + 1.1.7 + + + + + + + + + org.springframework.boot diff --git a/smartwell-demos.iml b/smartwell-demos.iml new file mode 100644 index 0000000..47b2113 --- /dev/null +++ b/smartwell-demos.iml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/casic/config/ApiHikomConfig.java b/src/main/java/com/casic/config/ApiHikomConfig.java new file mode 100644 index 0000000..73b3550 --- /dev/null +++ b/src/main/java/com/casic/config/ApiHikomConfig.java @@ -0,0 +1,14 @@ +package com.casic.config; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +@Configuration +@Data +public class ApiHikomConfig { + @Value("${casic.hikom.host}") + private String hikomHost; + @Value("${casic.hikom.url}") + private String hikomUrl; +} diff --git a/src/main/java/com/casic/config/Knife4jConfiguration.java b/src/main/java/com/casic/config/Knife4jConfiguration.java new file mode 100644 index 0000000..726a42f --- /dev/null +++ b/src/main/java/com/casic/config/Knife4jConfiguration.java @@ -0,0 +1,38 @@ +//package com.casic.config; +// +//import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; +//import org.springframework.beans.factory.annotation.Value; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import springfox.documentation.builders.ApiInfoBuilder; +//import springfox.documentation.builders.PathSelectors; +//import springfox.documentation.builders.RequestHandlerSelectors; +//import springfox.documentation.spi.DocumentationType; +//import springfox.documentation.spring.web.plugins.Docket; +// +//@Configuration +//@EnableKnife4j +//public class Knife4jConfiguration { +// +// @Value(value = "${swagger.enable}") +// public boolean enable; +// @Value(value = "${swagger.groupName}") +// public String groupName; +// +// @Bean(value = "dockerBean") +// public Docket dockerBean() { +// return new Docket(DocumentationType.SWAGGER_2) +// .apiInfo(new ApiInfoBuilder() +// //描述字段支持Markdown语法 +// .description("# Knife4j RESTful APIs") +// .termsOfServiceUrl("https://doc.casic.com/") +// .version("1.0") +// .build()) +// //分组名称 +// .groupName(groupName) +// .select() +// .apis(RequestHandlerSelectors.basePackage("com.casic")) +// .paths(PathSelectors.any()).build().enable(enable); +// } +// +//} \ No newline at end of file diff --git a/src/main/java/com/casic/controller/ArtemisValidController.java b/src/main/java/com/casic/controller/ArtemisValidController.java new file mode 100644 index 0000000..fcf634a --- /dev/null +++ b/src/main/java/com/casic/controller/ArtemisValidController.java @@ -0,0 +1,22 @@ +package com.casic.controller; + +import com.casic.model.HkvideoValidParam; +import com.casic.model.ResponseData; +import com.casic.util.ArtemisPostUtil; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@AllArgsConstructor +@RestController +public class ArtemisValidController { + private final ArtemisPostUtil artemisPostUtill; + + @RequestMapping("/hkvideo/getVideoUrl") + public ResponseData getVideoUrl(@RequestBody HkvideoValidParam hkvideoValidParam) { + + return artemisPostUtill.artemisPost(hkvideoValidParam); + } + +} diff --git a/src/main/java/com/casic/model/HkvideoValidParam.java b/src/main/java/com/casic/model/HkvideoValidParam.java new file mode 100644 index 0000000..cd50c96 --- /dev/null +++ b/src/main/java/com/casic/model/HkvideoValidParam.java @@ -0,0 +1,13 @@ +package com.casic.model; + +import com.alibaba.fastjson.JSONObject; +import lombok.Data; + +import java.util.Map; + +@Data +public class HkvideoValidParam { + private String appKey; + private String appSecret; + private JSONObject data; +} diff --git a/src/main/java/com/casic/model/ResponseData.java b/src/main/java/com/casic/model/ResponseData.java index 245ab04..a89e24b 100644 --- a/src/main/java/com/casic/model/ResponseData.java +++ b/src/main/java/com/casic/model/ResponseData.java @@ -7,12 +7,12 @@ * @date 2022-8-12 */ @Data -public class ResponseData { +public class ResponseData { public static final String DEFAULT_SUCCESS_MESSAGE = "请求成功"; public static final String DEFAULT_ERROR_MESSAGE = "网络异常"; public static final Integer DEFAULT_SUCCESS_CODE = 200; public static final Integer DEFAULT_ERROR_CODE = 500; private Integer code; private String message; - private Object data; + private T data; } \ No newline at end of file diff --git a/src/main/java/com/casic/service/impl/AlarmServiceImple.java b/src/main/java/com/casic/service/impl/AlarmServiceImple.java index a675207..0808c47 100644 --- a/src/main/java/com/casic/service/impl/AlarmServiceImple.java +++ b/src/main/java/com/casic/service/impl/AlarmServiceImple.java @@ -35,7 +35,7 @@ page.put("total", this.baseMapper.getAlarmTotalRecord(deviceType, devcode)); List> alarmRecordList = this.baseMapper.getAlarmRecord(deviceType, devcode, pageSize * (currentIndex - 1), pageSize); page.put("rows", alarmRecordList); - responseData.setData(alarmRecordList); + responseData.setData(page); responseData.setMessage(ResponseData.DEFAULT_SUCCESS_MESSAGE); responseData.setCode(ResponseData.DEFAULT_SUCCESS_CODE); } catch (DataAccessException dae) { diff --git a/src/main/java/com/casic/service/impl/ThirdDataServiceImpl.java b/src/main/java/com/casic/service/impl/ThirdDataServiceImpl.java index 6b23451..1e6f08a 100644 --- a/src/main/java/com/casic/service/impl/ThirdDataServiceImpl.java +++ b/src/main/java/com/casic/service/impl/ThirdDataServiceImpl.java @@ -82,9 +82,9 @@ private void checkAlarm(DataPressure dataPressure) { final Float ruleValue = this.baseMapper.getRuleValue("24"); if (ruleValue == null) return; - if (!StringUtils.isEmpty(dataPressure.getTemperature()) && !dataPressure.getTemperature().equals("null")) { - if (Float.valueOf(dataPressure.getTemperature()) > ruleValue) { - this.baseMapper.saveRecords(dataPressure.getTemperature(), new Date()); + if (!StringUtils.isEmpty(dataPressure.getPress()) && !dataPressure.getPress().equals("null")) { + if (Float.valueOf(dataPressure.getPress()) > ruleValue) { + this.baseMapper.saveRecords(dataPressure.getPress(), new Date()); } } } diff --git a/src/main/java/com/casic/util/ArtemisPostUtil.java b/src/main/java/com/casic/util/ArtemisPostUtil.java new file mode 100644 index 0000000..1de103d --- /dev/null +++ b/src/main/java/com/casic/util/ArtemisPostUtil.java @@ -0,0 +1,58 @@ +package com.casic.util; + +import com.alibaba.fastjson.JSONObject; +import com.casic.config.ApiHikomConfig; +import com.casic.model.HkvideoValidParam; +import com.casic.model.ResponseData; +import com.hikvision.artemis.sdk.ArtemisHttpUtil; +import com.hikvision.artemis.sdk.config.ArtemisConfig; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; + +/** + * 海康验证 + */ +@Component +@Slf4j +public class ArtemisPostUtil { + + @Resource + private ApiHikomConfig apiHikomConfig; + private final String contentType = "application/json"; + + public ResponseData artemisPost(HkvideoValidParam hkvideoValidParam) { + ResponseData responseData = new ResponseData(); + ArtemisConfig artemisConfig = new ArtemisConfig(); + artemisConfig.setHost(apiHikomConfig.getHikomHost());// artemis网关服务器ip端口 + artemisConfig.setAppKey(hkvideoValidParam.getAppKey()); + artemisConfig.setAppSecret(hkvideoValidParam.getAppSecret()); + Map path = new HashMap(2) { + { + put("https://", apiHikomConfig.getHikomUrl());//根据现场环境部署确认是http还是https + } + }; + String body = hkvideoValidParam.getData().toJSONString(); + try { + String result = ArtemisHttpUtil.doPostStringArtemis(artemisConfig, path, body, null, null, contentType, null);// post请求application/json类型参数 + Map resultMsg = (Map) JSONObject.parse(result); + if (resultMsg.get("msg").equals("success")) { + responseData.setCode(200); + responseData.setMessage("查询成功"); + responseData.setData(resultMsg.get("data")); + } else { + responseData.setCode(500); + responseData.setMessage("查询异常,异常信息" + resultMsg.get("data")); + } + } catch (Exception ex) { + log.info("主题:海康请求视频url出现异常,异常信息{}", ex.getMessage()); + responseData.setCode(500); + responseData.setMessage("查询异常,异常信息" + ex.getMessage()); + } + return responseData; + } + +} diff --git a/src/main/resources/config/application-prod.yml b/src/main/resources/config/application-prod.yml deleted file mode 100644 index 4fee268..0000000 --- a/src/main/resources/config/application-prod.yml +++ /dev/null @@ -1,43 +0,0 @@ -server: - port: 11312 -################### spring配置 ################### -spring: - datasource: - smartwell: - driver-class-name: org.postgresql.Driver - url: jdbc:postgresql://111.198.10.15:11209/smartwell - username: postgres - password: Casic203 - cms: - driver-class-name: org.postgresql.Driver - url: jdbc:postgresql://111.198.10.15:11209/smartwell_cms - username: postgres - password: Casic203 - span_tilt: - driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://111.198.10.15:11102/casic_span_tilt?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&serverTimezone=UTC&&allowMultiQueries=true&&useSSL=true - username: root - password: Casic203! - session: - store-type: redis - redis: - host: 111.198.10.15 - port: 11412 - password: ew5T4K3#203lwh - redisValueSerializer: org.springframework.data.redis.serializer.JdkSerializationRedisSerializer - # session: - # store-type: redis -#flowable数据源和多数据源配置 -casic: - kaptcha-open: false #是否开启登录时验证码 (true/false) - #kaptcha-open: false #是否开启登录时验证码 (true/false) - db: - init: - enable: false - spring-session-open: false #开启spring session -logging: - level.root: error - level.com.casic: error - file: - path: logs/ - name: missiles.log \ No newline at end of file diff --git a/pom.xml b/pom.xml index 50f4a19..eb09e10 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,42 @@ 2.4.5 + + + org.apache.commons + commons-lang3 + 3.1 + + + org.slf4j + slf4j-api + 1.7.7 + + + com.alibaba + fastjson + RELEASE + + + + org.apache.httpcomponents + httpclient + 4.5.9 + + + + com.hikvision.ga + artemis-http-client + 1.1.7 + + + + + + + + + org.springframework.boot diff --git a/smartwell-demos.iml b/smartwell-demos.iml new file mode 100644 index 0000000..47b2113 --- /dev/null +++ b/smartwell-demos.iml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/casic/config/ApiHikomConfig.java b/src/main/java/com/casic/config/ApiHikomConfig.java new file mode 100644 index 0000000..73b3550 --- /dev/null +++ b/src/main/java/com/casic/config/ApiHikomConfig.java @@ -0,0 +1,14 @@ +package com.casic.config; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +@Configuration +@Data +public class ApiHikomConfig { + @Value("${casic.hikom.host}") + private String hikomHost; + @Value("${casic.hikom.url}") + private String hikomUrl; +} diff --git a/src/main/java/com/casic/config/Knife4jConfiguration.java b/src/main/java/com/casic/config/Knife4jConfiguration.java new file mode 100644 index 0000000..726a42f --- /dev/null +++ b/src/main/java/com/casic/config/Knife4jConfiguration.java @@ -0,0 +1,38 @@ +//package com.casic.config; +// +//import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; +//import org.springframework.beans.factory.annotation.Value; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import springfox.documentation.builders.ApiInfoBuilder; +//import springfox.documentation.builders.PathSelectors; +//import springfox.documentation.builders.RequestHandlerSelectors; +//import springfox.documentation.spi.DocumentationType; +//import springfox.documentation.spring.web.plugins.Docket; +// +//@Configuration +//@EnableKnife4j +//public class Knife4jConfiguration { +// +// @Value(value = "${swagger.enable}") +// public boolean enable; +// @Value(value = "${swagger.groupName}") +// public String groupName; +// +// @Bean(value = "dockerBean") +// public Docket dockerBean() { +// return new Docket(DocumentationType.SWAGGER_2) +// .apiInfo(new ApiInfoBuilder() +// //描述字段支持Markdown语法 +// .description("# Knife4j RESTful APIs") +// .termsOfServiceUrl("https://doc.casic.com/") +// .version("1.0") +// .build()) +// //分组名称 +// .groupName(groupName) +// .select() +// .apis(RequestHandlerSelectors.basePackage("com.casic")) +// .paths(PathSelectors.any()).build().enable(enable); +// } +// +//} \ No newline at end of file diff --git a/src/main/java/com/casic/controller/ArtemisValidController.java b/src/main/java/com/casic/controller/ArtemisValidController.java new file mode 100644 index 0000000..fcf634a --- /dev/null +++ b/src/main/java/com/casic/controller/ArtemisValidController.java @@ -0,0 +1,22 @@ +package com.casic.controller; + +import com.casic.model.HkvideoValidParam; +import com.casic.model.ResponseData; +import com.casic.util.ArtemisPostUtil; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@AllArgsConstructor +@RestController +public class ArtemisValidController { + private final ArtemisPostUtil artemisPostUtill; + + @RequestMapping("/hkvideo/getVideoUrl") + public ResponseData getVideoUrl(@RequestBody HkvideoValidParam hkvideoValidParam) { + + return artemisPostUtill.artemisPost(hkvideoValidParam); + } + +} diff --git a/src/main/java/com/casic/model/HkvideoValidParam.java b/src/main/java/com/casic/model/HkvideoValidParam.java new file mode 100644 index 0000000..cd50c96 --- /dev/null +++ b/src/main/java/com/casic/model/HkvideoValidParam.java @@ -0,0 +1,13 @@ +package com.casic.model; + +import com.alibaba.fastjson.JSONObject; +import lombok.Data; + +import java.util.Map; + +@Data +public class HkvideoValidParam { + private String appKey; + private String appSecret; + private JSONObject data; +} diff --git a/src/main/java/com/casic/model/ResponseData.java b/src/main/java/com/casic/model/ResponseData.java index 245ab04..a89e24b 100644 --- a/src/main/java/com/casic/model/ResponseData.java +++ b/src/main/java/com/casic/model/ResponseData.java @@ -7,12 +7,12 @@ * @date 2022-8-12 */ @Data -public class ResponseData { +public class ResponseData { public static final String DEFAULT_SUCCESS_MESSAGE = "请求成功"; public static final String DEFAULT_ERROR_MESSAGE = "网络异常"; public static final Integer DEFAULT_SUCCESS_CODE = 200; public static final Integer DEFAULT_ERROR_CODE = 500; private Integer code; private String message; - private Object data; + private T data; } \ No newline at end of file diff --git a/src/main/java/com/casic/service/impl/AlarmServiceImple.java b/src/main/java/com/casic/service/impl/AlarmServiceImple.java index a675207..0808c47 100644 --- a/src/main/java/com/casic/service/impl/AlarmServiceImple.java +++ b/src/main/java/com/casic/service/impl/AlarmServiceImple.java @@ -35,7 +35,7 @@ page.put("total", this.baseMapper.getAlarmTotalRecord(deviceType, devcode)); List> alarmRecordList = this.baseMapper.getAlarmRecord(deviceType, devcode, pageSize * (currentIndex - 1), pageSize); page.put("rows", alarmRecordList); - responseData.setData(alarmRecordList); + responseData.setData(page); responseData.setMessage(ResponseData.DEFAULT_SUCCESS_MESSAGE); responseData.setCode(ResponseData.DEFAULT_SUCCESS_CODE); } catch (DataAccessException dae) { diff --git a/src/main/java/com/casic/service/impl/ThirdDataServiceImpl.java b/src/main/java/com/casic/service/impl/ThirdDataServiceImpl.java index 6b23451..1e6f08a 100644 --- a/src/main/java/com/casic/service/impl/ThirdDataServiceImpl.java +++ b/src/main/java/com/casic/service/impl/ThirdDataServiceImpl.java @@ -82,9 +82,9 @@ private void checkAlarm(DataPressure dataPressure) { final Float ruleValue = this.baseMapper.getRuleValue("24"); if (ruleValue == null) return; - if (!StringUtils.isEmpty(dataPressure.getTemperature()) && !dataPressure.getTemperature().equals("null")) { - if (Float.valueOf(dataPressure.getTemperature()) > ruleValue) { - this.baseMapper.saveRecords(dataPressure.getTemperature(), new Date()); + if (!StringUtils.isEmpty(dataPressure.getPress()) && !dataPressure.getPress().equals("null")) { + if (Float.valueOf(dataPressure.getPress()) > ruleValue) { + this.baseMapper.saveRecords(dataPressure.getPress(), new Date()); } } } diff --git a/src/main/java/com/casic/util/ArtemisPostUtil.java b/src/main/java/com/casic/util/ArtemisPostUtil.java new file mode 100644 index 0000000..1de103d --- /dev/null +++ b/src/main/java/com/casic/util/ArtemisPostUtil.java @@ -0,0 +1,58 @@ +package com.casic.util; + +import com.alibaba.fastjson.JSONObject; +import com.casic.config.ApiHikomConfig; +import com.casic.model.HkvideoValidParam; +import com.casic.model.ResponseData; +import com.hikvision.artemis.sdk.ArtemisHttpUtil; +import com.hikvision.artemis.sdk.config.ArtemisConfig; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; + +/** + * 海康验证 + */ +@Component +@Slf4j +public class ArtemisPostUtil { + + @Resource + private ApiHikomConfig apiHikomConfig; + private final String contentType = "application/json"; + + public ResponseData artemisPost(HkvideoValidParam hkvideoValidParam) { + ResponseData responseData = new ResponseData(); + ArtemisConfig artemisConfig = new ArtemisConfig(); + artemisConfig.setHost(apiHikomConfig.getHikomHost());// artemis网关服务器ip端口 + artemisConfig.setAppKey(hkvideoValidParam.getAppKey()); + artemisConfig.setAppSecret(hkvideoValidParam.getAppSecret()); + Map path = new HashMap(2) { + { + put("https://", apiHikomConfig.getHikomUrl());//根据现场环境部署确认是http还是https + } + }; + String body = hkvideoValidParam.getData().toJSONString(); + try { + String result = ArtemisHttpUtil.doPostStringArtemis(artemisConfig, path, body, null, null, contentType, null);// post请求application/json类型参数 + Map resultMsg = (Map) JSONObject.parse(result); + if (resultMsg.get("msg").equals("success")) { + responseData.setCode(200); + responseData.setMessage("查询成功"); + responseData.setData(resultMsg.get("data")); + } else { + responseData.setCode(500); + responseData.setMessage("查询异常,异常信息" + resultMsg.get("data")); + } + } catch (Exception ex) { + log.info("主题:海康请求视频url出现异常,异常信息{}", ex.getMessage()); + responseData.setCode(500); + responseData.setMessage("查询异常,异常信息" + ex.getMessage()); + } + return responseData; + } + +} diff --git a/src/main/resources/config/application-prod.yml b/src/main/resources/config/application-prod.yml deleted file mode 100644 index 4fee268..0000000 --- a/src/main/resources/config/application-prod.yml +++ /dev/null @@ -1,43 +0,0 @@ -server: - port: 11312 -################### spring配置 ################### -spring: - datasource: - smartwell: - driver-class-name: org.postgresql.Driver - url: jdbc:postgresql://111.198.10.15:11209/smartwell - username: postgres - password: Casic203 - cms: - driver-class-name: org.postgresql.Driver - url: jdbc:postgresql://111.198.10.15:11209/smartwell_cms - username: postgres - password: Casic203 - span_tilt: - driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://111.198.10.15:11102/casic_span_tilt?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&serverTimezone=UTC&&allowMultiQueries=true&&useSSL=true - username: root - password: Casic203! - session: - store-type: redis - redis: - host: 111.198.10.15 - port: 11412 - password: ew5T4K3#203lwh - redisValueSerializer: org.springframework.data.redis.serializer.JdkSerializationRedisSerializer - # session: - # store-type: redis -#flowable数据源和多数据源配置 -casic: - kaptcha-open: false #是否开启登录时验证码 (true/false) - #kaptcha-open: false #是否开启登录时验证码 (true/false) - db: - init: - enable: false - spring-session-open: false #开启spring session -logging: - level.root: error - level.com.casic: error - file: - path: logs/ - name: missiles.log \ No newline at end of file diff --git a/src/main/resources/config/application.yml b/src/main/resources/config/application.yml index 4930753..c21dc60 100644 --- a/src/main/resources/config/application.yml +++ b/src/main/resources/config/application.yml @@ -6,6 +6,9 @@ multipart: max-file-size: 50MB max-request-size: 80MB + mvc: + pathmatch: + matching-strategy: ant_path_matcher mybatis-plus: global-config: enable-sql-runner: true @@ -22,13 +25,6 @@ flowable: checkProcessDefinitions: false #不校验process文件 casic: - swagger-open: false #是否开启swagger (true/false) - kaptcha-open: false #是否开启登录时验证码 (true/false) - muti-datasource-open: false #是否开启多数据源(true/false) - spring-session-open: false #是否开启spring session,如果是多机环境需要开启(true/false) - session-invalidate-time: 86400 #session失效时间(只在单机环境下生效,,多机环境在SpringSessionConfig类中配置) 单位:秒 - session-validation-interval: 900 #多久检测一次失效的session(只在单机环境下生效) 单位:秒 - extUrl: sys device: redis: invalid-time: 86400 @@ -36,6 +32,9 @@ port: 6379 password: ew5T4K3#203lwh config-prefix: 'Casic:' - config: - export-path: D:\java\boot\guns-web-1.0.0-SNAPSHOT\export\ - config-path: E:\Develop\IdeaProject\smartcity\casic-smartcity-dcms\casic-web\src\main\resources\config\ \ No newline at end of file + hikom: + url: /artemis/api/video/v1/cameras/previewURLs + host: 118.122.17.165:1443/ +swagger: + enable: true + groupName: "硫化氢课题" \ No newline at end of file