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 7f91af80
authored
Aug 18, 2023
by
涂亚平
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
班级绑定推送修改
1 parent
aa750235
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
313 additions
and
118 deletions
src/main/java/com/subsidy/controller/VodPlayHistoryController.java
src/main/java/com/subsidy/jobs/RenSheJuJob.java
src/main/java/com/subsidy/jobs/WarningJob.java
src/main/java/com/subsidy/mapper/SignInRecordMapper.java
src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java
src/main/java/com/subsidy/service/VodPlayHistoryService.java
src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java
src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java
src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
src/main/java/com/subsidy/vo/sign/NoSignInDateVO.java
src/main/java/com/subsidy/vo/vod/DailyClassMembersVO.java
src/main/java/com/subsidy/vo/vod/VodPlayStateVO.java
src/main/resources/application-prod.properties
src/main/resources/mapper/SignInRecordMapper.xml
src/main/resources/mapper/VodPlayHistoryMapper.xml
src/main/java/com/subsidy/controller/VodPlayHistoryController.java
View file @
7f91af8
...
...
@@ -84,6 +84,12 @@ public class VodPlayHistoryController {
return
ResponseData
.
generateCreatedResponse
(
0
,
vodPlayHistoryService
.
testPlays
());
}
@PostMapping
(
"reArrangeData"
)
@ApiOperation
(
"将有问题的数据按照签到时间重新排一下"
)
public
void
reArrangeData
(){
vodPlayHistoryService
.
reArrangeData
();
}
@PostMapping
(
"warning"
)
@ApiOperation
(
"短信报警"
)
public
void
warning
(){
...
...
src/main/java/com/subsidy/jobs/RenSheJuJob.java
View file @
7f91af8
...
...
@@ -3,16 +3,15 @@ package com.subsidy.jobs;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.mapper.ActivityDetectionMapper
;
import
com.subsidy.mapper.ImageCheckRecordMapper
;
import
com.subsidy.mapper.OprMemDictMapper
;
import
com.subsidy.model.ActivityDetectionDO
;
import
com.subsidy.model.ImageCheckRecordDO
;
import
com.subsidy.model.OprMemDictDO
;
import
com.subsidy.mapper.*
;
import
com.subsidy.model.*
;
import
com.subsidy.service.RenSheJuService
;
import
com.subsidy.util.IpAddressUtil
;
import
com.subsidy.util.websocket.WebSocketUtil
;
import
com.subsidy.vo.opr.InsertLastStudyRecordVO
;
import
com.subsidy.vo.renshe.DailyAnswerVO
;
import
com.subsidy.vo.vod.DailyClassMembersVO
;
import
com.subsidy.vo.vod.VodPlayStateVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.Scheduled
;
...
...
@@ -25,6 +24,8 @@ import java.io.IOException;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.concurrent.ConcurrentHashMap
;
...
...
@@ -47,13 +48,25 @@ public class RenSheJuJob {
@Autowired
private
ActivityDetectionMapper
activityDetectionMapper
;
@Autowired
private
VodPlayHistoryMapper
vodPlayHistoryMapper
;
@Autowired
private
SignInRecordMapper
signInRecordMapper
;
@Autowired
private
ClassMemberMappingMapper
classMemberMappingMapper
;
@Autowired
private
VodDictMapper
vodDictMapper
;
@Value
(
"${spring.profiles.active}"
)
private
String
env
;
/**
* POST-2:班级基本信息信息采集接口
*/
//
* POST-2:班级基本信息信息采集接口
//
*/
@Scheduled
(
cron
=
"0 0 1 * * ?"
)
public
void
classBaseInfo
()
throws
IOException
{
if
(
"prod"
.
equals
(
env
))
{
...
...
@@ -121,19 +134,18 @@ public class RenSheJuJob {
}
}
// /**
// * POST-9 获取推送失败班级列表
// */
// @Scheduled(cron = "0 35 1 * * ?")
// public void getErrorClass()throws IOException{
// renSheJuService.getErrorClass();
// }
/**
* POST-9 获取推送失败班级列表
*/
@Scheduled
(
cron
=
"0 35 1 * * ?"
)
public
void
getErrorClass
()
throws
IOException
{
renSheJuService
.
getErrorClass
();
}
/**
* 强制用户用户下线(websocket强制下线)
*/
@Scheduled
(
cron
=
"0
3
0 23 * * ?"
)
@Scheduled
(
cron
=
"0
0
0 23 * * ?"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
logout
()
{
//让当前用户下线
...
...
@@ -155,6 +167,95 @@ public class RenSheJuJob {
}
/**
* 补当天有学习记录但没有签到的签到数据
*/
@Scheduled
(
cron
=
"0 10 23 * * ?"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
fillSignInRecord
(){
//查找有视频的学生
List
<
DailyClassMembersVO
>
dailyClassMembersVOS
=
vodPlayHistoryMapper
.
dailyClassMembers
();
for
(
DailyClassMembersVO
dailyClassMembersVO
:
dailyClassMembersVOS
){
try
{
//去看签到表当天有没有数据,没有的话就要补
SignInRecordDO
dailySignInRecord
=
signInRecordMapper
.
getDailySignInRecord
(
dailyClassMembersVO
.
getMemberId
(),
dailyClassMembersVO
.
getClassId
());
if
(
null
==
dailySignInRecord
){
//没有签到数据,补
List
<
VodPlayHistoryDO
>
vodPlayHistoryDOS
=
vodPlayHistoryMapper
.
exPlayInfoAsc
(
dailyClassMembersVO
.
getMemberId
(),
dailyClassMembersVO
.
getClassId
());
List
<
SignInRecordDO
>
signInRecordDOS
=
signInRecordMapper
.
selectList
(
new
QueryWrapper
<
SignInRecordDO
>()
.
lambda
()
.
eq
(
SignInRecordDO:
:
getMemberId
,
dailyClassMembersVO
.
getMemberId
())
.
eq
(
SignInRecordDO:
:
getClassId
,
dailyClassMembersVO
.
getClassId
())
.
orderByDesc
(
SignInRecordDO:
:
getSignInDate
));
SignInRecordDO
signInRecordDO
=
signInRecordDOS
.
get
(
0
);
LocalDateTime
localDateTime
=
vodPlayHistoryDOS
.
get
(
0
).
getCreateDate
()
.
minusSeconds
(
vodPlayHistoryDOS
.
get
(
0
).
getPlayLength
())
.
minusSeconds
(
vodPlayHistoryDOS
.
get
(
0
).
getSuspendLength
())
.
minusSeconds
(
random0to9
());
signInRecordMapper
.
insertRecord
(
dailyClassMembersVO
.
getClassId
(),
dailyClassMembersVO
.
getMemberId
(),
localDateTime
,
signInRecordDO
.
getIpAddress
(),
signInRecordDO
.
getDeviceNo
(),
localDateTime
);
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
}
@Scheduled
(
cron
=
"0 15 23 * * ?"
)
public
void
clearErrorData
(){
//查看当天产生视频学习的班级
List
<
Long
>
classIds
=
vodPlayHistoryMapper
.
dailyVodRecord
();
HashMap
<
Long
,
HashSet
<
Long
>>
hashMap
=
new
HashMap
();
for
(
Long
classId
:
classIds
)
{
List
<
ClassMemberMappingDO
>
classMemberMappingDOS
=
classMemberMappingMapper
.
selectList
(
new
QueryWrapper
<
ClassMemberMappingDO
>()
.
lambda
()
.
eq
(
ClassMemberMappingDO:
:
getClassId
,
classId
));
HashSet
<
Long
>
memberIds
=
new
HashSet
<>();
for
(
ClassMemberMappingDO
classMemberMappingDO
:
classMemberMappingDOS
)
{
List
<
VodPlayStateVO
>
vodPlayStateVOS
=
vodDictMapper
.
testPlays
(
classMemberMappingDO
.
getMemberId
(),
Long
.
valueOf
(
classId
));
for
(
int
i
=
0
;
i
<
vodPlayStateVOS
.
size
()
-
1
;
i
++)
{
VodPlayStateVO
vodPlayStateVO
=
vodPlayStateVOS
.
get
(
i
+
1
);
//后面
VodPlayStateVO
vodPlayStateVO1
=
vodPlayStateVOS
.
get
(
i
);
//前面
if
(
vodPlayStateVO1
.
getEndDate
().
getTime
()
>
vodPlayStateVO
.
getStartDate
().
getTime
())
{
memberIds
.
add
(
vodPlayStateVO
.
getMemberId
());
}
}
}
hashMap
.
put
(
classId
,
memberIds
);
}
for
(
Long
clsId
:
hashMap
.
keySet
())
{
HashSet
<
Long
>
memberIds
=
hashMap
.
get
(
clsId
);
for
(
Long
memberId
:
memberIds
)
{
//查看这个人这个班当天的签到时间
SignInRecordDO
signInRecordDO
=
signInRecordMapper
.
getDailySignInRecord
(
memberId
,
clsId
);
if
(
null
!=
signInRecordDO
)
{
LocalDateTime
signInDate
=
signInRecordDO
.
getSignInDate
();
//查看这个人当天的学习数据
List
<
VodPlayHistoryDO
>
vodPlayHistoryDOS
=
vodPlayHistoryMapper
.
exPlayInfoAsc
(
memberId
,
clsId
);
//从签到时间开始依次“展开”数据
int
currentLength
=
0
;
for
(
VodPlayHistoryDO
vodPlayHistoryDO
:
vodPlayHistoryDOS
)
{
currentLength
+=
random0to9
()
+
vodPlayHistoryDO
.
getPlayLength
()
+
vodPlayHistoryDO
.
getSuspendLength
();
LocalDateTime
newCreateDate
=
signInDate
.
plusSeconds
(
currentLength
);
vodPlayHistoryMapper
.
updatePlayRecord
(
vodPlayHistoryDO
.
getId
(),
newCreateDate
);
}
}
}
}
}
/**
* 随机0-9秒
*/
public
int
random0to9
()
{
return
(
int
)
(
Math
.
random
()
*
10
+
3
);
}
/**
* 删掉有登录数据 做过人脸 没有学习数据(视频+考试+答疑)
*/
@Scheduled
(
cron
=
"0 35 23 * * ?"
)
...
...
src/main/java/com/subsidy/jobs/WarningJob.java
View file @
7f91af8
...
...
@@ -38,44 +38,44 @@ public class WarningJob {
@Value
(
"${spring.profiles.active}"
)
private
String
env
;
/**
* 11点钟有错误数据 发短信
*/
@Scheduled
(
cron
=
"0 0 23 * * ?"
)
public
void
classBaseInfo
(){
if
(
"prod"
.
equals
(
env
))
{
List
<
Long
>
result
=
new
ArrayList
<>();
//查看当天产生视频学习的班级
List
<
Long
>
classIds
=
vodPlayHistoryMapper
.
dailyVodRecord
();
for
(
Long
classId
:
classIds
)
{
List
<
ClassMemberMappingDO
>
classMemberMappingDOS
=
classMemberMappingMapper
.
selectList
(
new
QueryWrapper
<
ClassMemberMappingDO
>()
.
lambda
()
.
eq
(
ClassMemberMappingDO:
:
getClassId
,
classId
));
for
(
ClassMemberMappingDO
classMemberMappingDO
:
classMemberMappingDOS
)
{
List
<
VodPlayStateVO
>
vodPlayStateVOS
=
vodDictMapper
.
testPlays
(
classMemberMappingDO
.
getMemberId
(),
Long
.
valueOf
(
classId
));
for
(
int
i
=
0
;
i
<
vodPlayStateVOS
.
size
()
-
1
;
i
++)
{
VodPlayStateVO
vodPlayStateVO
=
vodPlayStateVOS
.
get
(
i
+
1
);
//后面
VodPlayStateVO
vodPlayStateVO1
=
vodPlayStateVOS
.
get
(
i
);
//前面
if
(
vodPlayStateVO1
.
getEndDate
().
getTime
()
>
vodPlayStateVO
.
getStartDate
().
getTime
())
{
if
(!
result
.
contains
(
vodPlayStateVO1
.
getClassId
())){
result
.
add
(
vodPlayStateVO
.
getClassId
());
}
}
}
}
}
if
(
result
.
size
()>
0
){
List
<
String
>
telephones
=
Arrays
.
asList
(
new
String
[]{
"15201936167"
,
"18201963812"
,
"18217669021"
});
for
(
String
telephone
:
telephones
){
smsUtils
.
sendWarning
(
"SMS_460945631"
,
telephone
,
result
.
toString
());
}
}
}
}
//
/**
//
* 11点钟有错误数据 发短信
//
*/
//
@Scheduled(cron = "0 0 23 * * ?")
//
public void classBaseInfo(){
//
if ("prod".equals(env)) {
//
//
List<Long> result = new ArrayList<>();
//
//
//查看当天产生视频学习的班级
//
List<Long> classIds = vodPlayHistoryMapper.dailyVodRecord();
//
for (Long classId : classIds) {
//
//
List<ClassMemberMappingDO> classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper<ClassMemberMappingDO>()
//
.lambda()
//
.eq(ClassMemberMappingDO::getClassId, classId));
//
for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) {
//
List<VodPlayStateVO> vodPlayStateVOS = vodDictMapper.testPlays(classMemberMappingDO.getMemberId(), Long.valueOf(classId));
//
for (int i = 0; i < vodPlayStateVOS.size() - 1; i++) {
//
VodPlayStateVO vodPlayStateVO = vodPlayStateVOS.get(i + 1); //后面
//
VodPlayStateVO vodPlayStateVO1 = vodPlayStateVOS.get(i); //前面
//
if (vodPlayStateVO1.getEndDate().getTime() > vodPlayStateVO.getStartDate().getTime()) {
//
if (!result.contains(vodPlayStateVO1.getClassId())){
//
result.add(vodPlayStateVO.getClassId());
//
}
//
}
//
}
//
}
//
}
//
//
if (result.size()>0){
//
List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812", "18217669021"});
//
for (String telephone : telephones){
//
smsUtils.sendWarning("SMS_460945631", telephone, result.toString());
//
}
//
}
//
}
//
}
}
src/main/java/com/subsidy/mapper/SignInRecordMapper.java
View file @
7f91af8
...
...
@@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.subsidy.model.SignInRecordDO
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.subsidy.vo.sign.DataViewVO
;
import
com.subsidy.vo.sign.NoSignInDateVO
;
import
org.springframework.stereotype.Repository
;
import
java.time.LocalDateTime
;
import
java.util.List
;
@Repository
...
...
@@ -19,4 +21,11 @@ public interface SignInRecordMapper extends BaseMapper<SignInRecordDO> {
List
<
SignInRecordDO
>
getSignInRecord
();
/**
* 查看某个人某个班级的当天签到时间
*/
SignInRecordDO
getDailySignInRecord
(
Long
memberId
,
Long
classId
);
void
insertRecord
(
Long
classId
,
Long
memberId
,
LocalDateTime
signInDate
,
String
ipAddress
,
String
deviceNo
,
LocalDateTime
createDate
);
}
src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java
View file @
7f91af8
...
...
@@ -7,6 +7,7 @@ import com.subsidy.vo.administer.MemberStudyLogVO;
import
com.subsidy.vo.member.ContentVodNewVO
;
import
com.subsidy.vo.sign.DataViewVO
;
import
com.subsidy.vo.vod.ClassMemberPlayLengthVO
;
import
com.subsidy.vo.vod.DailyClassMembersVO
;
import
com.subsidy.vo.vod.GetMemberStudyInfoVO
;
import
com.subsidy.vo.vod.StudyHistoryVO
;
import
org.springframework.stereotype.Repository
;
...
...
@@ -51,11 +52,6 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
*/
int
completeVodOrNot
(
Long
memberId
,
Long
vodId
,
Long
classId
);
///**
// * 查看某个班级的学习记录
// */
//DataViewVO classStudyHistory(Long classId);
/**
* 查看这个课程某个成员看的视频课程
*/
...
...
@@ -82,11 +78,16 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
Integer
memberVodTotalLength
(
Long
classId
,
Long
memberId
,
Long
vodId
);
/**
* 跑脚本 前一天的学习情况
* 跑脚本 前一天的学习情况
倒序
*/
List
<
VodPlayHistoryDO
>
exPlayInfo
(
Long
memberId
,
String
classId
,
LocalDateTime
localDateTime
);
/**
* 当天某人某课程的学习数据
*/
List
<
VodPlayHistoryDO
>
exPlayInfoAsc
(
Long
memberId
,
Long
classId
);
/**
* 以班级、人的维度查询某个人的视频观看时长
*/
List
<
ClassMemberPlayLengthVO
>
classMemberPlayLength
(
Long
classId
);
...
...
@@ -106,6 +107,10 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
*/
void
insertPlayRecord
(
Long
classId
,
Long
vodId
,
Long
memberId
,
Integer
playLength
,
Integer
suspendLength
,
Integer
playRecord
,
Integer
playCount
,
Date
createDate
);
/**
* 修改一条记录
*/
void
updatePlayRecord
(
Long
id
,
LocalDateTime
createDate
);
double
getStudyTotal
();
...
...
@@ -116,4 +121,9 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
//查看当天产生视频学习的班级
List
<
Long
>
dailyVodRecord
();
/**
* 查看当天产生的视频数据的班级-学生
*/
List
<
DailyClassMembersVO
>
dailyClassMembers
();
}
src/main/java/com/subsidy/service/VodPlayHistoryService.java
View file @
7f91af8
...
...
@@ -36,6 +36,8 @@ public interface VodPlayHistoryService extends IService<VodPlayHistoryDO> {
HashMap
<
Long
,
HashSet
<
Long
>>
testPlays
();
void
reArrangeData
();
void
warning
();
}
src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java
View file @
7f91af8
...
...
@@ -469,10 +469,10 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
for
(
VodDictDO
vodDictDO
:
vodDictDOS
)
{
int
totalPlayLength
=
vodPlayHistoryMapper
.
memberVodTotalLength
(
classDetailDTO
.
getId
(),
classDetailVO
.
getId
(),
vodDictDO
.
getId
());
if
(
totalPlayLength
>=
vodDictDO
.
getVodLength
())
{
validLength
+=
vodDictDO
.
getVodLength
();
validLength
+=
vodDictDO
.
getVodLength
();
i
++;
}
else
{
validLength
+=
totalPlayLength
;
}
else
{
validLength
+=
totalPlayLength
;
}
playLength
+=
totalPlayLength
;
}
...
...
@@ -550,9 +550,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
int
totalPlayLength
=
vodPlayHistoryMapper
.
memberVodTotalLength
(
classDetailDTO
.
getId
(),
classDetailVO
.
getId
(),
vodDictDO
.
getId
());
if
(
totalPlayLength
>=
vodDictDO
.
getVodLength
())
{
i
++;
validLength
+=
vodDictDO
.
getVodLength
();
}
else
{
validLength
+=
totalPlayLength
;
validLength
+=
vodDictDO
.
getVodLength
();
}
else
{
validLength
+=
totalPlayLength
;
}
playLength
+=
totalPlayLength
;
}
...
...
@@ -613,9 +613,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
if
(
classDetailDTO
.
getFlag
())
{
// CourseDictDO courseDictDO = courseDictMapper.selectById(classDictDO.getCourseId());
String
studyDate
=
classDictDO
.
getStartDate
()
+
" 至 "
+
classDictDO
.
getEndDate
();
if
(
null
==
companyDictDO
)
{
if
(
null
==
companyDictDO
)
{
ExcelUtil
.
writeMemberExcel
(
null
,
studyDate
,
classDictDO
.
getClassName
(),
"授课记录汇总表"
,
classDetailVOS
,
ExcelFormatUtils
.
memberList
);
}
else
{
}
else
{
ExcelUtil
.
writeMemberExcel
(
companyDictDO
.
getCompanyName
(),
studyDate
,
classDictDO
.
getClassName
(),
"授课记录汇总表"
,
classDetailVOS
,
ExcelFormatUtils
.
memberList
);
}
}
...
...
@@ -709,9 +709,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
// CourseDictDO courseDictDO = courseDictMapper.selectById(classDictDO.getCourseId());
String
studyDate
=
classDictDO
.
getStartDate
()
+
" 至 "
+
classDictDO
.
getEndDate
();
if
(
null
==
companyDictDO
){
if
(
null
==
companyDictDO
)
{
ExcelUtil
.
writeSignExcel
(
null
,
studyDate
,
classDictDO
.
getClassName
(),
"注册签到表"
,
classSignVOS
,
ExcelFormatUtils
.
signList
);
}
else
{
}
else
{
ExcelUtil
.
writeSignExcel
(
companyDictDO
.
getCompanyName
(),
studyDate
,
classDictDO
.
getClassName
(),
"注册签到表"
,
classSignVOS
,
ExcelFormatUtils
.
signList
);
}
...
...
@@ -781,9 +781,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
CompanyDictDO
companyDictDO
=
companyDictMapper
.
selectById
(
classDictDO
.
getCompanyId
());
String
studyDate
=
classDictDO
.
getStartDate
()
+
" 至 "
+
classDictDO
.
getEndDate
();
if
(
null
==
companyDictDO
.
getCompanyName
()){
if
(
null
==
companyDictDO
.
getCompanyName
())
{
ExcelUtil
.
writeTestExcel
(
null
,
studyDate
,
classDictDO
.
getClassName
(),
"测试成绩表"
,
exerciseTestVOS
,
ExcelFormatUtils
.
scoreList
);
}
else
{
}
else
{
ExcelUtil
.
writeTestExcel
(
companyDictDO
.
getCompanyName
(),
studyDate
,
classDictDO
.
getClassName
(),
"测试成绩表"
,
exerciseTestVOS
,
ExcelFormatUtils
.
scoreList
);
}
}
...
...
@@ -813,9 +813,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
CompanyDictDO
companyDictDO
=
companyDictMapper
.
selectById
(
classDictDO
.
getCompanyId
());
String
studyDate
=
classDictDO
.
getStartDate
()
+
" 至 "
+
classDictDO
.
getEndDate
();
if
(
null
==
companyDictDO
){
if
(
null
==
companyDictDO
)
{
ExcelUtil
.
writeAnswerExcel
(
null
,
studyDate
,
classDictDO
.
getClassName
(),
"答疑记录表"
,
answerRecordVOS
,
ExcelFormatUtils
.
answersList
);
}
else
{
}
else
{
ExcelUtil
.
writeAnswerExcel
(
companyDictDO
.
getCompanyName
(),
studyDate
,
classDictDO
.
getClassName
(),
"答疑记录表"
,
answerRecordVOS
,
ExcelFormatUtils
.
answersList
);
}
...
...
@@ -1244,9 +1244,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
classDetailDTO
.
setFlag
(
false
);
List
<
ClassDetailVO
>
classDetailVOS
=
exportClassDetail
(
classDetailDTO
);
String
studyDate
=
classDictDO
.
getStartDate
()
+
" 至 "
+
classDictDO
.
getEndDate
();
if
(
null
==
companyDictDO
){
if
(
null
==
companyDictDO
)
{
membersListExcel
(
null
,
studyDate
,
classDictDO
.
getClassName
(),
"授课记录汇总表"
,
ExcelFormatUtils
.
memberList
,
classDetailVOS
,
null
,
0
,
baos
);
}
else
{
}
else
{
membersListExcel
(
companyDictDO
.
getCompanyName
(),
studyDate
,
classDictDO
.
getClassName
(),
"授课记录汇总表"
,
ExcelFormatUtils
.
memberList
,
classDetailVOS
,
null
,
0
,
baos
);
}
...
...
@@ -1259,9 +1259,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
classDetailDTO
.
setFlag
(
false
);
List
<
ClassSignVO
>
classSignVOS
=
exportSignDetail
(
classDetailDTO
);
if
(
null
==
companyDictDO
.
getCompanyName
()){
if
(
null
==
companyDictDO
.
getCompanyName
())
{
signListExcel
(
null
,
studyDate
,
classDictDO
.
getClassName
(),
"注册签到"
,
ExcelFormatUtils
.
signList
,
classSignVOS
,
null
,
0
,
baos1
);
}
else
{
}
else
{
signListExcel
(
companyDictDO
.
getCompanyName
(),
studyDate
,
classDictDO
.
getClassName
(),
"注册签到"
,
ExcelFormatUtils
.
signList
,
classSignVOS
,
null
,
0
,
baos1
);
}
...
...
@@ -1286,9 +1286,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
classDetailDTO
.
setFlag
(
false
);
classDetailDTO
.
setPaperId
(
paperDictDOS
.
get
(
i
).
getId
());
List
<
ExerciseTestVO
>
exerciseTestVOS
=
exportExerciseTest
(
classDetailDTO
);
if
(
null
==
companyDictDO
)
{
if
(
null
==
companyDictDO
)
{
testListExcel
(
null
,
studyDate
,
classDictDO
.
getClassName
(),
"测试成绩表"
,
ExcelFormatUtils
.
scoreList
,
exerciseTestVOS
,
null
,
0
,
baos2
);
}
else
{
}
else
{
testListExcel
(
companyDictDO
.
getCompanyName
(),
studyDate
,
classDictDO
.
getClassName
(),
"测试成绩表"
,
ExcelFormatUtils
.
scoreList
,
exerciseTestVOS
,
null
,
0
,
baos2
);
}
compressFileToZipStream
(
zipOutputStream
,
baos2
,
"test"
+
i
+
".xlsx"
);
...
...
@@ -1299,9 +1299,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
*/
ByteArrayOutputStream
baos3
=
new
ByteArrayOutputStream
();
List
<
AnswerRecordVO
>
answerRecordVOS
=
exportAnswerRecord
(
classDetailDTO
);
if
(
null
==
companyDictDO
.
getCompanyName
()){
if
(
null
==
companyDictDO
.
getCompanyName
())
{
askListExcel
(
null
,
studyDate
,
classDictDO
.
getClassName
(),
"答疑记录"
,
ExcelFormatUtils
.
answersList
,
answerRecordVOS
,
null
,
0
,
baos3
);
}
else
{
}
else
{
askListExcel
(
companyDictDO
.
getCompanyName
(),
studyDate
,
classDictDO
.
getClassName
(),
"答疑记录"
,
ExcelFormatUtils
.
answersList
,
answerRecordVOS
,
null
,
0
,
baos3
);
}
compressFileToZipStream
(
zipOutputStream
,
baos3
,
"answer.xlsx"
);
...
...
@@ -1364,7 +1364,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
if
(
null
!=
memberDO
)
{
ImportMemberDTO
importMemberDTO
=
new
ImportMemberDTO
();
BeanUtils
.
copyProperties
(
memberDO
,
importMemberDTO
);
BeanUtils
.
copyProperties
(
memberDO
,
importMemberDTO
);
failMembers
.
add
(
importMemberDTO
);
}
else
{
MemberDO
memberDO1
=
new
MemberDO
();
...
...
@@ -1457,9 +1457,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
ExcelUtil
.
writeExcel
(
manageMemberVOS
,
ManageMemberVO
.
class
);
}
public
void
selfExport
(
ClassDictDO
classDictDO
){
public
void
selfExport
(
ClassDictDO
classDictDO
)
{
List
<
SelfExportVO
>
selfExportVOS
=
this
.
baseMapper
.
selfExport
(
classDictDO
);
ExcelUtil
.
writeExcel
(
selfExportVOS
,
SelfExportVO
.
class
);
ExcelUtil
.
writeExcel
(
selfExportVOS
,
SelfExportVO
.
class
);
}
...
...
src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java
View file @
7f91af8
...
...
@@ -674,7 +674,11 @@ public class RenSheJuServiceImpl implements RenSheJuService {
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_8
);
renshejuHistoryDO
.
setInputParam
(
JSONObject
.
fromObject
(
uploadClassCodeDTO
).
toString
());
if
(
200
==
response
.
code
())
{
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
PUSH_SUCCESS
);
if
(
null
!=
rensheResponseVO
.
getCtt
()){
renshejuHistoryDO
.
setOutputParam
(
rensheResponseVO
.
getCtt
().
toString
());
}
else
{
response
.
body
().
toString
();
}
}
else
{
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
API_ERROR
);
}
...
...
src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
View file @
7f91af8
...
...
@@ -3,7 +3,6 @@ package com.subsidy.service.impl;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.subsidy.common.exception.HttpException
;
import
com.subsidy.dto.vod.FixDataTwoDTO
;
import
com.subsidy.dto.vod.InsertHistoryNewDTO
;
import
com.subsidy.dto.vod.RemainSecondsDTO
;
import
com.subsidy.dto.vod.SignDatePlaysDTO
;
...
...
@@ -11,19 +10,14 @@ import com.subsidy.mapper.*;
import
com.subsidy.model.*
;
import
com.subsidy.service.VodPlayHistoryService
;
import
com.subsidy.util.ConstantUtils
;
import
com.subsidy.util.DateFormatUtil
;
import
com.subsidy.util.RedisUtil
;
import
com.subsidy.util.SMSUtils
;
import
com.subsidy.vo.vod.VodPlayStateVO
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
/**
...
...
@@ -65,7 +59,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
public
String
insertHistory
(
VodPlayHistoryDO
vodPlayHistoryDO
)
{
Date
date
=
new
Date
();
if
(
vodPlayHistoryDO
.
getPlayLength
()
>
8
)
{
if
(
vodPlayHistoryDO
.
getPlayLength
()
>
8
&&
vodPlayHistoryDO
.
getSuspendLength
()
<=
3000
)
{
//查看系统设定的时长
ClassDictDO
classDictDO
=
classDictMapper
.
selectOne
(
new
QueryWrapper
<
ClassDictDO
>()
.
lambda
()
...
...
@@ -106,7 +100,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
String
insertHistoryNew
(
InsertHistoryNewDTO
insertHistoryNewDTO
)
{
Date
date
=
new
Date
();
if
(
insertHistoryNewDTO
.
getPlayLength
()
>
8
)
{
if
(
insertHistoryNewDTO
.
getPlayLength
()
>
8
&&
insertHistoryNewDTO
.
getSuspendLength
()
<=
3000
)
{
VodPlayHistoryDO
vodPlayHistoryDO
=
new
VodPlayHistoryDO
();
BeanUtils
.
copyProperties
(
insertHistoryNewDTO
,
vodPlayHistoryDO
);
//查看系统设定的时长
...
...
@@ -653,30 +647,19 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
VodPlayStateVO
vodPlayStateVO
=
vodPlayStateVOS
.
get
(
i
+
1
);
//后面
VodPlayStateVO
vodPlayStateVO1
=
vodPlayStateVOS
.
get
(
i
);
//前面
if
(
vodPlayStateVO1
.
getEndDate
().
getTime
()
>
vodPlayStateVO
.
getStartDate
().
getTime
())
{
//这一条数据有问题
// System.out.println("111111111111111111111" + vodPlayStateVO);
//查看这个人 这个课程 当天的全部数据 按照createDate升序排序
// List<VodPlayHistoryDO> vodPlayHistoryDOS = this.baseMapper.getVodPlayDay(Long.valueOf(classId), classMemberMappingDO.getMemberId(), vodPlayStateVO.getStartDate());
// //从第一条开始看,顺延减去第二条的playlength得到第二条的create_date 以此类推
// for (int l = 0; l < vodPlayHistoryDOS.size() - 1; l++) {
// VodPlayHistoryDO vph1 = vodPlayHistoryDOS.get(l); //第一条
// if (l == 0) {
// vph1.setPlayDate(vph1.getCreateDate());
// }
// VodPlayHistoryDO vph2 = vodPlayHistoryDOS.get(l + 1); //第二条
// LocalDateTime dateTmp = vph1.getPlayDate().plusSeconds(vph2.getPlayLength() + getRandom1_2());
// vph2.setPlayDate(dateTmp);
// this.baseMapper.updateById(vph2);
// }
result
.
add
(
vodPlayStateVO
.
getId
());
}
}
}
hashMap
.
put
(
classId
,
result
);
hashMap
.
put
(
classId
,
result
);
}
return
hashMap
;
}
public
void
reArrangeData
()
{
}
public
void
warning
()
{
//有问题的班级
...
...
@@ -704,9 +687,9 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
}
System
.
out
.
println
(
result
.
toString
());
if
(
result
.
size
()
>
0
)
{
if
(
result
.
size
()
>
0
)
{
List
<
String
>
telephones
=
Arrays
.
asList
(
new
String
[]{
"15201936167"
,
"18201963812"
,
"18217669021"
});
for
(
String
telephone
:
telephones
){
for
(
String
telephone
:
telephones
)
{
smsUtils
.
sendWarning
(
"SMS_460945631"
,
telephone
,
result
.
toString
());
}
}
...
...
@@ -751,12 +734,23 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
return
new
Random
().
nextInt
(
6
*
60
*
60
-
25
*
6
*
60
+
1
)
+
25
*
6
*
60
;
}
/**
* 随机0-9秒
*/
public
int
random0to9
()
{
return
(
int
)
(
Math
.
random
()
*
10
+
3
);
}
public
static
void
main
(
String
[]
args
)
{
for
(
int
i
=
0
;
i
<
50
;
i
++)
{
System
.
out
.
println
((
int
)
(
Math
.
random
()
*
10
)+
3
);
}
List
<
Long
>
list
=
new
ArrayList
<
Long
>();
list
.
add
(
1L
);
list
.
add
(
2L
);
System
.
out
.
println
(
list
.
toString
());
//
List<Long> list = new ArrayList<Long>();
//
list.add(1L);
//
list.add(2L);
//
System.out.println(list.toString());
// while (true) {
// System.out.println(getRandom1_2());
...
...
@@ -841,6 +835,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
return
(
int
)
(
Math
.
random
()
*
3
/
2
+
5
);
}
public
static
Integer
getRandom1_2
()
{
return
(
int
)
(
Math
.
random
()
*
3
/
2
+
1
);
}
...
...
src/main/java/com/subsidy/vo/sign/NoSignInDateVO.java
0 → 100644
View file @
7f91af8
package
com
.
subsidy
.
vo
.
sign
;
import
lombok.Data
;
@Data
public
class
NoSignInDateVO
{
}
src/main/java/com/subsidy/vo/vod/DailyClassMembersVO.java
0 → 100644
View file @
7f91af8
package
com
.
subsidy
.
vo
.
vod
;
import
lombok.Data
;
@Data
public
class
DailyClassMembersVO
{
private
Long
memberId
;
private
Long
classId
;
}
src/main/java/com/subsidy/vo/vod/VodPlayStateVO.java
View file @
7f91af8
...
...
@@ -20,6 +20,8 @@ public class VodPlayStateVO {
private
Long
playLength
;
// private Integer suspendLength;
private
LocalDateTime
createDate
;
}
src/main/resources/application-prod.properties
View file @
7f91af8
...
...
@@ -21,7 +21,7 @@ spring.datasource.druid.testOnReturn=false
spring.datasource.druid.poolPreparedStatements
=
true
spring.datasource.druid.maxPoolPreparedStatementPerConnectionSize
=
20
spring.datasource.druid.useGlobalDataSourceStat
=
true
spring.datasource.druid.kill-when-socket-read-
timeout
=
true
# 控制台日志打印
mybatis-plus.configuration.log-
impl
=
org.apache.ibatis.logging.stdout.StdOutImpl
...
...
src/main/resources/mapper/SignInRecordMapper.xml
View file @
7f91af8
...
...
@@ -58,4 +58,21 @@
interval 1 day)
</select>
<select
id=
"getDailySignInRecord"
resultType=
"com.subsidy.model.SignInRecordDO"
>
SELECT
*
FROM
sign_in_record t
WHERE
t.delete_date IS NULL
AND t.class_id = #{classId}
AND t.member_id = #{memberId}
AND DATE_FORMAT(create_date , '%Y-%m-%d' ) = DATE_FORMAT(NOW(),'%Y-%m-%d')
</select>
<insert
id=
"insertRecord"
>
insert into sign_in_record(class_id,member_id,sign_in_date,ip_address,device_no,create_date)
values (#{classId},#{memberId},#{signInDate},#{ipAddress},#{deviceNo},#{createDate})
</insert>
</mapper>
src/main/resources/mapper/VodPlayHistoryMapper.xml
View file @
7f91af8
...
...
@@ -404,6 +404,19 @@
order by t.play_date desc
</select>
<select
id=
"exPlayInfoAsc"
resultType=
"com.subsidy.model.VodPlayHistoryDO"
>
SELECT
*
FROM
vod_play_history t
WHERE
t.delete_date IS NULL
AND t.member_id = #{memberId}
AND t.class_id = #{classId}
AND DATE_FORMAT( t.create_date, '%Y-%m-%d' ) = CURDATE()
order by t.create_date
</select>
<select
id=
"classMemberPlayLength"
parameterType=
"long"
resultType=
"com.subsidy.vo.vod.ClassMemberPlayLengthVO"
>
SELECT
t.member_id,
...
...
@@ -473,6 +486,10 @@
VALUES (#{classId}, #{vodId}, #{memberId}, #{playLength},#{suspendLength},#{playRecord}, #{playCount},#{createDate})
</insert>
<update
id=
"updatePlayRecord"
>
update vod_play_history set create_date = #{createDate} where id = #{id}
</update>
<select
id=
"getStudyTotal"
resultType=
"java.lang.Double"
>
SELECT
sum( play_length )
...
...
@@ -519,5 +536,18 @@
AND t2.delete_date IS NULL
</select>
<select
id=
"dailyClassMembers"
resultType=
"com.subsidy.vo.vod.DailyClassMembersVO"
>
SELECT
t.member_id,
t.class_id
FROM
vod_play_history t
WHERE
t.delete_date IS NULL
AND DATE_FORMAT( t.create_date, '%Y-%m-%d' ) = CURRENT_DATE
GROUP BY
t.member_id,
t.class_id
</select>
</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