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 d2b413ec
authored
Oct 11, 2022
by
涂亚平
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
人脸识别上线版本
1 parent
f4da1322
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
59 deletions
src/main/java/com/subsidy/controller/ClassHourDictController.java
src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java
src/main/java/com/subsidy/service/impl/ClassHourDictServiceImpl.java
src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
src/main/resources/application.properties
src/main/resources/mapper/VodPlayHistoryMapper.xml
src/main/java/com/subsidy/controller/ClassHourDictController.java
View file @
d2b413e
...
@@ -48,14 +48,12 @@ public class ClassHourDictController {
...
@@ -48,14 +48,12 @@ public class ClassHourDictController {
return
ResponseData
.
generateCreatedResponse
(
0
,
classHourDictService
.
updateSetting
(
getSettingVO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
classHourDictService
.
updateSetting
(
getSettingVO
));
}
}
@PostMapping
(
"pollingGet"
)
// @PostMapping("pollingGet")
@ApiOperation
(
"轮询查询当前这个人当天有没有超过最长时长 memberId playLength"
)
// @ApiOperation("轮询查询当前这个人当天有没有超过最长时长 memberId playLength")
@LoginRequired
// @LoginRequired
@TimeRequired
// @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/mapper/VodPlayHistoryMapper.java
View file @
d2b413e
...
@@ -44,7 +44,7 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
...
@@ -44,7 +44,7 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
/**
/**
* 查看某人当天看了多少时间
* 查看某人当天看了多少时间
*/
*/
int
memberDailyStudyLength
(
Long
memberId
);
int
memberDailyStudyLength
(
Long
memberId
,
Long
classId
);
/**
/**
* 查看学生是否完成了某个视频
* 查看学生是否完成了某个视频
...
...
src/main/java/com/subsidy/service/impl/ClassHourDictServiceImpl.java
View file @
d2b413e
...
@@ -127,7 +127,7 @@ public class ClassHourDictServiceImpl extends ServiceImpl<ClassHourDictMapper, C
...
@@ -127,7 +127,7 @@ public class ClassHourDictServiceImpl extends ServiceImpl<ClassHourDictMapper, C
}
}
//查看当天这个人看了多少时间
//查看当天这个人看了多少时间
Integer
total
=
vodPlayHistoryMapper
.
memberDailyStudyLength
(
memberDO
.
getId
());
Integer
total
=
vodPlayHistoryMapper
.
memberDailyStudyLength
(
memberDO
.
getId
()
,
null
);
//是否超过时长 没超过 false 超过 true
//是否超过时长 没超过 false 超过 true
if
(
classHourDictDO
==
null
)
{
if
(
classHourDictDO
==
null
)
{
...
...
src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
View file @
d2b413e
...
@@ -56,85 +56,78 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
...
@@ -56,85 +56,78 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
@Autowired
@Autowired
private
MemberStudyLengthMapper
memberStudyLengthMapper
;
private
MemberStudyLengthMapper
memberStudyLengthMapper
;
@Autowired
private
ClassHourDictMapper
classHourDictMapper
;
@Autowired
private
MemberMapper
memberMapper
;
// @Autowired
// @Autowired
// private RedisUtil redisUtil;
// private RedisUtil redisUtil;
public
String
insertHistory
(
VodPlayHistoryDO
vodPlayHistoryDO
)
{
public
String
insertHistory
(
VodPlayHistoryDO
vodPlayHistoryDO
)
{
if
(
vodPlayHistoryDO
.
getPlayLength
()
>
3
)
{
if
(
vodPlayHistoryDO
.
getPlayLength
()
>
5
)
{
MemberDO
memberDO
=
memberMapper
.
selectById
(
vodPlayHistoryDO
.
getMemberId
());
//查看系统设定的时长
//查看系统设定的时长
Class
HourDictDO
classHourDictDO
=
classHourDictMapper
.
selectOne
(
new
QueryWrapper
<
ClassHour
DictDO
>()
Class
DictDO
classDictDO
=
classDictMapper
.
selectOne
(
new
QueryWrapper
<
Class
DictDO
>()
.
lambda
()
.
lambda
()
.
eq
(
Class
HourDictDO:
:
getCompanyId
,
memberDO
.
getCompany
Id
()));
.
eq
(
Class
DictDO:
:
getId
,
vodPlayHistoryDO
.
getClass
Id
()));
if
(
class
HourDictDO
.
getStatus
()
==
1
)
{
if
(
class
DictDO
.
getLimitHour
()==
1
)
{
//查看当天这个人看了多少时间
//查看当天这个人看了多少时间
Integer
total
=
vodPlayHistoryMapper
.
memberDailyStudyLength
(
member
DO
.
getId
());
Integer
total
=
vodPlayHistoryMapper
.
memberDailyStudyLength
(
vodPlayHistoryDO
.
getMemberId
(),
classDict
DO
.
getId
());
if
(
total
==
classHourDictDO
.
getClassHour
()
*
3600
)
{
if
(
total
==
6
*
3600
)
{
throw
new
HttpException
(
13001
);
throw
new
HttpException
(
13001
);
}
}
//是否超过时长 没超过 false 超过 true
//是否超过时长 没超过 false 超过 true
if
(
total
+
vodPlayHistoryDO
.
getPlayLength
()
>
class
HourDictDO
.
getClass
Hour
()
*
3600
)
{
if
(
total
+
vodPlayHistoryDO
.
getPlayLength
()
>
class
DictDO
.
getLimit
Hour
()
*
3600
)
{
int
playLength
=
class
HourDictDO
.
getClass
Hour
()
*
3600
-
total
;
int
playLength
=
class
DictDO
.
getLimit
Hour
()
*
3600
-
total
;
vodPlayHistoryDO
.
setPlayLength
(
playLength
);
vodPlayHistoryDO
.
setPlayLength
(
playLength
);
vodPlayHistoryDO
.
setPlayCount
(
1
);
vodPlayHistoryDO
.
setPlayCount
(
1
);
if
(
playLength
>
3
)
{
if
(
playLength
>
5
)
{
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
}
}
throw
new
HttpException
(
13001
);
throw
new
HttpException
(
13001
);
}
}
}
else
{
vodPlayHistoryDO
.
setPlayCount
(
1
);
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
}
}
vodPlayHistoryDO
.
setPlayCount
(
1
);
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
}
}
return
ConstantUtils
.
ADD_SUCCESS
;
return
ConstantUtils
.
ADD_SUCCESS
;
}
}
public
String
insertHistoryNew
(
InsertHistoryNewDTO
insertHistoryNewDTO
)
{
public
String
insertHistoryNew
(
InsertHistoryNewDTO
insertHistoryNewDTO
)
{
if
(
insertHistoryNewDTO
.
getPlayLength
()
>
3
)
{
if
(
insertHistoryNewDTO
.
getPlayLength
()
>
5
)
{
VodPlayHistoryDO
vodPlayHistoryDO
=
new
VodPlayHistoryDO
();
VodPlayHistoryDO
vodPlayHistoryDO
=
new
VodPlayHistoryDO
();
BeanUtils
.
copyProperties
(
insertHistoryNewDTO
,
vodPlayHistoryDO
);
BeanUtils
.
copyProperties
(
insertHistoryNewDTO
,
vodPlayHistoryDO
);
MemberDO
memberDO
=
memberMapper
.
selectById
(
vodPlayHistoryDO
.
getMemberId
());
//查看系统设定的时长
//查看系统设定的时长
Class
HourDictDO
classHourDictDO
=
classHourDictMapper
.
selectOne
(
new
QueryWrapper
<
ClassHour
DictDO
>()
Class
DictDO
classDictDO
=
classDictMapper
.
selectOne
(
new
QueryWrapper
<
Class
DictDO
>()
.
lambda
()
.
lambda
()
.
eq
(
Class
HourDictDO:
:
getCompanyId
,
memberDO
.
getCompany
Id
()));
.
eq
(
Class
DictDO:
:
getId
,
insertHistoryNewDTO
.
getClass
Id
()));
if
(
class
HourDictDO
.
getStatus
()
==
1
)
{
if
(
class
DictDO
.
getLimitHour
()==
1
)
{
//查看当天这个人看了多少时间
//查看当天这个人看了多少时间
Integer
total
=
vodPlayHistoryMapper
.
memberDailyStudyLength
(
memberDO
.
get
Id
());
Integer
total
=
vodPlayHistoryMapper
.
memberDailyStudyLength
(
insertHistoryNewDTO
.
getMemberId
(),
insertHistoryNewDTO
.
getClass
Id
());
if
(
total
==
classHourDictDO
.
getClassHour
()
*
3600
)
{
if
(
total
==
6
*
3600
)
{
throw
new
HttpException
(
13001
);
throw
new
HttpException
(
13001
);
}
}
//是否超过时长 没超过 false 超过 true
//是否超过时长 没超过 false 超过 true
if
(
total
+
vodPlayHistoryDO
.
getPlayLength
()
>
class
HourDictDO
.
getClass
Hour
()
*
3600
)
{
if
(
total
+
vodPlayHistoryDO
.
getPlayLength
()
>
class
DictDO
.
getLimit
Hour
()
*
3600
)
{
int
playLength
=
class
HourDictDO
.
getClass
Hour
()
*
3600
-
total
;
int
playLength
=
class
DictDO
.
getLimit
Hour
()
*
3600
-
total
;
vodPlayHistoryDO
.
setPlayLength
(
playLength
);
vodPlayHistoryDO
.
setPlayLength
(
playLength
);
vodPlayHistoryDO
.
setPlayCount
(
1
);
vodPlayHistoryDO
.
setPlayCount
(
1
);
if
(
playLength
>
3
)
{
if
(
playLength
>
5
)
{
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
}
}
throw
new
HttpException
(
13001
);
throw
new
HttpException
(
13001
);
}
}
}
else
{
vodPlayHistoryDO
.
setPlayCount
(
1
);
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
}
}
vodPlayHistoryDO
.
setPlayCount
(
1
);
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
}
}
return
ConstantUtils
.
ADD_SUCCESS
;
return
ConstantUtils
.
ADD_SUCCESS
;
}
}
...
@@ -630,7 +623,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
...
@@ -630,7 +623,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
public
HashSet
<
Long
>
testPlays
(
VodPlayHistoryDO
vodPlayHistoryDO
)
{
public
HashSet
<
Long
>
testPlays
(
VodPlayHistoryDO
vodPlayHistoryDO
)
{
String
classIds
=
"
344
"
;
String
classIds
=
"
286,292,350,355,302,366,379,367,368,371,374,373
"
;
String
[]
classIdArr
=
classIds
.
split
(
","
);
String
[]
classIdArr
=
classIds
.
split
(
","
);
...
@@ -647,19 +640,19 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
...
@@ -647,19 +640,19 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
if
(
vodPlayStateVO1
.
getEndDate
().
getTime
()
-
3000
>
vodPlayStateVO
.
getStartDate
().
getTime
()
&&
vodPlayStateVO
.
getPlayLength
()
>=
3
)
{
if
(
vodPlayStateVO1
.
getEndDate
().
getTime
()
-
3000
>
vodPlayStateVO
.
getStartDate
().
getTime
()
&&
vodPlayStateVO
.
getPlayLength
()
>=
3
)
{
//这一条数据有问题
//这一条数据有问题
System
.
out
.
println
(
"111111111111111111111"
+
vodPlayStateVO
);
System
.
out
.
println
(
"111111111111111111111"
+
vodPlayStateVO
);
//查看这个人 这个课程 当天的全部数据 按照createDate升序排序
//
//查看这个人 这个课程 当天的全部数据 按照createDate升序排序
List
<
VodPlayHistoryDO
>
vodPlayHistoryDOS
=
this
.
baseMapper
.
getVodPlayDay
(
Long
.
valueOf
(
classId
),
classMemberMappingDO
.
getMemberId
(),
vodPlayStateVO
.
getStartDate
());
//
List<VodPlayHistoryDO> vodPlayHistoryDOS = this.baseMapper.getVodPlayDay(Long.valueOf(classId), classMemberMappingDO.getMemberId(), vodPlayStateVO.getStartDate());
//从第一条开始看,顺延减去第二条的playlength得到第二条的create_date 以此类推
//
//从第一条开始看,顺延减去第二条的playlength得到第二条的create_date 以此类推
for
(
int
l
=
0
;
l
<
vodPlayHistoryDOS
.
size
()
-
1
;
l
++)
{
//
for (int l = 0; l < vodPlayHistoryDOS.size() - 1; l++) {
VodPlayHistoryDO
vph1
=
vodPlayHistoryDOS
.
get
(
l
);
//第一条
//
VodPlayHistoryDO vph1 = vodPlayHistoryDOS.get(l); //第一条
if
(
l
==
0
){
//
if (l==0){
vph1
.
setPlayDate
(
vph1
.
getCreateDate
());
//
vph1.setPlayDate(vph1.getCreateDate());
}
//
}
VodPlayHistoryDO
vph2
=
vodPlayHistoryDOS
.
get
(
l
+
1
);
//第二条
//
VodPlayHistoryDO vph2 = vodPlayHistoryDOS.get(l + 1); //第二条
LocalDateTime
dateTmp
=
vph1
.
getPlayDate
().
plusSeconds
(
vph2
.
getPlayLength
()+
getRandom1_2
());
//
LocalDateTime dateTmp = vph1.getPlayDate().plusSeconds(vph2.getPlayLength()+getRandom1_2());
vph2
.
setPlayDate
(
dateTmp
);
//
vph2.setPlayDate(dateTmp);
this
.
baseMapper
.
updateById
(
vph2
);
//
this.baseMapper.updateById(vph2);
}
//
}
result
.
add
(
vodPlayStateVO
.
getId
());
result
.
add
(
vodPlayStateVO
.
getId
());
// break;
// break;
}
}
...
...
src/main/resources/application.properties
View file @
d2b413e
# 环境配置
# 环境配置
spring.profiles.active
=
prod
spring.profiles.active
=
dev
#和CPU数
#和CPU数
spring.server.acceptorThreadCount
=
600
spring.server.acceptorThreadCount
=
600
spring.server.minSpareThreads
=
100
spring.server.minSpareThreads
=
100
...
...
src/main/resources/mapper/VodPlayHistoryMapper.xml
View file @
d2b413e
...
@@ -105,7 +105,7 @@
...
@@ -105,7 +105,7 @@
AND a.vod_id = b.vod_id
AND a.vod_id = b.vod_id
</select>
</select>
<select
id=
"memberDailyStudyLength"
parameterType=
"long"
resultType=
"integer"
>
<select
id=
"memberDailyStudyLength"
resultType=
"integer"
>
SELECT
SELECT
ifnull( sum( t.play_length ), 0 )
ifnull( sum( t.play_length ), 0 )
FROM
FROM
...
@@ -114,6 +114,7 @@
...
@@ -114,6 +114,7 @@
t.delete_date IS NULL
t.delete_date IS NULL
AND DATE_FORMAT( t.create_date, '%Y-%m-%d' ) = DATE_FORMAT( now(), '%Y-%m-%d' )
AND DATE_FORMAT( t.create_date, '%Y-%m-%d' ) = DATE_FORMAT( now(), '%Y-%m-%d' )
AND t.member_id = #{memberId}
AND t.member_id = #{memberId}
and t.class_id = #{classId}
</select>
</select>
<select
id=
"completeVodOrNot"
resultType=
"integer"
>
<select
id=
"completeVodOrNot"
resultType=
"integer"
>
...
...
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