Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-api-boot
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-api-boot
Commits
1cb3b1b2
提交
1cb3b1b2
authored
4月 26, 2022
作者:
17607474349
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'merge_dev' into dev_lijing
上级
fa526f10
7db8856e
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
93 个修改的文件
包含
2065 行增加
和
974 行删除
+2065
-974
.editorConfig
.editorConfig
+1
-1
.gitignore
.gitignore
+2
-0
README.md
README.md
+6
-0
build.gradle
app-push/build.gradle
+16
-0
PushMessage.java
...src/main/java/com/yiring/app/push/domain/PushMessage.java
+11
-11
PushAppParam.java
...src/main/java/com/yiring/app/push/param/PushAppParam.java
+25
-0
PushRabbitConfig.java
...n/java/com/yiring/app/push/rabbitmq/PushRabbitConfig.java
+36
-13
PushRabbitReceiver.java
...java/com/yiring/app/push/rabbitmq/PushRabbitReceiver.java
+55
-4
PushService.java
...rc/main/java/com/yiring/app/push/service/PushService.java
+7
-0
PushServiceImpl.java
...ava/com/yiring/app/push/service/impl/PushServiceImpl.java
+8
-3
build.gradle
app/build.gradle
+4
-0
Application.java
app/src/main/java/com/yiring/app/Application.java
+2
-0
TagAlarm.java
app/src/main/java/com/yiring/app/domain/alarm/TagAlarm.java
+11
-0
AppletUser.java
...ain/java/com/yiring/app/domain/appletUser/AppletUser.java
+39
-0
AppletUserRepository.java
...om/yiring/app/domain/appletUser/AppletUserRepository.java
+19
-0
Car.java
app/src/main/java/com/yiring/app/domain/car/Car.java
+8
-16
LocationBeacon.java
...n/java/com/yiring/app/domain/location/LocationBeacon.java
+12
-18
LocationBeaconRepository.java
.../yiring/app/domain/location/LocationBeaconRepository.java
+25
-0
LocationFence.java
...in/java/com/yiring/app/domain/location/LocationFence.java
+12
-34
LocationFenceRule.java
...ava/com/yiring/app/domain/location/LocationFenceRule.java
+10
-62
LocationLog.java
...main/java/com/yiring/app/domain/location/LocationLog.java
+22
-43
LocationLogRepository.java
...com/yiring/app/domain/location/LocationLogRepository.java
+17
-0
LocationTag.java
...main/java/com/yiring/app/domain/location/LocationTag.java
+14
-10
ZyRealtimeLog.java
...rc/main/java/com/yiring/app/domain/log/ZyRealtimeLog.java
+62
-0
ZyRealtimeLogRepository.java
...va/com/yiring/app/domain/log/ZyRealtimeLogRepository.java
+12
-0
Visitor.java
app/src/main/java/com/yiring/app/domain/visitor/Visitor.java
+99
-0
VisitorRepository.java
...java/com/yiring/app/domain/visitor/VisitorRepository.java
+14
-0
CarExportExcel.java
...rc/main/java/com/yiring/app/excel/car/CarExportExcel.java
+56
-0
VideoExportExcel.java
...ain/java/com/yiring/app/excel/video/VideoExportExcel.java
+43
-0
VideoImportExcel.java
...ain/java/com/yiring/app/excel/video/VideoImportExcel.java
+44
-0
VisitorExportExcel.java
...java/com/yiring/app/excel/visitor/VisitorExportExcel.java
+68
-0
GbClient.java
app/src/main/java/com/yiring/app/feign/GbClient.java
+50
-0
MapClient.java
app/src/main/java/com/yiring/app/feign/MapClient.java
+20
-0
WxClient.java
app/src/main/java/com/yiring/app/feign/WxClient.java
+34
-0
CarParam.java
app/src/main/java/com/yiring/app/param/car/CarParam.java
+6
-14
CarQueryParam.java
...src/main/java/com/yiring/app/param/car/CarQueryParam.java
+9
-6
DictParam.java
app/src/main/java/com/yiring/app/param/dict/DictParam.java
+4
-1
DictQueryParam.java
...c/main/java/com/yiring/app/param/dict/DictQueryParam.java
+4
-1
DictTypeParam.java
...rc/main/java/com/yiring/app/param/dict/DictTypeParam.java
+4
-1
DictTypeQueryParam.java
...in/java/com/yiring/app/param/dict/DictTypeQueryParam.java
+4
-1
StreamProxyItem.java
...main/java/com/yiring/app/param/video/StreamProxyItem.java
+40
-0
VideoParam.java
app/src/main/java/com/yiring/app/param/video/VideoParam.java
+12
-7
VideoQueryParam.java
...main/java/com/yiring/app/param/video/VideoQueryParam.java
+8
-0
VisitorInfoParam.java
...n/java/com/yiring/app/param/visitor/VisitorInfoParam.java
+41
-0
VisitorListParam.java
...n/java/com/yiring/app/param/visitor/VisitorListParam.java
+49
-0
VisitorParam.java
.../main/java/com/yiring/app/param/visitor/VisitorParam.java
+78
-0
VisitorQueryParam.java
.../java/com/yiring/app/param/visitor/VisitorQueryParam.java
+75
-0
RabbitConfig.java
.../main/java/com/yiring/app/rabbit/config/RabbitConfig.java
+83
-0
ZyConfigProperties.java
...java/com/yiring/app/rabbit/config/ZyConfigProperties.java
+1
-1
ZyRabbitConfig.java
...ain/java/com/yiring/app/rabbit/config/ZyRabbitConfig.java
+7
-28
RabbitReceiver.java
...n/java/com/yiring/app/rabbit/receiver/RabbitReceiver.java
+1
-1
ZyRabbitReceiver.java
...java/com/yiring/app/rabbit/receiver/ZyRabbitReceiver.java
+103
-8
RabbitConfig.java
app/src/main/java/com/yiring/app/rabbitmq/RabbitConfig.java
+0
-13
AppletUserService.java
.../com/yiring/app/service/appletUser/AppletUserService.java
+24
-0
AppletUserServiceImpl.java
...ng/app/service/appletUser/impl/AppletUserServiceImpl.java
+43
-0
CarService.java
app/src/main/java/com/yiring/app/service/car/CarService.java
+8
-3
CarServiceImpl.java
.../java/com/yiring/app/service/car/impl/CarServiceImpl.java
+69
-35
VideoService.java
.../main/java/com/yiring/app/service/video/VideoService.java
+28
-3
VideoServiceImpl.java
...a/com/yiring/app/service/video/impl/VideoServiceImpl.java
+0
-0
VisitorService.java
...n/java/com/yiring/app/service/visitor/VisitorService.java
+82
-0
VisitorServiceImpl.java
...m/yiring/app/service/visitor/impl/VisitorServiceImpl.java
+0
-0
WebSocketStompConfig.java
.../main/java/com/yiring/app/stomp/WebSocketStompConfig.java
+7
-6
GeoUtils.java
app/src/main/java/com/yiring/app/util/GeoUtils.java
+26
-1
CarVo.java
app/src/main/java/com/yiring/app/vo/car/CarVo.java
+16
-14
VideoVo.java
app/src/main/java/com/yiring/app/vo/video/VideoVo.java
+13
-3
VisitorVo.java
app/src/main/java/com/yiring/app/vo/visitor/VisitorVo.java
+80
-0
HelloController.java
app/src/main/java/com/yiring/app/web/HelloController.java
+0
-14
CarController.java
app/src/main/java/com/yiring/app/web/car/CarController.java
+8
-13
MapController.java
app/src/main/java/com/yiring/app/web/map/MapController.java
+43
-0
VideoController.java
...c/main/java/com/yiring/app/web/video/VideoController.java
+25
-6
VisitorController.java
...in/java/com/yiring/app/web/visitor/VisitorController.java
+87
-0
application-conf-patch.yml
app/src/main/resources/application-conf-patch.yml
+10
-0
application-dev.yml
app/src/main/resources/application-dev.yml
+45
-1
application-mock.yml
app/src/main/resources/application-mock.yml
+1
-0
application.yml
app/src/main/resources/application.yml
+1
-1
build.gradle
basic-auth/build.gradle
+2
-1
CorsConfig.java
...re/src/main/java/com/yiring/common/config/CorsConfig.java
+0
-30
EnvConfig.java
...ore/src/main/java/com/yiring/common/config/EnvConfig.java
+8
-0
Dict.java
...ommon/core/src/main/java/com/yiring/common/dict/Dict.java
+4
-0
DictType.java
...n/core/src/main/java/com/yiring/common/dict/DictType.java
+4
-0
build.gradle
basic-common/util/build.gradle
+0
-4
Excel.java
...til/src/main/java/com/yiring/common/annotation/Excel.java
+0
-177
Excels.java
...il/src/main/java/com/yiring/common/annotation/Excels.java
+0
-16
Convert.java
...on/util/src/main/java/com/yiring/common/text/Convert.java
+0
-0
DictUtils.java
.../util/src/main/java/com/yiring/common/util/DictUtils.java
+25
-20
StrUtils.java
...n/util/src/main/java/com/yiring/common/util/StrUtils.java
+10
-10
DateUtils.java
.../src/main/java/com/yiring/common/util/date/DateUtils.java
+0
-166
FileTypeUtils.java
.../main/java/com/yiring/common/util/file/FileTypeUtils.java
+0
-69
ImageUtils.java
...src/main/java/com/yiring/common/util/file/ImageUtils.java
+0
-67
ExcelHandlerAdapter.java
.../java/com/yiring/common/util/poi/ExcelHandlerAdapter.java
+0
-16
ExcelUtils.java
.../src/main/java/com/yiring/common/util/poi/ExcelUtils.java
+0
-0
ReflectUtils.java
...ain/java/com/yiring/common/util/reflect/ReflectUtils.java
+0
-0
build.gradle
build.gradle
+3
-1
没有找到文件。
.editorConfig
浏览文件 @
1cb3b1b2
...
@@ -7,5 +7,5 @@ indent_style = space
...
@@ -7,5 +7,5 @@ indent_style = space
end_of_line = lf
end_of_line = lf
insert_final_newline = true
insert_final_newline = true
[*
*.yml
]
[*
.{yml,yaml}
]
indent_size = 2
indent_size = 2
.gitignore
浏览文件 @
1cb3b1b2
...
@@ -36,3 +36,5 @@ out/
...
@@ -36,3 +36,5 @@ out/
### VS Code ###
### VS Code ###
.vscode/
.vscode/
node_modules
node_modules
logs/
README.md
浏览文件 @
1cb3b1b2
...
@@ -33,3 +33,9 @@
...
@@ -33,3 +33,9 @@
-
[
]
XXL-JOB 定时任务模块
-
[
]
XXL-JOB 定时任务模块
-
[
x
]
@Convert 处理 Raw JSON 数据格式转换
-
[
x
]
@Convert 处理 Raw JSON 数据格式转换
-
[
]
扩展 PostgresDialect 实现时序查询函数
-
[
]
扩展 PostgresDialect 实现时序查询函数
---
> 引用
1.
[
JTS
](
https://github.com/locationtech/jts
)
2.
[
GeoTools
](
http://docs.geotools.org/
)
app-push/build.gradle
浏览文件 @
1cb3b1b2
...
@@ -9,8 +9,13 @@ dependencies {
...
@@ -9,8 +9,13 @@ dependencies {
// 本地依赖
// 本地依赖
implementation
fileTree
(
dir:
project
.
rootDir
.
getPath
()
+
'\\libs'
,
includes:
[
'*jar'
])
implementation
fileTree
(
dir:
project
.
rootDir
.
getPath
()
+
'\\libs'
,
includes:
[
'*jar'
])
// 文档及参数校验
implementation
'org.springframework.boot:spring-boot-starter-validation'
implementation
"io.swagger:swagger-annotations:${swaggerAnnotationsVersion}"
// hutool-core
// hutool-core
implementation
"cn.hutool:hutool-core:${hutoolVersion}"
implementation
"cn.hutool:hutool-core:${hutoolVersion}"
implementation
"cn.hutool:hutool-http:${hutoolVersion}"
// fastjson
// fastjson
implementation
"com.alibaba:fastjson:${fastJsonVersion}"
implementation
"com.alibaba:fastjson:${fastJsonVersion}"
...
@@ -19,4 +24,15 @@ dependencies {
...
@@ -19,4 +24,15 @@ dependencies {
// hibernate-types-55
// hibernate-types-55
implementation
"com.vladmihalcea:hibernate-types-55:${hibernateTypesVersion}"
implementation
"com.vladmihalcea:hibernate-types-55:${hibernateTypesVersion}"
// ======================= 推送相关 =======================
// 个推 SDK(App 推送)
// https://mvnrepository.com/artifact/com.getui.push/restful-sdk
implementation
'com.getui.push:restful-sdk:1.0.0.6'
// 阿里云短信 SDK(SMS 推送)
// https://mvnrepository.com/artifact/com.aliyun/dysmsapi20170525
implementation
'com.aliyun:dysmsapi20170525:2.0.9'
// 邮件 SDK(EMAIL 推送)
implementation
'org.springframework.boot:spring-boot-starter-mail'
// ======================================================
}
}
app-push/src/main/java/com/yiring/app/push/domain/PushMessage.java
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
push
.
domain
;
package
com
.
yiring
.
app
.
push
.
domain
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
Object
;
import
com.vladmihalcea.hibernate.type.json.JsonType
;
import
com.vladmihalcea.hibernate.type.json.Json
Binary
Type
;
import
com.yiring.common.domain.BasicEntity
;
import
com.yiring.common.domain.BasicEntity
;
import
java.io.Serial
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.io.Serializable
;
...
@@ -34,7 +34,7 @@ import org.hibernate.annotations.TypeDef;
...
@@ -34,7 +34,7 @@ import org.hibernate.annotations.TypeDef;
@FieldNameConstants
@FieldNameConstants
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@Entity
@Entity
@TypeDef
(
name
=
"json
"
,
typeClass
=
Json
Type
.
class
)
@TypeDef
(
name
=
"json
b"
,
typeClass
=
JsonBinary
Type
.
class
)
@Table
(
@Table
(
name
=
"SYS_PUSH_MESSAGE"
,
name
=
"SYS_PUSH_MESSAGE"
,
indexes
=
{
indexes
=
{
...
@@ -73,18 +73,18 @@ public class PushMessage extends BasicEntity implements Serializable {
...
@@ -73,18 +73,18 @@ public class PushMessage extends BasicEntity implements Serializable {
String
content
;
String
content
;
@Comment
(
"扩展数据"
)
@Comment
(
"扩展数据"
)
@org
.
hibernate
.
annotations
.
Type
(
type
=
"json"
)
@org
.
hibernate
.
annotations
.
Type
(
type
=
"json
b
"
)
@Column
(
columnDefinition
=
"json"
)
@Column
(
columnDefinition
=
"json
b
"
)
JSON
extra
;
JSON
Object
extra
;
@Comment
(
"消息状态"
)
@Comment
(
"消息状态"
)
@Enumerated
(
EnumType
.
STRING
)
@Enumerated
(
EnumType
.
STRING
)
Status
status
;
Status
status
;
@Comment
(
"推送反馈结果"
)
@Comment
(
"推送反馈结果"
)
@org
.
hibernate
.
annotations
.
Type
(
type
=
"json"
)
@org
.
hibernate
.
annotations
.
Type
(
type
=
"json
b
"
)
@Column
(
columnDefinition
=
"json"
)
@Column
(
columnDefinition
=
"json
b
"
)
JSON
result
;
JSON
Object
result
;
@Comment
(
"重试次数"
)
@Comment
(
"重试次数"
)
Integer
retryCount
;
Integer
retryCount
;
...
@@ -94,7 +94,7 @@ public class PushMessage extends BasicEntity implements Serializable {
...
@@ -94,7 +94,7 @@ public class PushMessage extends BasicEntity implements Serializable {
@SuppressWarnings
({
"unused"
})
@SuppressWarnings
({
"unused"
})
public
enum
Type
{
public
enum
Type
{
W
S
(
"STOMP WebSocket 消息
"
),
W
EBHOOK
(
"webhook
"
),
APP
(
"APP 消息"
),
APP
(
"APP 消息"
),
SMS
(
"短信消息"
),
SMS
(
"短信消息"
),
EMAIL
(
"邮件消息"
),
EMAIL
(
"邮件消息"
),
...
@@ -113,7 +113,7 @@ public class PushMessage extends BasicEntity implements Serializable {
...
@@ -113,7 +113,7 @@ public class PushMessage extends BasicEntity implements Serializable {
}
}
public
String
queue
()
{
public
String
queue
()
{
return
String
.
format
(
"push.%s.queue"
,
this
.
name
());
return
String
.
format
(
"push.%s.queue"
,
this
.
name
()
.
toLowerCase
()
);
}
}
}
}
...
...
app-push/src/main/java/com/yiring/app/push/param/PushAppParam.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
push
.
param
;
import
io.swagger.annotations.ApiModel
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* App 推送参数
*
* @author Jim
* @version 0.1
* 2022/4/21 10:27
*/
@ApiModel
(
"A"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
PushAppParam
{
String
webhook
;
}
app-push/src/main/java/com/yiring/app/push/rabbitmq/PushRabbitConfig.java
浏览文件 @
1cb3b1b2
...
@@ -20,14 +20,37 @@ import org.springframework.context.annotation.Configuration;
...
@@ -20,14 +20,37 @@ import org.springframework.context.annotation.Configuration;
@Configuration
@Configuration
public
class
PushRabbitConfig
{
public
class
PushRabbitConfig
{
/**
* 消息交换机
*/
public
static
final
String
PUSH_TOPIC_EXCHANGE
=
"push.topic.exchange"
;
public
static
final
String
PUSH_TOPIC_EXCHANGE
=
"push.topic.exchange"
;
/**
* WebHook 推送队列
*/
public
static
final
String
PUSH_WEBHOOK_QUEUE
=
"push.webhook.queue"
;
/**
* App 消息推送队列
*/
public
static
final
String
PUSH_APP_QUEUE
=
"push.app.queue"
;
public
static
final
String
PUSH_APP_QUEUE
=
"push.app.queue"
;
public
static
final
String
PUSH_WS_QUEUE
=
"push.ws.queue"
;
/**
* 短信推送队列
*/
public
static
final
String
PUSH_SMS_QUEUE
=
"push.sms.queue"
;
public
static
final
String
PUSH_SMS_QUEUE
=
"push.sms.queue"
;
public
static
final
String
PUSH_EMAIL_QUEUE
=
"push.email.queue"
;
/**
* 邮箱推送队列
*/
public
static
final
String
PUSH_MAIL_QUEUE
=
"push.mail.queue"
;
/**
* TTS 语音电话队列
*/
public
static
final
String
PUSH_CALL_TTS_QUEUE
=
"push.call.tts.queue"
;
public
static
final
String
PUSH_CALL_TTS_QUEUE
=
"push.call.tts.queue"
;
/**
* 语音电话推送队列
*/
public
static
final
String
PUSH_CALL_AUDIO_QUEUE
=
"push.call.audio.queue"
;
public
static
final
String
PUSH_CALL_AUDIO_QUEUE
=
"push.call.audio.queue"
;
/**
* 设备广播推送队列
*/
public
static
final
String
PUSH_DEVICE_TONE_QUEUE
=
"push.device.tone.queue"
;
public
static
final
String
PUSH_DEVICE_TONE_QUEUE
=
"push.device.tone.queue"
;
/**
/**
...
@@ -52,16 +75,16 @@ public class PushRabbitConfig {
...
@@ -52,16 +75,16 @@ public class PushRabbitConfig {
return
BindingBuilder
.
bind
(
queue
).
to
(
exchange
).
with
(
PUSH_APP_QUEUE
);
return
BindingBuilder
.
bind
(
queue
).
to
(
exchange
).
with
(
PUSH_APP_QUEUE
);
}
}
@Bean
(
PUSH_W
S
_QUEUE
)
@Bean
(
PUSH_W
EBHOOK
_QUEUE
)
public
Queue
pushWeb
Socket
Queue
()
{
public
Queue
pushWeb
Hook
Queue
()
{
Map
<
String
,
Object
>
args
=
new
HashMap
<>(
1
);
Map
<
String
,
Object
>
args
=
new
HashMap
<>(
1
);
args
.
put
(
"x-message-ttl"
,
30
*
1000
);
args
.
put
(
"x-message-ttl"
,
30
*
1000
);
return
new
Queue
(
PUSH_W
S
_QUEUE
,
true
,
false
,
false
,
args
);
return
new
Queue
(
PUSH_W
EBHOOK
_QUEUE
,
true
,
false
,
false
,
args
);
}
}
@Bean
@Bean
Binding
bindingExchangeW
s
(
@Qualifier
(
PUSH_WS
_QUEUE
)
Queue
queue
,
TopicExchange
exchange
)
{
Binding
bindingExchangeW
ebHook
(
@Qualifier
(
PUSH_WEBHOOK
_QUEUE
)
Queue
queue
,
TopicExchange
exchange
)
{
return
BindingBuilder
.
bind
(
queue
).
to
(
exchange
).
with
(
PUSH_W
S
_QUEUE
);
return
BindingBuilder
.
bind
(
queue
).
to
(
exchange
).
with
(
PUSH_W
EBHOOK
_QUEUE
);
}
}
@Bean
(
PUSH_SMS_QUEUE
)
@Bean
(
PUSH_SMS_QUEUE
)
...
@@ -76,16 +99,16 @@ public class PushRabbitConfig {
...
@@ -76,16 +99,16 @@ public class PushRabbitConfig {
return
BindingBuilder
.
bind
(
queue
).
to
(
exchange
).
with
(
PUSH_SMS_QUEUE
);
return
BindingBuilder
.
bind
(
queue
).
to
(
exchange
).
with
(
PUSH_SMS_QUEUE
);
}
}
@Bean
(
PUSH_
E
MAIL_QUEUE
)
@Bean
(
PUSH_MAIL_QUEUE
)
public
Queue
push
Em
ailQueue
()
{
public
Queue
push
M
ailQueue
()
{
Map
<
String
,
Object
>
args
=
new
HashMap
<>(
1
);
Map
<
String
,
Object
>
args
=
new
HashMap
<>(
1
);
args
.
put
(
"x-message-ttl"
,
60
*
1000
);
args
.
put
(
"x-message-ttl"
,
60
*
1000
);
return
new
Queue
(
PUSH_
E
MAIL_QUEUE
,
true
,
false
,
false
,
args
);
return
new
Queue
(
PUSH_MAIL_QUEUE
,
true
,
false
,
false
,
args
);
}
}
@Bean
@Bean
Binding
bindingExchange
Email
(
@Qualifier
(
PUSH_E
MAIL_QUEUE
)
Queue
queue
,
TopicExchange
exchange
)
{
Binding
bindingExchange
Mail
(
@Qualifier
(
PUSH_
MAIL_QUEUE
)
Queue
queue
,
TopicExchange
exchange
)
{
return
BindingBuilder
.
bind
(
queue
).
to
(
exchange
).
with
(
PUSH_
E
MAIL_QUEUE
);
return
BindingBuilder
.
bind
(
queue
).
to
(
exchange
).
with
(
PUSH_MAIL_QUEUE
);
}
}
@Bean
(
PUSH_CALL_TTS_QUEUE
)
@Bean
(
PUSH_CALL_TTS_QUEUE
)
...
...
app-push/src/main/java/com/yiring/app/push/rabbitmq/PushRabbitReceiver.java
浏览文件 @
1cb3b1b2
...
@@ -26,10 +26,61 @@ public class PushRabbitReceiver {
...
@@ -26,10 +26,61 @@ public class PushRabbitReceiver {
PushMessageRepository
repository
;
PushMessageRepository
repository
;
@RabbitHandler
@RabbitHandler
@RabbitListener
(
queues
=
PushRabbitConfig
.
PUSH_WS_QUEUE
)
@RabbitListener
(
queues
=
PushRabbitConfig
.
PUSH_WEBHOOK_QUEUE
)
public
void
receiverWebSocketMessage
(
Long
id
)
{
public
void
receiverWebHookMessage
(
Long
id
)
{
log
.
info
(
"接收到消息: "
+
id
);
log
.
info
(
"[WebHook] Message: "
+
id
);
repository
.
findById
(
id
).
ifPresent
(
message
->
log
.
info
(
"{}"
,
message
));
repository
.
findById
(
id
).
ifPresent
(
message
->
log
.
info
(
"{}"
,
message
));
// TODO
// 实现调用 WebHook,基于 WebHook API 发起 HTTPs 请求
}
@RabbitHandler
@RabbitListener
(
queues
=
PushRabbitConfig
.
PUSH_APP_QUEUE
)
public
void
receiverAppMessage
(
Long
id
)
{
log
.
info
(
"[App] Message: "
+
id
);
// TODO
// 实现推送消息到 App,基于个推 API
// https://github.com/GetuiLaboratory/getui-pushapi-java-client-v2
}
@RabbitHandler
@RabbitListener
(
queues
=
PushRabbitConfig
.
PUSH_SMS_QUEUE
)
public
void
receiverSmsMessage
(
Long
id
)
{
log
.
info
(
"[SMS] Message: "
+
id
);
// TODO
// 实现发送短信,基于阿里云短信平台 API
}
@RabbitHandler
@RabbitListener
(
queues
=
PushRabbitConfig
.
PUSH_MAIL_QUEUE
)
public
void
receiverMailMessage
(
Long
id
)
{
log
.
info
(
"[Mail] Message: "
+
id
);
// TODO
// 实现发送邮件,基于邮件配置
}
@RabbitHandler
@RabbitListener
(
queues
=
PushRabbitConfig
.
PUSH_CALL_TTS_QUEUE
)
public
void
receiverTtsMessage
(
Long
id
)
{
log
.
info
(
"[Phone TTS] Message: "
+
id
);
// TODO
// 实现拨打电话播放 TTS 转语音,基于壹润外呼系统 API
}
@RabbitHandler
@RabbitListener
(
queues
=
PushRabbitConfig
.
PUSH_CALL_AUDIO_QUEUE
)
public
void
receiverAudioMessage
(
Long
id
)
{
log
.
info
(
"[Phone Audio] Message: "
+
id
);
// TODO
// 实现拨打电话播放音频文件,基于壹润外呼系统 API
}
@RabbitHandler
@RabbitListener
(
queues
=
PushRabbitConfig
.
PUSH_DEVICE_TONE_QUEUE
)
public
void
receiverToneMessage
(
Long
id
)
{
log
.
info
(
"[Device Tone] Message: "
+
id
);
// TODO
// 实现播放设备铃声,基于音柱广播设备 API
// SDK 暂未拿到,设备未采购,未进行联调
}
}
}
}
app-push/src/main/java/com/yiring/app/push/service/PushService.java
浏览文件 @
1cb3b1b2
...
@@ -3,6 +3,7 @@ package com.yiring.app.push.service;
...
@@ -3,6 +3,7 @@ package com.yiring.app.push.service;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yiring.app.push.domain.PushMessage
;
import
com.yiring.app.push.domain.PushMessage
;
import
com.yiring.app.push.param.PushAppParam
;
/**
/**
* 推送服务
* 推送服务
...
@@ -13,4 +14,10 @@ import com.yiring.app.push.domain.PushMessage;
...
@@ -13,4 +14,10 @@ import com.yiring.app.push.domain.PushMessage;
*/
*/
public
interface
PushService
{
public
interface
PushService
{
void
push
(
PushMessage
.
Type
type
,
JSONObject
raw
);
void
push
(
PushMessage
.
Type
type
,
JSONObject
raw
);
/**
* 推送到 App
* @param param 参数
*/
void
app
(
PushAppParam
param
);
}
}
app-push/src/main/java/com/yiring/app/push/service/impl/PushServiceImpl.java
浏览文件 @
1cb3b1b2
...
@@ -4,12 +4,13 @@ package com.yiring.app.push.service.impl;
...
@@ -4,12 +4,13 @@ package com.yiring.app.push.service.impl;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yiring.app.push.domain.PushMessage
;
import
com.yiring.app.push.domain.PushMessage
;
import
com.yiring.app.push.domain.PushMessageRepository
;
import
com.yiring.app.push.domain.PushMessageRepository
;
import
com.yiring.app.push.param.PushAppParam
;
import
com.yiring.app.push.rabbitmq.PushRabbitConfig
;
import
com.yiring.app.push.rabbitmq.PushRabbitConfig
;
import
com.yiring.app.push.service.PushService
;
import
com.yiring.app.push.service.PushService
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.transaction.Transactional
;
import
javax.transaction.Transactional
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.amqp.
core.Amqp
Template
;
import
org.springframework.amqp.
rabbit.core.Rabbit
Template
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
/**
/**
...
@@ -29,7 +30,7 @@ public class PushServiceImpl implements PushService {
...
@@ -29,7 +30,7 @@ public class PushServiceImpl implements PushService {
PushMessageRepository
repository
;
PushMessageRepository
repository
;
@Resource
@Resource
AmqpTemplate
amqp
Template
;
RabbitTemplate
rabbit
Template
;
@Override
@Override
public
void
push
(
PushMessage
.
Type
type
,
JSONObject
raw
)
{
public
void
push
(
PushMessage
.
Type
type
,
JSONObject
raw
)
{
...
@@ -37,6 +38,10 @@ public class PushServiceImpl implements PushService {
...
@@ -37,6 +38,10 @@ public class PushServiceImpl implements PushService {
message
.
setType
(
type
);
message
.
setType
(
type
);
message
.
setExtra
(
raw
);
message
.
setExtra
(
raw
);
repository
.
saveAndFlush
(
message
);
repository
.
saveAndFlush
(
message
);
amqpTemplate
.
convertAndSend
(
PushRabbitConfig
.
PUSH_TOPIC_EXCHANGE
,
type
.
queue
(),
message
.
getId
());
rabbitTemplate
.
convertAndSend
(
PushRabbitConfig
.
PUSH_TOPIC_EXCHANGE
,
type
.
queue
(),
message
.
getId
());
}
}
@Override
public
void
app
(
PushAppParam
param
)
{}
}
}
app/build.gradle
浏览文件 @
1cb3b1b2
...
@@ -53,6 +53,7 @@ dependencies {
...
@@ -53,6 +53,7 @@ dependencies {
implementation
"cn.hutool:hutool-extra:${hutoolVersion}"
implementation
"cn.hutool:hutool-extra:${hutoolVersion}"
implementation
"cn.hutool:hutool-http:${hutoolVersion}"
implementation
"cn.hutool:hutool-http:${hutoolVersion}"
implementation
"cn.hutool:hutool-json:${hutoolVersion}"
implementation
"cn.hutool:hutool-json:${hutoolVersion}"
// JPA 增加空间字段支持
// JPA 增加空间字段支持
// https://blog.wuwii.com/jpa-spatial.html
// https://blog.wuwii.com/jpa-spatial.html
implementation
(
"org.hibernate:hibernate-spatial:${hibernateSpatialVersion}"
)
{
implementation
(
"org.hibernate:hibernate-spatial:${hibernateSpatialVersion}"
)
{
...
@@ -69,4 +70,7 @@ dependencies {
...
@@ -69,4 +70,7 @@ dependencies {
// myexcel
// myexcel
implementation
"com.github.liaochong:myexcel:${myexcelVersion}"
implementation
"com.github.liaochong:myexcel:${myexcelVersion}"
// https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-openfeign
implementation
"org.springframework.cloud:spring-cloud-starter-openfeign:${openfeignVersion}"
}
}
app/src/main/java/com/yiring/app/Application.java
浏览文件 @
1cb3b1b2
...
@@ -4,6 +4,7 @@ package com.yiring.app;
...
@@ -4,6 +4,7 @@ package com.yiring.app;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.domain.EntityScan
;
import
org.springframework.boot.autoconfigure.domain.EntityScan
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.data.jpa.convert.threeten.Jsr310JpaConverters
;
import
org.springframework.data.jpa.convert.threeten.Jsr310JpaConverters
;
import
org.springframework.data.jpa.repository.config.EnableJpaRepositories
;
import
org.springframework.data.jpa.repository.config.EnableJpaRepositories
;
...
@@ -12,6 +13,7 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
...
@@ -12,6 +13,7 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
basePackageClasses
=
{
Application
.
class
,
Jsr310JpaConverters
.
class
},
basePackageClasses
=
{
Application
.
class
,
Jsr310JpaConverters
.
class
},
basePackages
=
Application
.
BASE_PACKAGES
basePackages
=
Application
.
BASE_PACKAGES
)
)
@EnableFeignClients
@SpringBootApplication
(
scanBasePackages
=
Application
.
BASE_PACKAGES
)
@SpringBootApplication
(
scanBasePackages
=
Application
.
BASE_PACKAGES
)
public
class
Application
{
public
class
Application
{
...
...
app/src/main/java/com/yiring/app/domain/alarm/TagAlarm.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
domain
.
alarm
;
/**
* 标签报警
*
* @author Jim
* @version 0.1
* 2022/4/25 15:38
*/
public
class
TagAlarm
{}
app/src/main/java/com/yiring/app/domain/appletUser/AppletUser.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
domain
.
appletUser
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
javax.persistence.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
org.hibernate.annotations.Comment
;
@Data
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Comment
(
"小程序用户表"
)
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@Entity
@Table
(
name
=
"BS_APPLET_USER"
)
public
class
AppletUser
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
5188008300684723724L
;
@Id
@Comment
(
"用户唯一标识"
)
String
openid
;
@Comment
(
"用户电话"
)
String
mobile
;
@Comment
(
"最后登录时间"
)
LocalDateTime
LastLoginTime
;
@Comment
(
"创建时间"
)
LocalDateTime
createTime
;
}
app/src/main/java/com/yiring/app/domain/appletUser/AppletUserRepository.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
domain
.
appletUser
;
import
java.io.Serializable
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.stereotype.Repository
;
/**
* @author tzl
* 2022/4/22 13:55
*/
@Repository
public
interface
AppletUserRepository
extends
JpaRepository
<
AppletUser
,
Serializable
>,
JpaSpecificationExecutor
<
AppletUser
>
{
@Query
(
"SELECT COUNT(id) FROM AppletUser WHERE mobile=?1"
)
Integer
countMobile
(
String
mobile
);
}
app/src/main/java/com/yiring/app/domain/car/Car.java
浏览文件 @
1cb3b1b2
...
@@ -2,10 +2,13 @@
...
@@ -2,10 +2,13 @@
package
com
.
yiring
.
app
.
domain
.
car
;
package
com
.
yiring
.
app
.
domain
.
car
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.yiring.common.annotation.Exce
l
;
import
java.io.Seria
l
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
javax.persistence.*
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
lombok.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldNameConstants
;
import
lombok.experimental.FieldNameConstants
;
...
@@ -30,6 +33,9 @@ import org.hibernate.snowflake.SnowflakeId;
...
@@ -30,6 +33,9 @@ import org.hibernate.snowflake.SnowflakeId;
@Comment
(
"车辆"
)
@Comment
(
"车辆"
)
public
class
Car
implements
Serializable
{
public
class
Car
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
8775607064296075463L
;
@Id
@Id
@Comment
(
"主键id"
)
@Comment
(
"主键id"
)
@GeneratedValue
(
generator
=
SnowflakeId
.
GENERATOR
)
@GeneratedValue
(
generator
=
SnowflakeId
.
GENERATOR
)
...
@@ -37,48 +43,34 @@ public class Car implements Serializable {
...
@@ -37,48 +43,34 @@ public class Car implements Serializable {
Long
id
;
Long
id
;
@Comment
(
"车牌号"
)
@Comment
(
"车牌号"
)
@Excel
(
name
=
"车牌"
,
sort
=
1
)
String
carNum
;
String
carNum
;
@Comment
(
"车辆类型"
)
@Comment
(
"车辆类型"
)
@Excel
(
name
=
"车辆类型"
,
sort
=
2
,
dictType
=
"car_type"
)
String
carType
;
String
carType
;
@Comment
(
"司机名称"
)
@Comment
(
"司机名称"
)
@Excel
(
name
=
"司机"
,
sort
=
3
)
String
driverName
;
String
driverName
;
@Comment
(
"司机电话"
)
@Comment
(
"司机电话"
)
@Excel
(
name
=
"联系电话"
,
sort
=
4
)
String
driverMobile
;
String
driverMobile
;
@Comment
(
"标签卡"
)
@Comment
(
"标签卡"
)
@Excel
(
name
=
"标签卡"
,
sort
=
9
)
String
labelCard
;
String
labelCard
;
@Comment
(
"标签卡状态"
)
@Excel
(
name
=
"标签卡状态"
,
sort
=
10
,
dictType
=
"car_label_status"
)
String
labelCardStatus
;
@Comment
(
"所属单位id"
)
@Comment
(
"所属单位id"
)
@Excel
(
name
=
"所属单位"
,
sort
=
5
)
String
orgId
;
String
orgId
;
@Comment
(
"被访人id"
)
@Comment
(
"被访人id"
)
@Excel
(
name
=
"被访人"
,
sort
=
7
)
String
intervieweeId
;
String
intervieweeId
;
@Comment
(
"来访原因"
)
@Comment
(
"来访原因"
)
@Excel
(
name
=
"来访原因"
,
sort
=
6
)
String
reason
;
String
reason
;
@Comment
(
"收卡时间"
)
@Comment
(
"收卡时间"
)
@Excel
(
name
=
"收卡时间"
,
sort
=
11
,
dateFormat
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
LocalDateTime
cardRecTime
;
LocalDateTime
cardRecTime
;
@Comment
(
"创建时间"
)
@Comment
(
"创建时间"
)
@Excel
(
name
=
"到访时间"
,
sort
=
8
,
dateFormat
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
LocalDateTime
createTime
;
LocalDateTime
createTime
;
...
...
app/src/main/java/com/yiring/app/domain/location/LocationBeacon.java
浏览文件 @
1cb3b1b2
...
@@ -2,20 +2,21 @@
...
@@ -2,20 +2,21 @@
package
com
.
yiring
.
app
.
domain
.
location
;
package
com
.
yiring
.
app
.
domain
.
location
;
import
com.yiring.common.annotation.FieldMapping
;
import
com.yiring.common.annotation.FieldMapping
;
import
com.yiring.common.domain.BasicEntity
;
import
java.io.Serial
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.
time.LocalDateTime
;
import
java.
util.HashSet
;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.Set
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
lombok.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldNameConstants
;
import
lombok.experimental.FieldNameConstants
;
import
lombok.experimental.SuperBuilder
;
import
org.hibernate.Hibernate
;
import
org.hibernate.Hibernate
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.GenericGenerator
;
import
org.hibernate.annotations.Type
;
import
org.hibernate.annotations.Type
;
import
org.hibernate.snowflake.SnowflakeId
;
import
org.locationtech.jts.geom.Point
;
import
org.locationtech.jts.geom.Point
;
/**
/**
...
@@ -32,7 +33,7 @@ import org.locationtech.jts.geom.Point;
...
@@ -32,7 +33,7 @@ import org.locationtech.jts.geom.Point;
@Getter
@Getter
@Setter
@Setter
@ToString
@ToString
@
Builder
@
SuperBuilder
(
toBuilder
=
true
)
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@FieldNameConstants
@FieldNameConstants
...
@@ -43,17 +44,11 @@ import org.locationtech.jts.geom.Point;
...
@@ -43,17 +44,11 @@ import org.locationtech.jts.geom.Point;
indexes
=
{
@Index
(
columnList
=
"linkId"
),
@Index
(
columnList
=
"code"
,
unique
=
true
)
}
indexes
=
{
@Index
(
columnList
=
"linkId"
),
@Index
(
columnList
=
"code"
,
unique
=
true
)
}
)
)
@Comment
(
"定位信标"
)
@Comment
(
"定位信标"
)
public
class
LocationBeacon
implements
Serializable
{
public
class
LocationBeacon
extends
BasicEntity
implements
Serializable
{
@Serial
@Serial
private
static
final
long
serialVersionUID
=
5419734189897829250L
;
private
static
final
long
serialVersionUID
=
5419734189897829250L
;
@Comment
(
"主键"
)
@Id
@GeneratedValue
(
generator
=
SnowflakeId
.
GENERATOR
)
@GenericGenerator
(
name
=
SnowflakeId
.
GENERATOR
,
strategy
=
SnowflakeId
.
Strategy
.
LONG
)
Long
id
;
/**
/**
* 数据来源于【真源人员定位系统 - 定位信标】
* 数据来源于【真源人员定位系统 - 定位信标】
* 作用: 用于双向联动进行数据同步
* 作用: 用于双向联动进行数据同步
...
@@ -99,19 +94,18 @@ public class LocationBeacon implements Serializable {
...
@@ -99,19 +94,18 @@ public class LocationBeacon implements Serializable {
@Comment
(
"电量单位"
)
@Comment
(
"电量单位"
)
String
voltUnit
;
String
voltUnit
;
@FieldMapping
(
value
=
"time"
,
desc
=
"更新时间戳"
,
type
=
Long
.
class
)
@Comment
(
"围栏集合"
)
@Comment
(
"更新时间"
)
@Builder
.
Default
LocalDateTime
updateTime
;
@ManyToMany
@ToString
.
Exclude
@Comment
(
"创建时间"
)
Set
<
LocationFence
>
fences
=
new
HashSet
<>(
0
);
LocalDateTime
createTime
;
@Override
@Override
public
boolean
equals
(
Object
o
)
{
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
Hibernate
.
getClass
(
this
)
!=
Hibernate
.
getClass
(
o
))
return
false
;
if
(
o
==
null
||
Hibernate
.
getClass
(
this
)
!=
Hibernate
.
getClass
(
o
))
return
false
;
LocationBeacon
that
=
(
LocationBeacon
)
o
;
LocationBeacon
that
=
(
LocationBeacon
)
o
;
return
id
!=
null
&&
Objects
.
equals
(
id
,
that
.
id
);
return
getId
()
!=
null
&&
Objects
.
equals
(
getId
(),
that
.
getId
()
);
}
}
@Override
@Override
...
...
app/src/main/java/com/yiring/app/domain/location/LocationBeaconRepository.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
domain
.
location
;
import
java.io.Serializable
;
import
java.util.Set
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.stereotype.Repository
;
/**
* @author Jim
* @version 0.1
* 2022/4/24 14:19
*/
@Repository
public
interface
LocationBeaconRepository
extends
JpaRepository
<
LocationBeacon
,
Serializable
>,
JpaSpecificationExecutor
<
LocationBeacon
>
{
/**
* 根据编号集合查询
* @param codes 编号集合
* @return 查询结果
*/
Set
<
LocationBeacon
>
findByCodeIn
(
Set
<
String
>
codes
);
}
app/src/main/java/com/yiring/app/domain/location/LocationFence.java
浏览文件 @
1cb3b1b2
...
@@ -2,19 +2,18 @@
...
@@ -2,19 +2,18 @@
package
com
.
yiring
.
app
.
domain
.
location
;
package
com
.
yiring
.
app
.
domain
.
location
;
import
com.yiring.common.annotation.FieldMapping
;
import
com.yiring.common.annotation.FieldMapping
;
import
com.yiring.common.domain.BasicEntity
;
import
java.io.Serial
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.Set
;
import
java.util.Set
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
lombok.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldNameConstants
;
import
lombok.experimental.FieldNameConstants
;
import
lombok.experimental.SuperBuilder
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.GenericGenerator
;
import
org.hibernate.annotations.Type
;
import
org.hibernate.annotations.Type
;
import
org.hibernate.snowflake.SnowflakeId
;
import
org.locationtech.jts.geom.Geometry
;
import
org.locationtech.jts.geom.Geometry
;
/**
/**
...
@@ -29,33 +28,19 @@ import org.locationtech.jts.geom.Geometry;
...
@@ -29,33 +28,19 @@ import org.locationtech.jts.geom.Geometry;
@Getter
@Getter
@Setter
@Setter
@ToString
@ToString
@
Builder
@
SuperBuilder
(
toBuilder
=
true
)
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@FieldNameConstants
@FieldNameConstants
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@Entity
@Entity
@Table
(
name
=
"BS_LOCATION_FENCE"
,
indexes
=
{
@Index
(
columnList
=
"
linkId"
),
@Index
(
columnList
=
"
mode"
)
})
@Table
(
name
=
"BS_LOCATION_FENCE"
,
indexes
=
{
@Index
(
columnList
=
"mode"
)
})
@Comment
(
"围栏"
)
@Comment
(
"围栏"
)
public
class
LocationFence
implements
Serializable
{
public
class
LocationFence
extends
BasicEntity
implements
Serializable
{
@Serial
@Serial
private
static
final
long
serialVersionUID
=
4155868702188991300L
;
private
static
final
long
serialVersionUID
=
4155868702188991300L
;
@Comment
(
"主键"
)
@Id
@GeneratedValue
(
generator
=
SnowflakeId
.
GENERATOR
)
@GenericGenerator
(
name
=
SnowflakeId
.
GENERATOR
,
strategy
=
SnowflakeId
.
Strategy
.
LONG
)
Long
id
;
/**
* 数据来源于【真源人员定位系统 - 电子围栏】
* 作用: 用于双向联动进行数据同步
*/
@FieldMapping
(
"id"
)
@Comment
(
"外链主键"
)
Long
linkId
;
@Comment
(
"地图 ID"
)
@Comment
(
"地图 ID"
)
Long
areaId
;
Long
areaId
;
...
@@ -64,21 +49,11 @@ public class LocationFence implements Serializable {
...
@@ -64,21 +49,11 @@ public class LocationFence implements Serializable {
@Enumerated
(
EnumType
.
STRING
)
@Enumerated
(
EnumType
.
STRING
)
Mode
mode
;
Mode
mode
;
@Comment
(
"坐标信息(x,y,r)"
)
@Column
(
columnDefinition
=
"JSON"
)
String
shape
;
@Comment
(
"形状信息(circle: 圆形, polygon: 多边形)"
)
String
shapeType
;
@Comment
(
"空间信息"
)
@Comment
(
"空间信息"
)
@Type
(
type
=
"jts_geometry"
)
@Type
(
type
=
"jts_geometry"
)
@Column
(
columnDefinition
=
"geometry"
)
@Column
(
columnDefinition
=
"geometry"
)
Geometry
geometry
;
Geometry
geometry
;
@Comment
(
"半径,米/单位(圆形围栏)"
)
Double
radius
;
@Comment
(
"超时时间(秒)"
)
@Comment
(
"超时时间(秒)"
)
Integer
overtime
;
Integer
overtime
;
...
@@ -91,13 +66,16 @@ public class LocationFence implements Serializable {
...
@@ -91,13 +66,16 @@ public class LocationFence implements Serializable {
@ToString
.
Exclude
@ToString
.
Exclude
Set
<
LocationBeacon
>
beacons
=
new
HashSet
<>(
0
);
Set
<
LocationBeacon
>
beacons
=
new
HashSet
<>(
0
);
@Comment
(
"创建时间"
)
@Comment
(
"围栏规则集合"
)
LocalDateTime
createTime
;
@Builder
.
Default
@OneToMany
(
mappedBy
=
"fence"
)
@ToString
.
Exclude
Set
<
LocationFenceRule
>
rules
=
new
HashSet
<>(
0
);
@SuppressWarnings
({
"unused"
})
@SuppressWarnings
({
"unused"
})
public
enum
Mode
{
public
enum
Mode
{
NORMAL
(
"
标准
"
),
NORMAL
(
"
常规区域
"
),
DANGER
(
"危险区域"
);
DANGER
(
"危险
源
区域"
);
@Getter
@Getter
final
String
text
;
final
String
text
;
...
...
app/src/main/java/com/yiring/app/domain/location/LocationFenceRule.java
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
domain
.
location
;
package
com
.
yiring
.
app
.
domain
.
location
;
import
com.yiring.auth.domain.user.User
;
import
com.yiring.common.domain.BasicEntity
;
import
com.yiring.common.annotation.FieldMapping
;
import
java.io.Serial
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java
.time.LocalTime
;
import
java
x.persistence.Entity
;
import
java
.util.HashSet
;
import
java
x.persistence.JoinColumn
;
import
java
.util.Set
;
import
java
x.persistence.ManyToOne
;
import
javax.persistence.
*
;
import
javax.persistence.
Table
;
import
lombok.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldNameConstants
;
import
lombok.experimental.FieldNameConstants
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.GenericGenerator
;
import
org.hibernate.snowflake.SnowflakeId
;
/**
/**
* 围栏规则
* 围栏规则
...
@@ -36,67 +33,18 @@ import org.hibernate.snowflake.SnowflakeId;
...
@@ -36,67 +33,18 @@ import org.hibernate.snowflake.SnowflakeId;
@Entity
@Entity
@Table
(
name
=
"BS_LOCATION_FENCE_RULE"
)
@Table
(
name
=
"BS_LOCATION_FENCE_RULE"
)
@Comment
(
"围栏规则"
)
@Comment
(
"围栏规则"
)
public
class
LocationFenceRule
implements
Serializable
{
public
class
LocationFenceRule
extends
BasicEntity
implements
Serializable
{
@Serial
@Serial
private
static
final
long
serialVersionUID
=
-
6683465582430417205L
;
private
static
final
long
serialVersionUID
=
-
6683465582430417205L
;
@Comment
(
"主键"
)
@Id
@GeneratedValue
(
generator
=
SnowflakeId
.
GENERATOR
)
@GenericGenerator
(
name
=
SnowflakeId
.
GENERATOR
,
strategy
=
SnowflakeId
.
Strategy
.
LONG
)
Long
id
;
@Comment
(
"围栏"
)
@Comment
(
"围栏"
)
@ManyToOne
@ManyToOne
@JoinColumn
(
name
=
"fence_id"
)
@JoinColumn
(
name
=
"fence_id"
)
LocationFence
fence
;
LocationFence
fence
;
// TODO
// 字段补充
// 关联表补充(报警规则)
// 关联表配置值补充
@FieldMapping
(
"entityTypes"
)
@Comment
(
"规则模型"
)
@Enumerated
(
EnumType
.
STRING
)
Mode
mode
;
@Comment
(
"规则名称"
)
String
name
;
@Comment
(
"规则描述"
)
String
describe
;
@Comment
(
"最小值(人数)"
)
Integer
minValue
;
@Comment
(
"最大值(人数)"
)
Integer
maxValue
;
@Comment
(
"规则生效开始时间"
)
LocalTime
minTime
;
@Comment
(
"规则生效结束时间"
)
LocalTime
maxTime
;
@Comment
(
"允许的用户(人员)"
)
@OneToMany
@Builder
.
Default
@ToString
.
Exclude
Set
<
User
>
includes
=
new
HashSet
<>(
0
);
@Comment
(
"不允许的用户(人员)"
)
@OneToMany
@Builder
.
Default
@ToString
.
Exclude
Set
<
User
>
excludes
=
new
HashSet
<>(
0
);
@SuppressWarnings
({
"unused"
})
public
enum
Mode
{
STAFF
(
"人员"
),
NUMBER
(
"数量"
);
@Getter
final
String
text
;
Mode
(
String
text
)
{
this
.
text
=
text
;
}
}
}
}
app/src/main/java/com/yiring/app/domain/location/LocationLog.java
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
domain
.
location
;
package
com
.
yiring
.
app
.
domain
.
location
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
Object
;
import
com.vladmihalcea.hibernate.type.json.JsonType
;
import
com.vladmihalcea.hibernate.type.json.JsonType
;
import
com.yiring.auth.domain.user.User
;
import
com.yiring.auth.domain.user.User
;
import
java.io.Serial
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.Objects
;
import
java.util.Set
;
import
java.util.Set
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
lombok.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldNameConstants
;
import
lombok.experimental.FieldNameConstants
;
import
org.hibernate.Hibernate
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.
GenericGenerator
;
import
org.hibernate.annotations.
CreationTimestamp
;
import
org.hibernate.annotations.Type
;
import
org.hibernate.annotations.Type
;
import
org.hibernate.annotations.TypeDef
;
import
org.hibernate.annotations.TypeDef
;
import
org.hibernate.snowflake.SnowflakeId
;
import
org.locationtech.jts.geom.Point
;
import
org.locationtech.jts.geom.Point
;
/**
/**
* 定位数据
* 定位数据
* 引用: 定位平台接口规范V3.0.1 #6
* 引用: 定位平台接口规范V3.0.1 #6
* TODO:
* 1. 实时数据日志的存储结构 TimeScale: 时间粒度,每天一个分区
* eg: SELECT create_hypertable('BS_LOCATION_LOG', 'time', chunk_time_interval => INTERVAL '1 day')
*
*
* @author Jim
* @author Jim
* @version 0.1
* @version 0.1
...
@@ -42,18 +41,24 @@ import org.locationtech.jts.geom.Point;
...
@@ -42,18 +41,24 @@ import org.locationtech.jts.geom.Point;
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@Entity
@Entity
@TypeDef
(
name
=
"json"
,
typeClass
=
JsonType
.
class
)
@TypeDef
(
name
=
"json"
,
typeClass
=
JsonType
.
class
)
@Table
(
name
=
"BS_LOCATION_LOG"
,
indexes
=
{
@Index
(
columnList
=
"time"
),
@Index
(
columnList
=
"silent"
)
}
)
@Table
(
name
=
"BS_LOCATION_LOG"
)
@Comment
(
"定位数据"
)
@Comment
(
"定位数据"
)
public
class
LocationLog
implements
Serializable
{
public
class
LocationLog
implements
Serializable
{
@Serial
@Serial
private
static
final
long
serialVersionUID
=
3467455881020691989L
;
private
static
final
long
serialVersionUID
=
3467455881020691989L
;
@Comment
(
"主键"
)
@Id
@Id
@GeneratedValue
(
generator
=
SnowflakeId
.
GENERATOR
)
@Comment
(
"时间"
)
@GenericGenerator
(
name
=
SnowflakeId
.
GENERATOR
,
strategy
=
SnowflakeId
.
Strategy
.
LONG
)
@Column
(
nullable
=
false
,
columnDefinition
=
"timestamp without time zone"
)
Long
id
;
@CreationTimestamp
LocalDateTime
time
;
@Comment
(
"地图 ID"
)
Long
areaId
;
@Comment
(
"楼层"
)
String
floor
;
/**
/**
* 来源于定位数据产生时刻标签所属的人员
* 来源于定位数据产生时刻标签所属的人员
...
@@ -74,19 +79,6 @@ public class LocationLog implements Serializable {
...
@@ -74,19 +79,6 @@ public class LocationLog implements Serializable {
@JoinColumn
(
name
=
"tag_id"
)
@JoinColumn
(
name
=
"tag_id"
)
LocationTag
tag
;
LocationTag
tag
;
@Comment
(
"时间"
)
@Column
(
nullable
=
false
)
LocalDateTime
time
;
@Comment
(
"经度"
)
BigDecimal
lon
;
@Comment
(
"纬度"
)
BigDecimal
lat
;
@Comment
(
"海拔高度(m)"
)
BigDecimal
altitude
;
@Comment
(
"坐标点信息"
)
@Comment
(
"坐标点信息"
)
@Type
(
type
=
"jts_geometry"
)
@Type
(
type
=
"jts_geometry"
)
@Column
(
columnDefinition
=
"point"
)
@Column
(
columnDefinition
=
"point"
)
...
@@ -94,13 +86,13 @@ public class LocationLog implements Serializable {
...
@@ -94,13 +86,13 @@ public class LocationLog implements Serializable {
@Comment
(
"信标集合"
)
@Comment
(
"信标集合"
)
@Builder
.
Default
@Builder
.
Default
@
Many
ToMany
@
One
ToMany
@ToString
.
Exclude
@ToString
.
Exclude
Set
<
LocationBeacon
>
beacons
=
new
HashSet
<>(
0
);
Set
<
LocationBeacon
>
beacons
=
new
HashSet
<>(
0
);
@Comment
(
"围栏集合"
)
@Comment
(
"围栏集合"
)
@Builder
.
Default
@Builder
.
Default
@
Many
ToMany
@
One
ToMany
@ToString
.
Exclude
@ToString
.
Exclude
Set
<
LocationFence
>
fences
=
new
HashSet
<>(
0
);
Set
<
LocationFence
>
fences
=
new
HashSet
<>(
0
);
...
@@ -116,21 +108,8 @@ public class LocationLog implements Serializable {
...
@@ -116,21 +108,8 @@ public class LocationLog implements Serializable {
@Comment
(
"原始数据"
)
@Comment
(
"原始数据"
)
@org
.
hibernate
.
annotations
.
Type
(
type
=
"json"
)
@org
.
hibernate
.
annotations
.
Type
(
type
=
"json"
)
@Column
(
columnDefinition
=
"json"
)
@Column
(
columnDefinition
=
"json"
)
JSON
raw
;
JSONObject
raw
;
@Comment
(
"创建时间"
)
@Comment
(
"定位时间"
)
LocalDateTime
createTime
;
LocalDateTime
locationTime
;
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
Hibernate
.
getClass
(
this
)
!=
Hibernate
.
getClass
(
o
))
return
false
;
LocationLog
locationLog
=
(
LocationLog
)
o
;
return
id
!=
null
&&
Objects
.
equals
(
id
,
locationLog
.
id
);
}
@Override
public
int
hashCode
()
{
return
getClass
().
hashCode
();
}
}
}
app/src/main/java/com/yiring/app/domain/location/LocationLogRepository.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
domain
.
location
;
import
java.io.Serializable
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.stereotype.Repository
;
/**
* @author Jim
* @version 0.1
* 2022/4/24 18:03
*/
@Repository
public
interface
LocationLogRepository
extends
JpaRepository
<
LocationLog
,
Serializable
>,
JpaSpecificationExecutor
<
LocationLog
>
{}
app/src/main/java/com/yiring/app/domain/location/LocationTag.java
浏览文件 @
1cb3b1b2
...
@@ -3,16 +3,18 @@ package com.yiring.app.domain.location;
...
@@ -3,16 +3,18 @@ package com.yiring.app.domain.location;
import
com.yiring.auth.domain.user.User
;
import
com.yiring.auth.domain.user.User
;
import
com.yiring.common.annotation.FieldMapping
;
import
com.yiring.common.annotation.FieldMapping
;
import
com.yiring.common.domain.BasicEntity
;
import
java.io.Serial
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.Objects
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
lombok.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldNameConstants
;
import
lombok.experimental.FieldNameConstants
;
import
lombok.experimental.SuperBuilder
;
import
org.hibernate.Hibernate
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.GenericGenerator
;
import
org.hibernate.snowflake.SnowflakeId
;
/**
/**
* 定位标签
* 定位标签
...
@@ -28,7 +30,7 @@ import org.hibernate.snowflake.SnowflakeId;
...
@@ -28,7 +30,7 @@ import org.hibernate.snowflake.SnowflakeId;
@Getter
@Getter
@Setter
@Setter
@ToString
@ToString
@
Builder
@
SuperBuilder
(
toBuilder
=
true
)
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@FieldNameConstants
@FieldNameConstants
...
@@ -45,17 +47,11 @@ import org.hibernate.snowflake.SnowflakeId;
...
@@ -45,17 +47,11 @@ import org.hibernate.snowflake.SnowflakeId;
}
}
)
)
@Comment
(
"定位标签"
)
@Comment
(
"定位标签"
)
public
class
LocationTag
implements
Serializable
{
public
class
LocationTag
extends
BasicEntity
implements
Serializable
{
@Serial
@Serial
private
static
final
long
serialVersionUID
=
5419734189897829250L
;
private
static
final
long
serialVersionUID
=
5419734189897829250L
;
@Comment
(
"主键"
)
@Id
@GeneratedValue
(
generator
=
SnowflakeId
.
GENERATOR
)
@GenericGenerator
(
name
=
SnowflakeId
.
GENERATOR
,
strategy
=
SnowflakeId
.
Strategy
.
LONG
)
Long
id
;
/**
/**
* 数据来源于【真源人员定位系统 - 定位标签】
* 数据来源于【真源人员定位系统 - 定位标签】
* 作用: 用于双向联动进行数据同步
* 作用: 用于双向联动进行数据同步
...
@@ -127,6 +123,14 @@ public class LocationTag implements Serializable {
...
@@ -127,6 +123,14 @@ public class LocationTag implements Serializable {
}
}
@Override
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
Hibernate
.
getClass
(
this
)
!=
Hibernate
.
getClass
(
o
))
return
false
;
LocationTag
that
=
(
LocationTag
)
o
;
return
getId
()
!=
null
&&
Objects
.
equals
(
getId
(),
that
.
getId
());
}
@Override
public
int
hashCode
()
{
public
int
hashCode
()
{
return
getClass
().
hashCode
();
return
getClass
().
hashCode
();
}
}
...
...
app/src/main/java/com/yiring/app/domain/log/ZyRealtimeLog.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
domain
.
log
;
import
com.alibaba.fastjson.JSONObject
;
import
com.vladmihalcea.hibernate.type.json.JsonBinaryType
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
javax.persistence.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldNameConstants
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.CreationTimestamp
;
import
org.hibernate.annotations.TypeDef
;
/**
* 真源定位系统实时数据日志
* TODO:
* 1. 实时数据日志的存储结构 TimeScale: 时间粒度,每小时一个分区
* eg: SELECT create_hypertable('ZY_REALTIME_LOG', 'time', chunk_time_interval => INTERVAL '1 hour')
* 2. 数据分区压缩
* 3. 定时删除过期分区数据
* 参考:<a href="https://blog.csdn.net/yang_z_1/article/details/111560747">文档</a>
*
* @author Jim
* @version 0.1
* 2022/4/25 15:52
*/
@Getter
@Setter
@ToString
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldNameConstants
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@Entity
@TypeDef
(
name
=
"jsonb"
,
typeClass
=
JsonBinaryType
.
class
)
@Table
(
name
=
"ZY_REALTIME_LOG"
,
indexes
=
{
@Index
(
columnList
=
"method"
)
})
@Comment
(
"真源定位系统实时数据日志"
)
public
class
ZyRealtimeLog
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
5545864821082386L
;
@Id
@Comment
(
"时间"
)
@Column
(
nullable
=
false
,
columnDefinition
=
"timestamp without time zone"
)
@CreationTimestamp
LocalDateTime
time
;
@Comment
(
"类型"
)
@Column
(
nullable
=
false
)
String
method
;
@Comment
(
"内容"
)
@org
.
hibernate
.
annotations
.
Type
(
type
=
"jsonb"
)
@Column
(
nullable
=
false
,
columnDefinition
=
"jsonb"
)
JSONObject
raw
;
}
app/src/main/java/com/yiring/app/domain/log/ZyRealtimeLogRepository.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
domain
.
log
;
import
java.io.Serializable
;
import
org.springframework.data.jpa.repository.JpaRepository
;
/**
* @author Jim
* @version 0.1
* 2022/4/25 16:02
*/
public
interface
ZyRealtimeLogRepository
extends
JpaRepository
<
ZyRealtimeLog
,
Serializable
>
{}
app/src/main/java/com/yiring/app/domain/visitor/Visitor.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
domain
.
visitor
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
javax.persistence.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldNameConstants
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.GenericGenerator
;
import
org.hibernate.snowflake.SnowflakeId
;
/**
* @author tzl
* 2022/4/19 11:41
*/
@Getter
@Setter
@ToString
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldNameConstants
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@Entity
@Table
(
name
=
"BS_VISITOR"
)
@Comment
(
"访客信息"
)
public
class
Visitor
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
7367226565168197562L
;
@Id
@Comment
(
"主键"
)
@GeneratedValue
(
generator
=
SnowflakeId
.
GENERATOR
)
@GenericGenerator
(
name
=
SnowflakeId
.
GENERATOR
,
strategy
=
SnowflakeId
.
Strategy
.
LONG
)
Long
id
;
@Comment
(
"到访人姓名"
)
String
visitorName
;
@Comment
(
"到访人电话"
)
String
visitorMobile
;
@Comment
(
"到访人身份证"
)
String
visitorCarNum
;
@Comment
(
"是否特殊作业"
)
boolean
taskType
;
@Comment
(
"邀请人数"
)
Integer
numOfVisitor
;
@Comment
(
"访客来源"
)
String
visitorSource
;
@Comment
(
"标签卡"
)
String
labelCard
;
@Comment
(
"标签卡状态"
)
String
labelCardStatus
;
@Comment
(
"所属单位id"
)
String
orgId
;
@Comment
(
"被访人id"
)
String
intervieweeId
;
@Comment
(
"来访原因"
)
String
reason
;
@Comment
(
"收卡时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
LocalDateTime
cardRecTime
;
@Comment
(
"预约到访时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
LocalDateTime
appOfVisitTime
;
@Comment
(
"创建时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
LocalDateTime
createTime
;
@Comment
(
"发卡时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
LocalDateTime
cardSendTime
;
@Comment
(
"备用字段"
)
String
reserve1
;
@Comment
(
"备用字段"
)
String
reserve2
;
@Comment
(
"备用字段"
)
String
reserve3
;
}
app/src/main/java/com/yiring/app/domain/visitor/VisitorRepository.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
domain
.
visitor
;
import
java.io.Serializable
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.stereotype.Repository
;
/**
* @author tzl
* 2022/4/19 14:06
*/
@Repository
public
interface
VisitorRepository
extends
JpaRepository
<
Visitor
,
Serializable
>,
JpaSpecificationExecutor
<
Visitor
>
{}
app/src/main/java/com/yiring/app/excel/car/CarExportExcel.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
excel
.
car
;
import
com.github.liaochong.myexcel.core.annotation.ExcelColumn
;
import
com.github.liaochong.myexcel.core.annotation.ExcelModel
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* @author tzl
* 2022/4/20 10:35
*/
@ExcelModel
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
CarExportExcel
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
4019303809667111441L
;
@ExcelColumn
(
title
=
"车牌"
)
String
carNum
;
@ExcelColumn
(
title
=
"车辆类型"
)
String
carType
;
@ExcelColumn
(
title
=
"司机"
)
String
driverName
;
@ExcelColumn
(
title
=
"联系电话"
)
String
driverMobile
;
@ExcelColumn
(
title
=
"所属单位"
)
String
orgId
;
@ExcelColumn
(
title
=
"来访原因"
,
width
=
15
)
String
reason
;
@ExcelColumn
(
title
=
"被访人"
)
String
intervieweeId
;
@ExcelColumn
(
title
=
"到访时间"
,
format
=
"yyyy-MM-dd HH:mm:ss"
,
width
=
15
)
LocalDateTime
cardSendTime
;
@ExcelColumn
(
title
=
"标签卡"
)
String
labelCard
;
@ExcelColumn
(
title
=
"收卡时间"
,
format
=
"yyyy-MM-dd HH:mm:ss"
,
width
=
15
)
LocalDateTime
cardRecTime
;
}
app/src/main/java/com/yiring/app/excel/video/VideoExportExcel.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
excel
.
video
;
import
com.github.liaochong.myexcel.core.annotation.ExcelColumn
;
import
com.github.liaochong.myexcel.core.annotation.ExcelModel
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
org.locationtech.jts.geom.Point
;
/**
* @author tzl
* 2022/4/20 16:21
*/
@ExcelModel
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
VideoExportExcel
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
5422685189135254189L
;
@ExcelColumn
(
title
=
"编号"
,
width
=
10
)
String
uuid
;
@ExcelColumn
(
title
=
"摄像头名称"
,
width
=
10
)
String
videoName
;
@ExcelColumn
(
title
=
"坐标点信息(经度,纬度)"
,
width
=
10
)
Point
point
;
@ExcelColumn
(
title
=
"m3u8 地址"
,
width
=
10
)
String
m3u8
;
@ExcelColumn
(
title
=
"备注"
,
width
=
15
)
String
remark
;
//
// String status;
}
app/src/main/java/com/yiring/app/excel/video/VideoImportExcel.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
excel
.
video
;
import
com.github.liaochong.myexcel.core.annotation.ExcelColumn
;
import
com.github.liaochong.myexcel.core.annotation.ExcelModel
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* @author tzl
* 2022/4/20 16:21
*/
@ExcelModel
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
VideoImportExcel
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
5422685189135254189L
;
@ExcelColumn
(
title
=
"编号"
)
String
uuid
;
@ExcelColumn
(
title
=
"摄像头名称"
)
String
videoName
;
@ExcelColumn
(
title
=
"m3u8 地址"
)
String
m3u8
;
@ExcelColumn
(
title
=
"备注"
)
String
remark
;
@ExcelColumn
(
title
=
"经度"
)
double
lon
;
@ExcelColumn
(
title
=
"纬度"
)
double
lat
;
// String status;
}
app/src/main/java/com/yiring/app/excel/visitor/VisitorExportExcel.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
excel
.
visitor
;
import
com.github.liaochong.myexcel.core.annotation.ExcelColumn
;
import
com.github.liaochong.myexcel.core.annotation.ExcelModel
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* @author tzl
* 2022/4/21 9:37
*/
@ExcelModel
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
VisitorExportExcel
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
5732379257900745806L
;
@ExcelColumn
(
title
=
"到访人姓名"
)
String
visitorName
;
@ExcelColumn
(
title
=
"到访人姓名"
)
String
visitorMobile
;
@ExcelColumn
(
title
=
"到访人身份证"
)
String
visitorCarNum
;
@ExcelColumn
(
title
=
"是否特殊作业"
)
boolean
taskType
;
@ExcelColumn
(
title
=
"邀请人数"
)
Integer
numOfVisitor
;
@ExcelColumn
(
title
=
"访客来源"
)
String
visitorSource
;
@ExcelColumn
(
title
=
"标签卡"
)
String
labelCard
;
@ExcelColumn
(
title
=
"标签卡状态"
,
mapping
=
"1:未发卡,2:使用中,3:已收卡"
)
String
labelCardStatus
;
@ExcelColumn
(
title
=
"所属单位"
)
String
orgId
;
@ExcelColumn
(
title
=
"被访人"
)
String
intervieweeId
;
@ExcelColumn
(
title
=
"来访原因"
)
String
reason
;
@ExcelColumn
(
title
=
"收卡时间"
)
LocalDateTime
cardRecTime
;
@ExcelColumn
(
title
=
"预约到访时间"
)
LocalDateTime
appOfVisitTime
;
@ExcelColumn
(
title
=
"发卡时间"
)
LocalDateTime
cardSendTime
;
}
app/src/main/java/com/yiring/app/feign/GbClient.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
feign
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yiring.app.param.video.StreamProxyItem
;
import
feign.Response
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.*
;
/**
* @author tzl
* 2022/4/18 14:22
*/
@FeignClient
(
url
=
"${env.host}:3008"
,
name
=
"gb"
)
public
interface
GbClient
{
/**
* 国标登录接口
* @param username 用户名
* @param password 密码
* @return Response
*/
@RequestMapping
(
value
=
"/api/user/login"
,
method
=
RequestMethod
.
GET
)
Response
userLogin
(
@RequestParam
(
name
=
"username"
)
String
username
,
@RequestParam
(
name
=
"password"
)
String
password
);
/**
* 拉流数据同步接口
* @param streamProxyItem 拉流对象
* @param cookie cookie
* @return 是否成功
*/
@RequestMapping
(
value
=
"/api/proxy/save"
,
method
=
RequestMethod
.
POST
)
JSONObject
proxySave
(
@RequestBody
StreamProxyItem
streamProxyItem
,
@RequestHeader
(
"Cookie"
)
String
cookie
);
/**
* 拉流删除接口
* @param app 流应用名
* @param stream 流编号
* @param cookie cookie
* @return 是否成功
*/
@RequestMapping
(
value
=
"/api/proxy/del"
,
method
=
RequestMethod
.
DELETE
)
JSONObject
proxyDel
(
@RequestParam
(
name
=
"app"
)
String
app
,
@RequestParam
(
name
=
"stream"
)
String
stream
,
@RequestHeader
(
"Cookie"
)
String
cookie
);
}
app/src/main/java/com/yiring/app/feign/MapClient.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
feign
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.*
;
@FeignClient
(
url
=
"http://project.yz-online.com:789"
,
name
=
"mapClient"
)
public
interface
MapClient
{
/**
* 地图层数据
* @author tzl
* @date 2022/4/25 10:51
* @param orgId 单位id
* @param token 认证参数
* @return com.alibaba.fastjson.JSONObject
*/
@RequestMapping
(
value
=
"/positionApi/api/area/allList/{orgId}"
,
method
=
RequestMethod
.
GET
)
JSONObject
selectMap
(
@PathVariable
(
"orgId"
)
String
orgId
,
@RequestHeader
(
"Authorization"
)
String
token
);
}
app/src/main/java/com/yiring/app/feign/WxClient.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
feign
;
import
com.alibaba.fastjson.JSONObject
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
@FeignClient
(
url
=
"api.weixin.qq.com"
,
name
=
"wxclient"
)
public
interface
WxClient
{
/**
* 获取微信用户唯一标识
*
* @param appid String
* @param secret String
* @param js_code String
* @param grant_type String
* @return com.alibaba.fastjson.JSONObject
* @author tzl
* @date 15:20
*/
@RequestMapping
(
value
=
"/sns/jscode2session"
,
method
=
RequestMethod
.
GET
)
@ApiImplicitParams
(
{
@ApiImplicitParam
(
value
=
"appid"
,
required
=
true
,
name
=
"appid"
),
@ApiImplicitParam
(
value
=
"secret"
,
required
=
true
,
name
=
"secret"
),
@ApiImplicitParam
(
value
=
"js_code"
,
required
=
true
,
name
=
"js_code"
),
@ApiImplicitParam
(
value
=
"grant_type"
,
required
=
true
,
name
=
"grant_type"
),
}
)
JSONObject
getOpenid
(
String
appid
,
String
secret
,
String
js_code
,
String
grant_type
);
}
app/src/main/java/com/yiring/app/param/car/CarParam.java
浏览文件 @
1cb3b1b2
...
@@ -4,6 +4,8 @@ package com.yiring.app.param.car;
...
@@ -4,6 +4,8 @@ package com.yiring.app.param.car;
import
com.yiring.common.constant.RegEx
;
import
com.yiring.common.constant.RegEx
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.Pattern
;
import
javax.validation.constraints.Pattern
;
import
javax.validation.constraints.Size
;
import
javax.validation.constraints.Size
;
...
@@ -20,7 +22,10 @@ import lombok.experimental.FieldDefaults;
...
@@ -20,7 +22,10 @@ import lombok.experimental.FieldDefaults;
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
CarParam
{
public
class
CarParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
521351582969232371L
;
@ApiModelProperty
(
value
=
"车牌号码"
,
example
=
"湘A99999"
,
required
=
true
)
@ApiModelProperty
(
value
=
"车牌号码"
,
example
=
"湘A99999"
,
required
=
true
)
@NotEmpty
(
message
=
"车牌号码不能为空"
)
@NotEmpty
(
message
=
"车牌号码不能为空"
)
...
@@ -39,12 +44,6 @@ public class CarParam {
...
@@ -39,12 +44,6 @@ public class CarParam {
@Pattern
(
regexp
=
RegEx
.
MOBILE
,
message
=
"手机号码格式不正确"
)
@Pattern
(
regexp
=
RegEx
.
MOBILE
,
message
=
"手机号码格式不正确"
)
String
driverMobile
;
String
driverMobile
;
// @ApiModelProperty(value = "标签卡", example = "DW24515512")
// String labelCard;
//
// @ApiModelProperty(value = "标签卡状态", example = "使用中")
// String labelCardStatus;
@ApiModelProperty
(
value
=
"所属单位id"
,
example
=
"1"
,
required
=
true
)
@ApiModelProperty
(
value
=
"所属单位id"
,
example
=
"1"
,
required
=
true
)
@NotEmpty
(
message
=
"所属单位id不能为空"
)
@NotEmpty
(
message
=
"所属单位id不能为空"
)
String
orgId
;
String
orgId
;
...
@@ -57,11 +56,4 @@ public class CarParam {
...
@@ -57,11 +56,4 @@ public class CarParam {
@NotEmpty
(
message
=
"来访原因不能为空"
)
@NotEmpty
(
message
=
"来访原因不能为空"
)
@Size
(
min
=
1
,
max
=
20
,
message
=
"来访原因超出范围"
)
@Size
(
min
=
1
,
max
=
20
,
message
=
"来访原因超出范围"
)
String
reason
;
String
reason
;
// @ApiModelProperty(value = "收卡时间", example = "2022-04-11 17:25:33")
// LocalDateTime cardRecTime;
//
// @ApiModelProperty(value = "发卡时间", example = "2022-04-11 17:25:33")
// LocalDateTime cardSendTime;
// @ApiModelProperty(value = "创建时间", example = "")
// LocalDateTime createTime;
}
}
app/src/main/java/com/yiring/app/param/car/CarQueryParam.java
浏览文件 @
1cb3b1b2
...
@@ -3,6 +3,8 @@ package com.yiring.app.param.car;
...
@@ -3,6 +3,8 @@ package com.yiring.app.param.car;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
lombok.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldDefaults
;
...
@@ -17,14 +19,15 @@ import lombok.experimental.FieldDefaults;
...
@@ -17,14 +19,15 @@ import lombok.experimental.FieldDefaults;
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
CarQueryParam
{
public
class
CarQueryParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
2107446950936463302L
;
@ApiModelProperty
(
value
=
"每页记录数"
,
example
=
"10"
)
@ApiModelProperty
(
value
=
"每页记录数"
,
example
=
"10"
)
// @DecimalMin(value = "1", message = "分页条数不能小于1")
Integer
pageSize
;
Integer
pageSize
;
@ApiModelProperty
(
value
=
"页码"
,
example
=
"1"
)
@ApiModelProperty
(
value
=
"页码"
,
example
=
"1"
)
// @DecimalMin(value = "1", message = "页码不能小于1")
Integer
pageNo
;
Integer
pageNo
;
@ApiModelProperty
(
value
=
"车牌号码"
,
example
=
"湘A12345"
)
@ApiModelProperty
(
value
=
"车牌号码"
,
example
=
"湘A12345"
)
...
@@ -42,9 +45,6 @@ public class CarQueryParam {
...
@@ -42,9 +45,6 @@ public class CarQueryParam {
@ApiModelProperty
(
value
=
"标签卡"
,
example
=
"DW24515512"
)
@ApiModelProperty
(
value
=
"标签卡"
,
example
=
"DW24515512"
)
String
labelCard
;
String
labelCard
;
@ApiModelProperty
(
value
=
"标签卡状态"
,
example
=
"2"
)
String
labelCardStatus
;
@ApiModelProperty
(
value
=
"所属单位id"
,
example
=
"1"
)
@ApiModelProperty
(
value
=
"所属单位id"
,
example
=
"1"
)
String
orgId
;
String
orgId
;
...
@@ -60,6 +60,9 @@ public class CarQueryParam {
...
@@ -60,6 +60,9 @@ public class CarQueryParam {
@ApiModelProperty
(
value
=
"收卡时间(结束)"
,
example
=
"2022-04-11 17:26:33"
)
@ApiModelProperty
(
value
=
"收卡时间(结束)"
,
example
=
"2022-04-11 17:26:33"
)
LocalDateTime
cardRecTimeEnd
;
LocalDateTime
cardRecTimeEnd
;
/**
* 来访时间参数字段名用错 应该时 cardSendTimeStart
*/
@ApiModelProperty
(
value
=
"来访时间(开始)"
,
example
=
"2022-04-11 17:25:33"
)
@ApiModelProperty
(
value
=
"来访时间(开始)"
,
example
=
"2022-04-11 17:25:33"
)
LocalDateTime
createTimeStart
;
LocalDateTime
createTimeStart
;
...
...
app/src/main/java/com/yiring/app/param/dict/DictParam.java
浏览文件 @
1cb3b1b2
...
@@ -3,6 +3,7 @@ package com.yiring.app.param.dict;
...
@@ -3,6 +3,7 @@ package com.yiring.app.param.dict;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotEmpty
;
import
lombok.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldDefaults
;
...
@@ -17,7 +18,9 @@ import lombok.experimental.FieldDefaults;
...
@@ -17,7 +18,9 @@ import lombok.experimental.FieldDefaults;
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
DictParam
{
public
class
DictParam
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
6297680882890239905L
;
@ApiModelProperty
(
value
=
"排序"
,
example
=
"1"
,
required
=
true
)
@ApiModelProperty
(
value
=
"排序"
,
example
=
"1"
,
required
=
true
)
Integer
dictSort
;
Integer
dictSort
;
...
...
app/src/main/java/com/yiring/app/param/dict/DictQueryParam.java
浏览文件 @
1cb3b1b2
...
@@ -3,6 +3,7 @@ package com.yiring.app.param.dict;
...
@@ -3,6 +3,7 @@ package com.yiring.app.param.dict;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
import
lombok.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldDefaults
;
...
@@ -16,7 +17,9 @@ import lombok.experimental.FieldDefaults;
...
@@ -16,7 +17,9 @@ import lombok.experimental.FieldDefaults;
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
DictQueryParam
{
public
class
DictQueryParam
implements
Serializable
{
private
static
final
long
serialVersionUID
=
558672306975530791L
;
@ApiModelProperty
(
value
=
"字典标签"
,
example
=
"男"
)
@ApiModelProperty
(
value
=
"字典标签"
,
example
=
"男"
)
String
dictLabel
;
String
dictLabel
;
...
...
app/src/main/java/com/yiring/app/param/dict/DictTypeParam.java
浏览文件 @
1cb3b1b2
...
@@ -3,6 +3,7 @@ package com.yiring.app.param.dict;
...
@@ -3,6 +3,7 @@ package com.yiring.app.param.dict;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotEmpty
;
import
lombok.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldDefaults
;
...
@@ -17,7 +18,9 @@ import lombok.experimental.FieldDefaults;
...
@@ -17,7 +18,9 @@ import lombok.experimental.FieldDefaults;
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
DictTypeParam
{
public
class
DictTypeParam
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
4725073029525910806L
;
@ApiModelProperty
(
value
=
"字典名称"
,
example
=
"性别"
,
required
=
true
)
@ApiModelProperty
(
value
=
"字典名称"
,
example
=
"性别"
,
required
=
true
)
@NotEmpty
(
message
=
"字典名称不能为空"
)
@NotEmpty
(
message
=
"字典名称不能为空"
)
...
...
app/src/main/java/com/yiring/app/param/dict/DictTypeQueryParam.java
浏览文件 @
1cb3b1b2
...
@@ -3,6 +3,7 @@ package com.yiring.app.param.dict;
...
@@ -3,6 +3,7 @@ package com.yiring.app.param.dict;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
import
lombok.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldDefaults
;
...
@@ -16,7 +17,9 @@ import lombok.experimental.FieldDefaults;
...
@@ -16,7 +17,9 @@ import lombok.experimental.FieldDefaults;
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
DictTypeQueryParam
{
public
class
DictTypeQueryParam
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
2940949823473695962L
;
@ApiModelProperty
(
value
=
"字典名称"
,
example
=
"性别"
)
@ApiModelProperty
(
value
=
"字典名称"
,
example
=
"性别"
)
String
dictName
;
String
dictName
;
...
...
app/src/main/java/com/yiring/app/param/video/StreamProxyItem.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
video
;
import
io.swagger.annotations.ApiModel
;
import
java.io.Serializable
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* @author tzl
* 2022/4/18 15:21
*/
@ApiModel
(
"StreamProxyItem"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
StreamProxyItem
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
7345369573992941431L
;
//名称
String
name
;
//流应用名称
String
app
;
//流id
String
stream
;
//拉流地址
String
url
;
//类型,根据地址是否有关键字判断
String
type
;
//节点选择
String
mediaServerId
;
//是否启用
boolean
enable
;
//是否转HLS
boolean
enable_hls
;
Integer
timeout_ms
;
}
app/src/main/java/com/yiring/app/param/video/VideoParam.java
浏览文件 @
1cb3b1b2
...
@@ -3,8 +3,10 @@ package com.yiring.app.param.video;
...
@@ -3,8 +3,10 @@ package com.yiring.app.param.video;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Size
;
import
javax.validation.constraints.Size
;
import
lombok.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldDefaults
;
...
@@ -23,11 +25,14 @@ import lombok.experimental.FieldDefaults;
...
@@ -23,11 +25,14 @@ import lombok.experimental.FieldDefaults;
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
VideoParam
implements
Serializable
{
public
class
VideoParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
6031274771790265507L
;
@ApiModelProperty
(
value
=
"编号"
,
example
=
"88888888"
,
required
=
true
)
@ApiModelProperty
(
value
=
"编号"
,
example
=
"88888888"
,
required
=
true
)
@NotEmpty
(
message
=
"标识不能为空"
)
@NotEmpty
(
message
=
"标识不能为空"
)
String
uuid
;
String
uuid
;
@ApiModelProperty
(
value
=
"m3u8 媒体地址"
,
example
=
""
,
required
=
true
)
@ApiModelProperty
(
value
=
"m3u8 媒体地址"
,
example
=
"
m3u8 媒体地址
"
,
required
=
true
)
@NotEmpty
(
message
=
"m3u8 媒体地址不能为空"
)
@NotEmpty
(
message
=
"m3u8 媒体地址不能为空"
)
String
m3u8
;
String
m3u8
;
...
@@ -35,13 +40,13 @@ public class VideoParam implements Serializable {
...
@@ -35,13 +40,13 @@ public class VideoParam implements Serializable {
@NotEmpty
(
message
=
"摄像头名称不能为空"
)
@NotEmpty
(
message
=
"摄像头名称不能为空"
)
String
videoName
;
String
videoName
;
@ApiModelProperty
(
value
=
"经度"
,
example
=
"1"
,
required
=
true
)
@ApiModelProperty
(
value
=
"经度"
,
example
=
"1
.00
"
,
required
=
true
)
@Not
Empty
(
message
=
"经度"
)
@Not
Null
(
message
=
"经度"
)
d
ouble
lon
;
D
ouble
lon
;
@ApiModelProperty
(
value
=
"纬度"
,
example
=
"1"
,
required
=
true
)
@ApiModelProperty
(
value
=
"纬度"
,
example
=
"1
.00
"
,
required
=
true
)
@Not
Empty
(
message
=
"纬度"
)
@Not
Null
(
message
=
"纬度"
)
d
ouble
lat
;
D
ouble
lat
;
@ApiModelProperty
(
value
=
"备注"
,
example
=
"厂区摄像头"
)
@ApiModelProperty
(
value
=
"备注"
,
example
=
"厂区摄像头"
)
@Size
(
max
=
100
,
message
=
"备注不能超过100字"
)
@Size
(
max
=
100
,
message
=
"备注不能超过100字"
)
...
...
app/src/main/java/com/yiring/app/param/video/VideoQueryParam.java
浏览文件 @
1cb3b1b2
...
@@ -21,6 +21,8 @@ import lombok.experimental.FieldDefaults;
...
@@ -21,6 +21,8 @@ import lombok.experimental.FieldDefaults;
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
VideoQueryParam
implements
Serializable
{
public
class
VideoQueryParam
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
330684070308585411L
;
@ApiModelProperty
(
value
=
"编号"
,
example
=
"88888888"
)
@ApiModelProperty
(
value
=
"编号"
,
example
=
"88888888"
)
String
uuid
;
String
uuid
;
...
@@ -29,6 +31,12 @@ public class VideoQueryParam implements Serializable {
...
@@ -29,6 +31,12 @@ public class VideoQueryParam implements Serializable {
@ApiModelProperty
(
value
=
"状态"
,
example
=
"1"
)
@ApiModelProperty
(
value
=
"状态"
,
example
=
"1"
)
String
status
;
String
status
;
@ApiModelProperty
(
value
=
"分页条数"
,
example
=
"10"
)
Integer
pageSize
;
@ApiModelProperty
(
value
=
"当前页数"
,
example
=
"1"
)
Integer
pageNo
;
// @ApiModelProperty(value = "m3u8 地址", example = "")
// @ApiModelProperty(value = "m3u8 地址", example = "")
// @NotEmpty(message = "m3u8 地址不能为空")
// @NotEmpty(message = "m3u8 地址不能为空")
// String m3u8;
// String m3u8;
...
...
app/src/main/java/com/yiring/app/param/visitor/VisitorInfoParam.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
visitor
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
javax.validation.constraints.NotEmpty
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* @author tzl
* 2022/4/21 14:04
*/
@ApiModel
(
"VisitorInfo"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
VisitorInfoParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
3419577080791245488L
;
@ApiModelProperty
(
value
=
"到访人姓名"
,
example
=
"张三"
,
required
=
true
)
@NotEmpty
(
message
=
"到访人姓名不能为空"
)
String
visitorName
;
@ApiModelProperty
(
value
=
"到访人电话"
,
example
=
"17688888888"
,
required
=
true
)
@NotEmpty
(
message
=
"到访人电话不能为空"
)
String
visitorMobile
;
@ApiModelProperty
(
value
=
"到访人身份证"
,
example
=
"430441190001255417"
,
required
=
true
)
@NotEmpty
(
message
=
"到访人身份证不能为空"
)
String
visitorCarNum
;
@ApiModelProperty
(
value
=
"是否特殊作业"
,
example
=
"fasle"
,
required
=
true
)
boolean
taskType
;
}
app/src/main/java/com/yiring/app/param/visitor/VisitorListParam.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
visitor
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.util.List
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* @author tzl
* 2022/4/21 13:51
*/
@ApiModel
(
"VisitorParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
VisitorListParam
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
6356324790945367160L
;
@ApiModelProperty
(
value
=
"访客来源"
,
example
=
"内部邀请"
,
required
=
true
)
String
visitorSource
;
@ApiModelProperty
(
value
=
"来访原因"
,
example
=
"2022-04-19 14:28:00"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
LocalDateTime
appOfVisitTime
;
@ApiModelProperty
(
value
=
"被访人id"
,
example
=
"1"
,
required
=
true
)
String
intervieweeId
;
@ApiModelProperty
(
value
=
"来访原因"
,
example
=
"看看"
,
required
=
true
)
String
reason
;
@ApiModelProperty
(
value
=
"访客所属公司"
,
example
=
"壹润科技"
,
required
=
true
)
String
orgId
;
@ApiModelProperty
(
value
=
"邀请人数"
,
example
=
"1"
,
required
=
true
)
Integer
numOfVisitor
;
List
<
VisitorInfoParam
>
visitorInfos
;
}
app/src/main/java/com/yiring/app/param/visitor/VisitorParam.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
visitor
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
javax.validation.constraints.NotEmpty
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* @author tzl
* 2022/4/19 14:15
*/
@ApiModel
(
"VisitorParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
VisitorParam
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1444009404727514785L
;
@ApiModelProperty
(
value
=
"到访人姓名"
,
example
=
"张三"
,
required
=
true
)
@NotEmpty
(
message
=
"到访人姓名不能为空"
)
String
visitorName
;
@ApiModelProperty
(
value
=
"到访人电话"
,
example
=
"17688888888"
,
required
=
true
)
@NotEmpty
(
message
=
"到访人电话不能为空"
)
String
visitorMobile
;
@ApiModelProperty
(
value
=
"到访人身份证"
,
example
=
"430441190001255417"
,
required
=
true
)
@NotEmpty
(
message
=
"到访人身份证不能为空"
)
String
visitorCarNum
;
@ApiModelProperty
(
value
=
"是否特殊作业"
,
example
=
"fasle"
,
required
=
true
)
boolean
taskType
;
// @Comment("邀请人数")
// Integer numOfVisitor;
@ApiModelProperty
(
value
=
"访客来源"
,
example
=
"外部邀请"
,
required
=
true
)
String
visitorSource
;
// @Comment("标签卡")
// String labelCard;
//
// @Comment("标签卡状态")
// String labelCardStatus;
@ApiModelProperty
(
value
=
"访客所属公司"
,
example
=
"壹润科技"
)
String
orgId
;
@ApiModelProperty
(
value
=
"被访人id"
,
example
=
"1"
,
required
=
true
)
String
intervieweeId
;
@ApiModelProperty
(
value
=
"来访原因"
,
example
=
"看看"
,
required
=
true
)
String
reason
;
// @ApiModelProperty(value = "发卡时间", example = "看看", required = true)
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
// LocalDateTime cardRecTime;
@ApiModelProperty
(
value
=
"来访原因"
,
example
=
"2022-04-19 14:28:00"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
LocalDateTime
appOfVisitTime
;
// @Comment("创建时间")
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
// LocalDateTime createTime;
//
// @Comment("发卡时间")
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
// LocalDateTime cardSendTime;
}
app/src/main/java/com/yiring/app/param/visitor/VisitorQueryParam.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
param
.
visitor
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* @author tzl
* 2022/4/19 14:15
*/
@ApiModel
(
"VisitorQueryParam"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
VisitorQueryParam
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
4314254785949101573L
;
@ApiModelProperty
(
value
=
"访客姓名"
,
example
=
"张三"
)
String
visitorName
;
@ApiModelProperty
(
value
=
"访客电话"
,
example
=
"17688888888"
)
String
visitorMobile
;
@ApiModelProperty
(
value
=
"访客身份证"
,
example
=
"430441190001255417"
)
String
visitorCarNum
;
@ApiModelProperty
(
value
=
"是否特殊作业"
,
example
=
"fasle"
)
String
taskType
;
@ApiModelProperty
(
value
=
"所属公司"
,
example
=
"壹润科技"
)
String
orgId
;
@ApiModelProperty
(
value
=
"访客来源"
,
example
=
"外部邀请"
)
String
visitorSource
;
@ApiModelProperty
(
value
=
"被访人id"
,
example
=
"1"
)
String
intervieweeId
;
@ApiModelProperty
(
value
=
"标签卡"
,
example
=
"DS41234231"
)
String
labelCard
;
@ApiModelProperty
(
value
=
"标签卡状态"
,
example
=
"1"
)
String
labelCardStatus
;
@ApiModelProperty
(
value
=
"预约到访时间(开始)"
,
example
=
"2022-04-19 14:28:00"
)
LocalDateTime
appOfVisitTimeStart
;
@ApiModelProperty
(
value
=
"预约到访时间(结束)"
,
example
=
"2022-04-19 14:28:00"
)
LocalDateTime
appOfVisitTimeEnd
;
@ApiModelProperty
(
value
=
"实际到访时间(开始)"
,
example
=
"2022-04-19 14:28:00"
)
LocalDateTime
cardSendTimeStart
;
@ApiModelProperty
(
value
=
"实际到访时间(结束)"
,
example
=
"2022-04-19 14:28:00"
)
LocalDateTime
cardSendTimeEnd
;
@ApiModelProperty
(
value
=
"收卡时间(开始)"
,
example
=
"2022-04-11 17:25:33"
)
LocalDateTime
cardRecTimeStart
;
@ApiModelProperty
(
value
=
"收卡时间(结束)"
,
example
=
"2022-04-11 17:26:33"
)
LocalDateTime
cardRecTimeEnd
;
@ApiModelProperty
(
value
=
"分页条数"
,
example
=
"10"
)
Integer
pageSize
;
@ApiModelProperty
(
value
=
"当前页数"
,
example
=
"1"
)
Integer
pageNo
;
}
app/src/main/java/com/yiring/app/rabbit/config/RabbitConfig.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
rabbit
.
config
;
import
javax.annotation.Resource
;
import
org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory
;
import
org.springframework.amqp.rabbit.connection.CachingConnectionFactory
;
import
org.springframework.amqp.rabbit.connection.ConnectionFactory
;
import
org.springframework.amqp.rabbit.core.RabbitTemplate
;
import
org.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.boot.autoconfigure.amqp.RabbitProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Primary
;
/**
* rabbitmq配置
*
* @author ifzm
* 2019/8/21 15:44
*/
@Configuration
public
class
RabbitConfig
{
@Resource
RabbitProperties
rabbitProperties
;
private
static
final
String
CONNECTION_FACTORY_NAME
=
"rabbitConnectionFactory"
;
@Bean
(
CONNECTION_FACTORY_NAME
)
@Primary
public
ConnectionFactory
connectionFactory
()
{
return
RabbitConfig
.
connectionFactory
(
rabbitProperties
.
getHost
(),
rabbitProperties
.
getPort
(),
rabbitProperties
.
getUsername
(),
rabbitProperties
.
getPassword
(),
rabbitProperties
.
getVirtualHost
()
);
}
@Bean
@Primary
public
RabbitListenerContainerFactory
<?>
rabbitListenerContainerFactory
(
@Qualifier
(
CONNECTION_FACTORY_NAME
)
ConnectionFactory
connectionFactory
)
{
SimpleRabbitListenerContainerFactory
factory
=
new
SimpleRabbitListenerContainerFactory
();
factory
.
setConnectionFactory
(
connectionFactory
);
return
factory
;
}
@Bean
@Primary
public
RabbitTemplate
rabbitTemplate
(
@Qualifier
(
CONNECTION_FACTORY_NAME
)
ConnectionFactory
connectionFactory
)
{
return
new
RabbitTemplate
(
connectionFactory
);
}
/**
* 创建连接工厂
*
* @param host 主机
* @param port 端口
* @param username 用户名
* @param password 密码
* @param virtualHost 虚拟主机
* @return 连接工厂
*/
public
static
CachingConnectionFactory
connectionFactory
(
String
host
,
int
port
,
String
username
,
String
password
,
String
virtualHost
)
{
CachingConnectionFactory
connectionFactory
=
new
CachingConnectionFactory
();
connectionFactory
.
setHost
(
host
);
connectionFactory
.
setPort
(
port
);
connectionFactory
.
setUsername
(
username
);
connectionFactory
.
setPassword
(
password
);
connectionFactory
.
setVirtualHost
(
virtualHost
);
return
connectionFactory
;
}
}
app/src/main/java/com/yiring/app/
config/zy
/ZyConfigProperties.java
→
app/src/main/java/com/yiring/app/
rabbit/config
/ZyConfigProperties.java
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
config
.
zy
;
package
com
.
yiring
.
app
.
rabbit
.
config
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
lombok.AccessLevel
;
import
lombok.AccessLevel
;
...
...
app/src/main/java/com/yiring/app/
config/zy
/ZyRabbitConfig.java
→
app/src/main/java/com/yiring/app/
rabbit/config
/ZyRabbitConfig.java
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
config
.
zy
;
package
com
.
yiring
.
app
.
rabbit
.
config
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.amqp.core.AcknowledgeMode
;
import
org.springframework.amqp.core.AcknowledgeMode
;
import
org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory
;
import
org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory
;
import
org.springframework.amqp.rabbit.connection.CachingConnectionFactory
;
import
org.springframework.amqp.rabbit.connection.ConnectionFactory
;
import
org.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.boot.autoconfigure.amqp.SimpleRabbitListenerContainerFactoryConfigurer
;
import
org.springframework.boot.autoconfigure.amqp.SimpleRabbitListenerContainerFactoryConfigurer
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
...
@@ -43,8 +44,8 @@ public class ZyRabbitConfig {
...
@@ -43,8 +44,8 @@ public class ZyRabbitConfig {
public
static
final
String
MESSAGE_QUEUES_NAME
=
"tenant_msg_12A14FDC_sc21080400"
;
public
static
final
String
MESSAGE_QUEUES_NAME
=
"tenant_msg_12A14FDC_sc21080400"
;
@Bean
(
CONNECTION_FACTORY_NAME
)
@Bean
(
CONNECTION_FACTORY_NAME
)
public
C
achingC
onnectionFactory
zyConnectionFactory
()
{
public
ConnectionFactory
zyConnectionFactory
()
{
return
connectionFactory
(
return
RabbitConfig
.
connectionFactory
(
rabbitmq
.
getHost
(),
rabbitmq
.
getHost
(),
rabbitmq
.
getPort
(),
rabbitmq
.
getPort
(),
rabbitmq
.
getUsername
(),
rabbitmq
.
getUsername
(),
...
@@ -54,9 +55,9 @@ public class ZyRabbitConfig {
...
@@ -54,9 +55,9 @@ public class ZyRabbitConfig {
}
}
@Bean
(
LISTENER_FACTORY_NAME
)
@Bean
(
LISTENER_FACTORY_NAME
)
public
SimpleRabbitListenerContainerFactory
second
Factory
(
public
RabbitListenerContainerFactory
<?>
rabbitListenerContainer
Factory
(
SimpleRabbitListenerContainerFactoryConfigurer
configurer
,
SimpleRabbitListenerContainerFactoryConfigurer
configurer
,
@Qualifier
(
CONNECTION_FACTORY_NAME
)
C
achingC
onnectionFactory
connectionFactory
@Qualifier
(
CONNECTION_FACTORY_NAME
)
ConnectionFactory
connectionFactory
)
{
)
{
// 检查队列名称是否与配置文件一致,避免监听错误
// 检查队列名称是否与配置文件一致,避免监听错误
if
(!
MESSAGE_QUEUES_NAME
.
equals
(
rabbitmq
.
getQueueName
()))
{
if
(!
MESSAGE_QUEUES_NAME
.
equals
(
rabbitmq
.
getQueueName
()))
{
...
@@ -66,31 +67,9 @@ public class ZyRabbitConfig {
...
@@ -66,31 +67,9 @@ public class ZyRabbitConfig {
}
}
SimpleRabbitListenerContainerFactory
factory
=
new
SimpleRabbitListenerContainerFactory
();
SimpleRabbitListenerContainerFactory
factory
=
new
SimpleRabbitListenerContainerFactory
();
// 最小消费者数量
factory
.
setConcurrentConsumers
(
1
);
// 最大消费者数量
factory
.
setMaxConcurrentConsumers
(
1
);
// 预读取一条消息
factory
.
setPrefetchCount
(
1
);
// 手动确认消息模式
// 手动确认消息模式
factory
.
setAcknowledgeMode
(
AcknowledgeMode
.
MANUAL
);
factory
.
setAcknowledgeMode
(
AcknowledgeMode
.
MANUAL
);
configurer
.
configure
(
factory
,
connectionFactory
);
configurer
.
configure
(
factory
,
connectionFactory
);
return
factory
;
return
factory
;
}
}
public
CachingConnectionFactory
connectionFactory
(
String
host
,
int
port
,
String
username
,
String
password
,
String
virtualHost
)
{
CachingConnectionFactory
connectionFactory
=
new
CachingConnectionFactory
();
connectionFactory
.
setHost
(
host
);
connectionFactory
.
setPort
(
port
);
connectionFactory
.
setUsername
(
username
);
connectionFactory
.
setPassword
(
password
);
connectionFactory
.
setVirtualHost
(
virtualHost
);
return
connectionFactory
;
}
}
}
app/src/main/java/com/yiring/app/rabbit
mq
/RabbitReceiver.java
→
app/src/main/java/com/yiring/app/rabbit
/receiver
/RabbitReceiver.java
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
rabbit
mq
;
package
com
.
yiring
.
app
.
rabbit
.
receiver
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
...
app/src/main/java/com/yiring/app/rabbit
mq/zy/ZyRabbitmq
Receiver.java
→
app/src/main/java/com/yiring/app/rabbit
/receiver/ZyRabbit
Receiver.java
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
rabbit
mq
.
zy
;
package
com
.
yiring
.
app
.
rabbit
.
receiver
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.rabbitmq.client.Channel
;
import
com.rabbitmq.client.Channel
;
import
com.yiring.app.config.zy.ZyRabbitConfig
;
import
com.yiring.app.domain.location.*
;
import
com.yiring.app.push.domain.PushMessage
;
import
com.yiring.app.domain.log.ZyRealtimeLog
;
import
com.yiring.app.push.service.PushService
;
import
com.yiring.app.domain.log.ZyRealtimeLogRepository
;
import
com.yiring.app.rabbit.config.ZyRabbitConfig
;
import
com.yiring.app.util.GeoUtils
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.time.Instant
;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.locationtech.jts.geom.Point
;
import
org.springframework.amqp.core.Message
;
import
org.springframework.amqp.core.Message
;
import
org.springframework.amqp.rabbit.annotation.RabbitHandler
;
import
org.springframework.amqp.rabbit.annotation.RabbitHandler
;
import
org.springframework.amqp.rabbit.annotation.RabbitListener
;
import
org.springframework.amqp.rabbit.annotation.RabbitListener
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.domain.Example
;
import
org.springframework.messaging.simp.SimpMessagingTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -30,7 +40,7 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -30,7 +40,7 @@ import org.springframework.transaction.annotation.Transactional;
@Component
@Component
@Configuration
@Configuration
@ConditionalOnProperty
(
prefix
=
"zy-config.rabbitmq"
,
value
=
"enabled"
,
havingValue
=
"true"
)
@ConditionalOnProperty
(
prefix
=
"zy-config.rabbitmq"
,
value
=
"enabled"
,
havingValue
=
"true"
)
public
class
ZyRabbit
mq
Receiver
{
public
class
ZyRabbitReceiver
{
// TODO
// TODO
// 1. 新增消息订阅定时任务,检查是否正常订阅了真源定位系统的消息
// 1. 新增消息订阅定时任务,检查是否正常订阅了真源定位系统的消息
...
@@ -38,7 +48,19 @@ public class ZyRabbitmqReceiver {
...
@@ -38,7 +48,19 @@ public class ZyRabbitmqReceiver {
// 3. 订阅 position(定位数据)、lowPower(低电量报警)、deviceStatus(设备状态)、keyWarning(按键报警)
// 3. 订阅 position(定位数据)、lowPower(低电量报警)、deviceStatus(设备状态)、keyWarning(按键报警)
@Resource
@Resource
PushService
pushService
;
LocationTagRepository
locationTagRepository
;
@Resource
LocationBeaconRepository
locationBeaconRepository
;
@Resource
LocationLogRepository
locationLogRepository
;
@Resource
SimpMessagingTemplate
simpMessagingTemplate
;
@Resource
ZyRealtimeLogRepository
zyRealtimeLogRepository
;
/**
/**
* 订阅真源定位系统 RabbitMQ 推送过来的消息(主动订阅的一些消息类别)
* 订阅真源定位系统 RabbitMQ 推送过来的消息(主动订阅的一些消息类别)
...
@@ -65,6 +87,12 @@ public class ZyRabbitmqReceiver {
...
@@ -65,6 +87,12 @@ public class ZyRabbitmqReceiver {
// 解构消息内容
// 解构消息内容
JSONObject
data
=
info
.
getJSONObject
(
"params"
);
JSONObject
data
=
info
.
getJSONObject
(
"params"
);
String
method
=
info
.
getString
(
"method"
);
String
method
=
info
.
getString
(
"method"
);
// 记录日志
ZyRealtimeLog
realtimeLog
=
ZyRealtimeLog
.
builder
().
method
(
method
).
raw
(
info
).
build
();
zyRealtimeLogRepository
.
save
(
realtimeLog
);
// 业务处理
switch
(
method
)
{
switch
(
method
)
{
// 实时定位
// 实时定位
case
"position"
->
processPositionMessage
(
data
);
case
"position"
->
processPositionMessage
(
data
);
...
@@ -74,6 +102,8 @@ public class ZyRabbitmqReceiver {
...
@@ -74,6 +102,8 @@ public class ZyRabbitmqReceiver {
case
"deviceStatus"
->
processDeviceStatusMessage
(
data
);
case
"deviceStatus"
->
processDeviceStatusMessage
(
data
);
// 按键报警
// 按键报警
case
"keyWarning"
->
processKeyWarningMessage
(
data
);
case
"keyWarning"
->
processKeyWarningMessage
(
data
);
// 围栏报警
case
"enclosure"
->
log
.
warn
(
"Ignore Message Type [enclosure]: {}"
,
info
);
default
->
log
.
warn
(
"Unknown Message Type: {}"
,
info
);
default
->
log
.
warn
(
"Unknown Message Type: {}"
,
info
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -95,9 +125,74 @@ public class ZyRabbitmqReceiver {
...
@@ -95,9 +125,74 @@ public class ZyRabbitmqReceiver {
// 1. 解析消息内容,进行围栏、出入标识判断等处理,将定位记录录入数据库
// 1. 解析消息内容,进行围栏、出入标识判断等处理,将定位记录录入数据库
// 2. 创建一条需要进行消息推送的记录
// 2. 创建一条需要进行消息推送的记录
// 3. 将记录推送的消息推送模块
// 3. 将记录推送的消息推送模块
// 4. 检查是否触发围栏告警,记录告警数据,并推送消息
// 定位时间
Instant
instant
=
Instant
.
ofEpochMilli
(
data
.
getLongValue
(
"locationTime"
));
LocalDateTime
time
=
LocalDateTime
.
ofInstant
(
instant
,
ZoneId
.
systemDefault
());
// 定位的基本信息
LocationLog
locationLog
=
LocationLog
.
builder
()
.
raw
(
data
)
.
locationTime
(
time
)
.
silent
(
data
.
getBoolean
(
"silent"
))
.
volt
(
data
.
getInteger
(
"volt"
))
.
voltUnit
(
data
.
getString
(
"voltUnit"
))
.
build
();
// WebSocket 消息推送
// 设置空间点位信息
pushService
.
push
(
PushMessage
.
Type
.
WS
,
data
);
Point
point
=
GeoUtils
.
createPoint
(
data
.
getDoubleValue
(
"longitude"
),
data
.
getDoubleValue
(
"latitude"
),
data
.
getDoubleValue
(
"altitude"
)
);
locationLog
.
setPoint
(
point
);
// 查询定位标签
Example
<
LocationTag
>
example
=
Example
.
of
(
LocationTag
.
builder
().
code
(
data
.
getString
(
"tagId"
)).
build
());
Optional
<
LocationTag
>
optional
=
locationTagRepository
.
findOne
(
example
);
if
(
optional
.
isPresent
())
{
LocationTag
tag
=
optional
.
get
();
// 设置定位标签
locationLog
.
setTag
(
tag
);
// 定位标签当时所属的用户
locationLog
.
setUser
(
tag
.
getUser
());
// 查询当前用户的状态
// TODO
}
// 查询定位信标
Set
<
String
>
codes
=
Arrays
.
stream
(
data
.
getString
(
"beacons"
).
split
(
","
))
.
map
(
beacon
->
beacon
.
replaceAll
(
"\\(.*\\)"
,
""
))
.
collect
(
Collectors
.
toSet
());
Set
<
LocationBeacon
>
beacons
=
locationBeaconRepository
.
findByCodeIn
(
codes
);
locationLog
.
setBeacons
(
beacons
);
// 查询定位所在围栏信息
Set
<
LocationFence
>
fences
=
locationLog
.
getBeacons
()
.
stream
()
.
map
(
LocationBeacon:
:
getFences
)
.
flatMap
(
Set:
:
stream
)
.
collect
(
Collectors
.
toSet
());
locationLog
.
setFences
(
fences
);
// TODO
// 并计算出入标记(围栏、区域)
// 写入数据
locationLogRepository
.
saveAndFlush
(
locationLog
);
// 更新定位标签卡电量信息
// TODO
// WebSocket 推送定位消息
// 消息内容需要确定 TODO
simpMessagingTemplate
.
convertAndSend
(
"/topic/position"
,
"{}"
);
// TODO
// 判断围栏告警是否触发,触发写入告警记录,并推送消息
}
}
/**
/**
...
...
app/src/main/java/com/yiring/app/rabbitmq/RabbitConfig.java
deleted
100644 → 0
浏览文件 @
fa526f10
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
rabbitmq
;
import
org.springframework.context.annotation.Configuration
;
/**
* rabbitmq配置
*
* @author ifzm
* 2019/8/21 15:44
*/
@Configuration
public
class
RabbitConfig
{}
app/src/main/java/com/yiring/app/service/appletUser/AppletUserService.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
appletUser
;
import
com.yiring.common.core.Result
;
/**
* @author Administrator
* @version 1.0
* @description: 微信小程序用户
* @date 2022/4/24 9:22
*/
public
interface
AppletUserService
{
/**
* 根据用户唯一标识获取手机号码,通过手机号码查询用户来访信息分页
* @author tzl
* @date 2022/4/24 9:34
* @param appid String
* @param secret String
* @param js_code String
* @param grant_type String
* @return com.yiring.common.core.Result<java.lang.String>
*/
Result
<
String
>
selectMobile
(
String
appid
,
String
secret
,
String
js_code
,
String
grant_type
);
}
app/src/main/java/com/yiring/app/service/appletUser/impl/AppletUserServiceImpl.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
appletUser
.
impl
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yiring.app.domain.appletUser.AppletUser
;
import
com.yiring.app.domain.appletUser.AppletUserRepository
;
import
com.yiring.app.feign.WxClient
;
import
com.yiring.app.service.appletUser.AppletUserService
;
import
com.yiring.common.core.Result
;
import
java.util.Optional
;
import
javax.annotation.Resource
;
/**
* @author Administrator
* @version 1.0
* @description: TODO
* @date 2022/4/24 9:25
*/
public
class
AppletUserServiceImpl
implements
AppletUserService
{
@Resource
AppletUserRepository
appletUserRepository
;
@Resource
WxClient
wxClient
;
@Override
public
Result
<
String
>
selectMobile
(
String
appid
,
String
secret
,
String
js_code
,
String
grant_type
)
{
JSONObject
jsonObject
=
wxClient
.
getOpenid
(
appid
,
secret
,
js_code
,
grant_type
);
Object
openid
=
jsonObject
.
get
(
"openid"
);
if
(
StrUtil
.
isNotBlank
(
openid
.
toString
()))
{
Optional
<
AppletUser
>
optional
=
appletUserRepository
.
findById
(
openid
.
toString
());
//如果该微信为第一次登录小程序
if
(
optional
.
isEmpty
())
{
return
Result
.
ok
(
"绑定手机号码"
);
}
AppletUser
appletUser
=
optional
.
get
();
return
Result
.
ok
(
appletUser
.
getMobile
());
}
return
null
;
}
}
app/src/main/java/com/yiring/app/service/car/CarService.java
浏览文件 @
1cb3b1b2
...
@@ -8,7 +8,7 @@ import com.yiring.app.vo.car.CarVo;
...
@@ -8,7 +8,7 @@ import com.yiring.app.vo.car.CarVo;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.vo.PageVo
;
import
com.yiring.common.vo.PageVo
;
import
java
.util.List
;
import
java
x.servlet.http.HttpServletResponse
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.data.jpa.domain.Specification
;
/**
/**
...
@@ -28,6 +28,7 @@ public interface CarService {
...
@@ -28,6 +28,7 @@ public interface CarService {
* 修改车辆来访信息
* 修改车辆来访信息
*
*
* @param carParam CarParam
* @param carParam CarParam
* @param idParam IdParam
* @return 修改的车辆来访信息id
* @return 修改的车辆来访信息id
*/
*/
Result
<
Long
>
updateCarInfo
(
CarParam
carParam
,
IdParam
idParam
);
Result
<
Long
>
updateCarInfo
(
CarParam
carParam
,
IdParam
idParam
);
...
@@ -44,6 +45,7 @@ public interface CarService {
...
@@ -44,6 +45,7 @@ public interface CarService {
* 发卡
* 发卡
*
*
* @param idParam IdParam
* @param idParam IdParam
* @param labelCard String
* @return 发卡信息id
* @return 发卡信息id
*/
*/
Result
<
Long
>
cardSend
(
IdParam
idParam
,
String
labelCard
);
Result
<
Long
>
cardSend
(
IdParam
idParam
,
String
labelCard
);
...
@@ -73,9 +75,11 @@ public interface CarService {
...
@@ -73,9 +75,11 @@ public interface CarService {
Result
<
PageVo
<
CarVo
>>
pageCarInfo
(
CarQueryParam
carParam
);
Result
<
PageVo
<
CarVo
>>
pageCarInfo
(
CarQueryParam
carParam
);
/**
/**
* 导出excel
* 导出接口
* @param carParam CarQueryParam
* @param response HttpServletResponse
*/
*/
List
<
Car
>
export
(
CarQueryParam
carParam
);
void
export
(
CarQueryParam
carParam
,
HttpServletResponse
response
);
/**
/**
* 检查是否存在相同车牌号登记
* 检查是否存在相同车牌号登记
...
@@ -94,6 +98,7 @@ public interface CarService {
...
@@ -94,6 +98,7 @@ public interface CarService {
boolean
hasCarInfoByMobile
(
String
param
);
boolean
hasCarInfoByMobile
(
String
param
);
/**
/**
* 筛选条件
* @param carParam CarQueryParam
* @param carParam CarQueryParam
* @return Specification
* @return Specification
*/
*/
...
...
app/src/main/java/com/yiring/app/service/car/impl/CarServiceImpl.java
浏览文件 @
1cb3b1b2
...
@@ -2,8 +2,10 @@
...
@@ -2,8 +2,10 @@
package
com
.
yiring
.
app
.
service
.
car
.
impl
;
package
com
.
yiring
.
app
.
service
.
car
.
impl
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.github.liaochong.myexcel.core.DefaultStreamExcelBuilder
;
import
com.yiring.app.domain.car.Car
;
import
com.yiring.app.domain.car.Car
;
import
com.yiring.app.domain.car.CarRepository
;
import
com.yiring.app.domain.car.CarRepository
;
import
com.yiring.app.excel.car.CarExportExcel
;
import
com.yiring.app.param.car.CarParam
;
import
com.yiring.app.param.car.CarParam
;
import
com.yiring.app.param.car.CarQueryParam
;
import
com.yiring.app.param.car.CarQueryParam
;
import
com.yiring.app.service.car.CarService
;
import
com.yiring.app.service.car.CarService
;
...
@@ -13,23 +15,33 @@ import com.yiring.common.core.Result;
...
@@ -13,23 +15,33 @@ import com.yiring.common.core.Result;
import
com.yiring.common.core.Status
;
import
com.yiring.common.core.Status
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.vo.PageVo
;
import
com.yiring.common.vo.PageVo
;
import
java.io.OutputStream
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.Optional
;
import
java.util.concurrent.Executors
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Predicate
;
import
javax.servlet.http.HttpServletResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.data.domain.*
;
import
org.springframework.data.domain.*
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
/**
/**
* @author tzl
* @author tzl
* 2022/4/11 13:58
* 2022/4/11 13:58
*/
*/
@Slf4j
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
@Service
@Service
public
class
CarServiceImpl
implements
CarService
{
public
class
CarServiceImpl
implements
CarService
{
...
@@ -40,15 +52,14 @@ public class CarServiceImpl implements CarService {
...
@@ -40,15 +52,14 @@ public class CarServiceImpl implements CarService {
public
Result
<
Long
>
saveCarInfo
(
CarParam
carParam
)
{
public
Result
<
Long
>
saveCarInfo
(
CarParam
carParam
)
{
// 检查车牌号是否已存在
// 检查车牌号是否已存在
if
(
hasCarInfoByCarNum
(
carParam
.
getCarNum
()))
{
if
(
hasCarInfoByCarNum
(
carParam
.
getCarNum
()))
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"您的车牌号已
预约登记
"
);
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"您的车牌号已
存在
"
);
}
}
// 检查司机手机号码号是否已存在
// 检查司机手机号码号是否已存在
if
(
hasCarInfoByMobile
(
carParam
.
getDriverMobile
()))
{
if
(
hasCarInfoByMobile
(
carParam
.
getDriverMobile
()))
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"您的联系方式已
预约登记
"
);
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"您的联系方式已
存在
"
);
}
}
Car
car
=
Car
Car
car
=
Car
.
builder
()
.
builder
()
.
labelCardStatus
(
"1"
)
.
carNum
(
carParam
.
getCarNum
())
.
carNum
(
carParam
.
getCarNum
())
.
carType
(
carParam
.
getCarType
())
.
carType
(
carParam
.
getCarType
())
.
driverMobile
(
carParam
.
getDriverMobile
())
.
driverMobile
(
carParam
.
getDriverMobile
())
...
@@ -69,20 +80,16 @@ public class CarServiceImpl implements CarService {
...
@@ -69,20 +80,16 @@ public class CarServiceImpl implements CarService {
return
Result
.
no
(
Status
.
NOT_FOUND
);
return
Result
.
no
(
Status
.
NOT_FOUND
);
}
}
Car
car
=
optional
.
get
();
Car
car
=
optional
.
get
();
//如果标签卡在使用中无法修改
if
(
StrUtil
.
isNotBlank
(
car
.
getLabelCardStatus
())
&&
"2"
.
equals
(
car
.
getLabelCardStatus
()))
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"标签卡使用中,信息无法修改"
);
}
if
(!
car
.
getCarNum
().
equals
(
carParam
.
getCarNum
()))
{
if
(!
car
.
getCarNum
().
equals
(
carParam
.
getCarNum
()))
{
// 当修改车牌号时才检查重复
// 当修改车牌号时才检查重复
if
(
hasCarInfoByCarNum
(
carParam
.
getCarNum
()))
{
if
(
hasCarInfoByCarNum
(
carParam
.
getCarNum
()))
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"您的车牌号
已预约登记
"
);
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"您的车牌号
信息已存在
"
);
}
}
}
}
if
(!
car
.
getDriverMobile
().
equals
(
carParam
.
getDriverMobile
()))
{
if
(!
car
.
getDriverMobile
().
equals
(
carParam
.
getDriverMobile
()))
{
// 当修改联系方式时才检查重复
// 当修改联系方式时才检查重复
if
(
hasCarInfoByMobile
(
carParam
.
getDriverMobile
()))
{
if
(
hasCarInfoByMobile
(
carParam
.
getDriverMobile
()))
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"您的联系方式已
预约登记
"
);
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"您的联系方式已
存在
"
);
}
}
}
}
BeanUtils
.
copyProperties
(
carParam
,
car
);
BeanUtils
.
copyProperties
(
carParam
,
car
);
...
@@ -97,7 +104,6 @@ public class CarServiceImpl implements CarService {
...
@@ -97,7 +104,6 @@ public class CarServiceImpl implements CarService {
return
Result
.
no
(
Status
.
NOT_FOUND
);
return
Result
.
no
(
Status
.
NOT_FOUND
);
}
}
Car
car
=
optional
.
get
();
Car
car
=
optional
.
get
();
car
.
setLabelCardStatus
(
"3"
);
car
.
setCardRecTime
(
LocalDateTime
.
now
());
car
.
setCardRecTime
(
LocalDateTime
.
now
());
Car
carReuslt
=
carRepository
.
saveAndFlush
(
car
);
Car
carReuslt
=
carRepository
.
saveAndFlush
(
car
);
return
Result
.
ok
(
carReuslt
.
getId
());
return
Result
.
ok
(
carReuslt
.
getId
());
...
@@ -110,7 +116,6 @@ public class CarServiceImpl implements CarService {
...
@@ -110,7 +116,6 @@ public class CarServiceImpl implements CarService {
return
Result
.
no
(
Status
.
NOT_FOUND
);
return
Result
.
no
(
Status
.
NOT_FOUND
);
}
}
Car
car
=
optional
.
get
();
Car
car
=
optional
.
get
();
car
.
setLabelCardStatus
(
"2"
);
car
.
setCardSendTime
(
LocalDateTime
.
now
());
car
.
setCardSendTime
(
LocalDateTime
.
now
());
car
.
setLabelCard
(
labelCard
);
car
.
setLabelCard
(
labelCard
);
Car
carReuslt
=
carRepository
.
saveAndFlush
(
car
);
Car
carReuslt
=
carRepository
.
saveAndFlush
(
car
);
...
@@ -123,12 +128,7 @@ public class CarServiceImpl implements CarService {
...
@@ -123,12 +128,7 @@ public class CarServiceImpl implements CarService {
if
(
optional
.
isEmpty
())
{
if
(
optional
.
isEmpty
())
{
return
Result
.
no
(
Status
.
NOT_FOUND
);
return
Result
.
no
(
Status
.
NOT_FOUND
);
}
}
//正在使用中的信息无法删除
Car
entity
=
optional
.
get
();
Car
entity
=
optional
.
get
();
if
(
"2"
.
equals
(
entity
.
getLabelCardStatus
()))
{
return
Result
.
no
(
Status
.
BAD_REQUEST
,
"标签卡使用中,信息无法删除"
);
}
carRepository
.
delete
(
entity
);
carRepository
.
delete
(
entity
);
return
Result
.
ok
();
return
Result
.
ok
();
}
}
...
@@ -148,7 +148,7 @@ public class CarServiceImpl implements CarService {
...
@@ -148,7 +148,7 @@ public class CarServiceImpl implements CarService {
@Override
@Override
public
Result
<
PageVo
<
CarVo
>>
pageCarInfo
(
CarQueryParam
carParam
)
{
public
Result
<
PageVo
<
CarVo
>>
pageCarInfo
(
CarQueryParam
carParam
)
{
PageVo
<
CarVo
>
resultVo
=
null
;
PageVo
<
CarVo
>
resultVo
;
//排序
//排序
Sort
sort
=
Sort
.
by
(
Sort
.
Order
.
desc
(
Car
.
Fields
.
createTime
));
Sort
sort
=
Sort
.
by
(
Sort
.
Order
.
desc
(
Car
.
Fields
.
createTime
));
//如果传分页参数则分页,否查全部数据
//如果传分页参数则分页,否查全部数据
...
@@ -181,26 +181,60 @@ public class CarServiceImpl implements CarService {
...
@@ -181,26 +181,60 @@ public class CarServiceImpl implements CarService {
}
}
@Override
@Override
public
List
<
Car
>
export
(
CarQueryParam
carParam
)
{
public
void
export
(
CarQueryParam
carParam
,
HttpServletResponse
response
)
{
return
carRepository
.
findAll
(
condition
(
carParam
));
Specification
<
Car
>
specification
=
condition
(
carParam
);
List
<
Car
>
all
=
carRepository
.
findAll
(
specification
);
List
<
CarExportExcel
>
data
=
all
.
stream
()
.
map
(
car
->
{
CarExportExcel
carExportExcel
=
new
CarExportExcel
();
BeanUtils
.
copyProperties
(
car
,
carExportExcel
);
return
carExportExcel
;
})
.
collect
(
Collectors
.
toList
());
try
(
DefaultStreamExcelBuilder
<
CarExportExcel
>
streamExcelBuilder
=
DefaultStreamExcelBuilder
.
of
(
CarExportExcel
.
class
)
.
threadPool
(
Executors
.
newFixedThreadPool
(
2
))
.
rowHeight
(
14
)
.
titleRowHeight
(
14
)
.
style
(
"cell->vertical-align:center;text-align:center"
,
"title->vertical-align:center;text-align:center;font-weight:bold;font-family:等线"
)
.
start
()
)
{
streamExcelBuilder
.
append
(
data
);
String
fileName
=
URLEncoder
.
encode
(
"车辆来访信息.xlsx"
,
StandardCharsets
.
UTF_8
);
response
.
setContentType
(
"application/octet-stream"
);
response
.
setHeader
(
"Access-Control-Expose-Headers"
,
"Content-Disposition"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
fileName
);
OutputStream
out
=
response
.
getOutputStream
();
Workbook
workbook
=
streamExcelBuilder
.
fixedTitles
().
build
();
workbook
.
write
(
out
);
workbook
.
close
();
out
.
flush
();
out
.
close
();
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
throw
new
RuntimeException
(
"导出车辆来访信息失败: "
+
e
.
getMessage
());
}
}
}
@Override
@Override
public
boolean
hasCarInfoByCarNum
(
String
param
)
{
public
boolean
hasCarInfoByCarNum
(
String
param
)
{
Car
entity
=
Car
.
builder
().
carNum
(
param
).
labelCardStatus
(
"1"
).
build
();
Car
entity
=
Car
.
builder
().
carNum
(
param
).
build
();
long
count
=
carRepository
.
count
(
Example
.
of
(
entity
));
long
count
=
carRepository
.
count
(
Example
.
of
(
entity
));
entity
=
Car
.
builder
().
carNum
(
param
).
labelCardStatus
(
"2"
).
build
();
return
count
>
0
;
long
count1
=
carRepository
.
count
(
Example
.
of
(
entity
));
return
count
+
count1
>
0
;
}
}
@Override
@Override
public
boolean
hasCarInfoByMobile
(
String
param
)
{
public
boolean
hasCarInfoByMobile
(
String
param
)
{
Car
entity
=
Car
.
builder
().
driverMobile
(
param
).
labelCardStatus
(
"1"
).
build
();
Car
entity
=
Car
.
builder
().
driverMobile
(
param
).
build
();
long
count
=
carRepository
.
count
(
Example
.
of
(
entity
));
long
count
=
carRepository
.
count
(
Example
.
of
(
entity
));
entity
=
Car
.
builder
().
driverMobile
(
param
).
labelCardStatus
(
"2"
).
build
();
return
count
>
0
;
long
count1
=
carRepository
.
count
(
Example
.
of
(
entity
));
return
count
+
count1
>
0
;
}
}
@Override
@Override
...
@@ -249,7 +283,7 @@ public class CarServiceImpl implements CarService {
...
@@ -249,7 +283,7 @@ public class CarServiceImpl implements CarService {
//来访时间区间段查询
//来访时间区间段查询
list
.
add
(
list
.
add
(
criteriaBuilder
.
between
(
criteriaBuilder
.
between
(
root
.
get
(
Car
.
Fields
.
c
reate
Time
),
root
.
get
(
Car
.
Fields
.
c
ardSend
Time
),
carParam
.
getCreateTimeStart
(),
carParam
.
getCreateTimeStart
(),
carParam
.
getCreateTimeEnd
()
carParam
.
getCreateTimeEnd
()
)
)
...
@@ -263,15 +297,15 @@ public class CarServiceImpl implements CarService {
...
@@ -263,15 +297,15 @@ public class CarServiceImpl implements CarService {
);
);
}
}
if
(
StrUtil
.
isNotBlank
(
carParam
.
getLabelCardStatus
()))
{
//
if (StrUtil.isNotBlank(carParam.getLabelCardStatus())) {
//标签卡状态查询
//
//标签卡状态查询
list
.
add
(
//
list.add(
criteriaBuilder
.
equal
(
root
.
get
(
"labelCardStatus"
).
as
(
String
.
class
),
carParam
.
getLabelCardStatus
())
//
criteriaBuilder.equal(root.get("labelCardStatus").as(String.class), carParam.getLabelCardStatus())
);
//
);
}
//
}
if
(
Objects
.
nonNull
(
carParam
.
getCardRecTimeStart
())
&&
Objects
.
nonNull
(
carParam
.
getCardRecTimeEnd
()))
{
if
(
Objects
.
nonNull
(
carParam
.
getCardRecTimeStart
())
&&
Objects
.
nonNull
(
carParam
.
getCardRecTimeEnd
()))
{
//
来访
时间区间段查询
//
收卡
时间区间段查询
list
.
add
(
list
.
add
(
criteriaBuilder
.
between
(
criteriaBuilder
.
between
(
root
.
get
(
Car
.
Fields
.
cardRecTime
),
root
.
get
(
Car
.
Fields
.
cardRecTime
),
...
...
app/src/main/java/com/yiring/app/service/video/VideoService.java
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
video
;
package
com
.
yiring
.
app
.
service
.
video
;
import
com.yiring.app.domain.video.Video
;
import
com.yiring.app.param.video.VideoParam
;
import
com.yiring.app.param.video.VideoParam
;
import
com.yiring.app.param.video.VideoQueryParam
;
import
com.yiring.app.param.video.VideoQueryParam
;
import
com.yiring.app.vo.video.VideoVo
;
import
com.yiring.app.vo.video.VideoVo
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.vo.PageVo
;
import
com.yiring.common.vo.PageVo
;
import
java.awt.*
;
import
java.awt.*
;
import
javax.servlet.http.HttpServletResponse
;
import
org.locationtech.jts.geom.Point
;
import
org.locationtech.jts.geom.Point
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.web.multipart.MultipartFile
;
/**
/**
* @author tzl
* @author tzl
...
@@ -57,10 +60,32 @@ public interface VideoService {
...
@@ -57,10 +60,32 @@ public interface VideoService {
/**
/**
* 分页查询
* 分页查询
* @param videoQueryParam 筛选条件
* @param videoQueryParam 筛选条件
* @param param 分页参数
* @return Result<PageVo<VideoVo>> 分页结果集
* @return Result<PageVo<VideoVo>> 分页结果集
* @author tzl
* @author tzl
* @date 2022/4/15 14:35
* @date 2022/4/15 14:35
*/
*/
Result
<
PageVo
<
VideoVo
>>
pageVideo
(
VideoQueryParam
videoQueryParam
,
PageParam
param
);
Result
<
PageVo
<
VideoVo
>>
pageVideo
(
VideoQueryParam
videoQueryParam
);
/**
* 查询条件
* @param videoQueryParam 查询条件
* @return Specification<Video>
* @author tzl
* @date 2022/4/15 14:57
*/
Specification
<
Video
>
condition
(
VideoQueryParam
videoQueryParam
);
/**
* 条件查询数据导出
* @param videoQueryParam 查询条件
* @param response HttpServletResponse
*/
void
exportVideo
(
VideoQueryParam
videoQueryParam
,
HttpServletResponse
response
);
/**
* 导入视频监控点位信息
* @param file 上传的excel文件
* @return 是否成功
*/
Result
<
String
>
importVideo
(
MultipartFile
file
);
}
}
app/src/main/java/com/yiring/app/service/video/impl/VideoServiceImpl.java
浏览文件 @
1cb3b1b2
差异被折叠。
点击展开。
app/src/main/java/com/yiring/app/service/visitor/VisitorService.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
service
.
visitor
;
import
com.yiring.app.param.visitor.VisitorListParam
;
import
com.yiring.app.param.visitor.VisitorParam
;
import
com.yiring.app.param.visitor.VisitorQueryParam
;
import
com.yiring.app.vo.visitor.VisitorVo
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.vo.PageVo
;
import
javax.servlet.http.HttpServletResponse
;
/**
* @author tzl
* 2022/4/19 14:12
*/
public
interface
VisitorService
{
/**
* 访客新增
* @param visitorParam 新增访客入参
* @return 是否成功
*/
Result
<
String
>
saveVisitor
(
VisitorParam
visitorParam
);
/**
* 访客批量新增
* @param visitorListParam 批量访客新增入参
* @return 是否成功
*/
Result
<
String
>
saveVisitor
(
VisitorListParam
visitorListParam
);
/**
* 访客删除
* @param idParam 主键id
* @return 是否成功
*/
Result
<
String
>
deleteVisitor
(
IdParam
idParam
);
/**
* 修改访客信息
* @param visitorParam 修改访客入参
* @param idParam 修改访客的主键id
* @return 是否成功
*/
Result
<
String
>
updateVisitor
(
VisitorParam
visitorParam
,
IdParam
idParam
);
/**
* 查询访客详情
* @param idParam 主键id
* @return 访客信息
*/
Result
<
VisitorVo
>
selectVisitor
(
IdParam
idParam
);
/**
* 分页查询
* @param visitorQueryParam 访客查询参数
* @return 访客分页信息
*/
Result
<
PageVo
<
VisitorVo
>>
pageVisitor
(
VisitorQueryParam
visitorQueryParam
);
/**
* 导出访客信息
* @param visitorQueryParam 访客筛选条件
* @param response HttpServletResponse
*/
void
exportVisitor
(
VisitorQueryParam
visitorQueryParam
,
HttpServletResponse
response
);
/**
* 发卡
* @param labelCard 标签卡号
* @param idParam 主键id
* @return 是否成功
*/
Result
<
String
>
cardSend
(
String
labelCard
,
IdParam
idParam
);
/**
* 收卡
* @param idParam 主键id
* @return 是否成功
*/
Result
<
String
>
cardRec
(
IdParam
idParam
);
}
app/src/main/java/com/yiring/app/service/visitor/impl/VisitorServiceImpl.java
0 → 100644
浏览文件 @
1cb3b1b2
差异被折叠。
点击展开。
app/src/main/java/com/yiring/app/stomp/WebSocketStompConfig.java
浏览文件 @
1cb3b1b2
...
@@ -5,6 +5,7 @@ import com.yiring.app.constant.RedisKey;
...
@@ -5,6 +5,7 @@ import com.yiring.app.constant.RedisKey;
import
com.yiring.common.core.Redis
;
import
com.yiring.common.core.Redis
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.boot.autoconfigure.amqp.RabbitProperties
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.messaging.simp.config.ChannelRegistration
;
import
org.springframework.messaging.simp.config.ChannelRegistration
;
import
org.springframework.messaging.simp.config.MessageBrokerRegistry
;
import
org.springframework.messaging.simp.config.MessageBrokerRegistry
;
...
@@ -32,7 +33,7 @@ public class WebSocketStompConfig implements WebSocketMessageBrokerConfigurer {
...
@@ -32,7 +33,7 @@ public class WebSocketStompConfig implements WebSocketMessageBrokerConfigurer {
Redis
redis
;
Redis
redis
;
@Resource
@Resource
Rabbit
mqProperties
rabbitmq
Properties
;
Rabbit
Properties
rabbit
Properties
;
@Resource
@Resource
ClientInboundChannelInterceptor
clientInboundChannelInterceptor
;
ClientInboundChannelInterceptor
clientInboundChannelInterceptor
;
...
@@ -61,11 +62,11 @@ public class WebSocketStompConfig implements WebSocketMessageBrokerConfigurer {
...
@@ -61,11 +62,11 @@ public class WebSocketStompConfig implements WebSocketMessageBrokerConfigurer {
registry
.
setApplicationDestinationPrefixes
(
"/app"
);
registry
.
setApplicationDestinationPrefixes
(
"/app"
);
registry
registry
.
enableStompBrokerRelay
(
"/topic"
,
"/queue"
)
.
enableStompBrokerRelay
(
"/topic"
,
"/queue"
)
.
setRelayHost
(
rabbit
mq
Properties
.
getHost
())
.
setRelayHost
(
rabbitProperties
.
getHost
())
.
setClientLogin
(
rabbit
mq
Properties
.
getUsername
())
.
setClientLogin
(
rabbitProperties
.
getUsername
())
.
setClientPasscode
(
rabbit
mq
Properties
.
getPassword
())
.
setClientPasscode
(
rabbitProperties
.
getPassword
())
.
setSystemLogin
(
rabbit
mq
Properties
.
getUsername
())
.
setSystemLogin
(
rabbitProperties
.
getUsername
())
.
setSystemPasscode
(
rabbit
mq
Properties
.
getPassword
());
.
setSystemPasscode
(
rabbitProperties
.
getPassword
());
log
.
info
(
"Init RabbitMQ STOMP MessageBroker Success."
);
log
.
info
(
"Init RabbitMQ STOMP MessageBroker Success."
);
}
}
...
...
app/src/main/java/com/yiring/app/util/GeoUtils.java
浏览文件 @
1cb3b1b2
...
@@ -18,7 +18,7 @@ import org.locationtech.jts.geom.Point;
...
@@ -18,7 +18,7 @@ import org.locationtech.jts.geom.Point;
@UtilityClass
@UtilityClass
public
class
GeoUtils
{
public
class
GeoUtils
{
p
rivate
final
GeometryFactory
factory
=
new
GeometryFactory
();
p
ublic
final
GeometryFactory
factory
=
new
GeometryFactory
();
/**
/**
* 创建点
* 创建点
...
@@ -30,4 +30,29 @@ public class GeoUtils {
...
@@ -30,4 +30,29 @@ public class GeoUtils {
public
Point
createPoint
(
double
lon
,
double
lat
)
{
public
Point
createPoint
(
double
lon
,
double
lat
)
{
return
factory
.
createPoint
(
new
Coordinate
(
lon
,
lat
));
return
factory
.
createPoint
(
new
Coordinate
(
lon
,
lat
));
}
}
/**
* 创建一个三维点
* @param lon 经度
* @param lat 纬度
* @param alt 高度
* @return 点
*/
public
Point
createPoint
(
double
lon
,
double
lat
,
double
alt
)
{
return
factory
.
createPoint
(
new
Coordinate
(
lon
,
lat
,
alt
));
}
/**
* 相对坐标转换为经纬度
* @param x x 坐标值
* @param y y 坐标值
* @param z z 坐标值
* @return 经纬度点
*/
public
Point
xyzToPoint
(
double
x
,
double
y
,
double
z
)
{
// TODO
// 根据真源定位系统设置的坐标系,转换为经纬度
// 根据北向的地图左下角坐标点,矩形长宽距离,结合二维图片的像素比,计算经纬度
return
factory
.
createPoint
(
new
Coordinate
(
x
,
y
,
z
));
}
}
}
app/src/main/java/com/yiring/app/vo/car/CarVo.java
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
vo
.
car
;
package
com
.
yiring
.
app
.
vo
.
car
;
import
cn.hutool.core.util.StrUtil
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
com.yiring.common.util.DictUtils
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
lombok.*
;
import
lombok.*
;
...
@@ -25,6 +24,9 @@ import lombok.experimental.FieldDefaults;
...
@@ -25,6 +24,9 @@ import lombok.experimental.FieldDefaults;
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
CarVo
implements
Serializable
{
public
class
CarVo
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
1778680629828674385L
;
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
@ApiModelProperty
(
value
=
"主键id"
,
example
=
"1458555485552"
)
@ApiModelProperty
(
value
=
"主键id"
,
example
=
"1458555485552"
)
Long
id
;
Long
id
;
...
@@ -41,12 +43,12 @@ public class CarVo implements Serializable {
...
@@ -41,12 +43,12 @@ public class CarVo implements Serializable {
@ApiModelProperty
(
value
=
"车辆类型(字典翻译)"
,
example
=
"货车"
)
@ApiModelProperty
(
value
=
"车辆类型(字典翻译)"
,
example
=
"货车"
)
String
carTypeName
;
String
carTypeName
;
public
String
getCarTypeName
()
{
//
public String getCarTypeName() {
if
(
StrUtil
.
isNotBlank
(
carType
))
{
//
if (StrUtil.isNotBlank(carType)) {
return
DictUtils
.
getDictLabel
(
"car_type"
,
carType
);
//
return DictUtils.getDictLabel("car_type", carType);
}
//
}
return
null
;
//
return null;
}
//
}
@ApiModelProperty
(
value
=
"司机名称"
,
example
=
"张三"
)
@ApiModelProperty
(
value
=
"司机名称"
,
example
=
"张三"
)
String
driverName
;
String
driverName
;
...
@@ -66,12 +68,12 @@ public class CarVo implements Serializable {
...
@@ -66,12 +68,12 @@ public class CarVo implements Serializable {
@ApiModelProperty
(
value
=
"标签卡状态"
,
example
=
"未发卡"
)
@ApiModelProperty
(
value
=
"标签卡状态"
,
example
=
"未发卡"
)
String
labelCardStatusName
;
String
labelCardStatusName
;
public
String
getLabelCardStatusName
()
{
//
public String getLabelCardStatusName() {
if
(
StrUtil
.
isNotBlank
(
carType
))
{
//
if (StrUtil.isNotBlank(carType)) {
return
DictUtils
.
getDictLabel
(
"car_label_status"
,
labelCardStatus
);
//
return DictUtils.getDictLabel("car_label_status", labelCardStatus);
}
//
}
return
null
;
//
return null;
}
//
}
@ApiModelProperty
(
value
=
"单位id"
,
example
=
"湖南壹润科技"
)
@ApiModelProperty
(
value
=
"单位id"
,
example
=
"湖南壹润科技"
)
String
orgId
;
String
orgId
;
...
...
app/src/main/java/com/yiring/app/vo/video/VideoVo.java
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
vo
.
video
;
package
com
.
yiring
.
app
.
vo
.
video
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
lombok.*
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
import
lombok.experimental.FieldDefaults
;
...
@@ -20,16 +23,23 @@ import org.locationtech.jts.geom.Point;
...
@@ -20,16 +23,23 @@ import org.locationtech.jts.geom.Point;
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
VideoVo
implements
Serializable
{
public
class
VideoVo
implements
Serializable
{
@ApiModelProperty
(
value
=
"坐标点信息"
,
example
=
""
)
@Serial
private
static
final
long
serialVersionUID
=
3968078657827350557L
;
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
@ApiModelProperty
(
value
=
"id"
,
example
=
"1548548545755"
)
Long
id
;
@ApiModelProperty
(
value
=
"坐标点"
,
example
=
"坐标点"
)
Point
point
;
Point
point
;
@ApiModelProperty
(
value
=
"编号"
,
example
=
"88888888"
)
@ApiModelProperty
(
value
=
"编号"
,
example
=
"88888888"
)
String
uuid
;
String
uuid
;
@ApiModelProperty
(
value
=
"m3u8地址"
,
example
=
""
)
@ApiModelProperty
(
value
=
"m3u8地址"
,
example
=
"
m3u8地址
"
)
String
m3u8
;
String
m3u8
;
@ApiModelProperty
(
value
=
"备注"
,
example
=
"
摄像头
"
)
@ApiModelProperty
(
value
=
"备注"
,
example
=
"
备注
"
)
String
remark
;
String
remark
;
@ApiModelProperty
(
value
=
"摄像头名称"
,
example
=
"摄像头1"
)
@ApiModelProperty
(
value
=
"摄像头名称"
,
example
=
"摄像头1"
)
...
...
app/src/main/java/com/yiring/app/vo/visitor/VisitorVo.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
vo
.
visitor
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* @author tzl
* 2022/4/19 14:16
*/
@ApiModel
(
"VisitorVo"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
VisitorVo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
9004209982164273860L
;
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
@ApiModelProperty
(
value
=
"id"
,
example
=
"1548548545755"
)
Long
id
;
@ApiModelProperty
(
value
=
"到访人姓名"
,
example
=
"张三"
)
String
visitorName
;
@ApiModelProperty
(
value
=
"到访人电话"
,
example
=
"17688888888"
)
String
visitorMobile
;
@ApiModelProperty
(
value
=
"到访人身份证"
,
example
=
"430441190001255417"
)
String
visitorCarNum
;
@ApiModelProperty
(
value
=
"是否特殊作业"
,
example
=
"true"
)
boolean
taskType
;
@ApiModelProperty
(
value
=
"邀请人数"
,
example
=
"1"
)
Integer
numOfVisitor
;
@ApiModelProperty
(
value
=
"访客来源"
,
example
=
"内部邀请"
)
String
visitorSource
;
@ApiModelProperty
(
value
=
"标签卡"
,
example
=
"WE34421231"
)
String
labelCard
;
@ApiModelProperty
(
value
=
"标签卡状态"
,
example
=
"使用中"
)
String
labelCardStatus
;
@ApiModelProperty
(
value
=
"所属单位id"
,
example
=
"壹润科技"
)
String
orgId
;
@ApiModelProperty
(
value
=
"被访人id"
,
example
=
"1"
)
String
intervieweeId
;
@ApiModelProperty
(
value
=
"来访原因"
,
example
=
"来访原因"
)
String
reason
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty
(
value
=
"收卡时间"
,
example
=
"2022-04-19 14:28:00"
)
LocalDateTime
cardRecTime
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty
(
value
=
"预约到访时间"
,
example
=
"2022-04-19 14:28:00"
)
LocalDateTime
appOfVisitTime
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty
(
value
=
"创建时间"
,
example
=
"2022-04-19 14:28:00"
)
LocalDateTime
createTime
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty
(
value
=
"发卡时间"
,
example
=
"2022-04-19 14:28:00"
)
LocalDateTime
cardSendTime
;
}
app/src/main/java/com/yiring/app/web/HelloController.java
浏览文件 @
1cb3b1b2
/* (C) 2021 YiRing, Inc. */
/* (C) 2021 YiRing, Inc. */
package
com
.
yiring
.
app
.
web
;
package
com
.
yiring
.
app
.
web
;
import
cn.hutool.extra.spring.SpringUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yiring.app.constant.Code
;
import
com.yiring.app.constant.Code
;
import
com.yiring.app.exception.CodeException
;
import
com.yiring.app.exception.CodeException
;
import
com.yiring.app.push.domain.PushMessage
;
import
com.yiring.app.push.service.PushService
;
import
com.yiring.app.util.GeoUtils
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.vo.PageVo
;
import
com.yiring.common.vo.PageVo
;
...
@@ -16,7 +11,6 @@ import java.util.Arrays;
...
@@ -16,7 +11,6 @@ import java.util.Arrays;
import
java.util.List
;
import
java.util.List
;
import
javax.validation.Valid
;
import
javax.validation.Valid
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.locationtech.jts.geom.Point
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
@@ -52,12 +46,4 @@ public class HelloController {
...
@@ -52,12 +46,4 @@ public class HelloController {
PageVo
<
String
>
vo
=
PageVo
.
build
(
data
,
data
.
size
());
PageVo
<
String
>
vo
=
PageVo
.
build
(
data
,
data
.
size
());
return
Result
.
ok
(
vo
);
return
Result
.
ok
(
vo
);
}
}
@GetMapping
(
"test"
)
public
Result
<
Point
>
test
()
{
PushService
service
=
SpringUtil
.
getBean
(
PushService
.
class
);
service
.
push
(
PushMessage
.
Type
.
WS
,
new
JSONObject
().
fluentPut
(
"msg"
,
"hello"
));
Point
point
=
GeoUtils
.
createPoint
(
112.1
,
23.56
);
return
Result
.
ok
(
point
);
}
}
}
app/src/main/java/com/yiring/app/web/car/CarController.java
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
web
.
car
;
package
com
.
yiring
.
app
.
web
.
car
;
import
com.yiring.app.domain.car.Car
;
import
com.yiring.app.param.car.CarParam
;
import
com.yiring.app.param.car.CarParam
;
import
com.yiring.app.param.car.CarQueryParam
;
import
com.yiring.app.param.car.CarQueryParam
;
import
com.yiring.app.service.car.CarService
;
import
com.yiring.app.service.car.CarService
;
import
com.yiring.app.vo.car.CarVo
;
import
com.yiring.app.vo.car.CarVo
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.util.poi.ExcelUtils
;
import
com.yiring.common.vo.PageVo
;
import
com.yiring.common.vo.PageVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
java.util.List
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.validation.Valid
;
import
javax.validation.Valid
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.http.MediaType
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
/**
* 车辆来访信息控制器
* 车辆来访信息控制器
...
@@ -28,7 +29,7 @@ import org.springframework.web.bind.annotation.*;
...
@@ -28,7 +29,7 @@ import org.springframework.web.bind.annotation.*;
* 2022/4/11 17:02
* 2022/4/11 17:02
*/
*/
@Slf4j
@Slf4j
@Api
(
tags
=
"Car"
)
@Api
(
tags
=
"Car
(车辆)
"
)
@Validated
@Validated
@RestController
@RestController
@RequestMapping
(
"/Car/"
)
@RequestMapping
(
"/Car/"
)
...
@@ -80,15 +81,9 @@ public class CarController {
...
@@ -80,15 +81,9 @@ public class CarController {
return
carService
.
pageCarInfo
(
carParam
);
return
carService
.
pageCarInfo
(
carParam
);
}
}
@ApiOperation
(
value
=
"导出车辆来访信息"
)
@ApiOperation
(
value
=
"导出车辆来访信息"
,
produces
=
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
)
@PostMapping
(
"exportCarInfo"
)
@PostMapping
(
"exportCarInfo"
)
public
void
exportCarInfo
(
HttpServletResponse
response
,
@Valid
CarQueryParam
carParam
)
{
public
void
exportCarInfo
(
HttpServletResponse
response
,
@Valid
CarQueryParam
carParam
)
{
List
<
Car
>
export
=
carService
.
export
(
carParam
);
carService
.
export
(
carParam
,
response
);
ExcelUtils
<
Car
>
util
=
new
ExcelUtils
<>(
Car
.
class
);
// String fileName = URLEncoder.encode("车辆来访信息.xlsx", StandardCharsets.UTF_8);
response
.
setContentType
(
"application/octet-stream"
);
// response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
// response.setCharacterEncoding("utf-8");
util
.
exportExcel
(
response
,
export
,
"车辆来访信息"
);
}
}
}
}
app/src/main/java/com/yiring/app/web/map/MapController.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
web
.
map
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yiring.app.feign.MapClient
;
import
com.yiring.auth.util.ZyUtil
;
import
com.yiring.common.core.Result
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
java.io.Serializable
;
import
javax.annotation.Resource
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 地图控制器
* @author Administrator
* @version 1.0
* @description: TODO
* @date 2022/4/24 13:48
*/
@Slf4j
@Validated
@Api
(
tags
=
"Map(地图)"
)
@RestController
@RequestMapping
(
"/map/"
)
public
class
MapController
{
@Resource
MapClient
mapClient
;
@GetMapping
(
"/mapSelect"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
value
=
"orgId"
,
required
=
true
,
name
=
"orgId"
)
})
public
Result
<
Serializable
>
fail
(
String
orgId
)
{
String
login
=
ZyUtil
.
login
();
JSONObject
jsonObject
=
mapClient
.
selectMap
(
orgId
,
"bearer "
+
login
);
return
Result
.
ok
(
jsonObject
.
get
(
"data"
).
toString
());
}
}
app/src/main/java/com/yiring/app/web/video/VideoController.java
浏览文件 @
1cb3b1b2
...
@@ -7,27 +7,33 @@ import com.yiring.app.service.video.VideoService;
...
@@ -7,27 +7,33 @@ import com.yiring.app.service.video.VideoService;
import
com.yiring.app.vo.video.VideoVo
;
import
com.yiring.app.vo.video.VideoVo
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.param.PageParam
;
import
com.yiring.common.vo.PageVo
;
import
com.yiring.common.vo.PageVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.validation.Valid
;
import
javax.validation.Valid
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.locationtech.jts.geom.Point
;
import
org.locationtech.jts.geom.Point
;
import
org.springframework.http.MediaType
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
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.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
/**
/**
* 监控点位控制器
* 监控点位控制器
*
* @author tzl
* @author tzl
* 2022/4/8 16:51
* 2022/4/8 16:51
*/
*/
@Slf4j
@Slf4j
@Validated
@Validated
@Api
(
tags
=
"Video"
)
@Api
(
tags
=
"Video
(监控设备)
"
)
@RestController
@RestController
@RequestMapping
(
"/video/"
)
@RequestMapping
(
"/video/"
)
public
class
VideoController
{
public
class
VideoController
{
...
@@ -54,14 +60,27 @@ public class VideoController {
...
@@ -54,14 +60,27 @@ public class VideoController {
}
}
@ApiOperation
(
value
=
"查看监控点位位置"
)
@ApiOperation
(
value
=
"查看监控点位位置"
)
@
Pos
tMapping
(
"selectPoint"
)
@
Ge
tMapping
(
"selectPoint"
)
public
Result
<
Point
>
selectPoint
(
@Valid
IdParam
idParam
)
{
public
Result
<
Point
>
selectPoint
(
@Valid
IdParam
idParam
)
{
return
videoService
.
selectPoint
(
idParam
);
return
videoService
.
selectPoint
(
idParam
);
}
}
@ApiOperation
(
value
=
"分页查询监控点位信息"
)
@ApiOperation
(
value
=
"分页查询监控点位信息"
)
@PostMapping
(
"pageVideo"
)
@GetMapping
(
"pageVideo"
)
public
Result
<
PageVo
<
VideoVo
>>
pageVideo
(
@Valid
VideoQueryParam
videoQueryParam
,
@Valid
PageParam
param
)
{
public
Result
<
PageVo
<
VideoVo
>>
pageVideo
(
@Valid
VideoQueryParam
videoQueryParam
)
{
return
videoService
.
pageVideo
(
videoQueryParam
,
param
);
return
videoService
.
pageVideo
(
videoQueryParam
);
}
@ApiOperation
(
value
=
"导出"
,
produces
=
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
)
@PostMapping
(
"exportVideo"
)
public
void
exportVideo
(
HttpServletResponse
response
,
@Valid
VideoQueryParam
videoQueryParam
)
{
videoService
.
exportVideo
(
videoQueryParam
,
response
);
}
@ApiOperation
(
value
=
"导入"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
value
=
"文件"
,
required
=
true
,
name
=
"file"
)
})
@PostMapping
(
"importVideo"
)
public
Result
<
String
>
importVideo
(
MultipartFile
file
)
{
return
videoService
.
importVideo
(
file
);
}
}
}
}
app/src/main/java/com/yiring/app/web/visitor/VisitorController.java
0 → 100644
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
web
.
visitor
;
import
com.yiring.app.param.visitor.VisitorParam
;
import
com.yiring.app.param.visitor.VisitorQueryParam
;
import
com.yiring.app.service.visitor.VisitorService
;
import
com.yiring.app.vo.visitor.VisitorVo
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.param.IdParam
;
import
com.yiring.common.vo.PageVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.validation.Valid
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.http.MediaType
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @author tzl
* 2022/4/21 9:50
*/
@Slf4j
@Validated
@Api
(
tags
=
"Visitor(访客)"
)
@RestController
@RequestMapping
(
"/visitor/"
)
public
class
VisitorController
{
@Resource
VisitorService
visitorService
;
@ApiOperation
(
value
=
"新增访客信息"
)
@PostMapping
(
"saveVisitor"
)
public
Result
<
String
>
saveVisitor
(
@Valid
VisitorParam
visitorParam
)
{
return
visitorService
.
saveVisitor
(
visitorParam
);
}
@ApiOperation
(
value
=
"修改访客信息"
)
@PostMapping
(
"updateVisitor"
)
public
Result
<
String
>
updateVisitor
(
@Valid
VisitorParam
visitorParam
,
@Valid
IdParam
idParam
)
{
return
visitorService
.
updateVisitor
(
visitorParam
,
idParam
);
}
@ApiOperation
(
value
=
"收卡"
)
@PostMapping
(
"cardRec"
)
public
Result
<
String
>
cardRec
(
@Valid
IdParam
idParam
)
{
return
visitorService
.
cardRec
(
idParam
);
}
@ApiOperation
(
value
=
"发卡"
)
@ApiImplicitParam
(
value
=
"标签卡"
,
example
=
"DW8544568"
,
required
=
true
,
name
=
"labelCard"
)
@PostMapping
(
"cardSend"
)
public
Result
<
String
>
cardSend
(
@Valid
IdParam
idParam
,
String
labelCard
)
{
return
visitorService
.
cardSend
(
labelCard
,
idParam
);
}
@ApiOperation
(
value
=
"删除访客信息"
)
@PostMapping
(
"deleteVisitor"
)
public
Result
<
String
>
deleteVisitor
(
@Valid
IdParam
idParam
)
{
return
visitorService
.
deleteVisitor
(
idParam
);
}
@ApiOperation
(
value
=
"查看访客信息详情"
)
@GetMapping
(
"selectVisitor"
)
public
Result
<
VisitorVo
>
selectVisitor
(
@Valid
IdParam
idParam
)
{
return
visitorService
.
selectVisitor
(
idParam
);
}
@ApiOperation
(
value
=
"查看访客信息(分页)"
)
@GetMapping
(
"pageVisitor"
)
public
Result
<
PageVo
<
VisitorVo
>>
pageVisitor
(
@Valid
VisitorQueryParam
visitorQueryParam
)
{
return
visitorService
.
pageVisitor
(
visitorQueryParam
);
}
@ApiOperation
(
value
=
"导出访客信息"
,
produces
=
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
)
@PostMapping
(
"exportVisitor"
)
public
void
exportVisitor
(
HttpServletResponse
response
,
@Valid
VisitorQueryParam
visitorQueryParam
)
{
visitorService
.
exportVisitor
(
visitorQueryParam
,
response
);
}
}
app/src/main/resources/application-conf-patch.yml
0 → 100644
浏览文件 @
1cb3b1b2
spring
:
mvc
:
pathmatch
:
# 修复 swagger 插件在 2.6.x 接口路径匹配问题
matching-strategy
:
ant_path_matcher
logging
:
level
:
# 关闭接口扫描 CachingOperationNameGenerator 日志
springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator
:
WARN
app/src/main/resources/application-dev.yml
浏览文件 @
1cb3b1b2
...
@@ -16,6 +16,7 @@ spring:
...
@@ -16,6 +16,7 @@ spring:
properties
:
properties
:
hibernate
:
hibernate
:
format_sql
:
true
format_sql
:
true
types.print.banner
:
false
redis
:
redis
:
database
:
5
database
:
5
host
:
${env.host}
host
:
${env.host}
...
@@ -24,7 +25,18 @@ spring:
...
@@ -24,7 +25,18 @@ spring:
port
:
5672
port
:
5672
username
:
admin
username
:
admin
password
:
123456
password
:
123456
virtual-host
:
/
# 开启发送端确认
publisher-confirm-type
:
correlated
# 开启接收端确认
publisher-returns
:
true
template
:
# 消息抵达队列,异步回调 confirm
mandatory
:
true
listener
:
simple
:
# 手动确认消息
acknowledge-mode
:
manual
# knife4j
# knife4j
knife4j
:
knife4j
:
...
@@ -49,3 +61,35 @@ logging:
...
@@ -49,3 +61,35 @@ logging:
level
:
level
:
# sql bind parameter
# sql bind parameter
org.hibernate.type.descriptor.sql.BasicBinder
:
trace
org.hibernate.type.descriptor.sql.BasicBinder
:
trace
# 真源定位系统相关配置
zy-config
:
host
:
project.yz-online.com
# RabbitMQ 订阅配置
rabbitmq
:
enabled
:
true
host
:
${zy-config.host}
port
:
672
username
:
admin
password
:
admin
virtual-host
:
/
queue-name
:
tenant_msg_${zy-config.open.client-secret}_${zy-config.open.client-id}
# 开放接口信息配置
open
:
api
:
http://${zy-config.host}:789/positionApi
client-id
:
sc21080400
grant-type
:
client_credentials
client-secret
:
12A14FDC
tenant
:
sc21080400
# 代理接口信息配置
proxy
:
api
:
https://nl.yz-cloud.com
tenant
:
ts00000006
# 应用平台账户信息
client
:
username
:
test1234
password
:
123456
# 管理后台账户信息
manage
:
username
:
test123
password
:
test123
app/src/main/resources/application-mock.yml
浏览文件 @
1cb3b1b2
...
@@ -16,6 +16,7 @@ spring:
...
@@ -16,6 +16,7 @@ spring:
properties
:
properties
:
hibernate
:
hibernate
:
format_sql
:
true
format_sql
:
true
types.print.banner
:
false
h2
:
h2
:
console
:
console
:
enabled
:
true
enabled
:
true
...
...
app/src/main/resources/application.yml
浏览文件 @
1cb3b1b2
...
@@ -7,7 +7,7 @@ spring:
...
@@ -7,7 +7,7 @@ spring:
application
:
application
:
name
:
"
kshg-api"
name
:
"
kshg-api"
profiles
:
profiles
:
include
:
auth
include
:
auth
, conf-patch
active
:
dev
active
:
dev
# DEBUG
# DEBUG
...
...
basic-auth/build.gradle
浏览文件 @
1cb3b1b2
dependencies
{
dependencies
{
implementation
project
(
':basic-common:core'
)
implementation
project
(
':basic-common:core'
)
implementation
project
(
':basic-common:util'
)
implementation
project
(
':basic-common:util'
)
implementation
project
(
':basic-common:redis'
)
implementation
'org.springframework.boot:spring-boot-starter-data-jpa'
implementation
'org.springframework.boot:spring-boot-starter-data-jpa'
implementation
'org.springframework.boot:spring-boot-starter-validation'
implementation
'org.springframework.boot:spring-boot-starter-validation'
...
@@ -17,6 +18,7 @@ dependencies {
...
@@ -17,6 +18,7 @@ dependencies {
// hutool
// hutool
implementation
"cn.hutool:hutool-core:${hutoolVersion}"
implementation
"cn.hutool:hutool-core:${hutoolVersion}"
implementation
"cn.hutool:hutool-json:${hutoolVersion}"
implementation
"cn.hutool:hutool-http:${hutoolVersion}"
implementation
"cn.hutool:hutool-http:${hutoolVersion}"
implementation
"cn.hutool:hutool-extra:${hutoolVersion}"
implementation
"cn.hutool:hutool-extra:${hutoolVersion}"
...
@@ -26,5 +28,4 @@ dependencies {
...
@@ -26,5 +28,4 @@ dependencies {
// myexcel
// myexcel
implementation
"com.github.liaochong:myexcel:${myexcelVersion}"
implementation
"com.github.liaochong:myexcel:${myexcelVersion}"
}
}
basic-common/core/src/main/java/com/yiring/common/config/CorsConfig.java
deleted
100644 → 0
浏览文件 @
fa526f10
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.cors.CorsConfiguration
;
import
org.springframework.web.cors.UrlBasedCorsConfigurationSource
;
import
org.springframework.web.filter.CorsFilter
;
/**
* 跨域设置
* @author tzl
* 2022/4/18 10:29
*/
@Configuration
public
class
CorsConfig
{
@Bean
public
CorsFilter
corsFilter
()
{
final
UrlBasedCorsConfigurationSource
urlBasedCorsConfigurationSource
=
new
UrlBasedCorsConfigurationSource
();
final
CorsConfiguration
corsConfiguration
=
new
CorsConfiguration
();
// corsConfiguration.setAllowCredentials(true);
corsConfiguration
.
addAllowedOrigin
(
"*"
);
corsConfiguration
.
addAllowedHeader
(
"*"
);
corsConfiguration
.
addAllowedMethod
(
"*"
);
urlBasedCorsConfigurationSource
.
registerCorsConfiguration
(
"/**"
,
corsConfiguration
);
return
new
CorsFilter
(
urlBasedCorsConfigurationSource
);
}
}
basic-common/core/src/main/java/com/yiring/common/config/EnvConfig.java
浏览文件 @
1cb3b1b2
...
@@ -25,4 +25,12 @@ public class EnvConfig {
...
@@ -25,4 +25,12 @@ public class EnvConfig {
* host,用来共享一些资源(如:数据库、文件存储等相关的依赖源)
* host,用来共享一些资源(如:数据库、文件存储等相关的依赖源)
*/
*/
String
host
;
String
host
;
/**
* 国标平台账号
*/
String
gbUsername
;
/**
* 国标平台密码
*/
String
gbPassword
;
}
}
basic-common/core/src/main/java/com/yiring/common/dict/Dict.java
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
dict
;
package
com
.
yiring
.
common
.
dict
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
javax.persistence.Entity
;
import
javax.persistence.Entity
;
...
@@ -33,6 +34,9 @@ import org.hibernate.snowflake.SnowflakeId;
...
@@ -33,6 +34,9 @@ import org.hibernate.snowflake.SnowflakeId;
@Comment
(
"字典"
)
@Comment
(
"字典"
)
public
class
Dict
implements
Serializable
{
public
class
Dict
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
2124350188949761567L
;
@Id
@Id
@Comment
(
"主键id"
)
@Comment
(
"主键id"
)
@GeneratedValue
(
generator
=
SnowflakeId
.
GENERATOR
)
@GeneratedValue
(
generator
=
SnowflakeId
.
GENERATOR
)
...
...
basic-common/core/src/main/java/com/yiring/common/dict/DictType.java
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
dict
;
package
com
.
yiring
.
common
.
dict
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
javax.persistence.Entity
;
import
javax.persistence.Entity
;
...
@@ -31,6 +32,9 @@ import org.hibernate.snowflake.SnowflakeId;
...
@@ -31,6 +32,9 @@ import org.hibernate.snowflake.SnowflakeId;
@Comment
(
"字典类型"
)
@Comment
(
"字典类型"
)
public
class
DictType
implements
Serializable
{
public
class
DictType
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
6302980159147541047L
;
@Id
@Id
@Comment
(
"主键id"
)
@Comment
(
"主键id"
)
@GeneratedValue
(
generator
=
SnowflakeId
.
GENERATOR
)
@GeneratedValue
(
generator
=
SnowflakeId
.
GENERATOR
)
...
...
basic-common/util/build.gradle
浏览文件 @
1cb3b1b2
...
@@ -8,8 +8,4 @@ dependencies {
...
@@ -8,8 +8,4 @@ dependencies {
implementation
"cn.hutool:hutool-extra:${hutoolVersion}"
implementation
"cn.hutool:hutool-extra:${hutoolVersion}"
// fastjson
// fastjson
implementation
"com.alibaba:fastjson:${fastJsonVersion}"
implementation
"com.alibaba:fastjson:${fastJsonVersion}"
implementation
group:
'org.apache.poi'
,
name:
'poi'
,
version:
'5.2.2'
implementation
group:
'org.apache.poi'
,
name:
'poi-ooxml'
,
version:
'5.2.2'
implementation
group:
'org.apache.commons'
,
name:
'commons-lang3'
,
version:
'3.12.0'
}
}
basic-common/util/src/main/java/com/yiring/common/annotation/Excel.java
deleted
100644 → 0
浏览文件 @
fa526f10
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
annotation
;
import
com.yiring.common.util.poi.ExcelHandlerAdapter
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
import
java.math.BigDecimal
;
/**
* 自定义导出Excel数据注解
*
*/
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Target
(
ElementType
.
FIELD
)
public
@interface
Excel
{
/**
* 导出时在excel中排序
*/
int
sort
()
default
Integer
.
MAX_VALUE
;
/**
* 导出到Excel中的名字.
*/
String
name
()
default
""
;
/**
* 日期格式, 如: yyyy-MM-dd
*/
String
dateFormat
()
default
""
;
/**
* 如果是字典类型,请设置字典的type值 (如: user_sex)
*/
String
dictType
()
default
""
;
/**
* 读取内容转表达式 (如: 0=男,1=女,2=未知)
*/
String
readConverterExp
()
default
""
;
/**
* 分隔符,读取字符串组内容
*/
String
separator
()
default
","
;
/**
* BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
*/
int
scale
()
default
-
1
;
/**
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
*/
int
roundingMode
()
default
BigDecimal
.
ROUND_HALF_EVEN
;
/**
* 导出类型(0数字 1字符串)
*/
ColumnType
cellType
()
default
ColumnType
.
STRING
;
/**
* 导出时在excel中每个列的高度 单位为字符
*/
double
height
()
default
14
;
/**
* 导出时在excel中每个列的宽 单位为字符
*/
double
width
()
default
16
;
/**
* 文字后缀,如% 90 变成90%
*/
String
suffix
()
default
""
;
/**
* 当值为空时,字段的默认值
*/
String
defaultValue
()
default
""
;
/**
* 提示信息
*/
String
prompt
()
default
""
;
/**
* 设置只能选择不能输入的列内容.
*/
String
[]
combo
()
default
{};
/**
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
*/
boolean
isExport
()
default
true
;
/**
* 另一个类中的属性名称,支持多级获取,以小数点隔开
*/
String
targetAttr
()
default
""
;
/**
* 是否自动统计数据,在最后追加一行统计数据总和
*/
boolean
isStatistics
()
default
false
;
/**
* 导出字段对齐方式(0:默认;1:靠左;2:居中;3:靠右)
*/
Align
align
()
default
Align
.
AUTO
;
/**
* 自定义数据处理器
*/
Class
<?>
handler
()
default
ExcelHandlerAdapter
.
class
;
/**
* 自定义数据处理器参数
*/
String
[]
args
()
default
{};
enum
Align
{
AUTO
(
0
),
LEFT
(
1
),
CENTER
(
2
),
RIGHT
(
3
);
private
final
int
value
;
Align
(
int
value
)
{
this
.
value
=
value
;
}
public
int
value
()
{
return
this
.
value
;
}
}
/**
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
*/
Type
type
()
default
Type
.
ALL
;
enum
Type
{
ALL
(
0
),
EXPORT
(
1
),
IMPORT
(
2
);
private
final
int
value
;
Type
(
int
value
)
{
this
.
value
=
value
;
}
int
value
()
{
return
this
.
value
;
}
}
enum
ColumnType
{
NUMERIC
(
0
),
STRING
(
1
),
IMAGE
(
2
);
private
final
int
value
;
ColumnType
(
int
value
)
{
this
.
value
=
value
;
}
int
value
()
{
return
this
.
value
;
}
}
}
basic-common/util/src/main/java/com/yiring/common/annotation/Excels.java
deleted
100644 → 0
浏览文件 @
fa526f10
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
annotation
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
/**
* Excel注解集
*/
@Target
(
ElementType
.
FIELD
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
Excels
{
Excel
[]
value
();
}
basic-common/util/src/main/java/com/yiring/common/text/Convert.java
deleted
100644 → 0
浏览文件 @
fa526f10
差异被折叠。
点击展开。
basic-common/util/src/main/java/com/yiring/common/util/DictUtils.java
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
util
;
package
com
.
yiring
.
common
.
util
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.extra.spring.SpringUtil
;
import
cn.hutool.extra.spring.SpringUtil
;
import
com.yiring.common.core.Redis
;
import
com.yiring.common.core.Redis
;
import
com.yiring.common.dict.Dict
;
import
com.yiring.common.dict.Dict
;
...
@@ -37,12 +39,17 @@ public class DictUtils {
...
@@ -37,12 +39,17 @@ public class DictUtils {
*/
*/
public
static
List
<
Dict
>
getDictCache
(
String
key
)
{
public
static
List
<
Dict
>
getDictCache
(
String
key
)
{
Object
cacheObj
=
SpringUtil
.
getBean
(
Redis
.
class
).
get
(
getCacheKey
(
key
));
Object
cacheObj
=
SpringUtil
.
getBean
(
Redis
.
class
).
get
(
getCacheKey
(
key
));
if
(
StrUtils
.
isNotNull
(
cacheObj
))
{
if
(
ObjectUtil
.
isNotNull
(
cacheObj
))
{
return
StrUtils
.
cast
(
cacheObj
);
return
cast
(
cacheObj
);
}
}
return
null
;
return
null
;
}
}
@SuppressWarnings
(
"unchecked"
)
public
static
<
T
>
T
cast
(
Object
obj
)
{
return
(
T
)
obj
;
}
/**
/**
* 根据字典类型和字典值获取字典标签
* 根据字典类型和字典值获取字典标签
*
*
...
@@ -77,14 +84,12 @@ public class DictUtils {
...
@@ -77,14 +84,12 @@ public class DictUtils {
StringBuilder
propertyString
=
new
StringBuilder
();
StringBuilder
propertyString
=
new
StringBuilder
();
List
<
Dict
>
datas
=
getDictCache
(
dictType
);
List
<
Dict
>
datas
=
getDictCache
(
dictType
);
if
(
StrUtils
.
containsAny
(
separator
,
dictValue
)
&&
StrUtils
.
isNotEmpty
(
datas
))
{
if
(
StrUtil
.
containsAny
(
separator
,
dictValue
)
&&
datas
!=
null
)
{
if
(
datas
!=
null
)
{
for
(
Dict
dict
:
datas
)
{
for
(
Dict
dict
:
datas
)
{
for
(
String
value
:
dictValue
.
split
(
separator
))
{
for
(
String
value
:
dictValue
.
split
(
separator
))
{
if
(
value
.
equals
(
dict
.
getDictValue
()))
{
if
(
value
.
equals
(
dict
.
getDictValue
()))
{
propertyString
.
append
(
dict
.
getDictLabel
()).
append
(
separator
);
propertyString
.
append
(
dict
.
getDictLabel
()).
append
(
separator
);
break
;
break
;
}
}
}
}
}
}
}
...
@@ -97,7 +102,8 @@ public class DictUtils {
...
@@ -97,7 +102,8 @@ public class DictUtils {
}
}
}
}
}
}
return
StrUtils
.
stripEnd
(
propertyString
.
toString
(),
separator
);
// StrUtil.stripEnd(propertyString.toString(), separator);
return
null
;
}
}
/**
/**
...
@@ -112,14 +118,12 @@ public class DictUtils {
...
@@ -112,14 +118,12 @@ public class DictUtils {
StringBuilder
propertyString
=
new
StringBuilder
();
StringBuilder
propertyString
=
new
StringBuilder
();
List
<
Dict
>
datas
=
getDictCache
(
dictType
);
List
<
Dict
>
datas
=
getDictCache
(
dictType
);
if
(
StrUtils
.
containsAny
(
separator
,
dictLabel
)
&&
StrUtils
.
isNotEmpty
(
datas
))
{
if
(
StrUtil
.
containsAny
(
separator
,
dictLabel
)
&&
datas
!=
null
)
{
if
(
datas
!=
null
)
{
for
(
Dict
dict
:
datas
)
{
for
(
Dict
dict
:
datas
)
{
for
(
String
label
:
dictLabel
.
split
(
separator
))
{
for
(
String
label
:
dictLabel
.
split
(
separator
))
{
if
(
label
.
equals
(
dict
.
getDictLabel
()))
{
if
(
label
.
equals
(
dict
.
getDictLabel
()))
{
propertyString
.
append
(
dict
.
getDictValue
()).
append
(
separator
);
propertyString
.
append
(
dict
.
getDictValue
()).
append
(
separator
);
break
;
break
;
}
}
}
}
}
}
}
...
@@ -132,7 +136,8 @@ public class DictUtils {
...
@@ -132,7 +136,8 @@ public class DictUtils {
}
}
}
}
}
}
return
StrUtils
.
stripEnd
(
propertyString
.
toString
(),
separator
);
// StrUtils.stripEnd(propertyString.toString(), separator)
return
null
;
}
}
/**
/**
...
...
basic-common/util/src/main/java/com/yiring/common/util/StrUtils.java
浏览文件 @
1cb3b1b2
/* (C) 2022 YiRing, Inc. */
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
util
;
package
com
.
yiring
.
common
.
util
;
import
cn.hutool.core.util.StrUtil
;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
org.springframework.util.AntPathMatcher
;
import
org.springframework.util.AntPathMatcher
;
/**
/**
* 字符串工具类
* @author Administrator
* @version 1.0
* @description: TODO
* @date 2022/4/22 17:19
*/
*/
public
class
StrUtils
extends
org
.
apache
.
commons
.
lang3
.
StringUtils
{
public
class
StrUtils
extends
StrUtil
{
/**
/**
* 空字符串
* 空字符串
...
@@ -390,7 +394,7 @@ public class StrUtils extends org.apache.commons.lang3.StringUtils {
...
@@ -390,7 +394,7 @@ public class StrUtils extends org.apache.commons.lang3.StringUtils {
* @param size 字符串指定长度
* @param size 字符串指定长度
* @return 返回数字的字符串格式,该字符串为指定长度。
* @return 返回数字的字符串格式,该字符串为指定长度。
*/
*/
public
static
final
String
padl
(
final
Number
num
,
final
int
size
)
{
public
static
String
padl
(
final
Number
num
,
final
int
size
)
{
return
padl
(
num
.
toString
(),
size
,
'0'
);
return
padl
(
num
.
toString
(),
size
,
'0'
);
}
}
...
@@ -402,22 +406,18 @@ public class StrUtils extends org.apache.commons.lang3.StringUtils {
...
@@ -402,22 +406,18 @@ public class StrUtils extends org.apache.commons.lang3.StringUtils {
* @param c 用于补齐的字符
* @param c 用于补齐的字符
* @return 返回指定长度的字符串,由原字符串左补齐或截取得到。
* @return 返回指定长度的字符串,由原字符串左补齐或截取得到。
*/
*/
public
static
final
String
padl
(
final
String
s
,
final
int
size
,
final
char
c
)
{
public
static
String
padl
(
final
String
s
,
final
int
size
,
final
char
c
)
{
final
StringBuilder
sb
=
new
StringBuilder
(
size
);
final
StringBuilder
sb
=
new
StringBuilder
(
size
);
if
(
s
!=
null
)
{
if
(
s
!=
null
)
{
final
int
len
=
s
.
length
();
final
int
len
=
s
.
length
();
if
(
s
.
length
()
<=
size
)
{
if
(
s
.
length
()
<=
size
)
{
for
(
int
i
=
size
-
len
;
i
>
0
;
i
--)
{
sb
.
append
(
String
.
valueOf
(
c
).
repeat
(
size
-
len
));
sb
.
append
(
c
);
}
sb
.
append
(
s
);
sb
.
append
(
s
);
}
else
{
}
else
{
return
s
.
substring
(
len
-
size
,
len
);
return
s
.
substring
(
len
-
size
,
len
);
}
}
}
else
{
}
else
{
for
(
int
i
=
size
;
i
>
0
;
i
--)
{
sb
.
append
(
String
.
valueOf
(
c
).
repeat
(
Math
.
max
(
0
,
size
)));
sb
.
append
(
c
);
}
}
}
return
sb
.
toString
();
return
sb
.
toString
();
}
}
...
...
basic-common/util/src/main/java/com/yiring/common/util/date/DateUtils.java
deleted
100644 → 0
浏览文件 @
fa526f10
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
util
.
date
;
import
java.lang.management.ManagementFactory
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalTime
;
import
java.time.ZoneId
;
import
java.time.ZonedDateTime
;
import
java.util.Date
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
/**
* 时间工具类
*/
public
class
DateUtils
extends
org
.
apache
.
commons
.
lang3
.
time
.
DateUtils
{
public
static
String
YYYY
=
"yyyy"
;
public
static
String
YYYY_MM
=
"yyyy-MM"
;
public
static
String
YYYY_MM_DD
=
"yyyy-MM-dd"
;
public
static
String
YYYYMMDDHHMMSS
=
"yyyyMMddHHmmss"
;
public
static
String
YYYY_MM_DD_HH_MM_SS
=
"yyyy-MM-dd HH:mm:ss"
;
private
static
final
String
[]
parsePatterns
=
{
"yyyy-MM-dd"
,
"yyyy-MM-dd HH:mm:ss"
,
"yyyy-MM-dd HH:mm"
,
"yyyy-MM"
,
"yyyy/MM/dd"
,
"yyyy/MM/dd HH:mm:ss"
,
"yyyy/MM/dd HH:mm"
,
"yyyy/MM"
,
"yyyy.MM.dd"
,
"yyyy.MM.dd HH:mm:ss"
,
"yyyy.MM.dd HH:mm"
,
"yyyy.MM"
,
};
/**
* 获取当前Date型日期
*
* @return Date() 当前日期
*/
public
static
Date
getNowDate
()
{
return
new
Date
();
}
/**
* 获取当前日期, 默认格式为yyyy-MM-dd
*
* @return String
*/
public
static
String
getDate
()
{
return
dateTimeNow
(
YYYY_MM_DD
);
}
public
static
String
getTime
()
{
return
dateTimeNow
(
YYYY_MM_DD_HH_MM_SS
);
}
public
static
String
dateTimeNow
()
{
return
dateTimeNow
(
YYYYMMDDHHMMSS
);
}
public
static
String
dateTimeNow
(
final
String
format
)
{
return
parseDateToStr
(
format
,
new
Date
());
}
public
static
String
dateTime
(
final
Date
date
)
{
return
parseDateToStr
(
YYYY_MM_DD
,
date
);
}
public
static
String
parseDateToStr
(
final
String
format
,
final
Date
date
)
{
return
new
SimpleDateFormat
(
format
).
format
(
date
);
}
public
static
Date
dateTime
(
final
String
format
,
final
String
ts
)
{
try
{
return
new
SimpleDateFormat
(
format
).
parse
(
ts
);
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
/**
* 日期路径 即年/月/日 如2018/08/08
*/
public
static
String
datePath
()
{
Date
now
=
new
Date
();
return
DateFormatUtils
.
format
(
now
,
"yyyy/MM/dd"
);
}
/**
* 日期路径 即年/月/日 如20180808
*/
public
static
String
dateTime
()
{
Date
now
=
new
Date
();
return
DateFormatUtils
.
format
(
now
,
"yyyyMMdd"
);
}
/**
* 日期型字符串转化为日期 格式
*/
public
static
Date
parseDate
(
Object
str
)
{
if
(
str
==
null
)
{
return
null
;
}
try
{
return
parseDate
(
str
.
toString
(),
parsePatterns
);
}
catch
(
ParseException
e
)
{
return
null
;
}
}
/**
* 获取服务器启动时间
*/
public
static
Date
getServerStartDate
()
{
long
time
=
ManagementFactory
.
getRuntimeMXBean
().
getStartTime
();
return
new
Date
(
time
);
}
/**
* 计算两个时间差
*/
public
static
String
getDatePoor
(
Date
endDate
,
Date
nowDate
)
{
long
nd
=
1000
*
24
*
60
*
60
;
long
nh
=
1000
*
60
*
60
;
long
nm
=
1000
*
60
;
// long ns = 1000;
// 获得两个时间的毫秒时间差异
long
diff
=
endDate
.
getTime
()
-
nowDate
.
getTime
();
// 计算差多少天
long
day
=
diff
/
nd
;
// 计算差多少小时
long
hour
=
diff
%
nd
/
nh
;
// 计算差多少分钟
long
min
=
diff
%
nd
%
nh
/
nm
;
// 计算差多少秒//输出结果
// long sec = diff % nd % nh % nm / ns;
return
day
+
"天"
+
hour
+
"小时"
+
min
+
"分钟"
;
}
/**
* 增加 LocalDateTime ==> Date
*/
public
static
Date
toDate
(
LocalDateTime
temporalAccessor
)
{
ZonedDateTime
zdt
=
temporalAccessor
.
atZone
(
ZoneId
.
systemDefault
());
return
Date
.
from
(
zdt
.
toInstant
());
}
/**
* 增加 LocalDate ==> Date
*/
public
static
Date
toDate
(
LocalDate
temporalAccessor
)
{
LocalDateTime
localDateTime
=
LocalDateTime
.
of
(
temporalAccessor
,
LocalTime
.
of
(
0
,
0
,
0
));
ZonedDateTime
zdt
=
localDateTime
.
atZone
(
ZoneId
.
systemDefault
());
return
Date
.
from
(
zdt
.
toInstant
());
}
}
basic-common/util/src/main/java/com/yiring/common/util/file/FileTypeUtils.java
deleted
100644 → 0
浏览文件 @
fa526f10
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
util
.
file
;
import
java.io.File
;
import
org.apache.commons.lang3.StringUtils
;
/**
* 文件类型工具类
*/
public
class
FileTypeUtils
{
/**
* 获取文件类型
* <p>
* 例如: ruoyi.txt, 返回: txt
*
* @param file 文件名
* @return 后缀(不含".")
*/
public
static
String
getFileType
(
File
file
)
{
if
(
null
==
file
)
{
return
StringUtils
.
EMPTY
;
}
return
getFileType
(
file
.
getName
());
}
/**
* 获取文件类型
* <p>
* 例如: ruoyi.txt, 返回: txt
*
* @param fileName 文件名
* @return 后缀(不含".")
*/
public
static
String
getFileType
(
String
fileName
)
{
int
separatorIndex
=
fileName
.
lastIndexOf
(
"."
);
if
(
separatorIndex
<
0
)
{
return
""
;
}
return
fileName
.
substring
(
separatorIndex
+
1
).
toLowerCase
();
}
/**
* 获取文件类型
*
* @param photoByte 文件字节码
* @return 后缀(不含".")
*/
public
static
String
getFileExtendName
(
byte
[]
photoByte
)
{
String
strFileExtendName
=
"JPG"
;
if
(
(
photoByte
[
0
]
==
71
)
&&
(
photoByte
[
1
]
==
73
)
&&
(
photoByte
[
2
]
==
70
)
&&
(
photoByte
[
3
]
==
56
)
&&
((
photoByte
[
4
]
==
55
)
||
(
photoByte
[
4
]
==
57
))
&&
(
photoByte
[
5
]
==
97
)
)
{
strFileExtendName
=
"GIF"
;
}
else
if
((
photoByte
[
6
]
==
74
)
&&
(
photoByte
[
7
]
==
70
)
&&
(
photoByte
[
8
]
==
73
)
&&
(
photoByte
[
9
]
==
70
))
{
strFileExtendName
=
"JPG"
;
}
else
if
((
photoByte
[
0
]
==
66
)
&&
(
photoByte
[
1
]
==
77
))
{
strFileExtendName
=
"BMP"
;
}
else
if
((
photoByte
[
1
]
==
80
)
&&
(
photoByte
[
2
]
==
78
)
&&
(
photoByte
[
3
]
==
71
))
{
strFileExtendName
=
"PNG"
;
}
return
strFileExtendName
;
}
}
basic-common/util/src/main/java/com/yiring/common/util/file/ImageUtils.java
deleted
100644 → 0
浏览文件 @
fa526f10
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
util
.
file
;
import
java.io.ByteArrayInputStream
;
import
java.io.InputStream
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.util.Arrays
;
import
org.apache.poi.util.IOUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* 图片处理工具类
*/
public
class
ImageUtils
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
ImageUtils
.
class
);
public
static
byte
[]
getImage
(
String
imagePath
)
{
InputStream
is
=
getFile
(
imagePath
);
try
{
return
IOUtils
.
toByteArray
(
is
);
}
catch
(
Exception
e
)
{
log
.
error
(
"图片加载异常 {}"
,
e
);
return
null
;
}
finally
{
IOUtils
.
closeQuietly
(
is
);
}
}
public
static
InputStream
getFile
(
String
imagePath
)
{
try
{
byte
[]
result
=
readFile
(
imagePath
);
result
=
Arrays
.
copyOf
(
result
,
result
.
length
);
return
new
ByteArrayInputStream
(
result
);
}
catch
(
Exception
e
)
{
log
.
error
(
"获取图片异常 {}"
,
e
);
}
return
null
;
}
/**
* 读取文件为字节数据
*
* @param url 地址
* @return 字节数据
*/
public
static
byte
[]
readFile
(
String
url
)
{
InputStream
in
=
null
;
try
{
// 网络地址
URL
urlObj
=
new
URL
(
url
);
URLConnection
urlConnection
=
urlObj
.
openConnection
();
urlConnection
.
setConnectTimeout
(
30
*
1000
);
urlConnection
.
setReadTimeout
(
60
*
1000
);
urlConnection
.
setDoInput
(
true
);
in
=
urlConnection
.
getInputStream
();
return
IOUtils
.
toByteArray
(
in
);
}
catch
(
Exception
e
)
{
log
.
error
(
"访问文件异常 {}"
,
e
);
return
null
;
}
finally
{
IOUtils
.
closeQuietly
(
in
);
}
}
}
basic-common/util/src/main/java/com/yiring/common/util/poi/ExcelHandlerAdapter.java
deleted
100644 → 0
浏览文件 @
fa526f10
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
util
.
poi
;
/**
* Excel数据格式处理适配器
*/
public
interface
ExcelHandlerAdapter
{
/**
* 格式化
*
* @param value 单元格数据值
* @param args excel注解args参数组
* @return 处理后的值
*/
Object
format
(
Object
value
,
String
[]
args
);
}
basic-common/util/src/main/java/com/yiring/common/util/poi/ExcelUtils.java
deleted
100644 → 0
浏览文件 @
fa526f10
差异被折叠。
点击展开。
basic-common/util/src/main/java/com/yiring/common/util/reflect/ReflectUtils.java
deleted
100644 → 0
浏览文件 @
fa526f10
差异被折叠。
点击展开。
build.gradle
浏览文件 @
1cb3b1b2
...
@@ -29,6 +29,8 @@ buildscript {
...
@@ -29,6 +29,8 @@ buildscript {
hibernateTypesVersion
=
'2.16.1'
hibernateTypesVersion
=
'2.16.1'
// https://mvnrepository.com/artifact/com.github.liaochong/myexcel
// https://mvnrepository.com/artifact/com.github.liaochong/myexcel
myexcelVersion
=
'4.1.1'
myexcelVersion
=
'4.1.1'
// https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-openfeign
openfeignVersion
=
'3.1.1'
}
}
}
}
...
@@ -77,7 +79,7 @@ subprojects {
...
@@ -77,7 +79,7 @@ subprojects {
annotationProcessor
'org.springframework.boot:spring-boot-configuration-processor'
annotationProcessor
'org.springframework.boot:spring-boot-configuration-processor'
}
}
[
compileJava
,
compileTestJava
,
javadoc
]*.
options
*.
encoding
=
'UTF-8'
[
compileJava
,
compileTestJava
,
javadoc
]*.
options
*.
encoding
=
'UTF-8'
tasks
.
withType
(
JavaCompile
)
{
tasks
.
withType
(
JavaCompile
)
{
options
.
encoding
=
'UTF-8'
options
.
encoding
=
'UTF-8'
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论