Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
F
feo-jobs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
探普后端
feo-jobs
Commits
1f33c046
Commit
1f33c046
authored
3 years ago
by
张辰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
短视频
parent
37f2daac
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
5240 additions
and
1 deletion
+5240
-1
pom.xml
pom.xml
+30
-1
CurriculumRes.java
...a/com/tanpu/feo/feojob/dao/user/entity/CurriculumRes.java
+255
-0
CurriculumResExample.java
...anpu/feo/feojob/dao/user/entity/CurriculumResExample.java
+1751
-0
UserCsFileRecord.java
...om/tanpu/feo/feojob/dao/user/entity/UserCsFileRecord.java
+195
-0
UserCsFileRecordExample.java
...u/feo/feojob/dao/user/entity/UserCsFileRecordExample.java
+1421
-0
CurriculumResMapper.java
...tanpu/feo/feojob/dao/user/mapper/CurriculumResMapper.java
+36
-0
UserCsFileRecordMapper.java
...pu/feo/feojob/dao/user/mapper/UserCsFileRecordMapper.java
+36
-0
SyncTxVodJob.java
src/main/java/com/tanpu/feo/feojob/jobs/SyncTxVodJob.java
+69
-0
CurriculumResService.java
...va/com/tanpu/feo/feojob/service/CurriculumResService.java
+32
-0
TxVodUtil.java
src/main/java/com/tanpu/feo/feojob/utils/TxVodUtil.java
+249
-0
generatorConfig.xml
src/main/resources/generatorConfig.xml
+58
-0
CurriculumResMapper.xml
src/main/resources/mapper/user/CurriculumResMapper.xml
+607
-0
UserCsFileRecordMapper.xml
src/main/resources/mapper/user/UserCsFileRecordMapper.xml
+501
-0
No files found.
pom.xml
View file @
1f33c046
...
@@ -153,6 +153,17 @@
...
@@ -153,6 +153,17 @@
<artifactId>
spring-boot-starter-test
</artifactId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
<scope>
test
</scope>
</dependency>
</dependency>
<dependency>
<groupId>
com.qcloud
</groupId>
<artifactId>
cos_api
</artifactId>
<version>
5.6.24
</version>
</dependency>
<dependency>
<groupId>
com.qcloud
</groupId>
<artifactId>
vod_api
</artifactId>
<version>
2.1.4
</version>
</dependency>
</dependencies>
</dependencies>
<dependencyManagement>
<dependencyManagement>
...
@@ -196,7 +207,6 @@
...
@@ -196,7 +207,6 @@
<artifactId>
apollo-client
</artifactId>
<artifactId>
apollo-client
</artifactId>
<version>
1.7.0
</version>
<version>
1.7.0
</version>
</dependency>
</dependency>
</dependencies>
</dependencies>
</dependencyManagement>
</dependencyManagement>
...
@@ -247,6 +257,25 @@
...
@@ -247,6 +257,25 @@
</execution>
</execution>
</executions>
</executions>
</plugin>
</plugin>
<plugin>
<groupId>
org.mybatis.generator
</groupId>
<artifactId>
mybatis-generator-maven-plugin
</artifactId>
<version>
1.3.5
</version>
<configuration>
<!--允许移动生成的文件 -->
<verbose>
true
</verbose>
<!-- 是否覆盖 -->
<overwrite>
true
</overwrite>
</configuration>
<dependencies>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<version>
8.0.12
</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</plugins>
<finalName>
app
</finalName>
<finalName>
app
</finalName>
</build>
</build>
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/tanpu/feo/feojob/dao/user/entity/CurriculumRes.java
0 → 100644
View file @
1f33c046
package
com
.
tanpu
.
feo
.
feojob
.
dao
.
user
.
entity
;
import
java.util.Date
;
public
class
CurriculumRes
{
private
String
id
;
private
String
title
;
private
String
audio
;
private
Integer
audioType
;
private
String
teacherId
;
private
String
teacherName
;
private
Integer
duration
;
private
Integer
fileSize
;
private
String
orgId
;
private
String
roomPwd
;
private
Integer
whiteList
;
private
String
createBy
;
private
Integer
readNum
;
private
Integer
readBaseNum
;
private
Date
createTime
;
private
String
updateBy
;
private
Date
updateTime
;
private
Integer
deleteTag
;
private
Integer
status
;
private
Integer
sort
;
private
String
info
;
private
String
cover
;
private
Integer
source
;
private
Integer
istop
;
private
String
content
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
==
null
?
null
:
id
.
trim
();
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
==
null
?
null
:
title
.
trim
();
}
public
String
getAudio
()
{
return
audio
;
}
public
void
setAudio
(
String
audio
)
{
this
.
audio
=
audio
==
null
?
null
:
audio
.
trim
();
}
public
Integer
getAudioType
()
{
return
audioType
;
}
public
void
setAudioType
(
Integer
audioType
)
{
this
.
audioType
=
audioType
;
}
public
String
getTeacherId
()
{
return
teacherId
;
}
public
void
setTeacherId
(
String
teacherId
)
{
this
.
teacherId
=
teacherId
==
null
?
null
:
teacherId
.
trim
();
}
public
String
getTeacherName
()
{
return
teacherName
;
}
public
void
setTeacherName
(
String
teacherName
)
{
this
.
teacherName
=
teacherName
==
null
?
null
:
teacherName
.
trim
();
}
public
Integer
getDuration
()
{
return
duration
;
}
public
void
setDuration
(
Integer
duration
)
{
this
.
duration
=
duration
;
}
public
Integer
getFileSize
()
{
return
fileSize
;
}
public
void
setFileSize
(
Integer
fileSize
)
{
this
.
fileSize
=
fileSize
;
}
public
String
getOrgId
()
{
return
orgId
;
}
public
void
setOrgId
(
String
orgId
)
{
this
.
orgId
=
orgId
==
null
?
null
:
orgId
.
trim
();
}
public
String
getRoomPwd
()
{
return
roomPwd
;
}
public
void
setRoomPwd
(
String
roomPwd
)
{
this
.
roomPwd
=
roomPwd
==
null
?
null
:
roomPwd
.
trim
();
}
public
Integer
getWhiteList
()
{
return
whiteList
;
}
public
void
setWhiteList
(
Integer
whiteList
)
{
this
.
whiteList
=
whiteList
;
}
public
String
getCreateBy
()
{
return
createBy
;
}
public
void
setCreateBy
(
String
createBy
)
{
this
.
createBy
=
createBy
==
null
?
null
:
createBy
.
trim
();
}
public
Integer
getReadNum
()
{
return
readNum
;
}
public
void
setReadNum
(
Integer
readNum
)
{
this
.
readNum
=
readNum
;
}
public
Integer
getReadBaseNum
()
{
return
readBaseNum
;
}
public
void
setReadBaseNum
(
Integer
readBaseNum
)
{
this
.
readBaseNum
=
readBaseNum
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
String
getUpdateBy
()
{
return
updateBy
;
}
public
void
setUpdateBy
(
String
updateBy
)
{
this
.
updateBy
=
updateBy
==
null
?
null
:
updateBy
.
trim
();
}
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
public
Integer
getDeleteTag
()
{
return
deleteTag
;
}
public
void
setDeleteTag
(
Integer
deleteTag
)
{
this
.
deleteTag
=
deleteTag
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
public
Integer
getSort
()
{
return
sort
;
}
public
void
setSort
(
Integer
sort
)
{
this
.
sort
=
sort
;
}
public
String
getInfo
()
{
return
info
;
}
public
void
setInfo
(
String
info
)
{
this
.
info
=
info
==
null
?
null
:
info
.
trim
();
}
public
String
getCover
()
{
return
cover
;
}
public
void
setCover
(
String
cover
)
{
this
.
cover
=
cover
==
null
?
null
:
cover
.
trim
();
}
public
Integer
getSource
()
{
return
source
;
}
public
void
setSource
(
Integer
source
)
{
this
.
source
=
source
;
}
public
Integer
getIstop
()
{
return
istop
;
}
public
void
setIstop
(
Integer
istop
)
{
this
.
istop
=
istop
;
}
public
String
getContent
()
{
return
content
;
}
public
void
setContent
(
String
content
)
{
this
.
content
=
content
==
null
?
null
:
content
.
trim
();
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/java/com/tanpu/feo/feojob/dao/user/entity/CurriculumResExample.java
0 → 100644
View file @
1f33c046
This diff is collapsed.
Click to expand it.
src/main/java/com/tanpu/feo/feojob/dao/user/entity/UserCsFileRecord.java
0 → 100644
View file @
1f33c046
package
com
.
tanpu
.
feo
.
feojob
.
dao
.
user
.
entity
;
import
java.util.Date
;
public
class
UserCsFileRecord
{
private
String
guid
;
private
String
originalName
;
private
String
originalUrl
;
private
String
fileSuffix
;
private
String
fileType
;
private
String
logicalName
;
private
String
logicalPath
;
private
Integer
fileStatus
;
private
String
ext1
;
private
String
ext2
;
private
String
ext3
;
private
Date
createTime
;
private
String
createBy
;
private
Date
updateTime
;
private
String
updateBy
;
private
Integer
deleteTag
;
private
String
ext4
;
private
String
fileAttr
;
private
String
refid
;
public
String
getGuid
()
{
return
guid
;
}
public
void
setGuid
(
String
guid
)
{
this
.
guid
=
guid
==
null
?
null
:
guid
.
trim
();
}
public
String
getOriginalName
()
{
return
originalName
;
}
public
void
setOriginalName
(
String
originalName
)
{
this
.
originalName
=
originalName
==
null
?
null
:
originalName
.
trim
();
}
public
String
getOriginalUrl
()
{
return
originalUrl
;
}
public
void
setOriginalUrl
(
String
originalUrl
)
{
this
.
originalUrl
=
originalUrl
==
null
?
null
:
originalUrl
.
trim
();
}
public
String
getFileSuffix
()
{
return
fileSuffix
;
}
public
void
setFileSuffix
(
String
fileSuffix
)
{
this
.
fileSuffix
=
fileSuffix
==
null
?
null
:
fileSuffix
.
trim
();
}
public
String
getFileType
()
{
return
fileType
;
}
public
void
setFileType
(
String
fileType
)
{
this
.
fileType
=
fileType
==
null
?
null
:
fileType
.
trim
();
}
public
String
getLogicalName
()
{
return
logicalName
;
}
public
void
setLogicalName
(
String
logicalName
)
{
this
.
logicalName
=
logicalName
==
null
?
null
:
logicalName
.
trim
();
}
public
String
getLogicalPath
()
{
return
logicalPath
;
}
public
void
setLogicalPath
(
String
logicalPath
)
{
this
.
logicalPath
=
logicalPath
==
null
?
null
:
logicalPath
.
trim
();
}
public
Integer
getFileStatus
()
{
return
fileStatus
;
}
public
void
setFileStatus
(
Integer
fileStatus
)
{
this
.
fileStatus
=
fileStatus
;
}
public
String
getExt1
()
{
return
ext1
;
}
public
void
setExt1
(
String
ext1
)
{
this
.
ext1
=
ext1
==
null
?
null
:
ext1
.
trim
();
}
public
String
getExt2
()
{
return
ext2
;
}
public
void
setExt2
(
String
ext2
)
{
this
.
ext2
=
ext2
==
null
?
null
:
ext2
.
trim
();
}
public
String
getExt3
()
{
return
ext3
;
}
public
void
setExt3
(
String
ext3
)
{
this
.
ext3
=
ext3
==
null
?
null
:
ext3
.
trim
();
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
String
getCreateBy
()
{
return
createBy
;
}
public
void
setCreateBy
(
String
createBy
)
{
this
.
createBy
=
createBy
==
null
?
null
:
createBy
.
trim
();
}
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
public
String
getUpdateBy
()
{
return
updateBy
;
}
public
void
setUpdateBy
(
String
updateBy
)
{
this
.
updateBy
=
updateBy
==
null
?
null
:
updateBy
.
trim
();
}
public
Integer
getDeleteTag
()
{
return
deleteTag
;
}
public
void
setDeleteTag
(
Integer
deleteTag
)
{
this
.
deleteTag
=
deleteTag
;
}
public
String
getExt4
()
{
return
ext4
;
}
public
void
setExt4
(
String
ext4
)
{
this
.
ext4
=
ext4
==
null
?
null
:
ext4
.
trim
();
}
public
String
getFileAttr
()
{
return
fileAttr
;
}
public
void
setFileAttr
(
String
fileAttr
)
{
this
.
fileAttr
=
fileAttr
==
null
?
null
:
fileAttr
.
trim
();
}
public
String
getRefid
()
{
return
refid
;
}
public
void
setRefid
(
String
refid
)
{
this
.
refid
=
refid
==
null
?
null
:
refid
.
trim
();
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/java/com/tanpu/feo/feojob/dao/user/entity/UserCsFileRecordExample.java
0 → 100644
View file @
1f33c046
This diff is collapsed.
Click to expand it.
src/main/java/com/tanpu/feo/feojob/dao/user/mapper/CurriculumResMapper.java
0 → 100644
View file @
1f33c046
package
com
.
tanpu
.
feo
.
feojob
.
dao
.
user
.
mapper
;
import
com.tanpu.feo.feojob.dao.user.entity.CurriculumRes
;
import
com.tanpu.feo.feojob.dao.user.entity.CurriculumResExample
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
public
interface
CurriculumResMapper
{
long
countByExample
(
CurriculumResExample
example
);
int
deleteByExample
(
CurriculumResExample
example
);
int
deleteByPrimaryKey
(
String
id
);
int
insert
(
CurriculumRes
record
);
int
insertSelective
(
CurriculumRes
record
);
List
<
CurriculumRes
>
selectByExampleWithBLOBs
(
CurriculumResExample
example
);
List
<
CurriculumRes
>
selectByExample
(
CurriculumResExample
example
);
CurriculumRes
selectByPrimaryKey
(
String
id
);
int
updateByExampleSelective
(
@Param
(
"record"
)
CurriculumRes
record
,
@Param
(
"example"
)
CurriculumResExample
example
);
int
updateByExampleWithBLOBs
(
@Param
(
"record"
)
CurriculumRes
record
,
@Param
(
"example"
)
CurriculumResExample
example
);
int
updateByExample
(
@Param
(
"record"
)
CurriculumRes
record
,
@Param
(
"example"
)
CurriculumResExample
example
);
int
updateByPrimaryKeySelective
(
CurriculumRes
record
);
int
updateByPrimaryKeyWithBLOBs
(
CurriculumRes
record
);
int
updateByPrimaryKey
(
CurriculumRes
record
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/java/com/tanpu/feo/feojob/dao/user/mapper/UserCsFileRecordMapper.java
0 → 100644
View file @
1f33c046
package
com
.
tanpu
.
feo
.
feojob
.
dao
.
user
.
mapper
;
import
com.tanpu.feo.feojob.dao.user.entity.UserCsFileRecord
;
import
com.tanpu.feo.feojob.dao.user.entity.UserCsFileRecordExample
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
public
interface
UserCsFileRecordMapper
{
long
countByExample
(
UserCsFileRecordExample
example
);
int
deleteByExample
(
UserCsFileRecordExample
example
);
int
deleteByPrimaryKey
(
String
guid
);
int
insert
(
UserCsFileRecord
record
);
int
insertSelective
(
UserCsFileRecord
record
);
List
<
UserCsFileRecord
>
selectByExampleWithBLOBs
(
UserCsFileRecordExample
example
);
List
<
UserCsFileRecord
>
selectByExample
(
UserCsFileRecordExample
example
);
UserCsFileRecord
selectByPrimaryKey
(
String
guid
);
int
updateByExampleSelective
(
@Param
(
"record"
)
UserCsFileRecord
record
,
@Param
(
"example"
)
UserCsFileRecordExample
example
);
int
updateByExampleWithBLOBs
(
@Param
(
"record"
)
UserCsFileRecord
record
,
@Param
(
"example"
)
UserCsFileRecordExample
example
);
int
updateByExample
(
@Param
(
"record"
)
UserCsFileRecord
record
,
@Param
(
"example"
)
UserCsFileRecordExample
example
);
int
updateByPrimaryKeySelective
(
UserCsFileRecord
record
);
int
updateByPrimaryKeyWithBLOBs
(
UserCsFileRecord
record
);
int
updateByPrimaryKey
(
UserCsFileRecord
record
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/java/com/tanpu/feo/feojob/jobs/SyncTxVodJob.java
0 → 100644
View file @
1f33c046
package
com
.
tanpu
.
feo
.
feojob
.
jobs
;
import
com.tanpu.feo.feojob.dao.user.entity.CurriculumRes
;
import
com.tanpu.feo.feojob.dao.user.entity.CurriculumResExample
;
import
com.tanpu.feo.feojob.dao.user.entity.UserCsFileRecord
;
import
com.tanpu.feo.feojob.dao.user.mapper.CurriculumResMapper
;
import
com.tanpu.feo.feojob.dao.user.mapper.UserCsFileRecordMapper
;
import
com.tanpu.feo.feojob.service.CurriculumResService
;
import
com.tanpu.feo.feojob.utils.TxVodUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.Map
;
@Component
@Slf4j
public
class
SyncTxVodJob
{
@Resource
private
CurriculumResService
curriculumResService
;
@Resource
private
UserCsFileRecordMapper
userCsFileRecordMapper
;
@Resource
private
CurriculumResMapper
resMapper
;
@Scheduled
(
cron
=
"0 * * * * ? "
)
public
void
execute
()
{
List
<
UserCsFileRecord
>
records
=
curriculumResService
.
selectShortVideoForUndoneVodTask
();
for
(
UserCsFileRecord
record
:
records
)
{
try
{
executeTask
(
record
);
}
catch
(
Exception
e
)
{
log
.
error
(
"error in parse short video task. guid: {}, error: {}"
,
record
.
getGuid
(),
e
);
}
}
}
public
void
executeTask
(
UserCsFileRecord
record
)
{
String
taskId
=
record
.
getExt2
();
if
(
StringUtils
.
isBlank
(
taskId
))
{
return
;
}
Map
<
String
,
String
>
resultMap
=
TxVodUtil
.
getTransUrlByFileId
(
taskId
);
String
videoUrl
=
resultMap
.
get
(
"videoUrl"
);
String
coverUrl
=
resultMap
.
get
(
"coverUrl"
);
if
(
StringUtils
.
isNotBlank
(
videoUrl
)
&&
StringUtils
.
isNotBlank
(
coverUrl
))
{
// 更新视频资源
CurriculumRes
res
=
new
CurriculumRes
();
res
.
setId
(
record
.
getRefid
());
res
.
setAudio
(
videoUrl
);
res
.
setCover
(
coverUrl
);
resMapper
.
updateByPrimaryKeySelective
(
res
);
// 更新cs file record
record
.
setExt1
(
""
);
userCsFileRecordMapper
.
updateByPrimaryKeySelective
(
record
);
}
}
}
This diff is collapsed.
Click to expand it.
src/main/java/com/tanpu/feo/feojob/service/CurriculumResService.java
0 → 100644
View file @
1f33c046
package
com
.
tanpu
.
feo
.
feojob
.
service
;
import
com.tanpu.feo.feojob.dao.user.entity.CurriculumRes
;
import
com.tanpu.feo.feojob.dao.user.entity.CurriculumResExample
;
import
com.tanpu.feo.feojob.dao.user.entity.UserCsFileRecord
;
import
com.tanpu.feo.feojob.dao.user.entity.UserCsFileRecordExample
;
import
com.tanpu.feo.feojob.dao.user.mapper.CurriculumResMapper
;
import
com.tanpu.feo.feojob.dao.user.mapper.UserCsFileRecordMapper
;
import
org.checkerframework.checker.units.qual.C
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
@Service
public
class
CurriculumResService
{
@Resource
private
CurriculumResMapper
curriculumResMapper
;
@Resource
private
UserCsFileRecordMapper
userCsFileRecordMapper
;
public
List
<
UserCsFileRecord
>
selectShortVideoForUndoneVodTask
()
{
UserCsFileRecordExample
example
=
new
UserCsFileRecordExample
();
example
.
createCriteria
().
andFileTypeEqualTo
(
"shortVideo"
).
andExt2NotEqualTo
(
""
);
example
.
setOrderByClause
(
" create_time desc limit 10"
);
List
<
UserCsFileRecord
>
records
=
userCsFileRecordMapper
.
selectByExample
(
example
);
return
records
;
}
}
This diff is collapsed.
Click to expand it.
src/main/java/com/tanpu/feo/feojob/utils/TxVodUtil.java
0 → 100644
View file @
1f33c046
package
com
.
tanpu
.
feo
.
feojob
.
utils
;
import
com.google.common.collect.Maps
;
import
com.qcloud.vod.VodUploadClient
;
import
com.qcloud.vod.model.VodUploadRequest
;
import
com.qcloud.vod.model.VodUploadResponse
;
import
com.tencentcloudapi.common.Credential
;
import
com.tencentcloudapi.vod.v20180717.VodClient
;
import
com.tencentcloudapi.vod.v20180717.models.*
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Configuration
;
import
java.util.Map
;
/**
* 腾讯点播
*/
@Configuration
public
class
TxVodUtil
{
/**
* 腾讯云的SecretId
*/
private
static
String
secretId
;
/**
* 腾讯云的SecretKey
*/
private
static
String
secretKey
;
/**
* 腾讯云地区
*/
private
static
String
region
;
private
static
String
procedure
;
private
static
Long
subAppId
;
private
static
Long
classId
;
private
static
VodUploadClient
vodUploadClient
;
private
static
VodClient
vodClient
;
@Value
(
"${tencent.cloud.secretId}"
)
public
void
setSecretId
(
String
secretId
)
{
TxVodUtil
.
secretId
=
secretId
;
}
@Value
(
"${tencent.cloud.secretKey}"
)
public
void
setSecretKey
(
String
secretKey
)
{
TxVodUtil
.
secretKey
=
secretKey
;
}
@Value
(
"${tencent.cloud.region}"
)
public
void
setRegion
(
String
region
)
{
TxVodUtil
.
region
=
region
;
}
@Value
(
"${tencent.cloud.vod.procedure}"
)
public
void
setProcedure
(
String
procedure
)
{
TxVodUtil
.
procedure
=
procedure
;
}
@Value
(
"${tencent.cloud.vod.subAppId}"
)
public
void
setSubAppId
(
Long
subAppId
)
{
TxVodUtil
.
subAppId
=
subAppId
;
}
@Value
(
"${tencent.cloud.vod.classId}"
)
public
void
setClassId
(
Long
classId
)
{
TxVodUtil
.
classId
=
classId
;
}
public
static
VodUploadClient
getVodUploadClient
()
{
if
(
vodUploadClient
==
null
)
{
vodUploadClient
=
new
VodUploadClient
(
secretId
,
secretKey
);
}
return
vodUploadClient
;
}
public
static
VodClient
getVodClient
()
{
Credential
credential
=
new
Credential
(
secretId
,
secretKey
);
if
(
vodClient
==
null
)
{
vodClient
=
new
VodClient
(
credential
,
region
);
}
return
vodClient
;
}
/**
* 上传点播视频
*
* @param filePath
* @return
*/
public
static
VodUploadResponse
upload
(
String
filePath
)
{
VodUploadRequest
request
=
new
VodUploadRequest
();
request
.
setMediaFilePath
(
filePath
);
request
.
setSubAppId
(
subAppId
);
request
.
setClassId
(
classId
);
request
.
setProcedure
(
procedure
);
try
{
VodUploadResponse
vodUploadResponse
=
getVodUploadClient
().
upload
(
region
,
request
);
if
(
vodUploadResponse
!=
null
&&
StringUtils
.
isNotBlank
(
vodUploadResponse
.
getFileId
()))
{
return
vodUploadResponse
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
/**
* 文件转码
*
* @param fileId
* @return
*/
public
static
String
processTrans
(
String
fileId
,
Long
templateId
)
{
ProcessMediaRequest
processMediaRequest
=
new
ProcessMediaRequest
();
processMediaRequest
.
setFileId
(
fileId
);
MediaProcessTaskInput
taskInput
=
new
MediaProcessTaskInput
();
TranscodeTaskInput
[]
transcodeTaskInputs
=
new
TranscodeTaskInput
[
1
];
TranscodeTaskInput
i
=
new
TranscodeTaskInput
();
i
.
setDefinition
(
templateId
);
transcodeTaskInputs
[
0
]
=
i
;
taskInput
.
setTranscodeTaskSet
(
transcodeTaskInputs
);
processMediaRequest
.
setMediaProcessTask
(
taskInput
);
try
{
ProcessMediaResponse
res
=
getVodClient
().
ProcessMedia
(
processMediaRequest
);
if
(
res
!=
null
&&
StringUtils
.
isNotBlank
(
res
.
getTaskId
()))
{
return
res
.
getTaskId
();
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
""
;
}
/**
* 获取点播任务详情
*
* @param taskId
* @return
*/
public
static
DescribeTaskDetailResponse
getTaskDetail
(
String
taskId
)
{
DescribeTaskDetailRequest
taskReq
=
new
DescribeTaskDetailRequest
();
taskReq
.
setTaskId
(
taskId
);
taskReq
.
setSubAppId
(
subAppId
);
try
{
return
getVodClient
().
DescribeTaskDetail
(
taskReq
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
/**
* 获取转码候url
*
* @param fileId
* @return
*/
public
static
Map
<
String
,
String
>
getTransUrlByFileId
(
String
fileId
)
{
DescribeTasksRequest
taskReq
=
new
DescribeTasksRequest
();
taskReq
.
setFileId
(
fileId
);
taskReq
.
setStatus
(
"FINISH"
);
taskReq
.
setSubAppId
(
subAppId
);
try
{
DescribeTasksResponse
tasksRes
=
getVodClient
().
DescribeTasks
(
taskReq
);
if
(
tasksRes
!=
null
&&
tasksRes
.
getTaskSet
()
!=
null
&&
tasksRes
.
getTaskSet
().
length
>
0
)
{
String
taskId
=
tasksRes
.
getTaskSet
()[
0
].
getTaskId
();
// 获取任务详情
DescribeTaskDetailResponse
taskRes
=
getTaskDetail
(
taskId
);
if
(
taskRes
!=
null
&&
taskRes
.
getStatus
().
equals
(
"FINISH"
)
&&
taskRes
.
getProcedureTask
()
!=
null
&&
taskRes
.
getProcedureTask
().
getStatus
().
equals
(
"FINISH"
))
{
Map
<
String
,
String
>
result
=
Maps
.
newHashMap
();
for
(
MediaProcessTaskResult
mediaProcessTaskResult
:
taskRes
.
getProcedureTask
().
getMediaProcessResultSet
())
{
if
(
mediaProcessTaskResult
.
getType
().
equals
(
"Transcode"
))
{
// 转码文件地址
result
.
put
(
"videoUrl"
,
mediaProcessTaskResult
.
getTranscodeTask
().
getOutput
().
getUrl
());
}
else
if
(
mediaProcessTaskResult
.
getType
().
equals
(
"CoverBySnapshot"
))
{
// 封面
result
.
put
(
"coverUrl"
,
mediaProcessTaskResult
.
getCoverBySnapshotTask
().
getOutput
().
getCoverUrl
().
replace
(
"http://"
,
"https://"
));
}
}
return
result
;
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
public
static
void
main
(
String
[]
args
)
{
String
txCloudSecretId
=
"AKIDTjjV2IhK4ZKBm8z5g14vPedNSJuFnTIq"
;
/**
* 腾讯云访问secretkey
*/
String
txCloudSecretKey
=
"PaVBZfeQwDVXKr7TZOzM6c9VZNwGJGyA"
;
VodUploadClient
client
=
new
VodUploadClient
(
txCloudSecretId
,
txCloudSecretKey
);
VodUploadRequest
request
=
new
VodUploadRequest
();
request
.
setMediaFilePath
(
"C://Users//John.Hu//Downloads//v.f100010.mp4"
);
request
.
setProcedure
(
"STD-H264-MP4-1080P"
);
request
.
setSubAppId
(
1500000662L
);
request
.
setClassId
(
782943L
);
try
{
// VodUploadResponse response = client.upload("ap-shanghai", request);
// System.out.println("Upload MediaUrl = {}" + response.getMediaUrl());
// System.out.println("Upload FileId = {}" + response.getFileId());
// System.out.println("Upload CoverUrl = {}" + response.getCoverUrl());
// System.out.println("Upload RequestId = {}" + response.getRequestId());
Credential
credential
=
new
Credential
(
txCloudSecretId
,
txCloudSecretKey
);
VodClient
vodClient
=
new
VodClient
(
credential
,
"ap-shanghai"
);
// ProcessMediaRequest processMediaRequest = new ProcessMediaRequest();
// processMediaRequest.setFileId("5285890811956391348");
// MediaProcessTaskInput taskInput = new MediaProcessTaskInput();
// TranscodeTaskInput[] transcodeTaskInputs = new TranscodeTaskInput[1];
// TranscodeTaskInput i = new TranscodeTaskInput();
// i.setDefinition(100010L);
// transcodeTaskInputs[0]=i;
// taskInput.setTranscodeTaskSet(transcodeTaskInputs);
// processMediaRequest.setMediaProcessTask(taskInput);
// ProcessMediaResponse res = vodClient.ProcessMedia(processMediaRequest);
// System.out.println("任务返回:"+res.getTaskId());
DescribeTaskDetailRequest
taskReq
=
new
DescribeTaskDetailRequest
();
taskReq
.
setTaskId
(
"1500000662-procedurev2-83c0147bbf2f70131c214cbb3e8bdc1dt0"
);
taskReq
.
setSubAppId
(
1500000662L
);
DescribeTaskDetailResponse
detailResponse
=
vodClient
.
DescribeTaskDetail
(
taskReq
);
System
.
out
.
println
(
"任务返回:"
+
detailResponse
.
toString
());
// DescribeTasksRequest r = new DescribeTasksRequest();
// r.setFileId("5285890814434477117");
// r.setSubAppId(1500000662L);
// r.setStatus("FINISH");
// DescribeTasksResponse dr = vodClient.DescribeTasks(r);
// System.out.println("大小:" + dr.getTaskSet().length);
// TaskSimpleInfo[] taskSimpleInfos = dr.getTaskSet();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
This diff is collapsed.
Click to expand it.
src/main/resources/generatorConfig.xml
0 → 100644
View file @
1f33c046
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<context
id=
"MYSqlContext"
targetRuntime=
"MyBatis3"
defaultModelType=
"flat"
>
<!-- 设置要使用的Java文件的编码 -->
<property
name=
"javaFileEncoding"
value=
"UTF-8"
/>
<!--去掉注释-->
<commentGenerator>
<property
name=
"suppressAllComments"
value=
"true"
/>
</commentGenerator>
<!--需要配置数据库连接-->
<jdbcConnection
driverClass=
"com.mysql.cj.jdbc.Driver"
connectionURL=
"jdbc:mysql://test-mysql.tamp-innner.com:3306/tamp_feo_user?useSSL=false"
userId=
"tamp_admin"
password=
"@imeng123"
>
<property
name=
"nullCatalogMeansCurrent"
value=
"true"
/>
</jdbcConnection>
<javaTypeResolver>
<property
name=
"forceBigDecimals"
value=
"false"
/>
</javaTypeResolver>
<!--指定entity生成的位置-->
<javaModelGenerator
targetPackage=
"com.tanpu.feo.admin.dao.model.user"
targetProject=
"src/main/java"
>
<property
name=
"enableSubPackages"
value=
"false"
/>
<property
name=
"trimStrings"
value=
"true"
/>
</javaModelGenerator>
<!--sql映射文件生成的位置 mapper.mapper-->
<sqlMapGenerator
targetPackage=
"mapperuser"
targetProject=
"src/main/resources"
>
<property
name=
"enableSubPackages"
value=
"false"
/>
</sqlMapGenerator>
<!--指定DaoMapper生成的位置 mapper.java-->
<javaClientGenerator
type=
"XMLMAPPER"
targetPackage=
"com.tanpu.feo.admin.dao.mapperuser"
targetProject=
"src/main/java"
>
<property
name=
"enableSubPackages"
value=
"false"
/>
</javaClientGenerator>
<!-- <table tableName="org_fund_manager" domainObjectName="OrgFundManager">-->
<!-- </table>-->
<!-- <table tableName="org_fund_company" domainObjectName="OrgFundCompany">-->
<!-- </table>-->
<table
tableName=
"curriculum_res"
domainObjectName=
"CurriculumRes"
>
<!-- </table>-->
<!-- <table tableName="tag" domainObjectName="Tag">-->
<!-- </table>-->
<!-- <table tableName="tag_rel" domainObjectName="TagRel">-->
<!-- </table>-->
<!-- <table tableName="cs_file_record" domainObjectName="UserCsFileRecord">-->
<!-- </table>-->
<!-- <table tableName="QUERY_NAV_FUND_LIST" domainObjectName="QueryNavFundList">-->
<!-- <table tableName="cs_file_record" domainObjectName="CsFileRecord">-->
</table>
</context>
</generatorConfiguration>
This diff is collapsed.
Click to expand it.
src/main/resources/mapper/user/CurriculumResMapper.xml
0 → 100644
View file @
1f33c046
This diff is collapsed.
Click to expand it.
src/main/resources/mapper/user/UserCsFileRecordMapper.xml
0 → 100644
View file @
1f33c046
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment