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 ec1f234c
authored
Dec 30, 2021
by
涂亚平
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
高并发优化压测版本
1 parent
c9123771
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
14 deletions
src/main/java/com/subsidy/jobs/Scheduler.java
src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java
src/main/resources/application-dev.properties
src/main/resources/application.properties
src/main/resources/mapper/VodPlayHistoryMapper.xml
src/main/java/com/subsidy/jobs/Scheduler.java
View file @
ec1f234
...
@@ -92,14 +92,15 @@ public class Scheduler {
...
@@ -92,14 +92,15 @@ public class Scheduler {
/**
/**
* 视频播放记录缩量
* 视频播放记录缩量
*/
*/
//@Scheduled(cron = "0 35 18
* * ?")
@Scheduled
(
cron
=
"0 48 14
* * ?"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
condenseVodPlayHistory
()
{
public
void
condenseVodPlayHistory
()
{
List
<
VodPlayHistoryDO
>
list
=
vodPlayHistoryMapper
.
getVodPlayHistory
();
List
<
VodPlayHistoryDO
>
list
=
vodPlayHistoryMapper
.
getVodPlayHistory
();
List
<
VodPlayHistoryDO
>
vodPlayHistoryList
=
vodPlayHistoryMapper
.
selectList
(
new
QueryWrapper
<
VodPlayHistoryDO
>());
vodPlayHistoryMapper
.
delete
(
null
);
for
(
VodPlayHistoryDO
vodPlayHistoryDO
:
vodPlayHistoryList
)
{
//List<VodPlayHistoryDO> vodPlayHistoryList = vodPlayHistoryMapper.selectList(null);
vodPlayHistoryMapper
.
deleteById
(
vodPlayHistoryDO
.
getId
());
//for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryList) {
}
vodPlayHistoryMapper
.
deleteById
(
null
);
//}
for
(
VodPlayHistoryDO
vodPlayHistoryDO
:
list
)
{
for
(
VodPlayHistoryDO
vodPlayHistoryDO
:
list
)
{
vodPlayHistoryMapper
.
insert
(
vodPlayHistoryDO
);
vodPlayHistoryMapper
.
insert
(
vodPlayHistoryDO
);
...
...
src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java
View file @
ec1f234
...
@@ -12,6 +12,7 @@ import com.subsidy.mapper.ClassDictMapper;
...
@@ -12,6 +12,7 @@ import com.subsidy.mapper.ClassDictMapper;
import
com.subsidy.mapper.ClassHourDictMapper
;
import
com.subsidy.mapper.ClassHourDictMapper
;
import
com.subsidy.mapper.ClassMemberMappingMapper
;
import
com.subsidy.mapper.ClassMemberMappingMapper
;
import
com.subsidy.mapper.ExerciseDoneResultMapper
;
import
com.subsidy.mapper.ExerciseDoneResultMapper
;
import
com.subsidy.mapper.MemberMapper
;
import
com.subsidy.mapper.SignInRecordMapper
;
import
com.subsidy.mapper.SignInRecordMapper
;
import
com.subsidy.mapper.VodPlayHistoryMapper
;
import
com.subsidy.mapper.VodPlayHistoryMapper
;
import
com.subsidy.model.AnsweringQuestionDO
;
import
com.subsidy.model.AnsweringQuestionDO
;
...
@@ -19,6 +20,7 @@ import com.subsidy.model.ClassDictDO;
...
@@ -19,6 +20,7 @@ import com.subsidy.model.ClassDictDO;
import
com.subsidy.model.ClassHourDictDO
;
import
com.subsidy.model.ClassHourDictDO
;
import
com.subsidy.model.ClassMemberMappingDO
;
import
com.subsidy.model.ClassMemberMappingDO
;
import
com.subsidy.model.ExerciseDoneResultDO
;
import
com.subsidy.model.ExerciseDoneResultDO
;
import
com.subsidy.model.MemberDO
;
import
com.subsidy.model.SignInRecordDO
;
import
com.subsidy.model.SignInRecordDO
;
import
com.subsidy.model.VodDictDO
;
import
com.subsidy.model.VodDictDO
;
import
com.subsidy.model.VodPlayHistoryDO
;
import
com.subsidy.model.VodPlayHistoryDO
;
...
@@ -70,6 +72,9 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
...
@@ -70,6 +72,9 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
private
RedisUtil
redisUtil
;
private
RedisUtil
redisUtil
;
@Autowired
@Autowired
private
MemberMapper
memberMapper
;
@Autowired
private
ClassHourDictMapper
classHourDictMapper
;
private
ClassHourDictMapper
classHourDictMapper
;
public
IPage
<
GetMemberSignInfoVO
>
getMemberSignInfo
(
GetMemberSignInfoDTO
getMemberSignInfoDTO
)
{
public
IPage
<
GetMemberSignInfoVO
>
getMemberSignInfo
(
GetMemberSignInfoDTO
getMemberSignInfoDTO
)
{
...
@@ -250,6 +255,11 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
...
@@ -250,6 +255,11 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
redisUtil
.
set
(
"subsidySettings_"
+
classHourDictDO
.
getCompanyId
(),
classHourDictDO
);
redisUtil
.
set
(
"subsidySettings_"
+
classHourDictDO
.
getCompanyId
(),
classHourDictDO
);
}
}
//List<MemberDO> memberDOS = memberMapper.selectList(null);
//for (MemberDO memberDO : memberDOS){
// redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX+memberDO.getCompanyId()+"_"+memberDO.getAccountName(),memberDO);
//}
}
}
}
}
src/main/resources/application-dev.properties
View file @
ec1f234
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
# 数据源配置
# 数据源配置
spring.datasource.url
=
jdbc:mysql://47.97.19.66:3306/subsidy_test?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
spring.datasource.url
=
jdbc:mysql://47.97.19.66:3306/subsidy_test?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
#spring.datasource.url=jdbc:mysql://rm-uf6
7mjh19252z6yg4eo.mysql.rds.aliyuncs.com:3306/subsidy
?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
#spring.datasource.url=jdbc:mysql://rm-uf6
06h696n5qod70cfo.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
#spring.datasource.username=ykadmin_new
#spring.datasource.username=ykadmin_new
...
...
src/main/resources/application.properties
View file @
ec1f234
...
@@ -64,12 +64,12 @@ spring.quartz.overwrite-existing-jobs=false
...
@@ -64,12 +64,12 @@ spring.quartz.overwrite-existing-jobs=false
#spring.quartz.jdbc.initialize-schema=always
#spring.quartz.jdbc.initialize-schema=always
#spring.datasource.initialization-mode=embedded
#spring.datasource.initialization-mode=embedded
spring.task.execution.pool.allow-core-thread-
timeout
=
true
#
spring.task.execution.pool.allow-core-thread-timeout=true
spring.task.execution.pool.core-
size
=
8
#
spring.task.execution.pool.core-size=8
spring.task.execution.pool.keep-
alive
=
60
#
spring.task.execution.pool.keep-alive=60
spring.task.execution.pool.max-
size
=
200
#
spring.task.execution.pool.max-size=200
spring.task.execution.pool.queue-
capacity
=
200
#
spring.task.execution.pool.queue-capacity=200
spring.task.execution.thread-name-
prefix
=
subsidy-
#
spring.task.execution.thread-name-prefix=subsidy-
#spring.task.scheduling.pool.size=2
#spring.task.scheduling.pool.size=2
#spring.task.scheduling.thread-name-prefix=subsidy-
#spring.task.scheduling.thread-name-prefix=subsidy-
...
@@ -82,6 +82,10 @@ spring.task.execution.thread-name-prefix=subsidy-
...
@@ -82,6 +82,10 @@ spring.task.execution.thread-name-prefix=subsidy-
#spring.redis.lettuce.pool.max-active=32
#spring.redis.lettuce.pool.max-active=32
#spring.redis.lettuce.pool.min-idle=8
#spring.redis.lettuce.pool.min-idle=8
#spring.redis.host=r-uf6m4cpkjrgpzywjm3pd.redis.rds.aliyuncs.com
#spring.redis.port=6379
#spring.redis.password=r-uf6m4cpkjrgpzywjm3:Ykhl@208
spring.redis.host
=
47.97.19.66
spring.redis.host
=
47.97.19.66
spring.redis.password
=
Ykhl@208
spring.redis.password
=
Ykhl@208
spring.redis.port
=
6389
spring.redis.port
=
6389
...
...
src/main/resources/mapper/VodPlayHistoryMapper.xml
View file @
ec1f234
...
@@ -24,7 +24,6 @@
...
@@ -24,7 +24,6 @@
</sql>
</sql>
<delete
id=
"deleteById"
>
<delete
id=
"deleteById"
>
delete from vod_play_history
delete from vod_play_history
where id = #{id}
</delete>
</delete>
<select
id=
"studyHistory"
parameterType=
"long"
resultType=
"com.subsidy.vo.vod.StudyHistoryVO"
>
<select
id=
"studyHistory"
parameterType=
"long"
resultType=
"com.subsidy.vo.vod.StudyHistoryVO"
>
...
@@ -116,7 +115,7 @@
...
@@ -116,7 +115,7 @@
<select
id=
"completeVodOrNot"
resultType=
"integer"
>
<select
id=
"completeVodOrNot"
resultType=
"integer"
>
SELECT
SELECT
IF
IF
( max( t.play_record ) > t2.vod_length, 1, 0 ) AS count
( max( t.play_record ) > t2.vod_length
*0.8
, 1, 0 ) AS count
FROM
FROM
vod_play_history t
vod_play_history t
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
...
...
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