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
9ed57d92
Commit
9ed57d92
authored
Jul 08, 2020
by
luzhuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 资源共享开关 时间限制1分钟
parent
3bd5914f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
14 deletions
+27
-14
BChapterRepository.java
...org/rcisoft/business/bchapter/dao/BChapterRepository.java
+1
-1
BMessageController.java
...soft/business/bmessage/controller/BMessageController.java
+3
-3
BMessageServiceImpl.java
...t/business/bmessage/service/impl/BMessageServiceImpl.java
+23
-10
No files found.
src/main/java/org/rcisoft/business/bchapter/dao/BChapterRepository.java
View file @
9ed57d92
...
@@ -504,7 +504,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
...
@@ -504,7 +504,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
* 根据课程id 查询 bPChapters
* 根据课程id 查询 bPChapters
*
*
*/
*/
@Select
(
"select * from b_
p_
chapter where 1=1 "
@Select
(
"select * from b_chapter where 1=1 "
+
" and del_flag != 1 and flag = 1 "
+
" and del_flag != 1 and flag = 1 "
+
" and lesson_id = #{lessonId}"
+
" and lesson_id = #{lessonId}"
// + " and corp_id = #{corpId}"
// + " and corp_id = #{corpId}"
...
...
src/main/java/org/rcisoft/business/bmessage/controller/BMessageController.java
View file @
9ed57d92
...
@@ -60,7 +60,7 @@ public class BMessageController extends PaginationController<BMessage> {
...
@@ -60,7 +60,7 @@ public class BMessageController extends PaginationController<BMessage> {
}
}
@ApiOperation
(
value
=
"修改"
,
notes
=
"修改"
)
@ApiOperation
(
value
=
"修改"
,
notes
=
"修改"
)
@ApiImplicitParam
s
({
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
false
,
dataType
=
"varchar"
)}
)
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
false
,
dataType
=
"varchar"
)
@PostMapping
(
"/update"
)
@PostMapping
(
"/update"
)
public
Result
update
(
CurUser
curUser
,
@Valid
BMessage
bMessage
,
BindingResult
bindingResult
)
{
public
Result
update
(
CurUser
curUser
,
@Valid
BMessage
bMessage
,
BindingResult
bindingResult
)
{
PersistModel
data
=
bMessageServiceImpl
.
merge
(
curUser
,
bMessage
);
PersistModel
data
=
bMessageServiceImpl
.
merge
(
curUser
,
bMessage
);
...
@@ -71,14 +71,14 @@ public class BMessageController extends PaginationController<BMessage> {
...
@@ -71,14 +71,14 @@ public class BMessageController extends PaginationController<BMessage> {
}
}
@ApiOperation
(
value
=
"修改共享 "
,
notes
=
"修改"
)
@ApiOperation
(
value
=
"修改共享 "
,
notes
=
"修改"
)
@ApiImplicitParam
s
({
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
false
,
dataType
=
"varchar"
)}
)
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
false
,
dataType
=
"varchar"
)
@PostMapping
(
"/updateSycn"
)
@PostMapping
(
"/updateSycn"
)
public
Result
updateSycn
(
CurUser
curUser
,
@Valid
BMessage
bMessage
,
BindingResult
bindingResult
)
{
public
Result
updateSycn
(
CurUser
curUser
,
@Valid
BMessage
bMessage
,
BindingResult
bindingResult
)
{
PersistModel
data
=
bMessageServiceImpl
.
updateSycn
(
curUser
,
bMessage
);
PersistModel
data
=
bMessageServiceImpl
.
updateSycn
(
curUser
,
bMessage
);
return
Result
.
builder
(
data
,
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
bMessage
);
"1"
.
equals
(
bMessage
.
getTimeValue
())?
"打开共享"
:
"关闭共享"
);
}
}
...
...
src/main/java/org/rcisoft/business/bmessage/service/impl/BMessageServiceImpl.java
View file @
9ed57d92
package
org
.
rcisoft
.
business
.
bmessage
.
service
.
impl
;
package
org
.
rcisoft
.
business
.
bmessage
.
service
.
impl
;
import
cn.hutool.core.date.DateUtil
;
import
org.rcisoft.business.bchapter.dao.BChapterRepository
;
import
org.rcisoft.business.bchapter.dao.BChapterRepository
;
import
org.rcisoft.business.bchapter.dao.BPChapterRepository
;
import
org.rcisoft.business.bchapter.dao.BPChapterRepository
;
import
org.rcisoft.business.bchapter.entity.BChapter
;
import
org.rcisoft.business.bchapter.entity.BChapter
;
...
@@ -13,6 +14,7 @@ import org.rcisoft.business.blesson.enums.ReleaseStateEnum;
...
@@ -13,6 +14,7 @@ import org.rcisoft.business.blesson.enums.ReleaseStateEnum;
import
org.rcisoft.business.blessonlog.dao.BLessonLogRepository
;
import
org.rcisoft.business.blessonlog.dao.BLessonLogRepository
;
import
org.rcisoft.business.blessonlog.entity.BLessonLog
;
import
org.rcisoft.business.blessonlog.entity.BLessonLog
;
import
org.rcisoft.core.constant.DelStatus
;
import
org.rcisoft.core.constant.DelStatus
;
import
org.rcisoft.core.exception.ServiceException
;
import
org.rcisoft.core.util.UserUtil
;
import
org.rcisoft.core.util.UserUtil
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.core.model.PersistModel
;
...
@@ -30,6 +32,7 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -30,6 +32,7 @@ import org.springframework.transaction.annotation.Transactional;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.List
;
import
java.util.List
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -108,9 +111,17 @@ public class BMessageServiceImpl implements BMessageService {
...
@@ -108,9 +111,17 @@ public class BMessageServiceImpl implements BMessageService {
* @param bMessage
* @param bMessage
* @return
* @return
*/
*/
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
//
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
@Override
public
PersistModel
updateSycn
(
CurUser
curUser
,
BMessage
bMessage
){
public
PersistModel
updateSycn
(
CurUser
curUser
,
BMessage
bMessage
){
//先查询 原数据
BMessage
oldBMessage
=
bMessageRepository
.
selectByPrimaryKey
(
bMessage
.
getBusinessId
());
Calendar
calendar
=
DateUtil
.
calendar
(
oldBMessage
.
getUpdateDate
());
//获取上次操作时间
calendar
.
add
(
Calendar
.
MINUTE
,
1
);
//将此文件和当前时间对比
Calendar
now
=
Calendar
.
getInstance
();
//获取当前时间
Long
sec
=
(
now
.
getTimeInMillis
()
-
calendar
.
getTimeInMillis
())/
1000
;
if
(
sec
<=
0L
)
throw
new
ServiceException
(
165
,
"请"
+
Math
.
abs
(
sec
)+
"秒后再次操作!"
);
//保存课程日志
//保存课程日志
sendLog
(
curUser
,
bMessage
);
sendLog
(
curUser
,
bMessage
);
//开启共享时同步课程
//开启共享时同步课程
...
@@ -153,16 +164,17 @@ public class BMessageServiceImpl implements BMessageService {
...
@@ -153,16 +164,17 @@ public class BMessageServiceImpl implements BMessageService {
* @param curUser
* @param curUser
* @param bMessage
* @param bMessage
*/
*/
public
void
sendLog
(
CurUser
curUser
,
BMessage
bMessage
){
public
int
sendLog
(
CurUser
curUser
,
BMessage
bMessage
){
//查询当前企业所有已发布已关闭和删除(曾经是已关闭和已发布)的课程
//查询当前企业所有已发布已关闭和删除(曾经是已关闭和已发布)的课程
List
<
BLesson
>
lessons
=
bLessonRepository
.
getLessons
(
curUser
.
getCorpId
());
List
<
BLesson
>
lessons
=
bLessonRepository
.
getLessons
(
curUser
.
getCorpId
());
List
<
BLessonLog
>
list
=
new
ArrayList
<>();
List
<
BLessonLog
>
list
=
new
ArrayList
<>();
//将操作日志添加到每一个课程
//将操作日志添加到每一个课程
for
(
BLesson
lesson
:
lessons
){
for
(
BLesson
lesson
:
lessons
){
BLessonLog
log
=
BLessonLog
.
generate
(
"1"
.
equals
(
bMessage
.
getTimeValue
())?
"开启
共享"
:
"关闭
共享"
,
lesson
.
getBusinessId
());
BLessonLog
log
=
BLessonLog
.
generate
(
"1"
.
equals
(
bMessage
.
getTimeValue
())?
"开启
资源共享"
:
"关闭资源
共享"
,
lesson
.
getBusinessId
());
list
.
add
(
log
);
list
.
add
(
log
);
}
}
bLessonLogRepository
.
insertList
(
list
);
int
line
=
bLessonLogRepository
.
insertList
(
list
);
return
line
;
}
}
/**
/**
...
@@ -187,14 +199,15 @@ public class BMessageServiceImpl implements BMessageService {
...
@@ -187,14 +199,15 @@ public class BMessageServiceImpl implements BMessageService {
chapters
.
addAll
(
chapterList
);
chapters
.
addAll
(
chapterList
);
files
.
addAll
(
fileList
);
files
.
addAll
(
fileList
);
});
});
int
line
=
0
;
//step3 将数据插入 缓存课程、章节、课件 表中(全删全加)
//step3 将数据插入 缓存课程、章节、课件 表中(全删全加)
bpLessonRepository
.
deleteList
(
lessons
);
line
=
bpLessonRepository
.
deleteList
(
lessons
);
bpChapterRepository
.
deleteList
(
chapters
);
line
=
bpChapterRepository
.
deleteList
(
chapters
);
bpFileRepository
.
deleteList
(
files
);
line
=
bpFileRepository
.
deleteList
(
files
);
bpLessonRepository
.
insertList
(
lessons
);
line
=
bpLessonRepository
.
insertList
(
lessons
);
bpChapterRepository
.
insertList
(
chapters
);
line
=
bpChapterRepository
.
insertList
(
chapters
);
bpFileRepository
.
insertList
(
files
);
line
=
bpFileRepository
.
insertList
(
files
);
}
}
...
...
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