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 4ad463a4
authored
Oct 16, 2022
by
涂亚平
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
每日学习时长计算bug修复
1 parent
28fc8087
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
11 deletions
src/main/java/com/subsidy/controller/VodPlayHistoryController.java
src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
src/main/resources/application-dev.properties
src/main/resources/application.properties
src/main/java/com/subsidy/controller/VodPlayHistoryController.java
View file @
4ad463a
...
@@ -37,7 +37,7 @@ public class VodPlayHistoryController {
...
@@ -37,7 +37,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
@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
));
...
...
src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
View file @
4ad463a
...
@@ -67,16 +67,18 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
...
@@ -67,16 +67,18 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
.
lambda
()
.
lambda
()
.
eq
(
ClassDictDO:
:
getId
,
vodPlayHistoryDO
.
getClassId
()));
.
eq
(
ClassDictDO:
:
getId
,
vodPlayHistoryDO
.
getClassId
()));
if
(
classDictDO
.
getLimitHour
()
==
1
)
{
if
(
classDictDO
.
getLimitHour
()
==
1
)
{
//查看当天这个人看了多少时间
//查看当天这个人看了多少时间
Integer
total
=
vodPlayHistoryMapper
.
memberDailyStudyLength
(
vodPlayHistoryDO
.
getMemberId
(),
classDictDO
.
getId
());
Integer
total
=
vodPlayHistoryMapper
.
memberDailyStudyLength
(
vodPlayHistoryDO
.
getMemberId
(),
classDictDO
.
getId
());
if
(
total
=
=
6
*
3600
)
{
if
(
total
>
=
6
*
3600
)
{
throw
new
HttpException
(
13001
);
throw
new
HttpException
(
13001
);
}
}
//是否超过时长
没超过 false 超过 true
//是否超过时长
if
(
total
+
vodPlayHistoryDO
.
getPlayLength
()
>
6
*
3600
)
{
if
(
total
+
vodPlayHistoryDO
.
getPlayLength
()
>
6
*
3600
)
{
//超过时长
int
playLength
=
6
*
3600
-
total
;
int
playLength
=
6
*
3600
-
total
;
vodPlayHistoryDO
.
setPlayLength
(
playLength
);
vodPlayHistoryDO
.
setPlayLength
(
playLength
);
vodPlayHistoryDO
.
setPlayCount
(
1
);
vodPlayHistoryDO
.
setPlayCount
(
1
);
...
@@ -84,10 +86,13 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
...
@@ -84,10 +86,13 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
}
}
// throw new HttpException(13001);
// throw new HttpException(13001);
}
else
{
}
else
{
vodPlayHistoryDO
.
setPlayCount
(
1
);
vodPlayHistoryDO
.
setPlayCount
(
1
);
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
}
}
}
else
if
(
classDictDO
.
getLimitHour
()
==
0
)
{
vodPlayHistoryDO
.
setPlayCount
(
1
);
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
}
}
}
}
return
ConstantUtils
.
ADD_SUCCESS
;
return
ConstantUtils
.
ADD_SUCCESS
;
...
@@ -105,9 +110,9 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
...
@@ -105,9 +110,9 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
.
lambda
()
.
lambda
()
.
eq
(
ClassDictDO:
:
getId
,
insertHistoryNewDTO
.
getClassId
()));
.
eq
(
ClassDictDO:
:
getId
,
insertHistoryNewDTO
.
getClassId
()));
if
(
classDictDO
.
getLimitHour
()
==
1
)
{
if
(
classDictDO
.
getLimitHour
()
==
1
)
{
//查看当天这个人看了多少时间
//查看当天这个人看了多少时间
Integer
total
=
vodPlayHistoryMapper
.
memberDailyStudyLength
(
insertHistoryNewDTO
.
getMemberId
(),
insertHistoryNewDTO
.
getClassId
());
Integer
total
=
vodPlayHistoryMapper
.
memberDailyStudyLength
(
insertHistoryNewDTO
.
getMemberId
(),
insertHistoryNewDTO
.
getClassId
());
if
(
total
==
6
*
3600
)
{
if
(
total
==
6
*
3600
)
{
throw
new
HttpException
(
13001
);
throw
new
HttpException
(
13001
);
...
@@ -122,8 +127,11 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
...
@@ -122,8 +127,11 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
}
}
// throw new HttpException(13001);
// throw new HttpException(13001);
}
else
{
vodPlayHistoryDO
.
setPlayCount
(
1
);
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
}
}
}
else
{
}
else
if
(
classDictDO
.
getLimitHour
()
==
0
)
{
vodPlayHistoryDO
.
setPlayCount
(
1
);
vodPlayHistoryDO
.
setPlayCount
(
1
);
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
}
}
...
...
src/main/resources/application-dev.properties
View file @
4ad463a
# 本地环境配置
# 本地环境配置
spring.server.port
=
234
57
spring.server.port
=
234
62
# 数据源配置
# 数据源配置
spring.datasource.url
=
jdbc:mysql://116.62.57.92:3306/subsidy_
test
?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
spring.datasource.url
=
jdbc:mysql://116.62.57.92:3306/subsidy_
online
?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
#spring.datasource.url=jdbc:mysql://rm-uf6rab73w0qg843opxo.mysql.rds.aliyuncs.com:3306/subsidy_test?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
#spring.datasource.url=jdbc:mysql://rm-uf6rab73w0qg843opxo.mysql.rds.aliyuncs.com:3306/subsidy_test?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
spring.datasource.type
=
com.alibaba.druid.pool.DruidDataSource
spring.datasource.type
=
com.alibaba.druid.pool.DruidDataSource
spring.datasource.driver-class-
name
=
com.mysql.cj.jdbc.Driver
spring.datasource.driver-class-
name
=
com.mysql.cj.jdbc.Driver
...
...
src/main/resources/application.properties
View file @
4ad463a
# 环境配置
# 环境配置
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
...
...
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