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 8a933c23
authored
Sep 08, 2021
by
xmh
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
运维服务:
1. <feat> 可以一次上传多个录像文件
1 parent
c8aa9e36
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
34 deletions
fanxing-commons/src/main/java/com/viontech/fanxing/commons/constant/TaskStatus.java
fanxing-commons/src/main/java/com/viontech/fanxing/commons/vo/ChannelVo.java
fanxing-ops/src/main/java/com/viontech/fanxing/ops/controller/web/ChannelController.java
fanxing-ops/src/main/java/com/viontech/fanxing/ops/service/adapter/ChannelService.java
fanxing-ops/src/main/java/com/viontech/fanxing/ops/service/impl/ChannelServiceImpl.java
fanxing-commons/src/main/java/com/viontech/fanxing/commons/constant/TaskStatus.java
View file @
8a933c2
...
...
@@ -8,13 +8,13 @@ package com.viontech.fanxing.commons.constant;
*/
public
enum
TaskStatus
{
/** 未部署 */
AWAIT
(
0
),
/** 运行中 */
RUNNING
(
1
),
/** 暂停 */
PAUSE
(
2
),
/** 等待执行 */
AWAIT
(
0
),
/** 资源不足 */
/** 无法运行 */
CAN_NOT_RUN
(
4
);
public
int
val
;
...
...
fanxing-commons/src/main/java/com/viontech/fanxing/commons/vo/ChannelVo.java
View file @
8a933c2
...
...
@@ -8,7 +8,6 @@ import java.util.List;
public
class
ChannelVo
extends
ChannelVoBase
{
private
MultipartFile
file
;
private
Boolean
tree
;
public
ChannelVo
()
{
...
...
@@ -27,13 +26,4 @@ public class ChannelVo extends ChannelVoBase {
this
.
tree
=
tree
;
return
this
;
}
public
MultipartFile
getFile
()
{
return
file
;
}
public
ChannelVo
setFile
(
MultipartFile
file
)
{
this
.
file
=
file
;
return
this
;
}
}
\ No newline at end of file
fanxing-ops/src/main/java/com/viontech/fanxing/ops/controller/web/ChannelController.java
View file @
8a933c2
...
...
@@ -15,6 +15,7 @@ import com.viontech.fanxing.ops.service.adapter.ChannelTagService;
import
com.viontech.keliu.util.JsonMessageUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
import
java.util.List
;
...
...
@@ -87,8 +88,8 @@ public class ChannelController extends ChannelBaseController {
}
@PostMapping
(
"/video/upload"
)
public
Object
uploadVideo
(
ChannelVo
channelVo
)
{
Channel
channel
=
channelService
.
uploadVideo
(
channelVo
);
return
JsonMessageUtil
.
getSuccessJsonMsg
(
channel
);
public
Object
uploadVideo
(
@RequestParam
List
<
MultipartFile
>
files
,
@RequestParam
(
required
=
false
)
List
<
Long
>
tags
)
{
channelService
.
uploadVideo
(
files
,
tags
);
return
JsonMessageUtil
.
getSuccessJsonMsg
(
"success"
);
}
}
\ No newline at end of file
fanxing-ops/src/main/java/com/viontech/fanxing/ops/service/adapter/ChannelService.java
View file @
8a933c2
...
...
@@ -5,6 +5,7 @@ import com.viontech.fanxing.commons.base.BaseService;
import
com.viontech.fanxing.commons.model.Channel
;
import
com.viontech.fanxing.commons.vo.ChannelVo
;
import
com.viontech.fanxing.commons.vo.DictCodeVo
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.List
;
...
...
@@ -14,6 +15,6 @@ public interface ChannelService extends BaseService<Channel> {
List
<
DictCodeVo
>
channelOrg
(
List
<
Channel
>
channels
);
Channel
uploadVideo
(
ChannelVo
channelVo
);
void
uploadVideo
(
List
<
MultipartFile
>
files
,
List
<
Long
>
tags
);
}
\ No newline at end of file
fanxing-ops/src/main/java/com/viontech/fanxing/ops/service/impl/ChannelServiceImpl.java
View file @
8a933c2
...
...
@@ -182,8 +182,8 @@ public class ChannelServiceImpl extends BaseServiceImpl<Channel> implements Chan
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Channel
uploadVideo
(
ChannelVo
channelVo
)
{
MultipartFile
file
=
channelVo
.
getFile
();
public
void
uploadVideo
(
List
<
MultipartFile
>
files
,
List
<
Long
>
tags
)
{
for
(
MultipartFile
file
:
files
)
{
String
originalFilename
=
file
.
getOriginalFilename
();
String
basePath
=
vionConfig
.
getImage
().
getPath
()
+
File
.
separator
+
"uploadVideo"
+
File
.
separator
;
String
extension
=
FilenameUtils
.
getExtension
(
originalFilename
);
...
...
@@ -202,20 +202,17 @@ public class ChannelServiceImpl extends BaseServiceImpl<Channel> implements Chan
long
videoLength
=
video
.
length
();
long
mbSize
=
videoLength
/
1024
/
1024
;
List
<
Long
>
tags
=
channelVo
.
getTags
();
channelVo
.
setUnid
(
unid
);
channelVo
.
setChannelUnid
(
unid
);
channelVo
.
setDeviceUnid
(
unid
);
channelVo
.
setName
(
originalFilename
);
channelVo
.
setStreamPath
(
video
.
getPath
());
channelVo
.
setType
(
ChannelType
.
FILE
.
value
);
channelVo
.
setStreamType
(
ChannelType
.
STREAM_FILE
.
value
);
channelVo
.
setPort
(
Math
.
toIntExact
(
mbSize
));
Channel
channel
=
this
.
insertSelective
(
channelVo
);
channel
=
selectByPrimaryKey
(
channel
.
getId
());
channelVo
=
new
ChannelVo
(
channel
);
channelVo
.
setTags
(
tags
);
Channel
channel
=
new
Channel
();
channel
.
setUnid
(
unid
);
channel
.
setChannelUnid
(
unid
);
channel
.
setDeviceUnid
(
unid
);
channel
.
setName
(
originalFilename
);
channel
.
setStreamPath
(
video
.
getPath
());
channel
.
setType
(
ChannelType
.
FILE
.
value
);
channel
.
setStreamType
(
ChannelType
.
STREAM_FILE
.
value
);
channel
.
setPort
(
Math
.
toIntExact
(
mbSize
));
channel
=
this
.
insertSelective
(
channel
);
if
(
tags
!=
null
&&
tags
.
size
()
>
0
)
{
for
(
Long
tagId
:
tags
)
{
ChannelTag
channelTag
=
new
ChannelTag
();
...
...
@@ -224,6 +221,6 @@ public class ChannelServiceImpl extends BaseServiceImpl<Channel> implements Chan
channelTagService
.
insertSelective
(
channelTag
);
}
}
return
channelVo
;
}
}
}
\ No newline at end of file
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