Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
extend
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
park
extend
Commits
4787423d
Commit
4787423d
authored
Jun 18, 2020
by
xieshixiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
三方接口功能开发
parent
5660dfd4
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
328 additions
and
163 deletions
+328
-163
api/pom.xml
+44
-6
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/BindInfoControlller.java
+49
-1
api/src/main/resources/application-dev.properties
+73
-0
api/src/main/resources/application.properties
+2
-74
api/src/main/resources/logback.xml
+28
-38
domain/pom.xml
+9
-0
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/IBindService.java
+6
-1
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
+32
-1
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/core/Result.java
+39
-18
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/core/enums/ResultCode.java
+15
-15
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/feign/UserDataFegin.java
+16
-0
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/mapper/BindInfoMapper.java
+5
-0
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/model/BindInfo.java
+2
-2
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/model/BindInfoQuery.java
+7
-7
pom.xml
+1
-0
No files found.
api/pom.xml
View file @
4787423d
...
@@ -14,19 +14,17 @@
...
@@ -14,19 +14,17 @@
<name>
api
</name>
<name>
api
</name>
<description>
对外暴露接口api
</description>
<description>
对外暴露接口api
</description>
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>
com.hikcreate.edl.pub.web.mobile
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
infra
</artifactId>
<artifactId>
spring-boot-starter-web
</artifactId>
<version>
${parent.version}
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-
web
</artifactId>
<artifactId>
spring-boot-starter-
actuator
</artifactId>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-eureka-client
</artifactId>
<artifactId>
spring-cloud-starter-netflix-eureka-client
</artifactId>
...
@@ -37,6 +35,46 @@
...
@@ -37,6 +35,46 @@
<artifactId>
apollo-client
</artifactId>
<artifactId>
apollo-client
</artifactId>
<version>
${appllo.version}
</version>
<version>
${appllo.version}
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.hikcreate.edl.pub.web.mobile
</groupId>
<artifactId>
domain
</artifactId>
<version>
${parent.version}
</version>
</dependency>
<dependency>
<groupId>
com.hikcreate.edl.pub.web.mobile
</groupId>
<artifactId>
infra
</artifactId>
<version>
${parent.version}
</version>
</dependency>
</dependencies>
</dependencies>
<profiles>
<profile>
<!-- 本地开发环境 -->
<id>
dev
</id>
<properties>
<profiles.active>
dev
</profiles.active>
</properties>
<activation>
<!-- 设置默认激活这个配置 -->
<activeByDefault>
true
</activeByDefault>
</activation>
</profile>
<profile>
<!-- 生产环境 -->
<id>
pro
</id>
<properties>
<profiles.active>
pro
</profiles.active>
</properties>
</profile>
<profile>
<!-- 测试环境 -->
<id>
test
</id>
<properties>
<profiles.active>
test
</profiles.active>
</properties>
</profile>
</profiles>
</project>
</project>
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/controller/BindInfoControlller.java
View file @
4787423d
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
api
.
controller
;
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
api
.
controller
;
import
cn.hutool.core.date.DateTime
;
import
com.hikcreate.edl.pub.web.mobile.domain.IBindService
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.Result
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.Result
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.enums.ResultCode
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.page.PageResult
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.mapper.BindInfoMapper
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.mapper.BindInfoMapper
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.BindInfoQuery
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
/**
/**
* description:绑定信息的controller
* description:绑定信息的controller
*
*
...
@@ -19,11 +28,50 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -19,11 +28,50 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RestController
@RequestMapping
(
"/vehicle"
)
@RequestMapping
(
"/vehicle"
)
@Slf4j
@Slf4j
public
class
BindInfoControlller
{
public
class
BindInfoControlller
extends
BaseController
{
@Autowired
IBindService
service
;
@Resource
BindInfoMapper
mapper
;
@PostMapping
(
"bind"
)
public
Result
bindInfo
(
@RequestBody
BindInfo
info
)
{
if
(
info
==
null
)
{
return
Result
.
errorResult
(
ResultCode
.
PARAMETER_ERROR
,
"参数不能为空"
);
}
return
service
.
bind
(
info
);
}
@PostMapping
(
"unbind"
)
public
Result
unbindInfo
(
@RequestBody
BindInfo
info
)
{
if
(
info
==
null
)
{
return
Result
.
errorResult
(
ResultCode
.
PARAMETER_ERROR
,
"参数不能为空"
);
}
info
.
setEditorTime
(
new
DateTime
());
return
mapper
.
updateById
(
info
)
>
0
?
Result
.
successResult
()
:
Result
.
errorResult
();
}
@PostMapping
(
"query"
)
public
Result
bindInfoQery
(
@RequestBody
BindInfoQuery
query
)
{
if
(
query
==
null
)
{
return
Result
.
errorResult
(
ResultCode
.
PARAMETER_ERROR
,
"参数不能为空"
);
}
return
Result
.
successResult
(
mapper
.
selectByQuery
(
query
));
}
@GetMapping
(
"authentication"
)
public
Result
authority
(
@RequestBody
BindInfoQuery
query
)
{
if
(
query
==
null
)
{
return
Result
.
errorResult
(
ResultCode
.
PARAMETER_ERROR
,
"参数不能为空"
);
}
PageResult
<
BindInfo
>
bindInfos
=
mapper
.
selectByQuery
(
query
);
return
bindInfos
.
getAllCount
()
>
0
?
Result
.
successResult
(
bindInfos
)
:
Result
.
errorResult
(
ResultCode
.
HASH_NO_PRIVILEGE
);
}
}
}
api/src/main/resources/application-dev.properties
0 → 100644
View file @
4787423d
server.port
=
60201
#数据源配置
spring.datasource.url
=
jdbc:mysql://10.197.236
\
.152:3306/edl_public?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8&useAffectedRows=true&useSSL
\
=false&zeroDateTimeBehavior=convertToNull
spring.datasource.username
=
root
spring.datasource.password
=
123456
spring.datasource.type
=
com.alibaba.druid.pool.DruidDataSource
spring.datasource.driver-class-name
=
com.mysql.cj.jdbc.Driver
# 连接池配置
# 初始化时建立物理连接的个数。初始化发生在显示调用init方法,或者第一次getConnection时
spring.datasource.druid.initial-size
=
0
# 最大连接池数量
spring.datasource.druid.max-active
=
80
spring.datasource.druid.min-idle
=
2
# 获取连接时最大等待时间,单位毫秒。配置了maxWait之后,缺省启用公平锁,并发效率会有所下降,如果需要可以通过配置useUnfairLock属性为true使用非公平锁。
spring.datasource.druid.max-wait
=
8000
# 使用非公平锁。
spring.datasource.druid.use-unfair-lock
=
true
# 是否缓存preparedStatement,也就是PSCache。PSCache对支持游标的数据库性能提升巨大,比如说oracle。
# 在mysql5.5以下的版本中没有PSCache功能,建议关闭掉。5.5及以上版本有PSCache,建议开启。
spring.datasource.druid.pool-prepared-statements
=
true
# 为每个连接缓存的preparedStatement的最大数量
spring.datasource.druid.max-pool-prepared-statement-per-connection-size
=
20
# 要启用PSCache,必须配置大于0,当大于0时,poolPreparedStatements自动触发修改为true。在Druid中,不会存在Oracle下PSCache占用内存过多的问题,可以把这个数值配置大一些,比如说100
spring.datasource.druid.max-open-prepared-statements
=
100
# 设置SQL的执行超时时间,单位:秒。当SQL超时会直接被取消掉并且抛出QLTimeoutException异常。底层调用jdbc Statement对象的void setQueryTimeout(int seconds)方法
spring.datasource.druid.validation-query-timeout
=
-1
# 用来检测连接是否有效的sql,要求是一个查询语句。如果validationQuery为null,testOnBorrow、testOnReturn、testWhileIdle都不会起作用
spring.datasource.druid.validation-query
=
SELECT NOW()
# 申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。
spring.datasource.druid.test-on-borrow
=
false
# 归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。
spring.datasource.druid.test-on-return
=
false
# 申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。建议配置为true,不影响性能,并且保证安全性。
spring.datasource.druid.test-while-idle
=
true
# 连接池中的minIdle数量以内的连接,空闲时间超过minEvictableIdleTimeMillis,则会执行keepAlive操作。
spring.datasource.druid.keep-alive
=
true
# 执行查询的超时时间(秒),执行Statement对象时如果超过此时间,则抛出SQLException
spring.datasource.druid.query-timeout
=
5
# 执行一个事务的超时时间(秒),执行Statement对象时判断是否为事务,如果是且此项未设置,则使用queryTimeout
spring.datasource.druid.transaction-query-timeout
=
10
#有两个含义:
# 1) Destroy线程会检测连接的间隔时间,如果连接空闲时间大于等于minEvictableIdleTimeMillis则关闭物理连接。
# 2) testWhileIdle的判断依据,详细看testWhileIdle属性的说明
spring.datasource.druid.time-between-eviction-runs-millis
=
45000
# spring.druid.time-between-log-stats-millis = 1000
# 连接保持空闲而不被驱逐的最小时间 (30*60*1000=30分钟)
spring.datasource.druid.min-evictable-idle-time-millis
=
90000
# 每隔timeBetweenEvictionRunsMillis进行一次shrink(连接池大小收缩),shrink之后检测是否强制关闭连接时长大于removeAbandonedTimeoutMillis的连接
spring.datasource.druid.remove-abandoned
=
true
# 一个连接从被连接到被关闭之间的最大生命周期
spring.datasource.druid.remove-abandoned-timeout
=
1800
# spring.druid.filters = #配置多个英文逗号分隔
# 监控配置
spring.datasource.druid.filter.stat.log-slow-sql
=
true
spring.datasource.druid.filter.stat.slow-sql-millis
=
1000
#mybatis配置
mybatis-plus.mapperLocations
=
classpath*:**/mapper/**/*Mapper.xml
mybatis-plus.configuration.log-impl
=
org.apache.ibatis.logging.stdout.StdOutImpl
#eureka配置
eureka.client.serviceUrl.defaultZone
=
http://10.197.236.100:8761/eureka
eureka.client.healthcheck.enabled
=
true
eureka.instance.lease-renewal-interval-in-seconds
=
5
eureka.instance.lease-expiration-duration-in-seconds
=
10
eureka.instance.preferIpAddress
=
false
eureka.instance.instance-id
=
${eureka.instance.hostname}:${spring.application.name}:${server.port}
api/src/main/resources/application.properties
View file @
4787423d
spring.profiles.active
=
dev
spring.application.name
=
park
serviceUri
=
http://10.197.236.214:60201
server.port
=
60201
#数据源配置
spring.datasource.url
=
jdbc:mysql://10.197.236
\
.152:3306/edl_public?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8&useAffectedRows=true&useSSL
\
=false&zeroDateTimeBehavior=convertToNull
spring.datasource.username
=
root
spring.datasource.password
=
123456
spring.datasource.type
=
com.alibaba.druid.pool.DruidDataSource
spring.datasource.driver-class-name
=
com.mysql.cj.jdbc.Driver
# 连接池配置
# 初始化时建立物理连接的个数。初始化发生在显示调用init方法,或者第一次getConnection时
spring.datasource.druid.name
=
spring.datasource.druid.initial-size
=
0
# 最大连接池数量
spring.datasource.druid.max-active
=
80
spring.datasource.druid.min-idle
=
2
# 获取连接时最大等待时间,单位毫秒。配置了maxWait之后,缺省启用公平锁,并发效率会有所下降,如果需要可以通过配置useUnfairLock属性为true使用非公平锁。
spring.datasource.druid.max-wait
=
8000
# 使用非公平锁。
spring.datasource.druid.use-unfair-lock
=
true
# 是否缓存preparedStatement,也就是PSCache。PSCache对支持游标的数据库性能提升巨大,比如说oracle。
# 在mysql5.5以下的版本中没有PSCache功能,建议关闭掉。5.5及以上版本有PSCache,建议开启。
spring.datasource.druid.pool-prepared-statements
=
true
# 为每个连接缓存的preparedStatement的最大数量
spring.datasource.druid.max-pool-prepared-statement-per-connection-size
=
20
# 要启用PSCache,必须配置大于0,当大于0时,poolPreparedStatements自动触发修改为true。在Druid中,不会存在Oracle下PSCache占用内存过多的问题,可以把这个数值配置大一些,比如说100
spring.datasource.druid.max-open-prepared-statements
=
100
# 设置SQL的执行超时时间,单位:秒。当SQL超时会直接被取消掉并且抛出QLTimeoutException异常。底层调用jdbc Statement对象的void setQueryTimeout(int seconds)方法
spring.datasource.druid.validation-query-timeout
=
-1
# 用来检测连接是否有效的sql,要求是一个查询语句。如果validationQuery为null,testOnBorrow、testOnReturn、testWhileIdle都不会起作用
spring.datasource.druid.validation-query
=
SELECT NOW()
# 申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。
spring.datasource.druid.test-on-borrow
=
false
# 归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。
spring.datasource.druid.test-on-return
=
false
# 申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。建议配置为true,不影响性能,并且保证安全性。
spring.datasource.druid.test-while-idle
=
true
# 连接池中的minIdle数量以内的连接,空闲时间超过minEvictableIdleTimeMillis,则会执行keepAlive操作。
spring.datasource.druid.keep-alive
=
true
# 执行查询的超时时间(秒),执行Statement对象时如果超过此时间,则抛出SQLException
spring.datasource.druid.query-timeout
=
5
# 执行一个事务的超时时间(秒),执行Statement对象时判断是否为事务,如果是且此项未设置,则使用queryTimeout
spring.datasource.druid.transaction-query-timeout
=
10
#有两个含义:
# 1) Destroy线程会检测连接的间隔时间,如果连接空闲时间大于等于minEvictableIdleTimeMillis则关闭物理连接。
# 2) testWhileIdle的判断依据,详细看testWhileIdle属性的说明
spring.datasource.druid.time-between-eviction-runs-millis
=
45000
# spring.druid.time-between-log-stats-millis = 1000
# 连接保持空闲而不被驱逐的最小时间 (30*60*1000=30分钟)
spring.datasource.druid.min-evictable-idle-time-millis
=
90000
# 每隔timeBetweenEvictionRunsMillis进行一次shrink(连接池大小收缩),shrink之后检测是否强制关闭连接时长大于removeAbandonedTimeoutMillis的连接
spring.datasource.druid.remove-abandoned
=
true
# 一个连接从被连接到被关闭之间的最大生命周期
spring.datasource.druid.remove-abandoned-timeout
=
1800
# spring.druid.filters = #配置多个英文逗号分隔
# 监控配置
spring.datasource.druid.filter.stat.log-slow-sql
=
true
spring.datasource.druid.filter.stat.slow-sql-millis
=
1000
#mybatis配置
mybatis-plus.mapperLocations
=
classpath*:**/mapper/**/*Mapper.xml
mybatis-plus.configuration.log-impl
=
org.apache.ibatis.logging.stdout.StdOutImpl
#eureka配置
spring.application.name
=
park
eureka.client.serviceUrl.defaultZone
=
http://10.197.236.100:8761/eureka
eureka.client.healthcheck.enabled
=
true
eureka.instance.lease-renewal-interval-in-seconds
=
5
eureka.instance.lease-expiration-duration-in-seconds
=
10
eureka.instance.preferIpAddress
=
false
eureka.instance.hostname
=
${spring.cloud.client.ip-address}
eureka.instance.instance-id
=
${eureka.instance.hostname}:${spring.application.name}:${server.port}
api/src/main/resources/logback.xml
View file @
4787423d
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<configuration
scan=
"true"
scanPeriod=
"60 seconds"
debug=
"false"
>
<configuration
scan=
"true"
scanPeriod=
"60 seconds"
debug=
"false"
>
<springProperty
scope=
"context"
name=
"logPath"
source=
"logging.path"
defaultValue=
"../../log"
/>
<!-- <springProperty scope="context" name="logPath" source="logging.path" defaultValue="../../log"/>-->
<property
name=
"logPath"
value=
"../../../log/park"
/>
<property
name=
"appName"
value=
"park"
/>
<property
name=
"appName"
value=
"bmc"
/>
<property
name=
"moduleName"
value=
"park"
/>
<property
name=
"moduleName"
value=
"pub-web-mobile"
/>
<!-- 文档保留天数 -->
<!-- 文档保留天数 -->
<property
name=
"maxHistory"
value=
"
3
0"
/>
<property
name=
"maxHistory"
value=
"
1
0"
/>
<!-- 文档保留总大小 -->
<!-- 文档保留总大小 -->
<property
name=
"totalSizeCap"
value=
"10GB"
/>
<property
name=
"totalSizeCap"
value=
"10GB"
/>
<!-- 日志文件大小 -->
<property
name=
"maxFileSize"
value=
"100MB"
/>
<property
name=
"CONSOLE_LOG_PATTERN"
<property
name=
"CONSOLE_LOG_PATTERN"
value=
"%cyan(%d)|%highlight(%level)|${moduleName},%X{
_API_URL},%X{X-B3-TraceId},%X{X-B3-SpanId},%X{X-Span-Export}|%X{_USER_ID
}|%yellow(%thread)|%blue(%logger{36}:%line)|%msg%n"
/>
value=
"%cyan(%d)|%highlight(%level)|${moduleName},%X{
X-B3-TraceId},%X{X-B3-SpanId},%X{X-Span-Export
}|%yellow(%thread)|%blue(%logger{36}:%line)|%msg%n"
/>
<!--没有颜色-->
<!--没有颜色-->
<property
name=
"FILE_LOG_PATTERN"
<property
name=
"FILE_LOG_PATTERN"
value=
"%d|%level|${moduleName},%X{_API_URL},%X{X-B3-TraceId},%X{X-B3-SpanId},%X{X-Span-Export}|%X{_USER_ID}|%thread|%logger{36}:%line|%msg%n"
/>
value=
"%d|%level|${moduleName},%X{X-B3-TraceId},%X{X-B3-SpanId},%X{X-Span-Export}|%thread|%logger{36}:%line|%msg%n"
/>
<!--%X{requestId}-->
<!--%X{requestId}-->
<!--输出到控制台 ConsoleAppender-->
<!--输出到控制台 ConsoleAppender-->
<appender
name=
"console
Log
"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<appender
name=
"console"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<layout
class=
"ch.qos.logback.classic.PatternLayout"
>
<layout
class=
"ch.qos.logback.classic.PatternLayout"
>
<pattern>
${CONSOLE_LOG_PATTERN}
</pattern>
<pattern>
${CONSOLE_LOG_PATTERN}
</pattern>
</layout>
</layout>
</appender>
</appender>
<appender
name=
"
fileInfoLog
"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<appender
name=
"
rollingFile
"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<!--日志名称,如果没有File 属性,那么只会使用FileNamePattern的文件路径规则
<!--日志名称,如果没有File 属性,那么只会使用FileNamePattern的文件路径规则
如果同时有<File>和<FileNamePattern>,那么当天日志是<File>,明天会自动把今天
如果同时有<File>和<FileNamePattern>,那么当天日志是<File>,明天会自动把今天
的日志改名为今天的日期。即,<File> 的日志都是当天的。
的日志改名为今天的日期。即,<File> 的日志都是当天的。
-->
-->
<File>
${logPath}/${appName}-${moduleName}.log
</File>
<File>
${logPath}/${appName}-${moduleName}.log
</File>
<!--滚动策略,按照时间滚动 TimeBasedRollingPolicy-->
<!--滚动策略,按照时间滚动 TimeBasedRollingPolicy-->
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.
SizeAnd
TimeBasedRollingPolicy"
>
<!--文件路径,定义了日志的切分方式——把每一天的日志归档到一个文件中,以防止日志填满整个磁盘空间-->
<!--文件路径,定义了日志的切分方式——把每一天的日志归档到一个文件中,以防止日志填满整个磁盘空间-->
<FileNamePattern>
${logPath}/${appName}-${moduleName}.log.%d{yyyy-MM-dd}
</FileNamePattern>
<FileNamePattern>
${logPath}/${appName}-${moduleName}.log.%d{yyyy-MM-dd}
.%i
</FileNamePattern>
<!--只保留最近
90天
的日志-->
<!--只保留最近
天数
的日志-->
<maxHistory>
${maxHistory}
</maxHistory>
<maxHistory>
${maxHistory}
</maxHistory>
<!--用来指定日志文件的上限大小,那么到了这个值,就会删除旧的日志-->
<!--用来指定日志文件的上限大小,那么到了这个值,就会删除旧的日志-->
<totalSizeCap>
${totalSizeCap}
</totalSizeCap>
<totalSizeCap>
${totalSizeCap}
</totalSizeCap>
<maxFileSize>
${maxFileSize}
</maxFileSize>
<cleanHistoryOnStart>
true
</cleanHistoryOnStart>
</rollingPolicy>
</rollingPolicy>
<!--日志输出编码格式化-->
<!--日志输出编码格式化-->
<encoder>
<encoder>
<charset>
UTF-8
</charset>
<charset>
UTF-8
</charset>
...
@@ -46,32 +54,13 @@
...
@@ -46,32 +54,13 @@
</encoder>
</encoder>
</appender>
</appender>
<appender
name=
"ASYNC"
class=
"ch.qos.logback.classic.AsyncAppender"
>
<!-- 在程序的开发测试阶段,可以调整level的级别,常用级别优先级为: -->
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 -->
<!-- TRACE < DEBUG < INFO < WARN < ERROR -->
<discardingThreshold>
0
</discardingThreshold>
<logger
name=
"org.springframework.boot"
level=
"WARN"
/>
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
<logger
name=
"com.netflix.discovery.shared.resolver.aws.ConfigClusterResolver"
level=
"WARN"
/>
<queueSize>
2048
</queueSize>
<includeCallerData>
true
</includeCallerData>
<!-- 添加附加的appender,最多只能添加一个 -->
<appender-ref
ref=
"fileInfoLog"
/>
</appender>
<springProfile
name=
"dev,local"
>
<logger
name=
"root"
level=
"INFO"
additivity=
"false"
>
<appender-ref
ref=
"consoleLog"
/>
<appender-ref
ref=
"ASYNC"
/>
</logger>
</springProfile>
<springProfile
name=
"test"
>
<logger
name=
"root"
level=
"INFO"
additivity=
"false"
>
<logger
name=
"root"
level=
"INFO"
additivity=
"false"
>
<appender-ref
ref=
"console"
/>
<appender-ref
ref=
"ASYNC"
/>
<appender-ref
ref=
"rollingFile"
/>
<appender-ref
ref=
"consoleLog"
/>
</logger>
</logger>
</springProfile>
<springProfile
name=
"pro,ys"
>
<logger
name=
"root"
level=
"INFO"
additivity=
"false"
>
<appender-ref
ref=
"ASYNC"
/>
</logger>
</springProfile>
</configuration>
</configuration>
\ No newline at end of file
domain/pom.xml
View file @
4787423d
...
@@ -14,4 +14,13 @@
...
@@ -14,4 +14,13 @@
<name>
domain
</name>
<name>
domain
</name>
<description>
服务模块
</description>
<description>
服务模块
</description>
<dependencies>
<dependency>
<groupId>
com.hikcreate.edl.pub.web.mobile
</groupId>
<artifactId>
infra
</artifactId>
<version>
${parent.version}
</version>
</dependency>
</dependencies>
</project>
</project>
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/IBindService.java
View file @
4787423d
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
domain
;
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
domain
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.Result
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo
;
/**
/**
* description: 客户绑定服务接口
* description: 客户绑定服务接口
*
*
* @author: xieshixiang
* @author: xieshixiang
* @time:2020/6/18 16:11
* @time:2020/6/18 16:11
**/
**/
public
interface
IBindService
{
public
interface
IBindService
extends
IService
<
BindInfo
>
{
Result
bind
(
BindInfo
info
);
}
}
domain/src/main/java/com/hikcreate/edl/pub/web/mobile/domain/impl/BindServiceImpl.java
View file @
4787423d
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
domain
.
impl
;
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
domain
.
impl
;
import
cn.hutool.core.date.DateTime
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.hikcreate.edl.pub.web.mobile.domain.IBindService
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.Result
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.enums.ResultCode
;
import
com.hikcreate.edl.pub.web.mobile.infra.data.mapper.BindInfoMapper
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.UUID
;
/**
/**
* description:客户绑定服务实现类
* description:客户绑定服务实现类
*
*
* @author: xieshixiang
* @author: xieshixiang
* @time:2020/6/18 16:12
* @time:2020/6/18 16:12
**/
**/
public
class
BindServiceImpl
{
@Service
public
class
BindServiceImpl
extends
ServiceImpl
<
BindInfoMapper
,
BindInfo
>
implements
IBindService
{
@Resource
BindInfoMapper
mapper
;
@Override
public
Result
bind
(
BindInfo
info
)
{
info
.
setUnqId
(
UUID
.
randomUUID
().
toString
());
info
.
setEditorTime
(
new
DateTime
());
//判断规则1:用户已绑定的车辆不超过3辆
QueryWrapper
boundQuery
=
new
QueryWrapper
();
boundQuery
.
eq
(
"user_id"
,
info
.
getUserId
());
Integer
bound
=
mapper
.
selectCount
(
boundQuery
);
if
(
bound
>=
3
)
{
return
Result
.
errorResult
(
ResultCode
.
SERVICE_ERROR
,
"您的绑定名额已用完!"
);
}
return
null
;
}
}
}
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/core/Result.java
View file @
4787423d
...
@@ -15,14 +15,15 @@ import lombok.NoArgsConstructor;
...
@@ -15,14 +15,15 @@ import lombok.NoArgsConstructor;
public
class
Result
<
T
>
{
public
class
Result
<
T
>
{
private
boolean
success
;
private
boolean
success
;
private
String
m
essage
;
private
String
m
sg
;
private
String
code
;
private
String
code
;
private
String
codeMean
;
private
T
data
;
private
T
data
;
public
static
<
T
>
Result
<
T
>
createResult
(
boolean
isSuccess
,
String
mes
,
T
data
,
String
code
)
{
public
static
<
T
>
Result
<
T
>
createResult
(
boolean
isSuccess
,
String
mes
,
T
data
,
String
code
)
{
Result
<
T
>
result
=
new
Result
<
T
>();
Result
<
T
>
result
=
new
Result
<
T
>();
if
(
mes
!=
null
&&
!
mes
.
isEmpty
())
{
if
(
mes
!=
null
&&
!
mes
.
isEmpty
())
{
result
.
setM
essage
(
mes
);
result
.
setM
sg
(
mes
);
}
}
if
(
data
!=
null
)
{
if
(
data
!=
null
)
{
result
.
setData
(
data
);
result
.
setData
(
data
);
...
@@ -32,16 +33,18 @@ public class Result<T> {
...
@@ -32,16 +33,18 @@ public class Result<T> {
return
result
;
return
result
;
}
}
public
static
<
T
>
Result
<
T
>
createResult
(
ResultCode
code
,
T
data
)
{
public
static
<
T
>
Result
<
T
>
createResult
(
ResultCode
code
,
String
mes
,
T
data
)
{
Result
<
T
>
result
=
new
Result
<
T
>();
Result
<
T
>
result
=
new
Result
<
T
>();
if
(
code
.
getMessage
()
!=
null
&&
!
code
.
getMessage
().
isEmpty
())
{
if
(
code
.
getMean
()
!=
null
&&
!
code
.
getMean
().
isEmpty
())
{
result
.
setMessage
(
code
.
getMessage
());
result
.
setCodeMean
(
code
.
getMean
());
}
if
(
mes
!=
null
&&
!
mes
.
isEmpty
())
{
result
.
setMsg
(
mes
);
}
}
if
(
data
!=
null
)
{
if
(
data
!=
null
)
{
result
.
setData
(
data
);
result
.
setData
(
data
);
}
}
result
.
setSuccess
(
code
.
isSuccess
());
result
.
setSuccess
(
code
.
isSuccess
());
result
.
setCode
(
code
.
getCode
());
result
.
setCode
(
code
.
getCode
());
return
result
;
return
result
;
...
@@ -49,23 +52,40 @@ public class Result<T> {
...
@@ -49,23 +52,40 @@ public class Result<T> {
public
static
<
T
>
Result
<
T
>
successResult
()
{
public
static
<
T
>
Result
<
T
>
successResult
()
{
return
createResult
(
ResultCode
.
SUCCESS
,
null
);
return
createResult
(
ResultCode
.
SUCCESS
,
null
,
null
);
}
}
public
static
<
T
>
Result
<
T
>
successResult
(
T
data
)
{
public
static
<
T
>
Result
<
T
>
successResult
(
T
data
)
{
return
createResult
(
ResultCode
.
SUCCESS
,
data
);
return
createResult
(
ResultCode
.
SUCCESS
,
null
,
data
);
}
public
static
<
T
>
Result
<
T
>
successResult
(
String
msg
,
T
data
)
{
return
createResult
(
ResultCode
.
SUCCESS
,
msg
,
data
);
}
}
public
static
<
T
>
Result
<
T
>
errorResult
()
{
public
static
<
T
>
Result
<
T
>
errorResult
()
{
return
createResult
(
ResultCode
.
SYSTEM_UNKNOWN_ERROR
,
null
);
return
createResult
(
ResultCode
.
SYSTEM_UNKNOWN_ERROR
,
null
,
null
);
}
}
public
static
<
T
>
Result
<
T
>
errorResult
(
T
data
)
{
public
static
<
T
>
Result
<
T
>
errorResult
(
T
data
)
{
return
createResult
(
ResultCode
.
SYSTEM_UNKNOWN_ERROR
,
data
);
return
createResult
(
ResultCode
.
SYSTEM_UNKNOWN_ERROR
,
null
,
data
);
}
public
static
<
T
>
Result
<
T
>
errorResult
(
ResultCode
code
)
{
return
createResult
(
code
,
null
,
null
);
}
public
static
<
T
>
Result
<
T
>
errorResult
(
ResultCode
code
,
String
msg
)
{
return
createResult
(
code
,
msg
,
null
);
}
}
public
static
<
T
>
Result
<
T
>
errorResult
(
ResultCode
code
,
T
data
)
{
return
createResult
(
code
,
null
,
data
);
}
public
Result
<
T
>
failFast
()
{
public
Result
<
T
>
failFast
()
{
return
this
.
failFast
(
this
.
code
,
this
.
m
essage
);
return
this
.
failFast
(
this
.
code
,
this
.
m
sg
);
}
}
public
Result
<
T
>
failFastWithCode
(
String
msg
)
{
public
Result
<
T
>
failFastWithCode
(
String
msg
)
{
...
@@ -73,12 +93,12 @@ public class Result<T> {
...
@@ -73,12 +93,12 @@ public class Result<T> {
}
}
public
Result
<
T
>
failFastWithMessage
(
String
code
)
{
public
Result
<
T
>
failFastWithMessage
(
String
code
)
{
return
this
.
failFast
(
code
,
this
.
m
essage
);
return
this
.
failFast
(
code
,
this
.
m
sg
);
}
}
public
Result
<
T
>
failFast
(
String
code
,
String
msg
)
{
public
Result
<
T
>
failFast
(
String
code
,
String
msg
)
{
if
(!
this
.
success
)
{
if
(!
this
.
success
)
{
RuntimeException
ex
=
new
RuntimeException
(
code
+
":"
+
msg
);
RuntimeException
ex
=
new
RuntimeException
(
code
+
":"
+
msg
);
throw
ex
;
throw
ex
;
}
else
{
}
else
{
return
this
;
return
this
;
...
@@ -93,15 +113,16 @@ public class Result<T> {
...
@@ -93,15 +113,16 @@ public class Result<T> {
}
else
if
(!(
o
instanceof
Result
))
{
}
else
if
(!(
o
instanceof
Result
))
{
return
false
;
return
false
;
}
else
{
}
else
{
Result
<?>
other
=
(
Result
)
o
;
Result
<?>
other
=
(
Result
)
o
;
if
(!
other
.
canEqual
(
this
))
{
if
(!
other
.
canEqual
(
this
))
{
return
false
;
return
false
;
}
else
if
(
this
.
isSuccess
()
!=
other
.
isSuccess
())
{
}
else
if
(
this
.
isSuccess
()
!=
other
.
isSuccess
())
{
return
false
;
return
false
;
}
else
{
}
else
{
label49:
{
label49:
Object
this
$message
=
this
.
getMessage
();
{
Object
other$message
=
other
.
getMessage
();
Object
this
$message
=
this
.
getMsg
();
Object
other$message
=
other
.
getMsg
();
if
(
this
$message
==
null
)
{
if
(
this
$message
==
null
)
{
if
(
other$message
==
null
)
{
if
(
other$message
==
null
)
{
break
label49
;
break
label49
;
...
@@ -144,6 +165,6 @@ public class Result<T> {
...
@@ -144,6 +165,6 @@ public class Result<T> {
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"Result(success="
+
this
.
isSuccess
()
+
", message="
+
this
.
getM
essage
()
+
", code="
+
this
.
getCode
()
+
", data="
+
this
.
getData
()
+
")"
;
return
"Result(success="
+
this
.
isSuccess
()
+
", message="
+
this
.
getM
sg
()
+
", code="
+
this
.
getCode
()
+
", data="
+
this
.
getData
()
+
")"
;
}
}
}
}
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/core/enums/ResultCode.java
View file @
4787423d
...
@@ -7,32 +7,32 @@ package com.hikcreate.edl.pub.web.mobile.infra.core.enums;
...
@@ -7,32 +7,32 @@ package com.hikcreate.edl.pub.web.mobile.infra.core.enums;
* @time:2020/6/18 12:38
* @time:2020/6/18 12:38
**/
**/
public
enum
ResultCode
{
public
enum
ResultCode
{
SUCCESS
(
"1000"
,
"操作成功"
,
true
),
SUCCESS
(
"1000"
,
"操作成功"
,
true
),
SYSTEM_UNKNOWN_ERROR
(
"1001"
,
"系统未知错误"
,
false
),
SYSTEM_UNKNOWN_ERROR
(
"1001"
,
"系统未知错误"
,
false
),
HASH_NO_PRIVILEGE
(
"1002"
,
"没有权限访问该服务"
,
false
),
HASH_NO_PRIVILEGE
(
"1002"
,
"没有权限访问该服务"
,
false
),
DATA_ERROR
(
"1003"
,
"数据错误"
,
false
),
DATA_ERROR
(
"1003"
,
"数据错误"
,
false
),
RESUBMIT
(
"1004"
,
"重复提交"
,
false
),
RESUBMIT
(
"1004"
,
"重复提交"
,
false
),
PARAMETER_ERROR
(
"1005"
,
"参数错误"
,
false
),
PARAMETER_ERROR
(
"1005"
,
"参数错误"
,
false
),
SERVICE_ERROR
(
"1006"
,
"业务错误"
,
false
);
SERVICE_ERROR
(
"1006"
,
"业务错误"
,
false
);
private
String
code
;
private
String
code
;
private
String
me
ssage
;
private
String
me
an
;
private
boolean
success
;
private
boolean
success
;
ResultCode
(
String
code
,
String
me
ssage
,
boolean
success
)
{
ResultCode
(
String
code
,
String
me
an
,
boolean
success
)
{
this
.
code
=
code
;
this
.
code
=
code
;
this
.
me
ssage
=
message
;
this
.
me
an
=
mean
;
this
.
success
=
success
;
this
.
success
=
success
;
}
}
public
String
getCode
()
{
public
String
getCode
()
{
return
this
.
code
;
return
this
.
code
;
}
}
public
String
getMe
ssage
()
{
public
String
getMe
an
()
{
return
me
ssage
;
return
me
an
;
}
}
public
boolean
isSuccess
()
{
public
boolean
isSuccess
()
{
...
...
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/feign/UserDataFegin.java
0 → 100644
View file @
4787423d
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
data
.
feign
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.PostMapping
;
/**
* description:
*
* @author: xieshixiang
* @time:2020/6/18 17:28
**/
@FeignClient
(
contextId
=
""
)
public
interface
UserDataFegin
{
}
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/mapper/BindInfoMapper.java
View file @
4787423d
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
data
.
mapper
;
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
data
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.page.PageResult
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo
;
import
com.hikcreate.edl.pub.web.mobile.infra.model.BindInfoQuery
;
/**
/**
* description:
* description:
...
@@ -10,4 +12,7 @@ import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo;
...
@@ -10,4 +12,7 @@ import com.hikcreate.edl.pub.web.mobile.infra.model.BindInfo;
* @time:2020/6/18 15:56
* @time:2020/6/18 15:56
**/
**/
public
interface
BindInfoMapper
extends
BaseMapper
<
BindInfo
>
{
public
interface
BindInfoMapper
extends
BaseMapper
<
BindInfo
>
{
PageResult
<
BindInfo
>
selectByQuery
(
BindInfoQuery
query
);
}
}
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/model/BindInfo.java
View file @
4787423d
...
@@ -7,14 +7,14 @@ import java.util.Date;
...
@@ -7,14 +7,14 @@ import java.util.Date;
@Data
@Data
public
class
BindInfo
implements
Serializable
{
public
class
BindInfo
implements
Serializable
{
private
String
unqId
;
private
String
unqId
;
private
String
userId
;
private
String
userId
;
private
String
phone
;
private
String
phone
;
private
String
plateColor
;
private
String
plateColor
;
private
String
plateNum
;
private
String
plateNum
;
private
String
editor
;
private
String
status
;
private
Date
editorTime
;
private
Date
editorTime
;
}
}
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/model/BindInfoQuery.java
View file @
4787423d
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
model
;
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
model
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.hikcreate.edl.pub.web.mobile.infra.core.page.PageQuery
;
import
lombok.Data
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.Date
;
/**
/**
* description: 客户绑定信息请求实体类
* description: 客户绑定信息请求实体类
...
@@ -13,12 +13,12 @@ package com.hikcreate.edl.pub.web.mobile.infra.model;
...
@@ -13,12 +13,12 @@ package com.hikcreate.edl.pub.web.mobile.infra.model;
* @time:2020/6/18 16:07
* @time:2020/6/18 16:07
**/
**/
@Data
@Data
public
class
BindInfoQuery
extends
Page
implements
Serializable
{
public
class
BindInfoQuery
extends
Page
Query
implements
Serializable
{
private
String
unqId
;
private
String
userId
;
private
String
userId
;
private
String
phone
;
private
String
phone
;
private
String
plateColor
;
private
String
plateColor
;
private
String
plateNum
;
private
String
plateNum
;
private
String
editor
;
private
String
status
;
private
Date
editorTime
;
private
Date
editorTime
;
}
}
pom.xml
View file @
4787423d
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
</modules>
</modules>
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter
</artifactId>
<artifactId>
spring-boot-starter
</artifactId>
...
...
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