Commit 07127669 by 涂亚平

压测优化版本

多线程还有点问题,容易进入死循环
1 parent f136ed8c
Showing with 554 additions and 701 deletions
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;
//}
}
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_";
}
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();
}
}
......@@ -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;
/**
* <p>
......@@ -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();
}
}
......@@ -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;
/**
* <p>
......@@ -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));
}
......
......@@ -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;
/**
* <p>
......@@ -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));
......
......@@ -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;
/**
* <p>
......@@ -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));
}
......
......@@ -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;
/**
* <p>
......
package com.subsidy.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 班级成员映射表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-10-12
*/
@RestController
@Api(tags = "班级成员映射表")
@RequestMapping("/class-member-mapping-do")
public class ClassMemberMappingController {
}
......@@ -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;
/**
* <p>
......
......@@ -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;
/**
* <p>
......
......@@ -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;
/**
* <p>
......
......@@ -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;
/**
* <p>
......
......@@ -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;
/**
* <p>
......
......@@ -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;
/**
* <p>
......
......@@ -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;
/**
* <p>
......
......@@ -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;
/**
* <p>
......
......@@ -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;
/**
* <p>
......
package com.subsidy.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 老师部门映射表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-11-01
*/
@RestController
@Api(tags = "老师部门映射表")
@RequestMapping("/member-department-mapping-do")
public class MemberDepartmentMappingController {
}
......@@ -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;
/**
* <p>
......
......@@ -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;
/**
* <p>
......
......@@ -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;
/**
* <p>
......@@ -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));
}
......
package com.subsidy.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 权限表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@RestController
@Api(tags = "权限表")
@RequestMapping("/permissions-dict-do")
public class PermissionsDictController {
}
package com.subsidy.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 前端控制器
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@RestController
@Api(tags = "")
@RequestMapping("/role-administer-mapping-do")
public class RoleAdministerMappingController {
}
package com.subsidy.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 角色表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@RestController
@Api(tags = "角色表")
@RequestMapping("/role-dict-do")
public class RoleDictController {
}
package com.subsidy.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 系统用户角色表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@RestController
@Api(tags = "系统用户角色表")
@RequestMapping("/role-permission-mapping-do")
public class RolePermissionMappingController {
}
......@@ -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;
/**
* <p>
......@@ -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();
}
}
......@@ -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;
/**
* <p>
......
......@@ -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;
/**
* <p>
......
......@@ -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;
/**
* <p>
......
......@@ -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;
}
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;
......
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;
/**
* <p>
* 问题答疑表 Mapper 接口
......
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;
......
......@@ -15,10 +15,4 @@ import org.springframework.stereotype.Repository;
@Repository
public interface ClassHourDictMapper extends BaseMapper<ClassHourDictDO> {
/**
* 获取课程的次数
* @return
*/
ClassHourDictDO getClassHourDictInfo(Long classId);
}
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<ClassMemberMappingD
* 获取班级成员id
*/
IPage<ClassDailyInfoVO> getClassMembersWithName(IPage iPage, Long classId, String userName);
/**
* 获取学生当前有效班级
*/
long getMemberClassCount(Long memberId);
}
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;
......
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;
......
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;
......
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;
/**
* <p>
* 部门字典表 Mapper 接口
......
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;
......
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;
/**
* <p>
* 学生签到表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2021-10-18
*/
@Repository
@Repository
public interface SignInRecordMapper extends BaseMapper<SignInRecordDO> {
/**
* 公司学习记录
*/
IPage<ClassSignInfoVO> classSignInfo(IPage iPage,String className,String courseName,Integer id);
IPage<ClassSignInfoVO> classSignInfo(IPage iPage, String className, String courseName, Integer id);
}
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<VodPlayHistoryDO> {
List<VodPlayHistoryDO> getVodPlayHistory();
void deleteById(Long id);
/**
* 查看某人当天看了多少时间
*/
int memberDailyStudyLength(Long memberId);
}
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<AdministerDO> {
String importMember(Long companyId, MultipartFile multipartFile);
void importRedis();
}
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;
......
package com.subsidy.service;
import com.subsidy.model.ClassMemberMappingDO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 班级成员映射表 服务类
* </p>
*
* @author DengMin
* @since 2021-10-12
*/
public interface ClassMemberMappingService extends IService<ClassMemberMappingDO> {
}
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;
......
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;
......
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;
/**
......
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;
/**
* <p>
......@@ -29,5 +26,5 @@ public interface SignInRecordService extends IService<SignInRecordDO> {
SignInStatusVO signInStatus(SignInRecordDO signInRecordDO);
Object test();
void test();
}
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;
/**
* <p>
* 视频表 服务类
......
......@@ -9,6 +9,7 @@ import com.subsidy.mapper.AnsweringQuestionMapper;
import com.subsidy.service.AnsweringQuestionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
/**
......@@ -28,16 +29,19 @@ public class AnsweringQuestionServiceImpl extends ServiceImpl<AnsweringQuestionM
return this.baseMapper.getCourseQuestion(pager, getCourseQuestionDTO.getClassId(), getCourseQuestionDTO.getMemberId());
}
@Async
public String addQuestion(AnsweringQuestionDO answeringQuestionDO) {
this.baseMapper.insert(answeringQuestionDO);
return ConstantUtils.ADD_SUCCESS;
}
@Async
public String deleteQuestion(AnsweringQuestionDO answeringQuestionDO) {
this.baseMapper.deleteById(answeringQuestionDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
@Async
public String updateQuestion(AnsweringQuestionDO answeringQuestionDO) {
this.baseMapper.updateById(answeringQuestionDO);
return ConstantUtils.SET_SUCCESS;
......
......@@ -10,6 +10,7 @@ import com.subsidy.mapper.CategoryMapper;
import com.subsidy.service.CategoryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.List;
......@@ -56,6 +57,7 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, CategoryDO>
}
@Async
public String addCategory(CategoryDO categoryDO) {
int count = 0;
......@@ -80,11 +82,13 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, CategoryDO>
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<CategoryDO>()
......
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<ClassDictMapper, ClassDict
}
@Transactional
@Async
public String deleteClasses(ClassDictDO classDictDO) {
this.baseMapper.deleteById(classDictDO.getId());
......@@ -60,6 +67,7 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
return ConstantUtils.DELETE_SUCCESS;
}
@Async
public String addClass(AddClassDTO addClassDTO) {
//查看当前登录人的角色
......@@ -81,6 +89,7 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
return ConstantUtils.ADD_SUCCESS;
}
@Async
public String updateClass(ClassDictDO classDictDO) {
this.baseMapper.updateById(classDictDO);
return ConstantUtils.SET_SUCCESS;
......@@ -90,6 +99,7 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
return this.baseMapper.selectById(classDictDO.getId());
}
@Async
public String removeMember(ClassMemberMappingDO classMemberMappingDO) {
classMemberMappingMapper.delete(new QueryWrapper<ClassMemberMappingDO>()
.lambda()
......@@ -115,6 +125,7 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
return ConstantUtils.ADD_SUCCESS;
}
@Async
public String batchSms(ClassDictDO classDictDO){
ClassDictDO classDictDO1 = this.baseMapper.selectById(classDictDO.getId());
......
package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.subsidy.common.RedisPrefixConstant;
import com.subsidy.mapper.ClassHourDictMapper;
import com.subsidy.mapper.MemberMapper;
import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.model.ClassHourDictDO;
import com.subsidy.mapper.ClassHourDictMapper;
import com.subsidy.model.MemberDO;
import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.service.ClassHourDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.RedisUtil;
import com.subsidy.vo.hour.PollingGetVO;
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 java.time.LocalDate;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
/**
* <p>
......@@ -29,81 +37,93 @@ import java.util.List;
public class ClassHourDictServiceImpl extends ServiceImpl<ClassHourDictMapper, ClassHourDictDO> 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<ClassHourDictDO>()
.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 = new ClassHourDictDO();
Integer total = 0;
try {
//多个任务
Future<ClassHourDictDO> future1 = newCachedThreadPool.submit(() -> ///该学生完成了多少个 学生成绩,学生进度
pollingGetTask1(memberDO.getCompanyId())).get();
//查看系统设定的时长
ClassHourDictDO classHourDictDO = classHourDictMapper.selectOne(new QueryWrapper<ClassHourDictDO>()
.lambda()
.eq(ClassHourDictDO::getStatus,1)
.gt(ClassHourDictDO::getCompanyId,memberDO.getCompanyId()));
if (null == classHourDictDO){
pollingGetVO.setBool(false);
return pollingGetVO;
classHourDictDO = future1.get();
Future<Integer> future2 = newCachedThreadPool.submit(() -> //答疑
pollingGetTask2(memberDO.getId())).get();
////查看当天这个人看了多少时间
total = future2.get();
} catch (Exception e) {
e.printStackTrace();
}
//查看当天这个人看了多少时间
List<VodPlayHistoryDO> vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper<VodPlayHistoryDO>()
.lambda()
.eq(VodPlayHistoryDO::getMemberId,vodPlayHistoryDO.getMemberId())
.eq(VodPlayHistoryDO::getCreateDate, LocalDate.now()));
int total = 0 ;
//执行后不再接收新任务,如果里面有任务,就执行完
newCachedThreadPool.shutdown();
try {
while (true) {
//等待所有任务都结束了继续执行
if (newCachedThreadPool.isTerminated()) {
break;
}
}
for (VodPlayHistoryDO vodPlayHistoryDO1 : vodPlayHistoryDOS){
total += vodPlayHistoryDO1.getPlayLength();
} 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<ClassHourDictDO> 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<Integer> pollingGetTask2(Long memberId) {
return new AsyncResult<>(vodPlayHistoryMapper.memberDailyStudyLength(memberId));
}
}
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;
/**
* <p>
* 班级成员映射表 服务实现类
* </p>
*
* @author DengMin
* @since 2021-10-12
*/
@Service
public class ClassMemberMappingServiceImpl extends ServiceImpl<ClassMemberMappingMapper, ClassMemberMappingDO> implements ClassMemberMappingService {
}
......@@ -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<CompanyDictMapper, Compa
private DepartmentDictMapper departmentDictMapper;
@Autowired
private ClassHourDictMapper classHourDictMapper;
private RedisUtil redisUtil;
public IPage<OperatorsVO> operators(OperatorsDTO operatorsDTO) {
Page pager = new Page(operatorsDTO.getPageNum(), operatorsDTO.getPageSize());
......@@ -109,10 +119,13 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
classHourDictDO2.setRepeatStatus(0);
classHourDictDO2.setRepeatTime(3);
classHourDictMapper.insert(classHourDictDO2);
redisUtil.set(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX +companyDictDO.getId(),classHourDictDO2);
return ConstantUtils.ADD_SUCCESS;
}
@Async
public String deleteAdminister(CompanyDictDO companyDictDO) {
this.baseMapper.deleteById(companyDictDO.getId());
......@@ -123,6 +136,7 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
return ConstantUtils.DELETE_SUCCESS;
}
@Async
public String updateAdminister(AddCompanyDTO addCompanyDTO) {
CompanyDictDO companyDictDO = new CompanyDictDO();
......
package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.common.exception.HttpException;
import com.subsidy.controller.CourseContentController;
import com.subsidy.mapper.VodDictMapper;
import com.subsidy.model.CourseContentDO;
import com.subsidy.mapper.CourseContentMapper;
import com.subsidy.model.CourseDictDO;
import com.subsidy.model.VodDictDO;
import com.subsidy.model.CourseContentDO;
import com.subsidy.service.CourseContentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.subsidy.vo.vod.GetContendVodsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.List;
......@@ -36,11 +31,13 @@ public class CourseContentServiceImpl extends ServiceImpl<CourseContentMapper, C
.orderByAsc(CourseContentDO::getCreateDate));
}
@Async
public String deleteContent(CourseContentDO courseContentDO){
this.baseMapper.deleteById(courseContentDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
@Async
public String addContent(CourseContentDO courseContentDO){
List<CourseContentDO> courseContentDOS = this.baseMapper.selectList(new QueryWrapper<CourseContentDO>()
......@@ -58,6 +55,7 @@ public class CourseContentServiceImpl extends ServiceImpl<CourseContentMapper, C
return ConstantUtils.ADD_SUCCESS;
}
@Async
public String updateContent(CourseContentDO courseContentDO){
List<CourseContentDO> courseContentDOS = this.baseMapper.selectList(new QueryWrapper<CourseContentDO>()
......
......@@ -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;
/**
* <p>
* 服务实现类
......@@ -35,6 +30,7 @@ public class CourseDictServiceImpl extends ServiceImpl<CourseDictMapper, CourseD
@Autowired
private RoleAdministerMappingMapper roleAdministerMappingMapper;
@Async
public String addCourse(CourseDictDO courseDictDO) {
int count = 0;
......@@ -60,6 +56,7 @@ public class CourseDictServiceImpl extends ServiceImpl<CourseDictMapper, CourseD
return ConstantUtils.ADD_SUCCESS;
}
@Async
public String deleteCourse(CourseDictDO courseDictDO) {
this.baseMapper.deleteById(courseDictDO.getId());
return ConstantUtils.DELETE_SUCCESS;
......@@ -81,6 +78,7 @@ public class CourseDictServiceImpl extends ServiceImpl<CourseDictMapper, CourseD
return this.baseMapper.queryCourses(pager, queryCoursesDTO.getCourseName(), queryCoursesDTO.getCategoryId(), queryCoursesDTO.getCourseType(), queryCoursesDTO.getCourseSource(), queryCoursesDTO.getCompanyId());
}
@Async
public String updateCourses(CourseDictDO courseDictDO) {
int count = 0;
......
......@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
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.ArrayList;
......@@ -97,6 +98,7 @@ public class DepartmentDictServiceImpl extends ServiceImpl<DepartmentDictMapper,
return getDepartmentsVOS;
}
@Async
public String addDepartment(DepartmentDictDO departmentDictDO) {
Integer counter = this.baseMapper.selectCount(new QueryWrapper<DepartmentDictDO>()
......@@ -113,6 +115,7 @@ public class DepartmentDictServiceImpl extends ServiceImpl<DepartmentDictMapper,
return ConstantUtils.ADD_SUCCESS;
}
@Async
public String deleteDepartment(DepartmentDictDO departmentDictDO) {
this.baseMapper.deleteById(departmentDictDO.getId());
......@@ -140,6 +143,7 @@ public class DepartmentDictServiceImpl extends ServiceImpl<DepartmentDictMapper,
this.baseMapper.deleteById(departmentDictDO.getId());
}
@Async
public String updateDepartment(DepartmentDictDO departmentDictDO) {
Integer counter = this.baseMapper.selectCount(new QueryWrapper<DepartmentDictDO>()
......
......@@ -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<ExerciseDictMapper, Exe
.orderByAsc(ExerciseDictDO::getOrderNo));
}
@Async
public String addExercise(ExerciseDictDO exerciseDictDO){
List<ExerciseDictDO> exerciseDictDOS = this.baseMapper.selectList(new QueryWrapper<ExerciseDictDO>()
......@@ -75,11 +77,13 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe
return ConstantUtils.ADD_SUCCESS;
}
@Async
public String deleteExercise(ExerciseDictDO exerciseDictDO) {
this.baseMapper.deleteById(exerciseDictDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
@Async
public String updateExercise(ExerciseDictDO exerciseDictDO) {
this.baseMapper.updateById(exerciseDictDO);
return ConstantUtils.SET_SUCCESS;
......@@ -102,6 +106,7 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe
}
@Transactional(rollbackFor = Exception.class)
@Async
public Long submit(SubmitDTO submitDTO) {
ExerciseDoneResultDO exerciseDoneResultDO = new ExerciseDoneResultDO();
......@@ -135,11 +140,6 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe
exerciseDoneResultDO.setResult("不合格");
}
//exerciseDoneResultMapper.delete(new QueryWrapper<ExerciseDoneResultDO>()
// .lambda()
// .eq(ExerciseDoneResultDO::getMemberId, submitDTO.getMemberId())
// .eq(ExerciseDoneResultDO::getCourseId, submitDTO.getCourseId()));
exerciseDoneResultMapper.insert(exerciseDoneResultDO);
for (MemberExerciseVO memberExerciseVO : memberExerciseVOS){
......
......@@ -18,7 +18,6 @@ import org.springframework.stereotype.Service;
@Service
public class ExerciseDoneResultServiceImpl extends ServiceImpl<ExerciseDoneResultMapper, ExerciseDoneResultDO> implements ExerciseDoneResultService {
public GetDoneDetailVO getDoneDetail(ExerciseDoneResultDO exerciseDoneResultDO){
return this.baseMapper.getDoneDetail(exerciseDoneResultDO.getId());
}
......
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<FileDictMapper, FileDictDO>
.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;
......
......@@ -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<PaperDictMapper, PaperDict
return this.baseMapper.queryPapers(paperDictDO.getCourseId(),paperDictDO.getPaperName(),null);
}
@Async
public String deletePaper(PaperDictDO paperDictDO){
this.baseMapper.deleteById(paperDictDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
@Async
public String updateStatus(PaperDictDO paperDictDO){
this.baseMapper.updateById(paperDictDO);
return ConstantUtils.SET_SUCCESS;
}
@Async
public String addPaper(PaperDictDO paperDictDO){
Integer count = this.baseMapper.selectCount(new QueryWrapper<PaperDictDO>()
......
......@@ -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;
/**
* <p>
......@@ -55,6 +69,9 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
@Autowired
private RedisUtil redisUtil;
@Autowired
private ClassHourDictMapper classHourDictMapper;
public IPage<GetMemberSignInfoVO> getMemberSignInfo(GetMemberSignInfoDTO getMemberSignInfoDTO) {
Page pager = new Page(getMemberSignInfoDTO.getPageNum(), getMemberSignInfoDTO.getPageSize());
......@@ -64,6 +81,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
.orderByDesc(SignInRecordDO::getCreateDate));
}
@Async
public String signIn(SignInRecordDO signInRecordDO) {
/**
......@@ -84,7 +102,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
signInRecordDO1.setSignInDate(LocalDateTime.now());
*/
redisUtil.set("subsidySignInfo_"+signInRecordDO.getMemberId()+"_"+classDictDO.getId()+"_"+DateFormatUtil.format(new Date(), "yyyyMMdd")+"_"+System.currentTimeMillis(), null);
redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId_" + signInRecordDO.getMemberId() + "_classId_" + classDictDO.getId() + "_" + DateFormatUtil.format(new Date(), "yyyyMMdd") + "_" + System.currentTimeMillis(), null);
// this.baseMapper.insert(signInRecordDO1);
}
......@@ -107,12 +125,40 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
classSignInfoVO.setMemberCount(classMemberMappingDOS.size());
//课程总数
List<VodDictDO> vodDictDOS = classDictMapper.getClassVods(classSignInfoVO.getClassId());
classSignInfoVO.setTotalVodCounts(vodDictDOS.size());
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;
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
classSignInfoVOIPage.setRecords(classSignInfoVOS);
return classSignInfoVOIPage;
}
public void classSignInfoTask1(List<VodDictDO> vodDictDOS, List<ClassMemberMappingDO> classMemberMappingDOS, ClassSignInfoVO classSignInfoVO) {
int totalStudyVods = 0;
int totalStudyLength = 0;
//学生总共学习课时数
......@@ -138,7 +184,9 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
//平均完成时长 学生观看课程视频的全部时长/总人数
int avg = MathUtil.intDivCeil(totalStudyLength, classMemberMappingDOS.size());
classSignInfoVO.setAvgVodPlayLength(avg);
}
public void classSignInfoTask2(ClassSignInfoVO classSignInfoVO, List<ClassMemberMappingDO> classMemberMappingDOS) {
//测试通过率
List<ExerciseDoneResultDO> exerciseDoneResultDOS = exerciseDoneResultMapper.selectList(new QueryWrapper<ExerciseDoneResultDO>()
.lambda()
......@@ -152,13 +200,12 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
}
}
classSignInfoVO.setPassRate(MathUtil.intDivFloorPercent(passNum, classMemberMappingDOS.size()));
}
public void classSignInfoTask3(ClassSignInfoVO classSignInfoVO, List<ClassMemberMappingDO> classMemberMappingDOS) {
//平均签到数 向上取整
//签到总次数
Integer signCount = this.baseMapper.selectCount(new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getClassId, classSignInfoVO.getClassId()));
long signCount = redisUtil.keys(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "*_classId_" + classSignInfoVO.getClassId() + "_*").stream().count();
classSignInfoVO.setAvgSignCount(MathUtil.intDivCeil(signCount, classMemberMappingDOS.size()));
//答疑数
......@@ -168,11 +215,6 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
classSignInfoVO.setAnswerCount(count);
}
classSignInfoVOIPage.setRecords(classSignInfoVOS);
return classSignInfoVOIPage;
}
public SignInStatusVO signInStatus(SignInRecordDO signInRecordDO) {
SignInStatusVO signInStatusVO = new SignInStatusVO();
......@@ -180,35 +222,36 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
Boolean flag = true; // 已经签过到了
//获取有效课程
List<ClassDictDO> classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId());
for (ClassDictDO classDictDO : classDictDOS) {
/*Integer count = this.baseMapper.selectCount(new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getClassId, classDictDO.getId())
.eq(SignInRecordDO::getMemberId, signInRecordDO.getMemberId())
.gt(SignInRecordDO::getSignInDate, LocalDate.now()));*/
long count = classMemberMappingMapper.getMemberClassCount(signInRecordDO.getMemberId());
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<ClassHourDictDO> classHourDictDOS = classHourDictMapper.selectList(null);
//
//for (ClassHourDictDO classHourDictDO : classHourDictDOS) {
// redisUtil.set(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + classHourDictDO.getCompanyId(), classHourDictDO);
//}
List<ClassHourDictDO> classHourDictDOS = classHourDictMapper.selectList(null);
for (ClassHourDictDO classHourDictDO : classHourDictDOS){
redisUtil.set("subsidySettings_"+classHourDictDO.getCompanyId(),classHourDictDO);
}
return null;
}
}
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;
/**
* <p>
* 短信验证码记录表 服务实现类
......@@ -38,6 +37,7 @@ public class SmsVerifyCodeServiceImpl extends ServiceImpl<SmsVerifyCodeMapper, S
@Autowired
private RedisUtil redisUtil;
@Async
public void sendVerifyCode(SendVerifyCodeDTO sendVerifyCodeDTO){
MemberDO memberDO =memberMapper.selectOne(new QueryWrapper<MemberDO>()
.lambda()
......@@ -57,7 +57,7 @@ public class SmsVerifyCodeServiceImpl extends ServiceImpl<SmsVerifyCodeMapper, S
/**
* 验证码存在redis
*/
redisUtil.set("subsidySmsCode_"+sendVerifyCodeDTO.getTelephone(),code,30*60);
redisUtil.set(RedisPrefixConstant.SUBSIDY_TELEPHONE_PREFIX +sendVerifyCodeDTO.getTelephone(),code,30*60);
}
......
......@@ -2,13 +2,13 @@ package com.subsidy.service.impl;
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.configure.VODConfig;
import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.content.GetContendVodsDTO;
import com.subsidy.model.VodDictDO;
import com.subsidy.mapper.VodDictMapper;
import com.subsidy.model.VodDictDO;
import com.subsidy.service.VodDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.Signature;
import com.subsidy.vo.vod.GetContendVodsVO;
......@@ -18,11 +18,15 @@ import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.vod.v20180717.VodClient;
import com.tencentcloudapi.vod.v20180717.models.*;
import com.tencentcloudapi.vod.v20180717.models.DeleteMediaRequest;
import com.tencentcloudapi.vod.v20180717.models.MediaProcessTaskInput;
import com.tencentcloudapi.vod.v20180717.models.ProcessMediaRequest;
import com.tencentcloudapi.vod.v20180717.models.ProcessMediaResponse;
import com.tencentcloudapi.vod.v20180717.models.TranscodeTaskInput;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Random;
/**
......@@ -67,6 +71,7 @@ public class VodDictServiceImpl extends ServiceImpl<VodDictMapper, VodDictDO> 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<VodDictMapper, VodDictDO> im
return ConstantUtils.DELETE_SUCCESS;
}
@Async
public String addVod(VodDictDO vodDictDO) {
this.baseMapper.insert(vodDictDO);
//上传后直接转码
......@@ -121,7 +127,6 @@ public class VodDictServiceImpl extends ServiceImpl<VodDictMapper, VodDictDO> 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<VodDictMapper, VodDictDO> im
return ConstantUtils.ADD_SUCCESS;
}
@Async
public String updateVod(VodDictDO vodDictDO) {
this.baseMapper.updateById(vodDictDO);
return ConstantUtils.SET_SUCCESS;
......
......@@ -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<VodPlayHistoryMapper, VodPlayHistoryDO> 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;
}
......
......@@ -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;
......
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);
}
}
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;
}
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)
......
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;
/**
* <p>
......
......@@ -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工具
......
......@@ -28,7 +28,7 @@ public class ClassDetailVO{
* 签到次数
*/
@ExcelColumn(col = 5,value = "签到次数")
private Integer signCounts;
private Long signCounts;
/**
* 已看视频
......
# 本地环境配置
# 数据源配置
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
# 环境配置
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
......
......@@ -7,7 +7,7 @@
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>debug</level>
<level>info</level>
</filter>
<encoder>
<pattern>%d [%t] %5p %c:%L - %m%n</pattern>
......@@ -47,7 +47,7 @@
</appender>
<springProfile name="dev">
<logger name="com.juequn" level="error" />
<logger name="com.subsidy" level="error" />
<root level="INFO">
<appender-ref ref="CONSOLE" />
<appender-ref ref="INFO_FILE" />
......@@ -56,14 +56,14 @@
</springProfile>
<springProfile name="pre">
<logger name="com.juequn" level="error" />
<logger name="com.subsidy" level="error" />
<root level="INFO">
<appender-ref ref="ERROR_FILE" />
</root>
</springProfile>
<springProfile name="prod">
<logger name="com.juequn" level="error" />
<logger name="com.subsidy" level="error" />
<root level="INFO">
<appender-ref ref="ERROR_FILE" />
</root>
......
......@@ -20,22 +20,4 @@
id, class_hour, status
</sql>
<select id="getClassHourDictInfo" parameterType="long" resultType="com.subsidy.model.ClassHourDictDO">
SELECT
class_hour,
interrupt,
repeat_time,
STATUS,
interrupt_status,
repeat_status
FROM
class_dict t
LEFT JOIN class_hour_dict t2 ON t.company_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t.id = #{classId}
AND t2.repeat_status = 1
</select>
</mapper>
......@@ -59,4 +59,17 @@
</if>
</select>
<select id="getMemberClassCount" parameterType="long" resultType="long">
SELECT
count(1)
FROM
class_member_mapping t
LEFT JOIN class_dict t2 ON t.class_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
and t2.end_date >=DATE_FORMAT(now(), '%Y-%m-%d')
and t.member_id = #{memberId}
</select>
</mapper>
......@@ -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}
</select>
......
......@@ -102,4 +102,15 @@
AND a.vod_id = b.vod_id
</select>
<select id="memberDailyStudyLength" parameterType="long" resultType="integer">
SELECT
ifnull( sum( t.play_length ), 0 )
FROM
vod_play_history t
WHERE
t.delete_date IS NULL
AND DATE_FORMAT( t.create_date, '%Y-%m-%d' ) = DATE_FORMAT( now(), '%Y-%m-%d' )
AND t.member_id = #{memberId}
</select>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!