diff --git a/src/main/java/com/subsidy/MeishuApplication.java b/src/main/java/com/subsidy/MeishuApplication.java
index d863709..f94c800 100644
--- a/src/main/java/com/subsidy/MeishuApplication.java
+++ b/src/main/java/com/subsidy/MeishuApplication.java
@@ -1,11 +1,8 @@
package com.subsidy;
-import com.alibaba.druid.support.http.StatViewServlet;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.web.servlet.ServletRegistrationBean;
-import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.bind.annotation.RestController;
@@ -21,19 +18,19 @@ public class MeishuApplication {
SpringApplication.run(MeishuApplication.class, args);
}
- @Bean
- public ServletRegistrationBean druidStatViewServlet() {
- //先配置管理后台的servLet,访问的入口为/druid/
- ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(
- new StatViewServlet(), "/druid/*");
- // IP白名单 (没有配置或者为空,则允许所有访问)
- servletRegistrationBean.addInitParameter("allow", "127.0.0.1");
- // IP黑名单 (存在共同时,deny优先于allow)
- servletRegistrationBean.addInitParameter("deny", "");
- servletRegistrationBean.addInitParameter("loginUsername", "admin");
- servletRegistrationBean.addInitParameter("loginPassword", "yhkl1234");
- servletRegistrationBean.addInitParameter("resetEnable", "false");
- return servletRegistrationBean;
- }
+ //@Bean
+ //public ServletRegistrationBean druidStatViewServlet() {
+ // //先配置管理后台的servLet,访问的入口为/druid/
+ // ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(
+ // new StatViewServlet(), "/druid/*");
+ // // IP白名单 (没有配置或者为空,则允许所有访问)
+ // servletRegistrationBean.addInitParameter("allow", "127.0.0.1");
+ // // IP黑名单 (存在共同时,deny优先于allow)
+ // servletRegistrationBean.addInitParameter("deny", "");
+ // servletRegistrationBean.addInitParameter("loginUsername", "admin");
+ // servletRegistrationBean.addInitParameter("loginPassword", "yhkl1234");
+ // servletRegistrationBean.addInitParameter("resetEnable", "false");
+ // return servletRegistrationBean;
+ //}
}
diff --git a/src/main/java/com/subsidy/common/RedisPrefixConstant.java b/src/main/java/com/subsidy/common/RedisPrefixConstant.java
new file mode 100644
index 0000000..f06de0e
--- /dev/null
+++ b/src/main/java/com/subsidy/common/RedisPrefixConstant.java
@@ -0,0 +1,35 @@
+package com.subsidy.common;
+
+public class RedisPrefixConstant {
+
+ /**
+ * subsidyAdminister_accountName:AdministerDO 老师账号密码
+ */
+ public static final String SUBSIDY_ADMINISTER_PREFIX = "subsidyAdminister_";
+
+ /**
+ * subsidyMember_companyId_accountName:MemberDO 学员账号密码
+ */
+ public static final String SUBSIDY_COMPANY_MEMBER_PREFIX = "subsidyMember_";
+
+ /**
+ * subsidy_memberLogin_memberId_now : OprMemDictDO 学员端审计记录
+ */
+ public static final String SUBSIDY_MEMBER_LOGIN_PREFIX = "subsidy_memberLogin_";
+
+ /**
+ * subsidySmsCode_telephone:code 手机验证码
+ */
+ public static final String SUBSIDY_TELEPHONE_PREFIX = "subsidySmsCode_";
+
+ /**
+ * subsidySettings_companyId:ClassHourDictDO 公司操作设置
+ */
+ public static final String SUBSIDY_SETTINGS_PREFIX = "subsidySettings_";
+
+ /**
+ * subsidySignInfo_memberId_1_classId_12_20211223_long,do 学生签到数据
+ */
+ public static final String SUBSIDY_SIGN_INFO_PREFIX = "subsidySignInfo_";
+
+}
diff --git a/src/main/java/com/subsidy/common/configure/ThreadPoolConfig.java b/src/main/java/com/subsidy/common/configure/ThreadPoolConfig.java
new file mode 100644
index 0000000..8dc87ae
--- /dev/null
+++ b/src/main/java/com/subsidy/common/configure/ThreadPoolConfig.java
@@ -0,0 +1,16 @@
+package com.subsidy.common.configure;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.AsyncConfigurer;
+import java.util.concurrent.*;
+
+@Configuration
+public class ThreadPoolConfig implements AsyncConfigurer {
+
+
+ @Bean
+ public ExecutorService getThreadPool(){
+ return Executors.newCachedThreadPool();
+ }
+}
diff --git a/src/main/java/com/subsidy/controller/AdministerController.java b/src/main/java/com/subsidy/controller/AdministerController.java
index ce1c124..72ccd40 100644
--- a/src/main/java/com/subsidy/controller/AdministerController.java
+++ b/src/main/java/com/subsidy/controller/AdministerController.java
@@ -9,28 +9,23 @@ import com.subsidy.dto.administer.ClassDetailDTO;
import com.subsidy.dto.administer.ClassVodInfoDTO;
import com.subsidy.dto.administer.OperatorsDTO;
import com.subsidy.model.AdministerDO;
-import com.subsidy.model.ClassDictDO;
import com.subsidy.model.ExerciseDoneHistoryDO;
import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.service.AdministerService;
import com.subsidy.util.ConstantUtils;
-import com.subsidy.util.excel.ExcelUtil;
-import com.subsidy.vo.administer.ExerciseTestVO;
-import com.subsidy.vo.classdict.ClassDetailVO;
-import com.subsidy.vo.member.ClassSignVO;
-import com.subsidy.vo.sign.AnswerRecordVO;
-import com.subsidy.vo.sign.ClassSignInfoVO;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import io.swagger.annotations.Api;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
-import javax.servlet.http.HttpServletResponse;
import java.net.InetAddress;
-import java.util.Arrays;
-import java.util.List;
/**
*
@@ -51,18 +46,17 @@ public class AdministerController {
@GetMapping("getIp")
public String getIp()throws Exception{
InetAddress addr = InetAddress.getLocalHost();
- System.out.println("Local HostAddress:"+addr.getHostAddress());
return addr.getHostAddress();
}
@PostMapping("/login")
- @ApiOperation("** 登录接口 accountName password")
+ @ApiOperation("登录接口 accountName password")
public ResponseVO login(@RequestBody AdministerDO administerDO){
return ResponseData.generateCreatedResponse(0,administerService.login(administerDO));
}
@PostMapping("/getPermissions")
- @ApiOperation("** 权限查询")
+ @ApiOperation("权限查询")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getPermissions() {
return ResponseData.generateCreatedResponse(0, administerService.getPermissions());
@@ -93,10 +87,9 @@ public class AdministerController {
return ResponseData.generateCreatedResponse(0,administerService.updateAdminister(administerDO));
}
-
@PostMapping("classSummary")
@ApiOperation("课程汇总 id 班级id ")
- @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
+ //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO classSummary(@RequestBody ClassDetailDTO classDetailDTO){
return ResponseData.generateCreatedResponse(0,administerService.classSummary(classDetailDTO));
}
@@ -117,8 +110,8 @@ public class AdministerController {
}
@PostMapping("signDetail")
- @ApiOperation("** 班级管理--注册签到 id 班级id userName")
- @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
+ @ApiOperation("班级管理--注册签到 id 班级id userName")
+ //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO signDetail(@RequestBody ClassDetailDTO classDetailDTO){
return ResponseData.generateCreatedResponse(0,administerService.signDetail(classDetailDTO));
}
@@ -160,14 +153,14 @@ public class AdministerController {
}
@PostMapping("answerRecord")
- @ApiOperation("** 班级管理--答疑 id 班级id userName")
+ @ApiOperation("班级管理--答疑 id 班级id userName")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO answerRecord(@RequestBody ClassDetailDTO classDetailDTO){
return ResponseData.generateCreatedResponse(0,administerService.answerRecord(classDetailDTO));
}
@PostMapping("exportAnswerRecord")
- @ApiOperation("** 班级管理--答疑 id 班级id userName")
+ @ApiOperation("班级管理--答疑 id 班级id userName")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public void exportAnswerRecord(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{
classDetailDTO.setFlag(true);
@@ -195,16 +188,9 @@ public class AdministerController {
}
@PostMapping("importMember")
- @ApiOperation("** 导入学生 {companyId 公司id file}")
+ @ApiOperation("导入学生 {companyId 公司id file}")
public ResponseVO importMember(Long companyId,@RequestParam("file") MultipartFile file){
return ResponseData.generateCreatedResponse(0,administerService.importMember(companyId,file));
}
- @PostMapping("importRedis")
- @ApiOperation("导入老师账号到redis")
- public void importRedis(){
- administerService.importRedis();
- }
-
-
}
diff --git a/src/main/java/com/subsidy/controller/AnsweringQuestionController.java b/src/main/java/com/subsidy/controller/AnsweringQuestionController.java
index 214a1ba..3f4dad2 100644
--- a/src/main/java/com/subsidy/controller/AnsweringQuestionController.java
+++ b/src/main/java/com/subsidy/controller/AnsweringQuestionController.java
@@ -6,11 +6,13 @@ import com.subsidy.common.ResponseVO;
import com.subsidy.dto.GetCourseQuestionDTO;
import com.subsidy.model.AnsweringQuestionDO;
import com.subsidy.service.AnsweringQuestionService;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import io.swagger.annotations.Api;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
/**
*
@@ -29,25 +31,25 @@ public class AnsweringQuestionController {
private AnsweringQuestionService answeringQuestionService;
@PostMapping("getCourseQuestion")
- @ApiOperation("** 获取某个课程的答疑 {classId pageSize pageNum memberId}")
+ @ApiOperation(" 获取某个课程的答疑 {classId pageSize pageNum memberId}")
public ResponseVO getCourseQuestion(@RequestBody GetCourseQuestionDTO getCourseQuestionDTO){
return ResponseData.generateCreatedResponse(0,answeringQuestionService.getCourseQuestion(getCourseQuestionDTO));
}
@PostMapping("addQuestion")
- @ApiOperation("** 新增答疑 {classId askId title}")
+ @ApiOperation("新增答疑 {classId askId title}")
public ResponseVO addQuestion(@RequestBody AnsweringQuestionDO answeringQuestionDO){
return ResponseData.generateCreatedResponse(0,answeringQuestionService.addQuestion(answeringQuestionDO));
}
@PostMapping("deleteQuestion")
- @ApiOperation("** 删除答疑 {id}")
+ @ApiOperation(" 删除答疑 {id}")
public ResponseVO deleteQuestion(@RequestBody AnsweringQuestionDO answeringQuestionDO){
return ResponseData.generateCreatedResponse(0,answeringQuestionService.deleteQuestion(answeringQuestionDO));
}
@PostMapping("updateQuestion")
- @ApiOperation("** 编辑答疑 {id answerId answer}")
+ @ApiOperation("编辑答疑 {id answerId answer}")
public ResponseVO updateQuestion(@RequestBody AnsweringQuestionDO answeringQuestionDO){
return ResponseData.generateCreatedResponse(0, answeringQuestionService.updateQuestion(answeringQuestionDO));
}
diff --git a/src/main/java/com/subsidy/controller/CategoryController.java b/src/main/java/com/subsidy/controller/CategoryController.java
index 2da5ac9..b51184a 100644
--- a/src/main/java/com/subsidy/controller/CategoryController.java
+++ b/src/main/java/com/subsidy/controller/CategoryController.java
@@ -8,14 +8,13 @@ import com.subsidy.dto.category.GetCategoriesDTO;
import com.subsidy.model.CategoryDO;
import com.subsidy.service.CategoryService;
import com.subsidy.util.ConstantUtils;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
-
import org.springframework.web.bind.annotation.RestController;
-import io.swagger.annotations.Api;
/**
*
@@ -34,34 +33,34 @@ public class CategoryController {
private CategoryService categoryService;
@PostMapping("getCategories")
- @ApiOperation("查询类目 ** name 类目名称 companyId pageSize pageNum")
+ @ApiOperation("查询类目 name 类目名称 companyId pageSize pageNum")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getCategories(@RequestBody GetCategoriesDTO getCategoriesDTO){
return ResponseData.generateCreatedResponse(0,categoryService.getCategories(getCategoriesDTO));
}
@PostMapping("getAll")
- @ApiOperation("查询所有类目 **companyId")
+ @ApiOperation("查询所有类目 companyId")
public ResponseVO getAll(@RequestBody GetCategoriesDTO getCategoriesDTO){
return ResponseData.generateCreatedResponse(0,categoryService.getAll(getCategoriesDTO));
}
@PostMapping("addCategory")
- @ApiOperation("新增类目 **name companyId")
+ @ApiOperation("新增类目 name companyId")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addCategory(@RequestBody CategoryDO categoryDO){
return ResponseData.generateCreatedResponse(0,categoryService.addCategory(categoryDO));
}
@PostMapping("deleteCategory")
- @ApiOperation("删除类目 ** id")
+ @ApiOperation("删除类目 id")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO deleteCategory(@RequestBody CategoryDO categoryDO){
return ResponseData.generateCreatedResponse(0,categoryService.deleteCategory(categoryDO));
}
@PostMapping("updateCategory")
- @ApiOperation("修改类目 ** id name companyId")
+ @ApiOperation("修改类目 id name companyId")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateCategory(@RequestBody CategoryDO categoryDO){
return ResponseData.generateCreatedResponse(0,categoryService.updateCategory(categoryDO));
diff --git a/src/main/java/com/subsidy/controller/ClassDictController.java b/src/main/java/com/subsidy/controller/ClassDictController.java
index 9791cd3..676385c 100644
--- a/src/main/java/com/subsidy/controller/ClassDictController.java
+++ b/src/main/java/com/subsidy/controller/ClassDictController.java
@@ -6,21 +6,18 @@ import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.classDict.AddClassDTO;
import com.subsidy.dto.classDict.AddMemberToClassDTO;
-import com.subsidy.dto.classDict.GetAllClassesDTO;
import com.subsidy.dto.classDict.GetSpareMembersDTO;
import com.subsidy.model.ClassDictDO;
import com.subsidy.model.ClassMemberMappingDO;
-import com.subsidy.model.CourseDictDO;
import com.subsidy.service.ClassDictService;
import com.subsidy.util.ConstantUtils;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
-
import org.springframework.web.bind.annotation.RestController;
-import io.swagger.annotations.Api;
/**
*
@@ -46,14 +43,14 @@ public class ClassDictController {
}
@PostMapping("deleteClasses")
- @ApiOperation("** 删除课程 id")
+ @ApiOperation(" 删除课程 id")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO deleteClasses(@RequestBody ClassDictDO classDictDO){
return ResponseData.generateCreatedResponse(0,classDictService.deleteClasses(classDictDO));
}
@PostMapping("addClass")
- @ApiOperation("添加课程 ** userId:登录人id companyId courseId className startDate endDate")
+ @ApiOperation("添加课程 userId:登录人id companyId courseId className startDate endDate")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addClass(@RequestBody AddClassDTO addClassDTO){
return ResponseData.generateCreatedResponse(0,classDictService.addClass(addClassDTO));
@@ -67,14 +64,14 @@ public class ClassDictController {
}
@PostMapping("classDetail")
- @ApiOperation("** 获取一个班级详情 id")
+ @ApiOperation("获取一个班级详情 id")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO classDetail(@RequestBody ClassDictDO classDictDO){
return ResponseData.generateCreatedResponse(0,classDictService.classDetail(classDictDO));
}
@PostMapping("removeMember")
- @ApiOperation("** 移除班级 classId 班级id memberId人员id")
+ @ApiOperation("移除班级 classId 班级id memberId人员id")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO removeMember(@RequestBody ClassMemberMappingDO classMemberMappingDO){
return ResponseData.generateCreatedResponse(0,classDictService.removeMember(classMemberMappingDO));
@@ -88,7 +85,7 @@ public class ClassDictController {
}
@PostMapping("addMemberToClass")
- @ApiOperation("** 将某个成员加入到某个班级里 classId memberIds []")
+ @ApiOperation("将某个成员加入到某个班级里 classId memberIds []")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addMemberToClass(@RequestBody AddMemberToClassDTO addMemberToClassDTO){
return ResponseData.generateCreatedResponse(0,classDictService.addMemberToClass(addMemberToClassDTO));
@@ -96,7 +93,7 @@ public class ClassDictController {
@PostMapping("batchSms")
- @ApiOperation("** 批量发送班级短信 {id 班级id}")
+ @ApiOperation(" 批量发送班级短信 {id 班级id}")
public ResponseVO batchSms(@RequestBody ClassDictDO classDictDO){
return ResponseData.generateCreatedResponse(0,classDictService.batchSms(classDictDO));
}
diff --git a/src/main/java/com/subsidy/controller/ClassHourDictController.java b/src/main/java/com/subsidy/controller/ClassHourDictController.java
index 5e2a0c5..c3052a6 100644
--- a/src/main/java/com/subsidy/controller/ClassHourDictController.java
+++ b/src/main/java/com/subsidy/controller/ClassHourDictController.java
@@ -8,11 +8,13 @@ import com.subsidy.model.ClassHourDictDO;
import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.service.ClassHourDictService;
import com.subsidy.util.ConstantUtils;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import io.swagger.annotations.Api;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
/**
*
diff --git a/src/main/java/com/subsidy/controller/ClassMemberMappingController.java b/src/main/java/com/subsidy/controller/ClassMemberMappingController.java
deleted file mode 100644
index ec9096f..0000000
--- a/src/main/java/com/subsidy/controller/ClassMemberMappingController.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.subsidy.controller;
-
-
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.web.bind.annotation.RestController;
-import io.swagger.annotations.Api;
-
-/**
- *
- * 班级成员映射表 前端控制器
- *
- *
- * @author DengMin
- * @since 2021-10-12
- */
-@RestController
-@Api(tags = "班级成员映射表")
-@RequestMapping("/class-member-mapping-do")
-public class ClassMemberMappingController {
-
-}
diff --git a/src/main/java/com/subsidy/controller/CompanyDictController.java b/src/main/java/com/subsidy/controller/CompanyDictController.java
index 8ce3290..51c2b19 100644
--- a/src/main/java/com/subsidy/controller/CompanyDictController.java
+++ b/src/main/java/com/subsidy/controller/CompanyDictController.java
@@ -6,19 +6,16 @@ import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.administer.OperatorsDTO;
import com.subsidy.dto.company.AddCompanyDTO;
-import com.subsidy.mapper.CompanyDictMapper;
-import com.subsidy.model.AdministerDO;
import com.subsidy.model.CompanyDictDO;
import com.subsidy.service.CompanyDictService;
import com.subsidy.util.ConstantUtils;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
-
import org.springframework.web.bind.annotation.RestController;
-import io.swagger.annotations.Api;
/**
*
diff --git a/src/main/java/com/subsidy/controller/CourseContentController.java b/src/main/java/com/subsidy/controller/CourseContentController.java
index 33d43db..7caa9bf 100644
--- a/src/main/java/com/subsidy/controller/CourseContentController.java
+++ b/src/main/java/com/subsidy/controller/CourseContentController.java
@@ -5,17 +5,15 @@ import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.model.CourseContentDO;
-import com.subsidy.model.VodDictDO;
import com.subsidy.service.CourseContentService;
import com.subsidy.util.ConstantUtils;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
-
import org.springframework.web.bind.annotation.RestController;
-import io.swagger.annotations.Api;
/**
*
diff --git a/src/main/java/com/subsidy/controller/CourseDictController.java b/src/main/java/com/subsidy/controller/CourseDictController.java
index d3ca18e..43f6aea 100644
--- a/src/main/java/com/subsidy/controller/CourseDictController.java
+++ b/src/main/java/com/subsidy/controller/CourseDictController.java
@@ -8,11 +8,13 @@ import com.subsidy.dto.course.QueryCoursesDTO;
import com.subsidy.model.CourseDictDO;
import com.subsidy.service.CourseDictService;
import com.subsidy.util.ConstantUtils;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import io.swagger.annotations.Api;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
/**
*
diff --git a/src/main/java/com/subsidy/controller/DepartmentDictController.java b/src/main/java/com/subsidy/controller/DepartmentDictController.java
index 4173cee..6acb1d8 100644
--- a/src/main/java/com/subsidy/controller/DepartmentDictController.java
+++ b/src/main/java/com/subsidy/controller/DepartmentDictController.java
@@ -7,14 +7,13 @@ import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.model.DepartmentDictDO;
import com.subsidy.service.DepartmentDictService;
import com.subsidy.util.ConstantUtils;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
-
import org.springframework.web.bind.annotation.RestController;
-import io.swagger.annotations.Api;
/**
*
diff --git a/src/main/java/com/subsidy/controller/ExerciseDictController.java b/src/main/java/com/subsidy/controller/ExerciseDictController.java
index 4609eb6..dcb6530 100644
--- a/src/main/java/com/subsidy/controller/ExerciseDictController.java
+++ b/src/main/java/com/subsidy/controller/ExerciseDictController.java
@@ -7,16 +7,17 @@ import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.exercise.GetAllExercisesDTO;
import com.subsidy.dto.exercise.GetPaperExerciseDTO;
import com.subsidy.dto.exercise.SubmitDTO;
-import com.subsidy.mapper.ExerciseDictMapper;
import com.subsidy.model.CourseDictDO;
import com.subsidy.model.ExerciseDictDO;
import com.subsidy.service.ExerciseDictService;
import com.subsidy.util.ConstantUtils;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import io.swagger.annotations.Api;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
/**
*
diff --git a/src/main/java/com/subsidy/controller/ExerciseDoneHistoryController.java b/src/main/java/com/subsidy/controller/ExerciseDoneHistoryController.java
index 206457d..cfa65a1 100644
--- a/src/main/java/com/subsidy/controller/ExerciseDoneHistoryController.java
+++ b/src/main/java/com/subsidy/controller/ExerciseDoneHistoryController.java
@@ -3,15 +3,15 @@ package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
-import com.subsidy.model.ExerciseDoneHistoryDO;
import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.service.ExerciseDoneHistoryService;
-import com.subsidy.service.ExerciseDoneResultService;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import io.swagger.annotations.Api;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
/**
*
diff --git a/src/main/java/com/subsidy/controller/ExerciseDoneResultController.java b/src/main/java/com/subsidy/controller/ExerciseDoneResultController.java
index a798d50..08c774e 100644
--- a/src/main/java/com/subsidy/controller/ExerciseDoneResultController.java
+++ b/src/main/java/com/subsidy/controller/ExerciseDoneResultController.java
@@ -5,14 +5,13 @@ import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.service.ExerciseDoneResultService;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
-
import org.springframework.web.bind.annotation.RestController;
-import io.swagger.annotations.Api;
/**
*
diff --git a/src/main/java/com/subsidy/controller/FileDictController.java b/src/main/java/com/subsidy/controller/FileDictController.java
index 4611778..7875d54 100644
--- a/src/main/java/com/subsidy/controller/FileDictController.java
+++ b/src/main/java/com/subsidy/controller/FileDictController.java
@@ -5,17 +5,15 @@ import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.model.FileDictDO;
-import com.subsidy.model.VodDictDO;
import com.subsidy.service.FileDictService;
import com.subsidy.util.ConstantUtils;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
-
import org.springframework.web.bind.annotation.RestController;
-import io.swagger.annotations.Api;
/**
*
diff --git a/src/main/java/com/subsidy/controller/MemberController.java b/src/main/java/com/subsidy/controller/MemberController.java
index 58f469b..6c66c52 100644
--- a/src/main/java/com/subsidy/controller/MemberController.java
+++ b/src/main/java/com/subsidy/controller/MemberController.java
@@ -5,21 +5,22 @@ import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.administer.VerifyCodeDTO;
-import com.subsidy.dto.member.*;
-import com.subsidy.model.ExerciseDoneHistoryDO;
+import com.subsidy.dto.member.AddMemberDTO;
+import com.subsidy.dto.member.ContentMemberDTO;
+import com.subsidy.dto.member.GetAllDTO;
+import com.subsidy.dto.member.PasswordLoginDTO;
+import com.subsidy.dto.member.StudyHistoryDTO;
import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.model.MemberDO;
import com.subsidy.service.MemberService;
import com.subsidy.util.ConstantUtils;
-import com.subsidy.vo.member.ContentVodVO;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
-
import org.springframework.web.bind.annotation.RestController;
-import io.swagger.annotations.Api;
/**
*
diff --git a/src/main/java/com/subsidy/controller/MemberDepartmentMappingController.java b/src/main/java/com/subsidy/controller/MemberDepartmentMappingController.java
deleted file mode 100644
index 640c491..0000000
--- a/src/main/java/com/subsidy/controller/MemberDepartmentMappingController.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.subsidy.controller;
-
-
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.web.bind.annotation.RestController;
-import io.swagger.annotations.Api;
-
-/**
- *
- * 老师部门映射表 前端控制器
- *
- *
- * @author DengMin
- * @since 2021-11-01
- */
-@RestController
-@Api(tags = "老师部门映射表")
-@RequestMapping("/member-department-mapping-do")
-public class MemberDepartmentMappingController {
-
-}
diff --git a/src/main/java/com/subsidy/controller/OprAdmDictController.java b/src/main/java/com/subsidy/controller/OprAdmDictController.java
index 0bf6cc3..7dc33eb 100644
--- a/src/main/java/com/subsidy/controller/OprAdmDictController.java
+++ b/src/main/java/com/subsidy/controller/OprAdmDictController.java
@@ -5,14 +5,13 @@ import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.dto.opr.GetHistoryDTO;
import com.subsidy.service.OprAdmDictService;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
-
import org.springframework.web.bind.annotation.RestController;
-import io.swagger.annotations.Api;
/**
*
diff --git a/src/main/java/com/subsidy/controller/OprMemDictController.java b/src/main/java/com/subsidy/controller/OprMemDictController.java
index c2215ae..ab16191 100644
--- a/src/main/java/com/subsidy/controller/OprMemDictController.java
+++ b/src/main/java/com/subsidy/controller/OprMemDictController.java
@@ -5,14 +5,13 @@ import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.dto.opr.GetHistoryDTO;
import com.subsidy.service.OprMemDictService;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
-
import org.springframework.web.bind.annotation.RestController;
-import io.swagger.annotations.Api;
/**
*
diff --git a/src/main/java/com/subsidy/controller/PaperDictController.java b/src/main/java/com/subsidy/controller/PaperDictController.java
index db85df9..76e906f 100644
--- a/src/main/java/com/subsidy/controller/PaperDictController.java
+++ b/src/main/java/com/subsidy/controller/PaperDictController.java
@@ -3,17 +3,17 @@ package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
+import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.model.PaperDictDO;
import com.subsidy.service.PaperDictService;
import com.subsidy.util.ConstantUtils;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
-
import org.springframework.web.bind.annotation.RestController;
-import io.swagger.annotations.Api;
/**
*
@@ -33,26 +33,30 @@ public class PaperDictController {
@PostMapping("queryPapers")
@ApiOperation("查看课程下的测试 {courseId paperName}")
- public ResponseVO queryPapers(@RequestBody PaperDictDO paperDictDO){
- return ResponseData.generateCreatedResponse(0,paperDictService.queryPapers(paperDictDO));
+ @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
+ public ResponseVO queryPapers(@RequestBody PaperDictDO paperDictDO) {
+ return ResponseData.generateCreatedResponse(0, paperDictService.queryPapers(paperDictDO));
}
@PostMapping("deletePaper")
@ApiOperation("删除卷子 {id}")
- public ResponseVO deletePaper(@RequestBody PaperDictDO paperDictDO){
- return ResponseData.generateCreatedResponse(0,paperDictService.deletePaper(paperDictDO));
+ @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
+ public ResponseVO deletePaper(@RequestBody PaperDictDO paperDictDO) {
+ return ResponseData.generateCreatedResponse(0, paperDictService.deletePaper(paperDictDO));
}
@PostMapping("update")
@ApiOperation("启用/禁用 {id paperStatus}")
- public ResponseVO updateStatus(@RequestBody PaperDictDO paperDictDO){
- return ResponseData.generateCreatedResponse(0,paperDictService.updateStatus(paperDictDO));
+ @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
+ public ResponseVO updateStatus(@RequestBody PaperDictDO paperDictDO) {
+ return ResponseData.generateCreatedResponse(0, paperDictService.updateStatus(paperDictDO));
}
@PostMapping("addPaper")
@ApiOperation("添加卷子 {courseId paperName}")
- public ResponseVO addPaper(@RequestBody PaperDictDO paperDictDO){
- return ResponseData.generateCreatedResponse(0,paperDictService.addPaper(paperDictDO));
+ @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
+ public ResponseVO addPaper(@RequestBody PaperDictDO paperDictDO) {
+ return ResponseData.generateCreatedResponse(0, paperDictService.addPaper(paperDictDO));
}
diff --git a/src/main/java/com/subsidy/controller/PermissionsDictController.java b/src/main/java/com/subsidy/controller/PermissionsDictController.java
deleted file mode 100644
index c257813..0000000
--- a/src/main/java/com/subsidy/controller/PermissionsDictController.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.subsidy.controller;
-
-
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.web.bind.annotation.RestController;
-import io.swagger.annotations.Api;
-
-/**
- *
- * 权限表 前端控制器
- *
- *
- * @author DengMin
- * @since 2021-10-11
- */
-@RestController
-@Api(tags = "权限表")
-@RequestMapping("/permissions-dict-do")
-public class PermissionsDictController {
-
-}
diff --git a/src/main/java/com/subsidy/controller/RoleAdministerMappingController.java b/src/main/java/com/subsidy/controller/RoleAdministerMappingController.java
deleted file mode 100644
index bfc1119..0000000
--- a/src/main/java/com/subsidy/controller/RoleAdministerMappingController.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.subsidy.controller;
-
-
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.web.bind.annotation.RestController;
-import io.swagger.annotations.Api;
-
-/**
- *
- * 前端控制器
- *
- *
- * @author DengMin
- * @since 2021-10-11
- */
-@RestController
-@Api(tags = "")
-@RequestMapping("/role-administer-mapping-do")
-public class RoleAdministerMappingController {
-
-}
diff --git a/src/main/java/com/subsidy/controller/RoleDictController.java b/src/main/java/com/subsidy/controller/RoleDictController.java
deleted file mode 100644
index 76b225c..0000000
--- a/src/main/java/com/subsidy/controller/RoleDictController.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.subsidy.controller;
-
-
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.web.bind.annotation.RestController;
-import io.swagger.annotations.Api;
-
-/**
- *
- * 角色表 前端控制器
- *
- *
- * @author DengMin
- * @since 2021-10-11
- */
-@RestController
-@Api(tags = "角色表")
-@RequestMapping("/role-dict-do")
-public class RoleDictController {
-
-}
diff --git a/src/main/java/com/subsidy/controller/RolePermissionMappingController.java b/src/main/java/com/subsidy/controller/RolePermissionMappingController.java
deleted file mode 100644
index a17f192..0000000
--- a/src/main/java/com/subsidy/controller/RolePermissionMappingController.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.subsidy.controller;
-
-
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.web.bind.annotation.RestController;
-import io.swagger.annotations.Api;
-
-/**
- *
- * 系统用户角色表 前端控制器
- *
- *
- * @author DengMin
- * @since 2021-10-11
- */
-@RestController
-@Api(tags = "系统用户角色表")
-@RequestMapping("/role-permission-mapping-do")
-public class RolePermissionMappingController {
-
-}
diff --git a/src/main/java/com/subsidy/controller/SignInRecordController.java b/src/main/java/com/subsidy/controller/SignInRecordController.java
index cd535dc..fede451 100644
--- a/src/main/java/com/subsidy/controller/SignInRecordController.java
+++ b/src/main/java/com/subsidy/controller/SignInRecordController.java
@@ -3,22 +3,17 @@ package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
-import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.member.GetMemberSignInfoDTO;
import com.subsidy.dto.sign.ClassSignInfoDTO;
-import com.subsidy.dto.sign.SignInDTO;
-import com.subsidy.model.MemberDO;
import com.subsidy.model.SignInRecordDO;
import com.subsidy.service.SignInRecordService;
-import com.subsidy.util.ConstantUtils;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
-
import org.springframework.web.bind.annotation.RestController;
-import io.swagger.annotations.Api;
/**
*
@@ -38,32 +33,32 @@ public class SignInRecordController {
@PostMapping("getMemberSignInfo")
@ApiOperation("** 获取某个成员的签到记录 id 成员id pageSize pageNum")
- public ResponseVO getMemberSignInfo(@RequestBody GetMemberSignInfoDTO getMemberSignInfoDTO){
- return ResponseData.generateCreatedResponse(0,signInRecordService.getMemberSignInfo(getMemberSignInfoDTO));
+ public ResponseVO getMemberSignInfo(@RequestBody GetMemberSignInfoDTO getMemberSignInfoDTO) {
+ return ResponseData.generateCreatedResponse(0, signInRecordService.getMemberSignInfo(getMemberSignInfoDTO));
}
@PostMapping("signIn")
@ApiOperation("** 签到 memberId")
- public ResponseVO signIn(@RequestBody SignInRecordDO signInRecordDO){
- return ResponseData.generateCreatedResponse(0,signInRecordService.signIn(signInRecordDO));
+ public ResponseVO signIn(@RequestBody SignInRecordDO signInRecordDO) {
+ return ResponseData.generateCreatedResponse(0, signInRecordService.signIn(signInRecordDO));
}
@PostMapping("classStudyHistory")
@ApiOperation("** 校区学习记录 id 校区id className courseName pageSize pageNum")
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
- public ResponseVO classSignInfo(@RequestBody ClassSignInfoDTO classSignInfoDTO){
- return ResponseData.generateCreatedResponse(0,signInRecordService.classSignInfo(classSignInfoDTO));
+ public ResponseVO classSignInfo(@RequestBody ClassSignInfoDTO classSignInfoDTO) {
+ return ResponseData.generateCreatedResponse(0, signInRecordService.classSignInfo(classSignInfoDTO));
}
@PostMapping("signInStatus")
@ApiOperation("** 判断学生当天有没有打卡 {memberId 学生id}")
- public ResponseVO signInStatus(@RequestBody SignInRecordDO signInRecordDO){
- return ResponseData.generateCreatedResponse(0,signInRecordService.signInStatus(signInRecordDO));
+ public ResponseVO signInStatus(@RequestBody SignInRecordDO signInRecordDO) {
+ return ResponseData.generateCreatedResponse(0, signInRecordService.signInStatus(signInRecordDO));
}
@PostMapping("getRedisData")
- public ResponseVO test(){
- return ResponseData.generateCreatedResponse(0,signInRecordService.test());
+ public void test() {
+ signInRecordService.test();
}
}
diff --git a/src/main/java/com/subsidy/controller/SmsVerifyCodeController.java b/src/main/java/com/subsidy/controller/SmsVerifyCodeController.java
index f4d0788..48f89f6 100644
--- a/src/main/java/com/subsidy/controller/SmsVerifyCodeController.java
+++ b/src/main/java/com/subsidy/controller/SmsVerifyCodeController.java
@@ -5,14 +5,13 @@ import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.dto.sms.SendVerifyCodeDTO;
import com.subsidy.service.SmsVerifyCodeService;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
-
import org.springframework.web.bind.annotation.RestController;
-import io.swagger.annotations.Api;
/**
*
diff --git a/src/main/java/com/subsidy/controller/VodDictController.java b/src/main/java/com/subsidy/controller/VodDictController.java
index 7a965bb..71f7d76 100644
--- a/src/main/java/com/subsidy/controller/VodDictController.java
+++ b/src/main/java/com/subsidy/controller/VodDictController.java
@@ -8,14 +8,13 @@ import com.subsidy.dto.content.GetContendVodsDTO;
import com.subsidy.model.VodDictDO;
import com.subsidy.service.VodDictService;
import com.subsidy.util.ConstantUtils;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
-
import org.springframework.web.bind.annotation.RestController;
-import io.swagger.annotations.Api;
/**
*
diff --git a/src/main/java/com/subsidy/controller/VodPlayHistoryController.java b/src/main/java/com/subsidy/controller/VodPlayHistoryController.java
index 4324473..78b8de1 100644
--- a/src/main/java/com/subsidy/controller/VodPlayHistoryController.java
+++ b/src/main/java/com/subsidy/controller/VodPlayHistoryController.java
@@ -6,14 +6,13 @@ import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.service.VodPlayHistoryService;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
-
import org.springframework.web.bind.annotation.RestController;
-import io.swagger.annotations.Api;
/**
*
diff --git a/src/main/java/com/subsidy/dto/member/ContentMemberDTO.java b/src/main/java/com/subsidy/dto/member/ContentMemberDTO.java
index 841ae85..ecee135 100644
--- a/src/main/java/com/subsidy/dto/member/ContentMemberDTO.java
+++ b/src/main/java/com/subsidy/dto/member/ContentMemberDTO.java
@@ -5,10 +5,10 @@ import lombok.Data;
@Data
public class ContentMemberDTO {
- private Integer memberId;
+ private Long memberId;
private Long courseId;
- private Integer classId;
+ private Long classId;
}
diff --git a/src/main/java/com/subsidy/mapper/AdministerMapper.java b/src/main/java/com/subsidy/mapper/AdministerMapper.java
index 313c9c5..dacc50f 100644
--- a/src/main/java/com/subsidy/mapper/AdministerMapper.java
+++ b/src/main/java/com/subsidy/mapper/AdministerMapper.java
@@ -1,11 +1,9 @@
package com.subsidy.mapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.subsidy.dto.administer.OperatorsDTO;
import com.subsidy.model.AdministerDO;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.vo.administer.ExerciseTestVO;
-import com.subsidy.vo.administer.OperatorsVO;
import com.subsidy.vo.administer.PermissionsVO;
import com.subsidy.vo.classdict.ClassDetailVO;
import com.subsidy.vo.member.ClassSignVO;
diff --git a/src/main/java/com/subsidy/mapper/AnsweringQuestionMapper.java b/src/main/java/com/subsidy/mapper/AnsweringQuestionMapper.java
index 7fa17a8..02c44b7 100644
--- a/src/main/java/com/subsidy/mapper/AnsweringQuestionMapper.java
+++ b/src/main/java/com/subsidy/mapper/AnsweringQuestionMapper.java
@@ -1,14 +1,11 @@
package com.subsidy.mapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.model.AnsweringQuestionDO;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.vo.answer.GetCourseQuestionVO;
-import com.subsidy.vo.vod.GetContendVodsVO;
import org.springframework.stereotype.Repository;
-import java.util.List;
-
/**
*
* 问题答疑表 Mapper 接口
diff --git a/src/main/java/com/subsidy/mapper/ClassDictMapper.java b/src/main/java/com/subsidy/mapper/ClassDictMapper.java
index 7058b5a..a810e25 100644
--- a/src/main/java/com/subsidy/mapper/ClassDictMapper.java
+++ b/src/main/java/com/subsidy/mapper/ClassDictMapper.java
@@ -1,9 +1,8 @@
package com.subsidy.mapper;
-import com.subsidy.dto.classDict.GetAllClassesDTO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.dto.classDict.GetSpareMembersDTO;
import com.subsidy.model.ClassDictDO;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.model.MemberDO;
import com.subsidy.model.VodDictDO;
import com.subsidy.vo.classdict.GetAllClassesVO;
diff --git a/src/main/java/com/subsidy/mapper/ClassHourDictMapper.java b/src/main/java/com/subsidy/mapper/ClassHourDictMapper.java
index 5073596..0850873 100644
--- a/src/main/java/com/subsidy/mapper/ClassHourDictMapper.java
+++ b/src/main/java/com/subsidy/mapper/ClassHourDictMapper.java
@@ -15,10 +15,4 @@ import org.springframework.stereotype.Repository;
@Repository
public interface ClassHourDictMapper extends BaseMapper {
- /**
- * 获取课程的次数
- * @return
- */
- ClassHourDictDO getClassHourDictInfo(Long classId);
-
}
diff --git a/src/main/java/com/subsidy/mapper/ClassMemberMappingMapper.java b/src/main/java/com/subsidy/mapper/ClassMemberMappingMapper.java
index 441f533..36a6ca5 100644
--- a/src/main/java/com/subsidy/mapper/ClassMemberMappingMapper.java
+++ b/src/main/java/com/subsidy/mapper/ClassMemberMappingMapper.java
@@ -1,11 +1,9 @@
package com.subsidy.mapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.subsidy.dto.classDict.GetSpareMembersDTO;
import com.subsidy.model.ClassDictDO;
import com.subsidy.model.ClassMemberMappingDO;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.subsidy.model.MemberDO;
import com.subsidy.vo.administer.ClassDailyInfoVO;
import org.springframework.stereotype.Repository;
@@ -36,4 +34,9 @@ public interface ClassMemberMappingMapper extends BaseMapper getClassMembersWithName(IPage iPage, Long classId, String userName);
+
+ /**
+ * 获取学生当前有效班级
+ */
+ long getMemberClassCount(Long memberId);
}
diff --git a/src/main/java/com/subsidy/mapper/CompanyDictMapper.java b/src/main/java/com/subsidy/mapper/CompanyDictMapper.java
index f6ac0a3..9441538 100644
--- a/src/main/java/com/subsidy/mapper/CompanyDictMapper.java
+++ b/src/main/java/com/subsidy/mapper/CompanyDictMapper.java
@@ -1,9 +1,8 @@
package com.subsidy.mapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.subsidy.model.AdministerDO;
import com.subsidy.model.CompanyDictDO;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.vo.administer.OperatorsVO;
import com.subsidy.vo.company.GetAllCompanyVO;
import org.springframework.stereotype.Repository;
diff --git a/src/main/java/com/subsidy/mapper/CourseContentMapper.java b/src/main/java/com/subsidy/mapper/CourseContentMapper.java
index c16dd53..0a1ac29 100644
--- a/src/main/java/com/subsidy/mapper/CourseContentMapper.java
+++ b/src/main/java/com/subsidy/mapper/CourseContentMapper.java
@@ -1,8 +1,7 @@
package com.subsidy.mapper;
-import com.subsidy.model.CourseContentDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.subsidy.model.CourseDictDO;
+import com.subsidy.model.CourseContentDO;
import com.subsidy.model.VodDictDO;
import org.springframework.stereotype.Repository;
diff --git a/src/main/java/com/subsidy/mapper/CourseDictMapper.java b/src/main/java/com/subsidy/mapper/CourseDictMapper.java
index 750b60f..a789085 100644
--- a/src/main/java/com/subsidy/mapper/CourseDictMapper.java
+++ b/src/main/java/com/subsidy/mapper/CourseDictMapper.java
@@ -1,13 +1,11 @@
package com.subsidy.mapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.model.ClassMemberMappingDO;
import com.subsidy.model.CourseDictDO;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.subsidy.model.MemberDO;
import com.subsidy.vo.course.QueryCoursesVO;
import com.subsidy.vo.member.StudyPageVO;
-import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
diff --git a/src/main/java/com/subsidy/mapper/DepartmentDictMapper.java b/src/main/java/com/subsidy/mapper/DepartmentDictMapper.java
index 0d71522..c91ca73 100644
--- a/src/main/java/com/subsidy/mapper/DepartmentDictMapper.java
+++ b/src/main/java/com/subsidy/mapper/DepartmentDictMapper.java
@@ -1,12 +1,9 @@
package com.subsidy.mapper;
-import com.subsidy.dto.department.GetDepartmentsVO;
-import com.subsidy.model.DepartmentDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.subsidy.model.DepartmentDictDO;
import org.springframework.stereotype.Repository;
-import java.util.List;
-
/**
*
* 部门字典表 Mapper 接口
diff --git a/src/main/java/com/subsidy/mapper/MemberMapper.java b/src/main/java/com/subsidy/mapper/MemberMapper.java
index d2ac917..d964d49 100644
--- a/src/main/java/com/subsidy/mapper/MemberMapper.java
+++ b/src/main/java/com/subsidy/mapper/MemberMapper.java
@@ -1,14 +1,13 @@
package com.subsidy.mapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.dto.member.PasswordLoginDTO;
import com.subsidy.model.DepartmentDictDO;
import com.subsidy.model.MemberDO;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.vo.administer.UserRoleVO;
import com.subsidy.vo.member.GetAllVO;
import com.subsidy.vo.member.StudyPageVO;
-import io.swagger.models.auth.In;
import org.springframework.stereotype.Repository;
import java.util.List;
diff --git a/src/main/java/com/subsidy/mapper/SignInRecordMapper.java b/src/main/java/com/subsidy/mapper/SignInRecordMapper.java
index 2e96e16..11b1261 100644
--- a/src/main/java/com/subsidy/mapper/SignInRecordMapper.java
+++ b/src/main/java/com/subsidy/mapper/SignInRecordMapper.java
@@ -1,28 +1,19 @@
package com.subsidy.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.subsidy.dto.sign.ClassSignInfoDTO;
import com.subsidy.model.SignInRecordDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.vo.sign.ClassSignInfoVO;
import org.springframework.stereotype.Repository;
-/**
- *
- * 学生签到表 Mapper 接口
- *
- *
- * @author DengMin
- * @since 2021-10-18
- */
- @Repository
+@Repository
public interface SignInRecordMapper extends BaseMapper {
- /**
- * 公司学习记录
- */
+ /**
+ * 公司学习记录
+ */
- IPage classSignInfo(IPage iPage,String className,String courseName,Integer id);
+ IPage classSignInfo(IPage iPage, String className, String courseName, Integer id);
}
diff --git a/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java b/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java
index 8300758..dcdf6ba 100644
--- a/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java
+++ b/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java
@@ -1,10 +1,9 @@
package com.subsidy.mapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.model.VodPlayHistoryDO;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.vo.vod.GetMemberStudyInfoVO;
-import com.subsidy.vo.vod.GetVodPlayHistoryVO;
import com.subsidy.vo.vod.StudyHistoryVO;
import org.springframework.stereotype.Repository;
@@ -37,4 +36,9 @@ public interface VodPlayHistoryMapper extends BaseMapper {
List getVodPlayHistory();
void deleteById(Long id);
+
+ /**
+ * 查看某人当天看了多少时间
+ */
+ int memberDailyStudyLength(Long memberId);
}
diff --git a/src/main/java/com/subsidy/service/AdministerService.java b/src/main/java/com/subsidy/service/AdministerService.java
index 1196e48..8215403 100644
--- a/src/main/java/com/subsidy/service/AdministerService.java
+++ b/src/main/java/com/subsidy/service/AdministerService.java
@@ -1,19 +1,28 @@
package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.dto.administer.ClassDailyInfoDTO;
import com.subsidy.dto.administer.ClassDetailDTO;
import com.subsidy.dto.administer.ClassVodInfoDTO;
import com.subsidy.dto.administer.OperatorsDTO;
-import com.subsidy.model.*;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.subsidy.vo.administer.*;
+import com.subsidy.model.AdministerDO;
+import com.subsidy.model.ExerciseDoneHistoryDO;
+import com.subsidy.model.ExerciseDoneResultDO;
+import com.subsidy.vo.administer.AdministerPermissionVO;
+import com.subsidy.vo.administer.ClassDailyInfoVO;
+import com.subsidy.vo.administer.ClassSummaryVO;
+import com.subsidy.vo.administer.ClassVodInfoVO;
+import com.subsidy.vo.administer.ExerciseTestVO;
+import com.subsidy.vo.administer.GetMemberPapersVO;
+import com.subsidy.vo.administer.GetPaperDetailVO;
+import com.subsidy.vo.administer.LoginVO;
+import com.subsidy.vo.administer.OperatorsVO;
import com.subsidy.vo.classdict.ClassDetailVO;
import com.subsidy.vo.member.ClassSignVO;
import com.subsidy.vo.sign.AnswerRecordVO;
import org.springframework.web.multipart.MultipartFile;
-import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
@@ -68,5 +77,4 @@ public interface AdministerService extends IService {
String importMember(Long companyId, MultipartFile multipartFile);
- void importRedis();
}
diff --git a/src/main/java/com/subsidy/service/ClassDictService.java b/src/main/java/com/subsidy/service/ClassDictService.java
index ca6f06b..fd64d05 100644
--- a/src/main/java/com/subsidy/service/ClassDictService.java
+++ b/src/main/java/com/subsidy/service/ClassDictService.java
@@ -1,13 +1,11 @@
package com.subsidy.service;
+import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.dto.classDict.AddClassDTO;
import com.subsidy.dto.classDict.AddMemberToClassDTO;
-import com.subsidy.dto.classDict.GetAllClassesDTO;
import com.subsidy.dto.classDict.GetSpareMembersDTO;
import com.subsidy.model.ClassDictDO;
-import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.model.ClassMemberMappingDO;
-import com.subsidy.model.CourseDictDO;
import com.subsidy.model.MemberDO;
import com.subsidy.vo.classdict.GetAllClassesVO;
diff --git a/src/main/java/com/subsidy/service/ClassMemberMappingService.java b/src/main/java/com/subsidy/service/ClassMemberMappingService.java
deleted file mode 100644
index e5e7430..0000000
--- a/src/main/java/com/subsidy/service/ClassMemberMappingService.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.subsidy.service;
-
-import com.subsidy.model.ClassMemberMappingDO;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-/**
- *
- * 班级成员映射表 服务类
- *
- *
- * @author DengMin
- * @since 2021-10-12
- */
-public interface ClassMemberMappingService extends IService {
-
-}
diff --git a/src/main/java/com/subsidy/service/CompanyDictService.java b/src/main/java/com/subsidy/service/CompanyDictService.java
index aadbec7..d17f9e2 100644
--- a/src/main/java/com/subsidy/service/CompanyDictService.java
+++ b/src/main/java/com/subsidy/service/CompanyDictService.java
@@ -1,14 +1,12 @@
package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.dto.administer.OperatorsDTO;
import com.subsidy.dto.company.AddCompanyDTO;
-import com.subsidy.model.AdministerDO;
import com.subsidy.model.CompanyDictDO;
-import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.vo.administer.OperatorsVO;
import com.subsidy.vo.company.GetAllCompanyVO;
-import com.subsidy.vo.member.GetAllVO;
import java.util.List;
diff --git a/src/main/java/com/subsidy/service/CourseContentService.java b/src/main/java/com/subsidy/service/CourseContentService.java
index 128b5c8..6bc45ca 100644
--- a/src/main/java/com/subsidy/service/CourseContentService.java
+++ b/src/main/java/com/subsidy/service/CourseContentService.java
@@ -1,11 +1,7 @@
package com.subsidy.service;
-import com.subsidy.controller.CourseDictController;
-import com.subsidy.model.CourseContentDO;
import com.baomidou.mybatisplus.extension.service.IService;
-import com.subsidy.model.CourseDictDO;
-import com.subsidy.model.VodDictDO;
-import com.subsidy.vo.vod.GetContendVodsVO;
+import com.subsidy.model.CourseContentDO;
import java.util.List;
diff --git a/src/main/java/com/subsidy/service/MemberService.java b/src/main/java/com/subsidy/service/MemberService.java
index f53d7e5..1bf9cd7 100644
--- a/src/main/java/com/subsidy/service/MemberService.java
+++ b/src/main/java/com/subsidy/service/MemberService.java
@@ -1,17 +1,23 @@
package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.dto.administer.VerifyCodeDTO;
-import com.subsidy.dto.member.*;
-import com.subsidy.model.ExerciseDoneHistoryDO;
+import com.subsidy.dto.member.AddMemberDTO;
+import com.subsidy.dto.member.ContentMemberDTO;
+import com.subsidy.dto.member.GetAllDTO;
+import com.subsidy.dto.member.PasswordLoginDTO;
+import com.subsidy.dto.member.StudyHistoryDTO;
import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.model.MemberDO;
-import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.vo.administer.UserRoleVO;
-import com.subsidy.vo.member.*;
+import com.subsidy.vo.member.ContentFilesVO;
+import com.subsidy.vo.member.ContentVodNewVO;
+import com.subsidy.vo.member.GetAllVO;
+import com.subsidy.vo.member.GetStudyInfoVO;
+import com.subsidy.vo.member.MemberStudyPageVO;
import com.subsidy.vo.paper.QueryPapersVO;
-import java.lang.reflect.Member;
import java.util.List;
/**
diff --git a/src/main/java/com/subsidy/service/SignInRecordService.java b/src/main/java/com/subsidy/service/SignInRecordService.java
index fd7b878..f29f553 100644
--- a/src/main/java/com/subsidy/service/SignInRecordService.java
+++ b/src/main/java/com/subsidy/service/SignInRecordService.java
@@ -1,15 +1,12 @@
package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.dto.member.GetMemberSignInfoDTO;
import com.subsidy.dto.sign.ClassSignInfoDTO;
-import com.subsidy.dto.sign.SignInDTO;
-import com.subsidy.model.MemberDO;
import com.subsidy.model.SignInRecordDO;
-import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.vo.member.GetMemberSignInfoVO;
import com.subsidy.vo.sign.SignInStatusVO;
-import com.tencentcloudapi.common.Sign;
/**
*
@@ -29,5 +26,5 @@ public interface SignInRecordService extends IService {
SignInStatusVO signInStatus(SignInRecordDO signInRecordDO);
- Object test();
+ void test();
}
diff --git a/src/main/java/com/subsidy/service/VodDictService.java b/src/main/java/com/subsidy/service/VodDictService.java
index 1d5183a..80f753d 100644
--- a/src/main/java/com/subsidy/service/VodDictService.java
+++ b/src/main/java/com/subsidy/service/VodDictService.java
@@ -1,14 +1,12 @@
package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.dto.content.GetContendVodsDTO;
import com.subsidy.model.VodDictDO;
-import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.vo.vod.GetContendVodsVO;
import com.subsidy.vo.vod.SignatureVO;
-import java.util.List;
-
/**
*
* 视频表 服务类
diff --git a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java
index e66e482..7bb8a85 100644
--- a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java
@@ -3,19 +3,62 @@ package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.subsidy.common.RedisPrefixConstant;
import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.administer.ClassDailyInfoDTO;
import com.subsidy.dto.administer.ClassDetailDTO;
import com.subsidy.dto.administer.ClassVodInfoDTO;
import com.subsidy.dto.administer.OperatorsDTO;
import com.subsidy.dto.member.ImportMemberDTO;
-import com.subsidy.mapper.*;
-import com.subsidy.model.*;
+import com.subsidy.mapper.AdministerMapper;
+import com.subsidy.mapper.AnsweringQuestionMapper;
+import com.subsidy.mapper.ClassDictMapper;
+import com.subsidy.mapper.ClassMemberMappingMapper;
+import com.subsidy.mapper.CompanyDictMapper;
+import com.subsidy.mapper.CourseDictMapper;
+import com.subsidy.mapper.DepartmentDictMapper;
+import com.subsidy.mapper.ExerciseDoneResultMapper;
+import com.subsidy.mapper.MemberDepartmentMappingMapper;
+import com.subsidy.mapper.MemberMapper;
+import com.subsidy.mapper.OprAdmDictMapper;
+import com.subsidy.mapper.RoleAdministerMappingMapper;
+import com.subsidy.mapper.VodDictMapper;
+import com.subsidy.mapper.VodPlayHistoryMapper;
+import com.subsidy.model.AdministerDO;
+import com.subsidy.model.AnsweringQuestionDO;
+import com.subsidy.model.ClassDictDO;
+import com.subsidy.model.ClassMemberMappingDO;
+import com.subsidy.model.CompanyDictDO;
+import com.subsidy.model.CourseDictDO;
+import com.subsidy.model.DepartmentDictDO;
+import com.subsidy.model.ExerciseDoneHistoryDO;
+import com.subsidy.model.ExerciseDoneResultDO;
+import com.subsidy.model.MemberDO;
+import com.subsidy.model.MemberDepartmentMappingDO;
+import com.subsidy.model.OprAdmDictDO;
+import com.subsidy.model.RoleAdministerMappingDO;
+import com.subsidy.model.SignInRecordDO;
+import com.subsidy.model.VodDictDO;
+import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.service.AdministerService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.subsidy.util.*;
+import com.subsidy.util.ConstantUtils;
+import com.subsidy.util.ExcelFormatUtils;
+import com.subsidy.util.JwtUtil;
+import com.subsidy.util.Localstorage;
+import com.subsidy.util.MathUtil;
+import com.subsidy.util.RedisUtil;
import com.subsidy.util.excel.ExcelUtil;
-import com.subsidy.vo.administer.*;
+import com.subsidy.vo.administer.AdministerPermissionVO;
+import com.subsidy.vo.administer.ClassDailyInfoVO;
+import com.subsidy.vo.administer.ClassSummaryVO;
+import com.subsidy.vo.administer.ClassVodInfoVO;
+import com.subsidy.vo.administer.ExerciseTestVO;
+import com.subsidy.vo.administer.GetMemberPapersVO;
+import com.subsidy.vo.administer.GetPaperDetailVO;
+import com.subsidy.vo.administer.LoginVO;
+import com.subsidy.vo.administer.OperatorsVO;
+import com.subsidy.vo.administer.PermissionsVO;
import com.subsidy.vo.classdict.ClassDetailVO;
import com.subsidy.vo.done.GetMaxScoreVO;
import com.subsidy.vo.member.ClassSignVO;
@@ -29,7 +72,8 @@ import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
import org.apache.commons.lang3.StringUtils;
-import org.apache.poi.hssf.usermodel.*;
+import org.apache.poi.hssf.usermodel.HSSFCellStyle;
+import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.util.CellRangeAddress;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Font;
@@ -39,7 +83,8 @@ import org.apache.poi.xssf.streaming.SXSSFSheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
@@ -48,12 +93,20 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
-import java.io.*;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@@ -88,9 +141,6 @@ public class AdministerServiceImpl extends ServiceImpl()
.lambda()
.eq(AdministerDO::getAccountName, administerDO.getAccountName()));
- redisUtil.set("subsidyAdminister_"+administerDO.getAccountName(),administerDO1);
+ redisUtil.set(RedisPrefixConstant.SUBSIDY_ADMINISTER_PREFIX + administerDO.getAccountName(), administerDO1);
}
/**
@@ -178,15 +228,15 @@ public class AdministerServiceImpl extends ServiceImpl()
@@ -266,11 +318,13 @@ public class AdministerServiceImpl extends ServiceImpl()
@@ -284,7 +338,7 @@ public class AdministerServiceImpl extends ServiceImpl vodDictDOS = classDictMapper.getClassVods(classDetailDTO.getId());
classSummaryVO.setTotalVodCounts(vodDictDOS.size());
+ /**
+ * 学生平均学习时长和平均学习次数
+ */
+ ExecutorService executorService = Executors.newCachedThreadPool();
+
+ //多个任务
+ executorService.execute(() -> //总共学习课时数 + 学习时长
+ summaryTask1(classSummaryVO, classMemberMappingDOS, vodDictDOS));
+ executorService.execute(() -> //测试通过率
+ summaryTask2(classSummaryVO, classDictDO.getId()));
+ executorService.execute(() -> //签到总次数
+ summaryTask3(classSummaryVO, classDictDO.getId()));
+ executorService.execute(() -> //答疑数
+ summaryTask4(classSummaryVO, classDictDO.getId()));
+ //执行后不再接收新任务,如果里面有任务,就执行完
+ executorService.shutdown();
+ try {
+ while (true) {
+ //等待所有任务都结束了继续执行
+ if (executorService.isTerminated()) {
+ break;
+ }
+ }
+
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ return classSummaryVO;
+ }
+
+ public Future summaryTask1(ClassSummaryVO classSummaryVO, List classMemberMappingDOS, List vodDictDOS) {
+
int totalStudyVods = 0;
int totalStudyLength = 0;
@@ -340,11 +426,15 @@ public class AdministerServiceImpl extends ServiceImpl(classSummaryVO);
+ }
+
+ public Future summaryTask2(ClassSummaryVO classSummaryVO, Long classId) {
//测试通过率
List exerciseDoneResultDOS = exerciseDoneResultMapper.selectList(new QueryWrapper()
.lambda()
- .eq(ExerciseDoneResultDO::getClassId, classDetailDTO.getId()));
+ .eq(ExerciseDoneResultDO::getClassId, classId));
int passNum = 0;
@@ -353,23 +443,25 @@ public class AdministerServiceImpl extends ServiceImpl(classSummaryVO);
+ }
- //平均签到数 向上取整
+ public Future summaryTask3(ClassSummaryVO classSummaryVO, Long classId) {
//签到总次数
- Integer signCount = signInRecordMapper.selectCount(new QueryWrapper()
- .lambda()
- .eq(SignInRecordDO::getClassId, classDetailDTO.getId()));
- classSummaryVO.setAvgSignCount(MathUtil.intDivCeil(signCount, classMemberMappingDOS.size()));
+ long signCount = redisUtil.keys("subsidySignInfo*_classId_" + classId + "*").stream().count();
+ classSummaryVO.setAvgSignCount(MathUtil.intDivCeil(signCount, classSummaryVO.getMemberCount()));
+ return new AsyncResult<>(classSummaryVO);
+ }
+ public Future summaryTask4(ClassSummaryVO classSummaryVO, Long classId) {
//答疑数
Integer count = answeringQuestionMapper.selectCount(new QueryWrapper()
.lambda()
- .eq(AnsweringQuestionDO::getClassId, classDetailDTO.getId()));
+ .eq(AnsweringQuestionDO::getClassId, classId));
classSummaryVO.setAnswerCount(count);
-
- return classSummaryVO;
+ return new AsyncResult<>(classSummaryVO);
}
public IPage classDetail(ClassDetailDTO classDetailDTO) {
@@ -390,74 +482,109 @@ public class AdministerServiceImpl extends ServiceImpl vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper()
- .lambda()
- .eq(VodPlayHistoryDO::getMemberId, classDetailVO.getId())
- .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
- .orderByDesc(VodPlayHistoryDO::getPlayRecord));
-
-
- if (vodPlayHistoryDOS.size() > 0) {
- if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) {
- i++;
+ /**
+ * 学生平均学习时长和平均学习次数
+ */
+ ExecutorService cachedThreadPool = Executors.newCachedThreadPool();
+
+ //多个任务
+ cachedThreadPool.execute(() -> ///该学生完成了多少个 学生成绩,学生进度
+ classDetailTask1(classDetailVO, vodDictDOS, classDictDO.getId(), classDetailVO.getId()));
+ cachedThreadPool.execute(() -> //答疑
+ classDetailTask2(classDetailVO, classDetailDTO));
+ cachedThreadPool.execute(() -> //签到
+ classDetailTask3(classDetailVO, classDetailDTO));
+
+ //执行后不再接收新任务,如果里面有任务,就执行完
+ cachedThreadPool.shutdown();
+ try {
+ while (true) {
+ //等待所有任务都结束了继续执行
+ if (cachedThreadPool.isTerminated()) {
+ break;
}
}
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+ classDetailVOIPage.setRecords(classDetailVOS);
+ return classDetailVOIPage;
+ }
- for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) {
- playLength += vodPlayHistoryDO.getPlayLength();
+ public Future classDetailTask1(ClassDetailVO classDetailVO, List vodDictDOS, Long classId, Long memberId) {
+
+ //该学生完成了多少个
+ int i = 0;
+ int playLength = 0;
+ //该成员完成了几个视频
+ for (VodDictDO vodDictDO : vodDictDOS) {
+ List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper()
+ .lambda()
+ .eq(VodPlayHistoryDO::getMemberId, memberId)
+ .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
+ .orderByDesc(VodPlayHistoryDO::getPlayRecord));
+
+
+ if (vodPlayHistoryDOS.size() > 0) {
+ if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) {
+ i++;
}
+ }
+ for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) {
+ playLength += vodPlayHistoryDO.getPlayLength();
}
- classDetailVO.setStudyVodCounts(i);
- //学生测试完成情况 多套卷子各返回最高成绩
- List getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classDictDO.getId(), classDetailVO.getId());
- classDetailVO.setGetMaxScoreVOS(getMaxScoreVOS);
+ }
+ classDetailVO.setStudyVodCounts(i);
- Boolean flag = true;
+ //学生测试完成情况 多套卷子各返回最高成绩
+ List getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classId, classDetailVO.getId());
+ classDetailVO.setGetMaxScoreVOS(getMaxScoreVOS);
- if (getMaxScoreVOS.size() > 0) {
- for (GetMaxScoreVO getMaxScoreVO : getMaxScoreVOS) {
- if (getMaxScoreVO.getScore() < 60) {
- flag = false;
- }
+ Boolean flag = true;
+
+ if (getMaxScoreVOS.size() > 0) {
+ for (GetMaxScoreVO getMaxScoreVO : getMaxScoreVOS) {
+ if (getMaxScoreVO.getScore() < 60) {
+ flag = false;
}
- } else {
- flag = false;
}
+ } else {
+ flag = false;
+ }
+ if (flag && i == vodDictDOS.size()) {
+ classDetailVO.setResult("合格");
+ } else {
+ classDetailVO.setResult("不合格");
+ }
- if (flag && i == vodDictDOS.size()) {
- classDetailVO.setResult("合格");
- } else {
- classDetailVO.setResult("不合格");
- }
+ classDetailVO.setClassProcess(i + "/" + vodDictDOS.size());
- classDetailVO.setClassProcess(i + "/" + vodDictDOS.size());
- //答疑
- Integer count = answeringQuestionMapper.selectCount(new QueryWrapper()
- .lambda()
- .eq(AnsweringQuestionDO::getAskId, classDetailVO.getId())
- .eq(AnsweringQuestionDO::getClassId, classDetailDTO.getId()));
- classDetailVO.setAskCounts(count);
+ //培训时长
+ classDetailVO.setTrainingLength(playLength);
+ return new AsyncResult<>(classDetailVO);
+ }
- //签到次数
- Integer signCount = signInRecordMapper.selectCount(new QueryWrapper()
- .lambda()
- .eq(SignInRecordDO::getMemberId, classDetailVO.getId())
- .eq(SignInRecordDO::getClassId, classDetailDTO.getId()));
- classDetailVO.setSignCounts(signCount);
+ public Future classDetailTask2(ClassDetailVO classDetailVO, ClassDetailDTO classDetailDTO) {
- //培训时长
- classDetailVO.setTrainingLength(playLength);
- }
- classDetailVOIPage.setRecords(classDetailVOS);
- return classDetailVOIPage;
+ //答疑
+ Integer count = answeringQuestionMapper.selectCount(new QueryWrapper()
+ .lambda()
+ .eq(AnsweringQuestionDO::getAskId, classDetailVO.getId())
+ .eq(AnsweringQuestionDO::getClassId, classDetailDTO.getId()));
+ classDetailVO.setAskCounts(count);
+
+ return new AsyncResult<>(classDetailVO);
+ }
+
+ public Future classDetailTask3(ClassDetailVO classDetailVO, ClassDetailDTO classDetailDTO) {
+ ////签到次数
+ long set = redisUtil.keys(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId_" + classDetailVO.getId() + "_classId_" + classDetailDTO.getId() + "*").stream().count();
+ classDetailVO.setSignCounts(set);
+ return new AsyncResult<>(classDetailVO);
}
public List exportClassDetail(ClassDetailDTO classDetailDTO) throws Exception {
@@ -477,87 +604,100 @@ public class AdministerServiceImpl extends ServiceImpl vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper()
- .lambda()
- .eq(VodPlayHistoryDO::getMemberId, classDetailVO.getId())
- .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
- .orderByDesc(VodPlayHistoryDO::getPlayRecord));
-
- if (vodPlayHistoryDOS.size() > 0) {
- if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) {
- i++;
+ final ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
+
+ //多个任务
+ newCachedThreadPool.execute(() -> ///该学生完成了多少个 学生成绩,学生进度
+ exportClassDetailTask(classDetailVO, vodDictDOS, classDictDO.getId(), classDetailVO.getId()));
+ newCachedThreadPool.execute(() -> //答疑
+ classDetailTask2(classDetailVO, classDetailDTO));
+ newCachedThreadPool.execute(() -> //签到
+ classDetailTask3(classDetailVO, classDetailDTO));
+
+ //执行后不再接收新任务,如果里面有任务,就执行完
+ newCachedThreadPool.shutdown();
+ try {
+ while (true) {
+ //等待所有任务都结束了继续执行
+ if (newCachedThreadPool.isTerminated()) {
+ break;
}
}
-
- for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) {
- playLength += vodPlayHistoryDO.getPlayLength();
- }
+ } catch (Exception ex) {
+ ex.printStackTrace();
}
- //classDetailVO.setStudyVodCounts(i);
- classDetailVO.setClassProcess(i + "/" + vodDictDOS.size());
+ }
- //学生测试完成情况 多套卷子各返回最高成绩
- List getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classDictDO.getId(), classDetailVO.getId());
- classDetailVO.setGetMaxScoreVOS(getMaxScoreVOS);
+ if (classDetailDTO.getFlag()) {
+ CourseDictDO courseDictDO = courseDictMapper.selectById(classDictDO.getCourseId());
+ String studyDate = classDictDO.getStartDate() + " 至 " + classDictDO.getEndDate();
+ ExcelUtil.writeMemberExcel(companyDictDO.getCompanyName(), studyDate, courseDictDO.getCourseName(), "授课记录汇总表", classDetailVOS, ExcelFormatUtils.memberList);
+ }
+ return classDetailVOS;
+ }
- Boolean flag = true;
+ public Future exportClassDetailTask(ClassDetailVO classDetailVO, List vodDictDOS, Long classId, Long memberId) {
- StringBuilder stringBuilder = new StringBuilder();
+ //该学生完成了多少个
+ int i = 0;
+ int playLength = 0;
+ //该成员完成了几个视频
+ for (VodDictDO vodDictDO : vodDictDOS) {
+ List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper()
+ .lambda()
+ .eq(VodPlayHistoryDO::getMemberId, memberId)
+ .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
+ .orderByDesc(VodPlayHistoryDO::getPlayRecord));
- if (getMaxScoreVOS.size() > 0) {
- for (GetMaxScoreVO getMaxScoreVO : getMaxScoreVOS) {
- stringBuilder.append(getMaxScoreVO.getPaperName() + ":" + getMaxScoreVO.getScore());
- if (getMaxScoreVO.getScore() < 60) {
- flag = false;
- }
- stringBuilder.append(" ");
+ if (vodPlayHistoryDOS.size() > 0) {
+ if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) {
+ i++;
}
-
- } else {
- flag = false;
}
- if (flag && i == vodDictDOS.size()) {
- classDetailVO.setResult("合格");
- } else {
- classDetailVO.setResult("不合格");
+
+ for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) {
+ playLength += vodPlayHistoryDO.getPlayLength();
}
+ }
+ //classDetailVO.setStudyVodCounts(i);
+ classDetailVO.setClassProcess(i + "/" + vodDictDOS.size());
- classDetailVO.setScore(stringBuilder.toString());
+ //学生测试完成情况 多套卷子各返回最高成绩
+ List getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classId, classDetailVO.getId());
+ classDetailVO.setGetMaxScoreVOS(getMaxScoreVOS);
- //答疑
- Integer count = answeringQuestionMapper.selectCount(new QueryWrapper()
- .lambda()
- .eq(AnsweringQuestionDO::getAskId, classDetailVO.getId())
- .eq(AnsweringQuestionDO::getClassId, classDetailDTO.getId()));
- classDetailVO.setAskCounts(count);
+ Boolean flag = true;
- //签到次数
- Integer signCount = signInRecordMapper.selectCount(new QueryWrapper()
- .lambda()
- .eq(SignInRecordDO::getMemberId, classDetailVO.getId())
- .eq(SignInRecordDO::getClassId, classDetailDTO.getId()));
- classDetailVO.setSignCounts(signCount);
+ StringBuilder stringBuilder = new StringBuilder();
+
+ if (getMaxScoreVOS.size() > 0) {
+ for (GetMaxScoreVO getMaxScoreVO : getMaxScoreVOS) {
+ stringBuilder.append(getMaxScoreVO.getPaperName() + ":" + getMaxScoreVO.getScore());
+ if (getMaxScoreVO.getScore() < 60) {
+ flag = false;
+ }
+ stringBuilder.append(" ");
+ }
- //培训时长
- classDetailVO.setTrainingLength(playLength);
- classDetailVO.setTrainingLengthStr(MathUtil.secToTime(playLength));
+ } else {
+ flag = false;
}
- if (classDetailDTO.getFlag()) {
- CourseDictDO courseDictDO = courseDictMapper.selectById(classDictDO.getCourseId());
- String studyDate = classDictDO.getStartDate() + " 至 " + classDictDO.getEndDate();
- ExcelUtil.writeMemberExcel(companyDictDO.getCompanyName(), studyDate, courseDictDO.getCourseName(), "授课记录汇总表", classDetailVOS, ExcelFormatUtils.memberList);
+ if (flag && i == vodDictDOS.size()) {
+ classDetailVO.setResult("合格");
+ } else {
+ classDetailVO.setResult("不合格");
}
- return classDetailVOS;
- }
+ classDetailVO.setScore(stringBuilder.toString());
+
+ //培训时长
+ classDetailVO.setTrainingLength(playLength);
+ classDetailVO.setTrainingLengthStr(MathUtil.secToTime(playLength));
+ return new AsyncResult(classDetailVO);
+ }
public IPage signDetail(ClassDetailDTO classDetailDTO) {
@@ -571,58 +711,83 @@ public class AdministerServiceImpl extends ServiceImpl vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper()
- .lambda()
- .eq(VodPlayHistoryDO::getMemberId, classSignVO.getId())
- .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
- .orderByDesc(VodPlayHistoryDO::getPlayRecord));
-
- if (vodPlayHistoryDOS.size() > 0) {
- if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) {
- i++;
+ ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
+
+ //多个任务
+ newCachedThreadPool.execute(() -> //全部视频数
+ classSignVO.setAllVodCounts(vodDictDOS.size()));
+ newCachedThreadPool.execute(() -> //完成率,完成情况
+ signDetailsTask1(vodDictDOS, classSignVO));
+ newCachedThreadPool.execute(() -> //签到,签到时间
+ signDetailsTask2(classSignVO, classDetailDTO));
+
+ //执行后不再接收新任务,如果里面有任务,就执行完
+ newCachedThreadPool.shutdown();
+ try {
+ while (true) {
+ //等待所有任务都结束了继续执行
+ if (newCachedThreadPool.isTerminated()) {
+ break;
}
}
- for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) {
- playLength += vodPlayHistoryDO.getPlayLength();
- }
+
+ } catch (Exception ex) {
+ ex.printStackTrace();
}
- classSignVO.setStudyVodCounts(i);
- classSignVO.setClassProcess(i + "/" + vodDictDOS.size());
+ }
+ classSignVOIPage.setRecords(classSignVOS);
+ return classSignVOIPage;
+ }
- //完成率
- String percent = MathUtil.getPercentAvgIndexWithPercent(new BigDecimal(i), new BigDecimal(vodDictDOS.size()));
- classSignVO.setPercent(percent);
+ public Future signDetailsTask1(List vodDictDOS, ClassSignVO classSignVO) {
- //签到
- List signInRecordDOS = signInRecordMapper.selectList(new QueryWrapper()
+ //该学生完成了多少个
+ int i = 0;
+ int playLength = 0;
+ //该成员完成了几个视频
+ for (VodDictDO vodDictDO : vodDictDOS) {
+ List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper()
.lambda()
- .eq(SignInRecordDO::getMemberId, classSignVO.getId())
- .eq(SignInRecordDO::getClassId, classDetailDTO.getId()));
- classSignVO.setSignCounts(signInRecordDOS.size());
-
- StringBuilder stringBuilder = new StringBuilder();
- //签到时间
- for (SignInRecordDO signInRecordDO : signInRecordDOS) {
- stringBuilder.append(signInRecordDO.getSignInDate().toString().replace("T", " ")).append(";");
+ .eq(VodPlayHistoryDO::getMemberId, classSignVO.getId())
+ .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
+ .orderByDesc(VodPlayHistoryDO::getPlayRecord));
+
+ if (vodPlayHistoryDOS.size() > 0) {
+ if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) {
+ i++;
+ }
}
- if (StringUtils.isNotBlank(stringBuilder.toString())) {
- String signInDate = stringBuilder.toString().substring(0, stringBuilder.length() - 1);
- classSignVO.setSignInDateList(signInDate);
+ for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) {
+ playLength += vodPlayHistoryDO.getPlayLength();
}
+ }
+ classSignVO.setStudyVodCounts(i);
+ classSignVO.setClassProcess(i + "/" + vodDictDOS.size());
+
+ //完成率
+ String percent = MathUtil.getPercentAvgIndexWithPercent(new BigDecimal(i), new BigDecimal(vodDictDOS.size()));
+ classSignVO.setPercent(percent);
+ //培训时长
+ classSignVO.setTrainingLength(playLength);
+ classSignVO.setTrainingLengthStr(MathUtil.secToTime(playLength));
+ return new AsyncResult<>(classSignVO);
+ }
+
+ public Future signDetailsTask2(ClassSignVO classSignVO, ClassDetailDTO classDetailDTO) {
+ //签到
+ Set set = redisUtil.keys(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId_" + classSignVO.getId() + "_classId_" + classDetailDTO.getId() + "*");
+ classSignVO.setSignCounts(set.size());
- //培训时长
- classSignVO.setTrainingLength(playLength);
+ StringBuilder stringBuilder = new StringBuilder();
+ //签到时间
+ for (SignInRecordDO signInRecordDO : set) {
+ stringBuilder.append(signInRecordDO.getSignInDate().toString().replace("T", " ")).append(";");
}
- classSignVOIPage.setRecords(classSignVOS);
- return classSignVOIPage;
+ if (StringUtils.isNotBlank(stringBuilder.toString())) {
+ String signInDate = stringBuilder.toString().substring(0, stringBuilder.length() - 1);
+ classSignVO.setSignInDateList(signInDate);
+ }
+ return new AsyncResult<>(classSignVO);
}
public List exportSignDetail(ClassDetailDTO classDetailDTO) throws Exception {
@@ -636,56 +801,29 @@ public class AdministerServiceImpl extends ServiceImpl vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper()
- .lambda()
- .eq(VodPlayHistoryDO::getMemberId, classSignVO.getId())
- .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
- .orderByDesc(VodPlayHistoryDO::getPlayRecord));
-
- if (vodPlayHistoryDOS.size() > 0) {
- if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) {
- i++;
+ final ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
+
+ //多个任务
+ newCachedThreadPool.execute(() -> //全部视频数
+ classSignVO.setAllVodCounts(vodDictDOS.size()));
+ newCachedThreadPool.execute(() -> //完成率,完成情况
+ signDetailsTask1(vodDictDOS, classSignVO));
+ newCachedThreadPool.execute(() -> //签到,签到时间
+ signDetailsTask2(classSignVO, classDetailDTO));
+
+ //执行后不再接收新任务,如果里面有任务,就执行完
+ newCachedThreadPool.shutdown();
+ try {
+ while (true) {
+ //等待所有任务都结束了继续执行
+ if (newCachedThreadPool.isTerminated()) {
+ break;
}
}
- for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) {
- playLength += vodPlayHistoryDO.getPlayLength();
- }
- }
- //classSignVO.setStudyVodCounts(i);
- classSignVO.setClassProcess(i + "/" + vodDictDOS.size());
- //完成率
- String percent = MathUtil.getPercentAvgIndexWithPercent(new BigDecimal(i), new BigDecimal(vodDictDOS.size()));
- classSignVO.setPercent(percent);
-
- //签到
- List signInRecordDOS = signInRecordMapper.selectList(new QueryWrapper()
- .lambda()
- .eq(SignInRecordDO::getMemberId, classSignVO.getId())
- .eq(SignInRecordDO::getClassId, classDetailDTO.getId()));
- classSignVO.setSignCounts(signInRecordDOS.size());
-
- StringBuilder stringBuilder = new StringBuilder();
- //签到时间
- for (SignInRecordDO signInRecordDO : signInRecordDOS) {
- stringBuilder.append(signInRecordDO.getSignInDate().toString().replace("T", " ")).append(";");
- }
- if (StringUtils.isNotBlank(stringBuilder.toString())) {
- String signInDate = stringBuilder.toString().substring(0, stringBuilder.length() - 1);
- classSignVO.setSignInDateList(signInDate);
+ } catch (Exception ex) {
+ ex.printStackTrace();
}
-
- //培训时长
- classSignVO.setTrainingLength(playLength);
- classSignVO.setTrainingLengthStr(MathUtil.secToTime(playLength));
}
if (classDetailDTO.getFlag()) {
@@ -699,7 +837,6 @@ public class AdministerServiceImpl extends ServiceImpl exerciseTest(ClassDetailDTO classDetailDTO) {
Page pager = new Page(classDetailDTO.getPageNum(), classDetailDTO.getPageSize());
@@ -707,27 +844,47 @@ public class AdministerServiceImpl extends ServiceImpl exerciseTestVOIPage = this.baseMapper.exerciseTest(pager, classDetailDTO.getId(), classDetailDTO.getUserName());
List classSignVOS = exerciseTestVOIPage.getRecords();
- for (ExerciseTestVO exerciseTestVO : classSignVOS) {
-
- //学生测试完成情况
- List exerciseDoneResultDOs = exerciseDoneResultMapper.queryExerciseDoneResult(exerciseTestVO.getId(), classDetailDTO.getId(), classDetailDTO.getPaperId());
+ ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
- exerciseTestVO.setPaperId(exerciseTestVO.getPaperId());
- if (exerciseDoneResultDOs.size() > 0) {
- exerciseTestVO.setScore(exerciseDoneResultDOs.get(0).getScore());
- exerciseTestVO.setResult(exerciseDoneResultDOs.get(0).getResult());
- //测评次数
- exerciseTestVO.setCount(exerciseDoneResultDOs.size());
- } else {
- exerciseTestVO.setScore(0);
- exerciseTestVO.setResult("不合格");
- exerciseTestVO.setCount(0);
+ for (ExerciseTestVO exerciseTestVO : classSignVOS) {
+ newCachedThreadPool.execute(() -> //签到,签到时间
+ exerciseTestTask(exerciseTestVO, classDetailDTO.getId(), exerciseTestVO.getPaperId()));
+ }
+ //执行后不再接收新任务,如果里面有任务,就执行完
+ newCachedThreadPool.shutdown();
+ try {
+ while (true) {
+ //等待所有任务都结束了继续执行
+ if (newCachedThreadPool.isTerminated()) {
+ break;
+ }
}
+
+ } catch (Exception ex) {
+ ex.printStackTrace();
}
exerciseTestVOIPage.setRecords(classSignVOS);
return exerciseTestVOIPage;
}
+ public void exerciseTestTask(ExerciseTestVO exerciseTestVO, Long classId, Long paperId) {
+ //学生测试完成情况
+ List exerciseDoneResultDOs = exerciseDoneResultMapper.queryExerciseDoneResult(exerciseTestVO.getId(), classId, paperId);
+
+ exerciseTestVO.setPaperId(exerciseTestVO.getPaperId());
+ if (exerciseDoneResultDOs.size() > 0) {
+ exerciseTestVO.setScore(exerciseDoneResultDOs.get(0).getScore());
+ exerciseTestVO.setResult(exerciseDoneResultDOs.get(0).getResult());
+ //测评次数
+ exerciseTestVO.setCount(exerciseDoneResultDOs.size());
+ } else {
+ exerciseTestVO.setScore(0);
+ exerciseTestVO.setResult("不合格");
+ exerciseTestVO.setCount(0);
+ }
+
+ }
+
public List exportExerciseTest(ClassDetailDTO classDetailDTO) throws Exception {
Page pager = new Page(0, -1L);
@@ -737,22 +894,26 @@ public class AdministerServiceImpl extends ServiceImpl exerciseDoneResultDOs = exerciseDoneResultMapper.queryExerciseDoneResult(exerciseTestVO.getId(), classDetailDTO.getId(), classDetailDTO.getPaperId());
+ for (ExerciseTestVO exerciseTestVO : exerciseTestVOS) {
- if (exerciseDoneResultDOs.size() > 0) {
- exerciseTestVO.setScore(exerciseDoneResultDOs.get(0).getScore());
- exerciseTestVO.setResult(exerciseDoneResultDOs.get(0).getResult());
- //测评次数
- exerciseTestVO.setCount(exerciseDoneResultDOs.size());
- } else {
- exerciseTestVO.setScore(0);
- exerciseTestVO.setResult("不合格");
- exerciseTestVO.setCount(0);
+ newCachedThreadPool.execute(() -> //签到,签到时间
+ exerciseTestTask(exerciseTestVO, classDetailDTO.getId(), exerciseTestVO.getPaperId()));
+ }
+ //执行后不再接收新任务,如果里面有任务,就执行完
+ newCachedThreadPool.shutdown();
+ try {
+ while (true) {
+ //等待所有任务都结束了继续执行
+ if (newCachedThreadPool.isTerminated()) {
+ break;
+ }
}
+ } catch (Exception ex) {
+ ex.printStackTrace();
}
+
if (classDetailDTO.getFlag()) {
CompanyDictDO companyDictDO = companyDictMapper.selectById(classDictDO.getCompanyId());
CourseDictDO courseDictDO = courseDictMapper.selectById(classDictDO.getCourseId());
@@ -775,6 +936,7 @@ public class AdministerServiceImpl extends ServiceImpl exportAnswerRecord(ClassDetailDTO classDetailDTO) throws Exception {
Page pager = new Page(1, -1L);
IPage iPage = this.baseMapper.answerRecord(pager, classDetailDTO.getId(), classDetailDTO.getUserName());
@@ -798,9 +960,8 @@ public class AdministerServiceImpl extends ServiceImpl vodDictDOS = vodDictMapper.getCourseVods(classVodInfoDTO.getCourseId(), classVodInfoDTO.getVodName());
for (VodDictDO vodDictDO : vodDictDOS) {
-
//获取这个视频的学习人数和平均学习时长
- ClassVodCompleteInfoVO classVodCompleteInfoVO = vodDictMapper.classVodCompleteInfo(classVodInfoDTO.getClassId(), vodDictDO.getId(),memberIds, classVodInfoDTO.getVodName());
+ ClassVodCompleteInfoVO classVodCompleteInfoVO = vodDictMapper.classVodCompleteInfo(classVodInfoDTO.getClassId(), vodDictDO.getId(), memberIds, classVodInfoDTO.getVodName());
ClassVodInfoVO classVodInfoVO = new ClassVodInfoVO();
classVodInfoVO.setVodName(vodDictDO.getVodName());
classVodInfoVO.setStudyCnt(classVodCompleteInfoVO.getCnt());
@@ -841,32 +1002,7 @@ public class AdministerServiceImpl extends ServiceImpl findDaysStr(String begintTime, String endTime) {
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
- Date dBegin = null;
- Date dEnd = null;
- try {
- dBegin = sdf.parse(begintTime);
- dEnd = sdf.parse(endTime);
- } catch (ParseException e) {
- e.printStackTrace();
- }
- List daysStrList = new ArrayList();
- daysStrList.add(sdf.format(dBegin));
- Calendar calBegin = Calendar.getInstance();
- calBegin.setTime(dBegin);
- Calendar calEnd = Calendar.getInstance();
- calEnd.setTime(dEnd);
- while (dEnd.after(calBegin.getTime())) {
- calBegin.add(Calendar.DAY_OF_MONTH, 1);
- String dayStr = sdf.format(calBegin.getTime());
- daysStrList.add(dayStr);
- }
- return daysStrList;
- }
-
+ @Async
public void export(ClassDetailDTO classDetailDTO) throws Exception {
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
@@ -933,7 +1069,6 @@ public class AdministerServiceImpl extends ServiceImpl administerDOS = this.baseMapper.selectList(null);
- for (AdministerDO administerDO: administerDOS){
- redisUtil.set("subsidyAdmin_"+administerDO.getAccountName(),administerDO);
- }
- }
-
public String userName(String originName, int i, Long companyId) {
i++;
List memberDOS = memberMapper.selectList(new QueryWrapper()
@@ -1018,7 +1146,6 @@ public class AdministerServiceImpl extends ServiceImpl headerList, List classDetailVOS, String datePattern, int colWidth, OutputStream out) {
// 声明一个工作薄
@@ -1235,7 +1362,6 @@ public class AdministerServiceImpl extends ServiceImpl headerList, List classSignVOS, String datePattern, int colWidth, OutputStream out) {
// 声明一个工作薄
@@ -1853,7 +1979,6 @@ public class AdministerServiceImpl extends ServiceImpl
}
+ @Async
public String addCategory(CategoryDO categoryDO) {
int count = 0;
@@ -80,11 +82,13 @@ public class CategoryServiceImpl extends ServiceImpl
return ConstantUtils.ADD_SUCCESS;
}
+ @Async
public String deleteCategory(CategoryDO categoryDO) {
this.baseMapper.deleteById(categoryDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
+ @Async
public String updateCategory(CategoryDO categoryDO) {
int count = this.baseMapper.selectCount(new QueryWrapper()
diff --git a/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java
index 3cc38cf..7d571c1 100644
--- a/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java
@@ -1,25 +1,31 @@
package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.dto.classDict.AddClassDTO;
import com.subsidy.dto.classDict.AddMemberToClassDTO;
-import com.subsidy.dto.classDict.GetAllClassesDTO;
import com.subsidy.dto.classDict.GetSpareMembersDTO;
-import com.subsidy.mapper.*;
-import com.subsidy.model.*;
+import com.subsidy.mapper.ClassDictMapper;
+import com.subsidy.mapper.ClassMemberMappingMapper;
+import com.subsidy.mapper.CompanyDictMapper;
+import com.subsidy.mapper.CourseDictMapper;
+import com.subsidy.mapper.RoleAdministerMappingMapper;
+import com.subsidy.model.ClassDictDO;
+import com.subsidy.model.ClassMemberMappingDO;
+import com.subsidy.model.CompanyDictDO;
+import com.subsidy.model.CourseDictDO;
+import com.subsidy.model.MemberDO;
+import com.subsidy.model.RoleAdministerMappingDO;
import com.subsidy.service.ClassDictService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.SMSUtils;
import com.subsidy.vo.classdict.GetAllClassesVO;
import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import javax.management.relation.Role;
-import java.util.ArrayList;
import java.util.List;
/**
@@ -51,6 +57,7 @@ public class ClassDictServiceImpl extends ServiceImpl()
.lambda()
@@ -115,6 +125,7 @@ public class ClassDictServiceImpl extends ServiceImpl
@@ -29,81 +37,93 @@ import java.util.List;
public class ClassHourDictServiceImpl extends ServiceImpl implements ClassHourDictService {
@Autowired
- private ClassHourDictMapper classHourDictMapper;
-
- @Autowired
private VodPlayHistoryMapper vodPlayHistoryMapper;
@Autowired
private MemberMapper memberMapper;
+ @Autowired
+ private RedisUtil redisUtil;
+
public ClassHourDictDO getSetting(ClassHourDictDO classHourDictDO) {
- ClassHourDictDO classHourDictDO1 = this.baseMapper.selectOne(new QueryWrapper()
- .lambda()
- .eq(ClassHourDictDO::getCompanyId,classHourDictDO.getCompanyId()));
- //if (null==classHourDictDO){
- // ClassHourDictDO classHourDictDO2 = new ClassHourDictDO();
- // classHourDictDO2.setCompanyId(classHourDictDO.getCompanyId());
- // classHourDictDO2.setStatus(0);
- // classHourDictDO2.setClassHour(6);
- //
- // classHourDictDO2.setInterruptStatus(0);
- // classHourDictDO2.setInterrupt(15);
- //
- // classHourDictDO2.setRepeatStatus(0);
- // classHourDictDO2.setRepeatTime(3);
- // this.baseMapper.insert(classHourDictDO2);
- // return classHourDictDO2;
- //}
- return classHourDictDO1;
+ return (ClassHourDictDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + classHourDictDO.getCompanyId());
}
- public String updateSetting(ClassHourDictDO classHourDictDO){
- this.baseMapper.updateById(classHourDictDO);
- return ConstantUtils.ADD_SUCCESS;
+ @Async
+ public String updateSetting(ClassHourDictDO classHourDictDO) {
+
+ ClassHourDictDO classHourDictDO1 = (ClassHourDictDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + classHourDictDO.getCompanyId());
+ BeanUtils.copyProperties(classHourDictDO, classHourDictDO1);
+ redisUtil.set(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + classHourDictDO.getCompanyId(), classHourDictDO1);
+ return ConstantUtils.SET_SUCCESS;
}
- public PollingGetVO pollingGet(VodPlayHistoryDO vodPlayHistoryDO){
+ public PollingGetVO pollingGet(VodPlayHistoryDO vodPlayHistoryDO) {
PollingGetVO pollingGetVO = new PollingGetVO();
MemberDO memberDO = memberMapper.selectById(vodPlayHistoryDO.getMemberId());
+ final ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
- //查看系统设定的时长
- ClassHourDictDO classHourDictDO = classHourDictMapper.selectOne(new QueryWrapper()
- .lambda()
- .eq(ClassHourDictDO::getStatus,1)
- .gt(ClassHourDictDO::getCompanyId,memberDO.getCompanyId()));
- if (null == classHourDictDO){
- pollingGetVO.setBool(false);
- return pollingGetVO;
- }
+ ClassHourDictDO classHourDictDO = new ClassHourDictDO();
- //查看当天这个人看了多少时间
- List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper()
- .lambda()
- .eq(VodPlayHistoryDO::getMemberId,vodPlayHistoryDO.getMemberId())
- .eq(VodPlayHistoryDO::getCreateDate, LocalDate.now()));
+ Integer total = 0;
+ try {
- int total = 0 ;
+ //多个任务
+ Future future1 = newCachedThreadPool.submit(() -> ///该学生完成了多少个 学生成绩,学生进度
+ pollingGetTask1(memberDO.getCompanyId())).get();
- for (VodPlayHistoryDO vodPlayHistoryDO1 : vodPlayHistoryDOS){
- total += vodPlayHistoryDO1.getPlayLength();
+ //查看系统设定的时长
+ classHourDictDO = future1.get();
+ Future future2 = newCachedThreadPool.submit(() -> //答疑
+ pollingGetTask2(memberDO.getId())).get();
+ ////查看当天这个人看了多少时间
+ total = future2.get();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ //执行后不再接收新任务,如果里面有任务,就执行完
+ newCachedThreadPool.shutdown();
+ try {
+ while (true) {
+ //等待所有任务都结束了继续执行
+ if (newCachedThreadPool.isTerminated()) {
+ break;
+ }
+ }
+
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ if (classHourDictDO.getStatus() == 0) {
+ pollingGetVO.setBool(false);
+ return pollingGetVO;
}
//是否超过时长 没超过 false 超过 true
- if (classHourDictDO==null){
+ if (classHourDictDO == null) {
pollingGetVO.setBool(true);
- }else {
- if (total + vodPlayHistoryDO.getPlayLength() < classHourDictDO.getClassHour()*60*60){
+ } else {
+ if (total + vodPlayHistoryDO.getPlayLength() < classHourDictDO.getClassHour() * 60 * 60) {
pollingGetVO.setBool(false);
- }else {
+ } else {
pollingGetVO.setBool(true);
}
}
return pollingGetVO;
}
+ public Future pollingGetTask1(Long companyId) {
+ System.out.println(redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + companyId));
+ return new AsyncResult<>((ClassHourDictDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + companyId));
+ //return new AsyncResult<>("hello");
+ }
+
+ public Future pollingGetTask2(Long memberId) {
+ return new AsyncResult<>(vodPlayHistoryMapper.memberDailyStudyLength(memberId));
+ }
}
diff --git a/src/main/java/com/subsidy/service/impl/ClassMemberMappingServiceImpl.java b/src/main/java/com/subsidy/service/impl/ClassMemberMappingServiceImpl.java
deleted file mode 100644
index e0947c6..0000000
--- a/src/main/java/com/subsidy/service/impl/ClassMemberMappingServiceImpl.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.subsidy.service.impl;
-
-import com.subsidy.model.ClassMemberMappingDO;
-import com.subsidy.mapper.ClassMemberMappingMapper;
-import com.subsidy.service.ClassMemberMappingService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.stereotype.Service;
-
-/**
- *
- * 班级成员映射表 服务实现类
- *
- *
- * @author DengMin
- * @since 2021-10-12
- */
-@Service
-public class ClassMemberMappingServiceImpl extends ServiceImpl implements ClassMemberMappingService {
-
-}
diff --git a/src/main/java/com/subsidy/service/impl/CompanyDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/CompanyDictServiceImpl.java
index 437c402..b96be4f 100644
--- a/src/main/java/com/subsidy/service/impl/CompanyDictServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/CompanyDictServiceImpl.java
@@ -4,18 +4,28 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.subsidy.common.RedisPrefixConstant;
import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.administer.OperatorsDTO;
import com.subsidy.dto.company.AddCompanyDTO;
-import com.subsidy.mapper.*;
-import com.subsidy.model.*;
+import com.subsidy.mapper.AdministerMapper;
+import com.subsidy.mapper.CompanyDictMapper;
+import com.subsidy.mapper.DepartmentDictMapper;
+import com.subsidy.mapper.RoleAdministerMappingMapper;
+import com.subsidy.model.AdministerDO;
+import com.subsidy.model.ClassHourDictDO;
+import com.subsidy.model.CompanyDictDO;
+import com.subsidy.model.DepartmentDictDO;
+import com.subsidy.model.RoleAdministerMappingDO;
import com.subsidy.service.CompanyDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
+import com.subsidy.util.RedisUtil;
import com.subsidy.vo.administer.OperatorsVO;
import com.subsidy.vo.company.GetAllCompanyVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -42,7 +52,7 @@ public class CompanyDictServiceImpl extends ServiceImpl operators(OperatorsDTO operatorsDTO) {
Page pager = new Page(operatorsDTO.getPageNum(), operatorsDTO.getPageSize());
@@ -109,10 +119,13 @@ public class CompanyDictServiceImpl extends ServiceImpl courseContentDOS = this.baseMapper.selectList(new QueryWrapper()
@@ -58,6 +55,7 @@ public class CourseContentServiceImpl extends ServiceImpl courseContentDOS = this.baseMapper.selectList(new QueryWrapper()
diff --git a/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java
index a08f61b..ac33235 100644
--- a/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java
@@ -3,24 +3,19 @@ package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.course.QueryCoursesDTO;
-import com.subsidy.mapper.AdministerMapper;
-import com.subsidy.mapper.CompanyDictMapper;
-import com.subsidy.mapper.RoleAdministerMappingMapper;
-import com.subsidy.model.*;
import com.subsidy.mapper.CourseDictMapper;
-import com.subsidy.service.CompanyDictService;
+import com.subsidy.mapper.RoleAdministerMappingMapper;
+import com.subsidy.model.CourseDictDO;
+import com.subsidy.model.RoleAdministerMappingDO;
import com.subsidy.service.CourseDictService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
-import com.subsidy.util.SMSUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
-import java.util.ArrayList;
-import java.util.List;
-
/**
*
* 服务实现类
@@ -35,6 +30,7 @@ public class CourseDictServiceImpl extends ServiceImpl()
@@ -113,6 +115,7 @@ public class DepartmentDictServiceImpl extends ServiceImpl()
diff --git a/src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java
index 8f24136..044cb5e 100644
--- a/src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java
@@ -22,6 +22,7 @@ import com.subsidy.vo.exercise.GetPaperExerciseVO;
import com.subsidy.vo.exercise.MemberExerciseVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -58,6 +59,7 @@ public class ExerciseDictServiceImpl extends ServiceImpl exerciseDictDOS = this.baseMapper.selectList(new QueryWrapper()
@@ -75,11 +77,13 @@ public class ExerciseDictServiceImpl extends ServiceImpl()
- // .lambda()
- // .eq(ExerciseDoneResultDO::getMemberId, submitDTO.getMemberId())
- // .eq(ExerciseDoneResultDO::getCourseId, submitDTO.getCourseId()));
-
exerciseDoneResultMapper.insert(exerciseDoneResultDO);
for (MemberExerciseVO memberExerciseVO : memberExerciseVOS){
diff --git a/src/main/java/com/subsidy/service/impl/ExerciseDoneResultServiceImpl.java b/src/main/java/com/subsidy/service/impl/ExerciseDoneResultServiceImpl.java
index dd2c015..d823af5 100644
--- a/src/main/java/com/subsidy/service/impl/ExerciseDoneResultServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/ExerciseDoneResultServiceImpl.java
@@ -18,7 +18,6 @@ import org.springframework.stereotype.Service;
@Service
public class ExerciseDoneResultServiceImpl extends ServiceImpl implements ExerciseDoneResultService {
-
public GetDoneDetailVO getDoneDetail(ExerciseDoneResultDO exerciseDoneResultDO){
return this.baseMapper.getDoneDetail(exerciseDoneResultDO.getId());
}
diff --git a/src/main/java/com/subsidy/service/impl/FileDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/FileDictServiceImpl.java
index 7619ebf..6a7afc6 100644
--- a/src/main/java/com/subsidy/service/impl/FileDictServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/FileDictServiceImpl.java
@@ -1,13 +1,12 @@
package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.subsidy.model.FileDictDO;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.mapper.FileDictMapper;
-import com.subsidy.model.VodDictDO;
+import com.subsidy.model.FileDictDO;
import com.subsidy.service.FileDictService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
-import com.subsidy.vo.vod.GetContendVodsVO;
+import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -30,16 +29,19 @@ public class FileDictServiceImpl extends ServiceImpl
.like(FileDictDO::getFileName,fileDictDO.getFileName()));
}
+ @Async
public String deleteFile(FileDictDO fileDictDO) {
this.baseMapper.deleteById(fileDictDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
+ @Async
public String addFile(FileDictDO fileDictDO) {
this.baseMapper.insert(fileDictDO);
return ConstantUtils.ADD_SUCCESS;
}
+ @Async
public String updateFile(FileDictDO fileDictDO) {
this.baseMapper.updateById(fileDictDO);
return ConstantUtils.SET_SUCCESS;
diff --git a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
index ff1d859..1a22b6e 100644
--- a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
@@ -2,37 +2,69 @@ package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.subsidy.common.RedisPrefixConstant;
import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.administer.VerifyCodeDTO;
-import com.subsidy.dto.member.*;
-import com.subsidy.mapper.*;
-import com.subsidy.model.*;
+import com.subsidy.dto.member.AddMemberDTO;
+import com.subsidy.dto.member.ContentMemberDTO;
+import com.subsidy.dto.member.GetAllDTO;
+import com.subsidy.dto.member.PasswordLoginDTO;
+import com.subsidy.dto.member.StudyHistoryDTO;
+import com.subsidy.mapper.ClassDictMapper;
+import com.subsidy.mapper.ClassMemberMappingMapper;
+import com.subsidy.mapper.CompanyDictMapper;
+import com.subsidy.mapper.CourseContentMapper;
+import com.subsidy.mapper.ExerciseDoneResultMapper;
+import com.subsidy.mapper.FileDictMapper;
+import com.subsidy.mapper.MemberDepartmentMappingMapper;
+import com.subsidy.mapper.MemberMapper;
+import com.subsidy.mapper.PaperDictMapper;
+import com.subsidy.mapper.VodDictMapper;
+import com.subsidy.mapper.VodPlayHistoryMapper;
+import com.subsidy.model.ClassDictDO;
+import com.subsidy.model.ClassHourDictDO;
+import com.subsidy.model.ClassMemberMappingDO;
+import com.subsidy.model.CompanyDictDO;
+import com.subsidy.model.CourseContentDO;
+import com.subsidy.model.DepartmentDictDO;
+import com.subsidy.model.ExerciseDoneResultDO;
+import com.subsidy.model.FileDictDO;
+import com.subsidy.model.MemberDO;
+import com.subsidy.model.MemberDepartmentMappingDO;
+import com.subsidy.model.OprMemDictDO;
+import com.subsidy.model.VodDictDO;
+import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.service.MemberService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.MathUtil;
import com.subsidy.util.RedisUtil;
import com.subsidy.vo.administer.UserRoleVO;
-import com.subsidy.vo.course.QueryCoursesVO;
-import com.subsidy.vo.member.*;
+import com.subsidy.vo.member.ContentFilesVO;
+import com.subsidy.vo.member.ContentVodNewVO;
+import com.subsidy.vo.member.ContentVodVO;
+import com.subsidy.vo.member.GetAllVO;
+import com.subsidy.vo.member.GetStudyInfoVO;
+import com.subsidy.vo.member.MemberStudyPageVO;
+import com.subsidy.vo.member.MemberVodVO;
+import com.subsidy.vo.member.StudyPageVO;
import com.subsidy.vo.paper.QueryPapersVO;
import com.subsidy.vo.vod.StudyHistoryVO;
-import net.sourceforge.pinyin4j.PinyinHelper;
-import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
-import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
-import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import java.lang.reflect.Member;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
/**
*
@@ -46,9 +78,6 @@ import java.util.List;
public class MemberServiceImpl extends ServiceImpl implements MemberService {
@Autowired
- private SmsVerifyCodeMapper smsVerifyCodeMapper;
-
- @Autowired
private CourseContentMapper courseContentMapper;
@Autowired
@@ -79,12 +108,6 @@ public class MemberServiceImpl extends ServiceImpl imple
private MemberDepartmentMappingMapper memberDepartmentMappingMapper;
@Autowired
- private ClassHourDictMapper classHourDictMapper;
-
- @Autowired
- private OprMemDictMapper oprMemDictMapper;
-
- @Autowired
private RedisUtil redisUtil;
public IPage getAll(GetAllDTO getAllDTO) {
@@ -100,15 +123,33 @@ public class MemberServiceImpl extends ServiceImpl imple
}
public String deleteMember(MemberDO memberDO) {
- this.baseMapper.deleteById(memberDO.getId());
- classMemberMappingMapper.delete(new QueryWrapper()
- .lambda()
- .eq(ClassMemberMappingDO::getMemberId, memberDO.getId()));
+ final ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
- memberDepartmentMappingMapper.delete(new QueryWrapper()
- .lambda()
- .eq(MemberDepartmentMappingDO::getMemberId, memberDO.getId()));
+ //多个任务
+ newCachedThreadPool.execute(() -> ///该学生完成了多少个 学生成绩,学生进度
+ this.baseMapper.deleteById(memberDO.getId()));
+ newCachedThreadPool.execute(() -> //答疑
+ classMemberMappingMapper.delete(new QueryWrapper()
+ .lambda()
+ .eq(ClassMemberMappingDO::getMemberId, memberDO.getId())));
+ newCachedThreadPool.execute(() -> //签到
+ memberDepartmentMappingMapper.delete(new QueryWrapper()
+ .lambda()
+ .eq(MemberDepartmentMappingDO::getMemberId, memberDO.getId())));
+
+ //执行后不再接收新任务,如果里面有任务,就执行完
+ newCachedThreadPool.shutdown();
+ try {
+ while (true) {
+ //等待所有任务都结束了继续执行
+ if (newCachedThreadPool.isTerminated()) {
+ break;
+ }
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
return ConstantUtils.DELETE_SUCCESS;
}
@@ -216,7 +257,8 @@ public class MemberServiceImpl extends ServiceImpl imple
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
- oprMemDictMapper.insert(oprMemDictDO);
+ //oprMemDictMapper.insert(oprMemDictDO);
+ redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + LocalDateTime.now(), oprMemDictDO);
throw new HttpException(10013);
}
@@ -227,84 +269,93 @@ public class MemberServiceImpl extends ServiceImpl imple
}
BeanUtils.copyProperties(memberDO, userRoleVO);
- String code = redisUtil.get("subsidySmsCode_"+verifyCodeDTO.getTelephone()).toString();
+ String code = redisUtil.get(RedisPrefixConstant.SUBSIDY_TELEPHONE_PREFIX + verifyCodeDTO.getTelephone()).toString();
//SmsVerifyCodeDO smsCodeDO = smsVerifyCodeMapper.selectOne(new QueryWrapper()
// .lambda()
// .eq(SmsVerifyCodeDO::getTelephone, verifyCodeDTO.getTelephone())
// .eq(SmsVerifyCodeDO::getVerifyCode, verifyCodeDTO.getVerifyCode())
// .gt(SmsVerifyCodeDO::getCreateDate, LocalDateTime.now().minusMinutes(30L)));
- if (code == null || !verifyCodeDTO.getVerifyCode().equals(code) ) {
+ if (code == null || !verifyCodeDTO.getVerifyCode().equals(code)) {
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
- oprMemDictMapper.insert(oprMemDictDO);
+ oprMemDictDO.setCreateDate(LocalDateTime.now());
+ //oprMemDictMapper.insert(oprMemDictDO);
+ redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + LocalDateTime.now(), oprMemDictDO);
+
throw new HttpException(70010);
}
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(1);
- oprMemDictMapper.insert(oprMemDictDO);
+ //oprMemDictMapper.insert(oprMemDictDO);
+ //审计日志
+ redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + LocalDateTime.now(), oprMemDictDO);
//将学员信息写到redis
- redisUtil.set("subsidyMember_"+memberDO.getCompanyId()+":"+memberDO.getAccountName(),memberDO);
+ redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
return userRoleVO;
}
public MemberDO passwordLogin(PasswordLoginDTO passwordLoginDTO) {
- //UserRoleVO userRoleVO = this.baseMapper.passwordLogin(passwordLoginDTO);
/**
* 先从redis里查
*/
- MemberDO memberDO = (MemberDO) redisUtil.get("subsidyMember_"+passwordLoginDTO.getCompanyId()+":"+passwordLoginDTO.getAccountName());
- if (null==memberDO){
+ MemberDO memberDO = (MemberDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + passwordLoginDTO.getCompanyId() + ":" + passwordLoginDTO.getAccountName());
+ if (null == memberDO) {
/**
* redis里没有,从数据库里查
*/
memberDO = this.baseMapper.selectOne(new QueryWrapper()
- .lambda()
- .eq(MemberDO::getCompanyId,passwordLoginDTO.getCompanyId())
- .eq(MemberDO::getAccountName,passwordLoginDTO.getAccountName()));
- }
- if (memberDO == null) {
- throw new HttpException(10017);
- }
- if (!memberDO.getPassword().equals(passwordLoginDTO.getPassword())) {
- OprMemDictDO oprMemDictDO = new OprMemDictDO();
- oprMemDictDO.setUserId(memberDO.getId());
- oprMemDictDO.setOprType("登录");
- oprMemDictDO.setResult(0);
- oprMemDictMapper.insert(oprMemDictDO);
- throw new HttpException(10016);
+ .lambda()
+ .eq(MemberDO::getCompanyId, passwordLoginDTO.getCompanyId())
+ .eq(MemberDO::getAccountName, passwordLoginDTO.getAccountName()));
+ if (memberDO == null) {
+ throw new HttpException(10017);
+ }
}
- if (0 == memberDO.getFirstLogin()) {
+ if (memberDO.getPassword().equals(passwordLoginDTO.getPassword())&&1==memberDO.getFirstLogin()&&"冻结".equals(memberDO.getStatus())){
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
- oprMemDictDO.setResult(0);
- oprMemDictMapper.insert(oprMemDictDO);
- throw new HttpException(10015);
- }
-
- if ("冻结".equals(memberDO.getStatus())) {
- throw new HttpException(10014);
+ oprMemDictDO.setResult(1);
+ oprMemDictDO.setCreateDate(LocalDateTime.now());
+ redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + "_" + System.currentTimeMillis(), 1);
+ return memberDO;
+ }else {
+ if (!memberDO.getPassword().equals(passwordLoginDTO.getPassword())) {
+ OprMemDictDO oprMemDictDO = new OprMemDictDO();
+ oprMemDictDO.setUserId(memberDO.getId());
+ oprMemDictDO.setOprType("登录");
+ oprMemDictDO.setResult(0);
+ redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + LocalDateTime.now(), oprMemDictDO);
+ throw new HttpException(10016);
+ }
+ if (0 == memberDO.getFirstLogin()) {
+ OprMemDictDO oprMemDictDO = new OprMemDictDO();
+ oprMemDictDO.setUserId(memberDO.getId());
+ oprMemDictDO.setOprType("登录");
+ oprMemDictDO.setResult(0);
+ oprMemDictDO.setCreateDate(LocalDateTime.now());
+ redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + "_" + System.currentTimeMillis(), 0);
+ throw new HttpException(10015);
+ }
+ if ("冻结".equals(memberDO.getStatus())) {
+ throw new HttpException(10014);
+ }
}
-
- OprMemDictDO oprMemDictDO = new OprMemDictDO();
- oprMemDictDO.setUserId(memberDO.getId());
- oprMemDictDO.setOprType("登录");
- oprMemDictDO.setResult(1);
- oprMemDictMapper.insert(oprMemDictDO);
- return memberDO;
+ return null;
}
+ @Async
public String updatePassword(MemberDO memberDO) {
this.baseMapper.updateById(memberDO);
MemberDO memberDO1 = this.baseMapper.selectById(memberDO.getId());
- redisUtil.set("subsidyMember_"+memberDO1.getCompanyId()+":"+memberDO.getAccountName(),memberDO);
+ redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO1.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
return ConstantUtils.SET_SUCCESS;
}
@@ -320,6 +371,8 @@ public class MemberServiceImpl extends ServiceImpl imple
List vodDictDOS = courseContentMapper.getCourseVods(studyPageVO.getId());
studyPageVO.setTotalVods(vodDictDOS.size());
+ final ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
+
int i = 0;
//该成员完成了几个视频
@@ -338,38 +391,32 @@ public class MemberServiceImpl extends ServiceImpl imple
}
studyPageVO.setDoneVods(i);
+
//该班级课程下有多少人
List classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper()
.lambda()
.eq(ClassMemberMappingDO::getClassId, studyPageVO.getClassId()));
studyPageVO.setTotalMember(classMemberMappingDOS.size());
- //多少人完成
- //int completedCnt = 0;
- //for (ClassMemberMappingDO cmmd : classMemberMappingDOS) {
- //
- // Boolean flag = true;
- //
- // for (VodDictDO vodDictDO : vodDictDOS) {
- // List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper()
- // .lambda()
- // .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
- // .eq(VodPlayHistoryDO::getMemberId, cmmd.getMemberId())
- // .orderByDesc(VodPlayHistoryDO::getPlayRecord));
- // if (vodPlayHistoryDOS.size() > 0) {
- // if (vodPlayHistoryDOS.get(0).getPlayRecord() < vodDictDO.getVodLength()) {
- // flag = false;
- // //break;
- // }
- // } else {
- // flag = false;
- // }
- // }
- // if (flag) {
- // completedCnt++;
- // }
- //}
- //studyPageVO.setDoneMember(completedCnt);
+ ////多个任务
+ //newCachedThreadPool.execute(() ->
+ // studyPageTask1(studyPageVO, vodDictDOS, memberDO.getId()));
+ //newCachedThreadPool.execute(() ->
+ // studyPageTask2(studyPageVO));
+
+ //执行后不再接收新任务,如果里面有任务,就执行完
+ newCachedThreadPool.shutdown();
+ try {
+ while (true) {
+ //等待所有任务都结束了继续执行
+ if (newCachedThreadPool.isTerminated()) {
+ break;
+ }
+ }
+
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
}
memberStudyPageVO.setStudyPageVOS(studyPageVOS);
@@ -385,6 +432,40 @@ public class MemberServiceImpl extends ServiceImpl imple
return memberStudyPageVO;
}
+ public Future studyPageTask1(StudyPageVO studyPageVO, List vodDictDOS, Long memberId) {
+
+ int i = 0;
+
+ //该成员完成了几个视频
+ for (VodDictDO vodDictDO : vodDictDOS) {
+ List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper()
+ .lambda()
+ .eq(VodPlayHistoryDO::getMemberId, memberId)
+ .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
+ .orderByDesc(VodPlayHistoryDO::getPlayRecord));
+
+ if (vodPlayHistoryDOS.size() > 0) {
+ if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) {
+ i++;
+ }
+ }
+ }
+ studyPageVO.setDoneVods(i);
+
+ return new AsyncResult<>(studyPageVO);
+ }
+
+ public Future studyPageTask2(StudyPageVO studyPageVO) {
+
+ //该班级课程下有多少人
+ List classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper()
+ .lambda()
+ .eq(ClassMemberMappingDO::getClassId, studyPageVO.getClassId()));
+ studyPageVO.setTotalMember(classMemberMappingDOS.size());
+
+ return new AsyncResult<>(studyPageVO);
+ }
+
public ContentVodNewVO contentVod(ContentMemberDTO contentVodDTO) {
ContentVodNewVO contentVodNewVO = new ContentVodNewVO();
@@ -407,39 +488,27 @@ public class MemberServiceImpl extends ServiceImpl imple
.eq(VodDictDO::getContentId, courseContentDO.getId()));
for (VodDictDO vodDictDO : vodDictDOS) {
MemberVodVO memberVodVO = new MemberVodVO();
- List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper()
- .lambda()
- .eq(VodPlayHistoryDO::getMemberId, contentVodDTO.getMemberId())
- .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
- .orderByDesc(VodPlayHistoryDO::getPlayRecord));
-
- memberVodVO.setStatus(false);
- if (vodPlayHistoryDOS.size() > 0) {
- int length = MathUtil.intDivCeil(100 * vodPlayHistoryDOS.get(0).getPlayRecord(), vodDictDO.getVodLength());
- if (length >= 100) {
- memberVodVO.setPercent(100);
- } else {
- memberVodVO.setPercent(length);
+ final ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
+
+ //多个任务
+ newCachedThreadPool.execute(() ->
+ contentVodTask1(memberVodVO, vodDictDO, contentVodDTO.getMemberId()));
+ newCachedThreadPool.execute(() ->
+ contentVodTask2(memberVodVO, vodDictDO, contentVodDTO.getMemberId()));
+
+ //执行后不再接收新任务,如果里面有任务,就执行完
+ newCachedThreadPool.shutdown();
+ try {
+ while (true) {
+ //等待所有任务都结束了继续执行
+ if (newCachedThreadPool.isTerminated()) {
+ break;
+ }
}
- if (memberVodVO.getPercent() >= 80) {
- memberVodVO.setStatus(true);
- }
- } else {
- memberVodVO.setPercent(0);
+ } catch (Exception ex) {
+ ex.printStackTrace();
}
- List vodPlayHistoryDOS1 = vodPlayHistoryMapper.selectList(new QueryWrapper()
- .lambda()
- .eq(VodPlayHistoryDO::getMemberId, contentVodDTO.getMemberId())
- .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
- .orderByDesc(VodPlayHistoryDO::getCreateDate));
- if (vodPlayHistoryDOS1.size() > 0) {
- memberVodVO.setPlayRecord(vodPlayHistoryDOS1.get(0).getPlayRecord());
- }
- memberVodVO.setId(vodDictDO.getId());
- memberVodVO.setVodUrl(vodDictDO.getVodUrl());
- memberVodVO.setTeacherName(vodDictDO.getTeacherName());
- memberVodVO.setVodLength(vodDictDO.getVodLength());
- memberVodVO.setVodName(vodDictDO.getVodName());
+
memberVodVOS.add(memberVodVO);
}
contentVodVO.setMemberVodVOS(memberVodVOS);
@@ -464,6 +533,51 @@ public class MemberServiceImpl extends ServiceImpl imple
return contentVodNewVO;
}
+ public Future contentVodTask1(MemberVodVO memberVodVO, VodDictDO vodDictDO, Long memberId) {
+
+ List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper()
+ .lambda()
+ .eq(VodPlayHistoryDO::getMemberId, memberId)
+ .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
+ .orderByDesc(VodPlayHistoryDO::getPlayRecord));
+
+ memberVodVO.setStatus(false);
+ if (vodPlayHistoryDOS.size() > 0) {
+ int length = MathUtil.intDivCeil(100 * vodPlayHistoryDOS.get(0).getPlayRecord(), vodDictDO.getVodLength());
+ if (length >= 100) {
+ memberVodVO.setPercent(100);
+ } else {
+ memberVodVO.setPercent(length);
+ }
+ if (memberVodVO.getPercent() >= 80) {
+ memberVodVO.setStatus(true);
+ }
+ } else {
+ memberVodVO.setPercent(0);
+ }
+
+ return new AsyncResult<>(memberVodVO);
+ }
+
+ public Future contentVodTask2(MemberVodVO memberVodVO, VodDictDO vodDictDO, Long memberId) {
+
+ List vodPlayHistoryDOS1 = vodPlayHistoryMapper.selectList(new QueryWrapper()
+ .lambda()
+ .eq(VodPlayHistoryDO::getMemberId, memberId)
+ .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
+ .orderByDesc(VodPlayHistoryDO::getCreateDate));
+ if (vodPlayHistoryDOS1.size() > 0) {
+ memberVodVO.setPlayRecord(vodPlayHistoryDOS1.get(0).getPlayRecord());
+ }
+ memberVodVO.setId(vodDictDO.getId());
+ memberVodVO.setVodUrl(vodDictDO.getVodUrl());
+ memberVodVO.setTeacherName(vodDictDO.getTeacherName());
+ memberVodVO.setVodLength(vodDictDO.getVodLength());
+ memberVodVO.setVodName(vodDictDO.getVodName());
+
+ return new AsyncResult<>(memberVodVO);
+ }
+
public List contentFiles(ContentMemberDTO contentMemberDTO) {
List contentFilesVOS = new ArrayList<>();
@@ -513,31 +627,36 @@ public class MemberServiceImpl extends ServiceImpl imple
//查看该班级下的测试卷子(有效卷子)
ClassDictDO classDictDO = classDictMapper.selectById(contentMemberDTO.getClassId());
List queryPapersVOS = paperDictMapper.queryPapers(contentMemberDTO.getCourseId(), null, 1);
+ ExecutorService executorService = Executors.newCachedThreadPool();
for (QueryPapersVO queryPapersVO : queryPapersVOS) {
- //多少人已完成
- Integer cnt = paperDictMapper.completeCount(queryPapersVO.getId());
- queryPapersVO.setCompleteCnt(cnt);
- //自己成绩
- List exerciseDoneResultDOS = exerciseDoneResultMapper.selectList(new QueryWrapper()
- .lambda()
- .eq(ExerciseDoneResultDO::getMemberId, contentMemberDTO.getMemberId())
- .eq(ExerciseDoneResultDO::getPaperId, queryPapersVO.getId())
- .orderByDesc(ExerciseDoneResultDO::getScore));
-
- if (exerciseDoneResultDOS.size() > 0) {
- queryPapersVO.setRightCounts(exerciseDoneResultDOS.get(0).getRightCounts());
- queryPapersVO.setTotalCount(exerciseDoneResultDOS.get(0).getTotalCounts());
- queryPapersVO.setResult(exerciseDoneResultDOS.get(0).getResult());
- } else {
- queryPapersVO.setResult("待完成");
- }
-
- //截止时间
- queryPapersVO.setEndDate(classDictDO.getEndDate());
+ executorService.execute(()->getCourseTestTask(queryPapersVO,contentMemberDTO.getMemberId(),classDictDO));
}
return queryPapersVOS;
}
+ public void getCourseTestTask(QueryPapersVO queryPapersVO,Long memberId,ClassDictDO classDictDO){
+ //多少人已完成
+ Integer cnt = paperDictMapper.completeCount(queryPapersVO.getId());
+ queryPapersVO.setCompleteCnt(cnt);
+ //自己成绩
+ List exerciseDoneResultDOS = exerciseDoneResultMapper.selectList(new QueryWrapper()
+ .lambda()
+ .eq(ExerciseDoneResultDO::getMemberId, memberId)
+ .eq(ExerciseDoneResultDO::getPaperId, queryPapersVO.getId())
+ .orderByDesc(ExerciseDoneResultDO::getScore));
+
+ if (exerciseDoneResultDOS.size() > 0) {
+ queryPapersVO.setRightCounts(exerciseDoneResultDOS.get(0).getRightCounts());
+ queryPapersVO.setTotalCount(exerciseDoneResultDOS.get(0).getTotalCounts());
+ queryPapersVO.setResult(exerciseDoneResultDOS.get(0).getResult());
+ } else {
+ queryPapersVO.setResult("待完成");
+ }
+
+ //截止时间
+ queryPapersVO.setEndDate(classDictDO.getEndDate());
+ }
+
public List getPaperDoneDetail(ExerciseDoneResultDO exerciseDoneResultDO) {
return exerciseDoneResultMapper.selectList(new QueryWrapper()
.lambda()
@@ -551,14 +670,35 @@ public class MemberServiceImpl extends ServiceImpl imple
MemberDO memberDO1 = this.baseMapper.selectById(memberDO.getId());
- //第几天
- long diff = Duration.between(memberDO1.getCreateDate(), LocalDateTime.now()).toDays();
- getStudyInfoVO.setDiff(diff);
+ final ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
+
+ //多个任务
+ newCachedThreadPool.execute(() ->
+ getStudyInfoTask1(memberDO1.getId(), getStudyInfoVO));
+ newCachedThreadPool.execute(() ->
+ getStudyInfoTask2(memberDO1, getStudyInfoVO));
+
+ //执行后不再接收新任务,如果里面有任务,就执行完
+ newCachedThreadPool.shutdown();
+ try {
+ while (true) {
+ //等待所有任务都结束了继续执行
+ if (newCachedThreadPool.isTerminated()) {
+ break;
+ }
+ }
+
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ return getStudyInfoVO;
+ }
+ public Future getStudyInfoTask1(Long memberId, GetStudyInfoVO getStudyInfoVO) {
//已学课程
List classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper()
.lambda()
- .eq(ClassMemberMappingDO::getMemberId, memberDO.getId()));
+ .eq(ClassMemberMappingDO::getMemberId, memberId));
/**
* 遍历课程,里面的视频都看过80% 则表示已学完
*/
@@ -568,7 +708,7 @@ public class MemberServiceImpl extends ServiceImpl imple
for (VodDictDO vodDictDO : vodDictDOS) {
List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper()
.lambda()
- .eq(VodPlayHistoryDO::getMemberId, memberDO.getId())
+ .eq(VodPlayHistoryDO::getMemberId, memberId)
.eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
.orderByDesc(VodPlayHistoryDO::getPlayRecord));
if (vodPlayHistoryDOS.size() > 0) {
@@ -580,7 +720,10 @@ public class MemberServiceImpl extends ServiceImpl imple
i++;
}
getStudyInfoVO.setStudyCourse(i);
+ return new AsyncResult<>(getStudyInfoVO);
+ }
+ public Future getStudyInfoTask2(MemberDO memberDO, GetStudyInfoVO getStudyInfoVO) {
//累计学习时长
int studyLength = 0;
List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper()
@@ -592,7 +735,10 @@ public class MemberServiceImpl extends ServiceImpl imple
}
getStudyInfoVO.setStudyLength(studyLength);
- return getStudyInfoVO;
+ //第几天
+ long diff = Duration.between(memberDO.getCreateDate(), LocalDateTime.now()).toDays();
+ getStudyInfoVO.setDiff(diff);
+ return new AsyncResult(getStudyInfoVO);
}
public ExerciseDoneResultDO getDoneResult(ExerciseDoneResultDO exerciseDoneResultDO) {
@@ -601,8 +747,8 @@ public class MemberServiceImpl extends ServiceImpl imple
public String checkTimes(ExerciseDoneResultDO exerciseDoneResultDO) {
-
- ClassHourDictDO classHourDictDO = classHourDictMapper.getClassHourDictInfo(exerciseDoneResultDO.getClassId());
+ MemberDO memberDO = this.baseMapper.selectById(exerciseDoneResultDO.getMemberId());
+ ClassHourDictDO classHourDictDO = (ClassHourDictDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX+memberDO.getCompanyId());
if (null != classHourDictDO) {
Integer status = classHourDictDO.getRepeatStatus();
@@ -626,7 +772,7 @@ public class MemberServiceImpl extends ServiceImpl imple
public void importRedis() {
List memberDOS = this.baseMapper.selectList(null);
for (MemberDO memberDO : memberDOS) {
- redisUtil.set("subsidyMember_"+memberDO.getCompanyId()+":"+memberDO.getAccountName(),memberDO);
+ redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
}
}
diff --git a/src/main/java/com/subsidy/service/impl/PaperDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/PaperDictServiceImpl.java
index a7655fd..b2345a9 100644
--- a/src/main/java/com/subsidy/service/impl/PaperDictServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/PaperDictServiceImpl.java
@@ -8,6 +8,7 @@ import com.subsidy.service.PaperDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.subsidy.vo.paper.QueryPapersVO;
+import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -27,16 +28,19 @@ public class PaperDictServiceImpl extends ServiceImpl()
diff --git a/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java b/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java
index a5052ce..e21eb47 100644
--- a/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java
@@ -3,28 +3,42 @@ package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.subsidy.common.RedisPrefixConstant;
import com.subsidy.dto.member.GetMemberSignInfoDTO;
import com.subsidy.dto.sign.ClassSignInfoDTO;
-import com.subsidy.dto.sign.SignInDTO;
-import com.subsidy.mapper.*;
-import com.subsidy.model.*;
+import com.subsidy.mapper.AnsweringQuestionMapper;
+import com.subsidy.mapper.ClassDictMapper;
+import com.subsidy.mapper.ClassHourDictMapper;
+import com.subsidy.mapper.ClassMemberMappingMapper;
+import com.subsidy.mapper.ExerciseDoneResultMapper;
+import com.subsidy.mapper.SignInRecordMapper;
+import com.subsidy.mapper.VodPlayHistoryMapper;
+import com.subsidy.model.AnsweringQuestionDO;
+import com.subsidy.model.ClassDictDO;
+import com.subsidy.model.ClassHourDictDO;
+import com.subsidy.model.ClassMemberMappingDO;
+import com.subsidy.model.ExerciseDoneResultDO;
+import com.subsidy.model.SignInRecordDO;
+import com.subsidy.model.VodDictDO;
+import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.service.SignInRecordService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.MathUtil;
import com.subsidy.util.RedisUtil;
+import com.subsidy.vo.member.ClassSignVO;
import com.subsidy.vo.member.GetMemberSignInfoVO;
import com.subsidy.vo.sign.ClassSignInfoVO;
import com.subsidy.vo.sign.SignInStatusVO;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
-import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
/**
*
@@ -55,6 +69,9 @@ public class SignInRecordServiceImpl extends ServiceImpl getMemberSignInfo(GetMemberSignInfoDTO getMemberSignInfoDTO) {
Page pager = new Page(getMemberSignInfoDTO.getPageNum(), getMemberSignInfoDTO.getPageSize());
@@ -64,6 +81,7 @@ public class SignInRecordServiceImpl extends ServiceImpl vodDictDOS = classDictMapper.getClassVods(classSignInfoVO.getClassId());
classSignInfoVO.setTotalVodCounts(vodDictDOS.size());
-
- int totalStudyVods = 0;
- int totalStudyLength = 0;
- //学生总共学习课时数
- for (VodDictDO vodDictDO : vodDictDOS) {
- for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) {
- List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper()
- .lambda()
- .eq(VodPlayHistoryDO::getMemberId, classMemberMappingDO.getMemberId())
- .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
- .orderByDesc(VodPlayHistoryDO::getPlayRecord));
- for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) {
- totalStudyLength += vodPlayHistoryDO.getPlayLength();
- }
- if (vodPlayHistoryDOS.size() > 0) {
- if (vodPlayHistoryDOS.get(0).getPlayRecord() >= vodDictDO.getVodLength() * 0.8) {
- totalStudyVods++;
- }
+ final ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
+
+ //多个任务
+ newCachedThreadPool.execute(() -> ///该学生完成了多少个 学生成绩,学生进度
+ classSignInfoTask1(vodDictDOS, classMemberMappingDOS, classSignInfoVO));
+ newCachedThreadPool.execute(() -> //答疑
+ classSignInfoTask2(classSignInfoVO, classMemberMappingDOS));
+ newCachedThreadPool.execute(() -> //签到
+ classSignInfoTask3(classSignInfoVO, classMemberMappingDOS));
+
+ //执行后不再接收新任务,如果里面有任务,就执行完
+ newCachedThreadPool.shutdown();
+ try {
+ while (true) {
+ //等待所有任务都结束了继续执行
+ if (newCachedThreadPool.isTerminated()) {
+ break;
}
}
- }
- classSignInfoVO.setStudyVodCounts(MathUtil.intDivCeil(totalStudyVods, classMemberMappingDOS.size()));
-
- //平均完成时长 学生观看课程视频的全部时长/总人数
- int avg = MathUtil.intDivCeil(totalStudyLength, classMemberMappingDOS.size());
- classSignInfoVO.setAvgVodPlayLength(avg);
- //测试通过率
- List exerciseDoneResultDOS = exerciseDoneResultMapper.selectList(new QueryWrapper()
- .lambda()
- .eq(ExerciseDoneResultDO::getClassId, classSignInfoVO.getClassId()));
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
- int passNum = 0;
+ classSignInfoVOIPage.setRecords(classSignInfoVOS);
+ return classSignInfoVOIPage;
+ }
- for (ExerciseDoneResultDO exerciseDoneResultDO : exerciseDoneResultDOS) {
- if (exerciseDoneResultDO.getRightCounts() > exerciseDoneResultDO.getTotalCounts() * 0.6) {
- passNum++;
+ public void classSignInfoTask1(List vodDictDOS, List classMemberMappingDOS, ClassSignInfoVO classSignInfoVO) {
+ int totalStudyVods = 0;
+ int totalStudyLength = 0;
+ //学生总共学习课时数
+ for (VodDictDO vodDictDO : vodDictDOS) {
+ for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) {
+ List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper()
+ .lambda()
+ .eq(VodPlayHistoryDO::getMemberId, classMemberMappingDO.getMemberId())
+ .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
+ .orderByDesc(VodPlayHistoryDO::getPlayRecord));
+ for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) {
+ totalStudyLength += vodPlayHistoryDO.getPlayLength();
+ }
+ if (vodPlayHistoryDOS.size() > 0) {
+ if (vodPlayHistoryDOS.get(0).getPlayRecord() >= vodDictDO.getVodLength() * 0.8) {
+ totalStudyVods++;
+ }
}
}
- classSignInfoVO.setPassRate(MathUtil.intDivFloorPercent(passNum, classMemberMappingDOS.size()));
+ }
+ classSignInfoVO.setStudyVodCounts(MathUtil.intDivCeil(totalStudyVods, classMemberMappingDOS.size()));
+ //平均完成时长 学生观看课程视频的全部时长/总人数
+ int avg = MathUtil.intDivCeil(totalStudyLength, classMemberMappingDOS.size());
+ classSignInfoVO.setAvgVodPlayLength(avg);
+ }
- //平均签到数 向上取整
- //签到总次数
- Integer signCount = this.baseMapper.selectCount(new QueryWrapper()
- .lambda()
- .eq(SignInRecordDO::getClassId, classSignInfoVO.getClassId()));
- classSignInfoVO.setAvgSignCount(MathUtil.intDivCeil(signCount, classMemberMappingDOS.size()));
+ public void classSignInfoTask2(ClassSignInfoVO classSignInfoVO, List classMemberMappingDOS) {
+ //测试通过率
+ List exerciseDoneResultDOS = exerciseDoneResultMapper.selectList(new QueryWrapper()
+ .lambda()
+ .eq(ExerciseDoneResultDO::getClassId, classSignInfoVO.getClassId()));
- //答疑数
- Integer count = answeringQuestionMapper.selectCount(new QueryWrapper()
- .lambda()
- .eq(AnsweringQuestionDO::getClassId, classSignInfoVO.getClassId()));
- classSignInfoVO.setAnswerCount(count);
- }
+ int passNum = 0;
- classSignInfoVOIPage.setRecords(classSignInfoVOS);
- return classSignInfoVOIPage;
+ for (ExerciseDoneResultDO exerciseDoneResultDO : exerciseDoneResultDOS) {
+ if (exerciseDoneResultDO.getRightCounts() > exerciseDoneResultDO.getTotalCounts() * 0.6) {
+ passNum++;
+ }
+ }
+ classSignInfoVO.setPassRate(MathUtil.intDivFloorPercent(passNum, classMemberMappingDOS.size()));
}
+ public void classSignInfoTask3(ClassSignInfoVO classSignInfoVO, List classMemberMappingDOS) {
+ //平均签到数 向上取整
+ //签到总次数
+ long signCount = redisUtil.keys(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "*_classId_" + classSignInfoVO.getClassId() + "_*").stream().count();
+ classSignInfoVO.setAvgSignCount(MathUtil.intDivCeil(signCount, classMemberMappingDOS.size()));
+
+ //答疑数
+ Integer count = answeringQuestionMapper.selectCount(new QueryWrapper()
+ .lambda()
+ .eq(AnsweringQuestionDO::getClassId, classSignInfoVO.getClassId()));
+ classSignInfoVO.setAnswerCount(count);
+ }
public SignInStatusVO signInStatus(SignInRecordDO signInRecordDO) {
@@ -180,35 +222,36 @@ public class SignInRecordServiceImpl extends ServiceImpl classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId());
+ long count = classMemberMappingMapper.getMemberClassCount(signInRecordDO.getMemberId());
- for (ClassDictDO classDictDO : classDictDOS) {
- /*Integer count = this.baseMapper.selectCount(new QueryWrapper()
- .lambda()
- .eq(SignInRecordDO::getClassId, classDictDO.getId())
- .eq(SignInRecordDO::getMemberId, signInRecordDO.getMemberId())
- .gt(SignInRecordDO::getSignInDate, LocalDate.now()));*/
-
- long count = redisUtil.keys("*subsidySignInfo_"+signInRecordDO.getMemberId()+"_"+classDictDO.getId()+"_"+DateFormatUtil.format(new Date(), "yyyyMMdd")+"*").stream().count();
+ long size = redisUtil.keys(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId_" + signInRecordDO.getMemberId() + "*_" + DateFormatUtil.format(new Date(), "yyyyMMdd")).stream().count();
- if (count == 0) {
- flag = false; //没有签到
- }
+ if (size!=count){
+ signInStatusVO.setStatus(flag);
}
- signInStatusVO.setStatus(flag);
return signInStatusVO;
}
- public Object test() {
-
- Set set = redisUtil.keys("*subsidyMember*");
- for (Object str : set) {
- System.out.println(str);
+ @Async
+ public void test() {
+ //Set set = redisUtil.keys("*subsidyMember*");
+ //for (Object str : set) {
+ // System.out.println(str);
+ // redisUtil.get(str.toString());
+ //}
+ //List classHourDictDOS = classHourDictMapper.selectList(null);
+ //
+ //for (ClassHourDictDO classHourDictDO : classHourDictDOS) {
+ // redisUtil.set(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + classHourDictDO.getCompanyId(), classHourDictDO);
+ //}
+
+ List classHourDictDOS = classHourDictMapper.selectList(null);
+ for (ClassHourDictDO classHourDictDO : classHourDictDOS){
+ redisUtil.set("subsidySettings_"+classHourDictDO.getCompanyId(),classHourDictDO);
}
- return null;
}
}
diff --git a/src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java b/src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java
index 7ee9d2b..a3621be 100644
--- a/src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java
@@ -1,23 +1,22 @@
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.RedisPrefixConstant;
import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.sms.SendVerifyCodeDTO;
import com.subsidy.mapper.MemberMapper;
+import com.subsidy.mapper.SmsVerifyCodeMapper;
import com.subsidy.model.MemberDO;
import com.subsidy.model.SmsVerifyCodeDO;
-import com.subsidy.mapper.SmsVerifyCodeMapper;
-import com.subsidy.service.MemberService;
import com.subsidy.service.SmsVerifyCodeService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.RandomUtil;
import com.subsidy.util.RedisUtil;
import com.subsidy.util.SMSUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
-import java.lang.reflect.Member;
-
/**
*
* 短信验证码记录表 服务实现类
@@ -38,6 +37,7 @@ public class SmsVerifyCodeServiceImpl extends ServiceImpl()
.lambda()
@@ -57,7 +57,7 @@ public class SmsVerifyCodeServiceImpl extends ServiceImpl im
return this.baseMapper.getContendVods(pager,getContendVodsDTO.getVodName(),getContendVodsDTO.getContentId());
}
+ @Async
public String deleteVod(VodDictDO vodDictDO) {
VodDictDO vodDictDO1 = this.baseMapper.selectById(vodDictDO.getId());
this.baseMapper.deleteById(vodDictDO.getId());
@@ -95,6 +100,7 @@ public class VodDictServiceImpl extends ServiceImpl im
return ConstantUtils.DELETE_SUCCESS;
}
+ @Async
public String addVod(VodDictDO vodDictDO) {
this.baseMapper.insert(vodDictDO);
//上传后直接转码
@@ -121,7 +127,6 @@ public class VodDictServiceImpl extends ServiceImpl im
ProcessMediaResponse processMediaResponse = null;
try {
processMediaResponse = client.ProcessMedia(processMediaRequest);
- System.out.println(processMediaResponse);
} catch (Exception ex) {
throw new HttpException(50001);
}
@@ -129,6 +134,7 @@ public class VodDictServiceImpl extends ServiceImpl im
return ConstantUtils.ADD_SUCCESS;
}
+ @Async
public String updateVod(VodDictDO vodDictDO) {
this.baseMapper.updateById(vodDictDO);
return ConstantUtils.SET_SUCCESS;
diff --git a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
index db73e96..7f70e7d 100644
--- a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
@@ -5,6 +5,7 @@ import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.service.VodPlayHistoryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
+import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
/**
@@ -18,12 +19,16 @@ import org.springframework.stereotype.Service;
@Service
public class VodPlayHistoryServiceImpl extends ServiceImpl implements VodPlayHistoryService {
+ @Async
public String insertHistory(VodPlayHistoryDO vodPlayHistoryDO) {
+ vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO);
return ConstantUtils.ADD_SUCCESS;
}
+ @Async
public String insertHistoryNew(VodPlayHistoryDO vodPlayHistoryDO){
+ vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO);
return ConstantUtils.ADD_SUCCESS;
}
diff --git a/src/main/java/com/subsidy/util/CodeGenerator.java b/src/main/java/com/subsidy/util/CodeGenerator.java
index ae1381a..7b488bc 100644
--- a/src/main/java/com/subsidy/util/CodeGenerator.java
+++ b/src/main/java/com/subsidy/util/CodeGenerator.java
@@ -6,7 +6,12 @@ import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.InjectionConfig;
-import com.baomidou.mybatisplus.generator.config.*;
+import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
+import com.baomidou.mybatisplus.generator.config.FileOutConfig;
+import com.baomidou.mybatisplus.generator.config.GlobalConfig;
+import com.baomidou.mybatisplus.generator.config.PackageConfig;
+import com.baomidou.mybatisplus.generator.config.StrategyConfig;
+import com.baomidou.mybatisplus.generator.config.TemplateConfig;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
diff --git a/src/main/java/com/subsidy/util/LatexUtils.java b/src/main/java/com/subsidy/util/LatexUtils.java
deleted file mode 100644
index ac6fddb..0000000
--- a/src/main/java/com/subsidy/util/LatexUtils.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package com.subsidy.util;
-
-import org.scilab.forge.jlatexmath.TeXConstants;
-import org.scilab.forge.jlatexmath.TeXFormula;
-import org.scilab.forge.jlatexmath.TeXIcon;
-
-import javax.imageio.ImageIO;
-import javax.swing.*;
-import java.awt.*;
-import java.awt.image.BufferedImage;
-import java.io.*;
-
-/**
- * @author: tuyp
- * @create: 2020-08-08 21:19
- */
-public class LatexUtils {
-
- /**
- * @Description: 将base64编码字符串转换为图片
- * @Author:
- * @CreateTime:
- * @param imgStr
- * base64编码字符串
- * @param path
- * 图片路径-具体到文件
- * @return
- */
- public static boolean generateImage(String imgStr, String path) {
- if (imgStr == null) {
- return false;
- }
-// BASE64Decoder decoder = new BASE64Decoder();
- try {
-// byte[] b = decoder.decodeBuffer(imgStr);
-// for (int i = 0; i < b.length; i++) {
-// if (b[i] < 0) {
-// b[i] += 256;
-// }
-// }
-// OutputStream out = new FileOutputStream(path);
-// out.write(b);
-// out.flush();
-// out.close();
- return true;
- } catch (Exception e) {
- // TODO: handle exception
- return false;
- }
- }
-
- /**
- * @Description: 根据图片地址转换为base64编码字符串
- * @Author:
- * @CreateTime:
- * @return
- */
-// public static String getImageStr(String imgFile) {
-// InputStream inputStream = null;
-// byte[] data = null;
-// try {
-// inputStream = new FileInputStream(imgFile);
-// data = new byte[inputStream.available()];
-// inputStream.read(data);
-// inputStream.close();
-// } catch (IOException e) {
-// e.printStackTrace();
-// }
-// // 加密
-// BASE64Encoder encoder = new BASE64Encoder();
-// return encoder.encode(data);
-// }
-
- // latex 转 imgbase64
- public static String latex2Png(String latex) {
- try {
- TeXFormula formula = new TeXFormula(latex);
- // render the formla to an icon of the same size as the formula.
- TeXIcon icon = formula.createTeXIcon(TeXConstants.STYLE_DISPLAY, 20);
- // insert a border
- icon.setInsets(new Insets(1, 1, 1, 1));
- // now create an actual image of the rendered equation
- BufferedImage image = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_BYTE_GRAY);
- Graphics2D g2 = image.createGraphics();
- g2.setColor(Color.white);
- g2.fillRect(0, 0, icon.getIconWidth(), icon.getIconHeight());
- JLabel jl = new JLabel();
- jl.setForeground(new Color(0, 0, 0));
- icon.paintIcon(jl, g2, 0, 0);
- // at this point the image is created, you could also save it with ImageIO
- // saveImage(image, "png", "F:\\b.png");
-// ImageIO.write(image, "png", new File("F:\\c.png"));
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- try {
- ImageIO.write(image, "png", outputStream);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- return null;
- }
- byte[] buffer = outputStream.toByteArray();
-// BASE64Encoder encoder = new BASE64Encoder();
- return ("data:image/png;base64,");
- } catch (Exception e) {
- // e.printStackTrace();
- // ExceptionUtil.log(log, e);
- System.err.println("公式解析有误:\n" + latex);
- // e.printStackTrace();
- return null;
- }
- }
-
- public static void main(String[] args) {
- String str = latex2Png("\\(\\sqrt[3]{2+x}\\)");
- System.out.println(str);
-
-
-
-
-// String omml =Latex_Word.latexToWord(str);
-// System.out.println(omml);
- }
-
-}
diff --git a/src/main/java/com/subsidy/util/Student.java b/src/main/java/com/subsidy/util/Student.java
deleted file mode 100644
index 77f6c1c..0000000
--- a/src/main/java/com/subsidy/util/Student.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.subsidy.util;
-
-import lombok.Data;
-
-import java.util.Date;
-
-@Data
-public class Student {
-
- private String name;
- private int age;
- private Date birthday;
- private float height;
- private double weight;
- private boolean sex;
-
-}
diff --git a/src/main/java/com/subsidy/util/ZipTestUtils.java b/src/main/java/com/subsidy/util/ZipTestUtils.java
deleted file mode 100644
index 9ed291c..0000000
--- a/src/main/java/com/subsidy/util/ZipTestUtils.java
+++ /dev/null
@@ -1,300 +0,0 @@
-package com.subsidy.util;
-
-import org.apache.poi.hssf.usermodel.HSSFCellStyle;
-import org.apache.poi.hssf.usermodel.HSSFFont;
-import org.apache.poi.hssf.util.CellRangeAddress;
-import org.apache.poi.ss.usermodel.CellStyle;
-import org.apache.poi.ss.usermodel.Font;
-import org.apache.poi.xssf.streaming.SXSSFCell;
-import org.apache.poi.xssf.streaming.SXSSFRow;
-import org.apache.poi.xssf.streaming.SXSSFSheet;
-import org.apache.poi.xssf.streaming.SXSSFWorkbook;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletResponse;
-import java.io.*;
-import java.nio.charset.StandardCharsets;
-import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-public class ZipTestUtils {
-
- /*
- 原链接:https://blog.csdn.net/houxuehan/article/details/89189820
- */
-
- public static String NO_DEFINE = "no_define";//未定义的字段
- public static String DEFAULT_DATE_PATTERN = "yyyy年MM月dd日";//默认日期格式
- public static int DEFAULT_COLOUMN_WIDTH = 17;
-
- /**
- * 导出Excel 2007 OOXML (.xlsx)格式
- *
- * @param title 标题行
- * @param headList 属性-列头
- * @param students 数据集
- * @param datePattern 日期格式,传null值则默认 年月日
- * @param colWidth 列宽 默认 至少17个字节
- * @param out 输出流
- */
- public static void exportExcelX(String title, List headList, List students, String datePattern, int colWidth, OutputStream out) {
- if (datePattern == null) {
- datePattern = DEFAULT_DATE_PATTERN;
- }
- // 声明一个工作薄
- SXSSFWorkbook workbook = new SXSSFWorkbook(1000);//缓存
- workbook.setCompressTempFiles(true);
- //表头样式
- CellStyle titleStyle = workbook.createCellStyle();
- titleStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
- Font titleFont = workbook.createFont();
- titleFont.setFontHeightInPoints((short) 20);
- titleFont.setBoldweight((short) 700);
- titleStyle.setFont(titleFont);
- // 列头样式
- CellStyle headerStyle = workbook.createCellStyle();
- headerStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
- headerStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
- headerStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
- headerStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
- headerStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
- headerStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
- Font headerFont = workbook.createFont();
- headerFont.setFontHeightInPoints((short) 12);
- headerFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
- headerStyle.setFont(headerFont);
- // 单元格样式
- CellStyle cellStyle = workbook.createCellStyle();
- cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
- cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
- cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
- cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
- cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
- cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
- cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
- Font cellFont = workbook.createFont();
- cellFont.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
- cellStyle.setFont(cellFont);
- // 生成一个(带标题)表格
- SXSSFSheet sheet = workbook.createSheet();
- //设置列宽
- int minBytes = colWidth < DEFAULT_COLOUMN_WIDTH ? DEFAULT_COLOUMN_WIDTH : colWidth;//至少字节数
- int[] arrColWidth = new int[headList.size()];
- // 产生表格标题行,以及设置列宽
- String[] properties = new String[headList.size()];
- String[] headers = new String[headList.size()];
- int ii = 0;
- for (int i = 0 ;i < headList.size(); i++) {
-
- //properties[ii] = fieldName;
- headers[ii] = headList.get(i);
-
- int bytes = headList.get(i).getBytes().length;
- arrColWidth[ii] = bytes < minBytes ? minBytes : bytes;
- sheet.setColumnWidth(ii, arrColWidth[ii] * 256);
- ii++;
- }
- // 遍历集合数据,产生数据行
- int rowIndex = 0;
- for (Student student : students) {
- if (rowIndex == 65535 || rowIndex == 0) {
- if (rowIndex != 0) {
- sheet = workbook.createSheet();//如果数据超过了,则在第二页显示
- }
- SXSSFRow titleRow = sheet.createRow(0);//表头 rowIndex=0
- titleRow.createCell(0).setCellValue(title);
- titleRow.getCell(0).setCellStyle(titleStyle);
- sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, headList.size() - 1));
-
- SXSSFRow headerRow = sheet.createRow(1); //列头 rowIndex =1
- for (int i = 0; i < headers.length; i++) {
- headerRow.createCell(i).setCellValue(headers[i]);
- headerRow.getCell(i).setCellStyle(headerStyle);
-
- }
- rowIndex = 2;//数据内容从 rowIndex=2开始
- }
-
- SXSSFRow dataRow = sheet.createRow(rowIndex);
-
- SXSSFCell newCell = dataRow.createCell(0);
- newCell.setCellStyle(cellStyle);
- newCell.setCellValue(student.getName());
-
- newCell = dataRow.createCell(1);
- //newCell.setCellStyle(cellStyle);
- newCell.setCellValue(student.getAge());
-
- newCell = dataRow.createCell(2);
- newCell.setCellValue(new SimpleDateFormat(datePattern).format(student.getBirthday()));
-
- newCell = dataRow.createCell(3);
- newCell.setCellValue(student.getHeight());
-
- newCell = dataRow.createCell(4);
- newCell.setCellValue(student.getWeight());
-
- newCell = dataRow.createCell(5);
- newCell.setCellValue(student.isSex());
-
- //
- //for (int i = 0; i < properties.length; i++) {
- //
- // Object o = jo.get(properties[i]);
- // String cellValue = "";
- // if (o == null) {
- // cellValue = "";
- // } else if (o instanceof Date) {
- // cellValue = new SimpleDateFormat(datePattern).format(o);
- // }
- // /*else if(o instanceof Float || o instanceof Double) {
- // double d = (double) o;
- // if(d%1==0) cellValue=o.toString();
- // else cellValue= new BigDecimal(o.toString()).setScale(2,BigDecimal.ROUND_HALF_UP).toString();
- // }*/
- // else {
- // cellValue = o.toString();
- // }
- // newCell.setCellValue(cellValue);
- // newCell.setCellStyle(cellStyle);
- //}
- rowIndex++;
- }
- // 自动调整宽度
- /*for (int i = 0; i < headers.length; i++) {
- sheet.autoSizeColumn(i);
- }*/
- try {
- workbook.write(out);
- workbook.close();
- workbook.dispose();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * 压缩单个excel文件的输出流 到zip输出流,注意zipOutputStream未关闭,需要交由调用者关闭之
- *
- * @param zipOutputStream zip文件的输出流
- * @param excelOutputStream excel文件的输出流
- * @param excelFilename 文件名可以带目录,例如 TestDir/test1.xlsx
- */
- public static void compressFileToZipStream(ZipOutputStream zipOutputStream,
- ByteArrayOutputStream excelOutputStream, String excelFilename) {
- byte[] buf = new byte[1024];
- try {
- // Compress the files
- byte[] content = excelOutputStream.toByteArray();
- ByteArrayInputStream is = new ByteArrayInputStream(content);
- BufferedInputStream bis = new BufferedInputStream(is);
- // Add ZIP entry to output stream.
- zipOutputStream.putNextEntry(new ZipEntry(excelFilename));
- // Transfer bytes from the file to the ZIP file
- int len;
- while ((len = bis.read(buf)) > 0) {
- zipOutputStream.write(buf, 0, len);
- }
- // Complete the entry
- //excelOutputStream.close();//关闭excel输出流
- zipOutputStream.closeEntry();
- bis.close();
- is.close();
- // Complete the ZIP file
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- public static void main(String[] args) throws IOException {
- int count = 100;
- List list = new ArrayList<>();
- for (int i = 0; i < count; i++) {
- Student s = new Student();
- s.setName("POI" + i);
- s.setAge(i);
- s.setBirthday(new Date());
- s.setHeight(i);
- s.setWeight(i);
- s.setSex(i / 2 != 0);
- list.add(s);
- }
- //Map headMap = new LinkedHashMap();
- //headMap.put("name", "姓名");
- //headMap.put("age", "年龄");
- //headMap.put("birthday", "生日");
- //headMap.put("height", "身高");
- //headMap.put("weight", "体重");
- //headMap.put("sex", "性别");
-
- List memberList = Arrays.asList("成员名称","账号","联系方式","签到次数","课程进度","培训时长","评级测试","答疑");
-
-
- //导出zip
- OutputStream outXlsx = new FileOutputStream("E://test.zip");
- ZipOutputStream zipOutputStream = new ZipOutputStream(outXlsx);
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- exportExcelX("testExcel", memberList, list, null, 0, baos);
- compressFileToZipStream(zipOutputStream, baos, "/test/aaa.xlsx");
- baos.close();
-
- zipOutputStream.flush();
- zipOutputStream.close();
- outXlsx.close();
-
- System.out.println("导出zip完成");
- }
-
-
- public void exportZip(HttpServletResponse response, List students) throws Exception {
-
- ServletOutputStream sos = response.getOutputStream();
- ZipOutputStream zipOutputStream = new ZipOutputStream(sos);
- String zipname = "test.zip";
- response.reset();
- response.setContentType("application/x-download");
- response.setHeader("Content-Disposition", "attachment;filename=" + new String((zipname).getBytes(), StandardCharsets.ISO_8859_1));
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- /**
- * 班级成员
- */
- List memberList = Arrays.asList("成员名称","账号","联系方式","签到次数","课程进度","培训时长","评级测试","答疑");
-
- /**
- * 注册签到
- */
- List signList = Arrays.asList("成员名称","培训时长","课程进度","完成率");
-
- /**
- * 测试成绩
- */
- List scoreList = Arrays.asList("成员名称","测试结果","最高分");
-
- /**
- * 答疑记录
- */
- List answerList = Arrays.asList("提问","答疑","提问时间","提问成员","答疑时间");
-
- //Map headMap = new LinkedHashMap();
- //headMap.put("name", "成员名称");
- //headMap.put("age", "年龄");
- //headMap.put("birthday", "生日");
- //headMap.put("height", "身高");
- //headMap.put("weight", "体重");
- //headMap.put("sex", "性别");
-
- exportExcelX("title", memberList, students, null, 0, baos);
- compressFileToZipStream(zipOutputStream, baos, "/test/aaa.xlsx");
- baos.close();
-
- zipOutputStream.flush();
- zipOutputStream.close();
- sos.close();
- System.out.println("导出zip完成");
- }
-
-}
diff --git a/src/main/java/com/subsidy/util/ZipUtils.java b/src/main/java/com/subsidy/util/ZipUtils.java
deleted file mode 100644
index d4e9c17..0000000
--- a/src/main/java/com/subsidy/util/ZipUtils.java
+++ /dev/null
@@ -1,260 +0,0 @@
-package com.subsidy.util;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import org.apache.poi.hssf.usermodel.HSSFCellStyle;
-import org.apache.poi.hssf.usermodel.HSSFFont;
-import org.apache.poi.hssf.util.CellRangeAddress;
-import org.apache.poi.ss.usermodel.CellStyle;
-import org.apache.poi.ss.usermodel.Font;
-import org.apache.poi.xssf.streaming.SXSSFCell;
-import org.apache.poi.xssf.streaming.SXSSFRow;
-import org.apache.poi.xssf.streaming.SXSSFSheet;
-import org.apache.poi.xssf.streaming.SXSSFWorkbook;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletResponse;
-import java.io.*;
-import java.nio.charset.StandardCharsets;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-public class ZipUtils {
-
- /*
- 原链接:https://blog.csdn.net/houxuehan/article/details/89189820
- */
-
- public static String NO_DEFINE = "no_define";//未定义的字段
- public static String DEFAULT_DATE_PATTERN = "yyyy年MM月dd日";//默认日期格式
- public static int DEFAULT_COLOUMN_WIDTH = 17;
-
- /**
- * 导出Excel 2007 OOXML (.xlsx)格式
- *
- * @param title 标题行
- * @param headMap 属性-列头
- * @param jsonArray 数据集
- * @param datePattern 日期格式,传null值则默认 年月日
- * @param colWidth 列宽 默认 至少17个字节
- * @param out 输出流
- */
- public static void exportExcelX(String title, Map headMap, JSONArray jsonArray, String datePattern, int colWidth, OutputStream out) {
- if (datePattern == null) {
- datePattern = DEFAULT_DATE_PATTERN;
- }
- // 声明一个工作薄
- SXSSFWorkbook workbook = new SXSSFWorkbook(1000);//缓存
- workbook.setCompressTempFiles(true);
- //表头样式
- CellStyle titleStyle = workbook.createCellStyle();
- titleStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
- Font titleFont = workbook.createFont();
- titleFont.setFontHeightInPoints((short) 20);
- titleFont.setBoldweight((short) 700);
- titleStyle.setFont(titleFont);
- // 列头样式
- CellStyle headerStyle = workbook.createCellStyle();
- headerStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
- headerStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
- headerStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
- headerStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
- headerStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
- headerStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
- Font headerFont = workbook.createFont();
- headerFont.setFontHeightInPoints((short) 12);
- headerFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
- headerStyle.setFont(headerFont);
- // 单元格样式
- CellStyle cellStyle = workbook.createCellStyle();
- cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
- cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
- cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
- cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
- cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
- cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
- cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
- Font cellFont = workbook.createFont();
- cellFont.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
- cellStyle.setFont(cellFont);
- // 生成一个(带标题)表格
- SXSSFSheet sheet = workbook.createSheet();
- //设置列宽
- int minBytes = colWidth < DEFAULT_COLOUMN_WIDTH ? DEFAULT_COLOUMN_WIDTH : colWidth;//至少字节数
- int[] arrColWidth = new int[headMap.size()];
- // 产生表格标题行,以及设置列宽
- String[] properties = new String[headMap.size()];
- String[] headers = new String[headMap.size()];
- int ii = 0;
- for (Iterator iter = headMap.keySet().iterator(); iter
- .hasNext(); ) {
- String fieldName = iter.next();
-
- properties[ii] = fieldName;
- headers[ii] = headMap.get(fieldName);
-
- int bytes = fieldName.getBytes().length;
- arrColWidth[ii] = bytes < minBytes ? minBytes : bytes;
- sheet.setColumnWidth(ii, arrColWidth[ii] * 256);
- ii++;
- }
- // 遍历集合数据,产生数据行
- int rowIndex = 0;
- for (Object obj : jsonArray) {
- if (rowIndex == 65535 || rowIndex == 0) {
- if (rowIndex != 0) {
- sheet = workbook.createSheet();//如果数据超过了,则在第二页显示
- }
- SXSSFRow titleRow = sheet.createRow(0);//表头 rowIndex=0
- titleRow.createCell(0).setCellValue(title);
- titleRow.getCell(0).setCellStyle(titleStyle);
- sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, headMap.size() - 1));
-
- SXSSFRow headerRow = sheet.createRow(1); //列头 rowIndex =1
- for (int i = 0; i < headers.length; i++) {
- headerRow.createCell(i).setCellValue(headers[i]);
- headerRow.getCell(i).setCellStyle(headerStyle);
-
- }
- rowIndex = 2;//数据内容从 rowIndex=2开始
- }
- JSONObject jo = (JSONObject) JSONObject.toJSON(obj);
- SXSSFRow dataRow = sheet.createRow(rowIndex);
- for (int i = 0; i < properties.length; i++) {
- SXSSFCell newCell = dataRow.createCell(i);
-
- Object o = jo.get(properties[i]);
- String cellValue = "";
- if (o == null) {
- cellValue = "";
- } else if (o instanceof Date) {
- cellValue = new SimpleDateFormat(datePattern).format(o);
- }
- /*else if(o instanceof Float || o instanceof Double) {
- double d = (double) o;
- if(d%1==0) cellValue=o.toString();
- else cellValue= new BigDecimal(o.toString()).setScale(2,BigDecimal.ROUND_HALF_UP).toString();
- }*/
- else {
- cellValue = o.toString();
- }
- newCell.setCellValue(cellValue);
- newCell.setCellStyle(cellStyle);
- }
- rowIndex++;
- }
- // 自动调整宽度
- /*for (int i = 0; i < headers.length; i++) {
- sheet.autoSizeColumn(i);
- }*/
- try {
- workbook.write(out);
- workbook.close();
- workbook.dispose();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * 压缩单个excel文件的输出流 到zip输出流,注意zipOutputStream未关闭,需要交由调用者关闭之
- *
- * @param zipOutputStream zip文件的输出流
- * @param excelOutputStream excel文件的输出流
- * @param excelFilename 文件名可以带目录,例如 TestDir/test1.xlsx
- */
- public static void compressFileToZipStream(ZipOutputStream zipOutputStream,
- ByteArrayOutputStream excelOutputStream, String excelFilename) {
- byte[] buf = new byte[1024];
- try {
- // Compress the files
- byte[] content = excelOutputStream.toByteArray();
- ByteArrayInputStream is = new ByteArrayInputStream(content);
- BufferedInputStream bis = new BufferedInputStream(is);
- // Add ZIP entry to output stream.
- zipOutputStream.putNextEntry(new ZipEntry(excelFilename));
- // Transfer bytes from the file to the ZIP file
- int len;
- while ((len = bis.read(buf)) > 0) {
- zipOutputStream.write(buf, 0, len);
- }
- // Complete the entry
- //excelOutputStream.close();//关闭excel输出流
- zipOutputStream.closeEntry();
- bis.close();
- is.close();
- // Complete the ZIP file
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- public static void main(String[] args) throws IOException {
- int count = 100;
- JSONArray ja = new JSONArray();
- for (int i = 0; i < count; i++) {
- Student s = new Student();
- s.setName("POI" + i);
- s.setAge(i);
- s.setBirthday(new Date());
- s.setHeight(i);
- s.setWeight(i);
- s.setSex(i / 2 != 0);
- ja.add(s);
- }
- Map headMap = new LinkedHashMap();
- headMap.put("name", "姓名");
- headMap.put("age", "年龄");
- headMap.put("birthday", "生日");
- headMap.put("height", "身高");
- headMap.put("weight", "体重");
- headMap.put("sex", "性别");
- //导出zip
- OutputStream outXlsx = new FileOutputStream("E://test.zip");
- ZipOutputStream zipOutputStream = new ZipOutputStream(outXlsx);
-
- for (int i = 1; i < 6; i++) {
- String dir = i % 2 == 0 ? "dirA" : "dirB";
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- exportExcelX("testExcel", headMap, ja, null, 0, baos);
- compressFileToZipStream(zipOutputStream, baos, dir + "/test" + i + ".xlsx");
- baos.close();
- }
- zipOutputStream.flush();
- zipOutputStream.close();
- outXlsx.close();
-
- System.out.println("导出zip完成");
- }
-
-
- public void exportZip(HttpServletResponse response) throws Exception {
-
- ServletOutputStream sos = response.getOutputStream();
- ZipOutputStream zipOutputStream = new ZipOutputStream(sos);
- String zipname = "test.zip";
- response.reset();
- response.setContentType("application/x-download");
- response.setHeader("Content-Disposition", "attachment;filename=" + new
-
- String((zipname).
-
- getBytes(), StandardCharsets.ISO_8859_1));
- for (int i = 1; i < 6; i++) {
- String dir = i % 2 == 0 ? "dirA" : "dirB";
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- //exportExcelX(title, headMap, ja, null, 0, baos);
- compressFileToZipStream(zipOutputStream, baos, dir + "/test" + i + ".xlsx");
- baos.close();
- }
- zipOutputStream.flush();
- zipOutputStream.close();
- sos.close();
- System.out.println("导出zip完成");
- }
-}
diff --git a/src/main/java/com/subsidy/util/excel/ExcelColumn.java b/src/main/java/com/subsidy/util/excel/ExcelColumn.java
index ca1690d..4344502 100644
--- a/src/main/java/com/subsidy/util/excel/ExcelColumn.java
+++ b/src/main/java/com/subsidy/util/excel/ExcelColumn.java
@@ -1,6 +1,11 @@
package com.subsidy.util.excel;
-import java.lang.annotation.*;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
diff --git a/src/main/java/com/subsidy/util/excel/ExcelColumnUtil.java b/src/main/java/com/subsidy/util/excel/ExcelColumnUtil.java
index 873ab06..e54be8f 100644
--- a/src/main/java/com/subsidy/util/excel/ExcelColumnUtil.java
+++ b/src/main/java/com/subsidy/util/excel/ExcelColumnUtil.java
@@ -1,6 +1,11 @@
package com.subsidy.util.excel;
-import java.lang.annotation.*;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
/**
*
diff --git a/src/main/java/com/subsidy/util/excel/ExcelUtil.java b/src/main/java/com/subsidy/util/excel/ExcelUtil.java
index fc6d242..729ecbd 100644
--- a/src/main/java/com/subsidy/util/excel/ExcelUtil.java
+++ b/src/main/java/com/subsidy/util/excel/ExcelUtil.java
@@ -14,7 +14,14 @@ import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.CellRangeAddress;
-import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.DateUtil;
+import org.apache.poi.ss.usermodel.Font;
+import org.apache.poi.ss.usermodel.IndexedColors;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.streaming.SXSSFCell;
import org.apache.poi.xssf.streaming.SXSSFRow;
import org.apache.poi.xssf.streaming.SXSSFSheet;
@@ -24,18 +31,26 @@ import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.multipart.MultipartFile;
-import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
-import java.io.*;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.net.URLEncoder;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import java.util.zip.ZipOutputStream;
/**
* Excel工具
diff --git a/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java b/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java
index 9ab86e9..63480bf 100644
--- a/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java
+++ b/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java
@@ -28,7 +28,7 @@ public class ClassDetailVO{
* 签到次数
*/
@ExcelColumn(col = 5,value = "签到次数")
- private Integer signCounts;
+ private Long signCounts;
/**
* 已看视频
diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties
index 3392cf0..82f67ed 100644
--- a/src/main/resources/application-dev.properties
+++ b/src/main/resources/application-dev.properties
@@ -1,7 +1,8 @@
# 本地环境配置
# 数据源配置
-spring.datasource.url=jdbc:mysql://47.97.19.66:3306/subsidy?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+#spring.datasource.url=jdbc:mysql://47.97.19.66:3306/subsidy?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+spring.datasource.url=jdbc:mysql://rm-uf67mjh19252z6yg4eo.mysql.rds.aliyuncs.com:3306/subsidy?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.datasource.username=ykadmin_new
@@ -26,9 +27,9 @@ spring.datasource.druid.useGlobalDataSourceStat=true
# 控制台日志打印
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
-spring.redis.host=47.97.19.66
-spring.redis.password=Ykhl@208
-spring.redis.port=6389
+spring.redis.host=r-uf6thsc3bzt5b6f7fdpd.redis.rds.aliyuncs.com
+spring.redis.password=r-uf6thsc3bzt5b6f7fd:Ykhl@208
+spring.redis.port=6379
spring.redis.lettuce.pool.max-idle=16
spring.redis.lettuce.pool.max-active=32
spring.redis.lettuce.pool.min-idle=8
\ No newline at end of file
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index cbb7380..4186757 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -1,7 +1,7 @@
# 环境配置
spring.profiles.active=dev
# 端口号
-spring.server.port=23454
+spring.server.port=23457
#嵌入tomcat配置
#和CPU数
spring.server.acceptorThreadCount=200
@@ -53,17 +53,26 @@ vod.region=ap-shanghai
vod.classId=848920
# quartz
# 数据持久化方式
-spring.quartz.job-store-type=jdbc
-# 初始化后是否自动启动计划程序
-spring.quartz.auto-startup=true
-# 初始化完成后启动计划程序的延迟时间
-spring.quartz.startup-delay=10s
-# 配置的作业是否应覆盖现有的作业定义
-spring.quartz.overwrite-existing-jobs=false
+#spring.quartz.job-store-type=jdbc
+## 初始化后是否自动启动计划程序
+#spring.quartz.auto-startup=true
+## 初始化完成后启动计划程序的延迟时间
+#spring.quartz.startup-delay=10s
+## 配置的作业是否应覆盖现有的作业定义
+#spring.quartz.overwrite-existing-jobs=false
# 自动建表,如果已经存在表请勿使用,会覆盖数据表
#spring.quartz.jdbc.initialize-schema=always
#spring.datasource.initialization-mode=embedded
+spring.task.execution.pool.allow-core-thread-timeout=true
+spring.task.execution.pool.core-size=8
+spring.task.execution.pool.keep-alive=60
+spring.task.execution.pool.max-size=200
+spring.task.execution.pool.queue-capacity=200
+spring.task.execution.thread-name-prefix=subsidy-
+
+#spring.task.scheduling.pool.size=2
+#spring.task.scheduling.thread-name-prefix=subsidy-
#spring.redis.cluster.nodes=47.97.19.66:6377,47.97.19.66:6378,47.97.19.66:6379
##spring.redis.port=6379
diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml
index 0fa1a04..03afcfb 100644
--- a/src/main/resources/logback-spring.xml
+++ b/src/main/resources/logback-spring.xml
@@ -7,7 +7,7 @@
- debug
+ info
%d [%t] %5p %c:%L - %m%n
@@ -47,7 +47,7 @@
-
+
@@ -56,14 +56,14 @@
-
+
-
+
diff --git a/src/main/resources/mapper/ClassHourDictMapper.xml b/src/main/resources/mapper/ClassHourDictMapper.xml
index 138848c..14853ec 100644
--- a/src/main/resources/mapper/ClassHourDictMapper.xml
+++ b/src/main/resources/mapper/ClassHourDictMapper.xml
@@ -20,22 +20,4 @@
id, class_hour, status
-
-
diff --git a/src/main/resources/mapper/ClassMemberMappingMapper.xml b/src/main/resources/mapper/ClassMemberMappingMapper.xml
index 55f02db..ead4ba5 100644
--- a/src/main/resources/mapper/ClassMemberMappingMapper.xml
+++ b/src/main/resources/mapper/ClassMemberMappingMapper.xml
@@ -59,4 +59,17 @@
+
+
diff --git a/src/main/resources/mapper/MemberMapper.xml b/src/main/resources/mapper/MemberMapper.xml
index 3086014..2554aed 100644
--- a/src/main/resources/mapper/MemberMapper.xml
+++ b/src/main/resources/mapper/MemberMapper.xml
@@ -55,6 +55,7 @@
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
+ and t3.delete_date is null
AND t.member_id = #{id}
diff --git a/src/main/resources/mapper/VodPlayHistoryMapper.xml b/src/main/resources/mapper/VodPlayHistoryMapper.xml
index 14a22d8..b5780ff 100644
--- a/src/main/resources/mapper/VodPlayHistoryMapper.xml
+++ b/src/main/resources/mapper/VodPlayHistoryMapper.xml
@@ -102,4 +102,15 @@
AND a.vod_id = b.vod_id
+
+