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 b998e5ed
authored
Jan 20, 2022
by
涂亚平
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化后版本,跑数据脚本
1 parent
0ec73509
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
45 additions
and
87 deletions
src/main/java/com/subsidy/controller/MemberController.java
src/main/java/com/subsidy/controller/VodPlayHistoryController.java
src/main/java/com/subsidy/dto/member/MyCoursesDTO.java
src/main/java/com/subsidy/service/MemberService.java
src/main/java/com/subsidy/service/VodPlayHistoryService.java
src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
src/main/java/com/subsidy/vo/member/MyCoursesVO.java
src/main/resources/application.properties
src/main/java/com/subsidy/controller/MemberController.java
View file @
b998e5e
...
...
@@ -8,6 +8,7 @@ import com.subsidy.dto.administer.VerifyCodeDTO;
import
com.subsidy.dto.member.AddMemberDTO
;
import
com.subsidy.dto.member.ContentMemberDTO
;
import
com.subsidy.dto.member.GetAllDTO
;
import
com.subsidy.dto.member.MyCoursesDTO
;
import
com.subsidy.dto.member.PasswordLoginDTO
;
import
com.subsidy.dto.member.StudyHistoryDTO
;
import
com.subsidy.model.ExerciseDoneResultDO
;
...
...
@@ -90,8 +91,11 @@ public class MemberController {
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
studyPage
(
memberDO
));
}
//@PostMapping("MyCourse")
//@ApiOperation("我的课程")
@PostMapping
(
"myCourses"
)
@ApiOperation
(
"手机端:我的学习--课程 id 学员id status 状态 0:全部 1:进行中 2:待开始 3:已完成 "
)
public
ResponseVO
myCourses
(
@RequestBody
MyCoursesDTO
myCoursesDTO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
myCourses
(
myCoursesDTO
));
}
@PostMapping
(
"contentVod"
)
@ApiOperation
(
"手机端:目录+视频 courseId 课程 memberId 学员id"
)
...
...
src/main/java/com/subsidy/controller/VodPlayHistoryController.java
View file @
b998e5e
...
...
@@ -50,11 +50,6 @@ public class VodPlayHistoryController {
vodPlayHistoryService
.
dataFix
(
dataFixDTO
);
}
@PostMapping
(
"fixDataTwo"
)
public
void
dataFixTwo
(
@RequestBody
FixDataTwoDTO
fixDataTwoDTO
){
vodPlayHistoryService
.
dataFixTwo
(
fixDataTwoDTO
);
}
@PostMapping
(
"signDatePlays"
)
public
void
signDatePlays
(
@RequestBody
SignDatePlaysDTO
signDatePlaysDTO
){
vodPlayHistoryService
.
signDatePlays
(
signDatePlaysDTO
);
...
...
src/main/java/com/subsidy/dto/member/MyCoursesDTO.java
0 → 100644
View file @
b998e5e
package
com
.
subsidy
.
dto
.
member
;
import
lombok.Data
;
@Data
public
class
MyCoursesDTO
{
private
Long
memberId
;
private
Integer
status
;
private
Integer
pageSize
;
private
Integer
pageNum
;
}
src/main/java/com/subsidy/service/MemberService.java
View file @
b998e5e
...
...
@@ -6,6 +6,7 @@ import com.subsidy.dto.administer.VerifyCodeDTO;
import
com.subsidy.dto.member.AddMemberDTO
;
import
com.subsidy.dto.member.ContentMemberDTO
;
import
com.subsidy.dto.member.GetAllDTO
;
import
com.subsidy.dto.member.MyCoursesDTO
;
import
com.subsidy.dto.member.PasswordLoginDTO
;
import
com.subsidy.dto.member.StudyHistoryDTO
;
import
com.subsidy.model.ExerciseDoneResultDO
;
...
...
@@ -18,6 +19,7 @@ import com.subsidy.vo.member.GetAllVO;
import
com.subsidy.vo.member.GetStudyInfoVO
;
import
com.subsidy.vo.member.MemberStudyPageVO
;
import
com.subsidy.vo.member.MemberVO
;
import
com.subsidy.vo.member.MyCoursesVO
;
import
com.subsidy.vo.paper.QueryPapersVO
;
import
java.util.List
;
...
...
@@ -48,6 +50,8 @@ public interface MemberService extends IService<MemberDO> {
MemberStudyPageVO
studyPage
(
MemberDO
memberDO
);
IPage
<
MyCoursesVO
>
myCourses
(
MyCoursesDTO
myCoursesDTO
);
ContentVodNewVO
contentVod
(
ContentMemberDTO
contentVodDTO
);
List
<
ContentFilesVO
>
contentFiles
(
ContentMemberDTO
contentMemberDTO
);
...
...
src/main/java/com/subsidy/service/VodPlayHistoryService.java
View file @
b998e5e
...
...
@@ -21,7 +21,5 @@ public interface VodPlayHistoryService extends IService<VodPlayHistoryDO> {
void
dataFix
(
SignDatePlaysDTO
dataFixDTO
);
void
dataFixTwo
(
FixDataTwoDTO
fixDataTwoDTO
);
void
signDatePlays
(
SignDatePlaysDTO
dataFixDTO
);
}
src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
View file @
b998e5e
...
...
@@ -10,6 +10,7 @@ import com.subsidy.dto.administer.VerifyCodeDTO;
import
com.subsidy.dto.member.AddMemberDTO
;
import
com.subsidy.dto.member.ContentMemberDTO
;
import
com.subsidy.dto.member.GetAllDTO
;
import
com.subsidy.dto.member.MyCoursesDTO
;
import
com.subsidy.dto.member.PasswordLoginDTO
;
import
com.subsidy.dto.member.StudyHistoryDTO
;
import
com.subsidy.mapper.ClassDictMapper
;
...
...
@@ -47,6 +48,7 @@ import com.subsidy.vo.member.GetAllVO;
import
com.subsidy.vo.member.GetStudyInfoVO
;
import
com.subsidy.vo.member.MemberStudyPageVO
;
import
com.subsidy.vo.member.MemberVO
;
import
com.subsidy.vo.member.MyCoursesVO
;
import
com.subsidy.vo.member.StudyPageVO
;
import
com.subsidy.vo.paper.QueryPapersVO
;
import
org.springframework.beans.BeanUtils
;
...
...
@@ -387,6 +389,12 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
return
new
AsyncResult
<>(
studyPageVO
);
}
public
IPage
<
MyCoursesVO
>
myCourses
(
MyCoursesDTO
myCoursesDTO
){
return
null
;
}
public
ContentVodNewVO
contentVod
(
ContentMemberDTO
contentVodDTO
)
{
ContentVodNewVO
contentVodNewVO
=
new
ContentVodNewVO
();
...
...
src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
View file @
b998e5e
...
...
@@ -234,83 +234,6 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
}
}
public
void
dataFixTwo
(
FixDataTwoDTO
fixDataTwoDTO
)
{
//班级ids
List
<
String
>
classIds
=
Arrays
.
asList
(
new
String
[]{
fixDataTwoDTO
.
getClassId
()});
for
(
String
str
:
classIds
)
{
ClassDictDO
classDictDO
=
classDictMapper
.
selectById
(
str
);
//找到班级里的学生
List
<
ClassMemberMappingDO
>
classMemberMappingDOS
=
classMemberMappingMapper
.
selectList
(
new
QueryWrapper
<
ClassMemberMappingDO
>()
.
lambda
()
.
eq
(
ClassMemberMappingDO:
:
getClassId
,
Long
.
valueOf
(
str
)));
//查找课程里的所有视频
List
<
VodDictDO
>
vodDictDOS
=
courseContentMapper
.
getCourseVods
(
classDictDO
.
getCourseId
());
//遍历班级学生
for
(
ClassMemberMappingDO
classMemberMappingDO
:
classMemberMappingDOS
)
{
//查询这个人 这节课 签到记录 排序
List
<
LocalDateTime
>
localDateTimes
=
new
ArrayList
<>();
List
<
SignInRecordDO
>
signInRecordDOS
=
new
ArrayList
<>();
if
(
"2"
.
equals
(
fixDataTwoDTO
.
getStep
()))
{
signInRecordDOS
=
signInRecordMapper
.
selectList
(
new
QueryWrapper
<
SignInRecordDO
>()
.
lambda
()
.
eq
(
SignInRecordDO:
:
getMemberId
,
classMemberMappingDO
.
getMemberId
())
.
eq
(
SignInRecordDO:
:
getClassId
,
str
)
.
orderByDesc
(
SignInRecordDO:
:
getSignInDate
));
}
else
{
signInRecordDOS
=
signInRecordMapper
.
selectList
(
new
QueryWrapper
<
SignInRecordDO
>()
.
lambda
()
.
eq
(
SignInRecordDO:
:
getMemberId
,
classMemberMappingDO
.
getMemberId
())
.
eq
(
SignInRecordDO:
:
getClassId
,
str
)
.
orderByAsc
(
SignInRecordDO:
:
getSignInDate
));
}
for
(
SignInRecordDO
signInrecord
:
signInRecordDOS
)
{
if
(
signInrecord
.
getSignInDate
().
getHour
()
>=
6
&&
signInrecord
.
getSignInDate
().
getHour
()
<
15
)
{
localDateTimes
.
add
(
signInrecord
.
getSignInDate
());
}
}
if
(
localDateTimes
.
size
()
>
0
)
{
LocalDateTime
date
=
localDateTimes
.
get
(
0
);
//查看当天这人已经看的视频时长
List
<
VodPlayHistoryDO
>
vodPlayHistoryDOS
=
vodPlayHistoryMapper
.
exPlayInfo
(
classMemberMappingDO
.
getMemberId
(),
str
,
date
);
int
playLength
=
0
;
for
(
int
m
=
0
;
m
<
vodPlayHistoryDOS
.
size
();
m
++)
{
playLength
+=
vodPlayHistoryDOS
.
get
(
m
).
getPlayLength
();
}
int
playCounts
=
new
Random
().
nextInt
(
2
);
for
(
int
i
=
0
;
i
<
playCounts
;
i
++)
{
VodPlayHistoryDO
vodPlayHistoryDO
=
new
VodPlayHistoryDO
();
Random
random1
=
new
Random
();
int
j
=
random1
.
nextInt
(
vodDictDOS
.
size
());
vodPlayHistoryDO
.
setPlayCount
(
1
);
vodPlayHistoryDO
.
setClassId
(
Long
.
valueOf
(
str
));
vodPlayHistoryDO
.
setMemberId
(
classMemberMappingDO
.
getMemberId
());
int
h
=
new
Random
().
nextInt
(
vodDictDOS
.
get
(
j
).
getVodLength
()
-
10
)
+
1
;
vodPlayHistoryDO
.
setPlayRecord
(
h
);
vodPlayHistoryDO
.
setPlayLength
(
new
Random
().
nextInt
(
vodPlayHistoryDO
.
getPlayRecord
()));
playLength
+=
vodPlayHistoryDO
.
getPlayLength
();
vodPlayHistoryDO
.
setVodId
(
vodDictDOS
.
get
(
j
).
getId
());
vodPlayHistoryDO
.
setPlayDate
(
date
.
plusSeconds
(
playLength
));
vodPlayHistoryMapper
.
insert
(
vodPlayHistoryDO
);
}
}
}
}
}
public
void
signDatePlays
(
SignDatePlaysDTO
signDatePlaysDTO
)
{
//班级ids
...
...
src/main/java/com/subsidy/vo/member/MyCoursesVO.java
0 → 100644
View file @
b998e5e
package
com
.
subsidy
.
vo
.
member
;
import
lombok.Data
;
@Data
public
class
MyCoursesVO
{
}
src/main/resources/application.properties
View file @
b998e5e
# 环境配置
spring.profiles.active
=
dev
# 端口号
spring.server.port
=
234
57
spring.server.port
=
234
60
#嵌入tomcat配置
#和CPU数
spring.server.acceptorThreadCount
=
600
...
...
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