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 97591d73
authored
Oct 28, 2021
by
xmh
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1. 修复录像文件大小小于1mb时显示不正确的bug
2. 完善 任务随机执行 的逻辑:只有在调用启动任务接口时才会执行,其他时候一律不执行
1 parent
b9b5d5af
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
6 deletions
fanxing-ops/src/main/java/com/viontech/fanxing/ops/service/main/VideoService.java
fanxing-task/src/main/java/com/viontech/fanxing/task/model/runtime/RandomRuntimeConfig.java
fanxing-task/src/main/java/com/viontech/fanxing/task/runner/TaskInitRunner.java
fanxing-task/src/main/java/com/viontech/fanxing/task/runner/TaskRunner.java
fanxing-ops/src/main/java/com/viontech/fanxing/ops/service/main/VideoService.java
View file @
97591d7
...
...
@@ -50,7 +50,7 @@ public class VideoService {
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
uploadVideo
(
List
<
MultipartFile
>
files
,
List
<
String
>
tags
)
{
DecimalFormat
decimalFormat
=
new
DecimalFormat
(
".00"
);
DecimalFormat
decimalFormat
=
new
DecimalFormat
(
"
0
.00"
);
for
(
MultipartFile
file
:
files
)
{
String
originalFilename
=
file
.
getOriginalFilename
();
String
basePath
=
vionConfig
.
getImage
().
getPath
()
+
File
.
separator
+
"uploadVideo"
+
File
.
separator
;
...
...
@@ -103,7 +103,7 @@ public class VideoService {
*/
@LocalCache
(
value
=
"video_overView"
,
duration
=
20
,
timeunit
=
TimeUnit
.
SECONDS
)
public
JSONObject
overview
()
{
DecimalFormat
decimalFormat
=
new
DecimalFormat
(
".00"
);
DecimalFormat
decimalFormat
=
new
DecimalFormat
(
"
0
.00"
);
ChannelExample
channelExample
=
new
ChannelExample
();
channelExample
.
createCriteria
().
andTypeEqualTo
(
ChannelType
.
FILE
.
value
);
channelExample
.
createColumns
().
hasExpandColumn
();
...
...
fanxing-task/src/main/java/com/viontech/fanxing/task/model/runtime/RandomRuntimeConfig.java
View file @
97591d7
...
...
@@ -2,14 +2,15 @@ package com.viontech.fanxing.task.model.runtime;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.viontech.fanxing.commons.model.Task
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
import
org.apache.commons.lang3.tuple.ImmutablePair
;
import
java.util.concurrent.TimeUnit
;
/**
*
.
*
随机执行,只有在调用 启动任务 接口的时候调用一次
*
* @author 谢明辉
* @date 2021/10/27
...
...
@@ -20,6 +21,7 @@ import org.apache.commons.lang3.tuple.ImmutablePair;
@Setter
public
class
RandomRuntimeConfig
implements
RuntimeConfig
{
/** 运行多长时间,单位分钟 */
private
Long
runningTime
;
public
RandomRuntimeConfig
(
String
runtimeConf
)
{
...
...
@@ -31,6 +33,8 @@ public class RandomRuntimeConfig implements RuntimeConfig {
@Override
public
ImmutablePair
<
Long
,
Long
>
getNextTimeOfExecutionAndTerminal
()
{
// todo
long
running
=
TimeUnit
.
MINUTES
.
toMillis
(
runningTime
);
return
ImmutablePair
.
nullPair
();
}
}
fanxing-task/src/main/java/com/viontech/fanxing/task/runner/TaskInitRunner.java
View file @
97591d7
...
...
@@ -39,6 +39,10 @@ public class TaskInitRunner implements CommandLineRunner {
List
<
Task
>
tasks
=
taskMapper
.
selectByExampleWithBLOBs
(
new
TaskExample
());
for
(
Task
task
:
tasks
)
{
// 随机任务只有 启动接口 可以启动,暂停状态说明运行完了
if
(
task
.
getRuntimeType
().
equals
(
3
)
&&
task
.
getStatus
()
==
TaskStatus
.
PAUSE
.
val
)
{
continue
;
}
// scene和storage不为空,不处于未部署状态
if
(
StringUtils
.
isNotBlank
(
task
.
getScene
())
&&
task
.
getStoreConfigId
()
!=
null
&&
!
TaskStatus
.
AWAIT
.
valEqual
(
task
.
getStatus
()))
{
try
{
...
...
fanxing-task/src/main/java/com/viontech/fanxing/task/runner/TaskRunner.java
View file @
97591d7
...
...
@@ -78,10 +78,10 @@ public class TaskRunner {
continue
;
}
}
if
(
temp
.
getAvailableResources
()
>
resourceNeed
)
{
if
(
temp
.
getAvailableResources
()
>
=
resourceNeed
)
{
devLock
=
vaServerService
.
getVaServerRedisRepository
().
getDevLock
(
devId
);
temp
=
vaServerMap
.
get
(
devId
);
if
(
temp
.
getAvailableResources
()
>
resourceNeed
)
{
if
(
temp
.
getAvailableResources
()
>
=
resourceNeed
)
{
server
=
temp
;
break
;
}
else
{
...
...
@@ -137,8 +137,11 @@ public class TaskRunner {
boolean
success
=
vaServerService
.
terminateTask
(
taskUnid
);
if
(
success
)
{
taskService
.
updateStatus
(
taskData
.
getTask
().
getId
(),
TaskStatus
.
PAUSE
.
val
);
// 随机任务不进行部署
if
(
taskData
.
getTask
().
getRuntimeType
()
!=
TaskStatus
.
PAUSE
.
val
)
{
boolean
b
=
taskDataService
.
distributeTask
(
taskData
);
}
}
set
.
remove
(
taskUnid
);
}
}
catch
(
Exception
e
)
{
...
...
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