Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
谢明辉
/
fanxing3
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 95cf11a0
authored
Dec 02, 2021
by
xmh
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
<refactor> 修改请求vaserver失败时的返回
<feat> 数据概览及详情 <feat> 定时任务初步配置
1 parent
07a440e4
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
175 additions
and
43 deletions
fanxing-commons/src/main/java/com/viontech/fanxing/commons/base/BaseModel.java
fanxing-ops/src/main/java/com/viontech/fanxing/ops/controller/web/ContentController.java
fanxing-ops/src/main/java/com/viontech/fanxing/ops/service/adapter/ContentService.java
fanxing-ops/src/main/java/com/viontech/fanxing/ops/service/impl/ContentServiceImpl.java
fanxing-query/src/main/java/com/viontech/fanxing/query/controller/web/TrafficController.java
fanxing-query/src/main/java/com/viontech/fanxing/query/service/adapter/TrafficService.java
fanxing-query/src/main/java/com/viontech/fanxing/query/service/impl/TrafficServiceImpl.java
fanxing-task/src/main/java/com/viontech/fanxing/task/service/VAServerHttpService.java
fanxing-commons/src/main/java/com/viontech/fanxing/commons/base/BaseModel.java
View file @
95cf11a
...
@@ -3,33 +3,40 @@ package com.viontech.fanxing.commons.base;
...
@@ -3,33 +3,40 @@ package com.viontech.fanxing.commons.base;
import
java.io.Serializable
;
import
java.io.Serializable
;
/**
/**
*
* @author suman
* @author suman
* model类的基类 所有的model都要继承自该类
* model类的基类 所有的model都要继承自该类
*/
*/
public
abstract
class
BaseModel
implements
Serializable
{
public
abstract
class
BaseModel
implements
Serializable
{
private
Long
count
;
private
Long
count
;
private
Long
id
;
private
Long
id
;
private
Integer
hour
;
public
BaseModel
()
{
super
();
public
BaseModel
()
{
}
super
();
}
public
Long
getCount
()
{
return
count
;
public
Long
getCount
()
{
}
return
count
;
}
public
void
setCount
(
Long
count
)
{
this
.
count
=
count
;
public
void
setCount
(
Long
count
)
{
}
this
.
count
=
count
;
}
public
Long
getId
()
{
return
id
;
public
Long
getId
()
{
}
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
public
void
setId
(
Long
id
)
{
}
this
.
id
=
id
;
}
public
Integer
getHour
()
{
return
hour
;
}
public
BaseModel
setHour
(
Integer
hour
)
{
this
.
hour
=
hour
;
return
this
;
}
}
}
fanxing-ops/src/main/java/com/viontech/fanxing/ops/controller/web/ContentController.java
View file @
95cf11a
package
com
.
viontech
.
fanxing
.
ops
.
controller
.
web
;
package
com
.
viontech
.
fanxing
.
ops
.
controller
.
web
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.viontech.fanxing.commons.base.BaseExample
;
import
com.viontech.fanxing.commons.base.BaseExample
;
import
com.viontech.fanxing.commons.model.ContentExample
;
import
com.viontech.fanxing.commons.model.ContentExample
;
...
@@ -48,4 +49,11 @@ public class ContentController extends ContentBaseController {
...
@@ -48,4 +49,11 @@ public class ContentController extends ContentBaseController {
public
JsonMessageUtil
.
JsonMessage
<
ImageKeepConfig
>
selectImageKeepConfig
()
{
public
JsonMessageUtil
.
JsonMessage
<
ImageKeepConfig
>
selectImageKeepConfig
()
{
return
JsonMessageUtil
.
getSuccessJsonMsg
(
contentService
.
selectImageKeepConfig
());
return
JsonMessageUtil
.
getSuccessJsonMsg
(
contentService
.
selectImageKeepConfig
());
}
}
@PostMapping
(
"/timing"
)
@ResponseBody
public
JsonMessageUtil
.
JsonMessage
<
Object
>
timing
(
@RequestBody
JSONObject
jsonObject
)
{
contentService
.
addOrUpdateTimingConfig
(
jsonObject
);
return
JsonMessageUtil
.
getSuccessJsonMsg
(
"success"
,
null
);
}
}
}
\ No newline at end of file
\ No newline at end of file
fanxing-ops/src/main/java/com/viontech/fanxing/ops/service/adapter/ContentService.java
View file @
95cf11a
package
com
.
viontech
.
fanxing
.
ops
.
service
.
adapter
;
package
com
.
viontech
.
fanxing
.
ops
.
service
.
adapter
;
import
com.alibaba.fastjson.JSONObject
;
import
com.viontech.fanxing.commons.base.BaseService
;
import
com.viontech.fanxing.commons.base.BaseService
;
import
com.viontech.fanxing.commons.model.Content
;
import
com.viontech.fanxing.commons.model.Content
;
import
com.viontech.fanxing.commons.model.ContentExample
;
import
com.viontech.fanxing.commons.model.ContentExample
;
...
@@ -12,4 +13,6 @@ public interface ContentService extends BaseService<Content> {
...
@@ -12,4 +13,6 @@ public interface ContentService extends BaseService<Content> {
List
<
Content
>
selectByExampleWithBlob
(
ContentExample
contentExample
);
List
<
Content
>
selectByExampleWithBlob
(
ContentExample
contentExample
);
ImageKeepConfig
selectImageKeepConfig
();
ImageKeepConfig
selectImageKeepConfig
();
void
addOrUpdateTimingConfig
(
JSONObject
jsonObject
);
}
}
\ No newline at end of file
\ No newline at end of file
fanxing-ops/src/main/java/com/viontech/fanxing/ops/service/impl/ContentServiceImpl.java
View file @
95cf11a
package
com
.
viontech
.
fanxing
.
ops
.
service
.
impl
;
package
com
.
viontech
.
fanxing
.
ops
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.viontech.fanxing.commons.base.BaseMapper
;
import
com.viontech.fanxing.commons.base.BaseMapper
;
import
com.viontech.fanxing.commons.base.BaseServiceImpl
;
import
com.viontech.fanxing.commons.base.BaseServiceImpl
;
import
com.viontech.fanxing.commons.model.Content
;
import
com.viontech.fanxing.commons.model.Content
;
...
@@ -15,6 +16,8 @@ import java.util.List;
...
@@ -15,6 +16,8 @@ import java.util.List;
@Service
@Service
public
class
ContentServiceImpl
extends
BaseServiceImpl
<
Content
>
implements
ContentService
{
public
class
ContentServiceImpl
extends
BaseServiceImpl
<
Content
>
implements
ContentService
{
private
static
final
String
PLATFORM_CONFIG
=
"platformConfig"
;
private
static
final
String
TIMING_CONFIG
=
"timingConfig"
;
@Resource
@Resource
private
ContentMapper
contentMapper
;
private
ContentMapper
contentMapper
;
...
@@ -32,7 +35,7 @@ public class ContentServiceImpl extends BaseServiceImpl<Content> implements Cont
...
@@ -32,7 +35,7 @@ public class ContentServiceImpl extends BaseServiceImpl<Content> implements Cont
@Override
@Override
public
ImageKeepConfig
selectImageKeepConfig
()
{
public
ImageKeepConfig
selectImageKeepConfig
()
{
ContentExample
contentExample
=
new
ContentExample
();
ContentExample
contentExample
=
new
ContentExample
();
contentExample
.
createCriteria
().
andTypeEqualTo
(
"platformConfig"
).
andNameEqualTo
(
"imageKeepConfig"
);
contentExample
.
createCriteria
().
andTypeEqualTo
(
PLATFORM_CONFIG
).
andNameEqualTo
(
"imageKeepConfig"
);
List
<
Content
>
contents
=
contentMapper
.
selectByExampleWithBLOBs
(
contentExample
);
List
<
Content
>
contents
=
contentMapper
.
selectByExampleWithBLOBs
(
contentExample
);
if
(
contents
.
size
()
>
0
)
{
if
(
contents
.
size
()
>
0
)
{
String
content
=
contents
.
get
(
0
).
getContent
();
String
content
=
contents
.
get
(
0
).
getContent
();
...
@@ -41,4 +44,24 @@ public class ContentServiceImpl extends BaseServiceImpl<Content> implements Cont
...
@@ -41,4 +44,24 @@ public class ContentServiceImpl extends BaseServiceImpl<Content> implements Cont
return
new
ImageKeepConfig
();
return
new
ImageKeepConfig
();
}
}
}
}
@Override
public
void
addOrUpdateTimingConfig
(
JSONObject
jsonObject
)
{
ContentExample
contentExample
=
new
ContentExample
();
contentExample
.
createCriteria
().
andTypeEqualTo
(
PLATFORM_CONFIG
).
andNameEqualTo
(
TIMING_CONFIG
);
List
<
Content
>
contents
=
contentMapper
.
selectByExampleWithBLOBs
(
contentExample
);
if
(
contents
.
size
()
>
0
)
{
Content
content
=
contents
.
get
(
0
);
content
.
setContent
(
jsonObject
.
toJSONString
());
contentMapper
.
updateByPrimaryKeySelective
(
content
);
}
else
{
Content
content
=
new
Content
();
content
.
setName
(
TIMING_CONFIG
);
content
.
setType
(
PLATFORM_CONFIG
);
content
.
setContent
(
jsonObject
.
toJSONString
());
}
// todo 发给运维服务
}
}
}
\ No newline at end of file
\ No newline at end of file
fanxing-query/src/main/java/com/viontech/fanxing/query/controller/web/TrafficController.java
View file @
95cf11a
...
@@ -138,6 +138,17 @@ public class TrafficController extends TrafficBaseController {
...
@@ -138,6 +138,17 @@ public class TrafficController extends TrafficBaseController {
return
JsonMessageUtil
.
getSuccessJsonMsg
(
dataOverViewModels
);
return
JsonMessageUtil
.
getSuccessJsonMsg
(
dataOverViewModels
);
}
}
@GetMapping
(
"overview/detail"
)
@ResponseBody
public
JsonMessageUtil
.
JsonMessage
<
Collection
<
DataOverViewModel
>>
overviewDetail
(
@RequestParam
(
required
=
false
)
Date
date
,
@RequestParam
Long
taskId
)
{
if
(
date
==
null
)
{
date
=
new
Date
();
}
Collection
<
DataOverViewModel
>
dataOverViewModels
=
trafficService
.
overviewDetail
(
date
,
taskId
);
return
JsonMessageUtil
.
getSuccessJsonMsg
(
dataOverViewModels
);
}
public
TrafficExample
getExample
(
TrafficVo
trafficVo
)
{
public
TrafficExample
getExample
(
TrafficVo
trafficVo
)
{
return
(
TrafficExample
)
super
.
getExample
(
trafficVo
,
EXAMPLE_TYPE_PAGE
);
return
(
TrafficExample
)
super
.
getExample
(
trafficVo
,
EXAMPLE_TYPE_PAGE
);
}
}
...
...
fanxing-query/src/main/java/com/viontech/fanxing/query/service/adapter/TrafficService.java
View file @
95cf11a
...
@@ -14,4 +14,6 @@ public interface TrafficService extends BaseService<Traffic> {
...
@@ -14,4 +14,6 @@ public interface TrafficService extends BaseService<Traffic> {
PageInfo
<
TrafficVo
>
getJsonData
(
BaseExample
example
,
int
pageNum
,
int
pageSize
);
PageInfo
<
TrafficVo
>
getJsonData
(
BaseExample
example
,
int
pageNum
,
int
pageSize
);
Collection
<
DataOverViewModel
>
dataOverview
(
Date
date
,
Long
taskId
);
Collection
<
DataOverViewModel
>
dataOverview
(
Date
date
,
Long
taskId
);
Collection
<
DataOverViewModel
>
overviewDetail
(
Date
date
,
Long
taskId
);
}
}
\ No newline at end of file
\ No newline at end of file
fanxing-query/src/main/java/com/viontech/fanxing/query/service/impl/TrafficServiceImpl.java
View file @
95cf11a
...
@@ -18,10 +18,7 @@ import com.viontech.keliu.util.DateUtil;
...
@@ -18,10 +18,7 @@ import com.viontech.keliu.util.DateUtil;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.Collection
;
import
java.util.*
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Service
@Service
...
@@ -122,4 +119,67 @@ public class TrafficServiceImpl extends BaseServiceImpl<Traffic> implements Traf
...
@@ -122,4 +119,67 @@ public class TrafficServiceImpl extends BaseServiceImpl<Traffic> implements Traf
}
}
return
resultMap
.
values
();
return
resultMap
.
values
();
}
}
@Override
public
Collection
<
DataOverViewModel
>
overviewDetail
(
Date
date
,
Long
taskId
)
{
Date
min
=
DateUtil
.
setDayMinTime
(
date
);
Date
max
=
DateUtil
.
setDayMaxTime
(
date
);
TreeMap
<
Integer
,
DataOverViewModel
>
resultMap
=
new
TreeMap
<>();
TrafficExample
trafficExample
=
new
TrafficExample
();
trafficExample
.
createCriteria
().
andEventTimeGreaterThanOrEqualTo
(
min
).
andEventTimeLessThanOrEqualTo
(
max
).
andTaskIdEqualTo
(
taskId
);
TrafficExample
.
ColumnContainer
columns
=
trafficExample
.
createColumns
().
hasTaskIdColumn
();
columns
.
addColumnStr
(
"count(*) as count"
);
columns
.
addColumnStr
(
"hour(date_add(event_time,interval 8 hour)) as hour"
);
trafficExample
.
setGroupByClause
(
"task_id,hour"
);
trafficExample
.
setOrderByClause
(
"task_id,hour"
);
List
<
Traffic
>
traffic
=
trafficMapper
.
selectByExample
(
trafficExample
);
for
(
Traffic
t
:
traffic
)
{
DataOverViewModel
dov
=
resultMap
.
computeIfAbsent
(
t
.
getHour
(),
x
->
{
DataOverViewModel
temp
=
new
DataOverViewModel
();
temp
.
setHour
(
x
);
return
temp
;
});
dov
.
setTraffic
(
t
.
getCount
());
dov
.
setTaskId
(
t
.
getTaskId
());
}
FlowEventExample
flowEventExample
=
new
FlowEventExample
();
flowEventExample
.
createCriteria
().
andEventTimeGreaterThanOrEqualTo
(
min
).
andEventTimeLessThanOrEqualTo
(
max
).
andTaskIdEqualTo
(
taskId
);
FlowEventExample
.
ColumnContainer
columns2
=
flowEventExample
.
createColumns
().
hasTaskIdColumn
();
columns2
.
addColumnStr
(
"count(*) as count"
);
columns2
.
addColumnStr
(
"hour(date_add(event_time,interval 8 hour)) as hour"
);
flowEventExample
.
setGroupByClause
(
"task_id,hour"
);
flowEventExample
.
setOrderByClause
(
"task_id,hour"
);
List
<
FlowEvent
>
flowEvents
=
flowEventService
.
getMapper
().
selectByExample
(
flowEventExample
);
for
(
FlowEvent
f
:
flowEvents
)
{
DataOverViewModel
dov
=
resultMap
.
computeIfAbsent
(
f
.
getHour
(),
x
->
{
DataOverViewModel
temp
=
new
DataOverViewModel
();
temp
.
setHour
(
x
);
return
temp
;
});
dov
.
setFlow
(
f
.
getCount
());
dov
.
setTaskId
(
f
.
getTaskId
());
}
BehaviorExample
behaviorExample
=
new
BehaviorExample
();
behaviorExample
.
createCriteria
().
andEventTimeGreaterThanOrEqualTo
(
min
).
andEventTimeLessThanOrEqualTo
(
max
).
andTaskIdEqualTo
(
taskId
);
BehaviorExample
.
ColumnContainer
columns3
=
behaviorExample
.
createColumns
().
hasTaskIdColumn
();
columns3
.
addColumnStr
(
"count(*) as count"
);
columns3
.
addColumnStr
(
"hour(date_add(event_time,interval 8 hour)) as hour"
);
behaviorExample
.
setGroupByClause
(
"task_id,hour"
);
behaviorExample
.
setOrderByClause
(
"task_id,hour"
);
List
<
Behavior
>
behaviors
=
behaviorService
.
getMapper
().
selectByExample
(
behaviorExample
);
for
(
Behavior
b
:
behaviors
)
{
DataOverViewModel
dov
=
resultMap
.
computeIfAbsent
(
b
.
getHour
(),
x
->
{
DataOverViewModel
temp
=
new
DataOverViewModel
();
temp
.
setHour
(
x
);
return
temp
;
});
dov
.
setBehavior
(
b
.
getCount
());
dov
.
setTaskId
(
b
.
getTaskId
());
}
return
resultMap
.
values
();
}
}
}
\ No newline at end of file
\ No newline at end of file
fanxing-task/src/main/java/com/viontech/fanxing/task/service/VAServerHttpService.java
View file @
95cf11a
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ecwid.consul.v1.ConsulClient
;
import
com.ecwid.consul.v1.ConsulClient
;
import
com.viontech.fanxing.commons.constant.ChannelType
;
import
com.viontech.fanxing.commons.constant.ChannelType
;
import
com.viontech.fanxing.commons.exception.FanXingException
;
import
com.viontech.fanxing.commons.model.Channel
;
import
com.viontech.fanxing.commons.model.Channel
;
import
com.viontech.fanxing.task.model.TaskData
;
import
com.viontech.fanxing.task.model.TaskData
;
import
com.viontech.fanxing.task.model.vaserver.VATask
;
import
com.viontech.fanxing.task.model.vaserver.VATask
;
...
@@ -52,7 +53,7 @@ public class VAServerHttpService {
...
@@ -52,7 +53,7 @@ public class VAServerHttpService {
.
bodyValue
(
vaTask
)
.
bodyValue
(
vaTask
)
.
retrieve
()
.
retrieve
()
.
bodyToMono
(
String
.
class
);
.
bodyToMono
(
String
.
class
);
String
response
=
stringMono
.
block
(
Duration
.
ofSeconds
(
60
));
String
response
=
getResponse
(
stringMono
,
Duration
.
ofSeconds
(
60
));
log
.
info
(
"下发任务结果:{}"
,
response
);
log
.
info
(
"下发任务结果:{}"
,
response
);
return
JSON
.
parseObject
(
response
);
return
JSON
.
parseObject
(
response
);
}
}
...
@@ -74,7 +75,7 @@ public class VAServerHttpService {
...
@@ -74,7 +75,7 @@ public class VAServerHttpService {
.
bodyValue
(
vaTask
)
.
bodyValue
(
vaTask
)
.
retrieve
()
.
retrieve
()
.
bodyToMono
(
String
.
class
);
.
bodyToMono
(
String
.
class
);
String
response
=
stringMono
.
block
(
Duration
.
ofSeconds
(
2
0
));
String
response
=
getResponse
(
stringMono
,
Duration
.
ofSeconds
(
6
0
));
log
.
info
(
"更新任务结果:{}"
,
response
);
log
.
info
(
"更新任务结果:{}"
,
response
);
return
JSON
.
parseObject
(
response
);
return
JSON
.
parseObject
(
response
);
}
}
...
@@ -94,7 +95,7 @@ public class VAServerHttpService {
...
@@ -94,7 +95,7 @@ public class VAServerHttpService {
.
bodyValue
(
jsonObject
.
toString
())
.
bodyValue
(
jsonObject
.
toString
())
.
retrieve
()
.
retrieve
()
.
bodyToMono
(
String
.
class
);
.
bodyToMono
(
String
.
class
);
String
response
=
stringMono
.
block
(
Duration
.
ofSeconds
(
20
)
);
String
response
=
getResponse
(
stringMono
);
log
.
info
(
"删除任务结果:{}"
,
response
);
log
.
info
(
"删除任务结果:{}"
,
response
);
return
JSON
.
parseObject
(
response
);
return
JSON
.
parseObject
(
response
);
}
}
...
@@ -115,7 +116,7 @@ public class VAServerHttpService {
...
@@ -115,7 +116,7 @@ public class VAServerHttpService {
.
retrieve
()
.
retrieve
()
.
bodyToMono
(
String
.
class
);
.
bodyToMono
(
String
.
class
);
String
block
=
stringMono
.
block
(
Duration
.
ofSeconds
(
20
)
);
String
block
=
getResponse
(
stringMono
);
return
JSON
.
parseObject
(
block
);
return
JSON
.
parseObject
(
block
);
}
}
...
@@ -135,7 +136,7 @@ public class VAServerHttpService {
...
@@ -135,7 +136,7 @@ public class VAServerHttpService {
.
retrieve
()
.
retrieve
()
.
bodyToMono
(
String
.
class
);
.
bodyToMono
(
String
.
class
);
String
response
=
stringMono
.
block
(
Duration
.
ofSeconds
(
10
)
);
String
response
=
getResponse
(
stringMono
);
log
.
info
(
"获取分析流地址结果 : {}"
,
response
);
log
.
info
(
"获取分析流地址结果 : {}"
,
response
);
return
JSON
.
parseObject
(
response
);
return
JSON
.
parseObject
(
response
);
}
}
...
@@ -158,7 +159,7 @@ public class VAServerHttpService {
...
@@ -158,7 +159,7 @@ public class VAServerHttpService {
.
retrieve
()
.
retrieve
()
.
bodyToMono
(
String
.
class
);
.
bodyToMono
(
String
.
class
);
String
response
=
stringMono
.
block
(
Duration
.
ofSeconds
(
20
)
);
String
response
=
getResponse
(
stringMono
);
log
.
info
(
"输出分析流结果:{}"
,
response
);
log
.
info
(
"输出分析流结果:{}"
,
response
);
return
JSON
.
parseObject
(
response
);
return
JSON
.
parseObject
(
response
);
}
}
...
@@ -180,7 +181,7 @@ public class VAServerHttpService {
...
@@ -180,7 +181,7 @@ public class VAServerHttpService {
.
retrieve
()
.
retrieve
()
.
bodyToMono
(
String
.
class
);
.
bodyToMono
(
String
.
class
);
String
response
=
stringMono
.
block
(
Duration
.
ofSeconds
(
20
)
);
String
response
=
getResponse
(
stringMono
);
log
.
info
(
"场景切换结果:{}"
,
response
);
log
.
info
(
"场景切换结果:{}"
,
response
);
return
JSON
.
parseObject
(
response
);
return
JSON
.
parseObject
(
response
);
}
}
...
@@ -202,7 +203,7 @@ public class VAServerHttpService {
...
@@ -202,7 +203,7 @@ public class VAServerHttpService {
.
retrieve
()
.
retrieve
()
.
bodyToMono
(
String
.
class
);
.
bodyToMono
(
String
.
class
);
String
response
=
stringMono
.
block
(
Duration
.
ofSeconds
(
20
)
);
String
response
=
getResponse
(
stringMono
);
log
.
info
(
"轮训状态控制结果:{}"
,
response
);
log
.
info
(
"轮训状态控制结果:{}"
,
response
);
return
JSON
.
parseObject
(
response
);
return
JSON
.
parseObject
(
response
);
}
}
...
@@ -223,7 +224,7 @@ public class VAServerHttpService {
...
@@ -223,7 +224,7 @@ public class VAServerHttpService {
.
retrieve
()
.
retrieve
()
.
bodyToMono
(
String
.
class
);
.
bodyToMono
(
String
.
class
);
String
response
=
stringMono
.
block
(
Duration
.
ofSeconds
(
20
)
);
String
response
=
getResponse
(
stringMono
);
log
.
info
(
"获取轮训状态:{}"
,
response
);
log
.
info
(
"获取轮训状态:{}"
,
response
);
return
JSON
.
parseObject
(
response
);
return
JSON
.
parseObject
(
response
);
}
}
...
@@ -242,7 +243,7 @@ public class VAServerHttpService {
...
@@ -242,7 +243,7 @@ public class VAServerHttpService {
.
retrieve
()
.
retrieve
()
.
bodyToMono
(
String
.
class
);
.
bodyToMono
(
String
.
class
);
String
response
=
stringMono
.
block
(
Duration
.
ofSeconds
(
20
)
);
String
response
=
getResponse
(
stringMono
);
log
.
info
(
"运行状态查询:{}"
,
response
);
log
.
info
(
"运行状态查询:{}"
,
response
);
return
JSON
.
parseObject
(
response
);
return
JSON
.
parseObject
(
response
);
}
}
...
@@ -262,7 +263,7 @@ public class VAServerHttpService {
...
@@ -262,7 +263,7 @@ public class VAServerHttpService {
.
retrieve
()
.
retrieve
()
.
bodyToMono
(
String
.
class
);
.
bodyToMono
(
String
.
class
);
String
block
=
mono
.
block
(
Duration
.
ofSeconds
(
20
)
);
String
block
=
getResponse
(
mono
);
log
.
info
(
"默认配置获取:{}"
,
block
);
log
.
info
(
"默认配置获取:{}"
,
block
);
return
JSON
.
parseObject
(
block
);
return
JSON
.
parseObject
(
block
);
...
@@ -283,9 +284,26 @@ public class VAServerHttpService {
...
@@ -283,9 +284,26 @@ public class VAServerHttpService {
.
retrieve
()
.
retrieve
()
.
bodyToMono
(
String
.
class
);
.
bodyToMono
(
String
.
class
);
String
block
=
mono
.
block
(
Duration
.
ofSeconds
(
20
)
);
String
block
=
getResponse
(
mono
);
log
.
info
(
"获取当前预置位:{}"
,
block
);
log
.
info
(
"获取当前预置位:{}"
,
block
);
return
JSON
.
parseObject
(
block
);
return
JSON
.
parseObject
(
block
);
}
}
private
<
T
>
T
getResponse
(
Mono
<
T
>
mono
,
Duration
duration
)
{
try
{
return
mono
.
block
(
duration
);
}
catch
(
Exception
e
)
{
throw
new
FanXingException
(
"访问设备失败"
);
}
}
private
<
T
>
T
getResponse
(
Mono
<
T
>
mono
)
{
try
{
return
mono
.
block
(
Duration
.
ofSeconds
(
20
));
}
catch
(
Exception
e
)
{
throw
new
FanXingException
(
"访问设备失败"
);
}
}
}
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment