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
4b98f49b
Commit
4b98f49b
authored
Jan 02, 2018
by
YangZhaoJun1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善接口
parent
1836d5d1
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
447 additions
and
201 deletions
+447
-201
BChapterController.java
...soft/business/bchapter/controller/BChapterController.java
+3
-3
BChapterRepository.java
...org/rcisoft/business/bchapter/dao/BChapterRepository.java
+5
-4
BChapter.java
...n/java/org/rcisoft/business/bchapter/entity/BChapter.java
+14
-1
BChapterServiceImpl.java
...t/business/bchapter/service/impl/BChapterServiceImpl.java
+71
-51
BFileController.java
...rg/rcisoft/business/bfile/controller/BFileController.java
+18
-36
BFileRepository.java
.../java/org/rcisoft/business/bfile/dao/BFileRepository.java
+42
-0
BFile.java
src/main/java/org/rcisoft/business/bfile/entity/BFile.java
+6
-6
BFileService.java
...java/org/rcisoft/business/bfile/service/BFileService.java
+9
-9
BFileServiceImpl.java
...rcisoft/business/bfile/service/impl/BFileServiceImpl.java
+257
-0
BSlServiceImpl.java
...org/rcisoft/business/bsl/service/impl/BSlServiceImpl.java
+4
-25
BVideoRepository.java
...ava/org/rcisoft/business/bvideo/dao/BVideoRepository.java
+0
-61
Global.java
src/main/java/org/rcisoft/common/component/Global.java
+8
-0
application-dev.yml
src/main/resources/application-dev.yml
+5
-3
BFileMapper.xml
...in/resources/mapper/business/bfile/mapper/BFileMapper.xml
+5
-2
No files found.
src/main/java/org/rcisoft/business/bchapter/controller/BChapterController.java
View file @
4b98f49b
...
@@ -66,12 +66,12 @@ public class BChapterController extends PaginationController<BChapter> {
...
@@ -66,12 +66,12 @@ public class BChapterController extends PaginationController<BChapter> {
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"slId"
,
value
=
"开课id"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"slId"
,
value
=
"开课id"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"chapterName"
,
value
=
"章节名称"
,
required
=
true
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"chapterName"
,
value
=
"章节名称"
,
required
=
true
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"pid"
,
value
=
"上一级"
,
required
=
fals
e
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"pid"
,
value
=
"上一级"
,
required
=
tru
e
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"classHour"
,
value
=
"课时"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"classHour"
,
value
=
"课时"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"isTest"
,
value
=
"1:实验 2:视频 3:PPT'"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"isTest"
,
value
=
"1:实验 2:视频 3:PPT'"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"lessonOrSl"
,
value
=
"课程或开课;0:开课 1:课程"
,
required
=
true
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"lessonOrSl"
,
value
=
"课程或开课;0:开课 1:课程"
,
required
=
true
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"lessonId"
,
value
=
"课程ID(课程ID和开课ID只能存在一个)"
,
required
=
false
,
dataType
=
"varchar"
)})
@ApiImplicitParam
(
name
=
"lessonId"
,
value
=
"课程ID(课程ID和开课ID只能存在一个)"
,
required
=
false
,
dataType
=
"varchar"
)})
@PreAuthorize
(
"hasAnyRole('ROLE_100
2
','ROLE_1002')"
)
@PreAuthorize
(
"hasAnyRole('ROLE_100
1
','ROLE_1002')"
)
@PostMapping
(
value
=
"/add"
)
@PostMapping
(
value
=
"/add"
)
public
Result
add
(
@Valid
BChapter
bChapter
,
public
Result
add
(
@Valid
BChapter
bChapter
,
BindingResult
bindingResult
BindingResult
bindingResult
...
@@ -91,7 +91,7 @@ public class BChapterController extends PaginationController<BChapter> {
...
@@ -91,7 +91,7 @@ public class BChapterController extends PaginationController<BChapter> {
@ApiOperation
(
value
=
"删除章节"
,
notes
=
"根据ID删除一条记录"
)
@ApiOperation
(
value
=
"删除章节"
,
notes
=
"根据ID删除一条记录"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"businessId"
,
required
=
true
,
dataType
=
"varchar"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"businessId"
,
required
=
true
,
dataType
=
"varchar"
)
@PreAuthorize
(
"has
Role(
'ROLE_1002')"
)
@PreAuthorize
(
"has
AnyRole('ROLE_1001',
'ROLE_1002')"
)
@PostMapping
(
value
=
"/remove"
)
@PostMapping
(
value
=
"/remove"
)
public
Result
remove
(
String
id
)
{
public
Result
remove
(
String
id
)
{
PersistModel
data
=
bChapterService
.
removeBChapter
(
id
,
getToken
());
PersistModel
data
=
bChapterService
.
removeBChapter
(
id
,
getToken
());
...
...
src/main/java/org/rcisoft/business/bchapter/dao/BChapterRepository.java
View file @
4b98f49b
...
@@ -46,13 +46,14 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
...
@@ -46,13 +46,14 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
*/
*/
@Select
(
"<script>SELECT\n"
+
@Select
(
"<script>SELECT\n"
+
" bc.*,\n"
+
" bc.*,\n"
+
" (SELECT bv.video_url FROM b_video bv WHERE bv.business_id = bcv1.video_id) AS videoUrl,\n"
+
" bf.video_url AS videoUrl,\n"
+
" (SELECT bv.video_url FROM b_video bv WHERE bv.business_id = bcv2.video_id) AS fileUrl,\n"
+
" bf.file_url AS fileUrl,\n"
+
" bf.ppt_url AS pptUrl,\n"
+
" bf.pdf_url AS pdfUrl,\n"
+
" (SELECT count(*) FROM b_r_student_chapter brs WHERE brs.chapter_id = bc.business_id AND brs.score = - 1) AS studentNum \n"
+
" (SELECT count(*) FROM b_r_student_chapter brs WHERE brs.chapter_id = bc.business_id AND brs.score = - 1) AS studentNum \n"
+
" FROM\n"
+
" FROM\n"
+
" b_chapter bc\n"
+
" b_chapter bc\n"
+
" LEFT JOIN b_r_chapter_video bcv1 ON bcv1.chapter_id = bc.business_id and bcv1.type = '0'\n"
+
" LEFT JOIN b_file bf ON bf.chapter_id = bc.business_id "
+
" LEFT JOIN b_r_chapter_video bcv2 ON bcv2.chapter_id = bc.business_id and bcv2.type = '1'\n"
+
" \n"
+
" \n"
+
" WHERE\n"
+
" WHERE\n"
+
" bc.del_flag = 0\n"
+
" bc.del_flag = 0\n"
+
...
...
src/main/java/org/rcisoft/business/bchapter/entity/BChapter.java
View file @
4b98f49b
...
@@ -71,10 +71,23 @@ public class BChapter extends IdEntity<BChapter> {
...
@@ -71,10 +71,23 @@ public class BChapter extends IdEntity<BChapter> {
@Transient
@Transient
private
String
videoUrl
;
private
String
videoUrl
;
@Transient
@Transient
private
String
fileUrl
;
private
String
fileUrl
;
@Transient
private
String
pptUrl
;
@Transient
private
String
pdfUrl
;
/**
* 课程的父ID(当作map的key存放开课的父ID用)
*/
@Transient
private
String
lPid
;
@Transient
private
String
sPid
;
...
...
src/main/java/org/rcisoft/business/bchapter/service/impl/BChapterServiceImpl.java
View file @
4b98f49b
This diff is collapsed.
Click to expand it.
src/main/java/org/rcisoft/business/b
video/controller/BVideo
Controller.java
→
src/main/java/org/rcisoft/business/b
file/controller/BFile
Controller.java
View file @
4b98f49b
package
org
.
rcisoft
.
business
.
b
video
.
controller
;
package
org
.
rcisoft
.
business
.
b
file
.
controller
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.io.IOUtils
;
import
org.rcisoft.business.b
video.entity.BVideo
;
import
org.rcisoft.business.b
file.entity.BFile
;
import
org.rcisoft.business.b
video.service.BVideo
Service
;
import
org.rcisoft.business.b
file.service.BFile
Service
;
import
org.rcisoft.common.component.Global
;
import
org.rcisoft.common.component.Global
;
import
org.rcisoft.common.controller.PaginationController
;
import
org.rcisoft.common.controller.PaginationController
;
import
org.rcisoft.common.model.GridModel
;
import
org.rcisoft.common.model.GridModel
;
import
org.rcisoft.core.constant.MessageConstant
;
import
org.rcisoft.core.constant.MessageConstant
;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.core.result.Result
;
import
org.rcisoft.core.result.Result
;
import
org.rcisoft.core.result.ResultCode
;
import
org.rcisoft.core.util.UserUtil
;
import
org.rcisoft.core.util.UserUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartHttpServletRequest
;
import
org.springframework.web.multipart.MultipartHttpServletRequest
;
...
@@ -31,9 +29,9 @@ import java.util.List;
...
@@ -31,9 +29,9 @@ import java.util.List;
*/
*/
@RestController
@RestController
@RequestMapping
(
"/BVideo"
)
@RequestMapping
(
"/BVideo"
)
public
class
B
VideoController
extends
PaginationController
<
BVideo
>
{
public
class
B
FileController
extends
PaginationController
<
BFile
>
{
@Autowired
@Autowired
private
B
VideoService
bVideo
Service
;
private
B
FileService
bFile
Service
;
@Autowired
@Autowired
private
Global
global
;
private
Global
global
;
...
@@ -46,12 +44,12 @@ public class BVideoController extends PaginationController<BVideo> {
...
@@ -46,12 +44,12 @@ public class BVideoController extends PaginationController<BVideo> {
@ApiImplicitParam
(
name
=
"remarks"
,
value
=
"备注"
,
required
=
false
,
dataType
=
"varchar"
)})
@ApiImplicitParam
(
name
=
"remarks"
,
value
=
"备注"
,
required
=
false
,
dataType
=
"varchar"
)})
@PreAuthorize
(
"hasRole('ROLE_1002')"
)
@PreAuthorize
(
"hasRole('ROLE_1002')"
)
@PostMapping
(
value
=
"/add"
)
@PostMapping
(
value
=
"/add"
)
public
Result
add
(
B
Video
bVideo
)
{
public
Result
add
(
B
File
bFile
)
{
PersistModel
data
=
b
VideoService
.
persist
(
bVideo
,
getToken
());
PersistModel
data
=
b
FileService
.
persist
(
bFile
,
getToken
());
return
Result
.
builder
(
data
,
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
b
Video
);
b
File
);
}
}
@ApiOperation
(
value
=
"逻辑删除"
,
notes
=
"根据ID删除一条记录"
)
@ApiOperation
(
value
=
"逻辑删除"
,
notes
=
"根据ID删除一条记录"
)
...
@@ -59,7 +57,7 @@ public class BVideoController extends PaginationController<BVideo> {
...
@@ -59,7 +57,7 @@ public class BVideoController extends PaginationController<BVideo> {
@PreAuthorize
(
"hasRole('ROLE_1001')"
)
@PreAuthorize
(
"hasRole('ROLE_1001')"
)
@PostMapping
(
value
=
"/remove"
)
@PostMapping
(
value
=
"/remove"
)
public
Result
remove
(
String
id
)
{
public
Result
remove
(
String
id
)
{
PersistModel
data
=
b
Video
Service
.
removeBVideo
(
id
,
getToken
());
PersistModel
data
=
b
File
Service
.
removeBVideo
(
id
,
getToken
());
return
Result
.
builder
(
data
,
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
...
@@ -73,7 +71,7 @@ public class BVideoController extends PaginationController<BVideo> {
...
@@ -73,7 +71,7 @@ public class BVideoController extends PaginationController<BVideo> {
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
,
b
Video
Service
.
selectOne
(
businessId
));
b
File
Service
.
selectOne
(
businessId
));
}
}
...
@@ -84,9 +82,9 @@ public class BVideoController extends PaginationController<BVideo> {
...
@@ -84,9 +82,9 @@ public class BVideoController extends PaginationController<BVideo> {
@ApiImplicitParam
(
name
=
"type"
,
value
=
"'0'为视频,'1'为附件"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"type"
,
value
=
"'0'为视频,'1'为附件"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"remarks"
,
value
=
"备注"
,
required
=
false
,
dataType
=
"varchar"
)})
@ApiImplicitParam
(
name
=
"remarks"
,
value
=
"备注"
,
required
=
false
,
dataType
=
"varchar"
)})
@GetMapping
(
value
=
"/queryBVideosByPagination"
)
@GetMapping
(
value
=
"/queryBVideosByPagination"
)
public
GridModel
queryBVideosByPagination
(
B
Video
param
)
{
public
GridModel
queryBVideosByPagination
(
B
File
param
)
{
param
.
setCreateBy
(
UserUtil
.
getUserInfoProp
(
getToken
(),
UserUtil
.
USER_ID
));
param
.
setCreateBy
(
UserUtil
.
getUserInfoProp
(
getToken
(),
UserUtil
.
USER_ID
));
b
Video
Service
.
queryBVideosByPagination
(
getPaginationUtility
(),
param
);
b
File
Service
.
queryBVideosByPagination
(
getPaginationUtility
(),
param
);
GridModel
gridModel
=
getGridModelResponse
();
GridModel
gridModel
=
getGridModelResponse
();
return
gridModel
;
return
gridModel
;
}
}
...
@@ -98,12 +96,12 @@ public class BVideoController extends PaginationController<BVideo> {
...
@@ -98,12 +96,12 @@ public class BVideoController extends PaginationController<BVideo> {
@ApiImplicitParam
(
name
=
"type"
,
value
=
"'0'为视频,'1'为附件"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"type"
,
value
=
"'0'为视频,'1'为附件"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"remarks"
,
value
=
"备注"
,
required
=
false
,
dataType
=
"varchar"
)})
@ApiImplicitParam
(
name
=
"remarks"
,
value
=
"备注"
,
required
=
false
,
dataType
=
"varchar"
)})
@GetMapping
(
value
=
"/queryBVideos"
)
@GetMapping
(
value
=
"/queryBVideos"
)
public
Result
queryBVideos
(
B
Video
param
)
{
public
Result
queryBVideos
(
B
File
param
)
{
param
.
setCreateBy
(
UserUtil
.
getUserInfoProp
(
getToken
(),
UserUtil
.
USER_ID
));
param
.
setCreateBy
(
UserUtil
.
getUserInfoProp
(
getToken
(),
UserUtil
.
USER_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
,
b
Video
Service
.
queryBVideos
(
param
));
b
File
Service
.
queryBVideos
(
param
));
}
}
...
@@ -111,30 +109,14 @@ public class BVideoController extends PaginationController<BVideo> {
...
@@ -111,30 +109,14 @@ public class BVideoController extends PaginationController<BVideo> {
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"videoName"
,
value
=
"视频名称"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"videoName"
,
value
=
"视频名称"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"videoUrl"
,
value
=
"视频地址"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"videoUrl"
,
value
=
"视频地址"
,
required
=
false
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"type"
,
value
=
"'0'为视频,'1'为附件
"
,
required
=
fals
e
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"type"
,
value
=
"'0'为视频,'1'为附件
,'2'为ppt,'3'为pdf"
,
required
=
tru
e
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"file"
,
value
=
"视频文件"
,
required
=
true
,
dataType
=
"MultipartFile"
)})
@ApiImplicitParam
(
name
=
"file"
,
value
=
"视频文件"
,
required
=
true
,
dataType
=
"MultipartFile"
)})
@PreAuthorize
(
"hasRole('ROLE_1002')"
)
@PreAuthorize
(
"hasRole('ROLE_1002')"
)
@PostMapping
(
value
=
"/uploadVideo"
)
@PostMapping
(
value
=
"/uploadVideo"
)
public
Result
uploadVideo
(
BVideo
bVideo
,
HttpServletRequest
request
)
{
public
Result
uploadVideo
(
BFile
bFile
,
HttpServletRequest
request
)
{
Result
result
=
new
Result
();
List
<
MultipartFile
>
list
=
((
MultipartHttpServletRequest
)
request
).
getFiles
(
"file"
);
List
<
MultipartFile
>
list
=
((
MultipartHttpServletRequest
)
request
).
getFiles
(
"file"
);
try
{
try
{
String
pathName
;
String
videoUrl
=
bFileService
.
uploadVideoToServer
(
list
,
bFile
,
getToken
());
if
(
bVideo
.
getType
().
equals
(
"0"
)){
pathName
=
global
.
getVIDEO_LOCATION
();
//视频路径
}
else
{
pathName
=
global
.
getFILE_LOCATION
();
//文件路径
}
String
path
=
global
.
getBASE_UPLOAD_SERVER_LOCATION
()
+
pathName
+
File
.
separator
+
bVideo
.
getLessonId
()
+
File
.
separator
;
//根据开课ID区分文件
File
outFile
=
new
File
(
path
);
if
(!
outFile
.
exists
()){
//判断保存路径是否存在,不存在新建
outFile
.
mkdirs
();
}
String
videoUrl
=
bVideoService
.
uploadVideoToServer
(
list
,
bVideo
,
path
,
getToken
());
return
Result
.
builder
(
new
PersistModel
(
1
),
return
Result
.
builder
(
new
PersistModel
(
1
),
"上传成功"
,
"上传成功"
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
...
@@ -161,7 +143,7 @@ public class BVideoController extends PaginationController<BVideo> {
...
@@ -161,7 +143,7 @@ public class BVideoController extends PaginationController<BVideo> {
@ApiImplicitParam
(
name
=
"chapterId"
,
value
=
"章节ID"
,
required
=
true
,
dataType
=
"varchar"
)
@ApiImplicitParam
(
name
=
"chapterId"
,
value
=
"章节ID"
,
required
=
true
,
dataType
=
"varchar"
)
@PostMapping
(
value
=
"/downloadFile"
)
@PostMapping
(
value
=
"/downloadFile"
)
public
Result
downloadFile
(
String
chapterId
,
HttpServletResponse
response
){
public
Result
downloadFile
(
String
chapterId
,
HttpServletResponse
response
){
B
Video
video
=
bVideo
Service
.
queryFileUrlByChapterId
(
chapterId
);
B
File
video
=
bFile
Service
.
queryFileUrlByChapterId
(
chapterId
);
BufferedInputStream
bis
=
null
;
BufferedInputStream
bis
=
null
;
BufferedOutputStream
bos
=
null
;
BufferedOutputStream
bos
=
null
;
if
(
video
.
getVideoUrl
()!=
""
&&
video
.
getVideoUrl
()!=
null
){
if
(
video
.
getVideoUrl
()!=
""
&&
video
.
getVideoUrl
()!=
null
){
...
...
src/main/java/org/rcisoft/business/bfile/dao/BFileRepository.java
0 → 100644
View file @
4b98f49b
package
org
.
rcisoft
.
business
.
bfile
.
dao
;
import
org.apache.ibatis.annotations.Insert
;
import
org.apache.ibatis.annotations.ResultMap
;
import
org.apache.ibatis.annotations.Select
;
import
org.rcisoft.business.bfile.entity.BFile
;
import
org.rcisoft.core.base.BaseMapper
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created with gaowenfneg on 2017-10-9 14:34:56.
*/
@Repository
public
interface
BFileRepository
extends
BaseMapper
<
BFile
>
{
/**
* 根据条件查找
* @param param
* @return
*/
@Select
(
"<script>select * from b_file</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BFile
>
queryBVideos
(
Map
<
String
,
Object
>
param
);
@Select
(
"<script>SELECT * from b_file "
+
"where chapter_id = #{chapterId} </script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
BFile
selectInfoByChapterId
(
String
chapterId
);
@Select
(
"<script>SELECT * FROM b_file WHERE chapter_id = #{chapterId}</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
BFile
queryFileUrlByChapterId
(
String
chapterId
);
@Select
(
"<script>SELECT * FROM b_file WHERE chapter_id = #{chapterId}</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
BFile
queryBVideoByChapterId
(
String
chapterId
);
}
src/main/java/org/rcisoft/business/b
video/entity/BVideo
.java
→
src/main/java/org/rcisoft/business/b
file/entity/BFile
.java
View file @
4b98f49b
package
org
.
rcisoft
.
business
.
b
video
.
entity
;
package
org
.
rcisoft
.
business
.
b
file
.
entity
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -13,11 +13,11 @@ import javax.persistence.Transient;
...
@@ -13,11 +13,11 @@ import javax.persistence.Transient;
* Created with gaowenfneg on 2017-10-9 14:34:56.
* Created with gaowenfneg on 2017-10-9 14:34:56.
*/
*/
@Entity
@Entity
@Table
(
name
=
"b_
video
"
)
@Table
(
name
=
"b_
file
"
)
@Data
@Data
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
public
class
B
Video
extends
IdEntity
<
BVideo
>
{
public
class
B
File
extends
IdEntity
<
BFile
>
{
private
static
final
long
serialVersionUID
=
5501554322621964535L
;
private
static
final
long
serialVersionUID
=
5501554322621964535L
;
/*视频名称*/
/*视频名称*/
...
@@ -35,10 +35,10 @@ public class BVideo extends IdEntity<BVideo> {
...
@@ -35,10 +35,10 @@ public class BVideo extends IdEntity<BVideo> {
private
String
pdfUrl
;
private
String
pdfUrl
;
@Transient
private
String
lessonId
;
//课程ID
private
String
lessonId
;
//开课ID
private
String
slId
;
//开课ID
@Transient
private
String
chapterId
;
//节ID
private
String
chapterId
;
//节ID
}
}
src/main/java/org/rcisoft/business/b
video/service/BVideo
Service.java
→
src/main/java/org/rcisoft/business/b
file/service/BFile
Service.java
View file @
4b98f49b
package
org
.
rcisoft
.
business
.
b
video
.
service
;
package
org
.
rcisoft
.
business
.
b
file
.
service
;
import
org.rcisoft.business.b
video.entity.BVideo
;
import
org.rcisoft.business.b
file.entity.BFile
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.core.model.PersistModel
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
...
@@ -10,13 +10,13 @@ import java.util.List;
...
@@ -10,13 +10,13 @@ import java.util.List;
/**
/**
* Created by gaowenfneg on 2017-10-9 14:34:56.
* Created by gaowenfneg on 2017-10-9 14:34:56.
*/
*/
public
interface
B
VideoService
{
public
interface
B
FileService
{
/**
/**
* 根据主键唯一查找
* 根据主键唯一查找
* @param businessId
* @param businessId
* @return
* @return
*/
*/
B
Video
selectOne
(
String
businessId
);
B
File
selectOne
(
String
businessId
);
/**
/**
* 根据条件分页查找
* 根据条件分页查找
...
@@ -24,21 +24,21 @@ public interface BVideoService{
...
@@ -24,21 +24,21 @@ public interface BVideoService{
* @param model
* @param model
* @return
* @return
*/
*/
List
<
B
Video
>
queryBVideosByPagination
(
PageUtil
pageUtil
,
BVideo
model
);
List
<
B
File
>
queryBVideosByPagination
(
PageUtil
pageUtil
,
BFile
model
);
/**
/**
* 根据条件查找全部
* 根据条件查找全部
* @param model
* @param model
* @return
* @return
*/
*/
List
<
B
Video
>
queryBVideos
(
BVideo
model
);
List
<
B
File
>
queryBVideos
(
BFile
model
);
/**
/**
* 插入
* 插入
* @param model
* @param model
* @return
* @return
*/
*/
PersistModel
persist
(
B
Video
model
,
String
token
);
PersistModel
persist
(
B
File
model
,
String
token
);
/**
/**
* 逻辑删除
* 逻辑删除
...
@@ -47,7 +47,7 @@ public interface BVideoService{
...
@@ -47,7 +47,7 @@ public interface BVideoService{
*/
*/
PersistModel
removeBVideo
(
String
id
,
String
token
);
PersistModel
removeBVideo
(
String
id
,
String
token
);
public
String
uploadVideoToServer
(
List
<
MultipartFile
>
list
,
B
Video
bVideo
,
String
path
,
String
token
);
public
String
uploadVideoToServer
(
List
<
MultipartFile
>
list
,
B
File
bFile
,
String
token
);
public
B
Video
queryFileUrlByChapterId
(
String
chapterId
);
public
B
File
queryFileUrlByChapterId
(
String
chapterId
);
}
}
src/main/java/org/rcisoft/business/b
video/service/impl/BVideo
ServiceImpl.java
→
src/main/java/org/rcisoft/business/b
file/service/impl/BFile
ServiceImpl.java
View file @
4b98f49b
This diff is collapsed.
Click to expand it.
src/main/java/org/rcisoft/business/bsl/service/impl/BSlServiceImpl.java
View file @
4b98f49b
package
org
.
rcisoft
.
business
.
bsl
.
service
.
impl
;
package
org
.
rcisoft
.
business
.
bsl
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.rcisoft.business.bchapter.dao.BChapterRepository
;
import
org.rcisoft.business.bchapter.dao.BChapterRepository
;
import
org.rcisoft.business.bchapter.entity.BChapter
;
import
org.rcisoft.business.bchapter.entity.BChapter
;
...
@@ -135,6 +136,7 @@ public class BSlServiceImpl implements BSlService {
...
@@ -135,6 +136,7 @@ public class BSlServiceImpl implements BSlService {
//添加课程方向信息
//添加课程方向信息
direction
.
setBusinessId
(
IdGen
.
uuid
());
direction
.
setBusinessId
(
IdGen
.
uuid
());
direction
.
setSlId
(
model
.
getBusinessId
());
direction
.
setSlId
(
model
.
getBusinessId
());
direction
.
setDirectionId
(
model
.
getDirectionId
());
bLessonRepository
.
insertLessonDirection
(
direction
);
bLessonRepository
.
insertLessonDirection
(
direction
);
if
(
data
!=
0
&&
result
!=
0
){
if
(
data
!=
0
&&
result
!=
0
){
line
=
data
;
line
=
data
;
...
@@ -151,10 +153,7 @@ public class BSlServiceImpl implements BSlService {
...
@@ -151,10 +153,7 @@ public class BSlServiceImpl implements BSlService {
ArrayList
<
String
>
repeatCode
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
repeatCode
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
lessonCode
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
lessonCode
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
teacherCode
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
teacherCode
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
gitlab
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
termCode
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
termCode
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
classHour
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
credits
=
new
ArrayList
<
String
>();
List
<
BSl
>
repeatSl
=
new
ArrayList
<>();
List
<
BSl
>
repeatSl
=
new
ArrayList
<>();
Map
map
=
new
HashMap
();
Map
map
=
new
HashMap
();
...
@@ -166,7 +165,7 @@ public class BSlServiceImpl implements BSlService {
...
@@ -166,7 +165,7 @@ public class BSlServiceImpl implements BSlService {
}
}
for
(
String
[]
value:
values
){
//将数据封装到entity
for
(
String
[]
value:
values
){
//将数据封装到entity
if
(
value
.
length
>=
4
)
{
if
(
value
.
length
>=
6
)
{
//1. 检查数据正确性
//1. 检查数据正确性
BSl
bSl
=
null
;
BSl
bSl
=
null
;
BSl
b
=
new
BSl
(
value
[
0
]);
BSl
b
=
new
BSl
(
value
[
0
]);
...
@@ -176,7 +175,7 @@ public class BSlServiceImpl implements BSlService {
...
@@ -176,7 +175,7 @@ public class BSlServiceImpl implements BSlService {
bSl1
.
setLessonCode
(
value
[
1
]);
bSl1
.
setLessonCode
(
value
[
1
]);
bSl1
.
setClassHour
(
value
[
4
]);
bSl1
.
setClassHour
(
value
[
4
]);
bSl1
.
setCredits
(
value
[
5
]);
bSl1
.
setCredits
(
value
[
5
]);
if
(
value
[
0
]
==
null
||
value
[
0
].
equals
(
""
)
||
value
[
1
]
==
null
||
value
[
1
].
equals
(
""
))
{
if
(
StringUtils
.
isAnyEmpty
(
value
[
0
]
)
||
value
[
1
]
==
null
||
value
[
1
].
equals
(
""
))
{
continue
;
continue
;
}
}
if
((
bSl
=
bSlRepository
.
selectOne
(
b
))
!=
null
)
{
if
((
bSl
=
bSlRepository
.
selectOne
(
b
))
!=
null
)
{
...
@@ -209,18 +208,6 @@ public class BSlServiceImpl implements BSlService {
...
@@ -209,18 +208,6 @@ public class BSlServiceImpl implements BSlService {
bSl
.
setSlCoverUrl
(
bLessonRepository
.
queryBLessonByCode
(
value
[
1
]).
getDefaultUrl
());
bSl
.
setSlCoverUrl
(
bLessonRepository
.
queryBLessonByCode
(
value
[
1
]).
getDefaultUrl
());
UserUtil
.
setCurrentPersistOperation
(
bSl
);
UserUtil
.
setCurrentPersistOperation
(
bSl
);
//3. 封装git lab
/*User user = userRepository.selectOne(new User(value[2]));
AccountDTO dto = new AccountDTO(user.getGitLabId(),user.getGitLabImpressionToken());
dto.setUsername(user.getGitLabUsername());
if(StringUtils.isEmpty(dto.getId())|| StringUtils.isEmpty(dto.getImpersonationToken())){
gitlab.add(value[2]);
continue;
}
Project project = action.createProject(pName,dto);
bSl.setGitLabProjectId(project.getId());
String pName = global.getGIT_LAB_PROJECT_PREFIX()+value[0];
bSl.setGitLabProjectName(pName);*/
if
(!
bSls
.
contains
(
bSl
))
{
if
(!
bSls
.
contains
(
bSl
))
{
bSls
.
add
(
bSl
);
bSls
.
add
(
bSl
);
}
}
...
@@ -256,18 +243,10 @@ public class BSlServiceImpl implements BSlService {
...
@@ -256,18 +243,10 @@ public class BSlServiceImpl implements BSlService {
if
(
termCode
.
size
()>
0
){
if
(
termCode
.
size
()>
0
){
nullResult
.
append
(
"以下学期编号不存在:"
).
append
(
JSON
.
toJSONString
(
termCode
)).
append
(
"。 "
);
nullResult
.
append
(
"以下学期编号不存在:"
).
append
(
JSON
.
toJSONString
(
termCode
)).
append
(
"。 "
);
}
}
if
(
gitlab
.
size
()>
0
){
nullResult
.
append
(
"以下教师的gitlab账户不存在(请重试新增该教师):"
).
append
(
JSON
.
toJSONString
(
gitlab
));
}
result
+=
nullResult
;
result
+=
nullResult
;
if
(
bSls
.
size
()<
1
){
if
(
bSls
.
size
()<
1
){
throw
new
ServiceException
(
ResultServiceEnums
.
EXCEL_IMPORT_DB_INSERT_ERROR
.
getCode
(),
result
);
throw
new
ServiceException
(
ResultServiceEnums
.
EXCEL_IMPORT_DB_INSERT_ERROR
.
getCode
(),
result
);
}
}
return
new
PersistModel
(
1
,
result
);
return
new
PersistModel
(
1
,
result
);
}
}
...
...
src/main/java/org/rcisoft/business/bvideo/dao/BVideoRepository.java
deleted
100644 → 0
View file @
1836d5d1
package
org
.
rcisoft
.
business
.
bvideo
.
dao
;
import
org.apache.ibatis.annotations.Insert
;
import
org.apache.ibatis.annotations.ResultMap
;
import
org.apache.ibatis.annotations.Select
;
import
org.rcisoft.business.bvideo.entity.BVideo
;
import
org.rcisoft.core.base.BaseMapper
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created with gaowenfneg on 2017-10-9 14:34:56.
*/
@Repository
public
interface
BVideoRepository
extends
BaseMapper
<
BVideo
>
{
/**
* 根据条件查找
* @param param
* @return
*/
@Select
(
"<script>select * from b_video</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BVideo
>
queryBVideos
(
Map
<
String
,
Object
>
param
);
@Insert
(
"<script>insert into b_r_chapter_video (video_id,chapter_id,type) values (#{businessId},#{chapterId},#{type})</script>"
)
int
insertChapterVideo
(
BVideo
model
);
@Select
(
"<script>SELECT\n"
+
"\tbv.* from b_video bv\n"
+
"\tLEFT JOIN b_r_chapter_video bcv on bcv.video_id = bv.business_id\n"
+
"\twhere bcv.chapter_id = #{0} "
+
"and bcv.type = #{1}</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
BVideo
selectInfoByChapterId
(
String
chapterId
,
String
type
);
@Select
(
"<script>SELECT\n"
+
"\tbv.*\n"
+
"FROM\n"
+
"\tb_video bv\n"
+
"LEFT JOIN b_r_chapter_video brc ON bv.business_id = brc.video_id\n"
+
"WHERE\n"
+
"\tbrc.chapter_id = #{chapterId}\n"
+
"AND brc.type = '1'</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
BVideo
queryFileUrlByChapterId
(
String
chapterId
);
@Select
(
"<script>SELECT\n"
+
"\tbv.*\n"
+
"FROM\n"
+
"\tb_video bv\n"
+
"LEFT JOIN b_r_chapter_video brc ON bv.business_id = brc.video_id\n"
+
"WHERE\n"
+
"\tbrc.chapter_id = #{chapterId}</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
BVideo
queryBVideoByChapterId
(
String
chapterId
);
}
src/main/java/org/rcisoft/common/component/Global.java
View file @
4b98f49b
...
@@ -68,6 +68,14 @@ public class Global {
...
@@ -68,6 +68,14 @@ public class Global {
@Value
(
"${global.path.file_location}"
)
@Value
(
"${global.path.file_location}"
)
private
String
FILE_LOCATION
;
private
String
FILE_LOCATION
;
/*ppt路径*/
@Value
(
"${global.path.ppt_location}"
)
private
String
PPT_LOCATION
;
/*pdf路径*/
@Value
(
"${global.path.pdf_location}"
)
private
String
PDF_LOCATION
;
/*excel模板位置*/
/*excel模板位置*/
@Value
(
"${global.path.excel_template_location}"
)
@Value
(
"${global.path.excel_template_location}"
)
private
String
EXCEL_TEMPLATE_LOCATION
;
private
String
EXCEL_TEMPLATE_LOCATION
;
...
...
src/main/resources/application-dev.yml
View file @
4b98f49b
...
@@ -107,9 +107,11 @@ global:
...
@@ -107,9 +107,11 @@ global:
sl_location
:
sl
sl_location
:
sl
freemarker_location
:
/freemarker
freemarker_location
:
/freemarker
image_location
:
/upload
image_location
:
/upload
video_location
:
/video
video_location
:
video
temp_location
:
/temp
temp_location
:
temp
file_location
:
/file
file_location
:
file
ppt_location
:
ppt
pdf_location
:
pdf
excel_template_location
:
excel-template/
excel_template_location
:
excel-template/
cource_logo_location
:
/course/logo
cource_logo_location
:
/course/logo
images_location
:
/images
images_location
:
/images
...
...
src/main/resources/mapper/business/b
video/mapper/BVideo
Mapper.xml
→
src/main/resources/mapper/business/b
file/mapper/BFile
Mapper.xml
View file @
4b98f49b
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"org.rcisoft.business.b
video.dao.BVideo
Repository"
>
<mapper
namespace=
"org.rcisoft.business.b
file.dao.BFile
Repository"
>
<resultMap
id=
"BaseResultMap"
type=
"org.rcisoft.business.b
video.entity.BVideo
"
>
<resultMap
id=
"BaseResultMap"
type=
"org.rcisoft.business.b
file.entity.BFile
"
>
<id
column=
"business_id"
jdbcType=
"VARCHAR"
property=
"businessId"
/>
<id
column=
"business_id"
jdbcType=
"VARCHAR"
property=
"businessId"
/>
<result
column=
"del_flag"
jdbcType=
"VARCHAR"
property=
"delFlag"
/>
<result
column=
"del_flag"
jdbcType=
"VARCHAR"
property=
"delFlag"
/>
<result
column=
"flag"
jdbcType=
"VARCHAR"
property=
"flag"
/>
<result
column=
"flag"
jdbcType=
"VARCHAR"
property=
"flag"
/>
...
@@ -16,5 +16,8 @@
...
@@ -16,5 +16,8 @@
<result
column=
"ppt_url"
jdbcType=
"VARCHAR"
property=
"pptUrl"
/>
<result
column=
"ppt_url"
jdbcType=
"VARCHAR"
property=
"pptUrl"
/>
<result
column=
"pdf_url"
jdbcType=
"VARCHAR"
property=
"pdfUrl"
/>
<result
column=
"pdf_url"
jdbcType=
"VARCHAR"
property=
"pdfUrl"
/>
<result
column=
"type"
jdbcType=
"VARCHAR"
property=
"type"
/>
<result
column=
"type"
jdbcType=
"VARCHAR"
property=
"type"
/>
<result
column=
"chapter_id"
jdbcType=
"VARCHAR"
property=
"chapterId"
/>
<result
column=
"sl_id"
jdbcType=
"VARCHAR"
property=
"slId"
/>
<result
column=
"lesson_id"
jdbcType=
"VARCHAR"
property=
"lessonId"
/>
</resultMap>
</resultMap>
</mapper>
</mapper>
\ No newline at end of file
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