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 af0e0279
authored
Jun 14, 2023
by
涂亚平
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
定时任务:删除上线做了人脸识别但是没有看视频或者考试的人,这些人的人脸识别记录
1 parent
17dd553c
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
118 additions
and
39 deletions
src/main/java/com/subsidy/jobs/RenSheJuJob.java
src/main/java/com/subsidy/jobs/WarningJob.java
src/main/java/com/subsidy/mapper/ImageCheckRecordMapper.java
src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java
src/main/resources/mapper/ImageCheckRecordMapper.xml
src/main/java/com/subsidy/jobs/RenSheJuJob.java
View file @
af0e027
package
com
.
subsidy
.
jobs
;
package
com
.
subsidy
.
jobs
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.mapper.ActivityDetectionMapper
;
import
com.subsidy.mapper.ImageCheckRecordMapper
;
import
com.subsidy.mapper.OprMemDictMapper
;
import
com.subsidy.mapper.OprMemDictMapper
;
import
com.subsidy.model.ActivityDetectionDO
;
import
com.subsidy.model.ImageCheckRecordDO
;
import
com.subsidy.model.OprMemDictDO
;
import
com.subsidy.model.OprMemDictDO
;
import
com.subsidy.service.RenSheJuService
;
import
com.subsidy.service.RenSheJuService
;
import
com.subsidy.util.IpAddressUtil
;
import
com.subsidy.util.IpAddressUtil
;
...
@@ -36,6 +41,12 @@ public class RenSheJuJob {
...
@@ -36,6 +41,12 @@ public class RenSheJuJob {
@Autowired
@Autowired
private
OprMemDictMapper
oprMemDictMapper
;
private
OprMemDictMapper
oprMemDictMapper
;
@Autowired
private
ImageCheckRecordMapper
imageCheckRecordMapper
;
@Autowired
private
ActivityDetectionMapper
activityDetectionMapper
;
@Value
(
"${spring.profiles.active}"
)
@Value
(
"${spring.profiles.active}"
)
private
String
env
;
private
String
env
;
...
@@ -45,7 +56,7 @@ public class RenSheJuJob {
...
@@ -45,7 +56,7 @@ public class RenSheJuJob {
*/
*/
@Scheduled
(
cron
=
"0 0 1 * * ?"
)
@Scheduled
(
cron
=
"0 0 1 * * ?"
)
public
void
classBaseInfo
()
throws
IOException
{
public
void
classBaseInfo
()
throws
IOException
{
if
(
"prod"
.
equals
(
env
)){
if
(
"prod"
.
equals
(
env
))
{
renSheJuService
.
classBaseInfo
();
renSheJuService
.
classBaseInfo
();
}
}
}
}
...
@@ -55,7 +66,7 @@ public class RenSheJuJob {
...
@@ -55,7 +66,7 @@ public class RenSheJuJob {
*/
*/
@Scheduled
(
cron
=
"0 5 1 * * ?"
)
@Scheduled
(
cron
=
"0 5 1 * * ?"
)
public
void
classHourBehavior
()
throws
IOException
{
public
void
classHourBehavior
()
throws
IOException
{
if
(
"prod"
.
equals
(
env
)){
if
(
"prod"
.
equals
(
env
))
{
renSheJuService
.
classHourBehavior
();
renSheJuService
.
classHourBehavior
();
}
}
}
}
...
@@ -65,7 +76,7 @@ public class RenSheJuJob {
...
@@ -65,7 +76,7 @@ public class RenSheJuJob {
*/
*/
@Scheduled
(
cron
=
"0 10 1 * * ?"
)
@Scheduled
(
cron
=
"0 10 1 * * ?"
)
public
void
uploadChapterBehavior
()
throws
IOException
{
public
void
uploadChapterBehavior
()
throws
IOException
{
if
(
"prod"
.
equals
(
env
)){
if
(
"prod"
.
equals
(
env
))
{
renSheJuService
.
uploadChapterBehavior
();
renSheJuService
.
uploadChapterBehavior
();
}
}
}
}
...
@@ -75,7 +86,7 @@ public class RenSheJuJob {
...
@@ -75,7 +86,7 @@ public class RenSheJuJob {
*/
*/
@Scheduled
(
cron
=
"0 15 1 * * ?"
)
@Scheduled
(
cron
=
"0 15 1 * * ?"
)
public
void
uploadClassAnswerQuestionBehavior
()
throws
IOException
{
public
void
uploadClassAnswerQuestionBehavior
()
throws
IOException
{
if
(
"prod"
.
equals
(
env
)){
if
(
"prod"
.
equals
(
env
))
{
renSheJuService
.
uploadClassAnswerQuestionBehavior
();
renSheJuService
.
uploadClassAnswerQuestionBehavior
();
}
}
}
}
...
@@ -85,7 +96,7 @@ public class RenSheJuJob {
...
@@ -85,7 +96,7 @@ public class RenSheJuJob {
*/
*/
@Scheduled
(
cron
=
"0 20 1 * * ?"
)
@Scheduled
(
cron
=
"0 20 1 * * ?"
)
public
void
uploadImage
()
throws
IOException
{
public
void
uploadImage
()
throws
IOException
{
if
(
"prod"
.
equals
(
env
)){
if
(
"prod"
.
equals
(
env
))
{
renSheJuService
.
uploadImage
();
renSheJuService
.
uploadImage
();
}
}
}
}
...
@@ -95,7 +106,7 @@ public class RenSheJuJob {
...
@@ -95,7 +106,7 @@ public class RenSheJuJob {
*/
*/
@Scheduled
(
cron
=
"0 25 1 * * ?"
)
@Scheduled
(
cron
=
"0 25 1 * * ?"
)
public
void
getClassCodeByPrivateKey
()
throws
IOException
{
public
void
getClassCodeByPrivateKey
()
throws
IOException
{
if
(
"prod"
.
equals
(
env
)){
if
(
"prod"
.
equals
(
env
))
{
renSheJuService
.
getClassCodeByPrivateKey
();
renSheJuService
.
getClassCodeByPrivateKey
();
}
}
}
}
...
@@ -105,7 +116,7 @@ public class RenSheJuJob {
...
@@ -105,7 +116,7 @@ public class RenSheJuJob {
*/
*/
@Scheduled
(
cron
=
"0 30 1 * * ?"
)
@Scheduled
(
cron
=
"0 30 1 * * ?"
)
public
void
uploadClassCode
()
throws
IOException
{
public
void
uploadClassCode
()
throws
IOException
{
if
(
"prod"
.
equals
(
env
)){
if
(
"prod"
.
equals
(
env
))
{
renSheJuService
.
uploadClassCode
();
renSheJuService
.
uploadClassCode
();
}
}
}
}
...
@@ -118,9 +129,13 @@ public class RenSheJuJob {
...
@@ -118,9 +129,13 @@ public class RenSheJuJob {
// renSheJuService.getErrorClass();
// renSheJuService.getErrorClass();
// }
// }
/**
* 强制用户用户下线(websocket强制下线)
*/
@Scheduled
(
cron
=
"0 30 23 * * ?"
)
@Scheduled
(
cron
=
"0 30 23 * * ?"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
logout
(){
public
void
logout
()
{
//让当前用户下线
//让当前用户下线
ConcurrentHashMap
<
Long
,
WebSocketSession
>
webSocketMap
=
WebSocketUtil
.
webSocketMap
;
ConcurrentHashMap
<
Long
,
WebSocketSession
>
webSocketMap
=
WebSocketUtil
.
webSocketMap
;
...
@@ -139,51 +154,64 @@ public class RenSheJuJob {
...
@@ -139,51 +154,64 @@ public class RenSheJuJob {
}
}
}
}
/**
* 删掉有登录数据 做过人脸 没有学习数据(视频+考试+答疑)
*/
@Scheduled
(
cron
=
"0 01 16 * * ?"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
deleteNoStudyMembers
()
{
//查看登陆过做过人脸,但是没视频记录的人
List
<
ImageCheckRecordDO
>
vodHistoryMembers
=
imageCheckRecordMapper
.
noVodHistoryMembers
();
vodHistoryMembers
.
stream
().
forEach
(
x
->
{
imageCheckRecordMapper
.
deleteById
(
x
.
getId
());
ActivityDetectionDO
activityDetectionDO
=
activityDetectionMapper
.
selectOne
(
new
QueryWrapper
<
ActivityDetectionDO
>()
.
lambda
()
.
eq
(
ActivityDetectionDO:
:
getFaceCheckId
,
x
.
getId
()));
if
(
null
!=
activityDetectionDO
)
{
activityDetectionMapper
.
deleteById
(
activityDetectionDO
.
getId
());
}
});
//查看登陆过做过人脸,但是没考试记录的人
List
<
ImageCheckRecordDO
>
examHistoryMembers
=
imageCheckRecordMapper
.
noExamHistoryMembers
();
examHistoryMembers
.
stream
().
forEach
(
x
->
{
imageCheckRecordMapper
.
deleteById
(
x
.
getId
());
ActivityDetectionDO
activityDetectionDO
=
activityDetectionMapper
.
selectOne
(
new
QueryWrapper
<
ActivityDetectionDO
>()
.
lambda
()
.
eq
(
ActivityDetectionDO:
:
getFaceCheckId
,
x
.
getId
()));
if
(
null
!=
activityDetectionDO
)
{
activityDetectionMapper
.
deleteById
(
activityDetectionDO
.
getId
());
}
});
}
/**
* 补登录登出数据
*/
@Scheduled
(
cron
=
"0 40 23 * * ?"
)
@Scheduled
(
cron
=
"0 40 23 * * ?"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
cancelLogin
()
{
public
void
cancelLogin
()
{
//让当前用户下线
//让当前用户下线
// ConcurrentHashMap<Long, WebSocketSession> webSocketMap = WebSocketUtil.webSocketMap;
// ConcurrentHashMap<Long, WebSocketSession> webSocketMap = WebSocketUtil.webSocketMap;
//查看当天登录过的人最后一次活跃数据
//查看当天登录过的人最后一次活跃数据
List
<
InsertLastStudyRecordVO
>
insertLastStudyRecordVOS
=
oprMemDictMapper
.
insertLastStudyRecord
();
List
<
InsertLastStudyRecordVO
>
insertLastStudyRecordVOS
=
oprMemDictMapper
.
insertLastStudyRecord
();
for
(
InsertLastStudyRecordVO
ilsr
:
insertLastStudyRecordVOS
)
{
for
(
InsertLastStudyRecordVO
ilsr
:
insertLastStudyRecordVOS
)
{
oprMemDictMapper
.
insertOrUpdate
(
ilsr
.
getMemberId
(),
"登录"
,
1
,
ilsr
.
getIpAddress
(),
ilsr
.
getSignInDate
());
oprMemDictMapper
.
insertOrUpdate
(
ilsr
.
getMemberId
(),
"登录"
,
1
,
ilsr
.
getIpAddress
(),
ilsr
.
getSignInDate
());
if
(
null
==
ilsr
.
getMt
())
{
if
(
null
==
ilsr
.
getMt
())
{
//补23:58的数据
//补23:58的数据
oprMemDictMapper
.
insertOrUpdate
(
ilsr
.
getMemberId
(),
"登出"
,
1
,
null
,
new
Date
());
oprMemDictMapper
.
insertOrUpdate
(
ilsr
.
getMemberId
(),
"登出"
,
1
,
null
,
new
Date
());
}
else
{
}
else
{
//最后一次学习的数据
//最后一次学习的数据
oprMemDictMapper
.
insertOrUpdate
(
ilsr
.
getMemberId
(),
"登出"
,
1
,
null
,
ilsr
.
getMt
());
oprMemDictMapper
.
insertOrUpdate
(
ilsr
.
getMemberId
(),
"登出"
,
1
,
null
,
ilsr
.
getMt
());
}
}
}
}
// List<Long> shutdownUsers = oprMemDictMapper.shutdownUser();
// for (Long key : shutdownUsers) {
// try {
// if (!onLineUsers.contains(key)) {
// OprMemDictDO oprMemDictDO = oprMemDictMapper.getLatestLoginInfo(key);
// if (null != oprMemDictDO) {
// if (oprMemDictDO.getResult() == 1 && "登出".equals(oprMemDictDO.getOprType())) {
// oprMemDictMapper.deleteById(oprMemDictDO.getId());
// }
// }
// DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// LocalDateTime time = LocalDateTime.now();
// String localDateTime = df.format(time);
// LocalDateTime ldt = LocalDateTime.parse(localDateTime, df);
// oprMemDictDO.setCreateDate(ldt);
// oprMemDictMapper.insertOrUpdate(key, "登出", 1, null, ldt);
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
}
}
}
}
src/main/java/com/subsidy/jobs/WarningJob.java
View file @
af0e027
...
@@ -39,10 +39,10 @@ public class WarningJob {
...
@@ -39,10 +39,10 @@ public class WarningJob {
private
String
env
;
private
String
env
;
/**
/**
*
POST-2:班级基本信息信息采集接口
*
11点钟有错误数据 发短信
*/
*/
@Scheduled
(
cron
=
"0 0 23 * * ?"
)
@Scheduled
(
cron
=
"0 0 23 * * ?"
)
public
void
classBaseInfo
()
throws
IOException
{
public
void
classBaseInfo
(){
if
(
"prod"
.
equals
(
env
))
{
if
(
"prod"
.
equals
(
env
))
{
List
<
Long
>
result
=
new
ArrayList
<>();
List
<
Long
>
result
=
new
ArrayList
<>();
...
...
src/main/java/com/subsidy/mapper/ImageCheckRecordMapper.java
View file @
af0e027
...
@@ -27,6 +27,17 @@ public interface ImageCheckRecordMapper extends BaseMapper<ImageCheckRecordDO> {
...
@@ -27,6 +27,17 @@ public interface ImageCheckRecordMapper extends BaseMapper<ImageCheckRecordDO> {
/**
/**
* 查看某个人某个课程当天做了几次人脸识别
* 查看某个人某个课程当天做了几次人脸识别
*/
*/
int
checkDailyCount
(
Long
memberId
,
Long
classId
,
Integer
checkPlace
,
Long
paperId
);
int
checkDailyCount
(
Long
memberId
,
Long
classId
,
Integer
checkPlace
,
Long
paperId
);
/**
* 查看登陆过做过人脸,但是没视频记录的人
*/
List
<
ImageCheckRecordDO
>
noVodHistoryMembers
();
/**
* 查看登陆过做过人脸,但是没考试记录的人
*/
List
<
ImageCheckRecordDO
>
noExamHistoryMembers
();
}
}
src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java
View file @
af0e027
...
@@ -189,9 +189,9 @@ public class RenSheJuServiceImpl implements RenSheJuService {
...
@@ -189,9 +189,9 @@ public class RenSheJuServiceImpl implements RenSheJuService {
List
<
ChapterList3
>
chapterList3s
=
renSheJuMapper
.
dailyStudyRecords
(
dailyStudyInfoVO
.
getMemberId
(),
dailyStudyInfoVO
.
getDownCode
(),
loginRecords
.
get
(
i
).
getCreateDate
().
toString
().
replace
(
"T"
,
" "
),
loginOutRecords
.
get
(
i
).
getCreateDate
().
toString
().
replace
(
"T"
,
" "
));
List
<
ChapterList3
>
chapterList3s
=
renSheJuMapper
.
dailyStudyRecords
(
dailyStudyInfoVO
.
getMemberId
(),
dailyStudyInfoVO
.
getDownCode
(),
loginRecords
.
get
(
i
).
getCreateDate
().
toString
().
replace
(
"T"
,
" "
),
loginOutRecords
.
get
(
i
).
getCreateDate
().
toString
().
replace
(
"T"
,
" "
));
if
(
chapterList3s
.
size
()
>
0
)
{
if
(
chapterList3s
.
size
()
>
0
)
{
loginList
.
setChapterList
(
chapterList3s
);
loginList
.
setChapterList
(
chapterList3s
);
}
loginLists
.
add
(
loginList
);
loginLists
.
add
(
loginList
);
}
}
}
classHourBasic
.
setLoginList
(
loginLists
);
classHourBasic
.
setLoginList
(
loginLists
);
//活跃度列表
//活跃度列表
...
...
src/main/resources/mapper/ImageCheckRecordMapper.xml
View file @
af0e027
...
@@ -55,4 +55,44 @@
...
@@ -55,4 +55,44 @@
</if>
</if>
</select>
</select>
<select
id=
"noVodHistoryMembers"
resultType=
"com.subsidy.model.ImageCheckRecordDO"
>
SELECT
id
FROM
image_check_record t1
WHERE
DATE_FORMAT( t1.create_date, '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
AND paper_id IS NULL
AND t1.member_id NOT IN (
SELECT DISTINCT
member_id
FROM
vod_play_history
WHERE
delete_date IS NULL
AND DATE_FORMAT( create_date, '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
)
</select>
<select
id=
"noExamHistoryMembers"
resultType=
"com.subsidy.model.ImageCheckRecordDO"
>
SELECT
id
FROM
image_check_record t1
WHERE
DATE_FORMAT( t1.create_date, '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
AND paper_id IS NOT NULL
and t1.member_id not in (
SELECT DISTINCT
member_id
FROM
exercise_done_result
WHERE
delete_date IS NULL
AND DATE_FORMAT( create_date, '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
)
</select>
</mapper>
</mapper>
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