Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
education
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李丛阳
education
Commits
ec523321
Commit
ec523321
authored
Jul 13, 2020
by
luzhuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 新增单个课程 课件下载接口
parent
6506f7af
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
1 deletion
+59
-1
BChapterController.java
...soft/business/bchapter/controller/BChapterController.java
+11
-1
BChapterService.java
...rg/rcisoft/business/bchapter/service/BChapterService.java
+7
-0
BChapterServiceImpl.java
...t/business/bchapter/service/impl/BChapterServiceImpl.java
+40
-0
BLessonMapper.xml
...esources/mapper/business/blesson/mapper/BLessonMapper.xml
+1
-0
No files found.
src/main/java/org/rcisoft/business/bchapter/controller/BChapterController.java
View file @
ec523321
...
@@ -200,7 +200,17 @@ public class BChapterController extends PaginationController<BChapter> {
...
@@ -200,7 +200,17 @@ public class BChapterController extends PaginationController<BChapter> {
@PostMapping
(
"/getBatchsDownload"
)
@PostMapping
(
"/getBatchsDownload"
)
public
Result
getBatchsDownload
(
CurUser
curUser
,
@RequestParam
String
ids
,
BindingResult
br
)
throws
IOException
{
public
Result
getBatchsDownload
(
CurUser
curUser
,
@RequestParam
String
ids
,
BindingResult
br
)
throws
IOException
{
String
newFileUrl
=
bChapterService
.
getBatchsDownload
(
ids
);
String
newFileUrl
=
bChapterService
.
getBatchsDownload
(
ids
);
// String newFileUrl = "http://192.168.5.54/eduServer/course/zip/6d454523b48d4885a6e2bee4a2bcd967.zip";
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
newFileUrl
);
}
@ApiOperation
(
value
=
"214 根据传入的课程id 单个课程下载文件 返回服务器Zip包地址"
,
notes
=
"下载文件 批量返回服务器Zip包地址"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"课程id"
,
required
=
true
,
dataType
=
"varchar"
)
@PostMapping
(
"/getLessonDownload"
)
public
Result
getLessonDownload
(
CurUser
curUser
,
@RequestParam
String
id
,
BindingResult
br
)
throws
IOException
{
String
newFileUrl
=
bChapterService
.
getLessonDownload
(
id
);
return
Result
.
builder
(
new
PersistModel
(
1
),
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
...
...
src/main/java/org/rcisoft/business/bchapter/service/BChapterService.java
View file @
ec523321
...
@@ -112,12 +112,19 @@ public interface BChapterService{
...
@@ -112,12 +112,19 @@ public interface BChapterService{
* @return
* @return
*/
*/
String
getBatchDownload
(
String
bFileJson
);
String
getBatchDownload
(
String
bFileJson
);
/**
/**
* 下载文件
* 下载文件
* @param bFileJson
* @param bFileJson
* @return
* @return
*/
*/
String
getBatchsDownload
(
String
bFileJson
);
String
getBatchsDownload
(
String
bFileJson
);
/**
* 下载文件
* @param lessonId
* @return
*/
String
getLessonDownload
(
String
lessonId
);
/**
/**
* 判断文件是否
* 判断文件是否
...
...
src/main/java/org/rcisoft/business/bchapter/service/impl/BChapterServiceImpl.java
View file @
ec523321
...
@@ -905,6 +905,46 @@ public class BChapterServiceImpl implements BChapterService {
...
@@ -905,6 +905,46 @@ public class BChapterServiceImpl implements BChapterService {
return
returnAddress
;
return
returnAddress
;
}
}
@Override
public
String
getLessonDownload
(
String
id
)
{
//获取当前课程的信息
BLesson
bLesson
=
bLessonRepository
.
selectByPrimaryKey
(
id
);
List
<
BFile
>
fileList
=
bFileRepository
.
getFileByLessonId
(
id
);
//batch是zip打包文件夹 bFile.getLessonId()替换形成name
String
filePath
=
global
.
getBASE_UPLOAD_SERVER_LOCATION
()
+
global
.
getCOURSE_LOCATION
()
+
File
.
separator
+
bLesson
.
getLessonName
()
;
File
file
=
new
File
(
filePath
);
if
(!
file
.
exists
())
file
.
mkdirs
();
if
(
fileList
!=
null
&&
fileList
.
size
()
>
0
){
//下载文件 并将这些文件包装成File
fileList
.
forEach
(
bFile
->
{
if
(
StringUtils
.
isNotEmpty
(
bFile
.
getVideoUrl
()))
downLoadFile
(
bFile
,
file
,
filePath
,
"1"
);
});
}
String
uuid
=
IdGen
.
uuid
();
//文件打包地址
File
zipFilePath
=
new
File
(
global
.
getBASE_UPLOAD_SERVER_LOCATION
()
+
global
.
getCOURSE_LOCATION
()
+
File
.
separator
+
global
.
getZIP_LOCATION
());
if
(!
zipFilePath
.
exists
())
zipFilePath
.
mkdirs
();
//定义压缩包的生成路径
File
zipFile
=
new
File
(
zipFilePath
.
getPath
()
+
File
.
separator
+
uuid
+
".zip"
);
log
.
info
(
"---------------批量课程下载----------zip压缩包 相对路径--------"
+
zipFile
.
getPath
());
//返回地址
String
returnAddress
=
global
.
getRETURN_UPLOAD_SERVER_LOCATION
()
+
global
.
getCOURSE_LOCATION
()
+
File
.
separator
+
global
.
getZIP_LOCATION
()
+
File
.
separator
+
uuid
+
".zip"
;
log
.
info
(
"---------------批量课程下载----------zip压缩包 网络访问路径--------"
+
returnAddress
);
try
{
//打包
ZipMultiFile
.
toZip
(
filePath
,
new
FileOutputStream
(
zipFile
),
true
);
//删除 文件夹
ZipMultiFile
.
deleteDirectory
(
file
);
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
return
returnAddress
;
}
@Override
@Override
public
String
fileReadable
(
BFile
bFile
)
{
public
String
fileReadable
(
BFile
bFile
)
{
String
flag
=
"1"
;
String
flag
=
"1"
;
...
...
src/main/resources/mapper/business/blesson/mapper/BLessonMapper.xml
View file @
ec523321
...
@@ -188,6 +188,7 @@
...
@@ -188,6 +188,7 @@
<result
column=
"train_address"
jdbcType=
"VARCHAR"
property=
"trainAddress"
/>
<result
column=
"train_address"
jdbcType=
"VARCHAR"
property=
"trainAddress"
/>
<result
column=
"train_sign_time"
jdbcType=
"VARCHAR"
property=
"trainSignTime"
/>
<result
column=
"train_sign_time"
jdbcType=
"VARCHAR"
property=
"trainSignTime"
/>
<result
column=
"qr_code"
jdbcType=
"VARCHAR"
property=
"qrCode"
/>
<result
column=
"qr_code"
jdbcType=
"VARCHAR"
property=
"qrCode"
/>
<result
column=
"corp_id"
jdbcType=
"VARCHAR"
property=
"corpId"
/>
<!---->
<!---->
<result
column=
"value_consume"
jdbcType=
"VARCHAR"
property=
"valueConsume"
/>
<result
column=
"value_consume"
jdbcType=
"VARCHAR"
property=
"valueConsume"
/>
<result
column=
"value_gain"
jdbcType=
"VARCHAR"
property=
"valueGain"
/>
<result
column=
"value_gain"
jdbcType=
"VARCHAR"
property=
"valueGain"
/>
...
...
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