From bd196736b617c398a900f39fbd05049c6908f5e7 Mon Sep 17 00:00:00 2001 From: DengMin <16679070171@qq.com> Date: Wed, 22 Dec 2021 15:44:55 +0800 Subject: [PATCH] 新增定时器,代码优化 --- src/main/java/com/subsidy/controller/AdministerController.java | 14 +++++++------- src/main/java/com/subsidy/controller/CourseDictController.java | 4 ++-- src/main/java/com/subsidy/jobs/Scheduler.java | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/mapper/OprAdmDictMapper.java | 3 +++ src/main/java/com/subsidy/mapper/OprMemDictMapper.java | 5 +++++ src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java | 7 +++++++ src/main/java/com/subsidy/util/DateFormatUtil.java | 8 ++++++++ src/main/java/com/subsidy/vo/course/QueryCoursesVO.java | 29 ++++++++++++++++++++++++++++- src/main/java/com/subsidy/vo/vod/GetVodPlayHistoryVO.java | 22 ++++++++++++++++++++++ src/main/resources/mapper/OprAdmDictMapper.xml | 13 +++++++++++++ src/main/resources/mapper/OprMemDictMapper.xml | 14 ++++++++++++++ src/main/resources/mapper/VodPlayHistoryMapper.xml | 19 +++++++++++++++++++ 12 files changed, 236 insertions(+), 10 deletions(-) create mode 100644 src/main/java/com/subsidy/jobs/Scheduler.java create mode 100644 src/main/java/com/subsidy/vo/vod/GetVodPlayHistoryVO.java diff --git a/src/main/java/com/subsidy/controller/AdministerController.java b/src/main/java/com/subsidy/controller/AdministerController.java index 9dd8824..ce1c124 100644 --- a/src/main/java/com/subsidy/controller/AdministerController.java +++ b/src/main/java/com/subsidy/controller/AdministerController.java @@ -69,47 +69,47 @@ public class AdministerController { } @PostMapping("/administers") - @ApiOperation("** 查询所有运营者 { userName pageNum pageSize }") + @ApiOperation("查询所有运营者 { userName pageNum pageSize }") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO operators(@RequestBody OperatorsDTO operatorsDTO){ return ResponseData.generateCreatedResponse(0,administerService.operators(operatorsDTO)); } @PostMapping("addAdminister") - @ApiOperation("** 添加运营者 id userName 名称 accountName 账号 ") + @ApiOperation("添加运营者 id userName 名称 accountName 账号 ") public ResponseVO addAdminister(@RequestBody AdministerDO administerDO){ return ResponseData.generateCreatedResponse(0,administerService.addAdminister(administerDO)); } @PostMapping("deleteAdminister") - @ApiOperation("** 添加运营者 id ") + @ApiOperation("添加运营者 id ") public ResponseVO deleteAdminister(@RequestBody AdministerDO administerDO){ return ResponseData.generateCreatedResponse(0,administerService.deleteAdminister(administerDO)); } @PostMapping("updateAdminister") - @ApiOperation("** 编辑运营者 id userName 名称 accountName 账号 password") + @ApiOperation("编辑运营者 id userName 名称 accountName 账号 password") public ResponseVO updateAdminister(@RequestBody AdministerDO administerDO){ return ResponseData.generateCreatedResponse(0,administerService.updateAdminister(administerDO)); } @PostMapping("classSummary") - @ApiOperation("** 课程汇总 id 班级id ") + @ApiOperation("课程汇总 id 班级id ") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO classSummary(@RequestBody ClassDetailDTO classDetailDTO){ return ResponseData.generateCreatedResponse(0,administerService.classSummary(classDetailDTO)); } @PostMapping("classDetail") - @ApiOperation("** 班级管理--班级成员 id 班级id userName") + @ApiOperation("班级管理--班级成员 id 班级id userName") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO classDetail(@RequestBody ClassDetailDTO classDetailDTO){ return ResponseData.generateCreatedResponse(0,administerService.classDetail(classDetailDTO)); } @PostMapping("exportClassDetail") - @ApiOperation("** 班级管理--班级成员--导出 id 班级id userName") + @ApiOperation("班级管理--班级成员--导出 id 班级id userName") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public void exportClassDetail(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{ classDetailDTO.setFlag(true); diff --git a/src/main/java/com/subsidy/controller/CourseDictController.java b/src/main/java/com/subsidy/controller/CourseDictController.java index a3ded81..d3ca18e 100644 --- a/src/main/java/com/subsidy/controller/CourseDictController.java +++ b/src/main/java/com/subsidy/controller/CourseDictController.java @@ -45,7 +45,7 @@ public class CourseDictController { } @PostMapping("queryCourses") - @ApiOperation("** 平台运营者--查询课程 pageSize pageNum administerId companyId courseName categoryId courseType courseSource") + @ApiOperation("平台运营者--查询课程 pageSize pageNum administerId companyId courseName categoryId courseType courseSource") //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO queryCourses(@RequestBody QueryCoursesDTO queryCoursesDTO){ return ResponseData.generateCreatedResponse(0,courseDictService.queryCourses(queryCoursesDTO)); @@ -59,7 +59,7 @@ public class CourseDictController { } @PostMapping("queryCompanyCourse") - @ApiOperation("企业内容管理-- { ** companyId 所选企业id}") + @ApiOperation("企业内容管理-- { companyId 所选企业id}") public ResponseVO queryCompanyCourse(@RequestBody QueryCoursesDTO queryCoursesDTO){ return ResponseData.generateCreatedResponse(0,courseDictService.queryCompanyCourse(queryCoursesDTO)); } diff --git a/src/main/java/com/subsidy/jobs/Scheduler.java b/src/main/java/com/subsidy/jobs/Scheduler.java new file mode 100644 index 0000000..bc15b92 --- /dev/null +++ b/src/main/java/com/subsidy/jobs/Scheduler.java @@ -0,0 +1,108 @@ +package com.subsidy.jobs; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.subsidy.mapper.OprAdmDictMapper; +import com.subsidy.mapper.OprMemDictMapper; +import com.subsidy.mapper.VodPlayHistoryMapper; +import com.subsidy.model.OprAdmDictDO; +import com.subsidy.model.OprMemDictDO; +import com.subsidy.model.VodPlayHistoryDO; +import com.subsidy.util.DateFormatUtil; +import com.subsidy.util.RedisUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Set; + +/** + *
+ * 定时器 + *
+ * + * @author DengMin + * @since 2021/12/21 + */ + +@Component +public class Scheduler { + + @Autowired + private OprAdmDictMapper oprAdmDictMapper; + + @Autowired + private OprMemDictMapper oprMemDictMapper; + + @Autowired + private VodPlayHistoryMapper vodPlayHistoryMapper; + + @Autowired + private RedisUtil redisUtil; + + /** + 删除十天前登录记录(管理端) + */ + @Scheduled(cron = "0 42 18 * * ?") + public void delOprAdmRecord() { + List
* 审计表 Mapper 接口
@@ -19,4 +21,7 @@ public interface OprMemDictMapper extends BaseMapper