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 0ec73509
authored
Jan 20, 2022
by
涂亚平
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化后版本,跑数据脚本
1 parent
57bd5af7
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
257 additions
and
65 deletions
src/main/java/com/subsidy/controller/AnsweringQuestionController.java
src/main/java/com/subsidy/controller/MemberController.java
src/main/java/com/subsidy/controller/OprMemDictController.java
src/main/java/com/subsidy/controller/VodPlayHistoryController.java
src/main/java/com/subsidy/dto/GetCourseQuestionDTO.java → src/main/java/com/subsidy/dto/course/GetCourseQuestionDTO.java
src/main/java/com/subsidy/dto/vod/DataFixTwoDTO.java
src/main/java/com/subsidy/dto/vod/FixDataTwoDTO.java
src/main/java/com/subsidy/dto/vod/SignDatePlaysDTO.java
src/main/java/com/subsidy/model/OprMemDictDO.java
src/main/java/com/subsidy/service/AnsweringQuestionService.java
src/main/java/com/subsidy/service/OprMemDictService.java
src/main/java/com/subsidy/service/VodPlayHistoryService.java
src/main/java/com/subsidy/service/impl/AnsweringQuestionServiceImpl.java
src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
src/main/java/com/subsidy/service/impl/OprMemDictServiceImpl.java
src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
src/main/java/com/subsidy/vo/member/MemberStudyPageVO.java
src/main/java/com/subsidy/vo/member/StudyPageVO.java
src/main/resources/mapper/CourseContentMapper.xml
src/main/resources/mapper/VodPlayHistoryMapper.xml
src/main/java/com/subsidy/controller/AnsweringQuestionController.java
View file @
0ec7350
...
...
@@ -3,7 +3,7 @@ package com.subsidy.controller;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.dto.GetCourseQuestionDTO
;
import
com.subsidy.dto.
course.
GetCourseQuestionDTO
;
import
com.subsidy.model.AnsweringQuestionDO
;
import
com.subsidy.service.AnsweringQuestionService
;
import
io.swagger.annotations.Api
;
...
...
src/main/java/com/subsidy/controller/MemberController.java
View file @
0ec7350
...
...
@@ -85,11 +85,14 @@ public class MemberController {
}
@PostMapping
(
"studyPage"
)
@ApiOperation
(
"手机端:学习主页 id 学员id"
)
@ApiOperation
(
"
[废弃]
手机端:学习主页 id 学员id"
)
public
ResponseVO
studyPage
(
@RequestBody
MemberDO
memberDO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
studyPage
(
memberDO
));
}
//@PostMapping("MyCourse")
//@ApiOperation("我的课程")
@PostMapping
(
"contentVod"
)
@ApiOperation
(
"手机端:目录+视频 courseId 课程 memberId 学员id"
)
public
ResponseVO
contentVod
(
@RequestBody
ContentMemberDTO
contentVodDTO
){
...
...
src/main/java/com/subsidy/controller/OprMemDictController.java
View file @
0ec7350
...
...
@@ -29,9 +29,8 @@ public class OprMemDictController {
@Autowired
private
OprMemDictService
oprMemDictService
;
@PostMapping
(
"getHistory"
)
@ApiOperation
(
"
###
获取学员审计 {pageSize pageNum userName startDate endDate}"
)
@ApiOperation
(
"获取学员审计 {pageSize pageNum userName startDate endDate}"
)
public
ResponseVO
getHistory
(
@RequestBody
GetHistoryDTO
getHistoryDTO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
oprMemDictService
.
getHistory
(
getHistoryDTO
));
}
...
...
src/main/java/com/subsidy/controller/VodPlayHistoryController.java
View file @
0ec7350
...
...
@@ -4,6 +4,8 @@ package com.subsidy.controller;
import
com.alibaba.fastjson.JSON
;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.dto.vod.SignDatePlaysDTO
;
import
com.subsidy.dto.vod.FixDataTwoDTO
;
import
com.subsidy.model.VodPlayHistoryDO
;
import
com.subsidy.service.VodPlayHistoryService
;
import
io.swagger.annotations.Api
;
...
...
@@ -44,12 +46,17 @@ public class VodPlayHistoryController {
}
@PostMapping
(
"dataFix"
)
public
void
dadaFix
(){
vodPlayHistoryService
.
dataFix
();
public
void
dadaFix
(
@RequestBody
SignDatePlaysDTO
dataFixDTO
){
vodPlayHistoryService
.
dataFix
(
dataFixDTO
);
}
@PostMapping
(
"fixDataTwo"
)
public
void
dataFixTwo
(){
vodPlayHistoryService
.
dataFixTwo
();
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/GetCourseQuestionDTO.java
→
src/main/java/com/subsidy/dto/
course/
GetCourseQuestionDTO.java
View file @
0ec7350
package
com
.
subsidy
.
dto
;
package
com
.
subsidy
.
dto
.
course
;
import
lombok.Data
;
...
...
src/main/java/com/subsidy/dto/vod/DataFixTwoDTO.java
0 → 100644
View file @
0ec7350
package
com
.
subsidy
.
dto
.
vod
;
import
lombok.Data
;
@Data
public
class
DataFixTwoDTO
{
private
Integer
classId
;
}
src/main/java/com/subsidy/dto/vod/FixDataTwoDTO.java
0 → 100644
View file @
0ec7350
package
com
.
subsidy
.
dto
.
vod
;
import
lombok.Data
;
@Data
public
class
FixDataTwoDTO
{
private
String
classId
;
private
String
step
;
}
src/main/java/com/subsidy/dto/vod/SignDatePlaysDTO.java
0 → 100644
View file @
0ec7350
package
com
.
subsidy
.
dto
.
vod
;
import
lombok.Data
;
@Data
public
class
SignDatePlaysDTO
{
private
String
classId
;
}
src/main/java/com/subsidy/model/OprMemDictDO.java
View file @
0ec7350
...
...
@@ -44,4 +44,6 @@ public class OprMemDictDO {
* 创建时间
*/
private
String
createDate
;
private
String
userName
;
}
src/main/java/com/subsidy/service/AnsweringQuestionService.java
View file @
0ec7350
package
com
.
subsidy
.
service
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.subsidy.dto.GetCourseQuestionDTO
;
import
com.subsidy.dto.
course.
GetCourseQuestionDTO
;
import
com.subsidy.model.AnsweringQuestionDO
;
import
com.baomidou.mybatisplus.extension.service.IService
;
...
...
src/main/java/com/subsidy/service/OprMemDictService.java
View file @
0ec7350
...
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.subsidy.dto.opr.GetHistoryDTO
;
import
com.subsidy.model.OprMemDictDO
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.subsidy.mongodb.PageVO
;
import
com.subsidy.vo.opr.GetHistoryVO
;
/**
...
...
@@ -16,6 +17,6 @@ import com.subsidy.vo.opr.GetHistoryVO;
*/
public
interface
OprMemDictService
extends
IService
<
OprMemDictDO
>
{
IPage
<
GetHistoryVO
>
getHistory
(
GetHistoryDTO
getHistoryDTO
);
PageVO
<
GetHistoryVO
>
getHistory
(
GetHistoryDTO
getHistoryDTO
);
}
src/main/java/com/subsidy/service/VodPlayHistoryService.java
View file @
0ec7350
package
com
.
subsidy
.
service
;
import
com.subsidy.dto.vod.SignDatePlaysDTO
;
import
com.subsidy.dto.vod.FixDataTwoDTO
;
import
com.subsidy.model.VodPlayHistoryDO
;
import
com.baomidou.mybatisplus.extension.service.IService
;
...
...
@@ -17,7 +19,9 @@ public interface VodPlayHistoryService extends IService<VodPlayHistoryDO> {
String
insertHistoryNew
(
VodPlayHistoryDO
vodPlayHistoryDO
);
void
dataFix
();
void
dataFix
(
SignDatePlaysDTO
dataFixDTO
);
void
dataFixTwo
();
void
dataFixTwo
(
FixDataTwoDTO
fixDataTwoDTO
);
void
signDatePlays
(
SignDatePlaysDTO
dataFixDTO
);
}
src/main/java/com/subsidy/service/impl/AnsweringQuestionServiceImpl.java
View file @
0ec7350
...
...
@@ -3,13 +3,12 @@ package com.subsidy.service.impl;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.subsidy.dto.GetCourseQuestionDTO
;
import
com.subsidy.dto.
course.
GetCourseQuestionDTO
;
import
com.subsidy.model.AnsweringQuestionDO
;
import
com.subsidy.mapper.AnsweringQuestionMapper
;
import
com.subsidy.service.AnsweringQuestionService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.subsidy.util.ConstantUtils
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
/**
...
...
src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
View file @
0ec7350
...
...
@@ -235,6 +235,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
oprMemDictDO
.
setUserId
(
memberDO
.
getId
());
oprMemDictDO
.
setOprType
(
"登录"
);
oprMemDictDO
.
setResult
(
0
);
oprMemDictDO
.
setUserName
(
memberDO
.
getUserName
());
oprMemDictDO
.
setCreateDate
(
System
.
currentTimeMillis
()+
""
);
oprMemDictDO
.
setLoginDateFormat
(
DateFormatUtil
.
format
(
new
Date
(),
"yyyyMMdd"
));
mongoTemplate
.
insert
(
oprMemDictDO
);
...
...
@@ -257,6 +258,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
oprMemDictDO
.
setUserId
(
memberDO
.
getId
());
oprMemDictDO
.
setOprType
(
"登录"
);
oprMemDictDO
.
setResult
(
0
);
oprMemDictDO
.
setUserName
(
memberDO
.
getUserName
());
oprMemDictDO
.
setCreateDate
(
System
.
currentTimeMillis
()+
""
);
oprMemDictDO
.
setLoginDateFormat
(
DateFormatUtil
.
format
(
new
Date
(),
"yyyyMMdd"
));
mongoTemplate
.
insert
(
oprMemDictDO
);
...
...
@@ -267,6 +269,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
OprMemDictDO
oprMemDictDO
=
new
OprMemDictDO
();
oprMemDictDO
.
setUserId
(
memberDO
.
getId
());
oprMemDictDO
.
setOprType
(
"登录"
);
oprMemDictDO
.
setUserName
(
memberDO
.
getUserName
());
oprMemDictDO
.
setResult
(
1
);
oprMemDictDO
.
setCreateDate
(
System
.
currentTimeMillis
()+
""
);
oprMemDictDO
.
setLoginDateFormat
(
DateFormatUtil
.
format
(
new
Date
(),
"yyyyMMdd"
));
...
...
@@ -300,6 +303,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
oprMemDictDO
.
setUserId
(
memberDO
.
getId
());
oprMemDictDO
.
setOprType
(
"登录"
);
oprMemDictDO
.
setResult
(
1
);
oprMemDictDO
.
setUserName
(
memberDO
.
getUserName
());
oprMemDictDO
.
setCreateDate
(
System
.
currentTimeMillis
()+
""
);
oprMemDictDO
.
setLoginDateFormat
(
DateFormatUtil
.
format
(
new
Date
(),
"yyyyMMdd"
));
mongoTemplate
.
insert
(
oprMemDictDO
);
...
...
@@ -311,6 +315,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
oprMemDictDO
.
setUserId
(
memberDO
.
getId
());
oprMemDictDO
.
setOprType
(
"登录"
);
oprMemDictDO
.
setResult
(
0
);
oprMemDictDO
.
setUserName
(
memberDO
.
getUserName
());
oprMemDictDO
.
setCreateDate
(
System
.
currentTimeMillis
()+
""
);
oprMemDictDO
.
setLoginDateFormat
(
DateFormatUtil
.
format
(
new
Date
(),
"yyyyMMdd"
));
mongoTemplate
.
insert
(
oprMemDictDO
);
...
...
@@ -322,6 +327,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
oprMemDictDO
.
setUserId
(
memberDO
.
getId
());
oprMemDictDO
.
setOprType
(
"登录"
);
oprMemDictDO
.
setResult
(
0
);
oprMemDictDO
.
setUserName
(
memberDO
.
getUserName
());
oprMemDictDO
.
setCreateDate
(
System
.
currentTimeMillis
()+
""
);
oprMemDictDO
.
setLoginDateFormat
(
DateFormatUtil
.
format
(
new
Date
(),
"yyyyMMdd"
));
mongoTemplate
.
insert
(
oprMemDictDO
);
...
...
@@ -372,11 +378,11 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
i
+=
completeVodOrNot
;
}
studyPageVO
.
setDoneVods
(
i
);
//该班级课程下有多少人
Integer
count
=
classMemberMappingMapper
.
selectCount
(
new
QueryWrapper
<
ClassMemberMappingDO
>()
.
lambda
()
.
eq
(
ClassMemberMappingDO:
:
getClassId
,
studyPageVO
.
getClassId
()));
studyPageVO
.
setTotalMember
(
count
);
//
//
该班级课程下有多少人
//
Integer count = classMemberMappingMapper.selectCount(new QueryWrapper<ClassMemberMappingDO>()
//
.lambda()
//
.eq(ClassMemberMappingDO::getClassId, studyPageVO.getClassId()));
//
studyPageVO.setTotalMember(count);
return
new
AsyncResult
<>(
studyPageVO
);
}
...
...
src/main/java/com/subsidy/service/impl/OprMemDictServiceImpl.java
View file @
0ec7350
...
...
@@ -3,13 +3,29 @@ package com.subsidy.service.impl;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.subsidy.dto.opr.GetHistoryDTO
;
import
com.subsidy.mapper.CompanyDictMapper
;
import
com.subsidy.mapper.MemberMapper
;
import
com.subsidy.model.AdministerDO
;
import
com.subsidy.model.CompanyDictDO
;
import
com.subsidy.model.MemberDO
;
import
com.subsidy.model.OprMemDictDO
;
import
com.subsidy.mapper.OprMemDictMapper
;
import
com.subsidy.mongodb.OprAdmDictDO
;
import
com.subsidy.mongodb.PageVO
;
import
com.subsidy.service.OprMemDictService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.subsidy.util.MongoUtil
;
import
com.subsidy.vo.opr.GetHistoryVO
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* <p>
* 审计表 服务实现类
...
...
@@ -21,10 +37,44 @@ import org.springframework.stereotype.Service;
@Service
public
class
OprMemDictServiceImpl
extends
ServiceImpl
<
OprMemDictMapper
,
OprMemDictDO
>
implements
OprMemDictService
{
@Autowired
private
MongoTemplate
mongoTemplate
;
@Autowired
private
MongoUtil
mongoUtil
;
@Autowired
private
MemberMapper
memberMapper
;
@Autowired
private
CompanyDictMapper
companyDictMapper
;
public
PageVO
<
GetHistoryVO
>
getHistory
(
GetHistoryDTO
getHistoryDTO
)
{
PageVO
pageVO
=
new
PageVO
();
List
<
GetHistoryVO
>
getHistoryVOS
=
new
ArrayList
<>();
//可累加条件
Query
query
=
new
Query
(
Criteria
.
where
(
"userName"
).
regex
(
getHistoryDTO
.
getUserName
())
.
andOperator
(
Criteria
.
where
(
"loginDateFormat"
).
gte
(
getHistoryDTO
.
getStartDate
()),
Criteria
.
where
(
"loginDateFormat"
).
lte
(
getHistoryDTO
.
getEndDate
())));
Long
count
=
mongoTemplate
.
count
(
query
,
OprMemDictDO
.
class
);
mongoUtil
.
start
(
getHistoryDTO
.
getPageNum
(),
getHistoryDTO
.
getPageSize
(),
query
);
List
<
OprMemDictDO
>
oprMemDictDOS
=
mongoTemplate
.
find
(
query
,
OprMemDictDO
.
class
);
for
(
OprMemDictDO
oprMemDictDO
:
oprMemDictDOS
)
{
MemberDO
memberDO
=
memberMapper
.
selectById
(
oprMemDictDO
.
getUserId
());
CompanyDictDO
companyDictDO
=
companyDictMapper
.
selectById
(
memberDO
.
getCompanyId
());
GetHistoryVO
getHistoryVO
=
new
GetHistoryVO
();
BeanUtils
.
copyProperties
(
oprMemDictDO
,
getHistoryVO
);
getHistoryVO
.
setCompanyName
(
companyDictDO
.
getCompanyName
());
getHistoryVO
.
setUserName
(
memberDO
.
getUserName
());
getHistoryVOS
.
add
(
getHistoryVO
);
}
pageVO
.
setRecords
(
getHistoryVOS
);
pageVO
.
setTotal
(
count
);
public
IPage
<
GetHistoryVO
>
getHistory
(
GetHistoryDTO
getHistoryDTO
){
Page
pager
=
new
Page
(
getHistoryDTO
.
getPageNum
(),
getHistoryDTO
.
getPageSize
());
return
this
.
baseMapper
.
getHistory
(
pager
,
getHistoryDTO
.
getUserName
(),
getHistoryDTO
.
getStartDate
(),
getHistoryDTO
.
getEndDate
());
return
pageVO
;
}
...
...
src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
View file @
0ec7350
package
com
.
subsidy
.
service
.
impl
;
import
com.amdelamar.jhash.Hash
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.subsidy.mapper.*
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.subsidy.dto.vod.FixDataTwoDTO
;
import
com.subsidy.dto.vod.SignDatePlaysDTO
;
import
com.subsidy.mapper.ClassDictMapper
;
import
com.subsidy.mapper.ClassMemberMappingMapper
;
import
com.subsidy.mapper.CourseContentMapper
;
import
com.subsidy.mapper.SignInRecordMapper
;
import
com.subsidy.mapper.VodDictMapper
;
import
com.subsidy.mapper.VodPlayHistoryMapper
;
import
com.subsidy.model.ClassDictDO
;
import
com.subsidy.model.ClassMemberMappingDO
;
import
com.subsidy.model.SignInRecordDO
;
import
com.subsidy.model.VodDictDO
;
import
com.subsidy.model.VodPlayHistoryDO
;
import
com.subsidy.service.VodDictService
;
import
com.subsidy.service.VodPlayHistoryService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.subsidy.util.ConstantUtils
;
import
com.subsidy.util.DateFormatUtil
;
import
com.subsidy.util.MathUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Random
;
/**
* <p>
...
...
@@ -64,10 +68,10 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
return
ConstantUtils
.
ADD_SUCCESS
;
}
public
void
dataFix
()
{
public
void
dataFix
(
SignDatePlaysDTO
dataFixDTO
)
{
//班级ids
List
<
String
>
classIds
=
Arrays
.
asList
(
new
String
[]{
"28"
});
List
<
String
>
classIds
=
Arrays
.
asList
(
new
String
[]{
dataFixDTO
.
getClassId
()
});
for
(
String
str
:
classIds
)
{
...
...
@@ -90,7 +94,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
.
lambda
()
.
eq
(
SignInRecordDO:
:
getMemberId
,
classMemberMappingDO
.
getMemberId
())
.
eq
(
SignInRecordDO:
:
getClassId
,
str
)
.
orderBy
De
sc
(
SignInRecordDO:
:
getSignInDate
));
.
orderBy
A
sc
(
SignInRecordDO:
:
getSignInDate
));
List
<
LocalDateTime
>
localDateTimes
=
new
ArrayList
<>();
for
(
SignInRecordDO
signInrecord
:
signInRecordDOS
)
{
if
(
signInrecord
.
getSignInDate
().
getHour
()
>=
6
&&
signInrecord
.
getSignInDate
().
getHour
()
<
15
)
{
...
...
@@ -194,7 +198,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
vodPlayHistoryDO
.
setPlayDate
(
localDateTime
.
plusSeconds
(
totalPlay
));
vodPlayHistoryMapper
.
insert
(
vodPlayHistoryDO
);
alreadyPlay
++;
}
else
{
}
else
{
//当天看的最后一个视频
VodPlayHistoryDO
vodPlayHistoryDO
=
new
VodPlayHistoryDO
();
vodPlayHistoryDO
.
setPlayCount
(
1
);
...
...
@@ -230,10 +234,10 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
}
}
public
void
dataFixTwo
()
{
public
void
dataFixTwo
(
FixDataTwoDTO
fixDataTwoDTO
)
{
//班级ids
List
<
String
>
classIds
=
Arrays
.
asList
(
new
String
[]{
"28"
});
List
<
String
>
classIds
=
Arrays
.
asList
(
new
String
[]{
fixDataTwoDTO
.
getClassId
()
});
for
(
String
str
:
classIds
)
{
...
...
@@ -253,17 +257,27 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
//查询这个人 这节课 签到记录 排序
List
<
LocalDateTime
>
localDateTimes
=
new
ArrayList
<>();
List
<
SignInRecordDO
>
signInRecordDOS
=
signInRecordMapper
.
selectList
(
new
QueryWrapper
<
SignInRecordDO
>()
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
)
{
if
(
localDateTimes
.
size
()
>
0
)
{
LocalDateTime
date
=
localDateTimes
.
get
(
0
);
//查看当天这人已经看的视频时长
...
...
@@ -274,7 +288,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
for
(
int
m
=
0
;
m
<
vodPlayHistoryDOS
.
size
();
m
++)
{
playLength
+=
vodPlayHistoryDOS
.
get
(
m
).
getPlayLength
();
}
int
playCounts
=
new
Random
().
nextInt
(
2
)
+
1
;
int
playCounts
=
new
Random
().
nextInt
(
2
);
for
(
int
i
=
0
;
i
<
playCounts
;
i
++)
{
VodPlayHistoryDO
vodPlayHistoryDO
=
new
VodPlayHistoryDO
();
...
...
@@ -297,6 +311,70 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
}
}
public
void
signDatePlays
(
SignDatePlaysDTO
signDatePlaysDTO
)
{
//班级ids
List
<
String
>
classIds
=
Arrays
.
asList
(
new
String
[]{
signDatePlaysDTO
.
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
=
signInRecordMapper
.
selectList
(
new
QueryWrapper
<
SignInRecordDO
>()
.
lambda
()
.
eq
(
SignInRecordDO:
:
getMemberId
,
classMemberMappingDO
.
getMemberId
())
.
eq
(
SignInRecordDO:
:
getClassId
,
str
));
for
(
SignInRecordDO
signInrecord
:
signInRecordDOS
)
{
localDateTimes
.
add
(
signInrecord
.
getSignInDate
());
}
if
(
localDateTimes
.
size
()
>
0
)
{
for
(
LocalDateTime
localDateTime
:
localDateTimes
)
{
//查看当天这人已经看的视频时长
List
<
VodPlayHistoryDO
>
vodPlayHistoryDOS
=
vodPlayHistoryMapper
.
exPlayInfo
(
classMemberMappingDO
.
getMemberId
(),
str
,
localDateTime
);
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
(
localDateTime
.
plusSeconds
(
playLength
));
vodPlayHistoryMapper
.
insert
(
vodPlayHistoryDO
);
}
}
}
}
}
}
public
int
severalPlays
(
Long
classId
,
Long
memberId
,
Long
vodId
,
int
playLength
,
LocalDateTime
localDateTime
,
List
<
VodDictDO
>
vodDictDOS
)
{
Random
random
=
new
Random
();
...
...
src/main/java/com/subsidy/vo/member/MemberStudyPageVO.java
View file @
0ec7350
...
...
@@ -17,5 +17,6 @@ public class MemberStudyPageVO {
private
String
img
;
private
String
logo
;
//private String logo;
}
src/main/java/com/subsidy/vo/member/StudyPageVO.java
View file @
0ec7350
...
...
@@ -11,16 +11,12 @@ public class StudyPageVO {
private
String
courseName
;
private
String
endDate
;
private
Integer
diffDates
;
private
Integer
totalVods
;
private
Integer
doneVods
;
private
Integer
totalMember
;
private
Integer
doneMember
;
private
String
className
;
//private String className;
}
src/main/resources/mapper/CourseContentMapper.xml
View file @
0ec7350
...
...
@@ -50,15 +50,25 @@
t3.vod_length,
t3.vod_name,
t3.vod_url,
floor( t2.play_record * 100 / t3.vod_length ) AS percent,
IF
( t2.play_record >= t3.vod_length * 0.8, 'true', 'false' ) AS STATUS
sum( t2.play_length ) AS play_length
FROM
vod_play_history t2
LEFT JOIN vod_dict t3 ON t2.vod_id = t3.id
WHERE
t2.vod_id IN ( SELECT id FROM vod_dict t WHERE t.content_id = #{contentId} )
t2.delete_date IS NULL
AND t3.delete_date IS NULL
AND t2.vod_id IN (
SELECT
id
FROM
vod_dict t
WHERE
t.content_id = #{contentId} )
AND t2.member_id = #{memberId}
GROUP BY
t3.id,
t3.vod_name,
t2.member_id
</select>
<select
id=
"contentFiles"
parameterType=
"long"
resultType=
"com.subsidy.model.FileDictDO"
>
...
...
src/main/resources/mapper/VodPlayHistoryMapper.xml
View file @
0ec7350
...
...
@@ -34,30 +34,32 @@
t2.vod_url,
t2.vod_name,
t3.play_record,
if(round( t3.play_record * 100 / t2.vod_length, 0 )>=80,'true','false') as status,
t.playDate
t3.create_date,
IF
( t.play_length >= t2.vod_length, 'true', 'false' ) AS STATUS
FROM
(
SELECT
t.vod_id,
t.member_id,
max( t.create_date ) AS playDate
sum( t.play_length ) AS play_length
FROM
vod_play_history t
WHERE
t.delete_date IS NULL
AND t.member_id = #{memberId}
AND t.member_id = #{member_id}
GROUP BY
t.vod_id,
t.member_id
) t
LEFT JOIN vod_play_history t3 ON t.playDate = t3.create_date
AND t.vod_id = t3.vod_id
LEFT JOIN vod_play_history t3 ON t.vod_id = t3.vod_id
AND t.member_id = t3.member_id
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
WHERE
t2.delete_date IS NULL
order by t.playDate desc
ORDER BY
t3.create_date DESC
</select>
<select
id=
"getMemberStudyInfo"
resultType=
"com.subsidy.vo.vod.GetMemberStudyInfoVO"
>
...
...
@@ -67,7 +69,7 @@
sum( t.play_length ) as playLength,
sum(
IF
( t.play_length > t2.vod_length, t2.vod_length, t.play_length )) AS distinctLength
( t.play_length >
=
t2.vod_length, t2.vod_length, t.play_length )) AS distinctLength
FROM
vod_play_history t
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
...
...
@@ -114,15 +116,17 @@
<select
id=
"completeVodOrNot"
resultType=
"integer"
>
SELECT
t.vod_id,
t.member_id,
IF
( max( t.play_record ) >= t2.vod_length*0.8
, 1, 0 ) AS count
( sum( t.play_length )>= t2.vod_length
, 1, 0 ) AS count
FROM
vod_play_history t
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
WHERE
t.delete_date is null
and t2.delete_date is null
t.member_id = #{memberId}
t.delete_date IS NULL
AND t.member_id = #{memberId}
AND t.vod_id = #{vodId}
</select>
...
...
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