Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-standard-interfaces-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 252dc1de
authored
Aug 25, 2021
by
刘宇峰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
新e盾标准接口提供给外部的api依赖
0 parents
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
161 additions
and
0 deletions
pom.xml
src/main/java/cn/com/glsx/stdinterface/api/StatisticsDriveClient.java
src/main/java/cn/com/glsx/stdinterface/dto/StatisticsDriveDto.java
src/main/java/cn/com/glsx/stdinterface/factory/StatisticsDriveFallbackFactory.java
src/main/java/cn/com/glsx/stdinterface/fallback/StatisticsDriveFallbackImpl.java
src/main/resources/META-INF/spring.factories
pom.xml
0 → 100644
View file @
252dc1d
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
glsx-ne-shield
</artifactId>
<groupId>
com.glsx
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
ne-shield-standard-interfaces-api
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<packaging>
jar
</packaging>
<dependencies>
<!-- feign -->
<dependency>
<groupId>
com.glsx
</groupId>
<artifactId>
rest-admin-feign
</artifactId>
<scope>
compile
</scope>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>
nexus-releases
</id>
<name>
Local Nexus Releases Repository
</name>
<url>
http://192.168.3.233/nexus/content/repositories/releases/
</url>
</repository>
<snapshotRepository>
<id>
nexus-snapshots
</id>
<name>
Local Nexus Snapshots Repository
</name>
<url>
http://192.168.3.233/nexus/content/repositories/snapshots/
</url>
</snapshotRepository>
</distributionManagement>
</project>
\ No newline at end of file
src/main/java/cn/com/glsx/stdinterface/api/StatisticsDriveClient.java
0 → 100644
View file @
252dc1d
package
cn
.
com
.
glsx
.
stdinterface
.
api
;
import
cn.com.glsx.stdinterface.dto.StatisticsDriveDto
;
import
cn.com.glsx.stdinterface.factory.StatisticsDriveFallbackFactory
;
import
com.glsx.plat.core.web.R
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
java.util.List
;
/**
* @author zhouhaibao
* @date 2021/5/24 9:49
*/
@FeignClient
(
name
=
"ne-shield-standard-interfaces"
,
path
=
"/stdinterface/statisticsdrive"
,
fallbackFactory
=
StatisticsDriveFallbackFactory
.
class
,
decode404
=
true
)
public
interface
StatisticsDriveClient
{
/**
* 获取数据集合
*
* @return R
*/
@GetMapping
(
value
=
"/drivedatalist"
)
R
statisticsDriveDataEveryDay
();
/**
* 插入数据
*
* @param statisticsDriveDtoList
* @return R
*/
@PostMapping
(
value
=
"/insertstatisticsdrivelist"
)
R
insertStatisticsDriveList
(
@RequestBody
List
<
StatisticsDriveDto
>
statisticsDriveDtoList
);
}
src/main/java/cn/com/glsx/stdinterface/dto/StatisticsDriveDto.java
0 → 100644
View file @
252dc1d
package
cn
.
com
.
glsx
.
stdinterface
.
dto
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* 试驾统计数据
*/
@Data
public
class
StatisticsDriveDto
implements
Serializable
{
/**
* 设备号
*/
private
String
sn
;
/**
* 当天有效试驾次数
*/
private
Integer
driveNum
;
/**
* 当天试驾总次数
*/
private
Integer
driveTotal
;
/**
* 试驾日期
*/
private
String
driveTime
;
}
\ No newline at end of file
src/main/java/cn/com/glsx/stdinterface/factory/StatisticsDriveFallbackFactory.java
0 → 100644
View file @
252dc1d
package
cn
.
com
.
glsx
.
stdinterface
.
factory
;
import
cn.com.glsx.stdinterface.api.StatisticsDriveClient
;
import
cn.com.glsx.stdinterface.fallback.StatisticsDriveFallbackImpl
;
import
feign.hystrix.FallbackFactory
;
import
org.springframework.stereotype.Component
;
/**
* 项目名:ne-shield-insurancenter-api
* 包名: cn.com.glsx.insurance.factory
* 作者: Yanglinlong
* 日期: 2021/7/5 16:15
*/
@Component
public
class
StatisticsDriveFallbackFactory
implements
FallbackFactory
<
StatisticsDriveClient
>
{
@Override
public
StatisticsDriveClient
create
(
Throwable
throwable
)
{
StatisticsDriveFallbackImpl
fallback
=
new
StatisticsDriveFallbackImpl
();
fallback
.
setCause
(
throwable
);
return
fallback
;
}
}
src/main/java/cn/com/glsx/stdinterface/fallback/StatisticsDriveFallbackImpl.java
0 → 100644
View file @
252dc1d
package
cn
.
com
.
glsx
.
stdinterface
.
fallback
;
import
cn.com.glsx.stdinterface.api.StatisticsDriveClient
;
import
cn.com.glsx.stdinterface.dto.StatisticsDriveDto
;
import
com.glsx.plat.core.web.R
;
import
lombok.Setter
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
/**
* 项目名:ne-shield-insurancenter-api
* 包名: cn.com.glsx.insurance.fallback
* 作者: Yanglinlong
* 日期: 2021/7/5 16:16
*/
@Slf4j
@Component
public
class
StatisticsDriveFallbackImpl
implements
StatisticsDriveClient
{
@Setter
private
Throwable
cause
;
@Override
public
R
statisticsDriveDataEveryDay
()
{
log
.
warn
(
"statisticsDriveDataEveryDay 熔断啦 {}"
,
cause
.
getMessage
());
return
R
.
ok
(
"服务异常"
);
}
@Override
public
R
insertStatisticsDriveList
(
List
<
StatisticsDriveDto
>
statisticsDriveDtoList
)
{
log
.
warn
(
"insertStatisticsDriveList 熔断啦 {}"
,
cause
.
getMessage
());
return
R
.
ok
(
"服务异常"
);
}
}
src/main/resources/META-INF/spring.factories
0 → 100644
View file @
252dc1d
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
cn.com.glsx.stdinterface.fallback.StatisticsDriveFallbackImpl,\
cn.com.glsx.stdinterface.factory.StatisticsDriveFallbackFactory
Write
Preview
Markdown
is supported
Attach a file
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 post a comment