Commit a28c0dbc by 涂亚平

交叉时间数据脚本

1 parent 205d0ae8
Showing with 125 additions and 35 deletions
......@@ -26,6 +26,8 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.Method;
import java.nio.charset.StandardCharsets;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;
/**
......@@ -99,6 +101,16 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
}
throw new HttpException(1010);
}
TimeRequired timeRequired = method.getAnnotation(TimeRequired.class);
if (timeRequired !=null){
Calendar calendar = Calendar.getInstance();
int hour = calendar.get(Calendar.HOUR_OF_DAY);
if (hour<6){
throw new HttpException(17001);
}
}
return true;
}
}
package com.subsidy.common.interceptor;
import java.lang.annotation.*;
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
public @interface TimeRequired {
}
......@@ -98,7 +98,7 @@ public class AdministerController {
@PostMapping("classDetail")
@ApiOperation("班级管理--班级成员 id 班级id userName")
@LoginRequired
// @LoginRequired
public ResponseVO classDetail(@RequestBody ClassDetailDTO classDetailDTO){
return ResponseData.generateCreatedResponse(0,administerService.classDetail(classDetailDTO));
}
......
......@@ -3,6 +3,7 @@ package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.TimeRequired;
import com.subsidy.dto.cert.GetListDTO;
import com.subsidy.dto.cert.SignManagementDTO;
import com.subsidy.dto.cert.SignUpDTO;
......@@ -52,6 +53,7 @@ public class CertMemberMappingController {
@PostMapping("getList")
@ApiOperation("手机端---获取全部订单 memberId status pageSize pageNum")
@TimeRequired
public ResponseVO getList(@RequestBody GetListDTO getListDTO){
return ResponseData.generateCreatedResponse(0,certMemberMappingService.getList(getListDTO));
}
......
......@@ -4,6 +4,7 @@ package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.common.interceptor.TimeRequired;
import com.subsidy.dto.classDict.AddClassDTO;
import com.subsidy.dto.classDict.AddMemberToClassDTO;
import com.subsidy.dto.classDict.GetClassBaseInfoDTO;
......@@ -102,6 +103,7 @@ public class ClassDictController {
@PostMapping("getClassBaseInfo")
@ApiOperation("班级详情--获取课程基本信息 id")
@LoginRequired
@TimeRequired
public ResponseVO getClassBaseInfo(@RequestBody GetClassBaseInfoDTO getClassBaseInfoDTO){
return ResponseData.generateCreatedResponse(0,classDictService.getClassBaseInfo(getClassBaseInfoDTO));
}
......
......@@ -4,6 +4,7 @@ package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.common.interceptor.TimeRequired;
import com.subsidy.model.ClassHourDictDO;
import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.service.ClassHourDictService;
......@@ -50,6 +51,7 @@ public class ClassHourDictController {
@PostMapping("pollingGet")
@ApiOperation("轮询查询当前这个人当天有没有超过最长时长 memberId playLength")
@LoginRequired
@TimeRequired
public ResponseVO pollingGet(@RequestBody VodPlayHistoryDO vodPlayHistoryDO){
return ResponseData.generateCreatedResponse(0,classHourDictService.pollingGet(vodPlayHistoryDO));
}
......
......@@ -4,6 +4,7 @@ package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.common.interceptor.TimeRequired;
import com.subsidy.dto.exercise.GetAllExercisesDTO;
import com.subsidy.dto.exercise.GetPaperExerciseDTO;
import com.subsidy.dto.exercise.SubmitDTO;
......@@ -59,6 +60,7 @@ public class ExerciseDictController {
@PostMapping("submit")
@ApiOperation("提交答案 {paperId 卷子id memberId 成员id classId课程 courseId 课程id memberExerciseVOS [ id selectAnswer ] length:做题时长} ")
@LoginRequired
@TimeRequired
public ResponseVO submit(@RequestBody SubmitDTO submitDTO){
return ResponseData.generateCreatedResponse(0,exerciseDictService.submit(submitDTO));
}
......
......@@ -4,6 +4,7 @@ package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.common.interceptor.TimeRequired;
import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.service.ExerciseDoneResultService;
import io.swagger.annotations.Api;
......@@ -31,12 +32,13 @@ public class ExerciseDoneResultController {
@PostMapping("getDoneDetail")
@ApiOperation("提交后获取做题结果 id 提交后返回的id")
@LoginRequired
@TimeRequired
public ResponseVO getDoneDetail(@RequestBody ExerciseDoneResultDO exerciseDoneResultDO){
return ResponseData.generateCreatedResponse(0,exerciseDoneResultService.getDoneDetail(exerciseDoneResultDO));
}
@PostMapping("importData")
public ResponseVO makedatas(@RequestParam("file") MultipartFile file){
public ResponseVO makeData(@RequestParam("file") MultipartFile file){
exerciseDoneResultService.importData(file);
return null;
}
......
......@@ -3,6 +3,7 @@ package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.common.interceptor.TimeRequired;
import com.subsidy.dto.administer.VerifyCodeDTO;
import com.subsidy.dto.member.*;
import com.subsidy.model.ExerciseDoneResultDO;
......@@ -62,24 +63,28 @@ public class MemberController {
@PostMapping(value = "/login")
@ApiOperation("手机端:登录:telephone/手机号, verifyCode/验证码")
@TimeRequired
public ResponseVO login(@RequestBody VerifyCodeDTO verifyCodeDTO) {
return ResponseData.generateCreatedResponse(0, memberService.login(verifyCodeDTO));
}
@PostMapping("passwordLogin")
@ApiOperation("手机端:密码登录 { companyId accountName password}")
@TimeRequired
public ResponseVO passwordLogin(@RequestBody PasswordLoginDTO passwordLoginDTO){
return ResponseData.generateCreatedResponse(0,memberService.passwordLogin(passwordLoginDTO));
}
@PostMapping("qingxuetangLogin")
@ApiOperation("轻学堂登录 手机号mobile")
@TimeRequired
public ResponseVO qingxuetangLogin(@RequestBody QingxuetangLoginDTO qingxuetangLoginDTO){
return ResponseData.generateCreatedResponse(0,memberService.qingxuetangLogin(qingxuetangLoginDTO));
}
@PostMapping("kunchiLogin")
@ApiOperation("鲲驰登陆 authCorpName 手机号mobile nickname timestamp sign")
@TimeRequired
public ResponseVO kunchiLogin(@RequestBody QingxuetangLoginDTO qingxuetangLoginDTO){
return ResponseData.generateCreatedResponse(0,memberService.kunchiLogin(qingxuetangLoginDTO));
}
......@@ -88,6 +93,7 @@ public class MemberController {
@PostMapping("updatePassword")
@ApiOperation("修改密码 {id password}")
@LoginRequired
@TimeRequired
public ResponseVO updatePassword(@RequestBody MemberDO memberDO){
return ResponseData.generateCreatedResponse(0,memberService.updatePassword(memberDO));
}
......@@ -100,7 +106,8 @@ public class MemberController {
@PostMapping("myCourses")
@ApiOperation("手机端:我的学习--课程 memberId 学员id status 状态 0:全部 1:进行中 2:待开始 3:已完成 ")
@LoginRequired
// @LoginRequired
@TimeRequired
public ResponseVO myCourses(@RequestBody MyCoursesDTO myCoursesDTO){
return ResponseData.generateCreatedResponse(0,memberService.myCourses(myCoursesDTO));
}
......@@ -108,6 +115,7 @@ public class MemberController {
@PostMapping("contentVod")
@ApiOperation("手机端:目录+视频 classId 班级id courseId 课程 memberId 学员id")
// @LoginRequired
@TimeRequired
public ResponseVO contentVod(@RequestBody ContentMemberDTO contentVodDTO){
return ResponseData.generateCreatedResponse(0,memberService.contentVod(contentVodDTO));
}
......@@ -115,6 +123,7 @@ public class MemberController {
@PostMapping("contentFiles")
@ApiOperation("手机端:目录+课件 courseId 课程 memberId 学员id")
@LoginRequired
@TimeRequired
public ResponseVO contentFiles(@RequestBody ContentMemberDTO contentMemberDTO){
return ResponseData.generateCreatedResponse(0,memberService.contentFiles(contentMemberDTO));
}
......@@ -122,6 +131,7 @@ public class MemberController {
@PostMapping("studyHistory")
@ApiOperation("学习记录 memberId 成员id pageSize pageNum")
@LoginRequired
@TimeRequired
public ResponseVO studyHistory(@RequestBody StudyHistoryDTO studyHistoryDTO){
return ResponseData.generateCreatedResponse(0,memberService.studyHistory(studyHistoryDTO));
}
......@@ -129,6 +139,7 @@ public class MemberController {
@PostMapping("getCourseTest")
@ApiOperation("获取课程下的测试情况 {memberId 成员id 班级id classId courseId 课程id }")
@LoginRequired
@TimeRequired
public ResponseVO getCourseTest(@RequestBody ContentMemberDTO contentMemberDTO){
return ResponseData.generateCreatedResponse(0,memberService.getCourseTest(contentMemberDTO));
}
......@@ -143,6 +154,7 @@ public class MemberController {
@PostMapping("getStudyInfo")
@ApiOperation("获取学生完成课程情况 id 学员id")
@LoginRequired
@TimeRequired
public ResponseVO getStudyInfo(@RequestBody MemberDO memberDO){
return ResponseData.generateCreatedResponse(0,memberService.getStudyInfo(memberDO));
}
......@@ -170,6 +182,7 @@ public class MemberController {
@PostMapping("qxy")
@ApiOperation("Q学友授权 telephone 手机号")
@TimeRequired
public ResponseVO qxy(@RequestBody MemberDO memberDO){
return ResponseData.generateCreatedResponse(0,memberService.qxy(memberDO));
}
......
......@@ -4,6 +4,7 @@ package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.common.interceptor.TimeRequired;
import com.subsidy.dto.member.GetMemberSignInfoDTO;
import com.subsidy.dto.sign.DataViewDTO;
import com.subsidy.model.SignInRecordDO;
......@@ -43,6 +44,7 @@ public class SignInRecordController {
@PostMapping("signIn")
@ApiOperation("签到 memberId")
@LoginRequired
@TimeRequired
public ResponseVO signIn(@RequestBody SignInRecordDO signInRecordDO) {
return ResponseData.generateCreatedResponse(0, signInRecordService.signIn(signInRecordDO));
}
......@@ -57,6 +59,7 @@ public class SignInRecordController {
@PostMapping("signInStatus")
@ApiOperation("判断学生当天有没有打卡 {memberId 学生id}")
@LoginRequired
@TimeRequired
public ResponseVO signInStatus(@RequestBody SignInRecordDO signInRecordDO) {
return ResponseData.generateCreatedResponse(0, signInRecordService.signInStatus(signInRecordDO));
}
......
......@@ -3,6 +3,7 @@ package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.TimeRequired;
import com.subsidy.dto.sms.SendVerifyCodeDTO;
import com.subsidy.service.SmsVerifyCodeService;
import io.swagger.annotations.Api;
......@@ -31,6 +32,7 @@ public class SmsVerifyCodeController {
@PostMapping(value = "/send")
@ApiOperation("发送短信验证码 {telephone} ")
@TimeRequired
public ResponseVO sendVerifyCode(@RequestBody SendVerifyCodeDTO sendVerifyCodeDTO ) {
smsVerifyCodeService.sendVerifyCode(sendVerifyCodeDTO);
return ResponseData.generateCreatedResponse(0);
......
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.common.interceptor.TimeRequired;
import com.subsidy.dto.vod.InsertHistoryNewDTO;
import com.subsidy.dto.vod.RemainSecondsDTO;
import com.subsidy.dto.vod.SignDatePlaysDTO;
......@@ -37,6 +38,7 @@ public class VodPlayHistoryController {
@PostMapping("insertHistory")
@ApiOperation("记录学生看视频位置 ajax请求 classId班级id vodId 视频id memberId 成员id playLength 播放时长 playRecord 位点")
@LoginRequired
@TimeRequired
public ResponseVO insertHistory(@RequestBody VodPlayHistoryDO vodPlayHistoryDO){
return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.insertHistory(vodPlayHistoryDO));
}
......@@ -44,6 +46,7 @@ public class VodPlayHistoryController {
@RequestMapping("insertHistoryNew")
@ApiOperation("记录学生看视频位置 classId班级id vodId 视频id memberId 成员id playLength 播放时长 playRecord 位点")
// @LoginRequired
@TimeRequired
public ResponseVO insertHistoryNew(@RequestBody String param){
InsertHistoryNewDTO insertHistoryNewDTO = JSON.parseObject(param, InsertHistoryNewDTO.class);
return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.insertHistoryNew(insertHistoryNewDTO));
......@@ -51,36 +54,37 @@ public class VodPlayHistoryController {
@PostMapping("dataFix")
@ApiOperation("每个视频都看一次")
@LoginRequired
// @LoginRequired
public void dadaFix(@RequestBody SignDatePlaysDTO dataFixDTO){
vodPlayHistoryService.dataFix(dataFixDTO);
}
@PostMapping("signDatePlays")
@ApiOperation("每天接着看几个视频 接dataFix的")
@LoginRequired
// @LoginRequired
public void signDatePlays(@RequestBody SignDatePlaysDTO signDatePlaysDTO ){
vodPlayHistoryService.signDatePlays(signDatePlaysDTO);
}
@PostMapping("remainSeconds")
@ApiOperation("每个视频先看一下,然后剩余时长分配到每天里")
@LoginRequired
@ApiOperation("每个视频先看一下,然后剩余时长分配到每天里 classId memberId")
// @LoginRequired
public void remainSeconds(@RequestBody RemainSecondsDTO remainSecondsDTO){
vodPlayHistoryService.remainSeconds(remainSecondsDTO);
}
@PostMapping("playLengthFix")
@ApiOperation("按照时长去跑脚本 {classId}")
@LoginRequired
@ApiOperation("按照时长去跑脚本 {classId memberId}")
// @LoginRequired
public void playLengthFix(@RequestBody RemainSecondsDTO remainSecondsDTO){
vodPlayHistoryService.playLengthFix(remainSecondsDTO);
}
@PostMapping("testPlays")
public ResponseVO testPlays(){
return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.testPlays());
@ApiOperation("解决有交叉时间的数据")
public ResponseVO testPlays(@RequestBody VodPlayHistoryDO vodPlayHistoryDO){
return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.testPlays(vodPlayHistoryDO));
}
}
......@@ -7,4 +7,6 @@ public class RemainSecondsDTO {
private Long classId;
private Long memberId;
}
......@@ -12,6 +12,7 @@ import com.subsidy.vo.vod.StudyHistoryVO;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
/**
......@@ -40,8 +41,6 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
*/
List<VodPlayHistoryDO> getVodPlayHistory();
void deleteById(Long id);
/**
* 查看某人当天看了多少时间
*/
......@@ -92,5 +91,10 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
*/
List<ClassMemberPlayLengthVO> classMemberPlayLength(Long classId);
/**
* 查找某个人某个课程某天看视频的全部数据---按照createDate排序
*/
List<VodPlayHistoryDO> getVodPlayDay(Long classId, Long memberId, Date endDate);
}
......@@ -32,5 +32,5 @@ public interface VodPlayHistoryService extends IService<VodPlayHistoryDO> {
void playLengthFix(RemainSecondsDTO remainSecondsDTO);
List<Long> testPlays();
List<Long> testPlays(VodPlayHistoryDO vodPlayHistoryDO);
}
......@@ -43,38 +43,39 @@ public class ExerciseDoneResultServiceImpl extends ServiceImpl<ExerciseDoneResul
@Autowired
private ExerciseDoneHistoryMapper exerciseDoneHistoryMapper;
public GetDoneDetailVO getDoneDetail(ExerciseDoneResultDO exerciseDoneResultDO){
public GetDoneDetailVO getDoneDetail(ExerciseDoneResultDO exerciseDoneResultDO) {
return this.baseMapper.getDoneDetail(exerciseDoneResultDO.getId());
}
public void importData(MultipartFile multipartFile){
public void importData(MultipartFile multipartFile) {
try {
ExcelUtil.readExcel(null, ImportHistory.class, multipartFile).forEach(s -> {
//找到相同卷子相同分数的人
List<ExerciseDoneResultDO> exerciseDoneResultDOS = exerciseDoneResultMapper.selectList(new QueryWrapper<ExerciseDoneResultDO>()
.lambda()
.eq(ExerciseDoneResultDO::getPaperId,s.getPaperId())
.eq(ExerciseDoneResultDO::getScore,s.getScore()));
.lambda()
.eq(ExerciseDoneResultDO::getPaperId, s.getPaperId())
.eq(ExerciseDoneResultDO::getScore, s.getScore()));
//随机获取一个人
Random random = new Random();
ExerciseDoneResultDO exerciseDoneResultDO = exerciseDoneResultDOS.get(random.nextInt(exerciseDoneResultDOS.size()));
//找到这个人的答卷
List<ExerciseDoneHistoryDO> exerciseDoneHistoryDOS = exerciseDoneHistoryMapper.selectList(new QueryWrapper<ExerciseDoneHistoryDO>()
.lambda()
.eq(ExerciseDoneHistoryDO::getDoneId,exerciseDoneResultDO.getId())
.eq(ExerciseDoneHistoryDO::getMemberId,exerciseDoneResultDO.getMemberId())
.eq(ExerciseDoneHistoryDO::getPaperId,exerciseDoneResultDO.getPaperId()));
.lambda()
.eq(ExerciseDoneHistoryDO::getDoneId, exerciseDoneResultDO.getId())
.eq(ExerciseDoneHistoryDO::getMemberId, exerciseDoneResultDO.getMemberId())
.eq(ExerciseDoneHistoryDO::getPaperId, exerciseDoneResultDO.getPaperId()));
DateTimeFormatter formatter =
DateTimeFormatter.ofPattern("EEE MMM dd HH:mm:ss zzz yyyy",Locale.ENGLISH);
DateTimeFormatter.ofPattern("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH);
//遍历写入
for (ExerciseDoneHistoryDO exerciseDoneHistoryDO : exerciseDoneHistoryDOS){
for (ExerciseDoneHistoryDO exerciseDoneHistoryDO : exerciseDoneHistoryDOS) {
ExerciseDoneHistoryDO ex = new ExerciseDoneHistoryDO();
BeanUtils.copyProperties(exerciseDoneHistoryDO,ex);
BeanUtils.copyProperties(exerciseDoneHistoryDO, ex);
ex.setId(null);
ex.setMemberId(s.getMemberId());
ex.setDoneId(s.getId());
......@@ -82,15 +83,22 @@ public class ExerciseDoneResultServiceImpl extends ServiceImpl<ExerciseDoneResul
ex.setPaperId(s.getPaperId());
// DateUtil.getJavaDate()
ex.setCreateDate(LocalDateTime.parse(s.getCreate_date(),formatter));
ex.setCreateDate(LocalDateTime.parse(s.getCreate_date(), formatter));
exerciseDoneHistoryMapper.insert(ex);
}
});
}catch (Exception ex){
} catch (Exception ex) {
ex.printStackTrace();
}
}
public static void main(String[] args) {
while (true) {
System.out.println(new Random().nextInt(0));
}
}
}
......@@ -16,7 +16,7 @@ public abstract class BaseModel {
* 创建时间
*/
@JsonIgnore
@TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER, value = "create_date", fill = FieldFill.INSERT)
// @TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER, value = "create_date", fill = FieldFill.INSERT)
private LocalDateTime createDate;
/**
......
......@@ -6,6 +6,7 @@ import org.springframework.stereotype.Component;
import javax.servlet.http.HttpSession;
import javax.websocket.*;
import javax.websocket.server.ServerEndpoint;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
......@@ -77,7 +78,7 @@ public class ChatEndPoint {
/**
* 接收到客户端发送的数据时候被调用
*/
@OnMessage
@OnMessage(maxMessageSize = 102400)
public void onMessage(String msg, Session session) {
try {
......
......@@ -2,6 +2,7 @@ package com.subsidy.vo.vod;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.Date;
@Data
......@@ -15,6 +16,8 @@ public class VodPlayStateVO {
private Date endDate;
private Integer playLength;
private Long playLength;
private LocalDateTime createDate;
}
# 环境配置
spring.profiles.active=dev
spring.profiles.active=prod
# 端口号
spring.server.port=23457
spring.server.port=23459
#嵌入tomcat配置
#和CPU数
spring.server.acceptorThreadCount=600
......
......@@ -63,4 +63,7 @@ meishu.code-message[15002]=类型已存在证书,删除失败
meishu.code-message[16001]=该条件已存在
meishu.code-message[17001]=系统不支持00:00:00~06:00:00学习
......@@ -97,7 +97,8 @@
member_id,
DATE_SUB( create_date, INTERVAL play_length SECOND ) AS start_date,
create_date AS end_date,
t.play_length
t.play_length,
create_date
FROM
vod_play_history t
where t.member_id = #{memberId}
......
......@@ -384,4 +384,18 @@
t3.vod_name
</select>
<select id="getVodPlayDay" parameterType="com.subsidy.model.VodPlayHistoryDO" resultType="com.subsidy.model.VodPlayHistoryDO">
SELECT
*
FROM
vod_play_history t
WHERE
t.delete_date IS NULL
AND t.class_id = #{classId}
AND t.member_id = #{memberId}
AND DATE_FORMAT( t.create_date, '%Y-%m-%d' ) = DATE_FORMAT( #{endDate}, '%Y-%m-%d' )
ORDER BY
t.create_date
</select>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!