Commit 2668dc30 by 涂亚平

优化后版本,跑数据脚本

1 parent d5c90365
Showing with 808 additions and 352 deletions
......@@ -203,6 +203,12 @@
<artifactId>jedis</artifactId>
<version>${jedis.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
</dependencies>
<build>
......
......@@ -5,31 +5,31 @@ public class RedisPrefixConstant {
/**
* subsidyAdminister_accountName:AdministerDO 老师账号密码
*/
public static final String SUBSIDY_ADMINISTER_PREFIX = "subsidyAdminister_";
public static final String SUBSIDY_ADMINISTER_PREFIX = "subsidyAdminister:";
/**
* subsidyMember_companyId_accountName:MemberDO 学员账号密码
*/
public static final String SUBSIDY_COMPANY_MEMBER_PREFIX = "subsidyMember_";
public static final String SUBSIDY_COMPANY_MEMBER_PREFIX = "subsidyMember:";
/**
*subsidy_memberLogin_memberId_userName_companyName_now : 学员端审计记录
*/
public static final String SUBSIDY_MEMBER_LOGIN_PREFIX = "subsidy_memberLogin_";
///**
// *subsidy_memberLogin_memberId_userName_companyName_now : 学员端审计记录
// */
//public static final String SUBSIDY_MEMBER_LOGIN_PREFIX = "subsidy:memberLogin:";
/**
* subsidySmsCode_telephone:code 手机验证码
*/
public static final String SUBSIDY_TELEPHONE_PREFIX = "subsidySmsCode_";
public static final String SUBSIDY_TELEPHONE_PREFIX = "subsidySmsCode:";
/**
* subsidySettings_companyId:ClassHourDictDO 公司操作设置
*/
public static final String SUBSIDY_SETTINGS_PREFIX = "subsidySettings_";
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_";
public static final String SUBSIDY_SIGN_INFO_PREFIX = "subsidySignInfo:";
}
......@@ -16,6 +16,7 @@ import com.subsidy.service.AdministerService;
import com.subsidy.util.ConstantUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -65,7 +66,7 @@ public class AdministerController {
@PostMapping("/administers")
@ApiOperation("查询所有运营者 { userName pageNum pageSize }")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO operators(@RequestBody OperatorsDTO operatorsDTO){
return ResponseData.generateCreatedResponse(0,administerService.operators(operatorsDTO));
}
......@@ -90,7 +91,7 @@ public class AdministerController {
@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));
}
......@@ -112,13 +113,13 @@ public class AdministerController {
@PostMapping("signDetail")
@ApiOperation("班级管理--注册签到 id 班级id userName")
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO signDetail(@RequestBody ClassDetailDTO classDetailDTO){
return ResponseData.generateCreatedResponse(0,administerService.signDetail(classDetailDTO));
}
@PostMapping("exportSignDetail")
@ApiOperation("** 班级管理--注册签到 id 班级id userName")
@ApiOperation("班级管理--注册签到 id 班级id userName")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public void exportSignDetail(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{
classDetailDTO.setFlag(true);
......@@ -142,7 +143,7 @@ public class AdministerController {
@PostMapping("getMemberPapers")
@ApiOperation("获取某个成员某个卷子的做题历史 memberId paperId")
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getMemberPapers(@RequestBody ExerciseDoneResultDO exerciseDoneResultDO){
return ResponseData.generateCreatedResponse(0,administerService.getMemberPapers(exerciseDoneResultDO));
}
......@@ -181,12 +182,13 @@ public class AdministerController {
}
@PostMapping("exportClassDailyInfo")
@ApiParam("每日学习日志")
public void exportVodInfo(@RequestBody ClassDailyInfoDTO classDailyInfoDTO){
administerService.exportClassDailyInfo(classDailyInfoDTO);
}
@PostMapping("exportZip")
@ApiOperation("** 下载压缩包 id 班级id")
@ApiOperation("下载压缩包 id 班级id")
@CrossOrigin
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public void exportZip(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{
......
......@@ -36,7 +36,7 @@ public class ClassDictController {
private ClassDictService classDictService;
@PostMapping("getAllClasses")
@ApiOperation("获取某老师下的所有课程 ** companyId 所选企业id className 班级名称")
@ApiOperation("获取某老师下的所有课程 companyId 所选企业id className 班级名称")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getAllClasses(@RequestBody ClassDictDO classDictDO){
return ResponseData.generateCreatedResponse(0,classDictService.getAllClasses(classDictDO));
......@@ -78,8 +78,8 @@ public class ClassDictController {
}
@PostMapping("getSpareMembers")
@ApiOperation("获取不在某班级的某企业里所有成员 ** companyId 企业id classId 班级id")
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
@ApiOperation("获取不在某班级的某企业里所有成员 companyId 企业id classId 班级id")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getSpareMembers(@RequestBody GetSpareMembersDTO getSpareMembersDTO){
return ResponseData.generateCreatedResponse(0,classDictService.getSpareMembers(getSpareMembersDTO));
}
......@@ -91,7 +91,6 @@ public class ClassDictController {
return ResponseData.generateCreatedResponse(0,classDictService.addMemberToClass(addMemberToClassDTO));
}
@PostMapping("batchSms")
@ApiOperation(" 批量发送班级短信 {id 班级id}")
public ResponseVO batchSms(@RequestBody ClassDictDO classDictDO){
......
......@@ -33,14 +33,14 @@ public class ClassHourDictController {
private ClassHourDictService classHourDictService;
@PostMapping("getSetting")
@ApiOperation("** 查看当天设置的最大学习时长 companyId")
@ApiOperation("查看当天设置的最大学习时长 companyId")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getSetting(@RequestBody ClassHourDictDO classHourDictDO){
return ResponseData.generateCreatedResponse(0,classHourDictService.getSetting(classHourDictDO));
}
@PostMapping("updateSetting")
@ApiOperation("** 修改当天设置时长 id 主键 classHour status interrupt interruptStatus repeatTime repeatStatus")
@ApiOperation("修改当天设置时长 id 主键 classHour status interrupt interruptStatus repeatTime repeatStatus")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateSetting(@RequestBody ClassHourDictDO classHourDictDO){
return ResponseData.generateCreatedResponse(0,classHourDictService.updateSetting(classHourDictDO));
......
......@@ -34,28 +34,28 @@ public class CompanyDictController {
private CompanyDictService companyDictService;
@PostMapping("/administers")
@ApiOperation("** 查询所有企业 {id companyName pageNum pageSize }")
@ApiOperation("查询所有企业 {id companyName pageNum pageSize }")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO operators(@RequestBody OperatorsDTO operatorsDTO){
return ResponseData.generateCreatedResponse(0,companyDictService.operators(operatorsDTO));
}
@PostMapping("addCompany")
@ApiOperation("** 添加企业 {accountName:账号 companyName:企业名称 shortName 简称 banner:标语 field:领域 role 1:超级管理员 2:普通成员}")
@ApiOperation("添加企业 {accountName:账号 companyName:企业名称 shortName 简称 banner:标语 field:领域 role 1:超级管理员 2:普通成员}")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addOperator(@RequestBody AddCompanyDTO addCompanyDTO){
return ResponseData.generateCreatedResponse(0,companyDictService.addOperator(addCompanyDTO));
}
@PostMapping("deleteCompany")
@ApiOperation("** 删除企业 id")
@ApiOperation("删除企业 id")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO deleteAdminister(@RequestBody CompanyDictDO companyDictDO){
return ResponseData.generateCreatedResponse(0,companyDictService.deleteAdminister(companyDictDO));
}
@PostMapping("updateCompany")
@ApiOperation("** 修改企业 id accountName:账号 companyName:企业名称 shortName 简称 banner:标语 field:领域 role 1:超级管理员 2:普通成员")
@ApiOperation("修改企业 id accountName:账号 companyName:企业名称 shortName 简称 banner:标语 field:领域 role 1:超级管理员 2:普通成员")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateAdminister(@RequestBody AddCompanyDTO addCompanyDTO){
return ResponseData.generateCreatedResponse(0,companyDictService.updateAdminister(addCompanyDTO));
......
......@@ -32,28 +32,28 @@ public class CourseContentController {
private CourseContentService courseContentService;
@PostMapping("getContents")
@ApiOperation("** 获取课程目录 {courseId}")
@ApiOperation("获取课程目录 {courseId}")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getContents(@RequestBody CourseContentDO courseContentDO){
return ResponseData.generateCreatedResponse(0,courseContentService.getContents(courseContentDO));
}
@PostMapping("deleteContent")
@ApiOperation("** 删除一个目录 {id} ")
@ApiOperation("删除一个目录 {id} ")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO deleteContent(@RequestBody CourseContentDO courseContentDO){
return ResponseData.generateCreatedResponse(0,courseContentService.deleteContent(courseContentDO));
}
@PostMapping("addContent")
@ApiOperation("** 添加一个目录 {courseId content}")
@ApiOperation("添加一个目录 {courseId content}")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addContent(@RequestBody CourseContentDO courseContentDO){
return ResponseData.generateCreatedResponse(0,courseContentService.addContent(courseContentDO));
}
@PostMapping("updateContent")
@ApiOperation("** 更新一个目录 {id courseId content}")
@ApiOperation("更新一个目录 {id courseId content}")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateContent(@RequestBody CourseContentDO courseContentDO){
return ResponseData.generateCreatedResponse(0,courseContentService.updateContent(courseContentDO));
......
......@@ -33,14 +33,14 @@ public class CourseDictController {
private CourseDictService courseDictService;
@PostMapping("addCourse")
@ApiOperation("添加课程 **companyId courseName categoryId courseType courseSource")
@ApiOperation("添加课程 companyId courseName categoryId courseType courseSource")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addCourse(@RequestBody CourseDictDO courseDictDO){
return ResponseData.generateCreatedResponse(0,courseDictService.addCourse(courseDictDO));
}
@PostMapping("deleteCourse")
@ApiOperation("** 删除课程 id")
@ApiOperation("删除课程 id")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO deleteCourse(@RequestBody CourseDictDO courseDictDO){
return ResponseData.generateCreatedResponse(0,courseDictService.deleteCourse(courseDictDO));
......@@ -48,13 +48,13 @@ public class CourseDictController {
@PostMapping("queryCourses")
@ApiOperation("平台运营者--查询课程 pageSize pageNum administerId companyId courseName categoryId courseType courseSource")
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO queryCourses(@RequestBody QueryCoursesDTO queryCoursesDTO){
return ResponseData.generateCreatedResponse(0,courseDictService.queryCourses(queryCoursesDTO));
}
@PostMapping("updateCourses")
@ApiOperation("编辑课程 id ** companyId courseName categoryId courseType courseSource")
@ApiOperation("编辑课程 id companyId courseName categoryId courseType courseSource")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateCourses(@RequestBody CourseDictDO courseDictDO){
return ResponseData.generateCreatedResponse(0,courseDictService.updateCourses(courseDictDO));
......
......@@ -32,28 +32,28 @@ public class DepartmentDictController {
private DepartmentDictService departmentDictService;
@PostMapping("getDepartments")
@ApiOperation("** 获取所有部门 companyId 企业id")
@ApiOperation("获取所有部门 companyId 企业id")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getDepartments(@RequestBody DepartmentDictDO departmentDictDO){
return ResponseData.generateCreatedResponse(0,departmentDictService.getDepartments(departmentDictDO));
}
@PostMapping("addDepartment")
@ApiOperation("添加部门 ** companyId departmentName leaderName parentId 父节点")
@ApiOperation("添加部门 companyId departmentName leaderName parentId 父节点")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addDepartment(@RequestBody DepartmentDictDO departmentDictDO){
return ResponseData.generateCreatedResponse(0,departmentDictService.addDepartment(departmentDictDO));
}
@PostMapping("deleteDepartment")
@ApiOperation("** 删除部门 id")
@ApiOperation("删除部门 id")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO deleteDepartment(@RequestBody DepartmentDictDO departmentDictDO){
return ResponseData.generateCreatedResponse(0,departmentDictService.deleteDepartment(departmentDictDO));
}
@PostMapping("updateDepartment")
@ApiOperation("编辑部门 id ** companyId departmentName leaderName parentId")
@ApiOperation("编辑部门 id companyId departmentName leaderName parentId")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateDepartment(@RequestBody DepartmentDictDO departmentDictDO){
return ResponseData.generateCreatedResponse(0,departmentDictService.updateDepartment(departmentDictDO));
......
......@@ -35,13 +35,6 @@ public class ExerciseDictController {
@Autowired
private ExerciseDictService exerciseDictService;
@PostMapping("getAllExercises")
@ApiOperation("【弃用】 查询所有题目 {courseId 课程id exerciseType 题目类型 difficulty 难度 title 题目 pageSize pageNum}")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getAllExercises(@RequestBody GetAllExercisesDTO getAllExercisesDTO){
return ResponseData.generateCreatedResponse(0,exerciseDictService.getAllExercises(getAllExercisesDTO));
}
@PostMapping("addExercise")
@ApiOperation("添加题目 {paperId 试卷id courseId 课程id exerciseType 题目类型 difficulty 难度 title题目 items 选项 rightAnswer 正确答案 }")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
......@@ -63,14 +56,8 @@ public class ExerciseDictController {
return ResponseData.generateCreatedResponse(0,exerciseDictService.updateExercise(exerciseDictDO));
}
@PostMapping("getCourseExercises")
@ApiOperation("【废弃】获取课程的习题 id 课程id")
public ResponseVO getCourseExercises(@RequestBody CourseDictDO courseDictDO){
return ResponseData.generateCreatedResponse(0,exerciseDictService.getCourseExercises(courseDictDO));
}
@PostMapping("submit")
@ApiOperation("** 提交答案 {paperId 卷子id memberId 成员id classId课程 courseId 课程id memberExerciseVOS [ id selectAnswer ] length:做题时长} ")
@ApiOperation("提交答案 {paperId 卷子id memberId 成员id classId课程 courseId 课程id memberExerciseVOS [ id selectAnswer ] length:做题时长} ")
public ResponseVO submit(@RequestBody SubmitDTO submitDTO){
return ResponseData.generateCreatedResponse(0,exerciseDictService.submit(submitDTO));
}
......
......@@ -32,7 +32,7 @@ public class FileDictController {
private FileDictService fileDictService;
@PostMapping("getContendFiles")
@ApiOperation("** 获取目录下的视频 {contentId fileName}")
@ApiOperation("获取目录下的视频 {contentId fileName}")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getContendFiles(@RequestBody FileDictDO fileDictDO){
return ResponseData.generateCreatedResponse(0,fileDictService.getContendFiles(fileDictDO));
......
......@@ -79,7 +79,7 @@ public class MemberController {
}
@PostMapping("updatePassword")
@ApiOperation("** 修改密码 {id password}")
@ApiOperation("修改密码 {id password}")
public ResponseVO updatePassword(@RequestBody MemberDO memberDO){
return ResponseData.generateCreatedResponse(0,memberService.updatePassword(memberDO));
}
......@@ -103,7 +103,7 @@ public class MemberController {
}
@PostMapping("studyHistory")
@ApiOperation("** 学习记录 memberId 成员id pageSize pageNum")
@ApiOperation("学习记录 memberId 成员id pageSize pageNum")
public ResponseVO studyHistory(@RequestBody StudyHistoryDTO studyHistoryDTO){
return ResponseData.generateCreatedResponse(0,memberService.studyHistory(studyHistoryDTO));
}
......@@ -121,17 +121,11 @@ public class MemberController {
}
@PostMapping("getStudyInfo")
@ApiOperation("** 获取学生完成课程情况 id 学员id")
@ApiOperation("获取学生完成课程情况 id 学员id")
public ResponseVO getStudyInfo(@RequestBody MemberDO memberDO){
return ResponseData.generateCreatedResponse(0,memberService.getStudyInfo(memberDO));
}
//@PostMapping("getDoneResult")
//@ApiOperation("获取此次完成情况 id 提交接口返回的id")
//public ResponseVO getDoneResult(@RequestBody ExerciseDoneResultDO exerciseDoneResultDO){
// return ResponseData.generateCreatedResponse(0,memberService.getDoneResult(exerciseDoneResultDO));
//}
@PostMapping("checkTimes")
@ApiOperation("检测是否超过次数 memberId paperId classId")
public ResponseVO checkTimes(@RequestBody ExerciseDoneResultDO exerciseDoneResultDO){
......
......@@ -30,7 +30,7 @@ public class OprAdmDictController {
private OprAdmDictService oprAdmDictService;
@PostMapping("getHistory")
@ApiOperation("###获取后台用户审计 {pageSize pageNum userName startDate endDate}")
@ApiOperation("获取后台用户审计 {pageSize pageNum userName startDate endDate}")
public ResponseVO getHistory(@RequestBody GetHistoryDTO getHistoryDTO){
return ResponseData.generateCreatedResponse(0,oprAdmDictService.getHistory(getHistoryDTO));
}
......
......@@ -34,7 +34,7 @@ public class SignInRecordController {
private SignInRecordService signInRecordService;
@PostMapping("getMemberSignInfo")
@ApiOperation("###获取某个成员的签到记录 id 成员id pageSize pageNum")
@ApiOperation("获取某个成员的签到记录 id 成员id pageSize pageNum")
public ResponseVO getMemberSignInfo(@RequestBody GetMemberSignInfoDTO getMemberSignInfoDTO) {
return ResponseData.generateCreatedResponse(0, signInRecordService.getMemberSignInfo(getMemberSignInfoDTO));
}
......
......@@ -42,4 +42,10 @@ public class VodPlayHistoryController {
VodPlayHistoryDO vodPlayHistoryDO = JSON.parseObject(param,VodPlayHistoryDO.class);
return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.insertHistoryNew(vodPlayHistoryDO));
}
@PostMapping("dataFix")
public void dadaFix(){
vodPlayHistoryService.dataFix();
}
}
package com.subsidy.jobs;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.subsidy.mapper.OprAdmDictMapper;
import com.subsidy.mapper.OprMemDictMapper;
import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.model.OprAdmDictDO;
import com.subsidy.mongodb.OprAdmDictDO;
import com.subsidy.model.OprMemDictDO;
import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;
......@@ -41,6 +42,8 @@ public class Scheduler {
@Autowired
private RedisUtil redisUtil;
@Autowired
private MongoTemplate mongoTemplate;
/**
删除十天前登录记录(管理端)
*/
......@@ -49,45 +52,45 @@ public class Scheduler {
List<OprAdmDictDO> list = oprAdmDictMapper.getRecordByDate();
if(list != null) {
for (OprAdmDictDO oprAdmDictDO : list) {
oprAdmDictMapper.deleteById(oprAdmDictDO.getId());
//oprAdmDictMapper.deleteById(oprAdmDictDO.getId());
}
}
}
/**
* 删除十天前登录记录(学员)
*/
//@Scheduled(cron = "0 42 18 * * ?")
public void delOprMemRecord() {
List<OprMemDictDO> list = oprMemDictMapper.getRecordByDate();
if(list != null) {
for (OprMemDictDO oprMemDictDO : list) {
oprMemDictMapper.deleteById(oprMemDictDO.getId());
}
}
}
///**
// * 删除十天前登录记录(学员)
// */
////@Scheduled(cron = "0 42 18 * * ?")
//public void delOprMemRecord() {
// List<OprMemDictDO> list = oprMemDictMapper.getRecordByDate();
// if(list != null) {
// for (OprMemDictDO oprMemDictDO : list) {
// oprMemDictMapper.deleteById(oprMemDictDO.getId());
// }
// }
//}
/**
* 用户数据审计记录添加(学员)
*/
//@Scheduled(cron = "0 39 18 * * ?")
public void getOprMemRecord() {
Set<String> set = redisUtil.scan("*memberLogin*");
if(set != null) {
for (String str : set) {
int result = (Integer) redisUtil.get(str);
OprMemDictDO oprMemDictDO = new OprMemDictDO();
String [] opr = str.split("_");
LocalDateTime createDate = DateFormatUtil.secondToLocalDateTime(Long.valueOf(opr[3]));
oprMemDictDO.setResult(result);
oprMemDictDO.setOprType("登录");
oprMemDictDO.setUserId(Long.valueOf(opr[2]));
oprMemDictDO.setCreateDate(createDate);
oprMemDictMapper.insert(oprMemDictDO);
redisUtil.del(str);
}
}
}
///**
// * 用户数据审计记录添加(学员)
// */
////@Scheduled(cron = "0 39 18 * * ?")
//public void getOprMemRecord() {
// Set<String> set = redisUtil.scan("*memberLogin*");
// if(set != null) {
// for (String str : set) {
// int result = (Integer) redisUtil.get(str);
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// String [] opr = str.split("_");
// LocalDateTime createDate = DateFormatUtil.secondToLocalDateTime(Long.valueOf(opr[3]));
// oprMemDictDO.setResult(result);
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setUserId(Long.valueOf(opr[2]));
// oprMemDictDO.setCreateDate(createDate);
// oprMemDictMapper.insert(oprMemDictDO);
// redisUtil.del(str);
// }
// }
//}
/**
* 视频播放记录缩量
......@@ -106,4 +109,5 @@ public class Scheduler {
vodPlayHistoryMapper.insert(vodPlayHistoryDO);
}
}
}
......@@ -24,7 +24,7 @@ public interface CourseContentMapper extends BaseMapper<CourseContentDO> {
/**
* 查看课程下有多少个视频
*/
List<VodDictDO> getCourseVods(Integer courseId);
List<VodDictDO> getCourseVods(Long courseId);
/**
* 查看某个目录下 某个成员看视频的进度
......@@ -36,4 +36,5 @@ public interface CourseContentMapper extends BaseMapper<CourseContentDO> {
*/
List<FileDictDO> contentFiles(Long courseId);
Integer selectMaxOrderNo(Long courseId);
}
......@@ -14,14 +14,16 @@ import org.springframework.stereotype.Repository;
* @author DengMin
* @since 2021-10-12
*/
@Repository
@Repository
public interface ExerciseDictMapper extends BaseMapper<ExerciseDictDO> {
/**
* 获取某一套卷子的题目
*/
IPage<GetPaperExerciseVO> getPaperExercise(IPage page,Long paperId,String difficulty,String exerciseType,String title);
IPage<GetPaperExerciseVO> getPaperExercise(IPage page, Long paperId, String difficulty, String exerciseType, String title);
/**
* 获取某个卷子的最大排序号
*/
Integer getMaximumNo(Long paperId);
}
package com.subsidy.mapper;
import com.subsidy.model.ExerciseDoneResultDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.vo.administer.GetMemberPapersVO;
import com.subsidy.vo.administer.GetPaperDetailVO;
import com.subsidy.vo.done.GetMaxScoreVO;
import com.subsidy.vo.done.TestScoreInfoVO;
import com.subsidy.vo.exercise.GetDoneDetailVO;
import org.springframework.stereotype.Repository;
......@@ -42,6 +43,18 @@ public interface ExerciseDoneResultMapper extends BaseMapper<ExerciseDoneResultD
*/
List<GetMaxScoreVO> getMaxScore(Long classId, Long memberId);
/**
* 查看某个人某个卷子完成的最好成绩
*/
ExerciseDoneResultDO getMaxScorePaper(Long paperId,Long memberId);
/**
* 测试成绩 最高成绩 测试测试 总评价
*/
TestScoreInfoVO testScoreInfo(Long paperId, Long memberId);
/**
* 汇总 查看课程通过情况
*/
Integer getClassTestPassRate(Long classId);
}
......@@ -4,6 +4,8 @@ import com.subsidy.model.FileDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* 课件表 Mapper 接口
......@@ -15,4 +17,6 @@ import org.springframework.stereotype.Repository;
@Repository
public interface FileDictMapper extends BaseMapper<FileDictDO> {
List<FileDictDO> selectFiles(Long contentId,String fileName);
}
package com.subsidy.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.model.OprAdmDictDO;
import com.subsidy.mongodb.OprAdmDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.vo.opr.GetHistoryVO;
import org.springframework.stereotype.Repository;
......
......@@ -66,6 +66,14 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
*/
List<MemberStudyLogVO> memberStudyLog(Long classId, Long memberId);
/**
* 查看某个人的学习累计时长
*/
Integer memberTotalLength(Long memberId);
/**
* 查看某个人某个视频的累计时长
*/
Integer memberVodTotalLength(Long memberId,Long vodId);
}
package com.subsidy.model;
import lombok.Data;
@Data
public class Collection {
private String _id;
private String name;
}
......@@ -16,14 +16,9 @@ import lombok.EqualsAndHashCode;
* @since 2021-12-13
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("opr_mem_dict")
public class OprMemDictDO extends BaseModel {
public class OprMemDictDO {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
private String _id;
/**
* 用户id
......@@ -40,4 +35,13 @@ public class OprMemDictDO extends BaseModel {
*/
private Integer result;
/**
* 登录时间
*/
private String loginDateFormat;
/**
* 创建时间
*/
private String createDate;
}
......@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
/**
* <p>
* 视频播放历史记录表
......@@ -55,5 +57,7 @@ public class VodPlayHistoryDO extends BaseModel {
*/
private Integer playCount;
private LocalDateTime playDate;
}
package com.subsidy.mongodb;
import com.subsidy.util.MongoUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/mango")
public class MongoController {
@Autowired
private MongoTemplate mongoTemplate;
@Autowired
private MongoUtil mongoUtil;
@PostMapping("getOne")
public void getAll(){
////Query query=new Query();
////MongoDO user = mongoTemplate.getDb(query , MongoDO.class);
////List<MongoDO> mongo= mongoTemplate.findAll(MongoDO.class);
////System.out.println(mongo);
//System.out.println(mongoTemplate.getDb().getName());
//
//Collection mongoDO = mongoTemplate.findById("61de944c5cdc5e3f896c95c7", Collection.class);
//System.out.println(mongoDO);
//
//List<Collection> collections = mongoTemplate.findAll(Collection.class);
//System.out.println(collections);
//
//Query query = new Query(Criteria.where("name").regex("张"));//可累加条件
//List<Collection> entrY = mongoTemplate.find(query,Collection.class);
//System.out.println(entrY);
//添加
//Collection collection = new Collection();
//collection.setName("bbbbbbbb");
//collection.set_id("61de944c5cdc5e3f896c95c7");
//mongoTemplate.save(collection,"collection");
//for (int i = 0 ; i < 100; i++){
// Collection collection1 = new Collection();
// collection1.setName("aaaa"+i);
// mongoTemplate.save(collection1);
//}
//Query query =new Query(new Criteria());
//query.with(Sort.by("name"));
////mongoUtil.start(1,5,query);
//List<Collection> collections = mongoTemplate.find(query,Collection.class);
//for (Collection collection : collections){
// System.out.println(collection+"=========");
//}
//OprAdmDictDO oprAdmDictDO = new OprAdmDictDO();
//oprAdmDictDO.setUserId(1L);
//oprAdmDictDO.setResult(1);
//oprAdmDictDO.setOprType("登录成功");
//mongoTemplate.save(oprAdmDictDO);
}
}
package com.subsidy.model;
package com.subsidy.mongodb;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.omg.CosNaming.NamingContextExtPackage.StringNameHelper;
/**
* <p>
......@@ -16,14 +17,9 @@ import lombok.EqualsAndHashCode;
* @since 2021-12-13
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("opr_adm_dict")
public class OprAdmDictDO extends BaseModel {
public class OprAdmDictDO {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
private String _id;
/**
* 用户id
......@@ -31,6 +27,16 @@ public class OprAdmDictDO extends BaseModel {
private Long userId;
/**
* 公司id
*/
private Long companyId;
/**
* 名字
*/
private String userName;
/**
* 操作类型
*/
private String oprType;
......@@ -40,4 +46,14 @@ public class OprAdmDictDO extends BaseModel {
*/
private Integer result;
/**
* 登录时间
*/
private String loginDateFormat;
/**
* 创建时间
*/
private String createDate;
}
package com.subsidy.mongodb;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.Data;
import java.util.List;
@Data
public class PageVO<T> {
/**
* 分页记录列表
*
* @return 分页对象记录列表
*/
private List<T> records;
/**
* 设置当前满足条件总行数
*/
private long total;
}
......@@ -21,16 +21,12 @@ import java.util.List;
*/
public interface ExerciseDictService extends IService<ExerciseDictDO> {
IPage<ExerciseDictDO> getAllExercises(GetAllExercisesDTO getAllExercisesDTO);
String addExercise(ExerciseDictDO exerciseDictDO);
String deleteExercise(ExerciseDictDO exerciseDictDO);
String updateExercise(ExerciseDictDO exerciseDictDO);
List<ExerciseVO> getCourseExercises(CourseDictDO courseDictDO);
Long submit(SubmitDTO submitDTO);
IPage getPaperExercise(GetPaperExerciseDTO getPaperExerciseDTO);
......
......@@ -60,8 +60,6 @@ public interface MemberService extends IService<MemberDO> {
GetStudyInfoVO getStudyInfo(MemberDO memberDO);
ExerciseDoneResultDO getDoneResult(ExerciseDoneResultDO exerciseDoneResultDO);
String checkTimes(ExerciseDoneResultDO exerciseDoneResultDO);
void importRedis();
......
......@@ -2,8 +2,9 @@ package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.dto.opr.GetHistoryDTO;
import com.subsidy.model.OprAdmDictDO;
import com.subsidy.mongodb.OprAdmDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.mongodb.PageVO;
import com.subsidy.vo.opr.GetHistoryVO;
/**
......@@ -16,6 +17,6 @@ import com.subsidy.vo.opr.GetHistoryVO;
*/
public interface OprAdmDictService extends IService<OprAdmDictDO> {
IPage<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO);
PageVO<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO);
}
......@@ -16,4 +16,6 @@ public interface VodPlayHistoryService extends IService<VodPlayHistoryDO> {
String insertHistory(VodPlayHistoryDO vodPlayHistoryDO);
String insertHistoryNew(VodPlayHistoryDO vodPlayHistoryDO);
void dataFix();
}
......@@ -29,19 +29,16 @@ 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;
......
......@@ -56,11 +56,9 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, CategoryDO>
}
}
@Async
public String addCategory(CategoryDO categoryDO) {
int count = 0;
int count;
if (null == categoryDO.getCompanyId()) {
count = this.baseMapper.selectCount(new QueryWrapper<CategoryDO>()
......@@ -82,20 +80,20 @@ 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>()
.lambda()
.eq(CategoryDO::getName, categoryDO.getName()));
.eq(CategoryDO::getName, categoryDO.getName())
.eq(CategoryDO::getCompanyId, categoryDO.getCompanyId())
.ne(CategoryDO::getId, categoryDO.getId()));
if (count > 2) {
if (count > 0) {
throw new HttpException(90001);
}
......
......@@ -57,7 +57,6 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
}
@Transactional
@Async
public String deleteClasses(ClassDictDO classDictDO) {
this.baseMapper.deleteById(classDictDO.getId());
......@@ -67,7 +66,6 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
return ConstantUtils.DELETE_SUCCESS;
}
@Async
public String addClass(AddClassDTO addClassDTO) {
//查看当前登录人的角色
......@@ -79,17 +77,12 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
ClassDictDO classDictDO = new ClassDictDO();
BeanUtils.copyProperties(addClassDTO,classDictDO);
if (count>0){
classDictDO.setClassType("平台支持");
}else{
classDictDO.setClassType("企业自建");
}
classDictDO.setClassType(count>0?"平台支持":"企业自建");
this.baseMapper.insert(classDictDO);
return ConstantUtils.ADD_SUCCESS;
}
@Async
public String updateClass(ClassDictDO classDictDO) {
this.baseMapper.updateById(classDictDO);
return ConstantUtils.SET_SUCCESS;
......@@ -99,7 +92,6 @@ 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()
......@@ -125,7 +117,6 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
return ConstantUtils.ADD_SUCCESS;
}
@Async
public String batchSms(ClassDictDO classDictDO){
ClassDictDO classDictDO1 = this.baseMapper.selectById(classDictDO.getId());
......
......@@ -79,7 +79,7 @@ public class ClassHourDictServiceImpl extends ServiceImpl<ClassHourDictMapper, C
if (classHourDictDO == null) {
pollingGetVO.setBool(true);
} else {
if (total + vodPlayHistoryDO.getPlayLength() <= classHourDictDO.getClassHour() * 60 * 60) {
if (total + vodPlayHistoryDO.getPlayLength() <= classHourDictDO.getClassHour() * 3600) {
pollingGetVO.setBool(false);
} else {
pollingGetVO.setBool(true);
......
......@@ -59,14 +59,15 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
//判断该用户的角色
Integer count = roleAdministerMappingMapper.selectCount(new QueryWrapper<RoleAdministerMappingDO>()
.lambda()
.eq(RoleAdministerMappingDO::getAdministerId,operatorsDTO.getId())
.eq(RoleAdministerMappingDO::getRoleId,1));
.eq(RoleAdministerMappingDO::getAdministerId, operatorsDTO.getId())
.eq(RoleAdministerMappingDO::getRoleId, 1));
if (count > 0){
if (count > 0) {
//后台管理员
operatorsDTO.setId(null);
}
return this.baseMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getId(),operatorsDTO.getUserName(),1);
return this.baseMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getId(), operatorsDTO.getUserName(), 1);
}
public String addOperator(AddCompanyDTO addCompanyDTO) {
......@@ -75,16 +76,20 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
.lambda()
.eq(CompanyDictDO::getCompanyName, addCompanyDTO.getAccountName()));
if (count > 0 ) {
throw new HttpException(20002);
}
Integer count1 = administerMapper.selectCount(new QueryWrapper<AdministerDO>()
.lambda()
.eq(AdministerDO::getAccountName, addCompanyDTO.getAccountName()));
if (count > 0 || count1>0) {
if (count1 > 0) {
throw new HttpException(20002);
}
CompanyDictDO companyDictDO =new CompanyDictDO();
BeanUtils.copyProperties(addCompanyDTO,companyDictDO);
CompanyDictDO companyDictDO = new CompanyDictDO();
BeanUtils.copyProperties(addCompanyDTO, companyDictDO);
this.baseMapper.insert(companyDictDO);
AdministerDO administerDO = new AdministerDO();
......@@ -108,7 +113,6 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
departmentDictMapper.insert(departmentDictDO);
//class_hour_dict
ClassHourDictDO classHourDictDO2 = new ClassHourDictDO();
classHourDictDO2.setCompanyId(companyDictDO.getId());
classHourDictDO2.setStatus(0);
......@@ -119,46 +123,44 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
classHourDictDO2.setRepeatStatus(0);
classHourDictDO2.setRepeatTime(3);
redisUtil.set(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX +companyDictDO.getId(),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());
administerMapper.delete(new QueryWrapper<AdministerDO>()
.lambda()
.eq(AdministerDO::getCompanyId,companyDictDO.getId()));
.eq(AdministerDO::getCompanyId, companyDictDO.getId()));
redisUtil.del(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX+companyDictDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
@Async
public String updateAdminister(AddCompanyDTO addCompanyDTO) {
CompanyDictDO companyDictDO = new CompanyDictDO();
BeanUtils.copyProperties(addCompanyDTO,companyDictDO);
BeanUtils.copyProperties(addCompanyDTO, companyDictDO);
this.baseMapper.updateById(companyDictDO);
//查找企业管理员
AdministerDO administerDO = administerMapper.selectOne(new QueryWrapper<AdministerDO>()
.lambda()
.eq(AdministerDO::getCompanyId,addCompanyDTO.getId())
.eq(AdministerDO::getRole,1));
if (StringUtils.isNotBlank(addCompanyDTO.getAccountName())){
.eq(AdministerDO::getCompanyId, addCompanyDTO.getId())
.eq(AdministerDO::getRole, 1));
if (StringUtils.isNotBlank(addCompanyDTO.getAccountName())) {
administerDO.setAccountName(addCompanyDTO.getAccountName());
}
if (StringUtils.isBlank(addCompanyDTO.getPassword())){
if (StringUtils.isBlank(addCompanyDTO.getPassword())) {
addCompanyDTO.setPassword(addCompanyDTO.getPassword());
}
administerMapper.updateById(administerDO);
return ConstantUtils.SET_SUCCESS;
}
public List<GetAllCompanyVO> getAllCompany(CompanyDictDO companyDictDO){
public List<GetAllCompanyVO> getAllCompany(CompanyDictDO companyDictDO) {
return this.baseMapper.getAllCompany(companyDictDO);
}
......
......@@ -31,39 +31,34 @@ 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>()
.lambda()
.eq(CourseContentDO::getCourseId,courseContentDO.getCourseId())
.orderByDesc(CourseContentDO::getOrderNo));
Integer orderNoTmp = this.baseMapper.selectMaxOrderNo(courseContentDO.getCourseId());
int orderNo = 1 ;
if (courseContentDOS.size()>0){
orderNo = courseContentDOS.get(0).getOrderNo()+1;
if (null!=orderNoTmp){
orderNo = orderNoTmp+1;
}
courseContentDO.setOrderNo(orderNo);
this.baseMapper.insert(courseContentDO);
return ConstantUtils.ADD_SUCCESS;
}
@Async
public String updateContent(CourseContentDO courseContentDO){
List<CourseContentDO> courseContentDOS = this.baseMapper.selectList(new QueryWrapper<CourseContentDO>()
int count = this.baseMapper.selectCount(new QueryWrapper<CourseContentDO>()
.lambda()
.eq(CourseContentDO::getCourseId,courseContentDO.getCourseId())
.eq(CourseContentDO::getContent,courseContentDO.getContent()));
.eq(CourseContentDO::getContent,courseContentDO.getContent())
.ne(CourseContentDO::getId,courseContentDO.getId()));
if (courseContentDOS.size()>0){
if (count>0){
throw new HttpException(40001);
}
this.baseMapper.updateById(courseContentDO);
......
......@@ -30,10 +30,9 @@ public class CourseDictServiceImpl extends ServiceImpl<CourseDictMapper, CourseD
@Autowired
private RoleAdministerMappingMapper roleAdministerMappingMapper;
@Async
public String addCourse(CourseDictDO courseDictDO) {
int count = 0;
int count;
if (null != courseDictDO.getCompanyId()) {
count = this.baseMapper.selectCount(new QueryWrapper<CourseDictDO>()
......@@ -56,7 +55,6 @@ 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;
......@@ -72,6 +70,7 @@ public class CourseDictServiceImpl extends ServiceImpl<CourseDictMapper, CourseD
.eq(RoleAdministerMappingDO::getRoleId,1));
if (count > 0){
//后台管理员
queryCoursesDTO.setCompanyId(null);
}
......@@ -80,7 +79,7 @@ public class CourseDictServiceImpl extends ServiceImpl<CourseDictMapper, CourseD
@Async
public String updateCourses(CourseDictDO courseDictDO) {
int count = 0;
int count;
if (null != courseDictDO.getCompanyId()) {
count = this.baseMapper.selectCount(new QueryWrapper<CourseDictDO>()
......
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.dto.exercise.GetAllExercisesDTO;
import com.subsidy.dto.exercise.GetPaperExerciseDTO;
import com.subsidy.dto.exercise.SubmitDTO;
import com.subsidy.mapper.ExerciseDictMapper;
import com.subsidy.mapper.ExerciseDoneHistoryMapper;
import com.subsidy.mapper.ExerciseDoneResultMapper;
import com.subsidy.model.CourseDictDO;
import com.subsidy.model.ExerciseDictDO;
import com.subsidy.model.ExerciseDoneHistoryDO;
import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.service.ExerciseDictService;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.MathUtil;
import com.subsidy.vo.course.ExerciseVO;
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;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -46,67 +39,31 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe
@Autowired
private ExerciseDoneHistoryMapper exerciseDoneHistoryMapper;
public IPage<ExerciseDictDO> getAllExercises(GetAllExercisesDTO getAllExercisesDTO) {
Page pager = new Page(getAllExercisesDTO.getPageNum(), getAllExercisesDTO.getPageSize());
return this.baseMapper.selectPage(pager, new QueryWrapper<ExerciseDictDO>()
.lambda()
.eq(ExerciseDictDO::getCourseId, getAllExercisesDTO.getCourseId())
.like(ExerciseDictDO::getDifficulty, getAllExercisesDTO.getDifficulty())
.like(ExerciseDictDO::getExerciseType, getAllExercisesDTO.getExerciseType())
.like(ExerciseDictDO::getTitle, getAllExercisesDTO.getTitle())
.orderByAsc(ExerciseDictDO::getOrderNo));
}
@Async
public String addExercise(ExerciseDictDO exerciseDictDO){
List<ExerciseDictDO> exerciseDictDOS = this.baseMapper.selectList(new QueryWrapper<ExerciseDictDO>()
.lambda()
.eq(ExerciseDictDO::getCourseId,exerciseDictDO.getCourseId())
.orderByDesc(ExerciseDictDO::getOrderNo));
Integer orderNoTmp = this.baseMapper.getMaximumNo(exerciseDictDO.getPaperId());
int orderNo = 1;
if (exerciseDictDOS.size() > 0) {
orderNo = exerciseDictDOS.get(0).getOrderNo() + 1;
if (null!= orderNoTmp) {
orderNo = orderNoTmp + 1;
}
exerciseDictDO.setOrderNo(orderNo);
this.baseMapper.insert(exerciseDictDO);
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;
}
public List<ExerciseVO> getCourseExercises(CourseDictDO courseDictDO) {
List<ExerciseVO> exerciseVOS = new ArrayList<>();
List<ExerciseDictDO> exerciseDictDOS = this.baseMapper.selectList(new QueryWrapper<ExerciseDictDO>()
.lambda()
.eq(ExerciseDictDO::getCourseId, courseDictDO.getId()));
for (ExerciseDictDO exerciseDictDO : exerciseDictDOS) {
ExerciseVO exerciseVO = new ExerciseVO();
BeanUtils.copyProperties(exerciseDictDO, exerciseVO);
exerciseVOS.add(exerciseVO);
}
return exerciseVOS;
}
@Transactional(rollbackFor = Exception.class)
@Async
public Long submit(SubmitDTO submitDTO) {
ExerciseDoneResultDO exerciseDoneResultDO = new ExerciseDoneResultDO();
......@@ -134,11 +91,7 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe
exerciseDoneResultDO.setLength(submitDTO.getLength());
int score = MathUtil.intDivFloorPercent(rightCounts, memberExerciseVOS.size());
exerciseDoneResultDO.setScore(score);
if (score >= 60) {
exerciseDoneResultDO.setResult("合格");
} else {
exerciseDoneResultDO.setResult("不合格");
}
exerciseDoneResultDO.setResult(score>=60?"合格":"不合格");
exerciseDoneResultMapper.insert(exerciseDoneResultDO);
......
......@@ -78,12 +78,6 @@ public class ExerciseDoneResultServiceImpl extends ServiceImpl<ExerciseDoneResul
exerciseDoneHistoryMapper.insert(ex);
}
// SignInRecordDO signInRecordDO = new SignInRecordDO();
// signInRecordDO.setClassId(s.getClassId());
// signInRecordDO.setMemberId(s.getMemberId());
// signInRecordDO.setCreateDate(LocalDateTime.parse(s.getSignInDate().replace("2021-12-17","2021-12-26"),df));
// signInRecordDO.setSignInDate(LocalDateTime.parse(s.getSignInDate().replace("2021-12-17","2021-12-26"),df));
});
}catch (Exception ex){
ex.printStackTrace();
......
......@@ -23,25 +23,19 @@ import java.util.List;
public class FileDictServiceImpl extends ServiceImpl<FileDictMapper, FileDictDO> implements FileDictService {
public List<FileDictDO> getContendFiles(FileDictDO fileDictDO) {
return this.baseMapper.selectList(new QueryWrapper<FileDictDO>()
.lambda()
.eq(FileDictDO::getContentId,fileDictDO.getContentId())
.like(FileDictDO::getFileName,fileDictDO.getFileName()));
return this.baseMapper.selectFiles(fileDictDO.getContentId(),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;
......
......@@ -3,13 +3,27 @@ package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subsidy.dto.opr.GetHistoryDTO;
import com.subsidy.model.OprAdmDictDO;
import com.subsidy.mapper.AdministerMapper;
import com.subsidy.mapper.CompanyDictMapper;
import com.subsidy.model.AdministerDO;
import com.subsidy.model.CompanyDictDO;
import com.subsidy.mongodb.OprAdmDictDO;
import com.subsidy.mapper.OprAdmDictMapper;
import com.subsidy.mongodb.PageVO;
import com.subsidy.service.OprAdmDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.MongoUtil;
import com.subsidy.vo.opr.GetHistoryVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 审计表 服务实现类
......@@ -21,10 +35,44 @@ import org.springframework.stereotype.Service;
@Service
public class OprAdmDictServiceImpl extends ServiceImpl<OprAdmDictMapper, OprAdmDictDO> implements OprAdmDictService {
@Autowired
private MongoTemplate mongoTemplate;
@Autowired
private MongoUtil mongoUtil;
@Autowired
private AdministerMapper administerMapper;
@Autowired
private CompanyDictMapper companyDictMapper;
public PageVO<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO){
PageVO pageVO = new PageVO();
List<GetHistoryVO> getHistoryVOS = new ArrayList<>();
//可累加条件
Query query = new Query(Criteria.where("userName").regex(getHistoryDTO.getUserName())
.and("loginDateFormat").gte(getHistoryDTO.getStartDate())
.and("loginDateFormat").lte(getHistoryDTO.getEndDate()));
Long count = mongoTemplate.count(query,OprAdmDictDO.class);
mongoUtil.start(getHistoryDTO.getPageNum(),getHistoryDTO.getPageSize(),query);
List<OprAdmDictDO> oprAdmDictDOS = mongoTemplate.find(query,OprAdmDictDO.class);
for (OprAdmDictDO oprAdmDictDO : oprAdmDictDOS){
AdministerDO administerDO = administerMapper.selectById(oprAdmDictDO.getUserId());
CompanyDictDO companyDictDO = companyDictMapper.selectById(administerDO.getCompanyId());
GetHistoryVO getHistoryVO = new GetHistoryVO();
BeanUtils.copyProperties(oprAdmDictDO,getHistoryVO);
getHistoryVO.setCompanyName(companyDictDO.getCompanyName());
getHistoryVO.setUserName(administerDO.getUserName());
getHistoryVOS.add(getHistoryVO);
}
pageVO.setRecords(getHistoryVOS);
pageVO.setTotal(count);
public IPage<GetHistoryVO> getHistory(GetHistoryDTO getHistoryDTO){
Page pager = new Page(getHistoryDTO.getPageNum(), getHistoryDTO.getPageSize());
return this.baseMapper.getHistory(pager,getHistoryDTO.getUserName(),getHistoryDTO.getStartDate(),getHistoryDTO.getEndDate());
return pageVO;
}
}
......@@ -9,31 +9,29 @@ import com.subsidy.dto.member.GetMemberSignInfoDTO;
import com.subsidy.dto.sign.ClassSignInfoDTO;
import com.subsidy.mapper.ClassHourDictMapper;
import com.subsidy.mapper.ClassMemberMappingMapper;
import com.subsidy.mapper.MemberMapper;
import com.subsidy.mapper.SignInRecordMapper;
import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.model.ClassDictDO;
import com.subsidy.model.ClassHourDictDO;
import com.subsidy.model.MemberDO;
import com.subsidy.model.SignInRecordDO;
import com.subsidy.model.VodDictDO;
import com.subsidy.service.SignInRecordService;
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.GetMemberSignInfoVO;
import com.subsidy.vo.member.StudyPageVO;
import com.subsidy.vo.sign.ClassSignInfoVO;
import com.subsidy.vo.sign.SignInStatusVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
/**
* <p>
......@@ -56,6 +54,9 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
private RedisUtil redisUtil;
@Autowired
private MemberMapper memberMapper;
@Autowired
private ClassHourDictMapper classHourDictMapper;
public IPage<GetMemberSignInfoVO> getMemberSignInfo(GetMemberSignInfoDTO getMemberSignInfoDTO) {
......@@ -73,7 +74,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
List<ClassDictDO> classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId());
for (ClassDictDO classDictDO : classDictDOS) {
redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId_" + signInRecordDO.getMemberId() + "_classId_" + 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);
}
return ConstantUtils.ADD_SUCCESS;
......@@ -88,24 +89,21 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
final ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
newCachedThreadPool.shutdown();
for (ClassSignInfoVO classSignInfoVO : classSignInfoVOS) {
newCachedThreadPool.submit(()->classSignInfoTask(classSignInfoVO));
newCachedThreadPool.execute(()->classSignInfoTask(classSignInfoVO));
}
newCachedThreadPool.shutdown();
classSignInfoVOIPage.setRecords(classSignInfoVOS);
return classSignInfoVOIPage;
}
public Future<ClassSignInfoVO> classSignInfoTask(ClassSignInfoVO classSignInfoVO){
public void classSignInfoTask(ClassSignInfoVO classSignInfoVO){
ClassSignInfoVO classSignInfoVO1 = vodPlayHistoryMapper.classStudyHistory(classSignInfoVO.getClassId());
BeanUtils.copyProperties(classSignInfoVO1,classSignInfoVO);
//平均签到数 向下取整
long signCount = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "*_classId_" + classSignInfoVO.getClassId() + "_*").stream().count();
long signCount = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "*:classId:" + classSignInfoVO.getClassId() + ":*").stream().count();
classSignInfoVO.setAvgSignCount(MathUtil.intDivCeil(signCount, classSignInfoVO1.getMemberCount()));
return new AsyncResult<>(classSignInfoVO);
}
public SignInStatusVO signInStatus(SignInRecordDO signInRecordDO) {
......@@ -113,10 +111,10 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
SignInStatusVO signInStatusVO = new SignInStatusVO();
Boolean flag = true; // 已经签过到了
signInStatusVO.setStatus(flag);
//获取有效课程
long count = classMemberMappingMapper.getMemberClassCount(signInRecordDO.getMemberId());
long size = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId_" + signInRecordDO.getMemberId() + "*_" + DateFormatUtil.format(new Date(), "yyyyMMdd")+"*").stream().count();
long size = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId:" + signInRecordDO.getMemberId() + "*:" + DateFormatUtil.format(new Date(), "yyyyMMdd")+"*").stream().count();
if (size != count) {
signInStatusVO.setStatus(flag);
......@@ -136,13 +134,13 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
//预写公司设置数据
List<ClassHourDictDO> classHourDictDOS = classHourDictMapper.selectList(null);
for (ClassHourDictDO classHourDictDO : classHourDictDOS) {
redisUtil.set("subsidySettings_" + classHourDictDO.getCompanyId(), classHourDictDO);
redisUtil.set("subsidySettings:" + classHourDictDO.getCompanyId(), classHourDictDO);
}
//预写学生账号数据
//List<MemberDO> memberDOS = memberMapper.selectList(null);
//for (MemberDO memberDO : memberDOS){
// redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX+memberDO.getCompanyId()+"_"+memberDO.getAccountName(),memberDO);
// redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX+memberDO.getCompanyId()+":"+memberDO.getAccountName(),memberDO);
//}
}
......
package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.subsidy.mapper.ClassDictMapper;
import com.subsidy.mapper.ClassMemberMappingMapper;
import com.subsidy.mapper.CourseContentMapper;
import com.subsidy.mapper.SignInRecordMapper;
import com.subsidy.model.ClassDictDO;
import com.subsidy.model.ClassMemberMappingDO;
import com.subsidy.model.SignInRecordDO;
import com.subsidy.model.VodDictDO;
import com.subsidy.model.VodPlayHistoryDO;
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.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.Arrays;
import java.util.List;
import java.util.Random;
/**
* <p>
* 视频播放历史记录表 服务实现类
......@@ -19,18 +35,104 @@ import org.springframework.stereotype.Service;
@Service
public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, VodPlayHistoryDO> implements VodPlayHistoryService {
@Async
@Autowired
private ClassMemberMappingMapper classMemberMappingMapper;
@Autowired
private ClassDictMapper classDictMapper;
@Autowired
private CourseContentMapper courseContentMapper;
@Autowired
private SignInRecordMapper signInRecordMapper;
@Autowired
private VodPlayHistoryMapper vodPlayHistoryMapper;
public String insertHistory(VodPlayHistoryDO vodPlayHistoryDO) {
vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO);
return ConstantUtils.ADD_SUCCESS;
}
@Async
public String insertHistoryNew(VodPlayHistoryDO vodPlayHistoryDO){
public String insertHistoryNew(VodPlayHistoryDO vodPlayHistoryDO) {
vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO);
return ConstantUtils.ADD_SUCCESS;
}
public void dataFix() {
//班级ids
List<String> classIds = Arrays.asList(new String[]{"28"});
for (String str : classIds) {
ClassDictDO classDictDO = classDictMapper.selectById(str);
//找到班级里的学生
List<ClassMemberMappingDO> classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper<ClassMemberMappingDO>()
.lambda()
.eq(ClassMemberMappingDO::getClassId, Long.valueOf(str)));
//查找课程里的所有视频
List<VodDictDO> vodDictDOS = courseContentMapper.getCourseVods(classDictDO.getCourseId());
//遍历班级学生
for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) {
//查询这个人 这节课 排序
List<SignInRecordDO> signInRecordDOS = signInRecordMapper.selectList(new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getMemberId, classMemberMappingDO.getMemberId())
.eq(SignInRecordDO::getClassId, str)
.orderByAsc(SignInRecordDO::getSignInDate));
//根据签到时间,对学生学习的课程做插入操作
for (SignInRecordDO signInRecordDO : signInRecordDOS) {
LocalDateTime signInDate = signInRecordDO.getSignInDate();
if (signInDate.getHour() <= 15 && signInDate.getHour() >= 6) {
Random random = new Random();
int totalDailyLength = random.nextInt(4);
//查找这个人应该学的课程
for (VodDictDO vodDictDO : vodDictDOS) {
//从历史记录里找中这个人有没有学过
if (totalDailyLength<=7*60*60){
Integer count = vodPlayHistoryMapper.selectCount(new QueryWrapper<VodPlayHistoryDO>()
.lambda()
.eq(VodPlayHistoryDO::getMemberId, classMemberMappingDO.getMemberId())
.eq(VodPlayHistoryDO::getClassId, str)
.eq(VodPlayHistoryDO::getVodId, vodDictDO.getId()));
if (count == 0 && signInDate.plusSeconds(totalDailyLength).getHour() < 23) {
totalDailyLength+=vodDictDO.getVodLength();
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
vodPlayHistoryDO.setPlayCount(1);
vodPlayHistoryDO.setClassId(Long.valueOf(str));
vodPlayHistoryDO.setMemberId(classMemberMappingDO.getMemberId());
vodPlayHistoryDO.setPlayRecord(vodDictDO.getVodLength());
vodPlayHistoryDO.setPlayLength(vodDictDO.getVodLength());
vodPlayHistoryDO.setVodId(vodDictDO.getId());
vodPlayHistoryDO.setPlayDate(signInDate.plusSeconds(totalDailyLength));
//vodPlayHistoryDO.setCreateDate(signInDate.plusSeconds(totalDailyLength));
vodPlayHistoryMapper.insert(vodPlayHistoryDO);
Random random1 = new Random();
totalDailyLength+=random1.nextInt(5);
}
}
}
}
}
}
}
}
public static void main(String[] args) {
Random random = new Random();
System.out.println();
}
}
......@@ -52,8 +52,6 @@ public class ConstantUtils {
public static final String COMPRESS_SUCCESS = "压缩成功";
public static final String SCHOOL = "上海市市西中学";
public static final String CHECK_STATUS = "审核通过";
/**
......
......@@ -14,6 +14,6 @@ public class ExcelFormatUtils {
public static final List<String> answersList = Arrays.asList("序号", "提问", "答疑", "提问时间", "提问成员", "答疑时间");
public static final List<String> studyLogList = Arrays.asList("开始时间","结束时间","操作对象","类型","平台","学习时长","有效时长");
public static final List<String> studyLogList = Arrays.asList("开始时间","结束时间","操作对象","类型","平台","学习时长","累计有效时长");
}
......@@ -137,17 +137,17 @@ public class MathUtil {
// }
public static String secToTime(int time) {
String timeStr = null;
int hour = 0;
int minute = 0;
int second = 0;
String timeStr ;
int hour;
int minute;
int second;
if (time <= 0) {
return "00:00";
return "00:00:00";
} else {
minute = time / 60;
if (minute < 60) {
second = time % 60;
timeStr = unitFormat(minute) + ":" + unitFormat(second);
timeStr = "00:"+unitFormat(minute) + ":" + unitFormat(second);
} else {
hour = minute / 60;
minute = minute % 60;
......
package com.subsidy.util;
import lombok.Data;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.regex.Pattern;
@Data
@Component
public class MongoUtil<T> {
public Integer pageSize;
private Integer currentPage;
public void start(Integer currentPage, Integer pageSize, Query query) {
pageSize = pageSize == 0 ? 10 : pageSize;
query.limit(pageSize);
query.skip((currentPage - 1) * pageSize);
this.pageSize = pageSize;
this.currentPage = currentPage;
}
public PageHelper pageHelper(long total, List<T> list) {
return new PageHelper(this.currentPage, total, this.pageSize, list);
}
public PageHelper pageHelper(List<T> list) {
return new PageHelper(this.currentPage, this.pageSize, list);
}
public PageHelper pageHelper(long currentPage, long total, long pageSize, List<T> list) {
return new PageHelper(currentPage, total, pageSize, list);
}
public PageHelper pageHelper(long currentPage, long pageSize, List<T> list) {
return new PageHelper(currentPage, pageSize, list);
}
/**
* 用于模糊查询忽略大小写
*
* @param string
* @return
*/
public Pattern getPattern(String string) {
Pattern pattern = Pattern.compile("^.*" + string + ".*$", Pattern.CASE_INSENSITIVE);
return pattern;
}
}
package com.subsidy.util;
import lombok.Data;
import org.apache.poi.ss.formula.functions.T;
import java.util.List;
@Data
public class PageHelper<T> {
private long currentPage;
private long total;
private long pageSize;
private List<T> list;
public PageHelper(long pageNum, long total, long pageSize, List<T> list) {
this.currentPage = pageNum;
this.total = total;
this.pageSize = pageSize;
this.list = list;
}
public PageHelper(long pageNum, long pageSize, List<T> list) {
this.currentPage = pageNum;
this.pageSize = pageSize;
this.list = list;
}
}
......@@ -557,14 +557,14 @@ public class RedisUtil {
}
}
/**
* 模糊查询获取key值
* @param pattern
* @return
*/
public Set keys(String pattern){
return redisTemplate.keys(pattern);
}
///**
// * 模糊查询获取key值
// * @param pattern
// * @return
// */
//public Set keys(String pattern){
// return redisTemplate.keys(pattern);
//}
/**
* 模糊查询
......
......@@ -13,4 +13,6 @@ public class ClassDailyInfoVO {
private String userName;
private List<DayInfoItemVO> dayInfoItemVOS;
private Integer total;
}
......@@ -5,17 +5,12 @@ import lombok.Data;
@Data
public class GetMemberPapersVO {
private Long id;
private Long paperId;
private String paperName;
private String score;
private Integer rightCounts;
private Integer cnt;
private Integer totalCounts;
private Integer result;
private String result;
private String createDate;
private Integer score;
}
......@@ -44,6 +44,5 @@ public class GetCourseQuestionVO {
private String updateDate;
private String deleteDate;
}
......@@ -33,12 +33,12 @@ public class ClassDetailVO{
/**
* 已看视频
*/
private Integer studyVodCounts;
//private Integer studyVodCounts;
/**
* 全部视频
*/
private Integer allVodCounts;
//private Integer allVodCounts;
@ExcelColumn(col = 6,value = "课程进度")
private String classProcess;
......
......@@ -11,4 +11,5 @@ public class GetMaxScoreVO {
private Long score;
private Integer result;
}
package com.subsidy.vo.done;
import lombok.Data;
@Data
public class TestScoreInfoVO {
private Long paperId;
private Integer score;
private Integer cnt;
private String result;
}
......@@ -34,15 +34,6 @@ public class ClassSignVO {
@ExcelColumn(col = 4,value = "培训时长")
private String trainingLengthStr;
/**
* 已看视频
*/
private Integer studyVodCounts;
/**
* 全部视频
*/
private Integer allVodCounts;
@ExcelColumn(col = 5,value = "课程进度")
private String classProcess;
......
......@@ -5,7 +5,7 @@ import lombok.Data;
@Data
public class StudyPageVO {
private Integer id;
private Long id;
private Integer classId;
......
......@@ -2,7 +2,7 @@
# 数据源配置
spring.datasource.url=jdbc:mysql://47.97.19.66:3306/subsidy_test?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
#spring.datasource.url=jdbc:mysql://rm-uf606h696n5qod70cfo.mysql.rds.aliyuncs.com:3306/subsidy_test?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
#spring.datasource.url=jdbc:mysql://rm-uf6rab73w0qg843opxo.mysql.rds.aliyuncs.com:3306/subsidy_test?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
......@@ -27,9 +27,19 @@ spring.datasource.druid.useGlobalDataSourceStat=true
# 控制台日志打印
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
#spring.redis.host=r-uf6thsc3bzt5b6f7fdpd.redis.rds.aliyuncs.com
#spring.redis.password=r-uf6thsc3bzt5b6f7fd:Ykhl@208
#spring.redis.host=r-uf6meywj6ysuehg148pd.redis.rds.aliyuncs.com
#spring.redis.password=r-uf6meywj6ysuehg148: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
spring.application.name=spring-boot-mongodb
# mongodb
#spring.data.mongodb.uri=mongodb://47.97.19.66:27017/subsidy
spring.data.mongodb.username=root
spring.data.mongodb.password=123456
#spring.data.mongodb.authentication-database=subsidy
spring.data.mongodb.database=subsidy
spring.data.mongodb.host=47.97.19.66
spring.data.mongodb.port=27017
# 环境配置
spring.profiles.active=dev
# 端口号
spring.server.port=23454
spring.server.port=23457
#嵌入tomcat配置
#和CPU数
spring.server.acceptorThreadCount=600
......@@ -64,24 +64,6 @@ 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
#spring.redis.password=Ykhl@208
## spring.redis.cluster.max-redirects=3
#spring.redis.lettuce.pool.max-idle=16
#spring.redis.lettuce.pool.max-active=32
#spring.redis.lettuce.pool.min-idle=8
#spring.redis.host=r-uf6m4cpkjrgpzywjm3pd.redis.rds.aliyuncs.com
#spring.redis.port=6379
#spring.redis.password=r-uf6m4cpkjrgpzywjm3:Ykhl@208
......
......@@ -4,15 +4,15 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.AnsweringQuestionDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="course_id" property="courseId" />
<result column="ask_id" property="askId" />
<result column="answer_id" property="answerId" />
<result column="title" property="title" />
<result column="answer" property="answer" />
<id column="id" property="id"/>
<result column="create_date" property="createDate"/>
<result column="update_date" property="updateDate"/>
<result column="delete_date" property="deleteDate"/>
<result column="course_id" property="courseId"/>
<result column="ask_id" property="askId"/>
<result column="answer_id" property="answerId"/>
<result column="title" property="title"/>
<result column="answer" property="answer"/>
</resultMap>
<!-- 通用查询结果列 -->
......@@ -25,7 +25,14 @@
<select id="getCourseQuestion" resultType="com.subsidy.vo.answer.GetCourseQuestionVO">
SELECT
t.*,
t.id,
t.class_id,
t.ask_id,
t.answer_id,
t.title,
t.answer,
t.create_date,
t.update_date,
t2.user_name as memberName,
t3.user_name as administerName,
t4.company_name
......
......@@ -65,7 +65,17 @@
<select id="getSpareMembers" parameterType="com.subsidy.dto.classDict.GetSpareMembersDTO"
resultType="com.subsidy.model.MemberDO">
SELECT
distinct t2.*
distinct t2.id,
t2.company_id,
t2.user_name,
t2.account_name,
t2.telephone,
t2.PASSWORD,
t2.gender,
t2.image,
t2.id_card,
t2.STATUS,
t2.first_login
FROM
member t2
LEFT JOIN member_department_mapping t ON t.member_id = t2.id
......@@ -87,7 +97,17 @@
<select id="classMembers" parameterType="long" resultType="com.subsidy.model.MemberDO">
SELECT
t2.*
t2.id,
t2.company_id,
t2.user_name,
t2.account_name,
t2.telephone,
t2.PASSWORD,
t2.gender,
t2.image,
t2.id_card,
t2.STATUS,
t2.first_login
FROM
class_member_mapping t
LEFT JOIN member t2 ON t.member_id = t2.id
......
......@@ -21,7 +21,7 @@
id, course_id, content, order_no
</sql>
<select id="getCourseVods" parameterType="integer" resultType="com.subsidy.model.VodDictDO">
<select id="getCourseVods" parameterType="long" resultType="com.subsidy.model.VodDictDO">
SELECT
t2.id,
t2.content_id,
......@@ -81,4 +81,14 @@
t2.order_no
</select>
<select id="selectMaxOrderNo" parameterType="long" resultType="integer">
SELECT
max(t.order_no)
FROM
course_content t
WHERE
t.delete_date IS NULL
AND t.course_id = #{courseId}
</select>
</mapper>
......@@ -92,7 +92,12 @@
<select id="queryCompanyCourse" resultType="com.subsidy.vo.course.QueryCoursesVO">
SELECT
t.*,
t.id,
t.company_id,
t.course_name,
t.category_id,
t.course_type,
t.course_source,
t2.name
FROM
course_dict t
......
......@@ -51,7 +51,16 @@
and t.title like concat('%',#{title} ,'%')
</if>
order by t.order_no
</select>
<select id="getMaximumNo" parameterType="long" resultType="integer">
SELECT
max( t.order_no )
FROM
exercise_dict t
WHERE
t.delete_date IS NULL
AND t.paper_id = #{paperId}
</select>
</mapper>
......@@ -93,4 +93,68 @@
t.member_id
</select>
<select id="getMaxScorePaper" resultType="com.subsidy.model.ExerciseDoneResultDO">
SELECT
max( t.score ),
t.right_counts,
t.total_counts,
t.result
FROM
exercise_done_result t
WHERE
t.delete_date IS NULL
AND t.paper_id = #{paperId}
AND t.member_id = #{memberId}
</select>
<select id="testScoreInfo" resultType="com.subsidy.vo.done.TestScoreInfoVO">
SELECT
t.paper_id,
max( t.score ) AS score,
count( 1 ) AS cnt,
IF
( max( t.score )>= 60, '合格', '不合格' ) AS result
FROM
exercise_done_result t
LEFT JOIN paper_dict t2 ON t.paper_id = t2.id
WHERE
t.delete_date IS NULL
AND t.member_id = #{memberId}
AND t.paper_id = #{paperId}
GROUP BY
t.class_id,
t.paper_id,
t.member_id
</select>
<select id="getClassTestPassRate" parameterType="long" resultType="integer">
SELECT
sum( t11.result )
FROM
(
SELECT
IF
( sum( cnt )= sum( result ), 1, 0 ) AS result
FROM
(
SELECT
t.paper_id,
t.member_id,
max( t.score ) AS score,
1 AS cnt,
IF
( max( t.score )>= 60, '1', '0' ) AS result
FROM
exercise_done_result t
LEFT JOIN paper_dict t2 ON t.paper_id = t2.id
WHERE
t.delete_date IS NULL
AND t.class_id = 2
GROUP BY
t.class_id,
t.paper_id,
t.member_id
) t10
) t11
</select>
</mapper>
......@@ -22,4 +22,22 @@
id, content_id, file_name, file_size, order_no
</sql>
<select id="selectFiles" resultType="com.subsidy.model.FileDictDO">
SELECT
id,
content_id,
file_name,
file_size,
file_type,
file_url,
order_no,
create_date
FROM
file_dict t
WHERE
t.delete_date IS NULL
AND t.content_id = 2
AND t.file_name LIKE concat('%',#{fileName} ,'%')
</select>
</mapper>
......@@ -3,7 +3,7 @@
<mapper namespace="com.subsidy.mapper.OprAdmDictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.OprAdmDictDO">
<resultMap id="BaseResultMap" type="com.subsidy.mongodb.OprAdmDictDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
......@@ -50,7 +50,7 @@
t.create_date DESC
</select>
<select id="getLoginInfo" parameterType="long" resultType="com.subsidy.model.OprAdmDictDO">
<select id="getLoginInfo" parameterType="long" resultType="com.subsidy.mongodb.OprAdmDictDO">
SELECT
*
FROM
......@@ -68,7 +68,7 @@
LIMIT 5)t2
</select>
<select id="getRecordByDate" resultType="com.subsidy.model.OprAdmDictDO">
<select id="getRecordByDate" resultType="com.subsidy.mongodb.OprAdmDictDO">
SELECT
*
FROM
......
......@@ -228,7 +228,7 @@
<select id="memberRecentPlay" resultType="com.subsidy.vo.member.ContentVodNewVO">
SELECT
t2.id,
t1.play_record
ifnull(t1.play_record,0) as play_record
FROM
(
SELECT
......@@ -238,8 +238,8 @@
FROM
vod_play_history t
WHERE
t.member_id = 1
AND t.class_id = 3
t.member_id = #{memberId}
AND t.class_id = #{classId}
) t1
LEFT JOIN vod_dict t2 ON t1.vod_id = t2.id
</select>
......@@ -286,4 +286,25 @@
ORDER BY
t1.create_date DESC
</select>
<select id="memberTotalLength" parameterType="long" resultType="integer">
SELECT
sum( play_length )
FROM
vod_play_history t
WHERE
t.delete_date IS NULL
AND t.member_id = #{memberId}
</select>
<select id="memberVodTotalLength" resultType="integer">
SELECT
sum( t.play_length )
FROM
vod_play_history t
WHERE
t.delete_date IS NULL
AND t.vod_id = #{vodId}
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!