Toggle navigation
Toggle navigation
This project
Loading...
Sign in
crp
/
crp-operation
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
wanghongbo
2025-08-21 14:37:33 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c8b03b7c838fd768243beb390bd1ba404cee3e9a
c8b03b7c
1 parent
bc10928f
审片间垫片上传修改
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
80 additions
and
30 deletions
src/main/java/com/wondertek/controller/BackupMaterialController.java
src/main/java/com/wondertek/controller/RoomOperationController.java
src/main/java/com/wondertek/dto/DelayParam.java
src/main/java/com/wondertek/service/impl/BackupMaterialServiceImpl.java
src/main/java/com/wondertek/service/impl/RoomOperationServiceImpl.java
src/main/java/com/wondertek/controller/BackupMaterialController.java
View file @
c8b03b7
...
...
@@ -54,6 +54,19 @@ public class BackupMaterialController {
}
/**
* @description 提交到素材库
* @author W5669
* @date 2025/8/21 11:26
* @param backupChangeDto
* @return ResultBean
*/
@PostMapping
(
"submit"
)
ResultBean
submit
(
BackupChangeDto
backupChangeDto
){
//
return
ResultBean
.
ok
();
}
/**
* @description 素材删除
* @author W5669
* @date 2025/8/19
...
...
src/main/java/com/wondertek/controller/RoomOperationController.java
View file @
c8b03b7
...
...
@@ -7,6 +7,7 @@ import com.wondertek.service.RoomOperationSerivice;
import
com.wondertek.util.ResultBean
;
import
jakarta.annotation.Resource
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
/**
...
...
@@ -29,7 +30,7 @@ public class RoomOperationController {
* @Version 1.0
*/
@PostMapping
(
"/setDelayTime"
)
public
ResultBean
setDelayTime
(
@RequestBody
DelayParam
delayParam
)
{
public
ResultBean
setDelayTime
(
@RequestBody
@Validated
DelayParam
delayParam
)
{
log
.
info
(
"-->【云审片平台】审片间延时设置,delayParam:{}"
,
delayParam
);
return
roomOperationSerivice
.
setDelayTime
(
delayParam
);
...
...
src/main/java/com/wondertek/dto/DelayParam.java
View file @
c8b03b7
package
com
.
wondertek
.
dto
;
import
jakarta.validation.constraints.NotNull
;
import
lombok.Data
;
/**
...
...
@@ -10,8 +11,12 @@ import lombok.Data;
*/
@Data
public
class
DelayParam
{
@NotNull
(
message
=
"roomId不能为空"
)
private
Long
roomId
;
@NotNull
(
message
=
"delayFirst不能为空"
)
private
Integer
delayFirst
;
@NotNull
(
message
=
"delaySecond不能为空"
)
private
Integer
delaySecond
;
@NotNull
(
message
=
"delayPlay不能为空"
)
private
Integer
delayPlay
;
}
...
...
src/main/java/com/wondertek/service/impl/BackupMaterialServiceImpl.java
View file @
c8b03b7
...
...
@@ -5,8 +5,8 @@ import cn.hutool.core.convert.ConvertException;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
...
...
@@ -99,10 +99,6 @@ public class BackupMaterialServiceImpl extends ServiceImpl<BackupMaterialMapper,
@Override
public
ResultBean
upload
(
MultipartFile
backupFile
,
BackupUploadVo
backupUploadVo
)
{
//校验
// if(!"mp4".equalsIgnoreCase(backupUploadVo.getFileType())){
// throw new ServiceException("仅支持上传mp4格式的垫片文件!");
// }
//校验backupFile后缀名
String
realName
=
backupFile
.
getOriginalFilename
();
String
suffix
=
realName
.
substring
(
realName
.
lastIndexOf
(
"."
)
+
1
);
...
...
@@ -139,6 +135,33 @@ public class BackupMaterialServiceImpl extends ServiceImpl<BackupMaterialMapper,
backupMaterial
.
setFileType
(
backupUploadVo
.
getFileType
());
backupMaterial
.
setCreatedTime
(
LocalDateTime
.
now
());
backupMaterial
.
setCreatedBy
(
"admin"
);
backupMaterial
.
setDel
(
"0"
);
backupMaterial
.
setSource
(
MaterialSourceEnum
.
UPLOAD
.
getCode
());
//封面图
String
coverPath
=
filedir
+
realName
.
substring
(
0
,
realName
.
lastIndexOf
(
"."
))
+
".jpg"
;
if
(
extracted
(
destFilePath
,
coverPath
)){
backupMaterial
.
setCoverPath
(
coverPath
.
replace
(
realPath
,
""
));
}
else
{
backupMaterial
.
setCoverPath
(
""
);
}
//媒体分析获取时长
try
{
Media
media
=
mediaInfoService
.
getMediaInfo
(
destFilePath
,
fileId
);
String
type
=
media
.
getType
();
Long
duration
=
0
l
;
//时长
switch
(
type
)
{
case
MediaType
.
VIDEO_TYPE
:
JSONObject
jsonObject
=
JSONUtil
.
parseObj
(
media
);
duration
=
Double
.
valueOf
(
jsonObject
.
get
(
"duration"
,
Double
.
class
)
*
1000
).
longValue
();
backupMaterial
.
setDuration
(
duration
);
}
}
catch
(
NumberFormatException
|
ConvertException
e
)
{
log
.
error
(
"媒体分析获取时长报错:e={}"
,
e
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
backupMaterialMapper
.
insert
(
backupMaterial
);
//添加审片间垫片配置
LambdaQueryWrapper
<
BackupConfig
>
wrapper
=
new
LambdaQueryWrapper
<>();
...
...
@@ -310,13 +333,41 @@ public class BackupMaterialServiceImpl extends ServiceImpl<BackupMaterialMapper,
backupMaterial
.
setDel
(
"0"
);
backupMaterial
.
setSource
(
MaterialSourceEnum
.
UPLOAD
.
getCode
());
String
coverPath
=
filedir
+
realName
.
substring
(
0
,
realName
.
lastIndexOf
(
"."
))
+
".jpg"
;
if
(
extracted
(
destFilePath
,
coverPath
)){
backupMaterial
.
setCoverPath
(
coverPath
.
replace
(
realPath
,
""
));
}
else
{
backupMaterial
.
setCoverPath
(
""
);
}
//媒体分析获取时长
try
{
Media
media
=
mediaInfoService
.
getMediaInfo
(
destFilePath
,
fileId
);
String
type
=
media
.
getType
();
Long
duration
=
0
l
;
//时长
switch
(
type
)
{
case
MediaType
.
VIDEO_TYPE
:
JSONObject
jsonObject
=
JSONUtil
.
parseObj
(
media
);
duration
=
Double
.
valueOf
(
jsonObject
.
get
(
"duration"
,
Double
.
class
)
*
1000
).
longValue
();
backupMaterial
.
setDuration
(
duration
);
}
}
catch
(
NumberFormatException
|
ConvertException
e
)
{
log
.
error
(
"媒体分析获取时长报错:e={}"
,
e
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
backupMaterialMapper
.
insert
(
backupMaterial
);
return
ResultBean
.
ok
(
"新增素材成功"
);
}
private
boolean
extracted
(
String
destFilePath
,
String
coverPath
)
{
//抽封面图,调用定帧抽图接口
ImageVideoReq
imageVideoReq
=
new
ImageVideoReq
();
imageVideoReq
.
setInput
(
destFilePath
);
imageVideoReq
.
setOffset
(
0L
);
OutPut
outPut
=
new
OutPut
();
outPut
.
setIndex
(
0
);
String
coverPath
=
filedir
+
realName
.
substring
(
0
,
realName
.
lastIndexOf
(
"."
))
+
".jpg"
;
outPut
.
setPath
(
coverPath
);
imageVideoReq
.
setOutput
(
Arrays
.
asList
(
outPut
));
try
{
...
...
@@ -329,8 +380,8 @@ public class BackupMaterialServiceImpl extends ServiceImpl<BackupMaterialMapper,
AbilityResp
response
=
JSONUtils
.
jsonToObject
(
body
,
new
TypeReference
<
AbilityResp
>()
{
});
if
(
response
.
getRet
()
==
0
)
{
backupMaterial
.
setCoverPath
(
coverPath
.
replace
(
realPath
,
""
));
log
.
info
(
"请求能力平台定帧抽图接口成功"
);
return
true
;
}
else
{
log
.
info
(
"请求能力平台定帧抽图接口响应失败,response:{}"
,
response
);
throw
new
ServiceException
(
"请求能力平台定帧抽图接口响应失败"
);
...
...
@@ -341,27 +392,7 @@ public class BackupMaterialServiceImpl extends ServiceImpl<BackupMaterialMapper,
}
catch
(
Exception
e
)
{
log
.
error
(
"请求能力平台定帧抽图接口失败,url:{}"
,
switchStreamUrl
,
e
);
}
//媒体分析获取时长
try
{
Media
media
=
mediaInfoService
.
getMediaInfo
(
destFilePath
,
fileId
);
String
type
=
media
.
getType
();
Long
duration
=
0
l
;
//时长
switch
(
type
)
{
case
MediaType
.
VIDEO_TYPE
:
cn
.
hutool
.
json
.
JSONObject
jsonObject
=
JSONUtil
.
parseObj
(
media
);
duration
=
Double
.
valueOf
(
jsonObject
.
get
(
"duration"
,
Double
.
class
)
*
1000
).
longValue
();
backupMaterial
.
setDuration
(
duration
);
}
}
catch
(
NumberFormatException
|
ConvertException
e
)
{
log
.
error
(
"媒体分析获取时长报错:e={}"
,
e
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
backupMaterialMapper
.
insert
(
backupMaterial
);
return
ResultBean
.
ok
(
"新增素材成功"
);
return
false
;
}
@Override
...
...
src/main/java/com/wondertek/service/impl/RoomOperationServiceImpl.java
View file @
c8b03b7
...
...
@@ -178,7 +178,7 @@ public class RoomOperationServiceImpl implements RoomOperationSerivice {
opLog
.
setBusinessId
(
blockParam
.
getRoomId
().
toString
());
opLog
.
setBusinessType
(
"cloudMonitor"
);
opLog
.
setOperationType
(
blockParam
.
getBlockStatus
().
equals
(
0
)?
RoomOperationEnum
.
BLOCK
.
getCode
():
RoomOperationEnum
.
RECOVER
.
getCode
());
RoomOperationEnum
.
RECOVER
.
getCode
():
RoomOperationEnum
.
BLOCK
.
getCode
());
opLog
.
setCreatedBy
(
"admin"
);
opLog
.
setCreatedTime
(
LocalDateTime
.
now
());
opLog
.
setRequestUrl
(
blockStatusUrl
);
...
...
Please
register
or
login
to post a comment