Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
0941f6f6
Commit
0941f6f6
authored
Jan 24, 2022
by
李成龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化特种设备数据对接
parent
c6affcf2
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
167 additions
and
156 deletions
+167
-156
pom.xml
amos-boot-data/amos-boot-data-common/pom.xml
+2
-61
pom.xml
amos-boot-data/amos-boot-data-openapi/pom.xml
+87
-10
ControllerAop.java
.../java/com/yeejoin/amos/api/openapi/aop/ControllerAop.java
+76
-76
CseiController.java
...m/yeejoin/amos/api/openapi/controller/CseiController.java
+0
-1
CylinderController.java
...ejoin/amos/api/openapi/controller/CylinderController.java
+0
-1
FilesController.java
.../yeejoin/amos/api/openapi/controller/FilesController.java
+0
-1
InspectionController.java
...oin/amos/api/openapi/controller/InspectionController.java
+0
-1
LiftController.java
...m/yeejoin/amos/api/openapi/controller/LiftController.java
+0
-1
OpenapiBizTokenController.java
...mos/api/openapi/controller/OpenapiBizTokenController.java
+0
-1
application-cyl.properties
...ata-openapi/src/main/resources/application-cyl.properties
+2
-2
pom.xml
amos-boot-data/pom.xml
+0
-1
No files found.
amos-boot-data/amos-boot-data-common/pom.xml
View file @
0941f6f6
...
@@ -7,72 +7,13 @@
...
@@ -7,72 +7,13 @@
<version>
1.0.0
</version>
<version>
1.0.0
</version>
</parent>
</parent>
<groupId>
com.amosframework.boot
</groupId>
<artifactId>
amos-boot-data-common
</artifactId>
<artifactId>
amos-boot-data-common
</artifactId>
<version>
1.0.0
</version>
<name>
amos-boot-data-common
</name>
<name>
amos-boot-data-common
</name>
<!-- FIXME change it to the project's website -->
<url>
http://www.example.com
</url>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<maven.compiler.source>
1.7
</maven.compiler.source>
<maven.compiler.target>
1.7
</maven.compiler.target>
</properties>
<dependencies>
<dependencies>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.11
</version>
<scope>
test
</scope>
</dependency>
</dependencies>
</dependencies>
<build>
<pluginManagement>
<!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>
maven-clean-plugin
</artifactId>
<version>
3.1.0
</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>
maven-resources-plugin
</artifactId>
<version>
3.0.2
</version>
</plugin>
<plugin>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
3.8.0
</version>
</plugin>
<plugin>
<artifactId>
maven-surefire-plugin
</artifactId>
<version>
2.22.1
</version>
</plugin>
<plugin>
<artifactId>
maven-jar-plugin
</artifactId>
<version>
3.0.2
</version>
</plugin>
<plugin>
<artifactId>
maven-install-plugin
</artifactId>
<version>
2.5.2
</version>
</plugin>
<plugin>
<artifactId>
maven-deploy-plugin
</artifactId>
<version>
2.8.2
</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>
maven-site-plugin
</artifactId>
<version>
3.7.1
</version>
</plugin>
<plugin>
<artifactId>
maven-project-info-reports-plugin
</artifactId>
<version>
3.0.0
</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
</project>
amos-boot-data/amos-boot-data-openapi/pom.xml
View file @
0941f6f6
...
@@ -9,31 +9,46 @@
...
@@ -9,31 +9,46 @@
<version>
1.0.0
</version>
<version>
1.0.0
</version>
</parent>
</parent>
<groupId>
com.amosframework.boot
</groupId>
<artifactId>
amos-boot-data-openapi
</artifactId>
<artifactId>
amos-boot-data-openapi
</artifactId>
<version>
1.0.0
</version>
<name>
amos-boot-data-openapi
</name>
<name>
amos-boot-data-openapi
</name>
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>
com.amosframework.boot
</groupId>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
amos-boot-biz-common
</artifactId>
<artifactId>
spring-cloud-starter-netflix-eureka-client
</artifactId>
<version>
${amos-biz-boot.version}
</version>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.typroject
</groupId>
<groupId>
org.typroject
</groupId>
<artifactId>
tyboot-component-event
</artifactId>
<artifactId>
tyboot-core-foundation
</artifactId>
<version>
${tyboot-version}
</version>
</dependency>
<dependency>
<groupId>
org.typroject
</groupId>
<artifactId>
tyboot-core-restful
</artifactId>
<version>
${tyboot-version}
</version>
<version>
${tyboot-version}
</version>
<exclusions>
<exclusions>
<exclusion>
<exclusion>
<groupId>
org.typroject
</groupId>
<groupId>
org.typroject
</groupId>
<artifactId>
*
</artifactId>
<artifactId>
*
</artifactId>
</exclusion>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.typroject
</groupId>
<artifactId>
tyboot-core-auth
</artifactId>
<version>
${tyboot-version}
</version>
<exclusions>
<exclusion>
<exclusion>
<groupId>
io.springfox
</groupId>
<groupId>
org.typroject
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
<artifactId>
*
</artifactId>
</exclusion>
</exclusion>
</exclusions>
</exclusions>
</dependency>
</dependency>
...
@@ -44,6 +59,17 @@
...
@@ -44,6 +59,17 @@
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.typroject
</groupId>
<groupId>
org.typroject
</groupId>
<artifactId>
tyboot-component-event
</artifactId>
<version>
${tyboot-version}
</version>
<exclusions>
<exclusion>
<groupId>
org.typroject
</groupId>
<artifactId>
*
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.typroject
</groupId>
<artifactId>
tyboot-component-opendata
</artifactId>
<artifactId>
tyboot-component-opendata
</artifactId>
<version>
${tyboot-version}
</version>
<version>
${tyboot-version}
</version>
<exclusions>
<exclusions>
...
@@ -53,11 +79,62 @@
...
@@ -53,11 +79,62 @@
</exclusion>
</exclusion>
</exclusions>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.yeejoin
</groupId>
<groupId>
com.yeejoin
</groupId>
<artifactId>
amos-feign-systemctl
</artifactId>
<artifactId>
amos-feign-systemctl
</artifactId>
<version>
${amos.version}
</version>
<version>
${amos.version}
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.yeejoin
</groupId>
<artifactId>
amos-component-config
</artifactId>
<version>
${amos.version}
</version>
</dependency>
<dependency>
<groupId>
org.typroject
</groupId>
<artifactId>
tyboot-core-rdbms
</artifactId>
<version>
${tyboot-version}
</version>
<exclusions>
<exclusion>
<groupId>
org.typroject
</groupId>
<artifactId>
*
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.typroject
</groupId>
<artifactId>
tyboot-component-cache
</artifactId>
<version>
${tyboot-version}
</version>
<exclusions>
<exclusion>
<groupId>
org.typroject
</groupId>
<artifactId>
*
</artifactId>
</exclusion>
<exclusion>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-redis
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-redis
</artifactId>
<version>
1.4.5.RELEASE
</version>
</dependency>
<dependency>
<groupId>
org.jetbrains
</groupId>
<artifactId>
annotations
</artifactId>
<version>
19.0.0
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
org.codehaus.jettison
</groupId>
<artifactId>
jettison
</artifactId>
<version>
1.3.7
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
<plugins>
<plugins>
...
...
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/aop/ControllerAop.java
View file @
0941f6f6
//
package com.yeejoin.amos.api.openapi.aop;
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
aop
;
//
//
import javax.servlet.http.HttpServletRequest;
import
javax.servlet.http.HttpServletRequest
;
//
//
import org.aspectj.lang.JoinPoint;
import
org.aspectj.lang.JoinPoint
;
//
import org.aspectj.lang.annotation.Aspect;
import
org.aspectj.lang.annotation.Aspect
;
//
import org.aspectj.lang.annotation.Before;
import
org.aspectj.lang.annotation.Before
;
//
import org.aspectj.lang.annotation.Pointcut;
import
org.aspectj.lang.annotation.Pointcut
;
//
import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Autowired
;
//
import org.springframework.core.annotation.Order;
import
org.springframework.core.annotation.Order
;
//
import org.springframework.data.redis.core.RedisTemplate;
import
org.springframework.data.redis.core.RedisTemplate
;
//
import org.springframework.stereotype.Component;
import
org.springframework.stereotype.Component
;
//
import org.springframework.web.context.request.RequestContextHolder;
import
org.springframework.web.context.request.RequestContextHolder
;
//
import org.springframework.web.context.request.ServletRequestAttributes;
import
org.springframework.web.context.request.ServletRequestAttributes
;
//
import org.typroject.tyboot.component.cache.Redis;
import
org.typroject.tyboot.component.cache.Redis
;
//
import org.typroject.tyboot.core.auth.exception.AuthException;
import
org.typroject.tyboot.core.auth.exception.AuthException
;
//
import org.typroject.tyboot.core.foundation.context.RequestContext;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
//
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
//
//
import com.yeejoin.amos.api.openapi.constant.Constant;
import
com.yeejoin.amos.api.openapi.constant.Constant
;
//
import com.yeejoin.amos.api.openapi.face.model.BizTokenModel;
import
com.yeejoin.amos.api.openapi.face.model.BizTokenModel
;
//
import com.yeejoin.amos.component.feign.config.TokenOperation;
import
com.yeejoin.amos.component.feign.config.TokenOperation
;
//
//
@Aspect
@Aspect
//
@Component
@Component
//
@Order(value = 0)
@Order
(
value
=
0
)
//
public class ControllerAop {
public
class
ControllerAop
{
//
//
@Autowired
@Autowired
//
private RedisTemplate redisTemplate;
private
RedisTemplate
redisTemplate
;
//
//
@Pointcut("(execution(public * com.yeejoin.amos.api.openapi.controller..*(..))) ")
@Pointcut
(
"(execution(public * com.yeejoin.amos.api.openapi.controller..*(..))) "
)
//
public void userCache() {
public
void
userCache
()
{
//
//
}
}
//
//
@Before("userCache()")
@Before
(
"userCache()"
)
//
public void doBefore(JoinPoint joinPoint) {
public
void
doBefore
(
JoinPoint
joinPoint
)
{
//
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
ServletRequestAttributes
attributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
//
HttpServletRequest request = attributes.getRequest();
HttpServletRequest
request
=
attributes
.
getRequest
();
//
// 不需要添加请求头的接口
// 不需要添加请求头的接口
//
String[] url = new String[]{"/api/user/selectInfo", "/api/user/save/curCompany","/openapi/bizToken/applyToken","/openapi/bizToken/getAppId","/lift/upload","/lift/status","/lift/run","/lift/fault","/lift/video/preview"};
String
[]
url
=
new
String
[]{
"/api/user/selectInfo"
,
"/api/user/save/curCompany"
,
"/openapi/bizToken/applyToken"
,
"/openapi/bizToken/getAppId"
,
"/lift/upload"
,
"/lift/status"
,
"/lift/run"
,
"/lift/fault"
,
"/lift/video/preview"
};
//
// 获取请求路径
// 获取请求路径
//
for(String uri : url) {
for
(
String
uri
:
url
)
{
//
if(request.getRequestURI().indexOf(uri) != -1) {
if
(
request
.
getRequestURI
().
indexOf
(
uri
)
!=
-
1
)
{
//
return;
return
;
//
}
}
//
}
}
//
//TODO tyboot 框架拦截器已缓存数据
//TODO tyboot 框架拦截器已缓存数据
//
String token = RequestContext.getToken();
String
token
=
RequestContext
.
getToken
();
//
if (ValidationUtil.isEmpty(token)) {
if
(
ValidationUtil
.
isEmpty
(
token
))
{
//
token = request.getParameterMap().get("access_token")[0];
token
=
request
.
getParameterMap
().
get
(
"access_token"
)[
0
];
//
}
}
//
if (token != null) {
if
(
token
!=
null
)
{
//
fillRequestContext(token);
fillRequestContext
(
token
);
//
}
}
//
boolean validToken = TokenOperation.refresh(token);
boolean
validToken
=
TokenOperation
.
refresh
(
token
);
//
if(!validToken) {
if
(!
validToken
)
{
//
throw new AuthException("请求未包含认证信息.");
throw
new
AuthException
(
"请求未包含认证信息."
);
//
}
}
//
}
}
//
//
//
private void fillRequestContext(String token) {
private
void
fillRequestContext
(
String
token
)
{
//
String tokenKey = Redis.genKey(Constant.TOKEN_PREFIX,token);
String
tokenKey
=
Redis
.
genKey
(
Constant
.
TOKEN_PREFIX
,
token
);
//
BizTokenModel bizTokenModel = (BizTokenModel) redisTemplate.opsForValue().get(tokenKey);
BizTokenModel
bizTokenModel
=
(
BizTokenModel
)
redisTemplate
.
opsForValue
().
get
(
tokenKey
);
//
if(null == bizTokenModel) {
if
(
null
==
bizTokenModel
)
{
//
throw new AuthException("请求未包含认证信息.");
throw
new
AuthException
(
"请求未包含认证信息."
);
//
}
}
//
String product = bizTokenModel.getProduct();
String
product
=
bizTokenModel
.
getProduct
();
//
String appKey = bizTokenModel.getAppKey();
String
appKey
=
bizTokenModel
.
getAppKey
();
//
RequestContext.setToken(token);
RequestContext
.
setToken
(
token
);
//
RequestContext.setProduct(product);
RequestContext
.
setProduct
(
product
);
//
RequestContext.setAppKey(appKey);
RequestContext
.
setAppKey
(
appKey
);
//
}
}
//
}
}
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/controller/CseiController.java
View file @
0941f6f6
...
@@ -57,7 +57,6 @@ import io.swagger.annotations.ApiOperation;
...
@@ -57,7 +57,6 @@ import io.swagger.annotations.ApiOperation;
import
net.sf.json.JSONObject
;
import
net.sf.json.JSONObject
;
@RestController
@RestController
@TycloudResource
(
module
=
"openapi"
,
value
=
"csei"
)
@RequestMapping
(
value
=
"/csei"
)
@RequestMapping
(
value
=
"/csei"
)
@Api
(
tags
=
"csei-检验检测数据对接"
)
@Api
(
tags
=
"csei-检验检测数据对接"
)
public
class
CseiController
{
public
class
CseiController
{
...
...
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/controller/CylinderController.java
View file @
0941f6f6
...
@@ -48,7 +48,6 @@ import io.swagger.annotations.ApiOperation;
...
@@ -48,7 +48,6 @@ import io.swagger.annotations.ApiOperation;
import
net.sf.json.JSONObject
;
import
net.sf.json.JSONObject
;
@RestController
@RestController
@TycloudResource
(
module
=
"openapi"
,
value
=
"cylinder"
)
@RequestMapping
(
value
=
"/cylinder"
)
@RequestMapping
(
value
=
"/cylinder"
)
@Api
(
tags
=
"cylinder-气瓶数据对接"
)
@Api
(
tags
=
"cylinder-气瓶数据对接"
)
public
class
CylinderController
{
public
class
CylinderController
{
...
...
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/controller/FilesController.java
View file @
0941f6f6
...
@@ -26,7 +26,6 @@ import io.swagger.annotations.ApiOperation;
...
@@ -26,7 +26,6 @@ import io.swagger.annotations.ApiOperation;
import
net.sf.json.JSONObject
;
import
net.sf.json.JSONObject
;
@RestController
@RestController
@TycloudResource
(
module
=
"openapi"
,
value
=
"filestorage"
)
@RequestMapping
(
value
=
"/filestorage"
)
@RequestMapping
(
value
=
"/filestorage"
)
@Api
(
tags
=
"filestorage-上传附件数据对接"
)
@Api
(
tags
=
"filestorage-上传附件数据对接"
)
public
class
FilesController
{
public
class
FilesController
{
...
...
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/controller/InspectionController.java
View file @
0941f6f6
...
@@ -33,7 +33,6 @@ import net.sf.json.JSONObject;
...
@@ -33,7 +33,6 @@ import net.sf.json.JSONObject;
* @version $Id: InspectionController.java, v 0.1 2021年11月8日 下午6:47:54 gwb Exp $
* @version $Id: InspectionController.java, v 0.1 2021年11月8日 下午6:47:54 gwb Exp $
*/
*/
@RestController
@RestController
@TycloudResource
(
module
=
"openapi"
,
value
=
"inspection"
)
@RequestMapping
(
value
=
"/v1/inspection"
)
@RequestMapping
(
value
=
"/v1/inspection"
)
@Api
(
tags
=
"inspection-特种设备检验对接"
)
@Api
(
tags
=
"inspection-特种设备检验对接"
)
public
class
InspectionController
public
class
InspectionController
...
...
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/controller/LiftController.java
View file @
0941f6f6
...
@@ -40,7 +40,6 @@ import net.sf.json.JSONObject;
...
@@ -40,7 +40,6 @@ import net.sf.json.JSONObject;
* @version $Id: ElevatorStatusController.java, v 0.1 2021年9月28日 上午9:11:38 gwb Exp $
* @version $Id: ElevatorStatusController.java, v 0.1 2021年9月28日 上午9:11:38 gwb Exp $
*/
*/
@RestController
@RestController
@TycloudResource
(
module
=
"openapi"
,
value
=
"lift"
)
@RequestMapping
(
value
=
"/lift"
)
@RequestMapping
(
value
=
"/lift"
)
@Api
(
tags
=
"lift-电梯物联对接"
)
@Api
(
tags
=
"lift-电梯物联对接"
)
public
class
LiftController
public
class
LiftController
...
...
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/controller/OpenapiBizTokenController.java
View file @
0941f6f6
...
@@ -41,7 +41,6 @@ import net.sf.json.JSONObject;
...
@@ -41,7 +41,6 @@ import net.sf.json.JSONObject;
* @version $Id: InspectionController.java, v 0.1 2021年11月8日 下午6:47:54 gwb Exp $
* @version $Id: InspectionController.java, v 0.1 2021年11月8日 下午6:47:54 gwb Exp $
*/
*/
@RestController
@RestController
@TycloudResource
(
module
=
"openapi"
,
value
=
"bizToken"
)
@RequestMapping
(
value
=
"/bizToken"
)
@RequestMapping
(
value
=
"/bizToken"
)
@Api
(
tags
=
"bizToken-企业数据对接票据管理"
)
@Api
(
tags
=
"bizToken-企业数据对接票据管理"
)
public
class
OpenapiBizTokenController
public
class
OpenapiBizTokenController
...
...
amos-boot-data/amos-boot-data-openapi/src/main/resources/application-cyl.properties
View file @
0941f6f6
spring.application.name
=
AMOS-API-OPENAPI
-CYL
spring.application.name
=
AMOS-API-OPENAPI
server.servlet.context-path
=
/openapi
cyl
server.servlet.context-path
=
/openapi
server.port
=
11001
server.port
=
11001
# jdbc_config
# jdbc_config
spring.datasource.url
=
jdbc:mysql://113.134.211.174:3308/amos_openapi_cylinder?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&serverTimezone=GMT%2B8
spring.datasource.url
=
jdbc:mysql://113.134.211.174:3308/amos_openapi_cylinder?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&serverTimezone=GMT%2B8
...
...
amos-boot-data/pom.xml
View file @
0941f6f6
...
@@ -8,7 +8,6 @@
...
@@ -8,7 +8,6 @@
</parent>
</parent>
<artifactId>
amos-boot-data
</artifactId>
<artifactId>
amos-boot-data
</artifactId>
<version>
1.0.0
</version>
<packaging>
pom
</packaging>
<packaging>
pom
</packaging>
<name>
amos-boot-data
</name>
<name>
amos-boot-data
</name>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment