Commit 2668dc30 by 涂亚平

优化后版本,跑数据脚本

1 parent d5c90365
Showing with 1105 additions and 856 deletions
...@@ -203,6 +203,12 @@ ...@@ -203,6 +203,12 @@
<artifactId>jedis</artifactId> <artifactId>jedis</artifactId>
<version>${jedis.version}</version> <version>${jedis.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -5,31 +5,31 @@ public class RedisPrefixConstant { ...@@ -5,31 +5,31 @@ public class RedisPrefixConstant {
/** /**
* subsidyAdminister_accountName:AdministerDO 老师账号密码 * subsidyAdminister_accountName:AdministerDO 老师账号密码
*/ */
public static final String SUBSIDY_ADMINISTER_PREFIX = "subsidyAdminister_"; public static final String SUBSIDY_ADMINISTER_PREFIX = "subsidyAdminister:";
/** /**
* subsidyMember_companyId_accountName:MemberDO 学员账号密码 * 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 : 学员端审计记录 // *subsidy_memberLogin_memberId_userName_companyName_now : 学员端审计记录
*/ // */
public static final String SUBSIDY_MEMBER_LOGIN_PREFIX = "subsidy_memberLogin_"; //public static final String SUBSIDY_MEMBER_LOGIN_PREFIX = "subsidy:memberLogin:";
/** /**
* subsidySmsCode_telephone:code 手机验证码 * subsidySmsCode_telephone:code 手机验证码
*/ */
public static final String SUBSIDY_TELEPHONE_PREFIX = "subsidySmsCode_"; public static final String SUBSIDY_TELEPHONE_PREFIX = "subsidySmsCode:";
/** /**
* subsidySettings_companyId:ClassHourDictDO 公司操作设置 * 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 学生签到数据 * 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; ...@@ -16,6 +16,7 @@ import com.subsidy.service.AdministerService;
import com.subsidy.util.ConstantUtils; import com.subsidy.util.ConstantUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -65,7 +66,7 @@ public class AdministerController { ...@@ -65,7 +66,7 @@ public class AdministerController {
@PostMapping("/administers") @PostMapping("/administers")
@ApiOperation("查询所有运营者 { userName pageNum pageSize }") @ApiOperation("查询所有运营者 { userName pageNum pageSize }")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO operators(@RequestBody OperatorsDTO operatorsDTO){ public ResponseVO operators(@RequestBody OperatorsDTO operatorsDTO){
return ResponseData.generateCreatedResponse(0,administerService.operators(operatorsDTO)); return ResponseData.generateCreatedResponse(0,administerService.operators(operatorsDTO));
} }
...@@ -90,7 +91,7 @@ public class AdministerController { ...@@ -90,7 +91,7 @@ public class AdministerController {
@PostMapping("classSummary") @PostMapping("classSummary")
@ApiOperation("课程汇总 id 班级id ") @ApiOperation("课程汇总 id 班级id ")
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO classSummary(@RequestBody ClassDetailDTO classDetailDTO){ public ResponseVO classSummary(@RequestBody ClassDetailDTO classDetailDTO){
return ResponseData.generateCreatedResponse(0,administerService.classSummary(classDetailDTO)); return ResponseData.generateCreatedResponse(0,administerService.classSummary(classDetailDTO));
} }
...@@ -112,13 +113,13 @@ public class AdministerController { ...@@ -112,13 +113,13 @@ public class AdministerController {
@PostMapping("signDetail") @PostMapping("signDetail")
@ApiOperation("班级管理--注册签到 id 班级id userName") @ApiOperation("班级管理--注册签到 id 班级id userName")
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO signDetail(@RequestBody ClassDetailDTO classDetailDTO){ public ResponseVO signDetail(@RequestBody ClassDetailDTO classDetailDTO){
return ResponseData.generateCreatedResponse(0,administerService.signDetail(classDetailDTO)); return ResponseData.generateCreatedResponse(0,administerService.signDetail(classDetailDTO));
} }
@PostMapping("exportSignDetail") @PostMapping("exportSignDetail")
@ApiOperation("** 班级管理--注册签到 id 班级id userName") @ApiOperation("班级管理--注册签到 id 班级id userName")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public void exportSignDetail(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{ public void exportSignDetail(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{
classDetailDTO.setFlag(true); classDetailDTO.setFlag(true);
...@@ -142,7 +143,7 @@ public class AdministerController { ...@@ -142,7 +143,7 @@ public class AdministerController {
@PostMapping("getMemberPapers") @PostMapping("getMemberPapers")
@ApiOperation("获取某个成员某个卷子的做题历史 memberId paperId") @ApiOperation("获取某个成员某个卷子的做题历史 memberId paperId")
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getMemberPapers(@RequestBody ExerciseDoneResultDO exerciseDoneResultDO){ public ResponseVO getMemberPapers(@RequestBody ExerciseDoneResultDO exerciseDoneResultDO){
return ResponseData.generateCreatedResponse(0,administerService.getMemberPapers(exerciseDoneResultDO)); return ResponseData.generateCreatedResponse(0,administerService.getMemberPapers(exerciseDoneResultDO));
} }
...@@ -181,12 +182,13 @@ public class AdministerController { ...@@ -181,12 +182,13 @@ public class AdministerController {
} }
@PostMapping("exportClassDailyInfo") @PostMapping("exportClassDailyInfo")
@ApiParam("每日学习日志")
public void exportVodInfo(@RequestBody ClassDailyInfoDTO classDailyInfoDTO){ public void exportVodInfo(@RequestBody ClassDailyInfoDTO classDailyInfoDTO){
administerService.exportClassDailyInfo(classDailyInfoDTO); administerService.exportClassDailyInfo(classDailyInfoDTO);
} }
@PostMapping("exportZip") @PostMapping("exportZip")
@ApiOperation("** 下载压缩包 id 班级id") @ApiOperation("下载压缩包 id 班级id")
@CrossOrigin @CrossOrigin
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public void exportZip(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{ public void exportZip(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{
......
...@@ -36,7 +36,7 @@ public class ClassDictController { ...@@ -36,7 +36,7 @@ public class ClassDictController {
private ClassDictService classDictService; private ClassDictService classDictService;
@PostMapping("getAllClasses") @PostMapping("getAllClasses")
@ApiOperation("获取某老师下的所有课程 ** companyId 所选企业id className 班级名称") @ApiOperation("获取某老师下的所有课程 companyId 所选企业id className 班级名称")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getAllClasses(@RequestBody ClassDictDO classDictDO){ public ResponseVO getAllClasses(@RequestBody ClassDictDO classDictDO){
return ResponseData.generateCreatedResponse(0,classDictService.getAllClasses(classDictDO)); return ResponseData.generateCreatedResponse(0,classDictService.getAllClasses(classDictDO));
...@@ -78,8 +78,8 @@ public class ClassDictController { ...@@ -78,8 +78,8 @@ public class ClassDictController {
} }
@PostMapping("getSpareMembers") @PostMapping("getSpareMembers")
@ApiOperation("获取不在某班级的某企业里所有成员 ** companyId 企业id classId 班级id") @ApiOperation("获取不在某班级的某企业里所有成员 companyId 企业id classId 班级id")
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getSpareMembers(@RequestBody GetSpareMembersDTO getSpareMembersDTO){ public ResponseVO getSpareMembers(@RequestBody GetSpareMembersDTO getSpareMembersDTO){
return ResponseData.generateCreatedResponse(0,classDictService.getSpareMembers(getSpareMembersDTO)); return ResponseData.generateCreatedResponse(0,classDictService.getSpareMembers(getSpareMembersDTO));
} }
...@@ -91,7 +91,6 @@ public class ClassDictController { ...@@ -91,7 +91,6 @@ public class ClassDictController {
return ResponseData.generateCreatedResponse(0,classDictService.addMemberToClass(addMemberToClassDTO)); return ResponseData.generateCreatedResponse(0,classDictService.addMemberToClass(addMemberToClassDTO));
} }
@PostMapping("batchSms") @PostMapping("batchSms")
@ApiOperation(" 批量发送班级短信 {id 班级id}") @ApiOperation(" 批量发送班级短信 {id 班级id}")
public ResponseVO batchSms(@RequestBody ClassDictDO classDictDO){ public ResponseVO batchSms(@RequestBody ClassDictDO classDictDO){
......
...@@ -33,14 +33,14 @@ public class ClassHourDictController { ...@@ -33,14 +33,14 @@ public class ClassHourDictController {
private ClassHourDictService classHourDictService; private ClassHourDictService classHourDictService;
@PostMapping("getSetting") @PostMapping("getSetting")
@ApiOperation("** 查看当天设置的最大学习时长 companyId") @ApiOperation("查看当天设置的最大学习时长 companyId")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getSetting(@RequestBody ClassHourDictDO classHourDictDO){ public ResponseVO getSetting(@RequestBody ClassHourDictDO classHourDictDO){
return ResponseData.generateCreatedResponse(0,classHourDictService.getSetting(classHourDictDO)); return ResponseData.generateCreatedResponse(0,classHourDictService.getSetting(classHourDictDO));
} }
@PostMapping("updateSetting") @PostMapping("updateSetting")
@ApiOperation("** 修改当天设置时长 id 主键 classHour status interrupt interruptStatus repeatTime repeatStatus") @ApiOperation("修改当天设置时长 id 主键 classHour status interrupt interruptStatus repeatTime repeatStatus")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateSetting(@RequestBody ClassHourDictDO classHourDictDO){ public ResponseVO updateSetting(@RequestBody ClassHourDictDO classHourDictDO){
return ResponseData.generateCreatedResponse(0,classHourDictService.updateSetting(classHourDictDO)); return ResponseData.generateCreatedResponse(0,classHourDictService.updateSetting(classHourDictDO));
......
...@@ -34,28 +34,28 @@ public class CompanyDictController { ...@@ -34,28 +34,28 @@ public class CompanyDictController {
private CompanyDictService companyDictService; private CompanyDictService companyDictService;
@PostMapping("/administers") @PostMapping("/administers")
@ApiOperation("** 查询所有企业 {id companyName pageNum pageSize }") @ApiOperation("查询所有企业 {id companyName pageNum pageSize }")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO operators(@RequestBody OperatorsDTO operatorsDTO){ public ResponseVO operators(@RequestBody OperatorsDTO operatorsDTO){
return ResponseData.generateCreatedResponse(0,companyDictService.operators(operatorsDTO)); return ResponseData.generateCreatedResponse(0,companyDictService.operators(operatorsDTO));
} }
@PostMapping("addCompany") @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}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addOperator(@RequestBody AddCompanyDTO addCompanyDTO){ public ResponseVO addOperator(@RequestBody AddCompanyDTO addCompanyDTO){
return ResponseData.generateCreatedResponse(0,companyDictService.addOperator(addCompanyDTO)); return ResponseData.generateCreatedResponse(0,companyDictService.addOperator(addCompanyDTO));
} }
@PostMapping("deleteCompany") @PostMapping("deleteCompany")
@ApiOperation("** 删除企业 id") @ApiOperation("删除企业 id")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO deleteAdminister(@RequestBody CompanyDictDO companyDictDO){ public ResponseVO deleteAdminister(@RequestBody CompanyDictDO companyDictDO){
return ResponseData.generateCreatedResponse(0,companyDictService.deleteAdminister(companyDictDO)); return ResponseData.generateCreatedResponse(0,companyDictService.deleteAdminister(companyDictDO));
} }
@PostMapping("updateCompany") @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}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateAdminister(@RequestBody AddCompanyDTO addCompanyDTO){ public ResponseVO updateAdminister(@RequestBody AddCompanyDTO addCompanyDTO){
return ResponseData.generateCreatedResponse(0,companyDictService.updateAdminister(addCompanyDTO)); return ResponseData.generateCreatedResponse(0,companyDictService.updateAdminister(addCompanyDTO));
......
...@@ -32,28 +32,28 @@ public class CourseContentController { ...@@ -32,28 +32,28 @@ public class CourseContentController {
private CourseContentService courseContentService; private CourseContentService courseContentService;
@PostMapping("getContents") @PostMapping("getContents")
@ApiOperation("** 获取课程目录 {courseId}") @ApiOperation("获取课程目录 {courseId}")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getContents(@RequestBody CourseContentDO courseContentDO){ public ResponseVO getContents(@RequestBody CourseContentDO courseContentDO){
return ResponseData.generateCreatedResponse(0,courseContentService.getContents(courseContentDO)); return ResponseData.generateCreatedResponse(0,courseContentService.getContents(courseContentDO));
} }
@PostMapping("deleteContent") @PostMapping("deleteContent")
@ApiOperation("** 删除一个目录 {id} ") @ApiOperation("删除一个目录 {id} ")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO deleteContent(@RequestBody CourseContentDO courseContentDO){ public ResponseVO deleteContent(@RequestBody CourseContentDO courseContentDO){
return ResponseData.generateCreatedResponse(0,courseContentService.deleteContent(courseContentDO)); return ResponseData.generateCreatedResponse(0,courseContentService.deleteContent(courseContentDO));
} }
@PostMapping("addContent") @PostMapping("addContent")
@ApiOperation("** 添加一个目录 {courseId content}") @ApiOperation("添加一个目录 {courseId content}")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addContent(@RequestBody CourseContentDO courseContentDO){ public ResponseVO addContent(@RequestBody CourseContentDO courseContentDO){
return ResponseData.generateCreatedResponse(0,courseContentService.addContent(courseContentDO)); return ResponseData.generateCreatedResponse(0,courseContentService.addContent(courseContentDO));
} }
@PostMapping("updateContent") @PostMapping("updateContent")
@ApiOperation("** 更新一个目录 {id courseId content}") @ApiOperation("更新一个目录 {id courseId content}")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateContent(@RequestBody CourseContentDO courseContentDO){ public ResponseVO updateContent(@RequestBody CourseContentDO courseContentDO){
return ResponseData.generateCreatedResponse(0,courseContentService.updateContent(courseContentDO)); return ResponseData.generateCreatedResponse(0,courseContentService.updateContent(courseContentDO));
......
...@@ -33,14 +33,14 @@ public class CourseDictController { ...@@ -33,14 +33,14 @@ public class CourseDictController {
private CourseDictService courseDictService; private CourseDictService courseDictService;
@PostMapping("addCourse") @PostMapping("addCourse")
@ApiOperation("添加课程 **companyId courseName categoryId courseType courseSource") @ApiOperation("添加课程 companyId courseName categoryId courseType courseSource")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addCourse(@RequestBody CourseDictDO courseDictDO){ public ResponseVO addCourse(@RequestBody CourseDictDO courseDictDO){
return ResponseData.generateCreatedResponse(0,courseDictService.addCourse(courseDictDO)); return ResponseData.generateCreatedResponse(0,courseDictService.addCourse(courseDictDO));
} }
@PostMapping("deleteCourse") @PostMapping("deleteCourse")
@ApiOperation("** 删除课程 id") @ApiOperation("删除课程 id")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO deleteCourse(@RequestBody CourseDictDO courseDictDO){ public ResponseVO deleteCourse(@RequestBody CourseDictDO courseDictDO){
return ResponseData.generateCreatedResponse(0,courseDictService.deleteCourse(courseDictDO)); return ResponseData.generateCreatedResponse(0,courseDictService.deleteCourse(courseDictDO));
...@@ -48,13 +48,13 @@ public class CourseDictController { ...@@ -48,13 +48,13 @@ public class CourseDictController {
@PostMapping("queryCourses") @PostMapping("queryCourses")
@ApiOperation("平台运营者--查询课程 pageSize pageNum administerId companyId courseName categoryId courseType courseSource") @ApiOperation("平台运营者--查询课程 pageSize pageNum administerId companyId courseName categoryId courseType courseSource")
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO queryCourses(@RequestBody QueryCoursesDTO queryCoursesDTO){ public ResponseVO queryCourses(@RequestBody QueryCoursesDTO queryCoursesDTO){
return ResponseData.generateCreatedResponse(0,courseDictService.queryCourses(queryCoursesDTO)); return ResponseData.generateCreatedResponse(0,courseDictService.queryCourses(queryCoursesDTO));
} }
@PostMapping("updateCourses") @PostMapping("updateCourses")
@ApiOperation("编辑课程 id ** companyId courseName categoryId courseType courseSource") @ApiOperation("编辑课程 id companyId courseName categoryId courseType courseSource")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateCourses(@RequestBody CourseDictDO courseDictDO){ public ResponseVO updateCourses(@RequestBody CourseDictDO courseDictDO){
return ResponseData.generateCreatedResponse(0,courseDictService.updateCourses(courseDictDO)); return ResponseData.generateCreatedResponse(0,courseDictService.updateCourses(courseDictDO));
......
...@@ -32,28 +32,28 @@ public class DepartmentDictController { ...@@ -32,28 +32,28 @@ public class DepartmentDictController {
private DepartmentDictService departmentDictService; private DepartmentDictService departmentDictService;
@PostMapping("getDepartments") @PostMapping("getDepartments")
@ApiOperation("** 获取所有部门 companyId 企业id") @ApiOperation("获取所有部门 companyId 企业id")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getDepartments(@RequestBody DepartmentDictDO departmentDictDO){ public ResponseVO getDepartments(@RequestBody DepartmentDictDO departmentDictDO){
return ResponseData.generateCreatedResponse(0,departmentDictService.getDepartments(departmentDictDO)); return ResponseData.generateCreatedResponse(0,departmentDictService.getDepartments(departmentDictDO));
} }
@PostMapping("addDepartment") @PostMapping("addDepartment")
@ApiOperation("添加部门 ** companyId departmentName leaderName parentId 父节点") @ApiOperation("添加部门 companyId departmentName leaderName parentId 父节点")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addDepartment(@RequestBody DepartmentDictDO departmentDictDO){ public ResponseVO addDepartment(@RequestBody DepartmentDictDO departmentDictDO){
return ResponseData.generateCreatedResponse(0,departmentDictService.addDepartment(departmentDictDO)); return ResponseData.generateCreatedResponse(0,departmentDictService.addDepartment(departmentDictDO));
} }
@PostMapping("deleteDepartment") @PostMapping("deleteDepartment")
@ApiOperation("** 删除部门 id") @ApiOperation("删除部门 id")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO deleteDepartment(@RequestBody DepartmentDictDO departmentDictDO){ public ResponseVO deleteDepartment(@RequestBody DepartmentDictDO departmentDictDO){
return ResponseData.generateCreatedResponse(0,departmentDictService.deleteDepartment(departmentDictDO)); return ResponseData.generateCreatedResponse(0,departmentDictService.deleteDepartment(departmentDictDO));
} }
@PostMapping("updateDepartment") @PostMapping("updateDepartment")
@ApiOperation("编辑部门 id ** companyId departmentName leaderName parentId") @ApiOperation("编辑部门 id companyId departmentName leaderName parentId")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateDepartment(@RequestBody DepartmentDictDO departmentDictDO){ public ResponseVO updateDepartment(@RequestBody DepartmentDictDO departmentDictDO){
return ResponseData.generateCreatedResponse(0,departmentDictService.updateDepartment(departmentDictDO)); return ResponseData.generateCreatedResponse(0,departmentDictService.updateDepartment(departmentDictDO));
......
...@@ -35,13 +35,6 @@ public class ExerciseDictController { ...@@ -35,13 +35,6 @@ public class ExerciseDictController {
@Autowired @Autowired
private ExerciseDictService exerciseDictService; 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") @PostMapping("addExercise")
@ApiOperation("添加题目 {paperId 试卷id courseId 课程id exerciseType 题目类型 difficulty 难度 title题目 items 选项 rightAnswer 正确答案 }") @ApiOperation("添加题目 {paperId 试卷id courseId 课程id exerciseType 题目类型 difficulty 难度 title题目 items 选项 rightAnswer 正确答案 }")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
...@@ -63,14 +56,8 @@ public class ExerciseDictController { ...@@ -63,14 +56,8 @@ public class ExerciseDictController {
return ResponseData.generateCreatedResponse(0,exerciseDictService.updateExercise(exerciseDictDO)); 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") @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){ public ResponseVO submit(@RequestBody SubmitDTO submitDTO){
return ResponseData.generateCreatedResponse(0,exerciseDictService.submit(submitDTO)); return ResponseData.generateCreatedResponse(0,exerciseDictService.submit(submitDTO));
} }
......
...@@ -32,7 +32,7 @@ public class FileDictController { ...@@ -32,7 +32,7 @@ public class FileDictController {
private FileDictService fileDictService; private FileDictService fileDictService;
@PostMapping("getContendFiles") @PostMapping("getContendFiles")
@ApiOperation("** 获取目录下的视频 {contentId fileName}") @ApiOperation("获取目录下的视频 {contentId fileName}")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getContendFiles(@RequestBody FileDictDO fileDictDO){ public ResponseVO getContendFiles(@RequestBody FileDictDO fileDictDO){
return ResponseData.generateCreatedResponse(0,fileDictService.getContendFiles(fileDictDO)); return ResponseData.generateCreatedResponse(0,fileDictService.getContendFiles(fileDictDO));
......
...@@ -79,7 +79,7 @@ public class MemberController { ...@@ -79,7 +79,7 @@ public class MemberController {
} }
@PostMapping("updatePassword") @PostMapping("updatePassword")
@ApiOperation("** 修改密码 {id password}") @ApiOperation("修改密码 {id password}")
public ResponseVO updatePassword(@RequestBody MemberDO memberDO){ public ResponseVO updatePassword(@RequestBody MemberDO memberDO){
return ResponseData.generateCreatedResponse(0,memberService.updatePassword(memberDO)); return ResponseData.generateCreatedResponse(0,memberService.updatePassword(memberDO));
} }
...@@ -103,7 +103,7 @@ public class MemberController { ...@@ -103,7 +103,7 @@ public class MemberController {
} }
@PostMapping("studyHistory") @PostMapping("studyHistory")
@ApiOperation("** 学习记录 memberId 成员id pageSize pageNum") @ApiOperation("学习记录 memberId 成员id pageSize pageNum")
public ResponseVO studyHistory(@RequestBody StudyHistoryDTO studyHistoryDTO){ public ResponseVO studyHistory(@RequestBody StudyHistoryDTO studyHistoryDTO){
return ResponseData.generateCreatedResponse(0,memberService.studyHistory(studyHistoryDTO)); return ResponseData.generateCreatedResponse(0,memberService.studyHistory(studyHistoryDTO));
} }
...@@ -121,17 +121,11 @@ public class MemberController { ...@@ -121,17 +121,11 @@ public class MemberController {
} }
@PostMapping("getStudyInfo") @PostMapping("getStudyInfo")
@ApiOperation("** 获取学生完成课程情况 id 学员id") @ApiOperation("获取学生完成课程情况 id 学员id")
public ResponseVO getStudyInfo(@RequestBody MemberDO memberDO){ public ResponseVO getStudyInfo(@RequestBody MemberDO memberDO){
return ResponseData.generateCreatedResponse(0,memberService.getStudyInfo(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") @PostMapping("checkTimes")
@ApiOperation("检测是否超过次数 memberId paperId classId") @ApiOperation("检测是否超过次数 memberId paperId classId")
public ResponseVO checkTimes(@RequestBody ExerciseDoneResultDO exerciseDoneResultDO){ public ResponseVO checkTimes(@RequestBody ExerciseDoneResultDO exerciseDoneResultDO){
......
...@@ -30,7 +30,7 @@ public class OprAdmDictController { ...@@ -30,7 +30,7 @@ public class OprAdmDictController {
private OprAdmDictService oprAdmDictService; private OprAdmDictService oprAdmDictService;
@PostMapping("getHistory") @PostMapping("getHistory")
@ApiOperation("###获取后台用户审计 {pageSize pageNum userName startDate endDate}") @ApiOperation("获取后台用户审计 {pageSize pageNum userName startDate endDate}")
public ResponseVO getHistory(@RequestBody GetHistoryDTO getHistoryDTO){ public ResponseVO getHistory(@RequestBody GetHistoryDTO getHistoryDTO){
return ResponseData.generateCreatedResponse(0,oprAdmDictService.getHistory(getHistoryDTO)); return ResponseData.generateCreatedResponse(0,oprAdmDictService.getHistory(getHistoryDTO));
} }
......
...@@ -34,7 +34,7 @@ public class SignInRecordController { ...@@ -34,7 +34,7 @@ public class SignInRecordController {
private SignInRecordService signInRecordService; private SignInRecordService signInRecordService;
@PostMapping("getMemberSignInfo") @PostMapping("getMemberSignInfo")
@ApiOperation("###获取某个成员的签到记录 id 成员id pageSize pageNum") @ApiOperation("获取某个成员的签到记录 id 成员id pageSize pageNum")
public ResponseVO getMemberSignInfo(@RequestBody GetMemberSignInfoDTO getMemberSignInfoDTO) { public ResponseVO getMemberSignInfo(@RequestBody GetMemberSignInfoDTO getMemberSignInfoDTO) {
return ResponseData.generateCreatedResponse(0, signInRecordService.getMemberSignInfo(getMemberSignInfoDTO)); return ResponseData.generateCreatedResponse(0, signInRecordService.getMemberSignInfo(getMemberSignInfoDTO));
} }
......
...@@ -42,4 +42,10 @@ public class VodPlayHistoryController { ...@@ -42,4 +42,10 @@ public class VodPlayHistoryController {
VodPlayHistoryDO vodPlayHistoryDO = JSON.parseObject(param,VodPlayHistoryDO.class); VodPlayHistoryDO vodPlayHistoryDO = JSON.parseObject(param,VodPlayHistoryDO.class);
return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.insertHistoryNew(vodPlayHistoryDO)); return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.insertHistoryNew(vodPlayHistoryDO));
} }
@PostMapping("dataFix")
public void dadaFix(){
vodPlayHistoryService.dataFix();
}
} }
package com.subsidy.jobs; package com.subsidy.jobs;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.subsidy.mapper.OprAdmDictMapper; import com.subsidy.mapper.OprAdmDictMapper;
import com.subsidy.mapper.OprMemDictMapper; import com.subsidy.mapper.OprMemDictMapper;
import com.subsidy.mapper.VodPlayHistoryMapper; import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.model.OprAdmDictDO; import com.subsidy.mongodb.OprAdmDictDO;
import com.subsidy.model.OprMemDictDO; import com.subsidy.model.OprMemDictDO;
import com.subsidy.model.VodPlayHistoryDO; import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.util.DateFormatUtil; import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.RedisUtil; import com.subsidy.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
...@@ -41,6 +42,8 @@ public class Scheduler { ...@@ -41,6 +42,8 @@ public class Scheduler {
@Autowired @Autowired
private RedisUtil redisUtil; private RedisUtil redisUtil;
@Autowired
private MongoTemplate mongoTemplate;
/** /**
删除十天前登录记录(管理端) 删除十天前登录记录(管理端)
*/ */
...@@ -49,45 +52,45 @@ public class Scheduler { ...@@ -49,45 +52,45 @@ public class Scheduler {
List<OprAdmDictDO> list = oprAdmDictMapper.getRecordByDate(); List<OprAdmDictDO> list = oprAdmDictMapper.getRecordByDate();
if(list != null) { if(list != null) {
for (OprAdmDictDO oprAdmDictDO : list) { for (OprAdmDictDO oprAdmDictDO : list) {
oprAdmDictMapper.deleteById(oprAdmDictDO.getId()); //oprAdmDictMapper.deleteById(oprAdmDictDO.getId());
} }
} }
} }
/** ///**
* 删除十天前登录记录(学员) // * 删除十天前登录记录(学员)
*/ // */
//@Scheduled(cron = "0 42 18 * * ?") ////@Scheduled(cron = "0 42 18 * * ?")
public void delOprMemRecord() { //public void delOprMemRecord() {
List<OprMemDictDO> list = oprMemDictMapper.getRecordByDate(); // List<OprMemDictDO> list = oprMemDictMapper.getRecordByDate();
if(list != null) { // if(list != null) {
for (OprMemDictDO oprMemDictDO : list) { // for (OprMemDictDO oprMemDictDO : list) {
oprMemDictMapper.deleteById(oprMemDictDO.getId()); // oprMemDictMapper.deleteById(oprMemDictDO.getId());
} // }
} // }
} //}
/** ///**
* 用户数据审计记录添加(学员) // * 用户数据审计记录添加(学员)
*/ // */
//@Scheduled(cron = "0 39 18 * * ?") ////@Scheduled(cron = "0 39 18 * * ?")
public void getOprMemRecord() { //public void getOprMemRecord() {
Set<String> set = redisUtil.scan("*memberLogin*"); // Set<String> set = redisUtil.scan("*memberLogin*");
if(set != null) { // if(set != null) {
for (String str : set) { // for (String str : set) {
int result = (Integer) redisUtil.get(str); // int result = (Integer) redisUtil.get(str);
OprMemDictDO oprMemDictDO = new OprMemDictDO(); // OprMemDictDO oprMemDictDO = new OprMemDictDO();
String [] opr = str.split("_"); // String [] opr = str.split("_");
LocalDateTime createDate = DateFormatUtil.secondToLocalDateTime(Long.valueOf(opr[3])); // LocalDateTime createDate = DateFormatUtil.secondToLocalDateTime(Long.valueOf(opr[3]));
oprMemDictDO.setResult(result); // oprMemDictDO.setResult(result);
oprMemDictDO.setOprType("登录"); // oprMemDictDO.setOprType("登录");
oprMemDictDO.setUserId(Long.valueOf(opr[2])); // oprMemDictDO.setUserId(Long.valueOf(opr[2]));
oprMemDictDO.setCreateDate(createDate); // oprMemDictDO.setCreateDate(createDate);
oprMemDictMapper.insert(oprMemDictDO); // oprMemDictMapper.insert(oprMemDictDO);
redisUtil.del(str); // redisUtil.del(str);
} // }
} // }
} //}
/** /**
* 视频播放记录缩量 * 视频播放记录缩量
...@@ -106,4 +109,5 @@ public class Scheduler { ...@@ -106,4 +109,5 @@ public class Scheduler {
vodPlayHistoryMapper.insert(vodPlayHistoryDO); vodPlayHistoryMapper.insert(vodPlayHistoryDO);
} }
} }
} }
...@@ -24,7 +24,7 @@ public interface CourseContentMapper extends BaseMapper<CourseContentDO> { ...@@ -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> { ...@@ -36,4 +36,5 @@ public interface CourseContentMapper extends BaseMapper<CourseContentDO> {
*/ */
List<FileDictDO> contentFiles(Long courseId); List<FileDictDO> contentFiles(Long courseId);
Integer selectMaxOrderNo(Long courseId);
} }
...@@ -14,14 +14,16 @@ import org.springframework.stereotype.Repository; ...@@ -14,14 +14,16 @@ import org.springframework.stereotype.Repository;
* @author DengMin * @author DengMin
* @since 2021-10-12 * @since 2021-10-12
*/ */
@Repository @Repository
public interface ExerciseDictMapper extends BaseMapper<ExerciseDictDO> { 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; package com.subsidy.mapper;
import com.subsidy.model.ExerciseDoneResultDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.vo.administer.GetMemberPapersVO; import com.subsidy.vo.administer.GetMemberPapersVO;
import com.subsidy.vo.administer.GetPaperDetailVO; import com.subsidy.vo.administer.GetPaperDetailVO;
import com.subsidy.vo.done.GetMaxScoreVO; import com.subsidy.vo.done.GetMaxScoreVO;
import com.subsidy.vo.done.TestScoreInfoVO;
import com.subsidy.vo.exercise.GetDoneDetailVO; import com.subsidy.vo.exercise.GetDoneDetailVO;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -42,6 +43,18 @@ public interface ExerciseDoneResultMapper extends BaseMapper<ExerciseDoneResultD ...@@ -42,6 +43,18 @@ public interface ExerciseDoneResultMapper extends BaseMapper<ExerciseDoneResultD
*/ */
List<GetMaxScoreVO> getMaxScore(Long classId, Long memberId); 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; ...@@ -4,6 +4,8 @@ import com.subsidy.model.FileDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
/** /**
* <p> * <p>
* 课件表 Mapper 接口 * 课件表 Mapper 接口
...@@ -15,4 +17,6 @@ import org.springframework.stereotype.Repository; ...@@ -15,4 +17,6 @@ import org.springframework.stereotype.Repository;
@Repository @Repository
public interface FileDictMapper extends BaseMapper<FileDictDO> { public interface FileDictMapper extends BaseMapper<FileDictDO> {
List<FileDictDO> selectFiles(Long contentId,String fileName);
} }
package com.subsidy.mapper; package com.subsidy.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.vo.opr.GetHistoryVO; import com.subsidy.vo.opr.GetHistoryVO;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
......
...@@ -66,6 +66,14 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> { ...@@ -66,6 +66,14 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
*/ */
List<MemberStudyLogVO> memberStudyLog(Long classId, Long memberId); 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; ...@@ -16,14 +16,9 @@ import lombok.EqualsAndHashCode;
* @since 2021-12-13 * @since 2021-12-13
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true) public class OprMemDictDO {
@TableName("opr_mem_dict")
public class OprMemDictDO extends BaseModel {
private static final long serialVersionUID = 1L; private String _id;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/** /**
* 用户id * 用户id
...@@ -40,4 +35,13 @@ public class OprMemDictDO extends BaseModel { ...@@ -40,4 +35,13 @@ public class OprMemDictDO extends BaseModel {
*/ */
private Integer result; private Integer result;
/**
* 登录时间
*/
private String loginDateFormat;
/**
* 创建时间
*/
private String createDate;
} }
...@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableId; ...@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
/** /**
* <p> * <p>
* 视频播放历史记录表 * 视频播放历史记录表
...@@ -55,5 +57,7 @@ public class VodPlayHistoryDO extends BaseModel { ...@@ -55,5 +57,7 @@ public class VodPlayHistoryDO extends BaseModel {
*/ */
private Integer playCount; 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.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.IdType; ...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.omg.CosNaming.NamingContextExtPackage.StringNameHelper;
/** /**
* <p> * <p>
...@@ -16,14 +17,9 @@ import lombok.EqualsAndHashCode; ...@@ -16,14 +17,9 @@ import lombok.EqualsAndHashCode;
* @since 2021-12-13 * @since 2021-12-13
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true) public class OprAdmDictDO {
@TableName("opr_adm_dict")
public class OprAdmDictDO extends BaseModel {
private static final long serialVersionUID = 1L; private String _id;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/** /**
* 用户id * 用户id
...@@ -31,6 +27,16 @@ public class OprAdmDictDO extends BaseModel { ...@@ -31,6 +27,16 @@ public class OprAdmDictDO extends BaseModel {
private Long userId; private Long userId;
/** /**
* 公司id
*/
private Long companyId;
/**
* 名字
*/
private String userName;
/**
* 操作类型 * 操作类型
*/ */
private String oprType; private String oprType;
...@@ -40,4 +46,14 @@ public class OprAdmDictDO extends BaseModel { ...@@ -40,4 +46,14 @@ public class OprAdmDictDO extends BaseModel {
*/ */
private Integer result; 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; ...@@ -21,16 +21,12 @@ import java.util.List;
*/ */
public interface ExerciseDictService extends IService<ExerciseDictDO> { public interface ExerciseDictService extends IService<ExerciseDictDO> {
IPage<ExerciseDictDO> getAllExercises(GetAllExercisesDTO getAllExercisesDTO);
String addExercise(ExerciseDictDO exerciseDictDO); String addExercise(ExerciseDictDO exerciseDictDO);
String deleteExercise(ExerciseDictDO exerciseDictDO); String deleteExercise(ExerciseDictDO exerciseDictDO);
String updateExercise(ExerciseDictDO exerciseDictDO); String updateExercise(ExerciseDictDO exerciseDictDO);
List<ExerciseVO> getCourseExercises(CourseDictDO courseDictDO);
Long submit(SubmitDTO submitDTO); Long submit(SubmitDTO submitDTO);
IPage getPaperExercise(GetPaperExerciseDTO getPaperExerciseDTO); IPage getPaperExercise(GetPaperExerciseDTO getPaperExerciseDTO);
......
...@@ -60,8 +60,6 @@ public interface MemberService extends IService<MemberDO> { ...@@ -60,8 +60,6 @@ public interface MemberService extends IService<MemberDO> {
GetStudyInfoVO getStudyInfo(MemberDO memberDO); GetStudyInfoVO getStudyInfo(MemberDO memberDO);
ExerciseDoneResultDO getDoneResult(ExerciseDoneResultDO exerciseDoneResultDO);
String checkTimes(ExerciseDoneResultDO exerciseDoneResultDO); String checkTimes(ExerciseDoneResultDO exerciseDoneResultDO);
void importRedis(); void importRedis();
......
...@@ -2,8 +2,9 @@ package com.subsidy.service; ...@@ -2,8 +2,9 @@ package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.dto.opr.GetHistoryDTO; 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.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.mongodb.PageVO;
import com.subsidy.vo.opr.GetHistoryVO; import com.subsidy.vo.opr.GetHistoryVO;
/** /**
...@@ -16,6 +17,6 @@ import com.subsidy.vo.opr.GetHistoryVO; ...@@ -16,6 +17,6 @@ import com.subsidy.vo.opr.GetHistoryVO;
*/ */
public interface OprAdmDictService extends IService<OprAdmDictDO> { 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> { ...@@ -16,4 +16,6 @@ public interface VodPlayHistoryService extends IService<VodPlayHistoryDO> {
String insertHistory(VodPlayHistoryDO vodPlayHistoryDO); String insertHistory(VodPlayHistoryDO vodPlayHistoryDO);
String insertHistoryNew(VodPlayHistoryDO vodPlayHistoryDO); String insertHistoryNew(VodPlayHistoryDO vodPlayHistoryDO);
void dataFix();
} }
...@@ -37,13 +37,14 @@ import com.subsidy.model.ExerciseDoneHistoryDO; ...@@ -37,13 +37,14 @@ import com.subsidy.model.ExerciseDoneHistoryDO;
import com.subsidy.model.ExerciseDoneResultDO; import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.model.MemberDO; import com.subsidy.model.MemberDO;
import com.subsidy.model.MemberDepartmentMappingDO; import com.subsidy.model.MemberDepartmentMappingDO;
import com.subsidy.model.OprAdmDictDO; import com.subsidy.model.OprMemDictDO;
import com.subsidy.mongodb.OprAdmDictDO;
import com.subsidy.model.RoleAdministerMappingDO; import com.subsidy.model.RoleAdministerMappingDO;
import com.subsidy.model.SignInRecordDO; import com.subsidy.model.SignInRecordDO;
import com.subsidy.model.VodDictDO; import com.subsidy.model.VodDictDO;
import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.service.AdministerService; import com.subsidy.service.AdministerService;
import com.subsidy.util.ConstantUtils; import com.subsidy.util.ConstantUtils;
import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.ExcelFormatUtils; import com.subsidy.util.ExcelFormatUtils;
import com.subsidy.util.JwtUtil; import com.subsidy.util.JwtUtil;
import com.subsidy.util.Localstorage; import com.subsidy.util.Localstorage;
...@@ -63,11 +64,13 @@ import com.subsidy.vo.administer.OperatorsVO; ...@@ -63,11 +64,13 @@ import com.subsidy.vo.administer.OperatorsVO;
import com.subsidy.vo.administer.PermissionsVO; import com.subsidy.vo.administer.PermissionsVO;
import com.subsidy.vo.classdict.ClassDetailVO; import com.subsidy.vo.classdict.ClassDetailVO;
import com.subsidy.vo.done.GetMaxScoreVO; import com.subsidy.vo.done.GetMaxScoreVO;
import com.subsidy.vo.done.TestScoreInfoVO;
import com.subsidy.vo.member.ClassSignVO; import com.subsidy.vo.member.ClassSignVO;
import com.subsidy.vo.sign.AnswerRecordVO; import com.subsidy.vo.sign.AnswerRecordVO;
import com.subsidy.vo.vod.ClassVodCompleteInfoVO; import com.subsidy.vo.vod.ClassVodCompleteInfoVO;
import com.subsidy.vo.vod.DayInfoItemVO; import com.subsidy.vo.vod.DayInfoItemVO;
import com.subsidy.vo.vod.GetMemberStudyInfoVO; import com.subsidy.vo.vod.GetMemberStudyInfoVO;
import net.bytebuddy.description.modifier.SynchronizationState;
import net.sourceforge.pinyin4j.PinyinHelper; import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType; import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat; import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
...@@ -91,8 +94,11 @@ import org.apache.poi.xssf.streaming.SXSSFWorkbook; ...@@ -91,8 +94,11 @@ import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
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.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
...@@ -118,9 +124,6 @@ import java.util.Date; ...@@ -118,9 +124,6 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
...@@ -179,6 +182,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -179,6 +182,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
@Autowired @Autowired
private RedisUtil redisUtil; private RedisUtil redisUtil;
@Autowired
private MongoTemplate mongoTemplate;
public LoginVO login(AdministerDO administerDO) { public LoginVO login(AdministerDO administerDO) {
LoginVO loginVO = new LoginVO(); LoginVO loginVO = new LoginVO();
...@@ -197,13 +203,18 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -197,13 +203,18 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
redisUtil.set(RedisPrefixConstant.SUBSIDY_ADMINISTER_PREFIX + administerDO.getAccountName(), administerDO1); redisUtil.set(RedisPrefixConstant.SUBSIDY_ADMINISTER_PREFIX + administerDO.getAccountName(), administerDO1);
} }
if ("0".equals(administerDO1.getStatus())){ if ("0".equals(administerDO1.getStatus())) {
throw new HttpException(10013); throw new HttpException(10013);
} }
/** /**
* 最近5次都输入失败,5分钟后再验证 待优化 * 最近5次都输入失败,5分钟后再验证 待优化
*/ */
List<OprAdmDictDO> oprAdmDictDOS = oprAdmDictMapper.getLoginInfo(administerDO1.getId()); Query query = new Query(Criteria.where("userId").is(1).and("createDate").gte(System.currentTimeMillis()-5*60*1000+""));//可累加条件
query.with(Sort.by("createDate").descending());
List<OprAdmDictDO> oprAdmDictDOS = mongoTemplate.find(query, OprAdmDictDO.class);
//查mysql逻辑
//List<OprAdmDictDO> oprAdmDictDOS = oprAdmDictMapper.getLoginInfo(administerDO1.getId());
boolean flag = false; boolean flag = false;
for (int i = 0; i < oprAdmDictDOS.size(); i++) { for (int i = 0; i < oprAdmDictDOS.size(); i++) {
...@@ -217,7 +228,6 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -217,7 +228,6 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
throw new HttpException(10016); throw new HttpException(10016);
} }
if (null != administerDO1) { if (null != administerDO1) {
if (administerDO.getPassword().equals(administerDO1.getPassword())) { if (administerDO.getPassword().equals(administerDO1.getPassword())) {
String token = JwtUtil.generateToken(administerDO1.getId(), ConstantUtils.ADMINISTER_TERMINATE); String token = JwtUtil.generateToken(administerDO1.getId(), ConstantUtils.ADMINISTER_TERMINATE);
...@@ -226,7 +236,12 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -226,7 +236,12 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
oprAdmDictDO.setUserId(administerDO1.getId()); oprAdmDictDO.setUserId(administerDO1.getId());
oprAdmDictDO.setOprType("登录"); oprAdmDictDO.setOprType("登录");
oprAdmDictDO.setResult(1); oprAdmDictDO.setResult(1);
oprAdmDictMapper.insert(oprAdmDictDO); oprAdmDictDO.setCreateDate(System.currentTimeMillis()+"");
oprAdmDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
oprAdmDictDO.setUserName(administerDO1.getUserName());
oprAdmDictDO.setCompanyId(administerDO1.getCompanyId());
//oprAdmDictMapper.insert(oprAdmDictDO);
mongoTemplate.insert(oprAdmDictDO);
loginVO.setToken(token); loginVO.setToken(token);
return loginVO; return loginVO;
} else { } else {
...@@ -235,7 +250,12 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -235,7 +250,12 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
oprAdmDictDO.setUserId(administerDO1.getId()); oprAdmDictDO.setUserId(administerDO1.getId());
oprAdmDictDO.setOprType("登录"); oprAdmDictDO.setOprType("登录");
oprAdmDictDO.setResult(0); oprAdmDictDO.setResult(0);
oprAdmDictMapper.insert(oprAdmDictDO); //oprAdmDictMapper.insert(oprAdmDictDO);
oprAdmDictDO.setCreateDate(System.currentTimeMillis()+"");
oprAdmDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
oprAdmDictDO.setUserName(administerDO1.getUserName());
oprAdmDictDO.setCompanyId(administerDO1.getCompanyId());
mongoTemplate.insert(oprAdmDictDO);
int i = 0; int i = 0;
...@@ -264,7 +284,6 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -264,7 +284,6 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
} }
} }
public AdministerPermissionVO getPermissions() { public AdministerPermissionVO getPermissions() {
AdministerPermissionVO administerPermissionVO = new AdministerPermissionVO(); AdministerPermissionVO administerPermissionVO = new AdministerPermissionVO();
...@@ -339,6 +358,10 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -339,6 +358,10 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
@Async @Async
public String deleteAdminister(AdministerDO administerDO) { public String deleteAdminister(AdministerDO administerDO) {
this.baseMapper.deleteById(administerDO.getId()); this.baseMapper.deleteById(administerDO.getId());
roleAdministerMappingMapper.delete(new QueryWrapper<RoleAdministerMappingDO>()
.lambda()
.eq(RoleAdministerMappingDO::getAdministerId, administerDO.getId()));
return ConstantUtils.DELETE_SUCCESS; return ConstantUtils.DELETE_SUCCESS;
} }
...@@ -360,7 +383,6 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -360,7 +383,6 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
return ConstantUtils.SET_SUCCESS; return ConstantUtils.SET_SUCCESS;
} }
public ClassSummaryVO classSummary(ClassDetailDTO classDetailDTO) { public ClassSummaryVO classSummary(ClassDetailDTO classDetailDTO) {
ClassSummaryVO classSummaryVO = new ClassSummaryVO(); ClassSummaryVO classSummaryVO = new ClassSummaryVO();
...@@ -387,55 +409,14 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -387,55 +409,14 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
/** /**
* 学生平均学习时长和平均学习次数 * 学生平均学习时长和平均学习次数
*/ */
ExecutorService executorService = Executors.newCachedThreadPool();
//多个任务
executorService.execute(() -> //总共学习课时数 + 学习时长
summaryTask1(classSummaryVO, classMemberMappingDOS, vodDictDOS));
executorService.execute(() -> //测试通过率
summaryTask2(classSummaryVO, classDictDO.getId()));
executorService.execute(() -> //签到总次数
summaryTask3(classSummaryVO, classDictDO.getId()));
executorService.execute(() -> //答疑数
summaryTask4(classSummaryVO, classDictDO.getId()));
//执行后不再接收新任务,如果里面有任务,就执行完
executorService.shutdown();
try {
while (true) {
//等待所有任务都结束了继续执行
if (executorService.isTerminated()) {
break;
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
return classSummaryVO;
}
public Future<ClassSummaryVO> summaryTask1(ClassSummaryVO classSummaryVO, List<ClassMemberMappingDO> classMemberMappingDOS, List<VodDictDO> vodDictDOS) {
int totalStudyVods = 0; int totalStudyVods = 0;
int totalStudyLength = 0; int totalStudyLength = 0;
//学生总共学习课时数 //学生总共学习课时数
for (VodDictDO vodDictDO : vodDictDOS) { for (VodDictDO vodDictDO : vodDictDOS) {
for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) { for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) {
List<VodPlayHistoryDO> vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper<VodPlayHistoryDO>() int totalLength = vodPlayHistoryMapper.memberVodTotalLength(classMemberMappingDO.getMemberId(), vodDictDO.getId());
.lambda() if (totalLength >= vodDictDO.getVodLength()) {
.eq(VodPlayHistoryDO::getMemberId, classMemberMappingDO.getMemberId()) totalStudyVods++;
.eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
.orderByDesc(VodPlayHistoryDO::getPlayRecord));
for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) {
totalStudyLength += vodPlayHistoryDO.getPlayLength();
}
if (vodPlayHistoryDOS.size() > 0) {
if (vodPlayHistoryDOS.get(0).getPlayRecord() >= vodDictDO.getVodLength() * 0.8) {
totalStudyVods++;
}
} }
} }
} }
...@@ -444,49 +425,27 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -444,49 +425,27 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
//平均完成时长 学生观看课程视频的全部时长/总人数 //平均完成时长 学生观看课程视频的全部时长/总人数
int avg = MathUtil.intDivCeil(totalStudyLength, classMemberMappingDOS.size()); int avg = MathUtil.intDivCeil(totalStudyLength, classMemberMappingDOS.size());
classSummaryVO.setAvgVodPlayLength(avg); classSummaryVO.setAvgVodPlayLength(avg);
return new AsyncResult<>(classSummaryVO);
}
public Future<ClassSummaryVO> summaryTask2(ClassSummaryVO classSummaryVO, Long classId) {
//测试通过率 //测试通过率
List<ExerciseDoneResultDO> exerciseDoneResultDOS = exerciseDoneResultMapper.selectList(new QueryWrapper<ExerciseDoneResultDO>() Integer passNum = exerciseDoneResultMapper.getClassTestPassRate(classDictDO.getId());
.lambda()
.eq(ExerciseDoneResultDO::getClassId, classId));
int passNum = 0;
for (ExerciseDoneResultDO exerciseDoneResultDO : exerciseDoneResultDOS) {
if (exerciseDoneResultDO.getRightCounts() >= exerciseDoneResultDO.getTotalCounts() * 0.6) {
passNum++;
}
}
classSummaryVO.setPassRate(MathUtil.intDivFloorPercent(passNum, classSummaryVO.getMemberCount())); classSummaryVO.setPassRate(MathUtil.intDivFloorPercent(passNum, classSummaryVO.getMemberCount()));
return new AsyncResult<>(classSummaryVO);
}
public Future<ClassSummaryVO> summaryTask3(ClassSummaryVO classSummaryVO, Long classId) {
//签到总次数 //签到总次数
long signCount = redisUtil.scan("subsidySignInfo*_classId_" + classId + "*").stream().count(); long signCount = redisUtil.scan("subsidySignInfo*:classId:" + classDictDO.getId() + "*").stream().count();
classSummaryVO.setAvgSignCount(MathUtil.intDivCeil(signCount, classSummaryVO.getMemberCount())); classSummaryVO.setAvgSignCount(MathUtil.intDivCeil(signCount, classSummaryVO.getMemberCount()));
return new AsyncResult<>(classSummaryVO);
}
public Future<ClassSummaryVO> summaryTask4(ClassSummaryVO classSummaryVO, Long classId) {
//答疑数 //答疑数
Integer count = answeringQuestionMapper.selectCount(new QueryWrapper<AnsweringQuestionDO>() Integer count = answeringQuestionMapper.selectCount(new QueryWrapper<AnsweringQuestionDO>()
.lambda() .lambda()
.eq(AnsweringQuestionDO::getClassId, classId)); .eq(AnsweringQuestionDO::getClassId, classDictDO.getId()));
classSummaryVO.setAnswerCount(count); classSummaryVO.setAnswerCount(count);
return new AsyncResult<>(classSummaryVO); return classSummaryVO;
} }
public IPage<ClassDetailVO> classDetail(ClassDetailDTO classDetailDTO) { public IPage<ClassDetailVO> classDetail(ClassDetailDTO classDetailDTO) {
Page pager = new Page(classDetailDTO.getPageNum(), classDetailDTO.getPageSize()); Page pager = new Page(classDetailDTO.getPageNum(), classDetailDTO.getPageSize());
IPage<ClassDetailVO> classDetailVOIPage = this.baseMapper.classMembers(pager, classDetailDTO.getId(), classDetailDTO.getUserName()); IPage<ClassDetailVO> classDetailVOIPage = this.baseMapper.classMembers(pager, classDetailDTO.getId(), classDetailDTO.getUserName());
List<ClassDetailVO> classDetailVOS = classDetailVOIPage.getRecords(); List<ClassDetailVO> classDetailVOS = classDetailVOIPage.getRecords();
...@@ -497,112 +456,59 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -497,112 +456,59 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
ClassDictDO classDictDO = classDictMapper.selectById(classDetailDTO.getId()); ClassDictDO classDictDO = classDictMapper.selectById(classDetailDTO.getId());
for (ClassDetailVO classDetailVO : classDetailVOS) { for (ClassDetailVO classDetailVO : classDetailVOS) {
//全部视频数
classDetailVO.setAllVodCounts(vodDictDOS.size());
/** /**
* 学生平均学习时长和平均学习次数 * 学生平均学习时长和平均学习次数
*/ */
ExecutorService cachedThreadPool = Executors.newCachedThreadPool(); //该学生完成了多少个
int i = 0;
//多个任务 int playLength = 0;
cachedThreadPool.execute(() -> ///该学生完成了多少个 学生成绩,学生进度 //该成员完成了几个视频
classDetailTask1(classDetailVO, vodDictDOS, classDictDO.getId(), classDetailVO.getId())); for (VodDictDO vodDictDO : vodDictDOS) {
cachedThreadPool.execute(() -> //答疑 int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classDetailVO.getId(), vodDictDO.getId());
classDetailTask2(classDetailVO, classDetailDTO)); if (totalPlayLength >= vodDictDO.getVodLength()) {
cachedThreadPool.execute(() -> //签到
classDetailTask3(classDetailVO, classDetailDTO));
//执行后不再接收新任务,如果里面有任务,就执行完
cachedThreadPool.shutdown();
try {
while (true) {
//等待所有任务都结束了继续执行
if (cachedThreadPool.isTerminated()) {
break;
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
classDetailVOIPage.setRecords(classDetailVOS);
return classDetailVOIPage;
}
public Future<ClassDetailVO> classDetailTask1(ClassDetailVO classDetailVO, List<VodDictDO> vodDictDOS, Long classId, Long memberId) {
//该学生完成了多少个
int i = 0;
int playLength = 0;
//该成员完成了几个视频
for (VodDictDO vodDictDO : vodDictDOS) {
List<VodPlayHistoryDO> vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper<VodPlayHistoryDO>()
.lambda()
.eq(VodPlayHistoryDO::getMemberId, memberId)
.eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
.orderByDesc(VodPlayHistoryDO::getPlayRecord));
if (vodPlayHistoryDOS.size() > 0) {
if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) {
i++; i++;
} }
playLength += totalPlayLength;
} }
//培训时长
classDetailVO.setTrainingLength(playLength);
for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) { //学生测试完成情况 多套卷子各返回最高成绩
playLength += vodPlayHistoryDO.getPlayLength(); List<GetMaxScoreVO> getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classDictDO.getId(), classDetailVO.getId());
} classDetailVO.setGetMaxScoreVOS(getMaxScoreVOS);
}
classDetailVO.setStudyVodCounts(i);
//学生测试完成情况 多套卷子各返回最高成绩
List<GetMaxScoreVO> getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classId, classDetailVO.getId());
classDetailVO.setGetMaxScoreVOS(getMaxScoreVOS);
Boolean flag = true; Boolean flag = true;
if (getMaxScoreVOS.size() > 0) { if (getMaxScoreVOS.size() > 0) {
for (GetMaxScoreVO getMaxScoreVO : getMaxScoreVOS) { for (GetMaxScoreVO getMaxScoreVO : getMaxScoreVOS) {
if (getMaxScoreVO.getScore() < 60) { if (getMaxScoreVO.getScore() < 60) {
flag = false; flag = false;
}
} }
} else {
flag = false;
} }
} else {
flag = false;
}
if (flag && i == vodDictDOS.size()) { //总评价
classDetailVO.setResult("合格"); classDetailVO.setResult(flag && i == vodDictDOS.size() ? "合格" : "不合格");
} else {
classDetailVO.setResult("不合格");
}
classDetailVO.setClassProcess(i + "/" + vodDictDOS.size());
//培训时长
classDetailVO.setTrainingLength(playLength);
return new AsyncResult<>(classDetailVO);
}
public Future<ClassDetailVO> classDetailTask2(ClassDetailVO classDetailVO, ClassDetailDTO classDetailDTO) {
//答疑 //课程进度
Integer count = answeringQuestionMapper.selectCount(new QueryWrapper<AnsweringQuestionDO>() classDetailVO.setClassProcess(i + "/" + vodDictDOS.size());
.lambda()
.eq(AnsweringQuestionDO::getAskId, classDetailVO.getId())
.eq(AnsweringQuestionDO::getClassId, classDetailDTO.getId()));
classDetailVO.setAskCounts(count);
return new AsyncResult<>(classDetailVO); //答疑
} Integer count = answeringQuestionMapper.selectCount(new QueryWrapper<AnsweringQuestionDO>()
.lambda()
.eq(AnsweringQuestionDO::getAskId, classDetailVO.getId())
.eq(AnsweringQuestionDO::getClassId, classDetailDTO.getId()));
classDetailVO.setAskCounts(count);
//签到次数
long set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId:" + classDetailVO.getId() + ":classId:" + classDetailDTO.getId() + "*").stream().count();
classDetailVO.setSignCounts(set);
public Future<ClassDetailVO> classDetailTask3(ClassDetailVO classDetailVO, ClassDetailDTO classDetailDTO) { }
////签到次数 classDetailVOIPage.setRecords(classDetailVOS);
long set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId_" + classDetailVO.getId() + "_classId_" + classDetailDTO.getId() + "*").stream().count(); return classDetailVOIPage;
classDetailVO.setSignCounts(set);
return new AsyncResult<>(classDetailVO);
} }
public List<ClassDetailVO> exportClassDetail(ClassDetailDTO classDetailDTO) throws Exception { public List<ClassDetailVO> exportClassDetail(ClassDetailDTO classDetailDTO) throws Exception {
...@@ -619,102 +525,69 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -619,102 +525,69 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
CompanyDictDO companyDictDO = companyDictMapper.selectById(classDictDO.getCompanyId()); CompanyDictDO companyDictDO = companyDictMapper.selectById(classDictDO.getCompanyId());
for (ClassDetailVO classDetailVO : classDetailVOS) { for (ClassDetailVO classDetailVO : classDetailVOS) {
//全部视频数
//classDetailVO.setAllVodCounts(vodDictDOS.size());
final ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
//多个任务
newCachedThreadPool.execute(() -> ///该学生完成了多少个 学生成绩,学生进度
exportClassDetailTask(classDetailVO, vodDictDOS, classDictDO.getId(), classDetailVO.getId()));
newCachedThreadPool.execute(() -> //答疑
classDetailTask2(classDetailVO, classDetailDTO));
newCachedThreadPool.execute(() -> //签到
classDetailTask3(classDetailVO, classDetailDTO));
//执行后不再接收新任务,如果里面有任务,就执行完
newCachedThreadPool.shutdown();
try {
while (true) {
//等待所有任务都结束了继续执行
if (newCachedThreadPool.isTerminated()) {
break;
}
}
} catch (Exception ex) { //该学生完成了多少个
ex.printStackTrace(); int i = 0;
int playLength = 0;
//该成员完成了几个视频
for (VodDictDO vodDictDO : vodDictDOS) {
int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classDetailVO.getId(), vodDictDO.getId());
if (totalPlayLength >= vodDictDO.getVodLength()) {
i++;
}
playLength += totalPlayLength;
} }
} //课程进度
classDetailVO.setClassProcess(i + "/" + vodDictDOS.size());
if (classDetailDTO.getFlag()) { //学生测试完成情况 多套卷子各返回最高成绩
CourseDictDO courseDictDO = courseDictMapper.selectById(classDictDO.getCourseId()); List<GetMaxScoreVO> getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classDictDO.getId(), classDetailVO.getId());
String studyDate = classDictDO.getStartDate() + " 至 " + classDictDO.getEndDate(); classDetailVO.setGetMaxScoreVOS(getMaxScoreVOS);
ExcelUtil.writeMemberExcel(companyDictDO.getCompanyName(), studyDate, courseDictDO.getCourseName(), "授课记录汇总表", classDetailVOS, ExcelFormatUtils.memberList);
}
return classDetailVOS;
}
public Future exportClassDetailTask(ClassDetailVO classDetailVO, List<VodDictDO> vodDictDOS, Long classId, Long memberId) { Boolean flag = true;
//该学生完成了多少个 StringBuilder stringBuilder = new StringBuilder();
int i = 0;
int playLength = 0;
//该成员完成了几个视频
for (VodDictDO vodDictDO : vodDictDOS) {
List<VodPlayHistoryDO> vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper<VodPlayHistoryDO>()
.lambda()
.eq(VodPlayHistoryDO::getMemberId, memberId)
.eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
.orderByDesc(VodPlayHistoryDO::getPlayRecord));
if (vodPlayHistoryDOS.size() > 0) { if (getMaxScoreVOS.size() > 0) {
if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) { for (GetMaxScoreVO getMaxScoreVO : getMaxScoreVOS) {
i++; stringBuilder.append(getMaxScoreVO.getPaperName() + ":" + getMaxScoreVO.getScore());
if (getMaxScoreVO.getScore() < 60) {
flag = false;
}
stringBuilder.append(" ");
} }
}
for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) { } else {
playLength += vodPlayHistoryDO.getPlayLength(); flag = false;
} }
}
//classDetailVO.setStudyVodCounts(i);
classDetailVO.setClassProcess(i + "/" + vodDictDOS.size());
//学生测试完成情况 多套卷子各返回最高成绩 //总评价
List<GetMaxScoreVO> getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classId, classDetailVO.getId()); classDetailVO.setResult(flag && i == vodDictDOS.size() ? "合格" : "不合格");
classDetailVO.setGetMaxScoreVOS(getMaxScoreVOS);
Boolean flag = true; classDetailVO.setScore(stringBuilder.toString());
StringBuilder stringBuilder = new StringBuilder(); //培训时长
classDetailVO.setTrainingLengthStr(MathUtil.secToTime(playLength));
if (getMaxScoreVOS.size() > 0) { //答疑
for (GetMaxScoreVO getMaxScoreVO : getMaxScoreVOS) { Integer count = answeringQuestionMapper.selectCount(new QueryWrapper<AnsweringQuestionDO>()
stringBuilder.append(getMaxScoreVO.getPaperName() + ":" + getMaxScoreVO.getScore()); .lambda()
if (getMaxScoreVO.getScore() < 60) { .eq(AnsweringQuestionDO::getAskId, classDetailVO.getId())
flag = false; .eq(AnsweringQuestionDO::getClassId, classDetailDTO.getId()));
} classDetailVO.setAskCounts(count);
stringBuilder.append(" ");
}
} else { //签到次数
flag = false; long set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId:" + classDetailVO.getId() + ":classId:" + classDetailDTO.getId() + "*").stream().count();
} classDetailVO.setSignCounts(set);
if (flag && i == vodDictDOS.size()) {
classDetailVO.setResult("合格");
} else {
classDetailVO.setResult("不合格");
} }
classDetailVO.setScore(stringBuilder.toString()); if (classDetailDTO.getFlag()) {
CourseDictDO courseDictDO = courseDictMapper.selectById(classDictDO.getCourseId());
//培训时长 String studyDate = classDictDO.getStartDate() + " 至 " + classDictDO.getEndDate();
classDetailVO.setTrainingLength(playLength); ExcelUtil.writeMemberExcel(companyDictDO.getCompanyName(), studyDate, courseDictDO.getCourseName(), "授课记录汇总表", classDetailVOS, ExcelFormatUtils.memberList);
classDetailVO.setTrainingLengthStr(MathUtil.secToTime(playLength)); }
return new AsyncResult(classDetailVO); return classDetailVOS;
} }
public IPage<ClassSignVO> signDetail(ClassDetailDTO classDetailDTO) { public IPage<ClassSignVO> signDetail(ClassDetailDTO classDetailDTO) {
...@@ -729,83 +602,45 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -729,83 +602,45 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
for (ClassSignVO classSignVO : classSignVOS) { for (ClassSignVO classSignVO : classSignVOS) {
ExecutorService newCachedThreadPool = Executors.newCachedThreadPool(); //该学生完成了多少个
int i = 0;
//多个任务 int playLength = 0;
newCachedThreadPool.execute(() -> //全部视频数 //该成员完成了几个视频
classSignVO.setAllVodCounts(vodDictDOS.size())); for (VodDictDO vodDictDO : vodDictDOS) {
newCachedThreadPool.execute(() -> //完成率,完成情况 int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classSignVO.getId(), vodDictDO.getId());
signDetailsTask1(vodDictDOS, classSignVO)); if (totalPlayLength >= vodDictDO.getVodLength()) {
newCachedThreadPool.execute(() -> //签到,签到时间 i++;
signDetailsTask2(classSignVO, classDetailDTO));
//执行后不再接收新任务,如果里面有任务,就执行完
newCachedThreadPool.shutdown();
try {
while (true) {
//等待所有任务都结束了继续执行
if (newCachedThreadPool.isTerminated()) {
break;
}
} }
playLength += totalPlayLength;
} catch (Exception ex) {
ex.printStackTrace();
} }
} //课程进度
classSignVOIPage.setRecords(classSignVOS); classSignVO.setClassProcess(i + "/" + vodDictDOS.size());
return classSignVOIPage;
}
public Future signDetailsTask1(List<VodDictDO> vodDictDOS, ClassSignVO classSignVO) { //完成率
String percent = MathUtil.getPercentAvgIndexWithPercent(new BigDecimal(i), new BigDecimal(vodDictDOS.size()));
classSignVO.setPercent(percent);
//该学生完成了多少个 //培训时长
int i = 0; classSignVO.setTrainingLength(playLength);
int playLength = 0; classSignVO.setTrainingLengthStr(MathUtil.secToTime(playLength));
//该成员完成了几个视频
for (VodDictDO vodDictDO : vodDictDOS) {
List<VodPlayHistoryDO> vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper<VodPlayHistoryDO>()
.lambda()
.eq(VodPlayHistoryDO::getMemberId, classSignVO.getId())
.eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
.orderByDesc(VodPlayHistoryDO::getPlayRecord));
if (vodPlayHistoryDOS.size() > 0) { //签到
if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) { Set<SignInRecordDO> set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId:" + classSignVO.getId() + ":classId:" + classDetailDTO.getId() + "*");
i++; classSignVO.setSignCounts(set.size());
}
StringBuilder stringBuilder = new StringBuilder();
//签到时间
for (SignInRecordDO signInRecordDO : set) {
stringBuilder.append(signInRecordDO.getSignInDate().toString().replace("T", " ")).append(";");
} }
for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) { if (StringUtils.isNotBlank(stringBuilder.toString())) {
playLength += vodPlayHistoryDO.getPlayLength(); String signInDate = stringBuilder.toString().substring(0, stringBuilder.length() - 1);
classSignVO.setSignInDateList(signInDate);
} }
}
classSignVO.setStudyVodCounts(i);
classSignVO.setClassProcess(i + "/" + vodDictDOS.size());
//完成率
String percent = MathUtil.getPercentAvgIndexWithPercent(new BigDecimal(i), new BigDecimal(vodDictDOS.size()));
classSignVO.setPercent(percent);
//培训时长
classSignVO.setTrainingLength(playLength);
classSignVO.setTrainingLengthStr(MathUtil.secToTime(playLength));
return new AsyncResult<>(classSignVO);
}
public Future signDetailsTask2(ClassSignVO classSignVO, ClassDetailDTO classDetailDTO) {
//签到
Set<SignInRecordDO> set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId_" + classSignVO.getId() + "_classId_" + classDetailDTO.getId() + "*");
classSignVO.setSignCounts(set.size());
StringBuilder stringBuilder = new StringBuilder();
//签到时间
for (SignInRecordDO signInRecordDO : set) {
stringBuilder.append(signInRecordDO.getSignInDate().toString().replace("T", " ")).append(";");
} }
if (StringUtils.isNotBlank(stringBuilder.toString())) { classSignVOIPage.setRecords(classSignVOS);
String signInDate = stringBuilder.toString().substring(0, stringBuilder.length() - 1); return classSignVOIPage;
classSignVO.setSignInDateList(signInDate);
}
return new AsyncResult<>(classSignVO);
} }
public List<ClassSignVO> exportSignDetail(ClassDetailDTO classDetailDTO) throws Exception { public List<ClassSignVO> exportSignDetail(ClassDetailDTO classDetailDTO) throws Exception {
...@@ -819,29 +654,40 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -819,29 +654,40 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
for (ClassSignVO classSignVO : classSignVOS) { for (ClassSignVO classSignVO : classSignVOS) {
final ExecutorService newCachedThreadPool = Executors.newCachedThreadPool(); //该学生完成了多少个
int i = 0;
//多个任务 int playLength = 0;
newCachedThreadPool.execute(() -> //全部视频数 //该成员完成了几个视频
classSignVO.setAllVodCounts(vodDictDOS.size())); for (VodDictDO vodDictDO : vodDictDOS) {
newCachedThreadPool.execute(() -> //完成率,完成情况 int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classSignVO.getId(), vodDictDO.getId());
signDetailsTask1(vodDictDOS, classSignVO)); if (totalPlayLength >= vodDictDO.getVodLength()) {
newCachedThreadPool.execute(() -> //签到,签到时间 i++;
signDetailsTask2(classSignVO, classDetailDTO));
//执行后不再接收新任务,如果里面有任务,就执行完
newCachedThreadPool.shutdown();
try {
while (true) {
//等待所有任务都结束了继续执行
if (newCachedThreadPool.isTerminated()) {
break;
}
} }
playLength += totalPlayLength;
}
classSignVO.setClassProcess(i + "/" + vodDictDOS.size());
} catch (Exception ex) { //完成率
ex.printStackTrace(); String percent = MathUtil.getPercentAvgIndexWithPercent(new BigDecimal(i), new BigDecimal(vodDictDOS.size()));
classSignVO.setPercent(percent);
//培训时长
classSignVO.setTrainingLengthStr(MathUtil.secToTime(playLength));
//签到
Set<SignInRecordDO> set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId:" + classSignVO.getId() + ":classId:" + classDetailDTO.getId() + "*");
classSignVO.setSignCounts(set.size());
StringBuilder stringBuilder = new StringBuilder();
//签到时间
for (SignInRecordDO signInRecordDO : set) {
stringBuilder.append(signInRecordDO.getSignInDate().toString().replace("T", " ")).append(";");
} }
if (StringUtils.isNotBlank(stringBuilder.toString())) {
String signInDate = stringBuilder.toString().substring(0, stringBuilder.length() - 1);
classSignVO.setSignInDateList(signInDate);
}
} }
if (classDetailDTO.getFlag()) { if (classDetailDTO.getFlag()) {
...@@ -862,47 +708,26 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -862,47 +708,26 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
IPage<ExerciseTestVO> exerciseTestVOIPage = this.baseMapper.exerciseTest(pager, classDetailDTO.getId(), classDetailDTO.getUserName()); IPage<ExerciseTestVO> exerciseTestVOIPage = this.baseMapper.exerciseTest(pager, classDetailDTO.getId(), classDetailDTO.getUserName());
List<ExerciseTestVO> classSignVOS = exerciseTestVOIPage.getRecords(); List<ExerciseTestVO> classSignVOS = exerciseTestVOIPage.getRecords();
ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
for (ExerciseTestVO exerciseTestVO : classSignVOS) { for (ExerciseTestVO exerciseTestVO : classSignVOS) {
newCachedThreadPool.execute(() -> //签到,签到时间 //学生测试完成情况
exerciseTestTask(exerciseTestVO, classDetailDTO.getId(), exerciseTestVO.getPaperId())); TestScoreInfoVO testScoreInfoVO = exerciseDoneResultMapper.testScoreInfo(classDetailDTO.getPaperId(), exerciseTestVO.getId());
} exerciseTestVO.setPaperId(exerciseTestVO.getPaperId());
//执行后不再接收新任务,如果里面有任务,就执行完 if (null != testScoreInfoVO) {
newCachedThreadPool.shutdown(); exerciseTestVO.setScore(testScoreInfoVO.getScore());
try { exerciseTestVO.setResult(testScoreInfoVO.getResult());
while (true) { //测评次数
//等待所有任务都结束了继续执行 exerciseTestVO.setCount(testScoreInfoVO.getCnt());
if (newCachedThreadPool.isTerminated()) { } else {
break; exerciseTestVO.setScore(0);
} exerciseTestVO.setResult("不合格");
exerciseTestVO.setCount(0);
} }
} catch (Exception ex) {
ex.printStackTrace();
} }
exerciseTestVOIPage.setRecords(classSignVOS); exerciseTestVOIPage.setRecords(classSignVOS);
return exerciseTestVOIPage; return exerciseTestVOIPage;
} }
public void exerciseTestTask(ExerciseTestVO exerciseTestVO, Long classId, Long paperId) {
//学生测试完成情况
List<GetMemberPapersVO> exerciseDoneResultDOs = exerciseDoneResultMapper.queryExerciseDoneResult(exerciseTestVO.getId(), classId, paperId);
exerciseTestVO.setPaperId(exerciseTestVO.getPaperId());
if (exerciseDoneResultDOs.size() > 0) {
exerciseTestVO.setScore(exerciseDoneResultDOs.get(0).getScore());
exerciseTestVO.setResult(exerciseDoneResultDOs.get(0).getResult());
//测评次数
exerciseTestVO.setCount(exerciseDoneResultDOs.size());
} else {
exerciseTestVO.setScore(0);
exerciseTestVO.setResult("不合格");
exerciseTestVO.setCount(0);
}
}
public List<ExerciseTestVO> exportExerciseTest(ClassDetailDTO classDetailDTO) throws Exception { public List<ExerciseTestVO> exportExerciseTest(ClassDetailDTO classDetailDTO) throws Exception {
Page pager = new Page(0, -1L); Page pager = new Page(0, -1L);
...@@ -912,24 +737,20 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -912,24 +737,20 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
//课程详情 //课程详情
ClassDictDO classDictDO = classDictMapper.selectById(classDetailDTO.getId()); ClassDictDO classDictDO = classDictMapper.selectById(classDetailDTO.getId());
ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
for (ExerciseTestVO exerciseTestVO : exerciseTestVOS) { for (ExerciseTestVO exerciseTestVO : exerciseTestVOS) {
//学生测试完成情况
newCachedThreadPool.execute(() -> //签到,签到时间 TestScoreInfoVO testScoreInfoVO = exerciseDoneResultMapper.testScoreInfo(classDetailDTO.getPaperId(), exerciseTestVO.getId());
exerciseTestTask(exerciseTestVO, classDetailDTO.getId(), exerciseTestVO.getPaperId())); exerciseTestVO.setPaperId(exerciseTestVO.getPaperId());
} if (null != testScoreInfoVO) {
//执行后不再接收新任务,如果里面有任务,就执行完 exerciseTestVO.setScore(testScoreInfoVO.getScore());
newCachedThreadPool.shutdown(); exerciseTestVO.setResult(testScoreInfoVO.getResult());
try { //测评次数
while (true) { exerciseTestVO.setCount(testScoreInfoVO.getCnt());
//等待所有任务都结束了继续执行 } else {
if (newCachedThreadPool.isTerminated()) { exerciseTestVO.setScore(0);
break; exerciseTestVO.setResult("不合格");
} exerciseTestVO.setCount(0);
} }
} catch (Exception ex) {
ex.printStackTrace();
} }
if (classDetailDTO.getFlag()) { if (classDetailDTO.getFlag()) {
...@@ -976,6 +797,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -976,6 +797,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
//获取班级成员 //获取班级成员
List<Long> memberIds = classMemberMappingMapper.getClassMembers(classVodInfoDTO.getClassId()); List<Long> memberIds = classMemberMappingMapper.getClassMembers(classVodInfoDTO.getClassId());
//获取课程下的视频
List<VodDictDO> vodDictDOS = vodDictMapper.getCourseVods(classVodInfoDTO.getCourseId(), classVodInfoDTO.getVodName()); List<VodDictDO> vodDictDOS = vodDictMapper.getCourseVods(classVodInfoDTO.getCourseId(), classVodInfoDTO.getVodName());
for (VodDictDO vodDictDO : vodDictDOS) { for (VodDictDO vodDictDO : vodDictDOS) {
//获取这个视频的学习人数和平均学习时长 //获取这个视频的学习人数和平均学习时长
...@@ -1007,14 +829,17 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -1007,14 +829,17 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
for (ClassDailyInfoVO classDailyInfoVO : classDailyInfoVOS) { for (ClassDailyInfoVO classDailyInfoVO : classDailyInfoVOS) {
List<DayInfoItemVO> dayInfoItemVOS = new ArrayList<>(); List<DayInfoItemVO> dayInfoItemVOS = new ArrayList<>();
int total = 0;
for (GetMemberStudyInfoVO getMemberStudyInfoVO : getMemberStudyInfoVOS) { for (GetMemberStudyInfoVO getMemberStudyInfoVO : getMemberStudyInfoVOS) {
if (classDailyInfoVO.getId().equals(getMemberStudyInfoVO.getMemberId())) { if (classDailyInfoVO.getId().equals(getMemberStudyInfoVO.getMemberId())) {
DayInfoItemVO dayInfoItemVO = new DayInfoItemVO(); DayInfoItemVO dayInfoItemVO = new DayInfoItemVO();
dayInfoItemVO.setStudyDate(getMemberStudyInfoVO.getStudyDate()); dayInfoItemVO.setStudyDate(getMemberStudyInfoVO.getStudyDate());
dayInfoItemVO.setTotalLength(getMemberStudyInfoVO.getPlayLength()); dayInfoItemVO.setTotalLength(getMemberStudyInfoVO.getPlayLength());
total += getMemberStudyInfoVO.getPlayLength();
dayInfoItemVOS.add(dayInfoItemVO); dayInfoItemVOS.add(dayInfoItemVO);
} }
} }
classDailyInfoVO.setTotal(total);
classDailyInfoVO.setDayInfoItemVOS(dayInfoItemVOS); classDailyInfoVO.setDayInfoItemVOS(dayInfoItemVOS);
} }
return classDailyInfoVOIPage; return classDailyInfoVOIPage;
...@@ -1027,6 +852,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -1027,6 +852,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
List<String> title = new ArrayList<>(); List<String> title = new ArrayList<>();
title.add("姓名"); title.add("姓名");
title.addAll(findDaysStr(classDailyInfoDTO.getStartDate(), classDailyInfoDTO.getEndDate())); title.addAll(findDaysStr(classDailyInfoDTO.getStartDate(), classDailyInfoDTO.getEndDate()));
title.add("合计总时长");
//获取班级成员 //获取班级成员
IPage<ClassDailyInfoVO> classDailyInfoVOIPage = classMemberMappingMapper.getClassMembersWithName(pager, classDailyInfoDTO.getClassId(), classDailyInfoDTO.getUserName()); IPage<ClassDailyInfoVO> classDailyInfoVOIPage = classMemberMappingMapper.getClassMembersWithName(pager, classDailyInfoDTO.getClassId(), classDailyInfoDTO.getUserName());
...@@ -1095,16 +921,21 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -1095,16 +921,21 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
HashMap<String, Integer> hashMap1 = hashMap.get(data); HashMap<String, Integer> hashMap1 = hashMap.get(data);
Cell namecell = r.createCell(a.getAndIncrement()); Cell namecell = r.createCell(a.getAndIncrement());
namecell.setCellValue(memberMapper.selectById(data).getUserName()); namecell.setCellValue(memberMapper.selectById(data).getUserName());
dates.forEach(field -> { int total = 0 ;
if (!field.equals("姓名")) { for (String date : dates){
if (!date.equals("姓名")&&!"合计总时长".equals(date)) {
Cell cell1 = r.createCell(a.getAndIncrement()); Cell cell1 = r.createCell(a.getAndIncrement());
if (null != hashMap1) { if (null != hashMap1) {
cell1.setCellValue(null == hashMap1.get(field) ? "00:00:00" : MathUtil.secToTime(hashMap1.get(field))); total += null == hashMap1.get(date)?0:hashMap1.get(date);
cell1.setCellValue(null == hashMap1.get(date) ? "00:00:00" : MathUtil.secToTime(hashMap1.get(date)));
} else { } else {
cell1.setCellValue("00:00:00"); cell1.setCellValue("00:00:00");
} }
} }
}); }
Cell totalCell = r.createCell(a.getAndIncrement());
totalCell.setCellValue(MathUtil.secToTime(total));
}); });
} }
String fileName = String.valueOf(new Date().getTime()); String fileName = String.valueOf(new Date().getTime());
...@@ -1916,11 +1747,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -1916,11 +1747,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
newCell = dataRow.createCell(6); newCell = dataRow.createCell(6);
newCell.setCellStyle(cellStyle); newCell.setCellStyle(cellStyle);
if (exerciseTestVO.getScore() >= 60) { newCell.setCellValue(exerciseTestVO.getScore() >= 60 ? "合格" : "不合格");
newCell.setCellValue("合格");
} else {
newCell.setCellValue("不合格");
}
rowIndex++; rowIndex++;
seq++; seq++;
......
...@@ -29,19 +29,16 @@ public class AnsweringQuestionServiceImpl extends ServiceImpl<AnsweringQuestionM ...@@ -29,19 +29,16 @@ public class AnsweringQuestionServiceImpl extends ServiceImpl<AnsweringQuestionM
return this.baseMapper.getCourseQuestion(pager, getCourseQuestionDTO.getClassId(), getCourseQuestionDTO.getMemberId()); return this.baseMapper.getCourseQuestion(pager, getCourseQuestionDTO.getClassId(), getCourseQuestionDTO.getMemberId());
} }
@Async
public String addQuestion(AnsweringQuestionDO answeringQuestionDO) { public String addQuestion(AnsweringQuestionDO answeringQuestionDO) {
this.baseMapper.insert(answeringQuestionDO); this.baseMapper.insert(answeringQuestionDO);
return ConstantUtils.ADD_SUCCESS; return ConstantUtils.ADD_SUCCESS;
} }
@Async
public String deleteQuestion(AnsweringQuestionDO answeringQuestionDO) { public String deleteQuestion(AnsweringQuestionDO answeringQuestionDO) {
this.baseMapper.deleteById(answeringQuestionDO.getId()); this.baseMapper.deleteById(answeringQuestionDO.getId());
return ConstantUtils.DELETE_SUCCESS; return ConstantUtils.DELETE_SUCCESS;
} }
@Async
public String updateQuestion(AnsweringQuestionDO answeringQuestionDO) { public String updateQuestion(AnsweringQuestionDO answeringQuestionDO) {
this.baseMapper.updateById(answeringQuestionDO); this.baseMapper.updateById(answeringQuestionDO);
return ConstantUtils.SET_SUCCESS; return ConstantUtils.SET_SUCCESS;
......
...@@ -56,11 +56,9 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, CategoryDO> ...@@ -56,11 +56,9 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, CategoryDO>
} }
} }
@Async
public String addCategory(CategoryDO categoryDO) { public String addCategory(CategoryDO categoryDO) {
int count = 0; int count;
if (null == categoryDO.getCompanyId()) { if (null == categoryDO.getCompanyId()) {
count = this.baseMapper.selectCount(new QueryWrapper<CategoryDO>() count = this.baseMapper.selectCount(new QueryWrapper<CategoryDO>()
...@@ -82,20 +80,20 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, CategoryDO> ...@@ -82,20 +80,20 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, CategoryDO>
return ConstantUtils.ADD_SUCCESS; return ConstantUtils.ADD_SUCCESS;
} }
@Async
public String deleteCategory(CategoryDO categoryDO) { public String deleteCategory(CategoryDO categoryDO) {
this.baseMapper.deleteById(categoryDO.getId()); this.baseMapper.deleteById(categoryDO.getId());
return ConstantUtils.DELETE_SUCCESS; return ConstantUtils.DELETE_SUCCESS;
} }
@Async
public String updateCategory(CategoryDO categoryDO) { public String updateCategory(CategoryDO categoryDO) {
int count = this.baseMapper.selectCount(new QueryWrapper<CategoryDO>() int count = this.baseMapper.selectCount(new QueryWrapper<CategoryDO>()
.lambda() .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); throw new HttpException(90001);
} }
......
...@@ -57,7 +57,6 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict ...@@ -57,7 +57,6 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
} }
@Transactional @Transactional
@Async
public String deleteClasses(ClassDictDO classDictDO) { public String deleteClasses(ClassDictDO classDictDO) {
this.baseMapper.deleteById(classDictDO.getId()); this.baseMapper.deleteById(classDictDO.getId());
...@@ -67,7 +66,6 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict ...@@ -67,7 +66,6 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
return ConstantUtils.DELETE_SUCCESS; return ConstantUtils.DELETE_SUCCESS;
} }
@Async
public String addClass(AddClassDTO addClassDTO) { public String addClass(AddClassDTO addClassDTO) {
//查看当前登录人的角色 //查看当前登录人的角色
...@@ -79,17 +77,12 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict ...@@ -79,17 +77,12 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
ClassDictDO classDictDO = new ClassDictDO(); ClassDictDO classDictDO = new ClassDictDO();
BeanUtils.copyProperties(addClassDTO,classDictDO); BeanUtils.copyProperties(addClassDTO,classDictDO);
if (count>0){ classDictDO.setClassType(count>0?"平台支持":"企业自建");
classDictDO.setClassType("平台支持");
}else{
classDictDO.setClassType("企业自建");
}
this.baseMapper.insert(classDictDO); this.baseMapper.insert(classDictDO);
return ConstantUtils.ADD_SUCCESS; return ConstantUtils.ADD_SUCCESS;
} }
@Async
public String updateClass(ClassDictDO classDictDO) { public String updateClass(ClassDictDO classDictDO) {
this.baseMapper.updateById(classDictDO); this.baseMapper.updateById(classDictDO);
return ConstantUtils.SET_SUCCESS; return ConstantUtils.SET_SUCCESS;
...@@ -99,7 +92,6 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict ...@@ -99,7 +92,6 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
return this.baseMapper.selectById(classDictDO.getId()); return this.baseMapper.selectById(classDictDO.getId());
} }
@Async
public String removeMember(ClassMemberMappingDO classMemberMappingDO) { public String removeMember(ClassMemberMappingDO classMemberMappingDO) {
classMemberMappingMapper.delete(new QueryWrapper<ClassMemberMappingDO>() classMemberMappingMapper.delete(new QueryWrapper<ClassMemberMappingDO>()
.lambda() .lambda()
...@@ -125,7 +117,6 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict ...@@ -125,7 +117,6 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
return ConstantUtils.ADD_SUCCESS; return ConstantUtils.ADD_SUCCESS;
} }
@Async
public String batchSms(ClassDictDO classDictDO){ public String batchSms(ClassDictDO classDictDO){
ClassDictDO classDictDO1 = this.baseMapper.selectById(classDictDO.getId()); ClassDictDO classDictDO1 = this.baseMapper.selectById(classDictDO.getId());
......
...@@ -79,7 +79,7 @@ public class ClassHourDictServiceImpl extends ServiceImpl<ClassHourDictMapper, C ...@@ -79,7 +79,7 @@ public class ClassHourDictServiceImpl extends ServiceImpl<ClassHourDictMapper, C
if (classHourDictDO == null) { if (classHourDictDO == null) {
pollingGetVO.setBool(true); pollingGetVO.setBool(true);
} else { } else {
if (total + vodPlayHistoryDO.getPlayLength() <= classHourDictDO.getClassHour() * 60 * 60) { if (total + vodPlayHistoryDO.getPlayLength() <= classHourDictDO.getClassHour() * 3600) {
pollingGetVO.setBool(false); pollingGetVO.setBool(false);
} else { } else {
pollingGetVO.setBool(true); pollingGetVO.setBool(true);
......
...@@ -59,14 +59,15 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa ...@@ -59,14 +59,15 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
//判断该用户的角色 //判断该用户的角色
Integer count = roleAdministerMappingMapper.selectCount(new QueryWrapper<RoleAdministerMappingDO>() Integer count = roleAdministerMappingMapper.selectCount(new QueryWrapper<RoleAdministerMappingDO>()
.lambda() .lambda()
.eq(RoleAdministerMappingDO::getAdministerId,operatorsDTO.getId()) .eq(RoleAdministerMappingDO::getAdministerId, operatorsDTO.getId())
.eq(RoleAdministerMappingDO::getRoleId,1)); .eq(RoleAdministerMappingDO::getRoleId, 1));
if (count > 0){ if (count > 0) {
//后台管理员
operatorsDTO.setId(null); 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) { public String addOperator(AddCompanyDTO addCompanyDTO) {
...@@ -75,16 +76,20 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa ...@@ -75,16 +76,20 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
.lambda() .lambda()
.eq(CompanyDictDO::getCompanyName, addCompanyDTO.getAccountName())); .eq(CompanyDictDO::getCompanyName, addCompanyDTO.getAccountName()));
if (count > 0 ) {
throw new HttpException(20002);
}
Integer count1 = administerMapper.selectCount(new QueryWrapper<AdministerDO>() Integer count1 = administerMapper.selectCount(new QueryWrapper<AdministerDO>()
.lambda() .lambda()
.eq(AdministerDO::getAccountName, addCompanyDTO.getAccountName())); .eq(AdministerDO::getAccountName, addCompanyDTO.getAccountName()));
if (count > 0 || count1>0) { if (count1 > 0) {
throw new HttpException(20002); throw new HttpException(20002);
} }
CompanyDictDO companyDictDO =new CompanyDictDO(); CompanyDictDO companyDictDO = new CompanyDictDO();
BeanUtils.copyProperties(addCompanyDTO,companyDictDO); BeanUtils.copyProperties(addCompanyDTO, companyDictDO);
this.baseMapper.insert(companyDictDO); this.baseMapper.insert(companyDictDO);
AdministerDO administerDO = new AdministerDO(); AdministerDO administerDO = new AdministerDO();
...@@ -108,7 +113,6 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa ...@@ -108,7 +113,6 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
departmentDictMapper.insert(departmentDictDO); departmentDictMapper.insert(departmentDictDO);
//class_hour_dict //class_hour_dict
ClassHourDictDO classHourDictDO2 = new ClassHourDictDO(); ClassHourDictDO classHourDictDO2 = new ClassHourDictDO();
classHourDictDO2.setCompanyId(companyDictDO.getId()); classHourDictDO2.setCompanyId(companyDictDO.getId());
classHourDictDO2.setStatus(0); classHourDictDO2.setStatus(0);
...@@ -119,46 +123,44 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa ...@@ -119,46 +123,44 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
classHourDictDO2.setRepeatStatus(0); classHourDictDO2.setRepeatStatus(0);
classHourDictDO2.setRepeatTime(3); 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; return ConstantUtils.ADD_SUCCESS;
} }
@Async
public String deleteAdminister(CompanyDictDO companyDictDO) { public String deleteAdminister(CompanyDictDO companyDictDO) {
this.baseMapper.deleteById(companyDictDO.getId()); this.baseMapper.deleteById(companyDictDO.getId());
administerMapper.delete(new QueryWrapper<AdministerDO>() administerMapper.delete(new QueryWrapper<AdministerDO>()
.lambda() .lambda()
.eq(AdministerDO::getCompanyId,companyDictDO.getId())); .eq(AdministerDO::getCompanyId, companyDictDO.getId()));
redisUtil.del(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX+companyDictDO.getId());
return ConstantUtils.DELETE_SUCCESS; return ConstantUtils.DELETE_SUCCESS;
} }
@Async
public String updateAdminister(AddCompanyDTO addCompanyDTO) { public String updateAdminister(AddCompanyDTO addCompanyDTO) {
CompanyDictDO companyDictDO = new CompanyDictDO(); CompanyDictDO companyDictDO = new CompanyDictDO();
BeanUtils.copyProperties(addCompanyDTO,companyDictDO); BeanUtils.copyProperties(addCompanyDTO, companyDictDO);
this.baseMapper.updateById(companyDictDO); this.baseMapper.updateById(companyDictDO);
//查找企业管理员 //查找企业管理员
AdministerDO administerDO = administerMapper.selectOne(new QueryWrapper<AdministerDO>() AdministerDO administerDO = administerMapper.selectOne(new QueryWrapper<AdministerDO>()
.lambda() .lambda()
.eq(AdministerDO::getCompanyId,addCompanyDTO.getId()) .eq(AdministerDO::getCompanyId, addCompanyDTO.getId())
.eq(AdministerDO::getRole,1)); .eq(AdministerDO::getRole, 1));
if (StringUtils.isNotBlank(addCompanyDTO.getAccountName())){ if (StringUtils.isNotBlank(addCompanyDTO.getAccountName())) {
administerDO.setAccountName(addCompanyDTO.getAccountName()); administerDO.setAccountName(addCompanyDTO.getAccountName());
} }
if (StringUtils.isBlank(addCompanyDTO.getPassword())){ if (StringUtils.isBlank(addCompanyDTO.getPassword())) {
addCompanyDTO.setPassword(addCompanyDTO.getPassword()); addCompanyDTO.setPassword(addCompanyDTO.getPassword());
} }
administerMapper.updateById(administerDO); administerMapper.updateById(administerDO);
return ConstantUtils.SET_SUCCESS; return ConstantUtils.SET_SUCCESS;
} }
public List<GetAllCompanyVO> getAllCompany(CompanyDictDO companyDictDO){ public List<GetAllCompanyVO> getAllCompany(CompanyDictDO companyDictDO) {
return this.baseMapper.getAllCompany(companyDictDO); return this.baseMapper.getAllCompany(companyDictDO);
} }
......
...@@ -31,39 +31,34 @@ public class CourseContentServiceImpl extends ServiceImpl<CourseContentMapper, C ...@@ -31,39 +31,34 @@ public class CourseContentServiceImpl extends ServiceImpl<CourseContentMapper, C
.orderByAsc(CourseContentDO::getCreateDate)); .orderByAsc(CourseContentDO::getCreateDate));
} }
@Async
public String deleteContent(CourseContentDO courseContentDO){ public String deleteContent(CourseContentDO courseContentDO){
this.baseMapper.deleteById(courseContentDO.getId()); this.baseMapper.deleteById(courseContentDO.getId());
return ConstantUtils.DELETE_SUCCESS; return ConstantUtils.DELETE_SUCCESS;
} }
@Async
public String addContent(CourseContentDO courseContentDO){ public String addContent(CourseContentDO courseContentDO){
List<CourseContentDO> courseContentDOS = this.baseMapper.selectList(new QueryWrapper<CourseContentDO>() Integer orderNoTmp = this.baseMapper.selectMaxOrderNo(courseContentDO.getCourseId());
.lambda()
.eq(CourseContentDO::getCourseId,courseContentDO.getCourseId())
.orderByDesc(CourseContentDO::getOrderNo));
int orderNo = 1 ; int orderNo = 1 ;
if (courseContentDOS.size()>0){ if (null!=orderNoTmp){
orderNo = courseContentDOS.get(0).getOrderNo()+1; orderNo = orderNoTmp+1;
} }
courseContentDO.setOrderNo(orderNo); courseContentDO.setOrderNo(orderNo);
this.baseMapper.insert(courseContentDO); this.baseMapper.insert(courseContentDO);
return ConstantUtils.ADD_SUCCESS; return ConstantUtils.ADD_SUCCESS;
} }
@Async
public String updateContent(CourseContentDO courseContentDO){ public String updateContent(CourseContentDO courseContentDO){
List<CourseContentDO> courseContentDOS = this.baseMapper.selectList(new QueryWrapper<CourseContentDO>() int count = this.baseMapper.selectCount(new QueryWrapper<CourseContentDO>()
.lambda() .lambda()
.eq(CourseContentDO::getCourseId,courseContentDO.getCourseId()) .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); throw new HttpException(40001);
} }
this.baseMapper.updateById(courseContentDO); this.baseMapper.updateById(courseContentDO);
......
...@@ -30,10 +30,9 @@ public class CourseDictServiceImpl extends ServiceImpl<CourseDictMapper, CourseD ...@@ -30,10 +30,9 @@ public class CourseDictServiceImpl extends ServiceImpl<CourseDictMapper, CourseD
@Autowired @Autowired
private RoleAdministerMappingMapper roleAdministerMappingMapper; private RoleAdministerMappingMapper roleAdministerMappingMapper;
@Async
public String addCourse(CourseDictDO courseDictDO) { public String addCourse(CourseDictDO courseDictDO) {
int count = 0; int count;
if (null != courseDictDO.getCompanyId()) { if (null != courseDictDO.getCompanyId()) {
count = this.baseMapper.selectCount(new QueryWrapper<CourseDictDO>() count = this.baseMapper.selectCount(new QueryWrapper<CourseDictDO>()
...@@ -56,7 +55,6 @@ public class CourseDictServiceImpl extends ServiceImpl<CourseDictMapper, CourseD ...@@ -56,7 +55,6 @@ public class CourseDictServiceImpl extends ServiceImpl<CourseDictMapper, CourseD
return ConstantUtils.ADD_SUCCESS; return ConstantUtils.ADD_SUCCESS;
} }
@Async
public String deleteCourse(CourseDictDO courseDictDO) { public String deleteCourse(CourseDictDO courseDictDO) {
this.baseMapper.deleteById(courseDictDO.getId()); this.baseMapper.deleteById(courseDictDO.getId());
return ConstantUtils.DELETE_SUCCESS; return ConstantUtils.DELETE_SUCCESS;
...@@ -72,6 +70,7 @@ public class CourseDictServiceImpl extends ServiceImpl<CourseDictMapper, CourseD ...@@ -72,6 +70,7 @@ public class CourseDictServiceImpl extends ServiceImpl<CourseDictMapper, CourseD
.eq(RoleAdministerMappingDO::getRoleId,1)); .eq(RoleAdministerMappingDO::getRoleId,1));
if (count > 0){ if (count > 0){
//后台管理员
queryCoursesDTO.setCompanyId(null); queryCoursesDTO.setCompanyId(null);
} }
...@@ -80,7 +79,7 @@ public class CourseDictServiceImpl extends ServiceImpl<CourseDictMapper, CourseD ...@@ -80,7 +79,7 @@ public class CourseDictServiceImpl extends ServiceImpl<CourseDictMapper, CourseD
@Async @Async
public String updateCourses(CourseDictDO courseDictDO) { public String updateCourses(CourseDictDO courseDictDO) {
int count = 0; int count;
if (null != courseDictDO.getCompanyId()) { if (null != courseDictDO.getCompanyId()) {
count = this.baseMapper.selectCount(new QueryWrapper<CourseDictDO>() count = this.baseMapper.selectCount(new QueryWrapper<CourseDictDO>()
......
package com.subsidy.service.impl; package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.GetPaperExerciseDTO;
import com.subsidy.dto.exercise.SubmitDTO; import com.subsidy.dto.exercise.SubmitDTO;
import com.subsidy.mapper.ExerciseDictMapper; import com.subsidy.mapper.ExerciseDictMapper;
import com.subsidy.mapper.ExerciseDoneHistoryMapper; import com.subsidy.mapper.ExerciseDoneHistoryMapper;
import com.subsidy.mapper.ExerciseDoneResultMapper; import com.subsidy.mapper.ExerciseDoneResultMapper;
import com.subsidy.model.CourseDictDO;
import com.subsidy.model.ExerciseDictDO; import com.subsidy.model.ExerciseDictDO;
import com.subsidy.model.ExerciseDoneHistoryDO; import com.subsidy.model.ExerciseDoneHistoryDO;
import com.subsidy.model.ExerciseDoneResultDO; import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.service.ExerciseDictService; import com.subsidy.service.ExerciseDictService;
import com.subsidy.util.ConstantUtils; import com.subsidy.util.ConstantUtils;
import com.subsidy.util.MathUtil; import com.subsidy.util.MathUtil;
import com.subsidy.vo.course.ExerciseVO;
import com.subsidy.vo.exercise.GetPaperExerciseVO; import com.subsidy.vo.exercise.GetPaperExerciseVO;
import com.subsidy.vo.exercise.MemberExerciseVO; import com.subsidy.vo.exercise.MemberExerciseVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
...@@ -46,67 +39,31 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe ...@@ -46,67 +39,31 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe
@Autowired @Autowired
private ExerciseDoneHistoryMapper exerciseDoneHistoryMapper; 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){ public String addExercise(ExerciseDictDO exerciseDictDO){
List<ExerciseDictDO> exerciseDictDOS = this.baseMapper.selectList(new QueryWrapper<ExerciseDictDO>() Integer orderNoTmp = this.baseMapper.getMaximumNo(exerciseDictDO.getPaperId());
.lambda()
.eq(ExerciseDictDO::getCourseId,exerciseDictDO.getCourseId())
.orderByDesc(ExerciseDictDO::getOrderNo));
int orderNo = 1; int orderNo = 1;
if (exerciseDictDOS.size() > 0) { if (null!= orderNoTmp) {
orderNo = exerciseDictDOS.get(0).getOrderNo() + 1; orderNo = orderNoTmp + 1;
} }
exerciseDictDO.setOrderNo(orderNo); exerciseDictDO.setOrderNo(orderNo);
this.baseMapper.insert(exerciseDictDO); this.baseMapper.insert(exerciseDictDO);
return ConstantUtils.ADD_SUCCESS; return ConstantUtils.ADD_SUCCESS;
} }
@Async
public String deleteExercise(ExerciseDictDO exerciseDictDO) { public String deleteExercise(ExerciseDictDO exerciseDictDO) {
this.baseMapper.deleteById(exerciseDictDO.getId()); this.baseMapper.deleteById(exerciseDictDO.getId());
return ConstantUtils.DELETE_SUCCESS; return ConstantUtils.DELETE_SUCCESS;
} }
@Async
public String updateExercise(ExerciseDictDO exerciseDictDO) { public String updateExercise(ExerciseDictDO exerciseDictDO) {
this.baseMapper.updateById(exerciseDictDO); this.baseMapper.updateById(exerciseDictDO);
return ConstantUtils.SET_SUCCESS; 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) @Transactional(rollbackFor = Exception.class)
@Async
public Long submit(SubmitDTO submitDTO) { public Long submit(SubmitDTO submitDTO) {
ExerciseDoneResultDO exerciseDoneResultDO = new ExerciseDoneResultDO(); ExerciseDoneResultDO exerciseDoneResultDO = new ExerciseDoneResultDO();
...@@ -134,11 +91,7 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe ...@@ -134,11 +91,7 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe
exerciseDoneResultDO.setLength(submitDTO.getLength()); exerciseDoneResultDO.setLength(submitDTO.getLength());
int score = MathUtil.intDivFloorPercent(rightCounts, memberExerciseVOS.size()); int score = MathUtil.intDivFloorPercent(rightCounts, memberExerciseVOS.size());
exerciseDoneResultDO.setScore(score); exerciseDoneResultDO.setScore(score);
if (score >= 60) { exerciseDoneResultDO.setResult(score>=60?"合格":"不合格");
exerciseDoneResultDO.setResult("合格");
} else {
exerciseDoneResultDO.setResult("不合格");
}
exerciseDoneResultMapper.insert(exerciseDoneResultDO); exerciseDoneResultMapper.insert(exerciseDoneResultDO);
......
...@@ -78,12 +78,6 @@ public class ExerciseDoneResultServiceImpl extends ServiceImpl<ExerciseDoneResul ...@@ -78,12 +78,6 @@ public class ExerciseDoneResultServiceImpl extends ServiceImpl<ExerciseDoneResul
exerciseDoneHistoryMapper.insert(ex); 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){ }catch (Exception ex){
ex.printStackTrace(); ex.printStackTrace();
......
...@@ -23,25 +23,19 @@ import java.util.List; ...@@ -23,25 +23,19 @@ import java.util.List;
public class FileDictServiceImpl extends ServiceImpl<FileDictMapper, FileDictDO> implements FileDictService { public class FileDictServiceImpl extends ServiceImpl<FileDictMapper, FileDictDO> implements FileDictService {
public List<FileDictDO> getContendFiles(FileDictDO fileDictDO) { public List<FileDictDO> getContendFiles(FileDictDO fileDictDO) {
return this.baseMapper.selectList(new QueryWrapper<FileDictDO>() return this.baseMapper.selectFiles(fileDictDO.getContentId(),fileDictDO.getFileName());
.lambda()
.eq(FileDictDO::getContentId,fileDictDO.getContentId())
.like(FileDictDO::getFileName,fileDictDO.getFileName()));
} }
@Async
public String deleteFile(FileDictDO fileDictDO) { public String deleteFile(FileDictDO fileDictDO) {
this.baseMapper.deleteById(fileDictDO.getId()); this.baseMapper.deleteById(fileDictDO.getId());
return ConstantUtils.DELETE_SUCCESS; return ConstantUtils.DELETE_SUCCESS;
} }
@Async
public String addFile(FileDictDO fileDictDO) { public String addFile(FileDictDO fileDictDO) {
this.baseMapper.insert(fileDictDO); this.baseMapper.insert(fileDictDO);
return ConstantUtils.ADD_SUCCESS; return ConstantUtils.ADD_SUCCESS;
} }
@Async
public String updateFile(FileDictDO fileDictDO) { public String updateFile(FileDictDO fileDictDO) {
this.baseMapper.updateById(fileDictDO); this.baseMapper.updateById(fileDictDO);
return ConstantUtils.SET_SUCCESS; return ConstantUtils.SET_SUCCESS;
......
...@@ -37,6 +37,7 @@ import com.subsidy.model.VodDictDO; ...@@ -37,6 +37,7 @@ import com.subsidy.model.VodDictDO;
import com.subsidy.model.VodPlayHistoryDO; import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.service.MemberService; import com.subsidy.service.MemberService;
import com.subsidy.util.ConstantUtils; import com.subsidy.util.ConstantUtils;
import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.RedisUtil; import com.subsidy.util.RedisUtil;
import com.subsidy.vo.administer.UserRoleVO; import com.subsidy.vo.administer.UserRoleVO;
import com.subsidy.vo.member.ContentFilesVO; import com.subsidy.vo.member.ContentFilesVO;
...@@ -50,6 +51,7 @@ import com.subsidy.vo.member.StudyPageVO; ...@@ -50,6 +51,7 @@ import com.subsidy.vo.member.StudyPageVO;
import com.subsidy.vo.paper.QueryPapersVO; import com.subsidy.vo.paper.QueryPapersVO;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult; import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -58,6 +60,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -58,6 +60,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.time.Duration; import java.time.Duration;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
...@@ -104,6 +107,9 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -104,6 +107,9 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
@Autowired @Autowired
private RedisUtil redisUtil; private RedisUtil redisUtil;
@Autowired
private MongoTemplate mongoTemplate;
public IPage<GetAllVO> getAll(GetAllDTO getAllDTO) { public IPage<GetAllVO> getAll(GetAllDTO getAllDTO) {
Page pager = new Page(getAllDTO.getPageNum(), getAllDTO.getPageSize()); Page pager = new Page(getAllDTO.getPageNum(), getAllDTO.getPageSize());
IPage iPage = this.baseMapper.getMembers(pager, getAllDTO.getDepartmentId(), getAllDTO.getUserName(), getAllDTO.getStatus()); IPage iPage = this.baseMapper.getMembers(pager, getAllDTO.getDepartmentId(), getAllDTO.getUserName(), getAllDTO.getStatus());
...@@ -155,7 +161,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -155,7 +161,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
//公司赋值 //公司赋值
memberDO.setCompanyId(addMemberDTO.getCompanyId()); memberDO.setCompanyId(addMemberDTO.getCompanyId());
this.baseMapper.insert(memberDO); this.baseMapper.insert(memberDO);
redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + memberDO.getAccountName(), memberDO); redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
//部门 //部门
List<Long> longs = addMemberDTO.getDepartmentIds(); List<Long> longs = addMemberDTO.getDepartmentIds();
...@@ -194,7 +200,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -194,7 +200,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
MemberDO memberDO = new MemberDO(); MemberDO memberDO = new MemberDO();
BeanUtils.copyProperties(addMemberDTO, memberDO); BeanUtils.copyProperties(addMemberDTO, memberDO);
this.baseMapper.updateById(memberDO); this.baseMapper.updateById(memberDO);
redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + memberDO.getAccountName(), memberDO); redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
if (null != addMemberDTO.getDepartmentIds()) { if (null != addMemberDTO.getDepartmentIds()) {
memberDepartmentMappingMapper.delete(new QueryWrapper<MemberDepartmentMappingDO>() memberDepartmentMappingMapper.delete(new QueryWrapper<MemberDepartmentMappingDO>()
...@@ -224,14 +230,15 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -224,14 +230,15 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
throw new HttpException(10010); throw new HttpException(10010);
} }
CompanyDictDO companyDictDO = companyDictMapper.selectById(memberDO.getCompanyId());
if ("冻结".equals(memberDO.getStatus())) { if ("冻结".equals(memberDO.getStatus())) {
OprMemDictDO oprMemDictDO = new OprMemDictDO(); OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录"); oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0); oprMemDictDO.setResult(0);
redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + "_" + memberDO.getUserName() + "_" + companyDictDO.getCompanyName() + "_" + LocalDateTime.now(), oprMemDictDO); oprMemDictDO.setCreateDate(System.currentTimeMillis()+"");
oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
mongoTemplate.insert(oprMemDictDO);
//redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + memberDO.getUserName() + ":" + companyDictDO.getCompanyName() + ":" + LocalDateTime.now(), oprMemDictDO);
throw new HttpException(10013); throw new HttpException(10013);
} }
...@@ -239,7 +246,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -239,7 +246,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
if (0 == memberDO.getFirstLogin()) { if (0 == memberDO.getFirstLogin()) {
memberDO.setFirstLogin(1); memberDO.setFirstLogin(1);
this.baseMapper.updateById(memberDO); this.baseMapper.updateById(memberDO);
redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + "_" + memberDO.getAccountName(), memberDO); redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
} }
BeanUtils.copyProperties(memberDO, userRoleVO); BeanUtils.copyProperties(memberDO, userRoleVO);
...@@ -250,17 +257,21 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -250,17 +257,21 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录"); oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0); oprMemDictDO.setResult(0);
oprMemDictDO.setCreateDate(LocalDateTime.now()); oprMemDictDO.setCreateDate(System.currentTimeMillis()+"");
redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + LocalDateTime.now(), oprMemDictDO); oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
mongoTemplate.insert(oprMemDictDO);
//redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + LocalDateTime.now(), oprMemDictDO);
throw new HttpException(70010); throw new HttpException(70010);
} }
//审计日志
OprMemDictDO oprMemDictDO = new OprMemDictDO(); OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录"); oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(1); oprMemDictDO.setResult(1);
//审计日志 oprMemDictDO.setCreateDate(System.currentTimeMillis()+"");
redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + LocalDateTime.now(), oprMemDictDO); oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
//redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + LocalDateTime.now(), oprMemDictDO);
mongoTemplate.insert(oprMemDictDO);
return userRoleVO; return userRoleVO;
} }
...@@ -282,15 +293,17 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -282,15 +293,17 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
} }
} }
if (memberDO.getPassword().equals(passwordLoginDTO.getPassword()) && 1 == memberDO.getFirstLogin() && "冻结".equals(memberDO.getStatus())) { if (memberDO.getPassword().equals(passwordLoginDTO.getPassword()) && 1 == memberDO.getFirstLogin() && !"冻结".equals(memberDO.getStatus())) {
MemberVO memberVO = new MemberVO(); MemberVO memberVO = new MemberVO();
BeanUtils.copyProperties(memberDO, memberVO); BeanUtils.copyProperties(memberDO, memberVO);
OprMemDictDO oprMemDictDO = new OprMemDictDO(); OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录"); oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(1); oprMemDictDO.setResult(1);
oprMemDictDO.setCreateDate(LocalDateTime.now()); oprMemDictDO.setCreateDate(System.currentTimeMillis()+"");
redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + "_" + System.currentTimeMillis(), 1); oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
mongoTemplate.insert(oprMemDictDO);
//redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + System.currentTimeMillis(), 1);
return memberVO; return memberVO;
} else { } else {
if (!memberDO.getPassword().equals(passwordLoginDTO.getPassword())) { if (!memberDO.getPassword().equals(passwordLoginDTO.getPassword())) {
...@@ -298,7 +311,10 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -298,7 +311,10 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录"); oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0); oprMemDictDO.setResult(0);
redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + LocalDateTime.now(), oprMemDictDO); oprMemDictDO.setCreateDate(System.currentTimeMillis()+"");
oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
mongoTemplate.insert(oprMemDictDO);
//redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + System.currentTimeMillis(), oprMemDictDO);
throw new HttpException(10016); throw new HttpException(10016);
} }
if (0 == memberDO.getFirstLogin()) { if (0 == memberDO.getFirstLogin()) {
...@@ -306,8 +322,10 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -306,8 +322,10 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录"); oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0); oprMemDictDO.setResult(0);
oprMemDictDO.setCreateDate(LocalDateTime.now()); oprMemDictDO.setCreateDate(System.currentTimeMillis()+"");
redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + "_" + System.currentTimeMillis(), 0); oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
mongoTemplate.insert(oprMemDictDO);
//redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + System.currentTimeMillis(), 0);
throw new HttpException(10015); throw new HttpException(10015);
} }
if ("冻结".equals(memberDO.getStatus())) { if ("冻结".equals(memberDO.getStatus())) {
...@@ -332,7 +350,6 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -332,7 +350,6 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
List<StudyPageVO> studyPageVOS = this.baseMapper.studyPage(memberDO); List<StudyPageVO> studyPageVOS = this.baseMapper.studyPage(memberDO);
final ExecutorService newCachedThreadPool = Executors.newCachedThreadPool(); final ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
for (StudyPageVO studyPageVO : studyPageVOS) { for (StudyPageVO studyPageVO : studyPageVOS) {
//查看课程下有几节课 //查看课程下有几节课
List<VodDictDO> vodDictDOS = courseContentMapper.getCourseVods(studyPageVO.getId()); List<VodDictDO> vodDictDOS = courseContentMapper.getCourseVods(studyPageVO.getId());
...@@ -377,13 +394,13 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -377,13 +394,13 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
for (CourseContentDO courseContentDO : courseContentDOS) { for (CourseContentDO courseContentDO : courseContentDOS) {
ContentVodVO contentVodVO = new ContentVodVO(); ContentVodVO contentVodVO = new ContentVodVO();
contentVodVO.setContent(courseContentDO.getContent()); contentVodVO.setContent(courseContentDO.getContent());
contentVodVO.setMemberVodVOS(courseContentMapper.contentVodProcess(courseContentDO.getId(),contentVodDTO.getMemberId())); contentVodVO.setMemberVodVOS(courseContentMapper.contentVodProcess(courseContentDO.getId(), contentVodDTO.getMemberId()));
contentVodVOS.add(contentVodVO); contentVodVOS.add(contentVodVO);
} }
contentVodNewVO.setContentVodVOS(contentVodVOS); contentVodNewVO.setContentVodVOS(contentVodVOS);
//最新的视频记录 //最新的视频记录
ContentVodNewVO contentVodNewVO1 = vodPlayHistoryMapper.memberRecentPlay(contentVodDTO.getClassId(),contentVodDTO.getMemberId()); ContentVodNewVO contentVodNewVO1 = vodPlayHistoryMapper.memberRecentPlay(contentVodDTO.getClassId(), contentVodDTO.getMemberId());
contentVodNewVO.setId(contentVodNewVO1.getId()); contentVodNewVO.setId(contentVodNewVO1.getId());
contentVodNewVO.setPlayRecord(contentVodNewVO.getPlayRecord()); contentVodNewVO.setPlayRecord(contentVodNewVO.getPlayRecord());
return contentVodNewVO; return contentVodNewVO;
...@@ -437,20 +454,15 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -437,20 +454,15 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
Integer cnt = paperDictMapper.completeCount(queryPapersVO.getId()); Integer cnt = paperDictMapper.completeCount(queryPapersVO.getId());
queryPapersVO.setCompleteCnt(cnt); queryPapersVO.setCompleteCnt(cnt);
//自己成绩 //自己成绩
List<ExerciseDoneResultDO> exerciseDoneResultDOS = exerciseDoneResultMapper.selectList(new QueryWrapper<ExerciseDoneResultDO>() ExerciseDoneResultDO exerciseDoneResultDO = exerciseDoneResultMapper.getMaxScorePaper(queryPapersVO.getId(),memberId);
.lambda()
.eq(ExerciseDoneResultDO::getMemberId, memberId) if (null!=exerciseDoneResultDO) {
.eq(ExerciseDoneResultDO::getPaperId, queryPapersVO.getId()) queryPapersVO.setRightCounts(exerciseDoneResultDO.getRightCounts());
.orderByDesc(ExerciseDoneResultDO::getScore)); queryPapersVO.setTotalCount(exerciseDoneResultDO.getTotalCounts());
queryPapersVO.setResult(exerciseDoneResultDO.getResult());
if (exerciseDoneResultDOS.size() > 0) {
queryPapersVO.setRightCounts(exerciseDoneResultDOS.get(0).getRightCounts());
queryPapersVO.setTotalCount(exerciseDoneResultDOS.get(0).getTotalCounts());
queryPapersVO.setResult(exerciseDoneResultDOS.get(0).getResult());
} else { } else {
queryPapersVO.setResult("待完成"); queryPapersVO.setResult("待完成");
} }
//截止时间 //截止时间
queryPapersVO.setEndDate(classDictDO.getEndDate()); queryPapersVO.setEndDate(classDictDO.getEndDate());
} }
...@@ -466,81 +478,36 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -466,81 +478,36 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
GetStudyInfoVO getStudyInfoVO = new GetStudyInfoVO(); GetStudyInfoVO getStudyInfoVO = new GetStudyInfoVO();
MemberDO memberDO1 = this.baseMapper.selectById(memberDO.getId());
final ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
//多个任务
newCachedThreadPool.execute(() ->
getStudyInfoTask1(memberDO1.getId(), getStudyInfoVO));
newCachedThreadPool.execute(() ->
getStudyInfoTask2(memberDO1, getStudyInfoVO));
//执行后不再接收新任务,如果里面有任务,就执行完
newCachedThreadPool.shutdown();
try {
while (true) {
//等待所有任务都结束了继续执行
if (newCachedThreadPool.isTerminated()) {
break;
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
return getStudyInfoVO;
}
public Future<GetStudyInfoVO> getStudyInfoTask1(Long memberId, GetStudyInfoVO getStudyInfoVO) {
//已学课程 //已学课程
List<ClassMemberMappingDO> classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper<ClassMemberMappingDO>() List<ClassMemberMappingDO> classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper<ClassMemberMappingDO>()
.lambda() .lambda()
.eq(ClassMemberMappingDO::getMemberId, memberId)); .eq(ClassMemberMappingDO::getMemberId, memberDO.getId()));
/** /**
* 遍历课程,里面的视频都看过80% 则表示已学完 * 遍历课程,累计学习时长超过视频时长 则表示已学完
*/ */
int i = 0; //已学课程 int i = 0; //已学课程
for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) { for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) {
List<VodDictDO> vodDictDOS = classDictMapper.getClassVods(classMemberMappingDO.getClassId()); List<VodDictDO> vodDictDOS = classDictMapper.getClassVods(classMemberMappingDO.getClassId());
for (VodDictDO vodDictDO : vodDictDOS) { for (VodDictDO vodDictDO : vodDictDOS) {
List<VodPlayHistoryDO> vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper<VodPlayHistoryDO>() int playLength = vodPlayHistoryMapper.memberVodTotalLength(memberDO.getId(), vodDictDO.getId());
.lambda() if (playLength < vodDictDO.getVodLength()) {
.eq(VodPlayHistoryDO::getMemberId, memberId) break;
.eq(VodPlayHistoryDO::getVodId, vodDictDO.getId())
.orderByDesc(VodPlayHistoryDO::getPlayRecord));
if (vodPlayHistoryDOS.size() > 0) {
if (vodPlayHistoryDOS.get(0).getPlayRecord() < vodDictDO.getVodLength() * 0.8) {
break;
}
} }
} }
i++; i++;
} }
getStudyInfoVO.setStudyCourse(i); getStudyInfoVO.setStudyCourse(i);
return new AsyncResult<>(getStudyInfoVO);
}
public Future<GetStudyInfoVO> getStudyInfoTask2(MemberDO memberDO, GetStudyInfoVO getStudyInfoVO) {
//累计学习时长 //累计学习时长
int studyLength = 0; int studyLength = vodPlayHistoryMapper.memberTotalLength(memberDO.getId());
List<VodPlayHistoryDO> vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper<VodPlayHistoryDO>()
.lambda()
.eq(VodPlayHistoryDO::getMemberId, memberDO.getId()));
for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) {
studyLength += vodPlayHistoryDO.getPlayLength();
}
getStudyInfoVO.setStudyLength(studyLength); getStudyInfoVO.setStudyLength(studyLength);
//第几天 //第几天
long diff = Duration.between(memberDO.getCreateDate(), LocalDateTime.now()).toDays(); MemberDO memberDO1 = this.baseMapper.selectById(memberDO.getId());
long diff = Duration.between(memberDO1.getCreateDate(), LocalDateTime.now()).toDays();
getStudyInfoVO.setDiff(diff); getStudyInfoVO.setDiff(diff);
return new AsyncResult(getStudyInfoVO);
}
public ExerciseDoneResultDO getDoneResult(ExerciseDoneResultDO exerciseDoneResultDO) { return getStudyInfoVO;
return exerciseDoneResultMapper.selectById(exerciseDoneResultDO.getId());
} }
public String checkTimes(ExerciseDoneResultDO exerciseDoneResultDO) { public String checkTimes(ExerciseDoneResultDO exerciseDoneResultDO) {
......
...@@ -3,13 +3,27 @@ package com.subsidy.service.impl; ...@@ -3,13 +3,27 @@ package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subsidy.dto.opr.GetHistoryDTO; 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.mapper.OprAdmDictMapper;
import com.subsidy.mongodb.PageVO;
import com.subsidy.service.OprAdmDictService; import com.subsidy.service.OprAdmDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.MongoUtil;
import com.subsidy.vo.opr.GetHistoryVO; 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 org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/** /**
* <p> * <p>
* 审计表 服务实现类 * 审计表 服务实现类
...@@ -21,10 +35,44 @@ import org.springframework.stereotype.Service; ...@@ -21,10 +35,44 @@ import org.springframework.stereotype.Service;
@Service @Service
public class OprAdmDictServiceImpl extends ServiceImpl<OprAdmDictMapper, OprAdmDictDO> implements OprAdmDictService { 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){ return pageVO;
Page pager = new Page(getHistoryDTO.getPageNum(), getHistoryDTO.getPageSize());
return this.baseMapper.getHistory(pager,getHistoryDTO.getUserName(),getHistoryDTO.getStartDate(),getHistoryDTO.getEndDate());
} }
} }
...@@ -9,31 +9,29 @@ import com.subsidy.dto.member.GetMemberSignInfoDTO; ...@@ -9,31 +9,29 @@ import com.subsidy.dto.member.GetMemberSignInfoDTO;
import com.subsidy.dto.sign.ClassSignInfoDTO; import com.subsidy.dto.sign.ClassSignInfoDTO;
import com.subsidy.mapper.ClassHourDictMapper; import com.subsidy.mapper.ClassHourDictMapper;
import com.subsidy.mapper.ClassMemberMappingMapper; import com.subsidy.mapper.ClassMemberMappingMapper;
import com.subsidy.mapper.MemberMapper;
import com.subsidy.mapper.SignInRecordMapper; import com.subsidy.mapper.SignInRecordMapper;
import com.subsidy.mapper.VodPlayHistoryMapper; import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.model.ClassDictDO; import com.subsidy.model.ClassDictDO;
import com.subsidy.model.ClassHourDictDO; import com.subsidy.model.ClassHourDictDO;
import com.subsidy.model.MemberDO;
import com.subsidy.model.SignInRecordDO; import com.subsidy.model.SignInRecordDO;
import com.subsidy.model.VodDictDO;
import com.subsidy.service.SignInRecordService; import com.subsidy.service.SignInRecordService;
import com.subsidy.util.ConstantUtils; import com.subsidy.util.ConstantUtils;
import com.subsidy.util.DateFormatUtil; import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.MathUtil; import com.subsidy.util.MathUtil;
import com.subsidy.util.RedisUtil; import com.subsidy.util.RedisUtil;
import com.subsidy.vo.member.GetMemberSignInfoVO; import com.subsidy.vo.member.GetMemberSignInfoVO;
import com.subsidy.vo.member.StudyPageVO;
import com.subsidy.vo.sign.ClassSignInfoVO; import com.subsidy.vo.sign.ClassSignInfoVO;
import com.subsidy.vo.sign.SignInStatusVO; import com.subsidy.vo.sign.SignInStatusVO;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.Future;
/** /**
* <p> * <p>
...@@ -56,8 +54,11 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig ...@@ -56,8 +54,11 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
private RedisUtil redisUtil; private RedisUtil redisUtil;
@Autowired @Autowired
private ClassHourDictMapper classHourDictMapper; private MemberMapper memberMapper;
@Autowired
private ClassHourDictMapper classHourDictMapper;
public IPage<GetMemberSignInfoVO> getMemberSignInfo(GetMemberSignInfoDTO getMemberSignInfoDTO) { public IPage<GetMemberSignInfoVO> getMemberSignInfo(GetMemberSignInfoDTO getMemberSignInfoDTO) {
Page pager = new Page(getMemberSignInfoDTO.getPageNum(), getMemberSignInfoDTO.getPageSize()); Page pager = new Page(getMemberSignInfoDTO.getPageNum(), getMemberSignInfoDTO.getPageSize());
...@@ -73,7 +74,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig ...@@ -73,7 +74,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
List<ClassDictDO> classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId()); List<ClassDictDO> classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId());
for (ClassDictDO classDictDO : classDictDOS) { 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; return ConstantUtils.ADD_SUCCESS;
...@@ -88,24 +89,21 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig ...@@ -88,24 +89,21 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
final ExecutorService newCachedThreadPool = Executors.newCachedThreadPool(); final ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
newCachedThreadPool.shutdown();
for (ClassSignInfoVO classSignInfoVO : classSignInfoVOS) { for (ClassSignInfoVO classSignInfoVO : classSignInfoVOS) {
newCachedThreadPool.submit(()->classSignInfoTask(classSignInfoVO)); newCachedThreadPool.execute(()->classSignInfoTask(classSignInfoVO));
} }
newCachedThreadPool.shutdown(); newCachedThreadPool.shutdown();
classSignInfoVOIPage.setRecords(classSignInfoVOS); classSignInfoVOIPage.setRecords(classSignInfoVOS);
return classSignInfoVOIPage; return classSignInfoVOIPage;
} }
public Future<ClassSignInfoVO> classSignInfoTask(ClassSignInfoVO classSignInfoVO){ public void classSignInfoTask(ClassSignInfoVO classSignInfoVO){
ClassSignInfoVO classSignInfoVO1 = vodPlayHistoryMapper.classStudyHistory(classSignInfoVO.getClassId()); ClassSignInfoVO classSignInfoVO1 = vodPlayHistoryMapper.classStudyHistory(classSignInfoVO.getClassId());
BeanUtils.copyProperties(classSignInfoVO1,classSignInfoVO); 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())); classSignInfoVO.setAvgSignCount(MathUtil.intDivCeil(signCount, classSignInfoVO1.getMemberCount()));
return new AsyncResult<>(classSignInfoVO);
} }
public SignInStatusVO signInStatus(SignInRecordDO signInRecordDO) { public SignInStatusVO signInStatus(SignInRecordDO signInRecordDO) {
...@@ -113,10 +111,10 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig ...@@ -113,10 +111,10 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
SignInStatusVO signInStatusVO = new SignInStatusVO(); SignInStatusVO signInStatusVO = new SignInStatusVO();
Boolean flag = true; // 已经签过到了 Boolean flag = true; // 已经签过到了
signInStatusVO.setStatus(flag);
//获取有效课程 //获取有效课程
long count = classMemberMappingMapper.getMemberClassCount(signInRecordDO.getMemberId()); 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) { if (size != count) {
signInStatusVO.setStatus(flag); signInStatusVO.setStatus(flag);
...@@ -136,13 +134,13 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig ...@@ -136,13 +134,13 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
//预写公司设置数据 //预写公司设置数据
List<ClassHourDictDO> classHourDictDOS = classHourDictMapper.selectList(null); List<ClassHourDictDO> classHourDictDOS = classHourDictMapper.selectList(null);
for (ClassHourDictDO classHourDictDO : classHourDictDOS) { for (ClassHourDictDO classHourDictDO : classHourDictDOS) {
redisUtil.set("subsidySettings_" + classHourDictDO.getCompanyId(), classHourDictDO); redisUtil.set("subsidySettings:" + classHourDictDO.getCompanyId(), classHourDictDO);
} }
//预写学生账号数据 //预写学生账号数据
//List<MemberDO> memberDOS = memberMapper.selectList(null); //List<MemberDO> memberDOS = memberMapper.selectList(null);
//for (MemberDO memberDO : memberDOS){ //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; 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.model.VodPlayHistoryDO;
import com.subsidy.mapper.VodPlayHistoryMapper; import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.service.VodPlayHistoryService; import com.subsidy.service.VodPlayHistoryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils; import com.subsidy.util.ConstantUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; 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> * <p>
* 视频播放历史记录表 服务实现类 * 视频播放历史记录表 服务实现类
...@@ -19,18 +35,104 @@ import org.springframework.stereotype.Service; ...@@ -19,18 +35,104 @@ import org.springframework.stereotype.Service;
@Service @Service
public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, VodPlayHistoryDO> implements VodPlayHistoryService { 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) { public String insertHistory(VodPlayHistoryDO vodPlayHistoryDO) {
vodPlayHistoryDO.setPlayCount(1); vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO); this.baseMapper.insert(vodPlayHistoryDO);
return ConstantUtils.ADD_SUCCESS; return ConstantUtils.ADD_SUCCESS;
} }
@Async public String insertHistoryNew(VodPlayHistoryDO vodPlayHistoryDO) {
public String insertHistoryNew(VodPlayHistoryDO vodPlayHistoryDO){
vodPlayHistoryDO.setPlayCount(1); vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO); this.baseMapper.insert(vodPlayHistoryDO);
return ConstantUtils.ADD_SUCCESS; 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 { ...@@ -52,8 +52,6 @@ public class ConstantUtils {
public static final String COMPRESS_SUCCESS = "压缩成功"; public static final String COMPRESS_SUCCESS = "压缩成功";
public static final String SCHOOL = "上海市市西中学";
public static final String CHECK_STATUS = "审核通过"; public static final String CHECK_STATUS = "审核通过";
/** /**
......
...@@ -14,6 +14,6 @@ public class ExcelFormatUtils { ...@@ -14,6 +14,6 @@ public class ExcelFormatUtils {
public static final List<String> answersList = Arrays.asList("序号", "提问", "答疑", "提问时间", "提问成员", "答疑时间"); 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 { ...@@ -137,17 +137,17 @@ public class MathUtil {
// } // }
public static String secToTime(int time) { public static String secToTime(int time) {
String timeStr = null; String timeStr ;
int hour = 0; int hour;
int minute = 0; int minute;
int second = 0; int second;
if (time <= 0) { if (time <= 0) {
return "00:00"; return "00:00:00";
} else { } else {
minute = time / 60; minute = time / 60;
if (minute < 60) { if (minute < 60) {
second = time % 60; second = time % 60;
timeStr = unitFormat(minute) + ":" + unitFormat(second); timeStr = "00:"+unitFormat(minute) + ":" + unitFormat(second);
} else { } else {
hour = minute / 60; hour = minute / 60;
minute = 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 { ...@@ -557,14 +557,14 @@ public class RedisUtil {
} }
} }
/** ///**
* 模糊查询获取key值 // * 模糊查询获取key值
* @param pattern // * @param pattern
* @return // * @return
*/ // */
public Set keys(String pattern){ //public Set keys(String pattern){
return redisTemplate.keys(pattern); // return redisTemplate.keys(pattern);
} //}
/** /**
* 模糊查询 * 模糊查询
......
...@@ -13,4 +13,6 @@ public class ClassDailyInfoVO { ...@@ -13,4 +13,6 @@ public class ClassDailyInfoVO {
private String userName; private String userName;
private List<DayInfoItemVO> dayInfoItemVOS; private List<DayInfoItemVO> dayInfoItemVOS;
private Integer total;
} }
...@@ -5,17 +5,12 @@ import lombok.Data; ...@@ -5,17 +5,12 @@ import lombok.Data;
@Data @Data
public class GetMemberPapersVO { 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 { ...@@ -44,6 +44,5 @@ public class GetCourseQuestionVO {
private String updateDate; private String updateDate;
private String deleteDate;
} }
...@@ -33,12 +33,12 @@ public class ClassDetailVO{ ...@@ -33,12 +33,12 @@ public class ClassDetailVO{
/** /**
* 已看视频 * 已看视频
*/ */
private Integer studyVodCounts; //private Integer studyVodCounts;
/** /**
* 全部视频 * 全部视频
*/ */
private Integer allVodCounts; //private Integer allVodCounts;
@ExcelColumn(col = 6,value = "课程进度") @ExcelColumn(col = 6,value = "课程进度")
private String classProcess; private String classProcess;
......
...@@ -11,4 +11,5 @@ public class GetMaxScoreVO { ...@@ -11,4 +11,5 @@ public class GetMaxScoreVO {
private Long score; 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 { ...@@ -34,15 +34,6 @@ public class ClassSignVO {
@ExcelColumn(col = 4,value = "培训时长") @ExcelColumn(col = 4,value = "培训时长")
private String trainingLengthStr; private String trainingLengthStr;
/**
* 已看视频
*/
private Integer studyVodCounts;
/**
* 全部视频
*/
private Integer allVodCounts;
@ExcelColumn(col = 5,value = "课程进度") @ExcelColumn(col = 5,value = "课程进度")
private String classProcess; private String classProcess;
......
...@@ -5,7 +5,7 @@ import lombok.Data; ...@@ -5,7 +5,7 @@ import lombok.Data;
@Data @Data
public class StudyPageVO { public class StudyPageVO {
private Integer id; private Long id;
private Integer classId; private Integer classId;
......
...@@ -2,7 +2,7 @@ ...@@ -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://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.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.datasource.username=ykadmin_new #spring.datasource.username=ykadmin_new
...@@ -27,9 +27,19 @@ spring.datasource.druid.useGlobalDataSourceStat=true ...@@ -27,9 +27,19 @@ spring.datasource.druid.useGlobalDataSourceStat=true
# 控制台日志打印 # 控制台日志打印
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
#spring.redis.host=r-uf6thsc3bzt5b6f7fdpd.redis.rds.aliyuncs.com #spring.redis.host=r-uf6meywj6ysuehg148pd.redis.rds.aliyuncs.com
#spring.redis.password=r-uf6thsc3bzt5b6f7fd:Ykhl@208 #spring.redis.password=r-uf6meywj6ysuehg148:Ykhl@208
#spring.redis.port=6379 #spring.redis.port=6379
#spring.redis.lettuce.pool.max-idle=16 #spring.redis.lettuce.pool.max-idle=16
#spring.redis.lettuce.pool.max-active=32 #spring.redis.lettuce.pool.max-active=32
#spring.redis.lettuce.pool.min-idle=8 #spring.redis.lettuce.pool.min-idle=8
\ No newline at end of file
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.profiles.active=dev
# 端口号 # 端口号
spring.server.port=23454 spring.server.port=23457
#嵌入tomcat配置 #嵌入tomcat配置
#和CPU数 #和CPU数
spring.server.acceptorThreadCount=600 spring.server.acceptorThreadCount=600
...@@ -64,24 +64,6 @@ spring.quartz.overwrite-existing-jobs=false ...@@ -64,24 +64,6 @@ spring.quartz.overwrite-existing-jobs=false
#spring.quartz.jdbc.initialize-schema=always #spring.quartz.jdbc.initialize-schema=always
#spring.datasource.initialization-mode=embedded #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.host=r-uf6m4cpkjrgpzywjm3pd.redis.rds.aliyuncs.com
#spring.redis.port=6379 #spring.redis.port=6379
#spring.redis.password=r-uf6m4cpkjrgpzywjm3:Ykhl@208 #spring.redis.password=r-uf6m4cpkjrgpzywjm3:Ykhl@208
......
...@@ -4,15 +4,15 @@ ...@@ -4,15 +4,15 @@
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.AnsweringQuestionDO"> <resultMap id="BaseResultMap" type="com.subsidy.model.AnsweringQuestionDO">
<id column="id" property="id" /> <id column="id" property="id"/>
<result column="create_date" property="createDate" /> <result column="create_date" property="createDate"/>
<result column="update_date" property="updateDate" /> <result column="update_date" property="updateDate"/>
<result column="delete_date" property="deleteDate" /> <result column="delete_date" property="deleteDate"/>
<result column="course_id" property="courseId" /> <result column="course_id" property="courseId"/>
<result column="ask_id" property="askId" /> <result column="ask_id" property="askId"/>
<result column="answer_id" property="answerId" /> <result column="answer_id" property="answerId"/>
<result column="title" property="title" /> <result column="title" property="title"/>
<result column="answer" property="answer" /> <result column="answer" property="answer"/>
</resultMap> </resultMap>
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
...@@ -25,23 +25,30 @@ ...@@ -25,23 +25,30 @@
<select id="getCourseQuestion" resultType="com.subsidy.vo.answer.GetCourseQuestionVO"> <select id="getCourseQuestion" resultType="com.subsidy.vo.answer.GetCourseQuestionVO">
SELECT 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, t2.user_name as memberName,
t3.user_name as administerName, t3.user_name as administerName,
t4.company_name t4.company_name
FROM FROM
answering_question t answering_question t
LEFT JOIN member t2 ON t.ask_id = t2.id LEFT JOIN member t2 ON t.ask_id = t2.id
left join administer t3 on t.answer_id = t3.id left join administer t3 on t.answer_id = t3.id
left join company_dict t4 on t3.company_id = t4.id left join company_dict t4 on t3.company_id = t4.id
WHERE WHERE
t.delete_date IS NULL t.delete_date IS NULL
AND t2.delete_date IS NULL AND t2.delete_date IS NULL
AND t.class_id = #{classId} AND t.class_id = #{classId}
<if test="memberId != null "> <if test="memberId != null ">
and t.ask_id = #{memberId} and t.ask_id = #{memberId}
</if> </if>
order by t.create_date desc order by t.create_date desc
</select> </select>
</mapper> </mapper>
...@@ -65,7 +65,17 @@ ...@@ -65,7 +65,17 @@
<select id="getSpareMembers" parameterType="com.subsidy.dto.classDict.GetSpareMembersDTO" <select id="getSpareMembers" parameterType="com.subsidy.dto.classDict.GetSpareMembersDTO"
resultType="com.subsidy.model.MemberDO"> resultType="com.subsidy.model.MemberDO">
SELECT 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 FROM
member t2 member t2
LEFT JOIN member_department_mapping t ON t.member_id = t2.id LEFT JOIN member_department_mapping t ON t.member_id = t2.id
...@@ -87,7 +97,17 @@ ...@@ -87,7 +97,17 @@
<select id="classMembers" parameterType="long" resultType="com.subsidy.model.MemberDO"> <select id="classMembers" parameterType="long" resultType="com.subsidy.model.MemberDO">
SELECT 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 FROM
class_member_mapping t class_member_mapping t
LEFT JOIN member t2 ON t.member_id = t2.id LEFT JOIN member t2 ON t.member_id = t2.id
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
id, course_id, content, order_no id, course_id, content, order_no
</sql> </sql>
<select id="getCourseVods" parameterType="integer" resultType="com.subsidy.model.VodDictDO"> <select id="getCourseVods" parameterType="long" resultType="com.subsidy.model.VodDictDO">
SELECT SELECT
t2.id, t2.id,
t2.content_id, t2.content_id,
...@@ -81,4 +81,14 @@ ...@@ -81,4 +81,14 @@
t2.order_no t2.order_no
</select> </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> </mapper>
...@@ -92,7 +92,12 @@ ...@@ -92,7 +92,12 @@
<select id="queryCompanyCourse" resultType="com.subsidy.vo.course.QueryCoursesVO"> <select id="queryCompanyCourse" resultType="com.subsidy.vo.course.QueryCoursesVO">
SELECT SELECT
t.*, t.id,
t.company_id,
t.course_name,
t.category_id,
t.course_type,
t.course_source,
t2.name t2.name
FROM FROM
course_dict t course_dict t
......
...@@ -51,7 +51,16 @@ ...@@ -51,7 +51,16 @@
and t.title like concat('%',#{title} ,'%') and t.title like concat('%',#{title} ,'%')
</if> </if>
order by t.order_no 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> </select>
</mapper> </mapper>
...@@ -93,4 +93,68 @@ ...@@ -93,4 +93,68 @@
t.member_id t.member_id
</select> </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> </mapper>
...@@ -22,4 +22,22 @@ ...@@ -22,4 +22,22 @@
id, content_id, file_name, file_size, order_no id, content_id, file_name, file_size, order_no
</sql> </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> </mapper>
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<mapper namespace="com.subsidy.mapper.OprAdmDictMapper"> <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" /> <id column="id" property="id" />
<result column="create_date" property="createDate" /> <result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" /> <result column="update_date" property="updateDate" />
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
t.create_date DESC t.create_date DESC
</select> </select>
<select id="getLoginInfo" parameterType="long" resultType="com.subsidy.model.OprAdmDictDO"> <select id="getLoginInfo" parameterType="long" resultType="com.subsidy.mongodb.OprAdmDictDO">
SELECT SELECT
* *
FROM FROM
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
LIMIT 5)t2 LIMIT 5)t2
</select> </select>
<select id="getRecordByDate" resultType="com.subsidy.model.OprAdmDictDO"> <select id="getRecordByDate" resultType="com.subsidy.mongodb.OprAdmDictDO">
SELECT SELECT
* *
FROM FROM
......
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
<select id="memberRecentPlay" resultType="com.subsidy.vo.member.ContentVodNewVO"> <select id="memberRecentPlay" resultType="com.subsidy.vo.member.ContentVodNewVO">
SELECT SELECT
t2.id, t2.id,
t1.play_record ifnull(t1.play_record,0) as play_record
FROM FROM
( (
SELECT SELECT
...@@ -238,8 +238,8 @@ ...@@ -238,8 +238,8 @@
FROM FROM
vod_play_history t vod_play_history t
WHERE WHERE
t.member_id = 1 t.member_id = #{memberId}
AND t.class_id = 3 AND t.class_id = #{classId}
) t1 ) t1
LEFT JOIN vod_dict t2 ON t1.vod_id = t2.id LEFT JOIN vod_dict t2 ON t1.vod_id = t2.id
</select> </select>
...@@ -286,4 +286,25 @@ ...@@ -286,4 +286,25 @@
ORDER BY ORDER BY
t1.create_date DESC t1.create_date DESC
</select> </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> </mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!