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
1836d5d1
Commit
1836d5d1
authored
Dec 29, 2017
by
YangZhaoJun1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2.0.1完善接口
parent
290e36ed
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
252 additions
and
21 deletions
+252
-21
BChapterController.java
...soft/business/bchapter/controller/BChapterController.java
+26
-2
BChapterRepository.java
...org/rcisoft/business/bchapter/dao/BChapterRepository.java
+33
-4
BChapter.java
...n/java/org/rcisoft/business/bchapter/entity/BChapter.java
+4
-0
BChapterService.java
...rg/rcisoft/business/bchapter/service/BChapterService.java
+4
-0
BChapterServiceImpl.java
...t/business/bchapter/service/impl/BChapterServiceImpl.java
+137
-4
BSlRepository.java
...main/java/org/rcisoft/business/bsl/dao/BSlRepository.java
+4
-4
BVideoRepository.java
...ava/org/rcisoft/business/bvideo/dao/BVideoRepository.java
+11
-0
BVideo.java
src/main/java/org/rcisoft/business/bvideo/entity/BVideo.java
+7
-0
Global.java
src/main/java/org/rcisoft/common/component/Global.java
+12
-0
ExcelUtil.java
src/main/java/org/rcisoft/core/util/ExcelUtil.java
+5
-5
application-dev.yml
src/main/resources/application-dev.yml
+5
-2
BChapterMapper.xml
...ources/mapper/business/bchapter/mapper/BChapterMapper.xml
+1
-0
BVideoMapper.xml
.../resources/mapper/business/bvideo/mapper/BVideoMapper.xml
+3
-0
No files found.
src/main/java/org/rcisoft/business/bchapter/controller/BChapterController.java
View file @
1836d5d1
...
@@ -159,8 +159,6 @@ public class BChapterController extends PaginationController<BChapter> {
...
@@ -159,8 +159,6 @@ public class BChapterController extends PaginationController<BChapter> {
@ApiImplicitParam
(
name
=
"lessonId"
,
value
=
"课程ID(课程ID和开课ID只能存在一个)"
,
required
=
false
,
dataType
=
"varchar"
)})
@ApiImplicitParam
(
name
=
"lessonId"
,
value
=
"课程ID(课程ID和开课ID只能存在一个)"
,
required
=
false
,
dataType
=
"varchar"
)})
@GetMapping
(
value
=
"/queryBChaptersWithoutAuth"
)
@GetMapping
(
value
=
"/queryBChaptersWithoutAuth"
)
public
Result
queryBChapters
(
BChapter
param
)
{
public
Result
queryBChapters
(
BChapter
param
)
{
if
(
StringUtils
.
isEmpty
(
param
.
getSlId
()))
throw
new
ServiceException
(
ResultServiceEnums
.
PARAMER_ERROR
);
Map
<
String
,
Object
>
map
=
new
HashedMap
();
Map
<
String
,
Object
>
map
=
new
HashedMap
();
String
userId
=
UserUtil
.
getUserInfoProp
(
getToken
(),
UserUtil
.
USER_ID
);
String
userId
=
UserUtil
.
getUserInfoProp
(
getToken
(),
UserUtil
.
USER_ID
);
List
<
SysRole
>
role
=
sysRoleRepository
.
queryCodeByBusinessId
(
userId
);
List
<
SysRole
>
role
=
sysRoleRepository
.
queryCodeByBusinessId
(
userId
);
...
@@ -435,4 +433,30 @@ public class BChapterController extends PaginationController<BChapter> {
...
@@ -435,4 +433,30 @@ public class BChapterController extends PaginationController<BChapter> {
MessageConstant
.
MESSAGE_ALERT_ERROR
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
slId
);
slId
);
}
}
@ApiOperation
(
value
=
"章节向上调顺序"
,
notes
=
"章节向上调顺序"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
true
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"pid"
,
value
=
"父节点ID"
,
required
=
true
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"sort"
,
value
=
"当前顺序"
,
required
=
true
,
dataType
=
"Integer"
)})
@PostMapping
(
value
=
"/updateTopChapter"
)
public
Result
updateTopChapter
(
BChapter
bChapter
){
int
data
=
bChapterService
.
updateTopChapter
(
bChapter
);
return
Result
.
builder
(
new
PersistModel
(
data
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
bChapter
);
}
@ApiOperation
(
value
=
"章节向下调顺序"
,
notes
=
"章节向下调顺序"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
true
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"pid"
,
value
=
"父节点ID"
,
required
=
true
,
dataType
=
"varchar"
),
@ApiImplicitParam
(
name
=
"sort"
,
value
=
"当前顺序"
,
required
=
true
,
dataType
=
"Integer"
)})
@PostMapping
(
value
=
"/updateDownChapter"
)
public
Result
updateDownChapter
(
BChapter
bChapter
){
int
data
=
bChapterService
.
updateDownChapter
(
bChapter
);
return
Result
.
builder
(
new
PersistModel
(
data
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
bChapter
);
}
}
}
src/main/java/org/rcisoft/business/bchapter/dao/BChapterRepository.java
View file @
1836d5d1
...
@@ -8,6 +8,7 @@ import org.rcisoft.business.bchapter.entity.BChapter;
...
@@ -8,6 +8,7 @@ import org.rcisoft.business.bchapter.entity.BChapter;
import
org.rcisoft.business.bchapter.vo.StudentChapterScoreVO
;
import
org.rcisoft.business.bchapter.vo.StudentChapterScoreVO
;
import
org.rcisoft.business.blesson.entity.BLesson
;
import
org.rcisoft.business.blesson.entity.BLesson
;
import
org.rcisoft.core.base.BaseMapper
;
import
org.rcisoft.core.base.BaseMapper
;
import
org.springframework.security.access.method.P
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
tk.mybatis.mapper.common.Mapper
;
import
tk.mybatis.mapper.common.Mapper
;
...
@@ -34,7 +35,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
...
@@ -34,7 +35,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
" and lesson_id = #{lessonId}\n"
+
" and lesson_id = #{lessonId}\n"
+
"</if>"
+
"</if>"
+
"and lesson_or_sl = #{lessonOrSl} "
+
"and lesson_or_sl = #{lessonOrSl} "
+
"order by
create_date
</script>"
)
"order by
sort asc
</script>"
)
@ResultMap
(
value
=
"SupperChildListResultMap"
)
@ResultMap
(
value
=
"SupperChildListResultMap"
)
List
<
BChapter
>
queryBChapters
(
Map
<
String
,
Object
>
param
);
List
<
BChapter
>
queryBChapters
(
Map
<
String
,
Object
>
param
);
...
@@ -57,7 +58,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
...
@@ -57,7 +58,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
" bc.del_flag = 0\n"
+
" bc.del_flag = 0\n"
+
" AND bc.pid = #{pid}\n"
+
" AND bc.pid = #{pid}\n"
+
" ORDER BY\n"
+
" ORDER BY\n"
+
" bc.
create_date
</script>"
)
" bc.
sort asc
</script>"
)
@ResultMap
(
value
=
"SupperChildListResultMap"
)
@ResultMap
(
value
=
"SupperChildListResultMap"
)
List
<
BChapter
>
queryBChaptersByPid
(
String
pid
);
List
<
BChapter
>
queryBChaptersByPid
(
String
pid
);
...
@@ -160,12 +161,12 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
...
@@ -160,12 +161,12 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
"(create_date,create_by,update_date,update_by,"
+
"(create_date,create_by,update_date,update_by,"
+
"del_flag,flag,business_id,"
+
"del_flag,flag,business_id,"
+
"sl_id,chapter_name,chapter_level,pid,"
+
"sl_id,chapter_name,chapter_level,pid,"
+
"chapter_url,md_file,is_test,lesson_or_sl)VALUES"
+
"chapter_url,md_file,is_test,lesson_or_sl
,class_hour,sort
)VALUES"
+
"<foreach collection=\"list\" item=\"item\" separator=\",\">"
+
"<foreach collection=\"list\" item=\"item\" separator=\",\">"
+
"(#{item.createDate},#{item.createBy},#{item.updateDate},#{item.updateBy},"
+
"(#{item.createDate},#{item.createBy},#{item.updateDate},#{item.updateBy},"
+
"#{item.delFlag},#{item.flag},#{item.businessId},"
+
"#{item.delFlag},#{item.flag},#{item.businessId},"
+
"#{item.slId},#{item.chapterName},#{item.chapterLevel},#{item.pid},"
+
"#{item.slId},#{item.chapterName},#{item.chapterLevel},#{item.pid},"
+
"#{item.chapterUrl},#{item.mdFile},#{item.isTest},#{item.lessonOrSl})"
+
"#{item.chapterUrl},#{item.mdFile},#{item.isTest},#{item.lessonOrSl}
,#{item.classHour},#{item.sort}
)"
+
"</foreach></script>"
)
"</foreach></script>"
)
int
insertChapterList
(
List
<
BChapter
>
slList
);
int
insertChapterList
(
List
<
BChapter
>
slList
);
...
@@ -193,5 +194,33 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
...
@@ -193,5 +194,33 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
@Update
(
"<script>update b_chapter set state = #{state} where sl_id = #{slId}</script>"
)
@Update
(
"<script>update b_chapter set state = #{state} where sl_id = #{slId}</script>"
)
int
updateAllStateBySlId
(
@Param
(
"slId"
)
String
slId
,
@Param
(
"state"
)
String
state
);
int
updateAllStateBySlId
(
@Param
(
"slId"
)
String
slId
,
@Param
(
"state"
)
String
state
);
@Select
(
"<script>select DISTINCT IFNULL((select max(sort) from b_chapter where pid = #{pid} "
+
"<if test=\"SlId !=null and SlId !=''\">AND sl_id = #{SlId} </if>"
+
"<if test=\"lessonId !=null and lessonId !=''\">AND lesson_id = #{lessonId} </if>),0)+1 as sort</script>"
)
int
selectMaxSort
(
@Param
(
"pid"
)
String
pid
,
@Param
(
"SlId"
)
String
SlId
,
@Param
(
"lessonId"
)
String
lessonId
);
@Select
(
"<script>select * from b_chapter where sort < #{sort} "
+
"AND pid = #{pid} AND sl_id = #{slId} "
+
"ORDER BY sort desc LIMIT 1</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
BChapter
getlessChapter
(
BChapter
bChapter
);
@Update
(
"<script>update b_chapter set sort = #{sort} where business_id = #{businessId}</script>"
)
int
updateSortById
(
@Param
(
"businessId"
)
String
businessId
,
@Param
(
"sort"
)
int
sort
);
@Select
(
"<script>select * from b_chapter where sort > #{sort} "
+
"AND pid = #{pid} AND sl_id = #{slId} "
+
"ORDER BY sort asc LIMIT 1</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
BChapter
getBigChapter
(
BChapter
bChapter
);
@Select
(
"<script>select * from b_chapter "
+
"where del_flag = 0 and flag = 1 "
+
"and sl_id = #{slId}</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BChapter
>
queryChapterBySlId
(
String
slId
);
}
}
src/main/java/org/rcisoft/business/bchapter/entity/BChapter.java
View file @
1836d5d1
...
@@ -57,7 +57,11 @@ public class BChapter extends IdEntity<BChapter> {
...
@@ -57,7 +57,11 @@ public class BChapter extends IdEntity<BChapter> {
/*课程ID*/
/*课程ID*/
private
String
lessonId
;
private
String
lessonId
;
/*课时*/
private
String
classHour
;
private
String
classHour
;
/*章节排序*/
private
Integer
sort
;
@Transient
@Transient
private
List
<
BChapterRepository
>
childList
;
private
List
<
BChapterRepository
>
childList
;
...
...
src/main/java/org/rcisoft/business/bchapter/service/BChapterService.java
View file @
1836d5d1
...
@@ -97,4 +97,8 @@ public interface BChapterService{
...
@@ -97,4 +97,8 @@ public interface BChapterService{
int
updateChapterState
(
BChapter
bChapter
);
int
updateChapterState
(
BChapter
bChapter
);
int
updateAllChapterState
(
String
slId
);
int
updateAllChapterState
(
String
slId
);
int
updateTopChapter
(
BChapter
bChapter
);
int
updateDownChapter
(
BChapter
bChapter
);
}
}
src/main/java/org/rcisoft/business/bchapter/service/impl/BChapterServiceImpl.java
View file @
1836d5d1
...
@@ -17,6 +17,10 @@ import org.rcisoft.business.brslstudent.dao.BRSlStudentRepository;
...
@@ -17,6 +17,10 @@ import org.rcisoft.business.brslstudent.dao.BRSlStudentRepository;
import
org.rcisoft.business.bsl.dao.BSlRepository
;
import
org.rcisoft.business.bsl.dao.BSlRepository
;
import
org.rcisoft.business.bsl.enums.AuditStatusEnum
;
import
org.rcisoft.business.bsl.enums.AuditStatusEnum
;
import
org.rcisoft.business.bstudent.dao.BStudentRepository
;
import
org.rcisoft.business.bstudent.dao.BStudentRepository
;
import
org.rcisoft.business.bvideo.dao.BVideoRepository
;
import
org.rcisoft.business.bvideo.entity.BVideo
;
import
org.rcisoft.business.bvideo.entity.UrlDto
;
import
org.rcisoft.common.component.Global
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.exception.ServiceException
;
import
org.rcisoft.core.exception.ServiceException
;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.core.model.PersistModel
;
...
@@ -27,6 +31,7 @@ import org.springframework.stereotype.Service;
...
@@ -27,6 +31,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.io.*
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -49,6 +54,10 @@ public class BChapterServiceImpl implements BChapterService {
...
@@ -49,6 +54,10 @@ public class BChapterServiceImpl implements BChapterService {
private
BRSlStudentRepository
brSlStudentRepository
;
private
BRSlStudentRepository
brSlStudentRepository
;
@Autowired
@Autowired
private
BLessonRepository
bLessonRepository
;
private
BLessonRepository
bLessonRepository
;
@Autowired
private
BVideoRepository
bVideoRepository
;
@Autowired
private
Global
global
;
@Override
@Override
public
BChapter
selectOne
(
String
businessId
){
public
BChapter
selectOne
(
String
businessId
){
...
@@ -98,6 +107,8 @@ public class BChapterServiceImpl implements BChapterService {
...
@@ -98,6 +107,8 @@ public class BChapterServiceImpl implements BChapterService {
if
(
model
.
getIsTest
()==
null
||
model
.
getIsTest
().
equals
(
""
)){
if
(
model
.
getIsTest
()==
null
||
model
.
getIsTest
().
equals
(
""
)){
model
.
setIsTest
(
""
);
model
.
setIsTest
(
""
);
}
}
int
sort
=
bChapterRepository
.
selectMaxSort
(
model
.
getPid
(),
model
.
getSlId
(),
model
.
getLessonId
());
model
.
setSort
(
sort
);
line
=
bChapterRepository
.
insertSelective
(
model
);
line
=
bChapterRepository
.
insertSelective
(
model
);
}
else
{
}
else
{
String
state
=
bSlRepository
.
queryStateById
(
model
.
getSlId
());
String
state
=
bSlRepository
.
queryStateById
(
model
.
getSlId
());
...
@@ -184,14 +195,14 @@ public class BChapterServiceImpl implements BChapterService {
...
@@ -184,14 +195,14 @@ public class BChapterServiceImpl implements BChapterService {
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
@Override
@Override
public
int
addBslFormLesson
(
String
bL
see
onId
,
String
lessonCode
,
String
slId
)
{
public
int
addBslFormLesson
(
String
bL
ess
onId
,
String
lessonCode
,
String
slId
)
{
int
result
=
0
;
int
result
=
0
;
if
(
bL
see
onId
==
null
){
if
(
bL
ess
onId
==
null
){
BLesson
bLseeon
=
bLessonRepository
.
queryBLessonByCode
(
lessonCode
);
BLesson
bLseeon
=
bLessonRepository
.
queryBLessonByCode
(
lessonCode
);
bL
see
onId
=
bLseeon
.
getBusinessId
();
bL
ess
onId
=
bLseeon
.
getBusinessId
();
}
}
//获取课程的章节列表
//获取课程的章节列表
List
<
BChapter
>
lessonList
=
bChapterRepository
.
queryChapterByLessonId
(
bL
see
onId
);
List
<
BChapter
>
lessonList
=
bChapterRepository
.
queryChapterByLessonId
(
bL
ess
onId
);
List
<
BChapter
>
chapterList
=
new
ArrayList
<>();
List
<
BChapter
>
chapterList
=
new
ArrayList
<>();
//map存放章的ID(key:章名称 value:新的章ID)
//map存放章的ID(key:章名称 value:新的章ID)
Map
map
=
new
HashMap
();
Map
map
=
new
HashMap
();
...
@@ -205,6 +216,7 @@ public class BChapterServiceImpl implements BChapterService {
...
@@ -205,6 +216,7 @@ public class BChapterServiceImpl implements BChapterService {
sl_chapter
.
setIsTest
(
lessonList
.
get
(
i
).
getIsTest
());
sl_chapter
.
setIsTest
(
lessonList
.
get
(
i
).
getIsTest
());
sl_chapter
.
setClassHour
(
lessonList
.
get
(
i
).
getClassHour
());
sl_chapter
.
setClassHour
(
lessonList
.
get
(
i
).
getClassHour
());
sl_chapter
.
setState
(
StateEnum
.
CLOSE
.
getCode
());
sl_chapter
.
setState
(
StateEnum
.
CLOSE
.
getCode
());
sl_chapter
.
setSort
(
lessonList
.
get
(
i
).
getSort
());
sl_chapter
.
setLessonOrSl
(
"0"
);
sl_chapter
.
setLessonOrSl
(
"0"
);
UserUtil
.
setCurrentPersistOperation
(
sl_chapter
);
UserUtil
.
setCurrentPersistOperation
(
sl_chapter
);
if
(
lessonList
.
get
(
i
).
getPid
().
equals
(
"-1"
)){
if
(
lessonList
.
get
(
i
).
getPid
().
equals
(
"-1"
)){
...
@@ -223,12 +235,103 @@ public class BChapterServiceImpl implements BChapterService {
...
@@ -223,12 +235,103 @@ public class BChapterServiceImpl implements BChapterService {
chapterList
.
get
(
i
).
setPid
(
String
.
valueOf
(
map
.
get
(
chapterName
)));
chapterList
.
get
(
i
).
setPid
(
String
.
valueOf
(
map
.
get
(
chapterName
)));
}
}
}
}
String
oldPath
=
global
.
getBASE_UPLOAD_SERVER_LOCATION
()+
File
.
separator
+
global
.
getCOURSE_LOCATION
()+
File
.
separator
+
global
.
getLESSON_LOCATION
()+
File
.
separator
+
bLessonId
;
String
newPath
=
global
.
getBASE_UPLOAD_SERVER_LOCATION
()+
File
.
separator
+
global
.
getCOURSE_LOCATION
()+
File
.
separator
+
global
.
getSL_LOCATION
()+
File
.
separator
+
slId
;
//copyFileToSl(oldPath,newPath,bLessonId,slId);
if
(
chapterList
.
size
()>
0
){
if
(
chapterList
.
size
()>
0
){
result
=
bChapterRepository
.
insertChapterList
(
chapterList
);
result
=
bChapterRepository
.
insertChapterList
(
chapterList
);
}
}
return
result
;
return
result
;
}
}
/**
* 递归方法复制文件夹及子目录
* @param oldPath
* @param newPath
*/
private
void
copyFileToSl
(
String
oldPath
,
String
newPath
,
String
bLessonId
,
String
slId
)
{
UrlDto
urlDto
=
new
UrlDto
();
File
oldFile
=
new
File
(
oldPath
);
File
[]
fs
=
oldFile
.
listFiles
();
File
newFile
=
new
File
(
newPath
);
if
(!
newFile
.
exists
()){
newFile
.
mkdirs
();
}
for
(
File
f
:
fs
)
{
if
(
f
.
isFile
()){
fileCopy
(
f
.
getPath
(),
newPath
+
File
.
separator
+
f
.
getName
());
//调用文件拷贝的方法
}
else
if
(
f
.
isDirectory
()){
copyFileToSl
(
f
.
getPath
(),
newPath
+
File
.
separator
+
f
.
getName
(),
bLessonId
,
slId
);
}
}
List
<
BChapter
>
leChapters
=
bChapterRepository
.
queryChapterByLessonId
(
bLessonId
);
List
<
BChapter
>
slChapters
=
bChapterRepository
.
queryChapterBySlId
(
slId
);
for
(
BChapter
leBChapter
:
leChapters
){
for
(
BChapter
slChapter
:
slChapters
){
if
(
leBChapter
.
getChapterName
().
equals
(
slChapter
.
getChapterName
())){
BVideo
bVideo
=
bVideoRepository
.
queryBVideoByChapterId
(
leBChapter
.
getBusinessId
());
BVideo
newVideo
=
new
BVideo
();
newVideo
.
setBusinessId
(
bVideo
.
getBusinessId
());
if
(
bVideo
!=
null
){
if
(
bVideo
.
getVideoUrl
()!=
null
&&!
bVideo
.
getVideoUrl
().
equals
(
""
)){
String
newUrl
=
bVideo
.
getVideoUrl
().
replace
(
bLessonId
,
slId
);
String
path
=
newUrl
.
replace
(
leBChapter
.
getBusinessId
(),
slChapter
.
getBusinessId
());
newVideo
.
setVideoUrl
(
path
);
}
if
(
bVideo
.
getFileUrl
()!=
null
&&!
bVideo
.
getFileUrl
().
equals
(
""
)){
String
newUrl
=
bVideo
.
getVideoUrl
().
replace
(
bLessonId
,
slId
);
String
path
=
newUrl
.
replace
(
leBChapter
.
getBusinessId
(),
slChapter
.
getBusinessId
());
newVideo
.
setFileUrl
(
path
);
}
if
(
bVideo
.
getPptUrl
()!=
null
&&!
bVideo
.
getPptUrl
().
equals
(
""
)){
String
newUrl
=
bVideo
.
getVideoUrl
().
replace
(
bLessonId
,
slId
);
String
path
=
newUrl
.
replace
(
leBChapter
.
getBusinessId
(),
slChapter
.
getBusinessId
());
newVideo
.
setPptUrl
(
path
);
}
if
(
bVideo
.
getPdfUrl
()!=
null
&&!
bVideo
.
getPdfUrl
().
equals
(
""
)){
String
newUrl
=
bVideo
.
getVideoUrl
().
replace
(
bLessonId
,
slId
);
String
path
=
newUrl
.
replace
(
leBChapter
.
getBusinessId
(),
slChapter
.
getBusinessId
());
newVideo
.
setPdfUrl
(
path
);
}
bVideoRepository
.
updateByPrimaryKeySelective
(
newVideo
);
}
}
}
}
}
private
void
fileCopy
(
String
oldPath
,
String
newPath
)
{
BufferedReader
br
=
null
;
PrintStream
ps
=
null
;
try
{
br
=
new
BufferedReader
(
new
InputStreamReader
(
new
FileInputStream
(
oldPath
)));
ps
=
new
PrintStream
(
new
FileOutputStream
(
newPath
));
String
s
=
null
;
while
((
s
=
br
.
readLine
())!=
null
){
ps
.
println
(
s
);
ps
.
flush
();
}
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
if
(
br
!=
null
)
br
.
close
();
if
(
ps
!=
null
)
ps
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
@Override
@Override
public
int
updateChapterState
(
BChapter
bChapter
)
{
public
int
updateChapterState
(
BChapter
bChapter
)
{
...
@@ -262,4 +365,34 @@ public class BChapterServiceImpl implements BChapterService {
...
@@ -262,4 +365,34 @@ public class BChapterServiceImpl implements BChapterService {
int
result
=
bChapterRepository
.
updateAllStateBySlId
(
slId
,
state
);
int
result
=
bChapterRepository
.
updateAllStateBySlId
(
slId
,
state
);
return
result
;
return
result
;
}
}
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
@Override
public
int
updateTopChapter
(
BChapter
bChapter
)
{
int
result
=
0
;
BChapter
lessChapter
=
bChapterRepository
.
getlessChapter
(
bChapter
);
int
sort
=
bChapter
.
getSort
();
int
lessSort
=
lessChapter
.
getSort
();
int
data
=
bChapterRepository
.
updateSortById
(
bChapter
.
getBusinessId
(),
lessSort
);
int
data2
=
bChapterRepository
.
updateSortById
(
lessChapter
.
getBusinessId
(),
sort
);
if
(
data
==
data2
){
result
=
1
;
}
return
result
;
}
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
@Override
public
int
updateDownChapter
(
BChapter
bChapter
)
{
int
result
=
0
;
BChapter
bigChapter
=
bChapterRepository
.
getBigChapter
(
bChapter
);
int
sort
=
bChapter
.
getSort
();
int
bigSort
=
bigChapter
.
getSort
();
int
data
=
bChapterRepository
.
updateSortById
(
bChapter
.
getBusinessId
(),
bigSort
);
int
data2
=
bChapterRepository
.
updateSortById
(
bigChapter
.
getBusinessId
(),
sort
);
if
(
data
==
data2
){
result
=
1
;
}
return
result
;
}
}
}
src/main/java/org/rcisoft/business/bsl/dao/BSlRepository.java
View file @
1836d5d1
...
@@ -27,7 +27,7 @@ public interface BSlRepository extends BaseMapper<BSl> {
...
@@ -27,7 +27,7 @@ public interface BSlRepository extends BaseMapper<BSl> {
"left join b_lesson_direction bld on bld.sl_id = sl.business_id "
+
"left join b_lesson_direction bld on bld.sl_id = sl.business_id "
+
"left join b_direction bd on bd.business_id = bld.direction_id "
+
"left join b_direction bd on bd.business_id = bld.direction_id "
+
" <where>"
+
" <where>"
+
" sl.del_flag = '0' and sl.flag = '1'"
+
" sl.del_flag = '0' and sl.flag = '1'
"
+
" <if test=\"isOnline !=NULL and isOnline !=''\">AND sl.is_online like CONCAT('%',#{isOnline},'%')</if>"
+
" <if test=\"isOnline !=NULL and isOnline !=''\">AND sl.is_online like CONCAT('%',#{isOnline},'%')</if>"
+
" <if test=\"teacherName !=null and teacherName !=''\">AND u.name like CONCAT('%',#{teacherName},'%')</if>"
+
" <if test=\"teacherName !=null and teacherName !=''\">AND u.name like CONCAT('%',#{teacherName},'%')</if>"
+
" <if test=\"lessonName !=null and lessonName !=''\">AND lesson.lesson_name like CONCAT('%',#{lessonName},'%')</if>"
+
" <if test=\"lessonName !=null and lessonName !=''\">AND lesson.lesson_name like CONCAT('%',#{lessonName},'%')</if>"
+
...
@@ -58,9 +58,9 @@ public interface BSlRepository extends BaseMapper<BSl> {
...
@@ -58,9 +58,9 @@ public interface BSlRepository extends BaseMapper<BSl> {
* @return
* @return
*/
*/
@Insert
(
"<script>INSERT INTO b_sl"
+
@Insert
(
"<script>INSERT INTO b_sl"
+
"(create_date,update_date,del_flag,flag,business_id,code,lesson_code,teacher_code,term_code,sl_cover_url,git_lab_project_id,git_lab_project_name)VALUES"
+
"(create_date,update_date,del_flag,flag,business_id,code,lesson_code,teacher_code,term_code,sl_cover_url,git_lab_project_id,git_lab_project_name
,class_hour,credits
)VALUES"
+
"<foreach collection=\"list\" item=\"item\" separator=\",\">"
+
"<foreach collection=\"list\" item=\"item\" separator=\",\">"
+
"( #{item.createDate},#{item.updateDate},#{item.delFlag},#{item.flag},#{item.businessId},#{item.code},#{item.lessonCode},#{item.teacherCode},#{item.termCode},#{item.slCoverUrl},#{item.gitLabProjectId},#{item.gitLabProjectName})"
+
"( #{item.createDate},#{item.updateDate},#{item.delFlag},#{item.flag},#{item.businessId},#{item.code},#{item.lessonCode},#{item.teacherCode},#{item.termCode},#{item.slCoverUrl},#{item.gitLabProjectId},#{item.gitLabProjectName}
,#{item.classHour},#{item.credits}
)"
+
"</foreach></script>"
)
"</foreach></script>"
)
int
insertList
(
List
<
BSl
>
bSls
);
int
insertList
(
List
<
BSl
>
bSls
);
...
@@ -244,7 +244,7 @@ public interface BSlRepository extends BaseMapper<BSl> {
...
@@ -244,7 +244,7 @@ public interface BSlRepository extends BaseMapper<BSl> {
@Param
(
"studentCode"
)
String
studentCode
,
@Param
(
"studentCode"
)
String
studentCode
,
@Param
(
"teacherCode"
)
String
teacherCode
);
@Param
(
"teacherCode"
)
String
teacherCode
);
@Update
(
"<script>update b_sl set audit_status=#{code} where business_id=#{
code
}</script>"
)
@Update
(
"<script>update b_sl set audit_status=#{code} where business_id=#{
slId
}</script>"
)
int
updateAuditStatus
(
@Param
(
"slId"
)
String
slId
,
@Param
(
"code"
)
String
code
);
int
updateAuditStatus
(
@Param
(
"slId"
)
String
slId
,
@Param
(
"code"
)
String
code
);
@Select
(
"select audit_status from b_sl where business_id = #{slId}"
)
@Select
(
"select audit_status from b_sl where business_id = #{slId}"
)
...
...
src/main/java/org/rcisoft/business/bvideo/dao/BVideoRepository.java
View file @
1836d5d1
...
@@ -46,5 +46,16 @@ public interface BVideoRepository extends BaseMapper<BVideo> {
...
@@ -46,5 +46,16 @@ public interface BVideoRepository extends BaseMapper<BVideo> {
"AND brc.type = '1'</script>"
)
"AND brc.type = '1'</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
@ResultMap
(
value
=
"BaseResultMap"
)
BVideo
queryFileUrlByChapterId
(
String
chapterId
);
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/business/bvideo/entity/BVideo.java
View file @
1836d5d1
...
@@ -19,6 +19,7 @@ import javax.persistence.Transient;
...
@@ -19,6 +19,7 @@ import javax.persistence.Transient;
@AllArgsConstructor
@AllArgsConstructor
public
class
BVideo
extends
IdEntity
<
BVideo
>
{
public
class
BVideo
extends
IdEntity
<
BVideo
>
{
private
static
final
long
serialVersionUID
=
5501554322621964535L
;
/*视频名称*/
/*视频名称*/
private
String
videoName
;
private
String
videoName
;
...
@@ -28,6 +29,12 @@ public class BVideo extends IdEntity<BVideo> {
...
@@ -28,6 +29,12 @@ public class BVideo extends IdEntity<BVideo> {
/*'0'为视频,'1'为附件*/
/*'0'为视频,'1'为附件*/
private
String
type
;
private
String
type
;
private
String
fileUrl
;
private
String
pptUrl
;
private
String
pdfUrl
;
@Transient
@Transient
private
String
lessonId
;
//开课ID
private
String
lessonId
;
//开课ID
...
...
src/main/java/org/rcisoft/common/component/Global.java
View file @
1836d5d1
...
@@ -36,6 +36,18 @@ public class Global {
...
@@ -36,6 +36,18 @@ public class Global {
@Value
(
"${global.path.base_upload_server_location}"
)
@Value
(
"${global.path.base_upload_server_location}"
)
private
String
BASE_UPLOAD_SERVER_LOCATION
;
private
String
BASE_UPLOAD_SERVER_LOCATION
;
/*课程相关文件路径*/
@Value
(
"${global.path.course_location}"
)
private
String
COURSE_LOCATION
;
/*lesson相关文件路径*/
@Value
(
"${global.path.lesson_location}"
)
private
String
LESSON_LOCATION
;
/*sl相关文件路径*/
@Value
(
"${global.path.sl_location}"
)
private
String
SL_LOCATION
;
/*服务器freemarker模板位置*/
/*服务器freemarker模板位置*/
@Value
(
"${global.path.freemarker_location}"
)
@Value
(
"${global.path.freemarker_location}"
)
private
String
FREEMARKER_LOCATION
;
private
String
FREEMARKER_LOCATION
;
...
...
src/main/java/org/rcisoft/core/util/ExcelUtil.java
View file @
1836d5d1
...
@@ -44,7 +44,7 @@ public class ExcelUtil {
...
@@ -44,7 +44,7 @@ public class ExcelUtil {
int
firstcolumnnum
=
hr
.
getFirstCellNum
();
int
firstcolumnnum
=
hr
.
getFirstCellNum
();
int
lastcolumnnum
=
hr
.
getLastCellNum
();
int
lastcolumnnum
=
hr
.
getLastCellNum
();
String
[]
value
=
new
String
[
lastcolumnnum
];
String
[]
value
=
new
String
[
lastcolumnnum
];
//
boolean hasEmpty = false;
boolean
hasEmpty
=
false
;
for
(
int
k
=
firstcolumnnum
;
k
<
lastcolumnnum
;
k
++)
{
for
(
int
k
=
firstcolumnnum
;
k
<
lastcolumnnum
;
k
++)
{
HSSFCell
hc
=
hr
.
getCell
(
k
);
HSSFCell
hc
=
hr
.
getCell
(
k
);
if
(
j
==
firstrownum
+
1
)
{
if
(
j
==
firstrownum
+
1
)
{
...
@@ -55,14 +55,14 @@ public class ExcelUtil {
...
@@ -55,14 +55,14 @@ public class ExcelUtil {
emptyColList
.
add
(
k
);
emptyColList
.
add
(
k
);
}
}
}
}
/*
else {
else
{
if
(
parseDB
(
hc
).
trim
().
equals
(
""
)&&
emptyColList
.
get
(
k
)!=-
1
)
{
if
(
parseDB
(
hc
).
trim
().
equals
(
""
)&&
emptyColList
.
get
(
k
)!=-
1
)
{
//在第j行第k列有空数据,且该列表头不是空的,则舍弃本行数据。
//在第j行第k列有空数据,且该列表头不是空的,则舍弃本行数据。
hasEmpty
=
true
;
hasEmpty
=
true
;
break
;
break
;
}
}
}
*/
}
value
[
k
]
=
parseDB
(
hc
);
value
[
k
]
=
parseDB
(
hc
);
//parseDB(hc.getCellType(), hc);
//parseDB(hc.getCellType(), hc);
...
@@ -73,9 +73,9 @@ public class ExcelUtil {
...
@@ -73,9 +73,9 @@ public class ExcelUtil {
throw
new
ServiceException
(
ResultServiceEnums
.
EXCEL_IMPORT_HEADER_ERROR
);
throw
new
ServiceException
(
ResultServiceEnums
.
EXCEL_IMPORT_HEADER_ERROR
);
}
}
}
else
{
}
else
{
//
if (!hasEmpty) {
if
(!
hasEmpty
)
{
values
.
add
(
value
);
values
.
add
(
value
);
//
}
}
}
}
}
}
}
}
...
...
src/main/resources/application-dev.yml
View file @
1836d5d1
...
@@ -11,9 +11,9 @@ server:
...
@@ -11,9 +11,9 @@ server:
# org.springframework.web: DEBUG
# org.springframework.web: DEBUG
druid
:
druid
:
url
:
jdbc:mysql://127.0.0.1:3306/edu_db
2
?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true
url
:
jdbc:mysql://127.0.0.1:3306/edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true
username
:
root
username
:
root
password
:
123456
password
:
root
initial-size
:
1
initial-size
:
1
min-idle
:
1
min-idle
:
1
max-active
:
20
max-active
:
20
...
@@ -102,6 +102,9 @@ global:
...
@@ -102,6 +102,9 @@ global:
max_password
:
16
max_password
:
16
path
:
path
:
base_upload_server_location
:
E:\\eduFiles
base_upload_server_location
:
E:\\eduFiles
course_location
:
course
lesson_location
:
lesson
sl_location
:
sl
freemarker_location
:
/freemarker
freemarker_location
:
/freemarker
image_location
:
/upload
image_location
:
/upload
video_location
:
/video
video_location
:
/video
...
...
src/main/resources/mapper/business/bchapter/mapper/BChapterMapper.xml
View file @
1836d5d1
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
<result
column=
"lesson_id"
jdbcType=
"VARCHAR"
property=
"lessonId"
/>
<result
column=
"lesson_id"
jdbcType=
"VARCHAR"
property=
"lessonId"
/>
<result
column=
"class_hour"
jdbcType=
"VARCHAR"
property=
"classHour"
/>
<result
column=
"class_hour"
jdbcType=
"VARCHAR"
property=
"classHour"
/>
<result
column=
"state"
jdbcType=
"VARCHAR"
property=
"state"
/>
<result
column=
"state"
jdbcType=
"VARCHAR"
property=
"state"
/>
<result
column=
"sort"
jdbcType=
"INTEGER"
property=
"sort"
/>
</resultMap>
</resultMap>
<resultMap
id=
"SupperChildListResultMap"
type=
"org.rcisoft.business.bchapter.entity.BChapter"
extends=
"BaseResultMap"
>
<resultMap
id=
"SupperChildListResultMap"
type=
"org.rcisoft.business.bchapter.entity.BChapter"
extends=
"BaseResultMap"
>
...
...
src/main/resources/mapper/business/bvideo/mapper/BVideoMapper.xml
View file @
1836d5d1
...
@@ -12,6 +12,9 @@
...
@@ -12,6 +12,9 @@
<result
column=
"create_date"
jdbcType=
"TIMESTAMP"
property=
"createDate"
/>
<result
column=
"create_date"
jdbcType=
"TIMESTAMP"
property=
"createDate"
/>
<result
column=
"video_name"
jdbcType=
"VARCHAR"
property=
"videoName"
/>
<result
column=
"video_name"
jdbcType=
"VARCHAR"
property=
"videoName"
/>
<result
column=
"video_url"
jdbcType=
"VARCHAR"
property=
"videoUrl"
/>
<result
column=
"video_url"
jdbcType=
"VARCHAR"
property=
"videoUrl"
/>
<result
column=
"file_url"
jdbcType=
"VARCHAR"
property=
"fileUrl"
/>
<result
column=
"ppt_url"
jdbcType=
"VARCHAR"
property=
"pptUrl"
/>
<result
column=
"pdf_url"
jdbcType=
"VARCHAR"
property=
"pdfUrl"
/>
<result
column=
"type"
jdbcType=
"VARCHAR"
property=
"type"
/>
<result
column=
"type"
jdbcType=
"VARCHAR"
property=
"type"
/>
</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