Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
涂亚平
/
subsidy
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a28c0dbc
authored
Jun 17, 2022
by
涂亚平
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
交叉时间数据脚本
1 parent
205d0ae8
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
416 additions
and
305 deletions
src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java
src/main/java/com/subsidy/common/interceptor/TimeRequired.java
src/main/java/com/subsidy/controller/AdministerController.java
src/main/java/com/subsidy/controller/CertMemberMappingController.java
src/main/java/com/subsidy/controller/ClassDictController.java
src/main/java/com/subsidy/controller/ClassHourDictController.java
src/main/java/com/subsidy/controller/ExerciseDictController.java
src/main/java/com/subsidy/controller/ExerciseDoneResultController.java
src/main/java/com/subsidy/controller/MemberController.java
src/main/java/com/subsidy/controller/SignInRecordController.java
src/main/java/com/subsidy/controller/SmsVerifyCodeController.java
src/main/java/com/subsidy/controller/VodPlayHistoryController.java
src/main/java/com/subsidy/dto/vod/RemainSecondsDTO.java
src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java
src/main/java/com/subsidy/service/VodPlayHistoryService.java
src/main/java/com/subsidy/service/impl/ExerciseDoneResultServiceImpl.java
src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
src/main/java/com/subsidy/util/BaseModel.java
src/main/java/com/subsidy/util/websocket/ChatEndPoint.java
src/main/java/com/subsidy/vo/vod/VodPlayStateVO.java
src/main/resources/application.properties
src/main/resources/code.properties
src/main/resources/mapper/VodDictMapper.xml
src/main/resources/mapper/VodPlayHistoryMapper.xml
src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java
View file @
a28c0db
...
@@ -26,6 +26,8 @@ import java.io.IOException;
...
@@ -26,6 +26,8 @@ import java.io.IOException;
import
java.io.PrintWriter
;
import
java.io.PrintWriter
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.Map
;
import
java.util.Map
;
/**
/**
...
@@ -99,6 +101,16 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
...
@@ -99,6 +101,16 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
}
}
throw
new
HttpException
(
1010
);
throw
new
HttpException
(
1010
);
}
}
TimeRequired
timeRequired
=
method
.
getAnnotation
(
TimeRequired
.
class
);
if
(
timeRequired
!=
null
){
Calendar
calendar
=
Calendar
.
getInstance
();
int
hour
=
calendar
.
get
(
Calendar
.
HOUR_OF_DAY
);
if
(
hour
<
6
){
throw
new
HttpException
(
17001
);
}
}
return
true
;
return
true
;
}
}
}
}
src/main/java/com/subsidy/common/interceptor/TimeRequired.java
0 → 100644
View file @
a28c0db
package
com
.
subsidy
.
common
.
interceptor
;
import
java.lang.annotation.*
;
@Target
({
ElementType
.
METHOD
})
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
@Inherited
public
@interface
TimeRequired
{
}
src/main/java/com/subsidy/controller/AdministerController.java
View file @
a28c0db
...
@@ -98,7 +98,7 @@ public class AdministerController {
...
@@ -98,7 +98,7 @@ public class AdministerController {
@PostMapping
(
"classDetail"
)
@PostMapping
(
"classDetail"
)
@ApiOperation
(
"班级管理--班级成员 id 班级id userName"
)
@ApiOperation
(
"班级管理--班级成员 id 班级id userName"
)
@LoginRequired
//
@LoginRequired
public
ResponseVO
classDetail
(
@RequestBody
ClassDetailDTO
classDetailDTO
){
public
ResponseVO
classDetail
(
@RequestBody
ClassDetailDTO
classDetailDTO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
administerService
.
classDetail
(
classDetailDTO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
administerService
.
classDetail
(
classDetailDTO
));
}
}
...
...
src/main/java/com/subsidy/controller/CertMemberMappingController.java
View file @
a28c0db
...
@@ -3,6 +3,7 @@ package com.subsidy.controller;
...
@@ -3,6 +3,7 @@ package com.subsidy.controller;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.interceptor.TimeRequired
;
import
com.subsidy.dto.cert.GetListDTO
;
import
com.subsidy.dto.cert.GetListDTO
;
import
com.subsidy.dto.cert.SignManagementDTO
;
import
com.subsidy.dto.cert.SignManagementDTO
;
import
com.subsidy.dto.cert.SignUpDTO
;
import
com.subsidy.dto.cert.SignUpDTO
;
...
@@ -52,6 +53,7 @@ public class CertMemberMappingController {
...
@@ -52,6 +53,7 @@ public class CertMemberMappingController {
@PostMapping
(
"getList"
)
@PostMapping
(
"getList"
)
@ApiOperation
(
"手机端---获取全部订单 memberId status pageSize pageNum"
)
@ApiOperation
(
"手机端---获取全部订单 memberId status pageSize pageNum"
)
@TimeRequired
public
ResponseVO
getList
(
@RequestBody
GetListDTO
getListDTO
){
public
ResponseVO
getList
(
@RequestBody
GetListDTO
getListDTO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
certMemberMappingService
.
getList
(
getListDTO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
certMemberMappingService
.
getList
(
getListDTO
));
}
}
...
...
src/main/java/com/subsidy/controller/ClassDictController.java
View file @
a28c0db
...
@@ -4,6 +4,7 @@ package com.subsidy.controller;
...
@@ -4,6 +4,7 @@ package com.subsidy.controller;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.interceptor.LoginRequired
;
import
com.subsidy.common.interceptor.LoginRequired
;
import
com.subsidy.common.interceptor.TimeRequired
;
import
com.subsidy.dto.classDict.AddClassDTO
;
import
com.subsidy.dto.classDict.AddClassDTO
;
import
com.subsidy.dto.classDict.AddMemberToClassDTO
;
import
com.subsidy.dto.classDict.AddMemberToClassDTO
;
import
com.subsidy.dto.classDict.GetClassBaseInfoDTO
;
import
com.subsidy.dto.classDict.GetClassBaseInfoDTO
;
...
@@ -102,6 +103,7 @@ public class ClassDictController {
...
@@ -102,6 +103,7 @@ public class ClassDictController {
@PostMapping
(
"getClassBaseInfo"
)
@PostMapping
(
"getClassBaseInfo"
)
@ApiOperation
(
"班级详情--获取课程基本信息 id"
)
@ApiOperation
(
"班级详情--获取课程基本信息 id"
)
@LoginRequired
@LoginRequired
@TimeRequired
public
ResponseVO
getClassBaseInfo
(
@RequestBody
GetClassBaseInfoDTO
getClassBaseInfoDTO
){
public
ResponseVO
getClassBaseInfo
(
@RequestBody
GetClassBaseInfoDTO
getClassBaseInfoDTO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
classDictService
.
getClassBaseInfo
(
getClassBaseInfoDTO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
classDictService
.
getClassBaseInfo
(
getClassBaseInfoDTO
));
}
}
...
...
src/main/java/com/subsidy/controller/ClassHourDictController.java
View file @
a28c0db
...
@@ -4,6 +4,7 @@ package com.subsidy.controller;
...
@@ -4,6 +4,7 @@ package com.subsidy.controller;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.interceptor.LoginRequired
;
import
com.subsidy.common.interceptor.LoginRequired
;
import
com.subsidy.common.interceptor.TimeRequired
;
import
com.subsidy.model.ClassHourDictDO
;
import
com.subsidy.model.ClassHourDictDO
;
import
com.subsidy.model.VodPlayHistoryDO
;
import
com.subsidy.model.VodPlayHistoryDO
;
import
com.subsidy.service.ClassHourDictService
;
import
com.subsidy.service.ClassHourDictService
;
...
@@ -50,6 +51,7 @@ public class ClassHourDictController {
...
@@ -50,6 +51,7 @@ public class ClassHourDictController {
@PostMapping
(
"pollingGet"
)
@PostMapping
(
"pollingGet"
)
@ApiOperation
(
"轮询查询当前这个人当天有没有超过最长时长 memberId playLength"
)
@ApiOperation
(
"轮询查询当前这个人当天有没有超过最长时长 memberId playLength"
)
@LoginRequired
@LoginRequired
@TimeRequired
public
ResponseVO
pollingGet
(
@RequestBody
VodPlayHistoryDO
vodPlayHistoryDO
){
public
ResponseVO
pollingGet
(
@RequestBody
VodPlayHistoryDO
vodPlayHistoryDO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
classHourDictService
.
pollingGet
(
vodPlayHistoryDO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
classHourDictService
.
pollingGet
(
vodPlayHistoryDO
));
}
}
...
...
src/main/java/com/subsidy/controller/ExerciseDictController.java
View file @
a28c0db
...
@@ -4,6 +4,7 @@ package com.subsidy.controller;
...
@@ -4,6 +4,7 @@ package com.subsidy.controller;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.interceptor.LoginRequired
;
import
com.subsidy.common.interceptor.LoginRequired
;
import
com.subsidy.common.interceptor.TimeRequired
;
import
com.subsidy.dto.exercise.GetAllExercisesDTO
;
import
com.subsidy.dto.exercise.GetAllExercisesDTO
;
import
com.subsidy.dto.exercise.GetPaperExerciseDTO
;
import
com.subsidy.dto.exercise.GetPaperExerciseDTO
;
import
com.subsidy.dto.exercise.SubmitDTO
;
import
com.subsidy.dto.exercise.SubmitDTO
;
...
@@ -59,6 +60,7 @@ public class ExerciseDictController {
...
@@ -59,6 +60,7 @@ public class ExerciseDictController {
@PostMapping
(
"submit"
)
@PostMapping
(
"submit"
)
@ApiOperation
(
"提交答案 {paperId 卷子id memberId 成员id classId课程 courseId 课程id memberExerciseVOS [ id selectAnswer ] length:做题时长} "
)
@ApiOperation
(
"提交答案 {paperId 卷子id memberId 成员id classId课程 courseId 课程id memberExerciseVOS [ id selectAnswer ] length:做题时长} "
)
@LoginRequired
@LoginRequired
@TimeRequired
public
ResponseVO
submit
(
@RequestBody
SubmitDTO
submitDTO
){
public
ResponseVO
submit
(
@RequestBody
SubmitDTO
submitDTO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
exerciseDictService
.
submit
(
submitDTO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
exerciseDictService
.
submit
(
submitDTO
));
}
}
...
...
src/main/java/com/subsidy/controller/ExerciseDoneResultController.java
View file @
a28c0db
...
@@ -4,6 +4,7 @@ package com.subsidy.controller;
...
@@ -4,6 +4,7 @@ package com.subsidy.controller;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.interceptor.LoginRequired
;
import
com.subsidy.common.interceptor.LoginRequired
;
import
com.subsidy.common.interceptor.TimeRequired
;
import
com.subsidy.model.ExerciseDoneResultDO
;
import
com.subsidy.model.ExerciseDoneResultDO
;
import
com.subsidy.service.ExerciseDoneResultService
;
import
com.subsidy.service.ExerciseDoneResultService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -31,12 +32,13 @@ public class ExerciseDoneResultController {
...
@@ -31,12 +32,13 @@ public class ExerciseDoneResultController {
@PostMapping
(
"getDoneDetail"
)
@PostMapping
(
"getDoneDetail"
)
@ApiOperation
(
"提交后获取做题结果 id 提交后返回的id"
)
@ApiOperation
(
"提交后获取做题结果 id 提交后返回的id"
)
@LoginRequired
@LoginRequired
@TimeRequired
public
ResponseVO
getDoneDetail
(
@RequestBody
ExerciseDoneResultDO
exerciseDoneResultDO
){
public
ResponseVO
getDoneDetail
(
@RequestBody
ExerciseDoneResultDO
exerciseDoneResultDO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
exerciseDoneResultService
.
getDoneDetail
(
exerciseDoneResultDO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
exerciseDoneResultService
.
getDoneDetail
(
exerciseDoneResultDO
));
}
}
@PostMapping
(
"importData"
)
@PostMapping
(
"importData"
)
public
ResponseVO
make
datas
(
@RequestParam
(
"file"
)
MultipartFile
file
){
public
ResponseVO
make
Data
(
@RequestParam
(
"file"
)
MultipartFile
file
){
exerciseDoneResultService
.
importData
(
file
);
exerciseDoneResultService
.
importData
(
file
);
return
null
;
return
null
;
}
}
...
...
src/main/java/com/subsidy/controller/MemberController.java
View file @
a28c0db
...
@@ -3,6 +3,7 @@ package com.subsidy.controller;
...
@@ -3,6 +3,7 @@ package com.subsidy.controller;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.interceptor.LoginRequired
;
import
com.subsidy.common.interceptor.LoginRequired
;
import
com.subsidy.common.interceptor.TimeRequired
;
import
com.subsidy.dto.administer.VerifyCodeDTO
;
import
com.subsidy.dto.administer.VerifyCodeDTO
;
import
com.subsidy.dto.member.*
;
import
com.subsidy.dto.member.*
;
import
com.subsidy.model.ExerciseDoneResultDO
;
import
com.subsidy.model.ExerciseDoneResultDO
;
...
@@ -62,24 +63,28 @@ public class MemberController {
...
@@ -62,24 +63,28 @@ public class MemberController {
@PostMapping
(
value
=
"/login"
)
@PostMapping
(
value
=
"/login"
)
@ApiOperation
(
"手机端:登录:telephone/手机号, verifyCode/验证码"
)
@ApiOperation
(
"手机端:登录:telephone/手机号, verifyCode/验证码"
)
@TimeRequired
public
ResponseVO
login
(
@RequestBody
VerifyCodeDTO
verifyCodeDTO
)
{
public
ResponseVO
login
(
@RequestBody
VerifyCodeDTO
verifyCodeDTO
)
{
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
login
(
verifyCodeDTO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
login
(
verifyCodeDTO
));
}
}
@PostMapping
(
"passwordLogin"
)
@PostMapping
(
"passwordLogin"
)
@ApiOperation
(
"手机端:密码登录 { companyId accountName password}"
)
@ApiOperation
(
"手机端:密码登录 { companyId accountName password}"
)
@TimeRequired
public
ResponseVO
passwordLogin
(
@RequestBody
PasswordLoginDTO
passwordLoginDTO
){
public
ResponseVO
passwordLogin
(
@RequestBody
PasswordLoginDTO
passwordLoginDTO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
passwordLogin
(
passwordLoginDTO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
passwordLogin
(
passwordLoginDTO
));
}
}
@PostMapping
(
"qingxuetangLogin"
)
@PostMapping
(
"qingxuetangLogin"
)
@ApiOperation
(
"轻学堂登录 手机号mobile"
)
@ApiOperation
(
"轻学堂登录 手机号mobile"
)
@TimeRequired
public
ResponseVO
qingxuetangLogin
(
@RequestBody
QingxuetangLoginDTO
qingxuetangLoginDTO
){
public
ResponseVO
qingxuetangLogin
(
@RequestBody
QingxuetangLoginDTO
qingxuetangLoginDTO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
qingxuetangLogin
(
qingxuetangLoginDTO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
qingxuetangLogin
(
qingxuetangLoginDTO
));
}
}
@PostMapping
(
"kunchiLogin"
)
@PostMapping
(
"kunchiLogin"
)
@ApiOperation
(
"鲲驰登陆 authCorpName 手机号mobile nickname timestamp sign"
)
@ApiOperation
(
"鲲驰登陆 authCorpName 手机号mobile nickname timestamp sign"
)
@TimeRequired
public
ResponseVO
kunchiLogin
(
@RequestBody
QingxuetangLoginDTO
qingxuetangLoginDTO
){
public
ResponseVO
kunchiLogin
(
@RequestBody
QingxuetangLoginDTO
qingxuetangLoginDTO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
kunchiLogin
(
qingxuetangLoginDTO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
kunchiLogin
(
qingxuetangLoginDTO
));
}
}
...
@@ -88,6 +93,7 @@ public class MemberController {
...
@@ -88,6 +93,7 @@ public class MemberController {
@PostMapping
(
"updatePassword"
)
@PostMapping
(
"updatePassword"
)
@ApiOperation
(
"修改密码 {id password}"
)
@ApiOperation
(
"修改密码 {id password}"
)
@LoginRequired
@LoginRequired
@TimeRequired
public
ResponseVO
updatePassword
(
@RequestBody
MemberDO
memberDO
){
public
ResponseVO
updatePassword
(
@RequestBody
MemberDO
memberDO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
updatePassword
(
memberDO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
updatePassword
(
memberDO
));
}
}
...
@@ -100,7 +106,8 @@ public class MemberController {
...
@@ -100,7 +106,8 @@ public class MemberController {
@PostMapping
(
"myCourses"
)
@PostMapping
(
"myCourses"
)
@ApiOperation
(
"手机端:我的学习--课程 memberId 学员id status 状态 0:全部 1:进行中 2:待开始 3:已完成 "
)
@ApiOperation
(
"手机端:我的学习--课程 memberId 学员id status 状态 0:全部 1:进行中 2:待开始 3:已完成 "
)
@LoginRequired
// @LoginRequired
@TimeRequired
public
ResponseVO
myCourses
(
@RequestBody
MyCoursesDTO
myCoursesDTO
){
public
ResponseVO
myCourses
(
@RequestBody
MyCoursesDTO
myCoursesDTO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
myCourses
(
myCoursesDTO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
myCourses
(
myCoursesDTO
));
}
}
...
@@ -108,6 +115,7 @@ public class MemberController {
...
@@ -108,6 +115,7 @@ public class MemberController {
@PostMapping
(
"contentVod"
)
@PostMapping
(
"contentVod"
)
@ApiOperation
(
"手机端:目录+视频 classId 班级id courseId 课程 memberId 学员id"
)
@ApiOperation
(
"手机端:目录+视频 classId 班级id courseId 课程 memberId 学员id"
)
// @LoginRequired
// @LoginRequired
@TimeRequired
public
ResponseVO
contentVod
(
@RequestBody
ContentMemberDTO
contentVodDTO
){
public
ResponseVO
contentVod
(
@RequestBody
ContentMemberDTO
contentVodDTO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
contentVod
(
contentVodDTO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
contentVod
(
contentVodDTO
));
}
}
...
@@ -115,6 +123,7 @@ public class MemberController {
...
@@ -115,6 +123,7 @@ public class MemberController {
@PostMapping
(
"contentFiles"
)
@PostMapping
(
"contentFiles"
)
@ApiOperation
(
"手机端:目录+课件 courseId 课程 memberId 学员id"
)
@ApiOperation
(
"手机端:目录+课件 courseId 课程 memberId 学员id"
)
@LoginRequired
@LoginRequired
@TimeRequired
public
ResponseVO
contentFiles
(
@RequestBody
ContentMemberDTO
contentMemberDTO
){
public
ResponseVO
contentFiles
(
@RequestBody
ContentMemberDTO
contentMemberDTO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
contentFiles
(
contentMemberDTO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
contentFiles
(
contentMemberDTO
));
}
}
...
@@ -122,6 +131,7 @@ public class MemberController {
...
@@ -122,6 +131,7 @@ public class MemberController {
@PostMapping
(
"studyHistory"
)
@PostMapping
(
"studyHistory"
)
@ApiOperation
(
"学习记录 memberId 成员id pageSize pageNum"
)
@ApiOperation
(
"学习记录 memberId 成员id pageSize pageNum"
)
@LoginRequired
@LoginRequired
@TimeRequired
public
ResponseVO
studyHistory
(
@RequestBody
StudyHistoryDTO
studyHistoryDTO
){
public
ResponseVO
studyHistory
(
@RequestBody
StudyHistoryDTO
studyHistoryDTO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
studyHistory
(
studyHistoryDTO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
studyHistory
(
studyHistoryDTO
));
}
}
...
@@ -129,6 +139,7 @@ public class MemberController {
...
@@ -129,6 +139,7 @@ public class MemberController {
@PostMapping
(
"getCourseTest"
)
@PostMapping
(
"getCourseTest"
)
@ApiOperation
(
"获取课程下的测试情况 {memberId 成员id 班级id classId courseId 课程id }"
)
@ApiOperation
(
"获取课程下的测试情况 {memberId 成员id 班级id classId courseId 课程id }"
)
@LoginRequired
@LoginRequired
@TimeRequired
public
ResponseVO
getCourseTest
(
@RequestBody
ContentMemberDTO
contentMemberDTO
){
public
ResponseVO
getCourseTest
(
@RequestBody
ContentMemberDTO
contentMemberDTO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
getCourseTest
(
contentMemberDTO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
getCourseTest
(
contentMemberDTO
));
}
}
...
@@ -143,6 +154,7 @@ public class MemberController {
...
@@ -143,6 +154,7 @@ public class MemberController {
@PostMapping
(
"getStudyInfo"
)
@PostMapping
(
"getStudyInfo"
)
@ApiOperation
(
"获取学生完成课程情况 id 学员id"
)
@ApiOperation
(
"获取学生完成课程情况 id 学员id"
)
@LoginRequired
@LoginRequired
@TimeRequired
public
ResponseVO
getStudyInfo
(
@RequestBody
MemberDO
memberDO
){
public
ResponseVO
getStudyInfo
(
@RequestBody
MemberDO
memberDO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
getStudyInfo
(
memberDO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
getStudyInfo
(
memberDO
));
}
}
...
@@ -170,6 +182,7 @@ public class MemberController {
...
@@ -170,6 +182,7 @@ public class MemberController {
@PostMapping
(
"qxy"
)
@PostMapping
(
"qxy"
)
@ApiOperation
(
"Q学友授权 telephone 手机号"
)
@ApiOperation
(
"Q学友授权 telephone 手机号"
)
@TimeRequired
public
ResponseVO
qxy
(
@RequestBody
MemberDO
memberDO
){
public
ResponseVO
qxy
(
@RequestBody
MemberDO
memberDO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
qxy
(
memberDO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
qxy
(
memberDO
));
}
}
...
...
src/main/java/com/subsidy/controller/SignInRecordController.java
View file @
a28c0db
...
@@ -4,6 +4,7 @@ package com.subsidy.controller;
...
@@ -4,6 +4,7 @@ package com.subsidy.controller;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.interceptor.LoginRequired
;
import
com.subsidy.common.interceptor.LoginRequired
;
import
com.subsidy.common.interceptor.TimeRequired
;
import
com.subsidy.dto.member.GetMemberSignInfoDTO
;
import
com.subsidy.dto.member.GetMemberSignInfoDTO
;
import
com.subsidy.dto.sign.DataViewDTO
;
import
com.subsidy.dto.sign.DataViewDTO
;
import
com.subsidy.model.SignInRecordDO
;
import
com.subsidy.model.SignInRecordDO
;
...
@@ -43,6 +44,7 @@ public class SignInRecordController {
...
@@ -43,6 +44,7 @@ public class SignInRecordController {
@PostMapping
(
"signIn"
)
@PostMapping
(
"signIn"
)
@ApiOperation
(
"签到 memberId"
)
@ApiOperation
(
"签到 memberId"
)
@LoginRequired
@LoginRequired
@TimeRequired
public
ResponseVO
signIn
(
@RequestBody
SignInRecordDO
signInRecordDO
)
{
public
ResponseVO
signIn
(
@RequestBody
SignInRecordDO
signInRecordDO
)
{
return
ResponseData
.
generateCreatedResponse
(
0
,
signInRecordService
.
signIn
(
signInRecordDO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
signInRecordService
.
signIn
(
signInRecordDO
));
}
}
...
@@ -57,6 +59,7 @@ public class SignInRecordController {
...
@@ -57,6 +59,7 @@ public class SignInRecordController {
@PostMapping
(
"signInStatus"
)
@PostMapping
(
"signInStatus"
)
@ApiOperation
(
"判断学生当天有没有打卡 {memberId 学生id}"
)
@ApiOperation
(
"判断学生当天有没有打卡 {memberId 学生id}"
)
@LoginRequired
@LoginRequired
@TimeRequired
public
ResponseVO
signInStatus
(
@RequestBody
SignInRecordDO
signInRecordDO
)
{
public
ResponseVO
signInStatus
(
@RequestBody
SignInRecordDO
signInRecordDO
)
{
return
ResponseData
.
generateCreatedResponse
(
0
,
signInRecordService
.
signInStatus
(
signInRecordDO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
signInRecordService
.
signInStatus
(
signInRecordDO
));
}
}
...
...
src/main/java/com/subsidy/controller/SmsVerifyCodeController.java
View file @
a28c0db
...
@@ -3,6 +3,7 @@ package com.subsidy.controller;
...
@@ -3,6 +3,7 @@ package com.subsidy.controller;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.interceptor.TimeRequired
;
import
com.subsidy.dto.sms.SendVerifyCodeDTO
;
import
com.subsidy.dto.sms.SendVerifyCodeDTO
;
import
com.subsidy.service.SmsVerifyCodeService
;
import
com.subsidy.service.SmsVerifyCodeService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -31,6 +32,7 @@ public class SmsVerifyCodeController {
...
@@ -31,6 +32,7 @@ public class SmsVerifyCodeController {
@PostMapping
(
value
=
"/send"
)
@PostMapping
(
value
=
"/send"
)
@ApiOperation
(
"发送短信验证码 {telephone} "
)
@ApiOperation
(
"发送短信验证码 {telephone} "
)
@TimeRequired
public
ResponseVO
sendVerifyCode
(
@RequestBody
SendVerifyCodeDTO
sendVerifyCodeDTO
)
{
public
ResponseVO
sendVerifyCode
(
@RequestBody
SendVerifyCodeDTO
sendVerifyCodeDTO
)
{
smsVerifyCodeService
.
sendVerifyCode
(
sendVerifyCodeDTO
);
smsVerifyCodeService
.
sendVerifyCode
(
sendVerifyCodeDTO
);
return
ResponseData
.
generateCreatedResponse
(
0
);
return
ResponseData
.
generateCreatedResponse
(
0
);
...
...
src/main/java/com/subsidy/controller/VodPlayHistoryController.java
View file @
a28c0db
...
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
...
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.interceptor.LoginRequired
;
import
com.subsidy.common.interceptor.LoginRequired
;
import
com.subsidy.common.interceptor.TimeRequired
;
import
com.subsidy.dto.vod.InsertHistoryNewDTO
;
import
com.subsidy.dto.vod.InsertHistoryNewDTO
;
import
com.subsidy.dto.vod.RemainSecondsDTO
;
import
com.subsidy.dto.vod.RemainSecondsDTO
;
import
com.subsidy.dto.vod.SignDatePlaysDTO
;
import
com.subsidy.dto.vod.SignDatePlaysDTO
;
...
@@ -37,6 +38,7 @@ public class VodPlayHistoryController {
...
@@ -37,6 +38,7 @@ public class VodPlayHistoryController {
@PostMapping
(
"insertHistory"
)
@PostMapping
(
"insertHistory"
)
@ApiOperation
(
"记录学生看视频位置 ajax请求 classId班级id vodId 视频id memberId 成员id playLength 播放时长 playRecord 位点"
)
@ApiOperation
(
"记录学生看视频位置 ajax请求 classId班级id vodId 视频id memberId 成员id playLength 播放时长 playRecord 位点"
)
@LoginRequired
@LoginRequired
@TimeRequired
public
ResponseVO
insertHistory
(
@RequestBody
VodPlayHistoryDO
vodPlayHistoryDO
){
public
ResponseVO
insertHistory
(
@RequestBody
VodPlayHistoryDO
vodPlayHistoryDO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
vodPlayHistoryService
.
insertHistory
(
vodPlayHistoryDO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
vodPlayHistoryService
.
insertHistory
(
vodPlayHistoryDO
));
}
}
...
@@ -44,6 +46,7 @@ public class VodPlayHistoryController {
...
@@ -44,6 +46,7 @@ public class VodPlayHistoryController {
@RequestMapping
(
"insertHistoryNew"
)
@RequestMapping
(
"insertHistoryNew"
)
@ApiOperation
(
"记录学生看视频位置 classId班级id vodId 视频id memberId 成员id playLength 播放时长 playRecord 位点"
)
@ApiOperation
(
"记录学生看视频位置 classId班级id vodId 视频id memberId 成员id playLength 播放时长 playRecord 位点"
)
// @LoginRequired
// @LoginRequired
@TimeRequired
public
ResponseVO
insertHistoryNew
(
@RequestBody
String
param
){
public
ResponseVO
insertHistoryNew
(
@RequestBody
String
param
){
InsertHistoryNewDTO
insertHistoryNewDTO
=
JSON
.
parseObject
(
param
,
InsertHistoryNewDTO
.
class
);
InsertHistoryNewDTO
insertHistoryNewDTO
=
JSON
.
parseObject
(
param
,
InsertHistoryNewDTO
.
class
);
return
ResponseData
.
generateCreatedResponse
(
0
,
vodPlayHistoryService
.
insertHistoryNew
(
insertHistoryNewDTO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
vodPlayHistoryService
.
insertHistoryNew
(
insertHistoryNewDTO
));
...
@@ -51,36 +54,37 @@ public class VodPlayHistoryController {
...
@@ -51,36 +54,37 @@ public class VodPlayHistoryController {
@PostMapping
(
"dataFix"
)
@PostMapping
(
"dataFix"
)
@ApiOperation
(
"每个视频都看一次"
)
@ApiOperation
(
"每个视频都看一次"
)
@LoginRequired
//
@LoginRequired
public
void
dadaFix
(
@RequestBody
SignDatePlaysDTO
dataFixDTO
){
public
void
dadaFix
(
@RequestBody
SignDatePlaysDTO
dataFixDTO
){
vodPlayHistoryService
.
dataFix
(
dataFixDTO
);
vodPlayHistoryService
.
dataFix
(
dataFixDTO
);
}
}
@PostMapping
(
"signDatePlays"
)
@PostMapping
(
"signDatePlays"
)
@ApiOperation
(
"每天接着看几个视频 接dataFix的"
)
@ApiOperation
(
"每天接着看几个视频 接dataFix的"
)
@LoginRequired
//
@LoginRequired
public
void
signDatePlays
(
@RequestBody
SignDatePlaysDTO
signDatePlaysDTO
){
public
void
signDatePlays
(
@RequestBody
SignDatePlaysDTO
signDatePlaysDTO
){
vodPlayHistoryService
.
signDatePlays
(
signDatePlaysDTO
);
vodPlayHistoryService
.
signDatePlays
(
signDatePlaysDTO
);
}
}
@PostMapping
(
"remainSeconds"
)
@PostMapping
(
"remainSeconds"
)
@ApiOperation
(
"每个视频先看一下,然后剩余时长分配到每天里"
)
@ApiOperation
(
"每个视频先看一下,然后剩余时长分配到每天里
classId memberId
"
)
@LoginRequired
//
@LoginRequired
public
void
remainSeconds
(
@RequestBody
RemainSecondsDTO
remainSecondsDTO
){
public
void
remainSeconds
(
@RequestBody
RemainSecondsDTO
remainSecondsDTO
){
vodPlayHistoryService
.
remainSeconds
(
remainSecondsDTO
);
vodPlayHistoryService
.
remainSeconds
(
remainSecondsDTO
);
}
}
@PostMapping
(
"playLengthFix"
)
@PostMapping
(
"playLengthFix"
)
@ApiOperation
(
"按照时长去跑脚本 {classId}"
)
@ApiOperation
(
"按照时长去跑脚本 {classId
memberId
}"
)
@LoginRequired
//
@LoginRequired
public
void
playLengthFix
(
@RequestBody
RemainSecondsDTO
remainSecondsDTO
){
public
void
playLengthFix
(
@RequestBody
RemainSecondsDTO
remainSecondsDTO
){
vodPlayHistoryService
.
playLengthFix
(
remainSecondsDTO
);
vodPlayHistoryService
.
playLengthFix
(
remainSecondsDTO
);
}
}
@PostMapping
(
"testPlays"
)
@PostMapping
(
"testPlays"
)
public
ResponseVO
testPlays
(){
@ApiOperation
(
"解决有交叉时间的数据"
)
return
ResponseData
.
generateCreatedResponse
(
0
,
vodPlayHistoryService
.
testPlays
());
public
ResponseVO
testPlays
(
@RequestBody
VodPlayHistoryDO
vodPlayHistoryDO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
vodPlayHistoryService
.
testPlays
(
vodPlayHistoryDO
));
}
}
}
}
src/main/java/com/subsidy/dto/vod/RemainSecondsDTO.java
View file @
a28c0db
...
@@ -7,4 +7,6 @@ public class RemainSecondsDTO {
...
@@ -7,4 +7,6 @@ public class RemainSecondsDTO {
private
Long
classId
;
private
Long
classId
;
private
Long
memberId
;
}
}
src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java
View file @
a28c0db
...
@@ -12,6 +12,7 @@ import com.subsidy.vo.vod.StudyHistoryVO;
...
@@ -12,6 +12,7 @@ import com.subsidy.vo.vod.StudyHistoryVO;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -40,8 +41,6 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
...
@@ -40,8 +41,6 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
*/
*/
List
<
VodPlayHistoryDO
>
getVodPlayHistory
();
List
<
VodPlayHistoryDO
>
getVodPlayHistory
();
void
deleteById
(
Long
id
);
/**
/**
* 查看某人当天看了多少时间
* 查看某人当天看了多少时间
*/
*/
...
@@ -92,5 +91,10 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
...
@@ -92,5 +91,10 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
*/
*/
List
<
ClassMemberPlayLengthVO
>
classMemberPlayLength
(
Long
classId
);
List
<
ClassMemberPlayLengthVO
>
classMemberPlayLength
(
Long
classId
);
/**
* 查找某个人某个课程某天看视频的全部数据---按照createDate排序
*/
List
<
VodPlayHistoryDO
>
getVodPlayDay
(
Long
classId
,
Long
memberId
,
Date
endDate
);
}
}
src/main/java/com/subsidy/service/VodPlayHistoryService.java
View file @
a28c0db
...
@@ -32,5 +32,5 @@ public interface VodPlayHistoryService extends IService<VodPlayHistoryDO> {
...
@@ -32,5 +32,5 @@ public interface VodPlayHistoryService extends IService<VodPlayHistoryDO> {
void
playLengthFix
(
RemainSecondsDTO
remainSecondsDTO
);
void
playLengthFix
(
RemainSecondsDTO
remainSecondsDTO
);
List
<
Long
>
testPlays
();
List
<
Long
>
testPlays
(
VodPlayHistoryDO
vodPlayHistoryDO
);
}
}
src/main/java/com/subsidy/service/impl/ExerciseDoneResultServiceImpl.java
View file @
a28c0db
...
@@ -43,38 +43,39 @@ public class ExerciseDoneResultServiceImpl extends ServiceImpl<ExerciseDoneResul
...
@@ -43,38 +43,39 @@ public class ExerciseDoneResultServiceImpl extends ServiceImpl<ExerciseDoneResul
@Autowired
@Autowired
private
ExerciseDoneHistoryMapper
exerciseDoneHistoryMapper
;
private
ExerciseDoneHistoryMapper
exerciseDoneHistoryMapper
;
public
GetDoneDetailVO
getDoneDetail
(
ExerciseDoneResultDO
exerciseDoneResultDO
){
public
GetDoneDetailVO
getDoneDetail
(
ExerciseDoneResultDO
exerciseDoneResultDO
)
{
return
this
.
baseMapper
.
getDoneDetail
(
exerciseDoneResultDO
.
getId
());
return
this
.
baseMapper
.
getDoneDetail
(
exerciseDoneResultDO
.
getId
());
}
}
public
void
importData
(
MultipartFile
multipartFile
)
{
public
void
importData
(
MultipartFile
multipartFile
)
{
try
{
try
{
ExcelUtil
.
readExcel
(
null
,
ImportHistory
.
class
,
multipartFile
).
forEach
(
s
->
{
ExcelUtil
.
readExcel
(
null
,
ImportHistory
.
class
,
multipartFile
).
forEach
(
s
->
{
//找到相同卷子相同分数的人
//找到相同卷子相同分数的人
List
<
ExerciseDoneResultDO
>
exerciseDoneResultDOS
=
exerciseDoneResultMapper
.
selectList
(
new
QueryWrapper
<
ExerciseDoneResultDO
>()
List
<
ExerciseDoneResultDO
>
exerciseDoneResultDOS
=
exerciseDoneResultMapper
.
selectList
(
new
QueryWrapper
<
ExerciseDoneResultDO
>()
.
lambda
()
.
lambda
()
.
eq
(
ExerciseDoneResultDO:
:
getPaperId
,
s
.
getPaperId
())
.
eq
(
ExerciseDoneResultDO:
:
getPaperId
,
s
.
getPaperId
())
.
eq
(
ExerciseDoneResultDO:
:
getScore
,
s
.
getScore
()));
.
eq
(
ExerciseDoneResultDO:
:
getScore
,
s
.
getScore
()));
//随机获取一个人
//随机获取一个人
Random
random
=
new
Random
();
Random
random
=
new
Random
();
ExerciseDoneResultDO
exerciseDoneResultDO
=
exerciseDoneResultDOS
.
get
(
random
.
nextInt
(
exerciseDoneResultDOS
.
size
()));
ExerciseDoneResultDO
exerciseDoneResultDO
=
exerciseDoneResultDOS
.
get
(
random
.
nextInt
(
exerciseDoneResultDOS
.
size
()));
//找到这个人的答卷
//找到这个人的答卷
List
<
ExerciseDoneHistoryDO
>
exerciseDoneHistoryDOS
=
exerciseDoneHistoryMapper
.
selectList
(
new
QueryWrapper
<
ExerciseDoneHistoryDO
>()
List
<
ExerciseDoneHistoryDO
>
exerciseDoneHistoryDOS
=
exerciseDoneHistoryMapper
.
selectList
(
new
QueryWrapper
<
ExerciseDoneHistoryDO
>()
.
lambda
()
.
lambda
()
.
eq
(
ExerciseDoneHistoryDO:
:
getDoneId
,
exerciseDoneResultDO
.
getId
())
.
eq
(
ExerciseDoneHistoryDO:
:
getDoneId
,
exerciseDoneResultDO
.
getId
())
.
eq
(
ExerciseDoneHistoryDO:
:
getMemberId
,
exerciseDoneResultDO
.
getMemberId
())
.
eq
(
ExerciseDoneHistoryDO:
:
getMemberId
,
exerciseDoneResultDO
.
getMemberId
())
.
eq
(
ExerciseDoneHistoryDO:
:
getPaperId
,
exerciseDoneResultDO
.
getPaperId
()));
.
eq
(
ExerciseDoneHistoryDO:
:
getPaperId
,
exerciseDoneResultDO
.
getPaperId
()));
DateTimeFormatter
formatter
=
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"EEE MMM dd HH:mm:ss zzz yyyy"
,
Locale
.
ENGLISH
);
DateTimeFormatter
.
ofPattern
(
"EEE MMM dd HH:mm:ss zzz yyyy"
,
Locale
.
ENGLISH
);
//遍历写入
//遍历写入
for
(
ExerciseDoneHistoryDO
exerciseDoneHistoryDO
:
exerciseDoneHistoryDOS
){
for
(
ExerciseDoneHistoryDO
exerciseDoneHistoryDO
:
exerciseDoneHistoryDOS
)
{
ExerciseDoneHistoryDO
ex
=
new
ExerciseDoneHistoryDO
();
ExerciseDoneHistoryDO
ex
=
new
ExerciseDoneHistoryDO
();
BeanUtils
.
copyProperties
(
exerciseDoneHistoryDO
,
ex
);
BeanUtils
.
copyProperties
(
exerciseDoneHistoryDO
,
ex
);
ex
.
setId
(
null
);
ex
.
setId
(
null
);
ex
.
setMemberId
(
s
.
getMemberId
());
ex
.
setMemberId
(
s
.
getMemberId
());
ex
.
setDoneId
(
s
.
getId
());
ex
.
setDoneId
(
s
.
getId
());
...
@@ -82,15 +83,22 @@ public class ExerciseDoneResultServiceImpl extends ServiceImpl<ExerciseDoneResul
...
@@ -82,15 +83,22 @@ public class ExerciseDoneResultServiceImpl extends ServiceImpl<ExerciseDoneResul
ex
.
setPaperId
(
s
.
getPaperId
());
ex
.
setPaperId
(
s
.
getPaperId
());
// DateUtil.getJavaDate()
// DateUtil.getJavaDate()
ex
.
setCreateDate
(
LocalDateTime
.
parse
(
s
.
getCreate_date
(),
formatter
));
ex
.
setCreateDate
(
LocalDateTime
.
parse
(
s
.
getCreate_date
(),
formatter
));
exerciseDoneHistoryMapper
.
insert
(
ex
);
exerciseDoneHistoryMapper
.
insert
(
ex
);
}
}
});
});
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
ex
.
printStackTrace
();
}
}
}
}
public
static
void
main
(
String
[]
args
)
{
while
(
true
)
{
System
.
out
.
println
(
new
Random
().
nextInt
(
0
));
}
}
}
}
src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
View file @
a28c0db
...
@@ -18,7 +18,9 @@ import org.springframework.beans.BeanUtils;
...
@@ -18,7 +18,9 @@ import org.springframework.beans.BeanUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashMap
;
...
@@ -68,7 +70,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
...
@@ -68,7 +70,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
public
String
insertHistory
(
VodPlayHistoryDO
vodPlayHistoryDO
)
{
public
String
insertHistory
(
VodPlayHistoryDO
vodPlayHistoryDO
)
{
if
(
vodPlayHistoryDO
.
getPlayLength
()
>
3
)
{
if
(
vodPlayHistoryDO
.
getPlayLength
()
>
3
)
{
MemberDO
memberDO
=
memberMapper
.
selectById
(
vodPlayHistoryDO
.
getMemberId
());
MemberDO
memberDO
=
memberMapper
.
selectById
(
vodPlayHistoryDO
.
getMemberId
());
//查看系统设定的时长
//查看系统设定的时长
ClassHourDictDO
classHourDictDO
=
classHourDictMapper
.
selectOne
(
new
QueryWrapper
<
ClassHourDictDO
>()
ClassHourDictDO
classHourDictDO
=
classHourDictMapper
.
selectOne
(
new
QueryWrapper
<
ClassHourDictDO
>()
...
@@ -95,15 +97,15 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
...
@@ -95,15 +97,15 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
public
String
insertHistoryNew
(
InsertHistoryNewDTO
insertHistoryNewDTO
)
{
public
String
insertHistoryNew
(
InsertHistoryNewDTO
insertHistoryNewDTO
)
{
if
(
insertHistoryNewDTO
.
getPlayLength
()
>
3
)
{
if
(
insertHistoryNewDTO
.
getPlayLength
()
>
3
)
{
//对比redis上的token
//对比redis上的token
String
token
=
redisUtil
.
get
(
"mobile_"
+
insertHistoryNewDTO
.
getMemberId
()).
toString
();
String
token
=
redisUtil
.
get
(
"mobile_"
+
insertHistoryNewDTO
.
getMemberId
()).
toString
();
if
(!
insertHistoryNewDTO
.
getToken
().
equals
(
token
)){
if
(!
insertHistoryNewDTO
.
getToken
().
equals
(
token
))
{
throw
new
HttpException
(
1010
);
throw
new
HttpException
(
1010
);
}
}
VodPlayHistoryDO
vodPlayHistoryDO
=
new
VodPlayHistoryDO
();
VodPlayHistoryDO
vodPlayHistoryDO
=
new
VodPlayHistoryDO
();
BeanUtils
.
copyProperties
(
insertHistoryNewDTO
,
vodPlayHistoryDO
);
BeanUtils
.
copyProperties
(
insertHistoryNewDTO
,
vodPlayHistoryDO
);
MemberDO
memberDO
=
memberMapper
.
selectById
(
vodPlayHistoryDO
.
getMemberId
());
MemberDO
memberDO
=
memberMapper
.
selectById
(
vodPlayHistoryDO
.
getMemberId
());
//查看系统设定的时长
//查看系统设定的时长
...
@@ -173,7 +175,8 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
...
@@ -173,7 +175,8 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
int
rdm_total
=
0
;
int
rdm_total
=
0
;
for
(
int
k
=
0
;
k
<
signInrecord
;
k
++)
{
for
(
int
k
=
0
;
k
<
signInrecord
;
k
++)
{
int
n
=
getRandom
();
// int n = getRandom();
int
n
=
vodSize
/
signInrecord
+
1
;
rdm_total
+=
n
;
rdm_total
+=
n
;
if
((
m
+
n
)
<
vodSize
&&
k
!=
signInrecord
-
1
)
{
if
((
m
+
n
)
<
vodSize
&&
k
!=
signInrecord
-
1
)
{
m
+=
n
;
m
+=
n
;
...
@@ -366,104 +369,104 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
...
@@ -366,104 +369,104 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
ClassDictDO
classDictDO
=
classDictMapper
.
selectById
(
classId
);
ClassDictDO
classDictDO
=
classDictMapper
.
selectById
(
classId
);
//找到班级里的学生
//
//找到班级里的学生
List
<
ClassMemberMappingDO
>
classMemberMappingDOS
=
classMemberMappingMapper
.
selectList
(
new
QueryWrapper
<
ClassMemberMappingDO
>()
//
List<ClassMemberMappingDO> classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper<ClassMemberMappingDO>()
.
lambda
()
//
.lambda()
.
eq
(
ClassMemberMappingDO:
:
getClassId
,
Long
.
valueOf
(
classId
)));
//
.eq(ClassMemberMappingDO::getClassId, Long.valueOf(classId)));
//查找课程里的所有视频
//查找课程里的所有视频
List
<
VodDictDO
>
vodDictDOS
=
courseContentMapper
.
getCourseVods
(
classDictDO
.
getCourseId
());
List
<
VodDictDO
>
vodDictDOS
=
courseContentMapper
.
getCourseVods
(
classDictDO
.
getCourseId
());
//查看每个人看视频的时长
//查看每个人看视频的时长
for
(
ClassMemberMappingDO
classMemberMappingDO
:
classMemberMappingDOS
)
{
//
for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) {
//查看每个人的剩余时长
//查看每个人的剩余时长
MemberStudyLengthDO
memberStudyLengthDO
=
memberStudyLengthMapper
.
selectOne
(
new
QueryWrapper
<
MemberStudyLengthDO
>()
MemberStudyLengthDO
memberStudyLengthDO
=
memberStudyLengthMapper
.
selectOne
(
new
QueryWrapper
<
MemberStudyLengthDO
>()
.
lambda
()
.
lambda
()
.
eq
(
MemberStudyLengthDO:
:
getMemberId
,
classMemberMappingD
O
.
getMemberId
()));
.
eq
(
MemberStudyLengthDO:
:
getMemberId
,
remainSecondsDT
O
.
getMemberId
()));
//查询这个人 这节课 签到记录 排序
//查询这个人 这节课 签到记录 排序
List
<
SignInRecordDO
>
signInRecordDOS
=
signInRecordMapper
.
selectList
(
new
QueryWrapper
<
SignInRecordDO
>()
List
<
SignInRecordDO
>
signInRecordDOS
=
signInRecordMapper
.
selectList
(
new
QueryWrapper
<
SignInRecordDO
>()
.
lambda
()
.
lambda
()
.
eq
(
SignInRecordDO:
:
getMemberId
,
classMemberMappingDO
.
getMemberId
())
.
eq
(
SignInRecordDO:
:
getMemberId
,
remainSecondsDTO
.
getMemberId
())
.
eq
(
SignInRecordDO:
:
getClassId
,
classId
));
.
eq
(
SignInRecordDO:
:
getClassId
,
classId
));
//确定每日最大学习时长
int
maxLength
=
memberStudyLengthDO
.
getTotalLength
()/
signInRecordDOS
.
size
()+
650
;
//确定每日最大学习时长
int
maxLength
=
memberStudyLengthDO
.
getTotalLength
()
/
signInRecordDOS
.
size
()
+
650
;
for
(
int
k
=
signInRecordDOS
.
size
()
-
1
;
k
>=
0
;
k
--)
{
//查看当天这人已经看的视频时长
for
(
int
k
=
signInRecordDOS
.
size
()
-
1
;
k
>=
0
;
k
--)
{
List
<
VodPlayHistoryDO
>
vodPlayHistoryDOS
=
vodPlayHistoryMapper
.
exPlayInfo
(
classMemberMappingDO
.
getMemberId
(),
String
.
valueOf
(
classId
),
signInRecordDOS
.
get
(
k
).
getSignInDate
());
//查看学生已看视频时长
//查看当天这人已经看的视频时长
int
totalLength
=
0
;
List
<
VodPlayHistoryDO
>
vodPlayHistoryDOS
=
vodPlayHistoryMapper
.
exPlayInfo
(
remainSecondsDTO
.
getMemberId
(),
String
.
valueOf
(
classId
),
signInRecordDOS
.
get
(
k
).
getSignInDate
());
System
.
out
.
println
(
"111111111111111"
);
List
<
VodPlayHistoryDO
>
vodPlayHistoryDOS1
=
vodPlayHistoryMapper
.
selectList
(
new
QueryWrapper
<
VodPlayHistoryDO
>()
.
lambda
()
.
eq
(
VodPlayHistoryDO:
:
getMemberId
,
classMemberMappingDO
.
getMemberId
())
.
eq
(
VodPlayHistoryDO:
:
getClassId
,
classId
));
for
(
VodPlayHistoryDO
vodPlayHistoryDO
:
vodPlayHistoryDOS1
)
{
totalLength
+=
vodPlayHistoryDO
.
getPlayLength
();
}
int
leftLength
=
0
;
//查看学生已看视频时长
int
totalLength
=
0
;
System
.
out
.
println
(
"111111111111111"
);
List
<
VodPlayHistoryDO
>
vodPlayHistoryDOS1
=
vodPlayHistoryMapper
.
selectList
(
new
QueryWrapper
<
VodPlayHistoryDO
>()
.
lambda
()
.
eq
(
VodPlayHistoryDO:
:
getMemberId
,
remainSecondsDTO
.
getMemberId
())
.
eq
(
VodPlayHistoryDO:
:
getClassId
,
classId
));
for
(
VodPlayHistoryDO
vodPlayHistoryDO
:
vodPlayHistoryDOS1
)
{
totalLength
+=
vodPlayHistoryDO
.
getPlayLength
();
}
System
.
out
.
println
(
"22222222222222222222222"
);
int
leftLength
=
0
;
if
(
memberStudyLengthDO
!=
null
)
{
//这个人还剩多少时长
leftLength
=
memberStudyLengthDO
.
getTotalLength
()
-
totalLength
;
}
System
.
out
.
println
(
"2.5==============================="
);
System
.
out
.
println
(
"22222222222222222222222"
);
//当天已经看了多少时间视频
if
(
memberStudyLengthDO
!=
null
)
{
int
playLength
=
0
;
//这个人还剩多少时长
leftLength
=
memberStudyLengthDO
.
getTotalLength
()
-
totalLength
;
}
for
(
int
m
=
0
;
m
<
vodPlayHistoryDOS
.
size
();
m
++)
{
System
.
out
.
println
(
"2.5==============================="
);
playLength
+=
vodPlayHistoryDOS
.
get
(
m
).
getPlayLength
();
//当天已经看了多少时间视频
}
int
playLength
=
0
;
if
(
maxLength
>
playLength
){
for
(
int
m
=
0
;
m
<
vodPlayHistoryDOS
.
size
();
m
++)
{
if
(
leftLength
>
0
)
{
playLength
+=
vodPlayHistoryDOS
.
get
(
m
).
getPlayLength
();
//随机看几个视频
}
int
playCounts
=
new
Random
().
nextInt
(
4
)
+
2
;
System
.
out
.
println
(
"4444444444444444"
);
for
(
int
i
=
0
;
i
<
playCounts
;
i
++)
{
VodPlayHistoryDO
vodPlayHistoryDO
=
new
VodPlayHistoryDO
();
if
(
maxLength
>
playLength
)
{
Random
random1
=
new
Random
();
if
(
leftLength
>
0
)
{
System
.
out
.
println
(
"55555555555555555555"
);
//随机看几个视频
int
j
=
random1
.
nextInt
(
vodDictDOS
.
size
());
int
playCounts
=
new
Random
().
nextInt
(
4
)
+
2
;
vodPlayHistoryDO
.
setPlayCount
(
1
);
System
.
out
.
println
(
"4444444444444444"
);
vodPlayHistoryDO
.
setClassId
(
classId
);
for
(
int
i
=
0
;
i
<
playCounts
;
i
++)
{
vodPlayHistoryDO
.
setMemberId
(
classMemberMappingDO
.
getMemberId
());
int
h
=
new
Random
().
nextInt
(
vodDictDOS
.
get
(
j
).
getVodLength
()
-
10
)
+
1
;
VodPlayHistoryDO
vodPlayHistoryDO
=
new
VodPlayHistoryDO
();
System
.
out
.
println
(
"666666666666666666"
);
Random
random1
=
new
Random
();
vodPlayHistoryDO
.
setPlayRecord
(
new
Random
().
nextInt
(
h
));
System
.
out
.
println
(
"55555555555555555555"
);
if
(
leftLength
-
h
>
0
)
{
int
j
=
random1
.
nextInt
(
vodDictDOS
.
size
());
vodPlayHistoryDO
.
setPlayLength
(
h
);
vodPlayHistoryDO
.
setPlayCount
(
1
);
playLength
+=
h
;
vodPlayHistoryDO
.
setClassId
(
classId
);
vodPlayHistoryDO
.
setVodId
(
vodDictDOS
.
get
(
j
).
getId
());
vodPlayHistoryDO
.
setMemberId
(
remainSecondsDTO
.
getMemberId
());
vodPlayHistoryDO
.
setPlayDate
(
signInRecordDOS
.
get
(
k
).
getSignInDate
().
plusSeconds
(
playLength
));
int
h
=
new
Random
().
nextInt
(
vodDictDOS
.
get
(
j
).
getVodLength
()
-
10
)
+
1
;
leftLength
=
leftLength
-
h
;
System
.
out
.
println
(
"666666666666666666"
);
vodPlayHistoryMapper
.
insert
(
vodPlayHistoryDO
);
vodPlayHistoryDO
.
setPlayRecord
(
new
Random
().
nextInt
(
h
));
}
else
{
if
(
leftLength
-
h
>
0
)
{
vodPlayHistoryDO
.
setPlayLength
(
leftLength
);
vodPlayHistoryDO
.
setPlayLength
(
h
);
playLength
+=
leftLength
;
playLength
+=
h
;
vodPlayHistoryDO
.
setVodId
(
vodDictDOS
.
get
(
j
).
getId
());
vodPlayHistoryDO
.
setVodId
(
vodDictDOS
.
get
(
j
).
getId
());
vodPlayHistoryDO
.
setPlayDate
(
signInRecordDOS
.
get
(
k
).
getSignInDate
().
plusSeconds
(
playLength
));
vodPlayHistoryDO
.
setPlayDate
(
signInRecordDOS
.
get
(
k
).
getSignInDate
().
plusSeconds
(
playLength
));
vodPlayHistoryMapper
.
insert
(
vodPlayHistoryDO
);
leftLength
=
leftLength
-
h
;
break
;
vodPlayHistoryMapper
.
insert
(
vodPlayHistoryDO
);
}
}
else
{
vodPlayHistoryDO
.
setPlayLength
(
leftLength
);
playLength
+=
leftLength
;
vodPlayHistoryDO
.
setVodId
(
vodDictDOS
.
get
(
j
).
getId
());
vodPlayHistoryDO
.
setPlayDate
(
signInRecordDOS
.
get
(
k
).
getSignInDate
().
plusSeconds
(
playLength
));
vodPlayHistoryMapper
.
insert
(
vodPlayHistoryDO
);
break
;
}
}
}
}
}
}
System
.
out
.
println
(
"33333333333333333333"
);
}
}
System
.
out
.
println
(
"33333333333333333333"
);
}
}
// }
}
}
public
void
playLengthFix
(
RemainSecondsDTO
remainSecondsDTO
)
{
public
void
playLengthFix
(
RemainSecondsDTO
remainSecondsDTO
)
{
...
@@ -471,224 +474,238 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
...
@@ -471,224 +474,238 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
// 查看签到次数
// 查看签到次数
ClassDictDO
classDictDO
=
classDictMapper
.
selectById
(
remainSecondsDTO
.
getClassId
());
ClassDictDO
classDictDO
=
classDictMapper
.
selectById
(
remainSecondsDTO
.
getClassId
());
//找到班级里的学生
//
//找到班级里的学生
List
<
ClassMemberMappingDO
>
classMemberMappingDOS
=
classMemberMappingMapper
.
selectList
(
new
QueryWrapper
<
ClassMemberMappingDO
>()
//
List<ClassMemberMappingDO> classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper<ClassMemberMappingDO>()
.
lambda
()
//
.lambda()
.
eq
(
ClassMemberMappingDO:
:
getClassId
,
classDictDO
.
getId
()));
//
.eq(ClassMemberMappingDO::getClassId, classDictDO.getId()));
//查找课程里的所有视频
//查找课程里的所有视频
List
<
VodDictDO
>
vodDictDOS
=
courseContentMapper
.
getCourseVods
(
classDictDO
.
getCourseId
());
List
<
VodDictDO
>
vodDictDOS
=
courseContentMapper
.
getCourseVods
(
classDictDO
.
getCourseId
());
//查看每个人看视频的时长
//查看每个人看视频的时长
for
(
ClassMemberMappingDO
classMemberMappingDO
:
classMemberMappingDOS
)
{
// for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) {
//查看签到次数,得到学习时长
//查询这个人 这节课 签到记录 排序
List
<
SignInRecordDO
>
signInRecordDOS
=
signInRecordMapper
.
selectList
(
new
QueryWrapper
<
SignInRecordDO
>()
.
lambda
()
.
eq
(
SignInRecordDO:
:
getMemberId
,
classMemberMappingDO
.
getMemberId
())
.
eq
(
SignInRecordDO:
:
getClassId
,
classDictDO
.
getId
())
.
orderByAsc
(
SignInRecordDO:
:
getSignInDate
));
List
<
LocalDateTime
>
localDateTimes
=
new
ArrayList
<>();
//查看签到次数,得到学习时长
for
(
SignInRecordDO
signInrecord
:
signInRecordDOS
)
{
//查询这个人 这节课 签到记录 排序
if
(
signInrecord
.
getSignInDate
().
getHour
()
>=
6
&&
signInrecord
.
getSignInDate
().
getHour
()
<
17
)
{
List
<
SignInRecordDO
>
signInRecordDOS
=
signInRecordMapper
.
selectList
(
new
QueryWrapper
<
SignInRecordDO
>()
localDateTimes
.
add
(
signInrecord
.
getSignInDate
());
.
lambda
()
}
.
eq
(
SignInRecordDO:
:
getMemberId
,
remainSecondsDTO
.
getMemberId
())
.
eq
(
SignInRecordDO:
:
getClassId
,
classDictDO
.
getId
())
.
orderByAsc
(
SignInRecordDO:
:
getSignInDate
));
List
<
LocalDateTime
>
localDateTimes
=
new
ArrayList
<>();
for
(
SignInRecordDO
signInrecord
:
signInRecordDOS
)
{
if
(
signInrecord
.
getSignInDate
().
getHour
()
>=
6
&&
signInrecord
.
getSignInDate
().
getHour
()
<
17
)
{
localDateTimes
.
add
(
signInrecord
.
getSignInDate
());
}
}
int
signInrecord
=
localDateTimes
.
size
();
}
int
vodSize
=
vodDictDOS
.
size
();
int
signInrecord
=
localDateTimes
.
size
();
int
vodSize
=
vodDictDOS
.
size
();
LinkedHashMap
<
LocalDateTime
,
Integer
>
hashMap
=
new
LinkedHashMap
<>();
List
<
LocalDateTime
>
integers
=
new
ArrayList
<>();
LinkedHashMap
<
LocalDateTime
,
Integer
>
hashMap
=
new
LinkedHashMap
<>();
List
<
LocalDateTime
>
integers
=
new
ArrayList
<>();
int
m
=
0
;
int
m
=
0
;
int
rdm_total
=
0
;
for
(
int
k
=
0
;
k
<
signInrecord
;
k
++)
{
int
rdm_total
=
0
;
int
n
=
getRandom
();
for
(
int
k
=
0
;
k
<
signInrecord
;
k
++)
{
rdm_total
+=
n
;
int
n
=
getRandom
()
;
if
((
m
+
n
)
<
vodSize
&&
k
!=
signInrecord
-
1
)
{
rdm_total
+=
n
;
m
+=
n
;
if
((
m
+
n
)
<
vodSize
&&
k
!=
signInrecord
-
1
)
{
//if (n > 11 || n < 5) {
m
+=
n
;
// System.out.println("error" + "===================");
//if (n > 11 || n < 5) {
//}
// System.out.println("error" + "===================");
hashMap
.
put
(
localDateTimes
.
get
(
k
),
n
);
//}
integers
.
add
(
localDateTimes
.
get
(
k
)
);
hashMap
.
put
(
localDateTimes
.
get
(
k
),
n
);
}
else
{
integers
.
add
(
localDateTimes
.
get
(
k
));
//if (vodSize - rdm_total + n > 10 || vodSize - rdm_total + n < 5)
{
}
else
{
// System.out.println("error+==================");
//if (vodSize - rdm_total + n > 10 || vodSize - rdm_total + n < 5) {
//}
// System.out.println("error+==================");
hashMap
.
put
(
localDateTimes
.
get
(
k
),
vodSize
-
rdm_total
+
n
);
//}
integers
.
add
(
localDateTimes
.
get
(
k
)
);
hashMap
.
put
(
localDateTimes
.
get
(
k
),
vodSize
-
rdm_total
+
n
);
break
;
integers
.
add
(
localDateTimes
.
get
(
k
))
;
}
break
;
}
}
}
//是否是最后一天的
//是否是最后一天的
int
key_index
=
0
;
int
key_index
=
0
;
// for (LocalDateTime localDateTime : hashMap.keySet()){
// for (LocalDateTime localDateTime : hashMap.keySet()){
// if (hashMap.get(localDateTime)>10||hashMap.get(localDateTime)<5){
// if (hashMap.get(localDateTime)>10||hashMap.get(localDateTime)<5){
// System.out.println("================");
// System.out.println("================");
// }
// }
// }
// }
for
(
LocalDateTime
localDateTime
:
localDateTimes
)
{
for
(
LocalDateTime
localDateTime
:
localDateTimes
)
{
//今天应该看多久视频
//今天应该看多久视频
int
totalPlayLength
=
0
;
int
totalPlayLength
=
0
;
if
(
localDateTimes
.
size
()
==
3
)
{
if
(
localDateTimes
.
size
()
==
3
)
{
totalPlayLength
=
_3times
();
totalPlayLength
=
_3times
();
}
else
if
(
localDateTimes
.
size
()
==
4
)
{
}
else
if
(
localDateTimes
.
size
()
==
4
)
{
totalPlayLength
=
_4times
();
totalPlayLength
=
_4times
();
}
else
if
(
localDateTimes
.
size
()
==
5
)
{
}
else
if
(
localDateTimes
.
size
()
==
5
)
{
totalPlayLength
=
_5times
();
totalPlayLength
=
_5times
();
}
else
if
(
localDateTimes
.
size
()
==
6
)
{
}
else
if
(
localDateTimes
.
size
()
==
6
)
{
totalPlayLength
=
_6times
();
totalPlayLength
=
_6times
();
}
else
{
}
else
{
totalPlayLength
=
_7times
();
totalPlayLength
=
_7times
();
}
}
//今天已看视频时长
//今天已看视频时长
int
totalPlay
=
0
;
int
totalPlay
=
0
;
//先续播前一天未看完的视频
//先续播前一天未看完的视频
List
<
VodPlayHistoryDO
>
vodPlayHistoryDOS
=
vodPlayHistoryMapper
.
selectList
(
new
QueryWrapper
<
VodPlayHistoryDO
>()
List
<
VodPlayHistoryDO
>
vodPlayHistoryDOS
=
vodPlayHistoryMapper
.
selectList
(
new
QueryWrapper
<
VodPlayHistoryDO
>()
.
lambda
()
.
eq
(
VodPlayHistoryDO:
:
getMemberId
,
remainSecondsDTO
.
getMemberId
())
.
eq
(
VodPlayHistoryDO:
:
getClassId
,
classDictDO
.
getId
())
.
orderByDesc
(
VodPlayHistoryDO:
:
getPlayDate
));
//续播
if
(
vodPlayHistoryDOS
.
size
()
>
0
)
{
VodPlayHistoryDO
vodPlayHistoryDO1
=
vodPlayHistoryDOS
.
get
(
0
);
int
count
=
this
.
baseMapper
.
selectCount
(
new
QueryWrapper
<
VodPlayHistoryDO
>()
.
lambda
()
.
lambda
()
.
eq
(
VodPlayHistoryDO:
:
getMemberId
,
classMemberMappingDO
.
getMemberId
())
.
eq
(
VodPlayHistoryDO:
:
getVodId
,
vodPlayHistoryDO1
.
getVodId
())
.
eq
(
VodPlayHistoryDO:
:
getClassId
,
classDictDO
.
getId
())
.
eq
(
VodPlayHistoryDO:
:
getMemberId
,
remainSecondsDTO
.
getMemberId
()));
.
orderByDesc
(
VodPlayHistoryDO:
:
getPlayDate
));
//续播
if
(
vodPlayHistoryDOS
.
size
()
>
0
)
{
VodPlayHistoryDO
vodPlayHistoryDO1
=
vodPlayHistoryDOS
.
get
(
0
);
int
count
=
this
.
baseMapper
.
selectCount
(
new
QueryWrapper
<
VodPlayHistoryDO
>()
.
lambda
()
.
eq
(
VodPlayHistoryDO:
:
getVodId
,
vodPlayHistoryDO1
.
getVodId
())
.
eq
(
VodPlayHistoryDO:
:
getMemberId
,
classMemberMappingDO
.
getMemberId
()));
if
(
count
<
2
)
{
if
(
count
<
2
)
{
VodDictDO
vodDictDO
=
vodDictMapper
.
selectById
(
vodPlayHistoryDO1
.
getVodId
());
VodDictDO
vodDictDO
=
vodDictMapper
.
selectById
(
vodPlayHistoryDO1
.
getVodId
());
//剩下的学习时长
//剩下的学习时长
int
leftLength
=
vodDictDO
.
getVodLength
()
-
vodPlayHistoryDO1
.
getPlayLength
();
int
leftLength
=
vodDictDO
.
getVodLength
()
-
vodPlayHistoryDO1
.
getPlayLength
();
if
(
leftLength
>
0
)
{
if
(
leftLength
>
0
)
{
totalPlay
+=
leftLength
;
totalPlay
+=
leftLength
;
VodPlayHistoryDO
vodPlayHistoryDO
=
new
VodPlayHistoryDO
();
VodPlayHistoryDO
vodPlayHistoryDO
=
new
VodPlayHistoryDO
();
vodPlayHistoryDO
.
setPlayCount
(
1
);
vodPlayHistoryDO
.
setPlayCount
(
1
);
vodPlayHistoryDO
.
setClassId
(
classDictDO
.
getId
());
vodPlayHistoryDO
.
setClassId
(
classDictDO
.
getId
());
vodPlayHistoryDO
.
setMemberId
(
classMemberMappingDO
.
getMemberId
());
vodPlayHistoryDO
.
setMemberId
(
remainSecondsDTO
.
getMemberId
());
vodPlayHistoryDO
.
setPlayRecord
(
vodDictDO
.
getVodLength
());
vodPlayHistoryDO
.
setPlayRecord
(
vodDictDO
.
getVodLength
());
vodPlayHistoryDO
.
setPlayLength
(
leftLength
);
vodPlayHistoryDO
.
setPlayLength
(
leftLength
);
vodPlayHistoryDO
.
setVodId
(
vodDictDO
.
getId
());
vodPlayHistoryDO
.
setVodId
(
vodDictDO
.
getId
());
vodPlayHistoryDO
.
setPlayDate
(
localDateTime
.
plusSeconds
(
leftLength
));
vodPlayHistoryDO
.
setPlayDate
(
localDateTime
.
plusSeconds
(
leftLength
));
vodPlayHistoryMapper
.
insert
(
vodPlayHistoryDO
);
vodPlayHistoryMapper
.
insert
(
vodPlayHistoryDO
);
}
}
}
}
}
}
//查找这个人应该学的课程
//查找这个人应该学的课程
for
(
VodDictDO
vodDictDO
:
vodDictDOS
)
{
for
(
VodDictDO
vodDictDO
:
vodDictDOS
)
{
//从历史记录里找中这个人有没有学过
//从历史记录里找中这个人有没有学过
Integer
count
=
vodPlayHistoryMapper
.
selectCount
(
new
QueryWrapper
<
VodPlayHistoryDO
>()
Integer
count
=
vodPlayHistoryMapper
.
selectCount
(
new
QueryWrapper
<
VodPlayHistoryDO
>()
.
lambda
()
.
lambda
()
.
eq
(
VodPlayHistoryDO:
:
getMemberId
,
classMemberMappingDO
.
getMemberId
())
.
eq
(
VodPlayHistoryDO:
:
getMemberId
,
remainSecondsDTO
.
getMemberId
())
.
eq
(
VodPlayHistoryDO:
:
getClassId
,
classDictDO
.
getId
())
.
eq
(
VodPlayHistoryDO:
:
getClassId
,
classDictDO
.
getId
())
.
eq
(
VodPlayHistoryDO:
:
getVodId
,
vodDictDO
.
getId
()));
.
eq
(
VodPlayHistoryDO:
:
getVodId
,
vodDictDO
.
getId
()));
//表示这个视频没有学过
//表示这个视频没有学过
if
(
count
==
0
)
{
if
(
count
==
0
)
{
if
(
totalPlayLength
>
totalPlay
)
{
//说明今天还可以学
if
(
totalPlayLength
>
totalPlay
)
{
//说明今天还可以学
VodPlayHistoryDO
vodPlayHistoryDO
=
new
VodPlayHistoryDO
();
VodPlayHistoryDO
vodPlayHistoryDO
=
new
VodPlayHistoryDO
();
vodPlayHistoryDO
.
setPlayCount
(
1
);
vodPlayHistoryDO
.
setPlayCount
(
1
);
vodPlayHistoryDO
.
setClassId
(
classDictDO
.
getId
());
vodPlayHistoryDO
.
setClassId
(
classDictDO
.
getId
());
vodPlayHistoryDO
.
setMemberId
(
classMemberMappingDO
.
getMemberId
());
vodPlayHistoryDO
.
setMemberId
(
remainSecondsDTO
.
getMemberId
());
vodPlayHistoryDO
.
setPlayRecord
(
vodDictDO
.
getVodLength
());
vodPlayHistoryDO
.
setPlayRecord
(
vodDictDO
.
getVodLength
());
if
(
totalPlay
+
vodDictDO
.
getVodLength
()
<=
totalPlayLength
)
{
if
(
totalPlay
+
vodDictDO
.
getVodLength
()
<=
totalPlayLength
)
{
vodPlayHistoryDO
.
setPlayLength
(
vodDictDO
.
getVodLength
());
vodPlayHistoryDO
.
setPlayLength
(
vodDictDO
.
getVodLength
());
totalPlay
+=
vodDictDO
.
getVodLength
();
totalPlay
+=
vodDictDO
.
getVodLength
();
}
else
{
}
else
{
vodPlayHistoryDO
.
setPlayLength
(
totalPlayLength
-
totalPlay
);
vodPlayHistoryDO
.
setPlayLength
(
totalPlayLength
-
totalPlay
);
totalPlay
=
totalPlayLength
;
totalPlay
=
totalPlayLength
;
}
vodPlayHistoryDO
.
setVodId
(
vodDictDO
.
getId
());
vodPlayHistoryDO
.
setPlayDate
(
localDateTime
.
plusSeconds
(
totalPlay
));
vodPlayHistoryMapper
.
insert
(
vodPlayHistoryDO
);
}
}
vodPlayHistoryDO
.
setVodId
(
vodDictDO
.
getId
());
vodPlayHistoryDO
.
setPlayDate
(
localDateTime
.
plusSeconds
(
totalPlay
));
vodPlayHistoryMapper
.
insert
(
vodPlayHistoryDO
);
}
}
}
}
key_index
++;
}
}
key_index
++;
}
}
// }
}
}
public
List
<
Long
>
testPlays
(){
public
List
<
Long
>
testPlays
(
VodPlayHistoryDO
vodPlayHistoryDO
)
{
List
<
ClassMemberMappingDO
>
classMemberMappingDOS
=
classMemberMappingMapper
.
selectList
(
new
QueryWrapper
<
ClassMemberMappingDO
>()
String
classIds
=
"122,150,151,152,153,165,168,195,199,200,202,203,204,205,206,207,209,210,211,212,213,215,227,228,229,233,234,235,240,241,243,244,248,249,250"
;
.
lambda
()
.
eq
(
ClassMemberMappingDO:
:
getClassId
,
168
));
// String classIds = "122,150";
List
<
String
>
classIdArr
=
Arrays
.
asList
(
classIds
.
split
(
","
));
// List<MemberDO> memberDOS = memberMapper.selectList(null);
List
<
Long
>
result
=
new
ArrayList
<>();
List
<
Long
>
result
=
new
ArrayList
<>();
for
(
ClassMemberMappingDO
classMemberMappingDO
:
classMemberMappingDOS
){
for
(
String
classId
:
classIdArr
)
{
List
<
VodPlayStateVO
>
vodPlayStateVOS
=
vodDictMapper
.
testPlays
(
classMemberMappingDO
.
getMemberId
());
List
<
ClassMemberMappingDO
>
classMemberMappingDOS
=
classMemberMappingMapper
.
selectList
(
new
QueryWrapper
<
ClassMemberMappingDO
>()
for
(
int
i
=
0
;
i
<
vodPlayStateVOS
.
size
()
;
i
++){
.
lambda
()
for
(
int
k
=
i
+
1
;
k
<
vodPlayStateVOS
.
size
()
;
k
++){
.
eq
(
ClassMemberMappingDO:
:
getClassId
,
classId
));
VodPlayStateVO
vodPlayStateVO
=
vodPlayStateVOS
.
get
(
k
);
for
(
ClassMemberMappingDO
classMemberMappingDO
:
classMemberMappingDOS
)
{
VodPlayStateVO
vodPlayStateVO1
=
vodPlayStateVOS
.
get
(
i
);
List
<
VodPlayStateVO
>
vodPlayStateVOS
=
vodDictMapper
.
testPlays
(
classMemberMappingDO
.
getMemberId
());
if
(
vodPlayStateVO
.
getStartDate
().
after
(
vodPlayStateVO1
.
getStartDate
())
&&
vodPlayStateVO
.
getStartDate
().
before
(
vodPlayStateVO1
.
getEndDate
())){
for
(
int
i
=
0
;
i
<
vodPlayStateVOS
.
size
();
i
++)
{
System
.
out
.
println
(
"11111111111111111111111"
+
vodPlayStateVO
);
for
(
int
k
=
i
+
1
;
k
<
vodPlayStateVOS
.
size
();
k
++)
{
result
.
add
(
vodPlayStateVO
.
getId
());
VodPlayStateVO
vodPlayStateVO
=
vodPlayStateVOS
.
get
(
k
);
VodPlayStateVO
vodPlayStateVO1
=
vodPlayStateVOS
.
get
(
i
);
if
(
vodPlayStateVO
.
getStartDate
().
after
(
vodPlayStateVO1
.
getStartDate
())
&&
vodPlayStateVO
.
getStartDate
().
before
(
vodPlayStateVO1
.
getEndDate
()))
{
// System.out.println(vodPlayStateVO);
//这一条数据有问题
//查看这个人 这个课程 当天的全部数据 按照createDate升序排序
List
<
VodPlayHistoryDO
>
vodPlayHistoryDOS
=
this
.
baseMapper
.
getVodPlayDay
(
Long
.
valueOf
(
classId
),
vodPlayStateVO
.
getMemberId
(),
vodPlayStateVO
.
getEndDate
());
//从第一条开始看,顺延减去第二条的playlength得到第二条的create_date 以此类推
for
(
int
l
=
0
;
l
<
vodPlayHistoryDOS
.
size
()
-
1
;
l
++)
{
VodPlayHistoryDO
vph1
=
vodPlayHistoryDOS
.
get
(
l
);
VodPlayHistoryDO
vph2
=
vodPlayHistoryDOS
.
get
(
l
+
1
);
// playLength += vph2.getPlayLength();
LocalDateTime
dateTmp
=
vph1
.
getCreateDate
().
minusSeconds
(-
vph2
.
getPlayLength
()
-
getRandom1_2
());
vph2
.
setCreateDate
(
dateTmp
);
this
.
baseMapper
.
updateById
(
vph2
);
// result.add(vodPlayStateVO.getId());
}
}
}
}
}
}
}
}
}
return
result
;
}
}
return
result
;
}
//19为基数的话,3次签到6.5到8,4次签到4.8-6,
// 5次4-6,6次3.2-6,7次及以上2.5-6吧
//int randNumber =rand.nextInt(MAX - MIN + 1) + MIN;
//19为基数的话,3次签到6.5到8,4次签到4.8-6,
// 5次4-6,6次3.2-6,7次及以上2.5-6吧
//int randNumber =rand.nextInt(MAX - MIN + 1) + MIN;
/**
/**
* 3次签到 23400---28800
* 3次签到 23400---28800
*/
*/
public
Integer
_3times
()
{
public
Integer
_3times
()
{
return
new
Random
().
nextInt
(
28800
-
23400
+
1
)
+
23400
;
return
new
Random
().
nextInt
(
28800
-
23400
+
1
)
+
23400
;
}
}
/**
* 4次签到 23400---28800
*/
public
Integer
_4times
()
{
return
new
Random
().
nextInt
(
6
*
60
*
60
-
48
*
6
*
60
+
1
)
+
48
*
6
*
60
;
}
/**
* 5次签到 23400---28800
*/
public
Integer
_5times
()
{
return
new
Random
().
nextInt
(
6
*
60
*
60
-
4
*
60
*
60
+
1
)
+
4
*
60
*
60
;
}
/**
/**
* 6
次签到 23400---28800
* 4
次签到 23400---28800
*/
*/
public
Integer
_6times
()
{
public
Integer
_4times
()
{
return
new
Random
().
nextInt
(
6
*
60
*
60
-
32
*
6
*
60
+
1
)
+
32
*
60
*
6
;
return
new
Random
().
nextInt
(
6
*
60
*
60
-
48
*
6
*
60
+
1
)
+
48
*
6
*
60
;
}
}
/**
/**
* 7
次签到 23400---28800
* 5
次签到 23400---28800
*/
*/
public
Integer
_7times
()
{
public
Integer
_5times
()
{
return
new
Random
().
nextInt
(
6
*
60
*
60
-
25
*
6
*
60
+
1
)
+
25
*
6
*
60
;
return
new
Random
().
nextInt
(
6
*
60
*
60
-
4
*
60
*
60
+
1
)
+
4
*
60
*
60
;
}
}
public
static
void
main
(
String
[]
args
)
{
/**
* 6次签到 23400---28800
*/
public
Integer
_6times
()
{
return
new
Random
().
nextInt
(
6
*
60
*
60
-
32
*
6
*
60
+
1
)
+
32
*
60
*
6
;
}
while
(
true
)
{
/**
System
.
out
.
println
(
getRandom
());
* 7次签到 23400---28800
*/
public
Integer
_7times
()
{
return
new
Random
().
nextInt
(
6
*
60
*
60
-
25
*
6
*
60
+
1
)
+
25
*
6
*
60
;
}
}
public
static
void
main
(
String
[]
args
){
while
(
true
)
{
System
.
out
.
println
(
getRandom
());
}
// int m = 0;
// int m = 0;
//
//
// int signInrecord = 4;
// int signInrecord = 4;
...
@@ -752,18 +769,22 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
...
@@ -752,18 +769,22 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
// System.out.println(integer+"=====");
// System.out.println(integer+"=====");
// }
// }
//while (true) {
//while (true) {
// int i = getRandom();
// int i = getRandom();
// System.out.println(i + "============");
// System.out.println(i + "============");
// if (i > 11 || i < 5) {
// if (i > 11 || i < 5) {
// System.out.println("error");
// System.out.println("error");
// }
// }
//}
//}
}
}
public
static
Integer
getRandom
()
{
public
static
Integer
getRandom
()
{
return
(
int
)
(
Math
.
random
()
*
11
/
2
+
5
);
return
(
int
)
(
Math
.
random
()
*
3
/
2
+
5
);
}
}
public
static
Integer
getRandom1_2
()
{
return
(
int
)
(
Math
.
random
()
*
3
/
2
+
1
);
}
}
}
src/main/java/com/subsidy/util/BaseModel.java
View file @
a28c0db
...
@@ -16,7 +16,7 @@ public abstract class BaseModel {
...
@@ -16,7 +16,7 @@ public abstract class BaseModel {
* 创建时间
* 创建时间
*/
*/
@JsonIgnore
@JsonIgnore
@TableField
(
insertStrategy
=
FieldStrategy
.
NEVER
,
updateStrategy
=
FieldStrategy
.
NEVER
,
value
=
"create_date"
,
fill
=
FieldFill
.
INSERT
)
//
@TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER, value = "create_date", fill = FieldFill.INSERT)
private
LocalDateTime
createDate
;
private
LocalDateTime
createDate
;
/**
/**
...
...
src/main/java/com/subsidy/util/websocket/ChatEndPoint.java
View file @
a28c0db
...
@@ -6,6 +6,7 @@ import org.springframework.stereotype.Component;
...
@@ -6,6 +6,7 @@ import org.springframework.stereotype.Component;
import
javax.servlet.http.HttpSession
;
import
javax.servlet.http.HttpSession
;
import
javax.websocket.*
;
import
javax.websocket.*
;
import
javax.websocket.server.ServerEndpoint
;
import
javax.websocket.server.ServerEndpoint
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
...
@@ -77,7 +78,7 @@ public class ChatEndPoint {
...
@@ -77,7 +78,7 @@ public class ChatEndPoint {
/**
/**
* 接收到客户端发送的数据时候被调用
* 接收到客户端发送的数据时候被调用
*/
*/
@OnMessage
@OnMessage
(
maxMessageSize
=
102400
)
public
void
onMessage
(
String
msg
,
Session
session
)
{
public
void
onMessage
(
String
msg
,
Session
session
)
{
try
{
try
{
...
...
src/main/java/com/subsidy/vo/vod/VodPlayStateVO.java
View file @
a28c0db
...
@@ -2,6 +2,7 @@ package com.subsidy.vo.vod;
...
@@ -2,6 +2,7 @@ package com.subsidy.vo.vod;
import
lombok.Data
;
import
lombok.Data
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
import
java.util.Date
;
@Data
@Data
...
@@ -15,6 +16,8 @@ public class VodPlayStateVO {
...
@@ -15,6 +16,8 @@ public class VodPlayStateVO {
private
Date
endDate
;
private
Date
endDate
;
private
Integer
playLength
;
private
Long
playLength
;
private
LocalDateTime
createDate
;
}
}
src/main/resources/application.properties
View file @
a28c0db
# 环境配置
# 环境配置
spring.profiles.active
=
dev
spring.profiles.active
=
prod
# 端口号
# 端口号
spring.server.port
=
2345
7
spring.server.port
=
2345
9
#嵌入tomcat配置
#嵌入tomcat配置
#和CPU数
#和CPU数
spring.server.acceptorThreadCount
=
600
spring.server.acceptorThreadCount
=
600
...
...
src/main/resources/code.properties
View file @
a28c0db
...
@@ -63,4 +63,7 @@ meishu.code-message[15002]=类型已存在证书,删除失败
...
@@ -63,4 +63,7 @@ meishu.code-message[15002]=类型已存在证书,删除失败
meishu.code-message[16001]=该条件已存在
meishu.code-message[16001]=该条件已存在
meishu.code-message[17001]=系统不支持
00
:
00:00~06:00:00学习
src/main/resources/mapper/VodDictMapper.xml
View file @
a28c0db
...
@@ -97,7 +97,8 @@
...
@@ -97,7 +97,8 @@
member_id,
member_id,
DATE_SUB( create_date, INTERVAL play_length SECOND ) AS start_date,
DATE_SUB( create_date, INTERVAL play_length SECOND ) AS start_date,
create_date AS end_date,
create_date AS end_date,
t.play_length
t.play_length,
create_date
FROM
FROM
vod_play_history t
vod_play_history t
where t.member_id = #{memberId}
where t.member_id = #{memberId}
...
...
src/main/resources/mapper/VodPlayHistoryMapper.xml
View file @
a28c0db
...
@@ -384,4 +384,18 @@
...
@@ -384,4 +384,18 @@
t3.vod_name
t3.vod_name
</select>
</select>
<select
id=
"getVodPlayDay"
parameterType=
"com.subsidy.model.VodPlayHistoryDO"
resultType=
"com.subsidy.model.VodPlayHistoryDO"
>
SELECT
*
FROM
vod_play_history t
WHERE
t.delete_date IS NULL
AND t.class_id = #{classId}
AND t.member_id = #{memberId}
AND DATE_FORMAT( t.create_date, '%Y-%m-%d' ) = DATE_FORMAT( #{endDate}, '%Y-%m-%d' )
ORDER BY
t.create_date
</select>
</mapper>
</mapper>
Write
Preview
Markdown
is supported
Attach a file
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 post a comment