From 2668dc30b30aeb9d428c703ac9dc7def6c6761ea Mon Sep 17 00:00:00 2001 From: Administrator Date: Fri, 14 Jan 2022 18:34:24 +0800 Subject: [PATCH] 优化后版本,跑数据脚本 --- pom.xml | 6 ++++++ src/main/java/com/subsidy/common/RedisPrefixConstant.java | 18 +++++++++--------- src/main/java/com/subsidy/controller/AdministerController.java | 14 ++++++++------ src/main/java/com/subsidy/controller/ClassDictController.java | 7 +++---- src/main/java/com/subsidy/controller/ClassHourDictController.java | 4 ++-- src/main/java/com/subsidy/controller/CompanyDictController.java | 8 ++++---- src/main/java/com/subsidy/controller/CourseContentController.java | 8 ++++---- src/main/java/com/subsidy/controller/CourseDictController.java | 8 ++++---- src/main/java/com/subsidy/controller/DepartmentDictController.java | 8 ++++---- src/main/java/com/subsidy/controller/ExerciseDictController.java | 15 +-------------- src/main/java/com/subsidy/controller/FileDictController.java | 2 +- src/main/java/com/subsidy/controller/MemberController.java | 12 +++--------- src/main/java/com/subsidy/controller/OprAdmDictController.java | 2 +- src/main/java/com/subsidy/controller/SignInRecordController.java | 2 +- src/main/java/com/subsidy/controller/VodPlayHistoryController.java | 6 ++++++ src/main/java/com/subsidy/jobs/Scheduler.java | 76 ++++++++++++++++++++++++++++++++++++++++------------------------------------ src/main/java/com/subsidy/mapper/CourseContentMapper.java | 3 ++- src/main/java/com/subsidy/mapper/ExerciseDictMapper.java | 16 +++++++++------- src/main/java/com/subsidy/mapper/ExerciseDoneResultMapper.java | 15 ++++++++++++++- src/main/java/com/subsidy/mapper/FileDictMapper.java | 4 ++++ src/main/java/com/subsidy/mapper/OprAdmDictMapper.java | 2 +- src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java | 8 ++++++++ src/main/java/com/subsidy/model/Collection.java | 13 +++++++++++++ src/main/java/com/subsidy/model/OprAdmDictDO.java | 43 ------------------------------------------- src/main/java/com/subsidy/model/OprMemDictDO.java | 18 +++++++++++------- src/main/java/com/subsidy/model/VodPlayHistoryDO.java | 4 ++++ src/main/java/com/subsidy/mongodb/MongoController.java | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/mongodb/OprAdmDictDO.java | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/mongodb/PageVO.java | 26 ++++++++++++++++++++++++++ src/main/java/com/subsidy/service/ExerciseDictService.java | 4 ---- src/main/java/com/subsidy/service/MemberService.java | 2 -- src/main/java/com/subsidy/service/OprAdmDictService.java | 5 +++-- src/main/java/com/subsidy/service/VodPlayHistoryService.java | 2 ++ src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java | 627 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- src/main/java/com/subsidy/service/impl/AnsweringQuestionServiceImpl.java | 3 --- src/main/java/com/subsidy/service/impl/CategoryServiceImpl.java | 12 +++++------- src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java | 11 +---------- src/main/java/com/subsidy/service/impl/ClassHourDictServiceImpl.java | 2 +- src/main/java/com/subsidy/service/impl/CompanyDictServiceImpl.java | 48 +++++++++++++++++++++++++----------------------- src/main/java/com/subsidy/service/impl/CourseContentServiceImpl.java | 19 +++++++------------ src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java | 7 +++---- src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java | 55 ++++--------------------------------------------------- src/main/java/com/subsidy/service/impl/ExerciseDoneResultServiceImpl.java | 6 ------ src/main/java/com/subsidy/service/impl/FileDictServiceImpl.java | 8 +------- src/main/java/com/subsidy/service/impl/MemberServiceImpl.java | 137 ++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------- src/main/java/com/subsidy/service/impl/OprAdmDictServiceImpl.java | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java | 30 ++++++++++++++---------------- src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- src/main/java/com/subsidy/util/ConstantUtils.java | 2 -- src/main/java/com/subsidy/util/ExcelFormatUtils.java | 2 +- src/main/java/com/subsidy/util/MathUtil.java | 12 ++++++------ src/main/java/com/subsidy/util/MongoUtil.java | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/util/PageHelper.java | 30 ++++++++++++++++++++++++++++++ src/main/java/com/subsidy/util/RedisUtil.java | 16 ++++++++-------- src/main/java/com/subsidy/vo/administer/ClassDailyInfoVO.java | 2 ++ src/main/java/com/subsidy/vo/administer/GetMemberPapersVO.java | 13 ++++--------- src/main/java/com/subsidy/vo/answer/GetCourseQuestionVO.java | 1 - src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java | 4 ++-- src/main/java/com/subsidy/vo/done/GetMaxScoreVO.java | 1 + src/main/java/com/subsidy/vo/done/TestScoreInfoVO.java | 16 ++++++++++++++++ src/main/java/com/subsidy/vo/member/ClassSignVO.java | 9 --------- src/main/java/com/subsidy/vo/member/StudyPageVO.java | 2 +- src/main/resources/application-dev.properties | 18 ++++++++++++++---- src/main/resources/application.properties | 20 +------------------- src/main/resources/mapper/AnsweringQuestionMapper.xml | 45 ++++++++++++++++++++++++++------------------- src/main/resources/mapper/ClassDictMapper.xml | 24 ++++++++++++++++++++++-- src/main/resources/mapper/CourseContentMapper.xml | 12 +++++++++++- src/main/resources/mapper/CourseDictMapper.xml | 7 ++++++- src/main/resources/mapper/ExerciseDictMapper.xml | 9 +++++++++ src/main/resources/mapper/ExerciseDoneResultMapper.xml | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/resources/mapper/FileDictMapper.xml | 18 ++++++++++++++++++ src/main/resources/mapper/OprAdmDictMapper.xml | 6 +++--- src/main/resources/mapper/VodPlayHistoryMapper.xml | 27 ++++++++++++++++++++++++--- 73 files changed, 1140 insertions(+), 890 deletions(-) create mode 100644 src/main/java/com/subsidy/model/Collection.java delete mode 100644 src/main/java/com/subsidy/model/OprAdmDictDO.java create mode 100644 src/main/java/com/subsidy/mongodb/MongoController.java create mode 100644 src/main/java/com/subsidy/mongodb/OprAdmDictDO.java create mode 100644 src/main/java/com/subsidy/mongodb/PageVO.java create mode 100644 src/main/java/com/subsidy/util/MongoUtil.java create mode 100644 src/main/java/com/subsidy/util/PageHelper.java create mode 100644 src/main/java/com/subsidy/vo/done/TestScoreInfoVO.java diff --git a/pom.xml b/pom.xml index 84e0b4a..4365dae 100644 --- a/pom.xml +++ b/pom.xml @@ -203,6 +203,12 @@ jedis ${jedis.version} + + + org.springframework.boot + spring-boot-starter-data-mongodb + + diff --git a/src/main/java/com/subsidy/common/RedisPrefixConstant.java b/src/main/java/com/subsidy/common/RedisPrefixConstant.java index 99e0397..b8d5ea3 100644 --- a/src/main/java/com/subsidy/common/RedisPrefixConstant.java +++ b/src/main/java/com/subsidy/common/RedisPrefixConstant.java @@ -5,31 +5,31 @@ public class RedisPrefixConstant { /** * subsidyAdminister_accountName:AdministerDO 老师账号密码 */ - public static final String SUBSIDY_ADMINISTER_PREFIX = "subsidyAdminister_"; + public static final String SUBSIDY_ADMINISTER_PREFIX = "subsidyAdminister:"; /** * subsidyMember_companyId_accountName:MemberDO 学员账号密码 */ - public static final String SUBSIDY_COMPANY_MEMBER_PREFIX = "subsidyMember_"; + public static final String SUBSIDY_COMPANY_MEMBER_PREFIX = "subsidyMember:"; - /** - *subsidy_memberLogin_memberId_userName_companyName_now : 学员端审计记录 - */ - public static final String SUBSIDY_MEMBER_LOGIN_PREFIX = "subsidy_memberLogin_"; + ///** + // *subsidy_memberLogin_memberId_userName_companyName_now : 学员端审计记录 + // */ + //public static final String SUBSIDY_MEMBER_LOGIN_PREFIX = "subsidy:memberLogin:"; /** * subsidySmsCode_telephone:code 手机验证码 */ - public static final String SUBSIDY_TELEPHONE_PREFIX = "subsidySmsCode_"; + public static final String SUBSIDY_TELEPHONE_PREFIX = "subsidySmsCode:"; /** * subsidySettings_companyId:ClassHourDictDO 公司操作设置 */ - public static final String SUBSIDY_SETTINGS_PREFIX = "subsidySettings_"; + public static final String SUBSIDY_SETTINGS_PREFIX = "subsidySettings:"; /** * subsidySignInfo_memberId_1_classId_12_20211223_long,do 学生签到数据 */ - public static final String SUBSIDY_SIGN_INFO_PREFIX = "subsidySignInfo_"; + public static final String SUBSIDY_SIGN_INFO_PREFIX = "subsidySignInfo:"; } diff --git a/src/main/java/com/subsidy/controller/AdministerController.java b/src/main/java/com/subsidy/controller/AdministerController.java index f957668..f532cf5 100644 --- a/src/main/java/com/subsidy/controller/AdministerController.java +++ b/src/main/java/com/subsidy/controller/AdministerController.java @@ -16,6 +16,7 @@ import com.subsidy.service.AdministerService; import com.subsidy.util.ConstantUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; @@ -65,7 +66,7 @@ public class AdministerController { @PostMapping("/administers") @ApiOperation("查询所有运营者 { userName pageNum pageSize }") - @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO operators(@RequestBody OperatorsDTO operatorsDTO){ return ResponseData.generateCreatedResponse(0,administerService.operators(operatorsDTO)); } @@ -90,7 +91,7 @@ public class AdministerController { @PostMapping("classSummary") @ApiOperation("课程汇总 id 班级id ") - //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO classSummary(@RequestBody ClassDetailDTO classDetailDTO){ return ResponseData.generateCreatedResponse(0,administerService.classSummary(classDetailDTO)); } @@ -112,13 +113,13 @@ public class AdministerController { @PostMapping("signDetail") @ApiOperation("班级管理--注册签到 id 班级id userName") - //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO signDetail(@RequestBody ClassDetailDTO classDetailDTO){ return ResponseData.generateCreatedResponse(0,administerService.signDetail(classDetailDTO)); } @PostMapping("exportSignDetail") - @ApiOperation("** 班级管理--注册签到 id 班级id userName") + @ApiOperation("班级管理--注册签到 id 班级id userName") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public void exportSignDetail(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{ classDetailDTO.setFlag(true); @@ -142,7 +143,7 @@ public class AdministerController { @PostMapping("getMemberPapers") @ApiOperation("获取某个成员某个卷子的做题历史 memberId paperId") - //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO getMemberPapers(@RequestBody ExerciseDoneResultDO exerciseDoneResultDO){ return ResponseData.generateCreatedResponse(0,administerService.getMemberPapers(exerciseDoneResultDO)); } @@ -181,12 +182,13 @@ public class AdministerController { } @PostMapping("exportClassDailyInfo") + @ApiParam("每日学习日志") public void exportVodInfo(@RequestBody ClassDailyInfoDTO classDailyInfoDTO){ administerService.exportClassDailyInfo(classDailyInfoDTO); } @PostMapping("exportZip") - @ApiOperation("** 下载压缩包 id 班级id") + @ApiOperation("下载压缩包 id 班级id") @CrossOrigin @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public void exportZip(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{ diff --git a/src/main/java/com/subsidy/controller/ClassDictController.java b/src/main/java/com/subsidy/controller/ClassDictController.java index 676385c..fb31158 100644 --- a/src/main/java/com/subsidy/controller/ClassDictController.java +++ b/src/main/java/com/subsidy/controller/ClassDictController.java @@ -36,7 +36,7 @@ public class ClassDictController { private ClassDictService classDictService; @PostMapping("getAllClasses") - @ApiOperation("获取某老师下的所有课程 ** companyId 所选企业id className 班级名称") + @ApiOperation("获取某老师下的所有课程 companyId 所选企业id className 班级名称") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO getAllClasses(@RequestBody ClassDictDO classDictDO){ return ResponseData.generateCreatedResponse(0,classDictService.getAllClasses(classDictDO)); @@ -78,8 +78,8 @@ public class ClassDictController { } @PostMapping("getSpareMembers") - @ApiOperation("获取不在某班级的某企业里所有成员 ** companyId 企业id classId 班级id") - //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + @ApiOperation("获取不在某班级的某企业里所有成员 companyId 企业id classId 班级id") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO getSpareMembers(@RequestBody GetSpareMembersDTO getSpareMembersDTO){ return ResponseData.generateCreatedResponse(0,classDictService.getSpareMembers(getSpareMembersDTO)); } @@ -91,7 +91,6 @@ public class ClassDictController { return ResponseData.generateCreatedResponse(0,classDictService.addMemberToClass(addMemberToClassDTO)); } - @PostMapping("batchSms") @ApiOperation(" 批量发送班级短信 {id 班级id}") public ResponseVO batchSms(@RequestBody ClassDictDO classDictDO){ diff --git a/src/main/java/com/subsidy/controller/ClassHourDictController.java b/src/main/java/com/subsidy/controller/ClassHourDictController.java index 4a19aad..178a7a2 100644 --- a/src/main/java/com/subsidy/controller/ClassHourDictController.java +++ b/src/main/java/com/subsidy/controller/ClassHourDictController.java @@ -33,14 +33,14 @@ public class ClassHourDictController { private ClassHourDictService classHourDictService; @PostMapping("getSetting") - @ApiOperation("** 查看当天设置的最大学习时长 companyId") + @ApiOperation("查看当天设置的最大学习时长 companyId") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO getSetting(@RequestBody ClassHourDictDO classHourDictDO){ return ResponseData.generateCreatedResponse(0,classHourDictService.getSetting(classHourDictDO)); } @PostMapping("updateSetting") - @ApiOperation("** 修改当天设置时长 id 主键 classHour status interrupt interruptStatus repeatTime repeatStatus") + @ApiOperation("修改当天设置时长 id 主键 classHour status interrupt interruptStatus repeatTime repeatStatus") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO updateSetting(@RequestBody ClassHourDictDO classHourDictDO){ return ResponseData.generateCreatedResponse(0,classHourDictService.updateSetting(classHourDictDO)); diff --git a/src/main/java/com/subsidy/controller/CompanyDictController.java b/src/main/java/com/subsidy/controller/CompanyDictController.java index 51c2b19..734b052 100644 --- a/src/main/java/com/subsidy/controller/CompanyDictController.java +++ b/src/main/java/com/subsidy/controller/CompanyDictController.java @@ -34,28 +34,28 @@ public class CompanyDictController { private CompanyDictService companyDictService; @PostMapping("/administers") - @ApiOperation("** 查询所有企业 {id companyName pageNum pageSize }") + @ApiOperation("查询所有企业 {id companyName pageNum pageSize }") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO operators(@RequestBody OperatorsDTO operatorsDTO){ return ResponseData.generateCreatedResponse(0,companyDictService.operators(operatorsDTO)); } @PostMapping("addCompany") - @ApiOperation("** 添加企业 {accountName:账号 companyName:企业名称 shortName 简称 banner:标语 field:领域 role 1:超级管理员 2:普通成员}") + @ApiOperation("添加企业 {accountName:账号 companyName:企业名称 shortName 简称 banner:标语 field:领域 role 1:超级管理员 2:普通成员}") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO addOperator(@RequestBody AddCompanyDTO addCompanyDTO){ return ResponseData.generateCreatedResponse(0,companyDictService.addOperator(addCompanyDTO)); } @PostMapping("deleteCompany") - @ApiOperation("** 删除企业 id") + @ApiOperation("删除企业 id") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO deleteAdminister(@RequestBody CompanyDictDO companyDictDO){ return ResponseData.generateCreatedResponse(0,companyDictService.deleteAdminister(companyDictDO)); } @PostMapping("updateCompany") - @ApiOperation("** 修改企业 id accountName:账号 companyName:企业名称 shortName 简称 banner:标语 field:领域 role 1:超级管理员 2:普通成员") + @ApiOperation("修改企业 id accountName:账号 companyName:企业名称 shortName 简称 banner:标语 field:领域 role 1:超级管理员 2:普通成员") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO updateAdminister(@RequestBody AddCompanyDTO addCompanyDTO){ return ResponseData.generateCreatedResponse(0,companyDictService.updateAdminister(addCompanyDTO)); diff --git a/src/main/java/com/subsidy/controller/CourseContentController.java b/src/main/java/com/subsidy/controller/CourseContentController.java index 7caa9bf..2016b71 100644 --- a/src/main/java/com/subsidy/controller/CourseContentController.java +++ b/src/main/java/com/subsidy/controller/CourseContentController.java @@ -32,28 +32,28 @@ public class CourseContentController { private CourseContentService courseContentService; @PostMapping("getContents") - @ApiOperation("** 获取课程目录 {courseId}") + @ApiOperation("获取课程目录 {courseId}") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO getContents(@RequestBody CourseContentDO courseContentDO){ return ResponseData.generateCreatedResponse(0,courseContentService.getContents(courseContentDO)); } @PostMapping("deleteContent") - @ApiOperation("** 删除一个目录 {id} ") + @ApiOperation("删除一个目录 {id} ") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO deleteContent(@RequestBody CourseContentDO courseContentDO){ return ResponseData.generateCreatedResponse(0,courseContentService.deleteContent(courseContentDO)); } @PostMapping("addContent") - @ApiOperation("** 添加一个目录 {courseId content}") + @ApiOperation("添加一个目录 {courseId content}") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO addContent(@RequestBody CourseContentDO courseContentDO){ return ResponseData.generateCreatedResponse(0,courseContentService.addContent(courseContentDO)); } @PostMapping("updateContent") - @ApiOperation("** 更新一个目录 {id courseId content}") + @ApiOperation("更新一个目录 {id courseId content}") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO updateContent(@RequestBody CourseContentDO courseContentDO){ return ResponseData.generateCreatedResponse(0,courseContentService.updateContent(courseContentDO)); diff --git a/src/main/java/com/subsidy/controller/CourseDictController.java b/src/main/java/com/subsidy/controller/CourseDictController.java index 43f6aea..4b4f8e7 100644 --- a/src/main/java/com/subsidy/controller/CourseDictController.java +++ b/src/main/java/com/subsidy/controller/CourseDictController.java @@ -33,14 +33,14 @@ public class CourseDictController { private CourseDictService courseDictService; @PostMapping("addCourse") - @ApiOperation("添加课程 **companyId courseName categoryId courseType courseSource") + @ApiOperation("添加课程 companyId courseName categoryId courseType courseSource") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO addCourse(@RequestBody CourseDictDO courseDictDO){ return ResponseData.generateCreatedResponse(0,courseDictService.addCourse(courseDictDO)); } @PostMapping("deleteCourse") - @ApiOperation("** 删除课程 id") + @ApiOperation("删除课程 id") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO deleteCourse(@RequestBody CourseDictDO courseDictDO){ return ResponseData.generateCreatedResponse(0,courseDictService.deleteCourse(courseDictDO)); @@ -48,13 +48,13 @@ public class CourseDictController { @PostMapping("queryCourses") @ApiOperation("平台运营者--查询课程 pageSize pageNum administerId companyId courseName categoryId courseType courseSource") - //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO queryCourses(@RequestBody QueryCoursesDTO queryCoursesDTO){ return ResponseData.generateCreatedResponse(0,courseDictService.queryCourses(queryCoursesDTO)); } @PostMapping("updateCourses") - @ApiOperation("编辑课程 id ** companyId courseName categoryId courseType courseSource") + @ApiOperation("编辑课程 id companyId courseName categoryId courseType courseSource") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO updateCourses(@RequestBody CourseDictDO courseDictDO){ return ResponseData.generateCreatedResponse(0,courseDictService.updateCourses(courseDictDO)); diff --git a/src/main/java/com/subsidy/controller/DepartmentDictController.java b/src/main/java/com/subsidy/controller/DepartmentDictController.java index 6acb1d8..f902875 100644 --- a/src/main/java/com/subsidy/controller/DepartmentDictController.java +++ b/src/main/java/com/subsidy/controller/DepartmentDictController.java @@ -32,28 +32,28 @@ public class DepartmentDictController { private DepartmentDictService departmentDictService; @PostMapping("getDepartments") - @ApiOperation("** 获取所有部门 companyId 企业id") + @ApiOperation("获取所有部门 companyId 企业id") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO getDepartments(@RequestBody DepartmentDictDO departmentDictDO){ return ResponseData.generateCreatedResponse(0,departmentDictService.getDepartments(departmentDictDO)); } @PostMapping("addDepartment") - @ApiOperation("添加部门 ** companyId departmentName leaderName parentId 父节点") + @ApiOperation("添加部门 companyId departmentName leaderName parentId 父节点") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO addDepartment(@RequestBody DepartmentDictDO departmentDictDO){ return ResponseData.generateCreatedResponse(0,departmentDictService.addDepartment(departmentDictDO)); } @PostMapping("deleteDepartment") - @ApiOperation("** 删除部门 id") + @ApiOperation("删除部门 id") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO deleteDepartment(@RequestBody DepartmentDictDO departmentDictDO){ return ResponseData.generateCreatedResponse(0,departmentDictService.deleteDepartment(departmentDictDO)); } @PostMapping("updateDepartment") - @ApiOperation("编辑部门 id ** companyId departmentName leaderName parentId") + @ApiOperation("编辑部门 id companyId departmentName leaderName parentId") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO updateDepartment(@RequestBody DepartmentDictDO departmentDictDO){ return ResponseData.generateCreatedResponse(0,departmentDictService.updateDepartment(departmentDictDO)); diff --git a/src/main/java/com/subsidy/controller/ExerciseDictController.java b/src/main/java/com/subsidy/controller/ExerciseDictController.java index dcb6530..cabfbf1 100644 --- a/src/main/java/com/subsidy/controller/ExerciseDictController.java +++ b/src/main/java/com/subsidy/controller/ExerciseDictController.java @@ -35,13 +35,6 @@ public class ExerciseDictController { @Autowired private ExerciseDictService exerciseDictService; - @PostMapping("getAllExercises") - @ApiOperation("【弃用】 查询所有题目 {courseId 课程id exerciseType 题目类型 difficulty 难度 title 题目 pageSize pageNum}") - @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) - public ResponseVO getAllExercises(@RequestBody GetAllExercisesDTO getAllExercisesDTO){ - return ResponseData.generateCreatedResponse(0,exerciseDictService.getAllExercises(getAllExercisesDTO)); - } - @PostMapping("addExercise") @ApiOperation("添加题目 {paperId 试卷id courseId 课程id exerciseType 题目类型 difficulty 难度 title题目 items 选项 rightAnswer 正确答案 }") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @@ -63,14 +56,8 @@ public class ExerciseDictController { return ResponseData.generateCreatedResponse(0,exerciseDictService.updateExercise(exerciseDictDO)); } - @PostMapping("getCourseExercises") - @ApiOperation("【废弃】获取课程的习题 id 课程id") - public ResponseVO getCourseExercises(@RequestBody CourseDictDO courseDictDO){ - return ResponseData.generateCreatedResponse(0,exerciseDictService.getCourseExercises(courseDictDO)); - } - @PostMapping("submit") - @ApiOperation("** 提交答案 {paperId 卷子id memberId 成员id classId课程 courseId 课程id memberExerciseVOS [ id selectAnswer ] length:做题时长} ") + @ApiOperation("提交答案 {paperId 卷子id memberId 成员id classId课程 courseId 课程id memberExerciseVOS [ id selectAnswer ] length:做题时长} ") public ResponseVO submit(@RequestBody SubmitDTO submitDTO){ return ResponseData.generateCreatedResponse(0,exerciseDictService.submit(submitDTO)); } diff --git a/src/main/java/com/subsidy/controller/FileDictController.java b/src/main/java/com/subsidy/controller/FileDictController.java index 7875d54..a479597 100644 --- a/src/main/java/com/subsidy/controller/FileDictController.java +++ b/src/main/java/com/subsidy/controller/FileDictController.java @@ -32,7 +32,7 @@ public class FileDictController { private FileDictService fileDictService; @PostMapping("getContendFiles") - @ApiOperation("** 获取目录下的视频 {contentId fileName}") + @ApiOperation("获取目录下的视频 {contentId fileName}") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO getContendFiles(@RequestBody FileDictDO fileDictDO){ return ResponseData.generateCreatedResponse(0,fileDictService.getContendFiles(fileDictDO)); diff --git a/src/main/java/com/subsidy/controller/MemberController.java b/src/main/java/com/subsidy/controller/MemberController.java index e8b0f16..d18538f 100644 --- a/src/main/java/com/subsidy/controller/MemberController.java +++ b/src/main/java/com/subsidy/controller/MemberController.java @@ -79,7 +79,7 @@ public class MemberController { } @PostMapping("updatePassword") - @ApiOperation("** 修改密码 {id password}") + @ApiOperation("修改密码 {id password}") public ResponseVO updatePassword(@RequestBody MemberDO memberDO){ return ResponseData.generateCreatedResponse(0,memberService.updatePassword(memberDO)); } @@ -103,7 +103,7 @@ public class MemberController { } @PostMapping("studyHistory") - @ApiOperation("** 学习记录 memberId 成员id pageSize pageNum") + @ApiOperation("学习记录 memberId 成员id pageSize pageNum") public ResponseVO studyHistory(@RequestBody StudyHistoryDTO studyHistoryDTO){ return ResponseData.generateCreatedResponse(0,memberService.studyHistory(studyHistoryDTO)); } @@ -121,17 +121,11 @@ public class MemberController { } @PostMapping("getStudyInfo") - @ApiOperation("** 获取学生完成课程情况 id 学员id") + @ApiOperation("获取学生完成课程情况 id 学员id") public ResponseVO getStudyInfo(@RequestBody MemberDO memberDO){ return ResponseData.generateCreatedResponse(0,memberService.getStudyInfo(memberDO)); } - //@PostMapping("getDoneResult") - //@ApiOperation("获取此次完成情况 id 提交接口返回的id") - //public ResponseVO getDoneResult(@RequestBody ExerciseDoneResultDO exerciseDoneResultDO){ - // return ResponseData.generateCreatedResponse(0,memberService.getDoneResult(exerciseDoneResultDO)); - //} - @PostMapping("checkTimes") @ApiOperation("检测是否超过次数 memberId paperId classId") public ResponseVO checkTimes(@RequestBody ExerciseDoneResultDO exerciseDoneResultDO){ diff --git a/src/main/java/com/subsidy/controller/OprAdmDictController.java b/src/main/java/com/subsidy/controller/OprAdmDictController.java index 69c05dc..7dc33eb 100644 --- a/src/main/java/com/subsidy/controller/OprAdmDictController.java +++ b/src/main/java/com/subsidy/controller/OprAdmDictController.java @@ -30,7 +30,7 @@ public class OprAdmDictController { private OprAdmDictService oprAdmDictService; @PostMapping("getHistory") - @ApiOperation("###获取后台用户审计 {pageSize pageNum userName startDate endDate}") + @ApiOperation("获取后台用户审计 {pageSize pageNum userName startDate endDate}") public ResponseVO getHistory(@RequestBody GetHistoryDTO getHistoryDTO){ return ResponseData.generateCreatedResponse(0,oprAdmDictService.getHistory(getHistoryDTO)); } diff --git a/src/main/java/com/subsidy/controller/SignInRecordController.java b/src/main/java/com/subsidy/controller/SignInRecordController.java index 98c2210..c7a3662 100644 --- a/src/main/java/com/subsidy/controller/SignInRecordController.java +++ b/src/main/java/com/subsidy/controller/SignInRecordController.java @@ -34,7 +34,7 @@ public class SignInRecordController { private SignInRecordService signInRecordService; @PostMapping("getMemberSignInfo") - @ApiOperation("###获取某个成员的签到记录 id 成员id pageSize pageNum") + @ApiOperation("获取某个成员的签到记录 id 成员id pageSize pageNum") public ResponseVO getMemberSignInfo(@RequestBody GetMemberSignInfoDTO getMemberSignInfoDTO) { return ResponseData.generateCreatedResponse(0, signInRecordService.getMemberSignInfo(getMemberSignInfoDTO)); } diff --git a/src/main/java/com/subsidy/controller/VodPlayHistoryController.java b/src/main/java/com/subsidy/controller/VodPlayHistoryController.java index c6118c6..24a05ae 100644 --- a/src/main/java/com/subsidy/controller/VodPlayHistoryController.java +++ b/src/main/java/com/subsidy/controller/VodPlayHistoryController.java @@ -42,4 +42,10 @@ public class VodPlayHistoryController { VodPlayHistoryDO vodPlayHistoryDO = JSON.parseObject(param,VodPlayHistoryDO.class); return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.insertHistoryNew(vodPlayHistoryDO)); } + + @PostMapping("dataFix") + public void dadaFix(){ + vodPlayHistoryService.dataFix(); + } + } diff --git a/src/main/java/com/subsidy/jobs/Scheduler.java b/src/main/java/com/subsidy/jobs/Scheduler.java index 63e5eef..bfbe8b4 100644 --- a/src/main/java/com/subsidy/jobs/Scheduler.java +++ b/src/main/java/com/subsidy/jobs/Scheduler.java @@ -1,18 +1,19 @@ package com.subsidy.jobs; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.subsidy.mapper.OprAdmDictMapper; import com.subsidy.mapper.OprMemDictMapper; import com.subsidy.mapper.VodPlayHistoryMapper; -import com.subsidy.model.OprAdmDictDO; +import com.subsidy.mongodb.OprAdmDictDO; import com.subsidy.model.OprMemDictDO; import com.subsidy.model.VodPlayHistoryDO; import com.subsidy.util.DateFormatUtil; import com.subsidy.util.RedisUtil; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; + import java.time.LocalDateTime; import java.util.List; import java.util.Set; @@ -41,6 +42,8 @@ public class Scheduler { @Autowired private RedisUtil redisUtil; + @Autowired + private MongoTemplate mongoTemplate; /** 删除十天前登录记录(管理端) */ @@ -49,45 +52,45 @@ public class Scheduler { List list = oprAdmDictMapper.getRecordByDate(); if(list != null) { for (OprAdmDictDO oprAdmDictDO : list) { - oprAdmDictMapper.deleteById(oprAdmDictDO.getId()); + //oprAdmDictMapper.deleteById(oprAdmDictDO.getId()); } } } - /** - * 删除十天前登录记录(学员) - */ - //@Scheduled(cron = "0 42 18 * * ?") - public void delOprMemRecord() { - List list = oprMemDictMapper.getRecordByDate(); - if(list != null) { - for (OprMemDictDO oprMemDictDO : list) { - oprMemDictMapper.deleteById(oprMemDictDO.getId()); - } - } - } + ///** + // * 删除十天前登录记录(学员) + // */ + ////@Scheduled(cron = "0 42 18 * * ?") + //public void delOprMemRecord() { + // List list = oprMemDictMapper.getRecordByDate(); + // if(list != null) { + // for (OprMemDictDO oprMemDictDO : list) { + // oprMemDictMapper.deleteById(oprMemDictDO.getId()); + // } + // } + //} - /** - * 用户数据审计记录添加(学员) - */ - //@Scheduled(cron = "0 39 18 * * ?") - public void getOprMemRecord() { - Set set = redisUtil.scan("*memberLogin*"); - if(set != null) { - for (String str : set) { - int result = (Integer) redisUtil.get(str); - OprMemDictDO oprMemDictDO = new OprMemDictDO(); - String [] opr = str.split("_"); - LocalDateTime createDate = DateFormatUtil.secondToLocalDateTime(Long.valueOf(opr[3])); - oprMemDictDO.setResult(result); - oprMemDictDO.setOprType("登录"); - oprMemDictDO.setUserId(Long.valueOf(opr[2])); - oprMemDictDO.setCreateDate(createDate); - oprMemDictMapper.insert(oprMemDictDO); - redisUtil.del(str); - } - } - } + ///** + // * 用户数据审计记录添加(学员) + // */ + ////@Scheduled(cron = "0 39 18 * * ?") + //public void getOprMemRecord() { + // Set set = redisUtil.scan("*memberLogin*"); + // if(set != null) { + // for (String str : set) { + // int result = (Integer) redisUtil.get(str); + // OprMemDictDO oprMemDictDO = new OprMemDictDO(); + // String [] opr = str.split("_"); + // LocalDateTime createDate = DateFormatUtil.secondToLocalDateTime(Long.valueOf(opr[3])); + // oprMemDictDO.setResult(result); + // oprMemDictDO.setOprType("登录"); + // oprMemDictDO.setUserId(Long.valueOf(opr[2])); + // oprMemDictDO.setCreateDate(createDate); + // oprMemDictMapper.insert(oprMemDictDO); + // redisUtil.del(str); + // } + // } + //} /** * 视频播放记录缩量 @@ -106,4 +109,5 @@ public class Scheduler { vodPlayHistoryMapper.insert(vodPlayHistoryDO); } } + } diff --git a/src/main/java/com/subsidy/mapper/CourseContentMapper.java b/src/main/java/com/subsidy/mapper/CourseContentMapper.java index c8115fc..b4d559e 100644 --- a/src/main/java/com/subsidy/mapper/CourseContentMapper.java +++ b/src/main/java/com/subsidy/mapper/CourseContentMapper.java @@ -24,7 +24,7 @@ public interface CourseContentMapper extends BaseMapper { /** * 查看课程下有多少个视频 */ - List getCourseVods(Integer courseId); + List getCourseVods(Long courseId); /** * 查看某个目录下 某个成员看视频的进度 @@ -36,4 +36,5 @@ public interface CourseContentMapper extends BaseMapper { */ List contentFiles(Long courseId); + Integer selectMaxOrderNo(Long courseId); } diff --git a/src/main/java/com/subsidy/mapper/ExerciseDictMapper.java b/src/main/java/com/subsidy/mapper/ExerciseDictMapper.java index 296e4bb..1770e6e 100644 --- a/src/main/java/com/subsidy/mapper/ExerciseDictMapper.java +++ b/src/main/java/com/subsidy/mapper/ExerciseDictMapper.java @@ -14,14 +14,16 @@ import org.springframework.stereotype.Repository; * @author DengMin * @since 2021-10-12 */ - @Repository +@Repository public interface ExerciseDictMapper extends BaseMapper { - /** - * 获取某一套卷子的题目 - */ - IPage getPaperExercise(IPage page,Long paperId,String difficulty,String exerciseType,String title); - - + /** + * 获取某一套卷子的题目 + */ + IPage getPaperExercise(IPage page, Long paperId, String difficulty, String exerciseType, String title); + /** + * 获取某个卷子的最大排序号 + */ + Integer getMaximumNo(Long paperId); } diff --git a/src/main/java/com/subsidy/mapper/ExerciseDoneResultMapper.java b/src/main/java/com/subsidy/mapper/ExerciseDoneResultMapper.java index da31a9a..b273887 100644 --- a/src/main/java/com/subsidy/mapper/ExerciseDoneResultMapper.java +++ b/src/main/java/com/subsidy/mapper/ExerciseDoneResultMapper.java @@ -1,10 +1,11 @@ package com.subsidy.mapper; -import com.subsidy.model.ExerciseDoneResultDO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.subsidy.model.ExerciseDoneResultDO; import com.subsidy.vo.administer.GetMemberPapersVO; import com.subsidy.vo.administer.GetPaperDetailVO; import com.subsidy.vo.done.GetMaxScoreVO; +import com.subsidy.vo.done.TestScoreInfoVO; import com.subsidy.vo.exercise.GetDoneDetailVO; import org.springframework.stereotype.Repository; @@ -42,6 +43,18 @@ public interface ExerciseDoneResultMapper extends BaseMapper getMaxScore(Long classId, Long memberId); + /** + * 查看某个人某个卷子完成的最好成绩 + */ + ExerciseDoneResultDO getMaxScorePaper(Long paperId,Long memberId); + /** + * 测试成绩 最高成绩 测试测试 总评价 + */ + TestScoreInfoVO testScoreInfo(Long paperId, Long memberId); + /** + * 汇总 查看课程通过情况 + */ + Integer getClassTestPassRate(Long classId); } diff --git a/src/main/java/com/subsidy/mapper/FileDictMapper.java b/src/main/java/com/subsidy/mapper/FileDictMapper.java index 4ee1912..1f42b30 100644 --- a/src/main/java/com/subsidy/mapper/FileDictMapper.java +++ b/src/main/java/com/subsidy/mapper/FileDictMapper.java @@ -4,6 +4,8 @@ import com.subsidy.model.FileDictDO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.springframework.stereotype.Repository; +import java.util.List; + /** *

* 课件表 Mapper 接口 @@ -15,4 +17,6 @@ import org.springframework.stereotype.Repository; @Repository public interface FileDictMapper extends BaseMapper { + List selectFiles(Long contentId,String fileName); + } diff --git a/src/main/java/com/subsidy/mapper/OprAdmDictMapper.java b/src/main/java/com/subsidy/mapper/OprAdmDictMapper.java index d52761c..741930d 100644 --- a/src/main/java/com/subsidy/mapper/OprAdmDictMapper.java +++ b/src/main/java/com/subsidy/mapper/OprAdmDictMapper.java @@ -1,7 +1,7 @@ package com.subsidy.mapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.subsidy.model.OprAdmDictDO; +import com.subsidy.mongodb.OprAdmDictDO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.subsidy.vo.opr.GetHistoryVO; import org.springframework.stereotype.Repository; diff --git a/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java b/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java index 9a1d023..afeafc7 100644 --- a/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java +++ b/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java @@ -66,6 +66,14 @@ public interface VodPlayHistoryMapper extends BaseMapper { */ List memberStudyLog(Long classId, Long memberId); + /** + * 查看某个人的学习累计时长 + */ + Integer memberTotalLength(Long memberId); + /** + * 查看某个人某个视频的累计时长 + */ + Integer memberVodTotalLength(Long memberId,Long vodId); } diff --git a/src/main/java/com/subsidy/model/Collection.java b/src/main/java/com/subsidy/model/Collection.java new file mode 100644 index 0000000..abcf13b --- /dev/null +++ b/src/main/java/com/subsidy/model/Collection.java @@ -0,0 +1,13 @@ +package com.subsidy.model; + +import lombok.Data; + +@Data + +public class Collection { + + private String _id; + + private String name; + +} diff --git a/src/main/java/com/subsidy/model/OprAdmDictDO.java b/src/main/java/com/subsidy/model/OprAdmDictDO.java deleted file mode 100644 index 8ece55c..0000000 --- a/src/main/java/com/subsidy/model/OprAdmDictDO.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.subsidy.model; - -import com.subsidy.util.BaseModel; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - *

- * 审计表 - *

- * - * @author DengMin - * @since 2021-12-13 - */ -@Data -@EqualsAndHashCode(callSuper = true) -@TableName("opr_adm_dict") -public class OprAdmDictDO extends BaseModel { - - private static final long serialVersionUID = 1L; - - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - /** - * 用户id - */ - private Long userId; - - /** - * 操作类型 - */ - private String oprType; - - /** - * 登录结果 - */ - private Integer result; - -} diff --git a/src/main/java/com/subsidy/model/OprMemDictDO.java b/src/main/java/com/subsidy/model/OprMemDictDO.java index 252bbc1..5622567 100644 --- a/src/main/java/com/subsidy/model/OprMemDictDO.java +++ b/src/main/java/com/subsidy/model/OprMemDictDO.java @@ -16,14 +16,9 @@ import lombok.EqualsAndHashCode; * @since 2021-12-13 */ @Data -@EqualsAndHashCode(callSuper = true) -@TableName("opr_mem_dict") -public class OprMemDictDO extends BaseModel { +public class OprMemDictDO { - private static final long serialVersionUID = 1L; - - @TableId(value = "id", type = IdType.AUTO) - private Long id; + private String _id; /** * 用户id @@ -40,4 +35,13 @@ public class OprMemDictDO extends BaseModel { */ private Integer result; + /** + * 登录时间 + */ + private String loginDateFormat; + + /** + * 创建时间 + */ + private String createDate; } diff --git a/src/main/java/com/subsidy/model/VodPlayHistoryDO.java b/src/main/java/com/subsidy/model/VodPlayHistoryDO.java index 900a7bc..d5fc850 100644 --- a/src/main/java/com/subsidy/model/VodPlayHistoryDO.java +++ b/src/main/java/com/subsidy/model/VodPlayHistoryDO.java @@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableId; import lombok.Data; import lombok.EqualsAndHashCode; +import java.time.LocalDateTime; + /** *

* 视频播放历史记录表 @@ -55,5 +57,7 @@ public class VodPlayHistoryDO extends BaseModel { */ private Integer playCount; + private LocalDateTime playDate; + } diff --git a/src/main/java/com/subsidy/mongodb/MongoController.java b/src/main/java/com/subsidy/mongodb/MongoController.java new file mode 100644 index 0000000..74fb71e --- /dev/null +++ b/src/main/java/com/subsidy/mongodb/MongoController.java @@ -0,0 +1,68 @@ +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 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 collections = mongoTemplate.findAll(Collection.class); + //System.out.println(collections); + // + //Query query = new Query(Criteria.where("name").regex("张"));//可累加条件 + //List 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 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); + + + } + +} diff --git a/src/main/java/com/subsidy/mongodb/OprAdmDictDO.java b/src/main/java/com/subsidy/mongodb/OprAdmDictDO.java new file mode 100644 index 0000000..443c8fc --- /dev/null +++ b/src/main/java/com/subsidy/mongodb/OprAdmDictDO.java @@ -0,0 +1,59 @@ +package com.subsidy.mongodb; + +import com.subsidy.util.BaseModel; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.omg.CosNaming.NamingContextExtPackage.StringNameHelper; + +/** + *

+ * 审计表 + *

+ * + * @author DengMin + * @since 2021-12-13 + */ +@Data +public class OprAdmDictDO { + + private String _id; + + /** + * 用户id + */ + private Long userId; + + /** + * 公司id + */ + private Long companyId; + + /** + * 名字 + */ + private String userName; + + /** + * 操作类型 + */ + private String oprType; + + /** + * 登录结果 + */ + private Integer result; + + /** + * 登录时间 + */ + private String loginDateFormat; + + /** + * 创建时间 + */ + private String createDate; + +} diff --git a/src/main/java/com/subsidy/mongodb/PageVO.java b/src/main/java/com/subsidy/mongodb/PageVO.java new file mode 100644 index 0000000..cca0447 --- /dev/null +++ b/src/main/java/com/subsidy/mongodb/PageVO.java @@ -0,0 +1,26 @@ +package com.subsidy.mongodb; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import lombok.Data; + +import java.util.List; + +@Data +public class PageVO { + + + /** + * 分页记录列表 + * + * @return 分页对象记录列表 + */ + private List records; + + /** + * 设置当前满足条件总行数 + */ + private long total; + + + +} diff --git a/src/main/java/com/subsidy/service/ExerciseDictService.java b/src/main/java/com/subsidy/service/ExerciseDictService.java index a730c54..44a7f5f 100644 --- a/src/main/java/com/subsidy/service/ExerciseDictService.java +++ b/src/main/java/com/subsidy/service/ExerciseDictService.java @@ -21,16 +21,12 @@ import java.util.List; */ public interface ExerciseDictService extends IService { - IPage getAllExercises(GetAllExercisesDTO getAllExercisesDTO); - String addExercise(ExerciseDictDO exerciseDictDO); String deleteExercise(ExerciseDictDO exerciseDictDO); String updateExercise(ExerciseDictDO exerciseDictDO); - List getCourseExercises(CourseDictDO courseDictDO); - Long submit(SubmitDTO submitDTO); IPage getPaperExercise(GetPaperExerciseDTO getPaperExerciseDTO); diff --git a/src/main/java/com/subsidy/service/MemberService.java b/src/main/java/com/subsidy/service/MemberService.java index 39db22a..e4e3928 100644 --- a/src/main/java/com/subsidy/service/MemberService.java +++ b/src/main/java/com/subsidy/service/MemberService.java @@ -60,8 +60,6 @@ public interface MemberService extends IService { GetStudyInfoVO getStudyInfo(MemberDO memberDO); - ExerciseDoneResultDO getDoneResult(ExerciseDoneResultDO exerciseDoneResultDO); - String checkTimes(ExerciseDoneResultDO exerciseDoneResultDO); void importRedis(); diff --git a/src/main/java/com/subsidy/service/OprAdmDictService.java b/src/main/java/com/subsidy/service/OprAdmDictService.java index 092b88c..ae63e22 100644 --- a/src/main/java/com/subsidy/service/OprAdmDictService.java +++ b/src/main/java/com/subsidy/service/OprAdmDictService.java @@ -2,8 +2,9 @@ package com.subsidy.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.subsidy.dto.opr.GetHistoryDTO; -import com.subsidy.model.OprAdmDictDO; +import com.subsidy.mongodb.OprAdmDictDO; import com.baomidou.mybatisplus.extension.service.IService; +import com.subsidy.mongodb.PageVO; import com.subsidy.vo.opr.GetHistoryVO; /** @@ -16,6 +17,6 @@ import com.subsidy.vo.opr.GetHistoryVO; */ public interface OprAdmDictService extends IService { - IPage getHistory(GetHistoryDTO getHistoryDTO); + PageVO getHistory(GetHistoryDTO getHistoryDTO); } diff --git a/src/main/java/com/subsidy/service/VodPlayHistoryService.java b/src/main/java/com/subsidy/service/VodPlayHistoryService.java index a355a19..6b8c5ea 100644 --- a/src/main/java/com/subsidy/service/VodPlayHistoryService.java +++ b/src/main/java/com/subsidy/service/VodPlayHistoryService.java @@ -16,4 +16,6 @@ public interface VodPlayHistoryService extends IService { String insertHistory(VodPlayHistoryDO vodPlayHistoryDO); String insertHistoryNew(VodPlayHistoryDO vodPlayHistoryDO); + + void dataFix(); } diff --git a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java index cf47d81..cfbbac8 100644 --- a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java @@ -37,13 +37,14 @@ import com.subsidy.model.ExerciseDoneHistoryDO; import com.subsidy.model.ExerciseDoneResultDO; import com.subsidy.model.MemberDO; import com.subsidy.model.MemberDepartmentMappingDO; -import com.subsidy.model.OprAdmDictDO; +import com.subsidy.model.OprMemDictDO; +import com.subsidy.mongodb.OprAdmDictDO; import com.subsidy.model.RoleAdministerMappingDO; import com.subsidy.model.SignInRecordDO; import com.subsidy.model.VodDictDO; -import com.subsidy.model.VodPlayHistoryDO; import com.subsidy.service.AdministerService; import com.subsidy.util.ConstantUtils; +import com.subsidy.util.DateFormatUtil; import com.subsidy.util.ExcelFormatUtils; import com.subsidy.util.JwtUtil; import com.subsidy.util.Localstorage; @@ -63,11 +64,13 @@ import com.subsidy.vo.administer.OperatorsVO; import com.subsidy.vo.administer.PermissionsVO; import com.subsidy.vo.classdict.ClassDetailVO; import com.subsidy.vo.done.GetMaxScoreVO; +import com.subsidy.vo.done.TestScoreInfoVO; import com.subsidy.vo.member.ClassSignVO; import com.subsidy.vo.sign.AnswerRecordVO; import com.subsidy.vo.vod.ClassVodCompleteInfoVO; import com.subsidy.vo.vod.DayInfoItemVO; import com.subsidy.vo.vod.GetMemberStudyInfoVO; +import net.bytebuddy.description.modifier.SynchronizationState; import net.sourceforge.pinyin4j.PinyinHelper; import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType; import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat; @@ -91,8 +94,11 @@ import org.apache.poi.xssf.streaming.SXSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.beans.BeanUtils; 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.AsyncResult; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.context.request.RequestContextHolder; @@ -118,9 +124,6 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Set; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; import java.util.concurrent.atomic.AtomicInteger; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; @@ -179,6 +182,9 @@ public class AdministerServiceImpl extends ServiceImpl 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 oprAdmDictDOS = mongoTemplate.find(query, OprAdmDictDO.class); + + //查mysql逻辑 + //List oprAdmDictDOS = oprAdmDictMapper.getLoginInfo(administerDO1.getId()); boolean flag = false; for (int i = 0; i < oprAdmDictDOS.size(); i++) { @@ -217,7 +228,6 @@ public class AdministerServiceImpl extends ServiceImpl() + .lambda() + .eq(RoleAdministerMappingDO::getAdministerId, administerDO.getId())); return ConstantUtils.DELETE_SUCCESS; } @@ -360,7 +383,6 @@ public class AdministerServiceImpl extends ServiceImpl //总共学习课时数 + 学习时长 - summaryTask1(classSummaryVO, classMemberMappingDOS, vodDictDOS)); - executorService.execute(() -> //测试通过率 - summaryTask2(classSummaryVO, classDictDO.getId())); - executorService.execute(() -> //签到总次数 - summaryTask3(classSummaryVO, classDictDO.getId())); - executorService.execute(() -> //答疑数 - summaryTask4(classSummaryVO, classDictDO.getId())); - //执行后不再接收新任务,如果里面有任务,就执行完 - executorService.shutdown(); - try { - while (true) { - //等待所有任务都结束了继续执行 - if (executorService.isTerminated()) { - break; - } - } - - } catch (Exception ex) { - ex.printStackTrace(); - } - return classSummaryVO; - } - - public Future summaryTask1(ClassSummaryVO classSummaryVO, List classMemberMappingDOS, List vodDictDOS) { - - int totalStudyVods = 0; int totalStudyLength = 0; //学生总共学习课时数 for (VodDictDO vodDictDO : vodDictDOS) { for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) { - List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper() - .lambda() - .eq(VodPlayHistoryDO::getMemberId, classMemberMappingDO.getMemberId()) - .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId()) - .orderByDesc(VodPlayHistoryDO::getPlayRecord)); - - for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) { - totalStudyLength += vodPlayHistoryDO.getPlayLength(); - } - - if (vodPlayHistoryDOS.size() > 0) { - if (vodPlayHistoryDOS.get(0).getPlayRecord() >= vodDictDO.getVodLength() * 0.8) { - totalStudyVods++; - } + int totalLength = vodPlayHistoryMapper.memberVodTotalLength(classMemberMappingDO.getMemberId(), vodDictDO.getId()); + if (totalLength >= vodDictDO.getVodLength()) { + totalStudyVods++; } } } @@ -444,49 +425,27 @@ public class AdministerServiceImpl extends ServiceImpl(classSummaryVO); - } - - public Future summaryTask2(ClassSummaryVO classSummaryVO, Long classId) { //测试通过率 - List exerciseDoneResultDOS = exerciseDoneResultMapper.selectList(new QueryWrapper() - .lambda() - .eq(ExerciseDoneResultDO::getClassId, classId)); - - int passNum = 0; - - for (ExerciseDoneResultDO exerciseDoneResultDO : exerciseDoneResultDOS) { - if (exerciseDoneResultDO.getRightCounts() >= exerciseDoneResultDO.getTotalCounts() * 0.6) { - passNum++; - } - } - + Integer passNum = exerciseDoneResultMapper.getClassTestPassRate(classDictDO.getId()); classSummaryVO.setPassRate(MathUtil.intDivFloorPercent(passNum, classSummaryVO.getMemberCount())); - return new AsyncResult<>(classSummaryVO); - } - public Future 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())); - return new AsyncResult<>(classSummaryVO); - } - - public Future summaryTask4(ClassSummaryVO classSummaryVO, Long classId) { //答疑数 Integer count = answeringQuestionMapper.selectCount(new QueryWrapper() .lambda() - .eq(AnsweringQuestionDO::getClassId, classId)); + .eq(AnsweringQuestionDO::getClassId, classDictDO.getId())); classSummaryVO.setAnswerCount(count); - return new AsyncResult<>(classSummaryVO); + return classSummaryVO; } + public IPage classDetail(ClassDetailDTO classDetailDTO) { Page pager = new Page(classDetailDTO.getPageNum(), classDetailDTO.getPageSize()); - IPage classDetailVOIPage = this.baseMapper.classMembers(pager, classDetailDTO.getId(), classDetailDTO.getUserName()); List classDetailVOS = classDetailVOIPage.getRecords(); @@ -497,112 +456,59 @@ public class AdministerServiceImpl extends ServiceImpl ///该学生完成了多少个 学生成绩,学生进度 - classDetailTask1(classDetailVO, vodDictDOS, classDictDO.getId(), classDetailVO.getId())); - cachedThreadPool.execute(() -> //答疑 - classDetailTask2(classDetailVO, classDetailDTO)); - cachedThreadPool.execute(() -> //签到 - classDetailTask3(classDetailVO, classDetailDTO)); - - //执行后不再接收新任务,如果里面有任务,就执行完 - cachedThreadPool.shutdown(); - try { - while (true) { - //等待所有任务都结束了继续执行 - if (cachedThreadPool.isTerminated()) { - break; - } - } - } catch (Exception ex) { - ex.printStackTrace(); - } - } - classDetailVOIPage.setRecords(classDetailVOS); - return classDetailVOIPage; - } - - public Future classDetailTask1(ClassDetailVO classDetailVO, List vodDictDOS, Long classId, Long memberId) { - - //该学生完成了多少个 - int i = 0; - int playLength = 0; - //该成员完成了几个视频 - for (VodDictDO vodDictDO : vodDictDOS) { - List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper() - .lambda() - .eq(VodPlayHistoryDO::getMemberId, memberId) - .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId()) - .orderByDesc(VodPlayHistoryDO::getPlayRecord)); - - - if (vodPlayHistoryDOS.size() > 0) { - if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) { + //该学生完成了多少个 + 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.setTrainingLength(playLength); - for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) { - playLength += vodPlayHistoryDO.getPlayLength(); - } - - } - classDetailVO.setStudyVodCounts(i); - - //学生测试完成情况 多套卷子各返回最高成绩 - List getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classId, classDetailVO.getId()); - classDetailVO.setGetMaxScoreVOS(getMaxScoreVOS); + //学生测试完成情况 多套卷子各返回最高成绩 + List getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classDictDO.getId(), classDetailVO.getId()); + classDetailVO.setGetMaxScoreVOS(getMaxScoreVOS); - Boolean flag = true; + Boolean flag = true; - if (getMaxScoreVOS.size() > 0) { - for (GetMaxScoreVO getMaxScoreVO : getMaxScoreVOS) { - if (getMaxScoreVO.getScore() < 60) { - flag = false; + if (getMaxScoreVOS.size() > 0) { + for (GetMaxScoreVO getMaxScoreVO : getMaxScoreVOS) { + if (getMaxScoreVO.getScore() < 60) { + flag = false; + } } + } else { + flag = false; } - } else { - flag = false; - } - if (flag && i == vodDictDOS.size()) { - classDetailVO.setResult("合格"); - } else { - classDetailVO.setResult("不合格"); - } - - classDetailVO.setClassProcess(i + "/" + vodDictDOS.size()); - - //培训时长 - classDetailVO.setTrainingLength(playLength); - return new AsyncResult<>(classDetailVO); - } - - public Future classDetailTask2(ClassDetailVO classDetailVO, ClassDetailDTO classDetailDTO) { + //总评价 + classDetailVO.setResult(flag && i == vodDictDOS.size() ? "合格" : "不合格"); - //答疑 - Integer count = answeringQuestionMapper.selectCount(new QueryWrapper() - .lambda() - .eq(AnsweringQuestionDO::getAskId, classDetailVO.getId()) - .eq(AnsweringQuestionDO::getClassId, classDetailDTO.getId())); - classDetailVO.setAskCounts(count); + //课程进度 + classDetailVO.setClassProcess(i + "/" + vodDictDOS.size()); - return new AsyncResult<>(classDetailVO); - } + //答疑 + Integer count = answeringQuestionMapper.selectCount(new QueryWrapper() + .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 classDetailTask3(ClassDetailVO classDetailVO, ClassDetailDTO classDetailDTO) { - ////签到次数 - long set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId_" + classDetailVO.getId() + "_classId_" + classDetailDTO.getId() + "*").stream().count(); - classDetailVO.setSignCounts(set); - return new AsyncResult<>(classDetailVO); + } + classDetailVOIPage.setRecords(classDetailVOS); + return classDetailVOIPage; } public List exportClassDetail(ClassDetailDTO classDetailDTO) throws Exception { @@ -619,102 +525,69 @@ public class AdministerServiceImpl extends ServiceImpl ///该学生完成了多少个 学生成绩,学生进度 - 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()); - String studyDate = classDictDO.getStartDate() + " 至 " + classDictDO.getEndDate(); - ExcelUtil.writeMemberExcel(companyDictDO.getCompanyName(), studyDate, courseDictDO.getCourseName(), "授课记录汇总表", classDetailVOS, ExcelFormatUtils.memberList); - } - return classDetailVOS; - } + //学生测试完成情况 多套卷子各返回最高成绩 + List getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classDictDO.getId(), classDetailVO.getId()); + classDetailVO.setGetMaxScoreVOS(getMaxScoreVOS); - public Future exportClassDetailTask(ClassDetailVO classDetailVO, List vodDictDOS, Long classId, Long memberId) { + Boolean flag = true; - //该学生完成了多少个 - int i = 0; - int playLength = 0; - //该成员完成了几个视频 - for (VodDictDO vodDictDO : vodDictDOS) { - List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper() - .lambda() - .eq(VodPlayHistoryDO::getMemberId, memberId) - .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId()) - .orderByDesc(VodPlayHistoryDO::getPlayRecord)); + StringBuilder stringBuilder = new StringBuilder(); - if (vodPlayHistoryDOS.size() > 0) { - if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) { - i++; + if (getMaxScoreVOS.size() > 0) { + for (GetMaxScoreVO getMaxScoreVO : getMaxScoreVOS) { + stringBuilder.append(getMaxScoreVO.getPaperName() + ":" + getMaxScoreVO.getScore()); + if (getMaxScoreVO.getScore() < 60) { + flag = false; + } + stringBuilder.append(" "); } - } - - for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) { - playLength += vodPlayHistoryDO.getPlayLength(); + } else { + flag = false; } - } - //classDetailVO.setStudyVodCounts(i); - classDetailVO.setClassProcess(i + "/" + vodDictDOS.size()); - //学生测试完成情况 多套卷子各返回最高成绩 - List getMaxScoreVOS = exerciseDoneResultMapper.getMaxScore(classId, classDetailVO.getId()); - classDetailVO.setGetMaxScoreVOS(getMaxScoreVOS); + //总评价 + classDetailVO.setResult(flag && i == vodDictDOS.size() ? "合格" : "不合格"); - Boolean flag = true; + classDetailVO.setScore(stringBuilder.toString()); - StringBuilder stringBuilder = new StringBuilder(); + //培训时长 + classDetailVO.setTrainingLengthStr(MathUtil.secToTime(playLength)); - if (getMaxScoreVOS.size() > 0) { - for (GetMaxScoreVO getMaxScoreVO : getMaxScoreVOS) { - stringBuilder.append(getMaxScoreVO.getPaperName() + ":" + getMaxScoreVO.getScore()); - if (getMaxScoreVO.getScore() < 60) { - flag = false; - } - stringBuilder.append(" "); - } + //答疑 + Integer count = answeringQuestionMapper.selectCount(new QueryWrapper() + .lambda() + .eq(AnsweringQuestionDO::getAskId, classDetailVO.getId()) + .eq(AnsweringQuestionDO::getClassId, classDetailDTO.getId())); + classDetailVO.setAskCounts(count); - } 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()); - - //培训时长 - classDetailVO.setTrainingLength(playLength); - classDetailVO.setTrainingLengthStr(MathUtil.secToTime(playLength)); - return new AsyncResult(classDetailVO); + if (classDetailDTO.getFlag()) { + CourseDictDO courseDictDO = courseDictMapper.selectById(classDictDO.getCourseId()); + String studyDate = classDictDO.getStartDate() + " 至 " + classDictDO.getEndDate(); + ExcelUtil.writeMemberExcel(companyDictDO.getCompanyName(), studyDate, courseDictDO.getCourseName(), "授课记录汇总表", classDetailVOS, ExcelFormatUtils.memberList); + } + return classDetailVOS; } public IPage signDetail(ClassDetailDTO classDetailDTO) { @@ -729,83 +602,45 @@ public class AdministerServiceImpl extends ServiceImpl //全部视频数 - classSignVO.setAllVodCounts(vodDictDOS.size())); - newCachedThreadPool.execute(() -> //完成率,完成情况 - signDetailsTask1(vodDictDOS, classSignVO)); - newCachedThreadPool.execute(() -> //签到,签到时间 - signDetailsTask2(classSignVO, classDetailDTO)); - - //执行后不再接收新任务,如果里面有任务,就执行完 - newCachedThreadPool.shutdown(); - try { - while (true) { - //等待所有任务都结束了继续执行 - if (newCachedThreadPool.isTerminated()) { - break; - } + //该学生完成了多少个 + int i = 0; + int playLength = 0; + //该成员完成了几个视频 + for (VodDictDO vodDictDO : vodDictDOS) { + int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classSignVO.getId(), vodDictDO.getId()); + if (totalPlayLength >= vodDictDO.getVodLength()) { + i++; } - - } catch (Exception ex) { - ex.printStackTrace(); + playLength += totalPlayLength; } - } - classSignVOIPage.setRecords(classSignVOS); - return classSignVOIPage; - } + //课程进度 + classSignVO.setClassProcess(i + "/" + vodDictDOS.size()); - public Future signDetailsTask1(List vodDictDOS, ClassSignVO classSignVO) { + //完成率 + String percent = MathUtil.getPercentAvgIndexWithPercent(new BigDecimal(i), new BigDecimal(vodDictDOS.size())); + classSignVO.setPercent(percent); - //该学生完成了多少个 - int i = 0; - int playLength = 0; - //该成员完成了几个视频 - for (VodDictDO vodDictDO : vodDictDOS) { - List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper() - .lambda() - .eq(VodPlayHistoryDO::getMemberId, classSignVO.getId()) - .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId()) - .orderByDesc(VodPlayHistoryDO::getPlayRecord)); + //培训时长 + classSignVO.setTrainingLength(playLength); + classSignVO.setTrainingLengthStr(MathUtil.secToTime(playLength)); - if (vodPlayHistoryDOS.size() > 0) { - if (vodPlayHistoryDOS.get(0).getPlayRecord() > vodDictDO.getVodLength() * 0.8) { - i++; - } + //签到 + Set 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(";"); } - for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) { - playLength += vodPlayHistoryDO.getPlayLength(); + if (StringUtils.isNotBlank(stringBuilder.toString())) { + 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 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); - } - return new AsyncResult<>(classSignVO); + classSignVOIPage.setRecords(classSignVOS); + return classSignVOIPage; } public List exportSignDetail(ClassDetailDTO classDetailDTO) throws Exception { @@ -819,29 +654,40 @@ public class AdministerServiceImpl extends ServiceImpl //全部视频数 - classSignVO.setAllVodCounts(vodDictDOS.size())); - newCachedThreadPool.execute(() -> //完成率,完成情况 - signDetailsTask1(vodDictDOS, classSignVO)); - newCachedThreadPool.execute(() -> //签到,签到时间 - signDetailsTask2(classSignVO, classDetailDTO)); - - //执行后不再接收新任务,如果里面有任务,就执行完 - newCachedThreadPool.shutdown(); - try { - while (true) { - //等待所有任务都结束了继续执行 - if (newCachedThreadPool.isTerminated()) { - break; - } + //该学生完成了多少个 + int i = 0; + int playLength = 0; + //该成员完成了几个视频 + for (VodDictDO vodDictDO : vodDictDOS) { + int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classSignVO.getId(), vodDictDO.getId()); + if (totalPlayLength >= vodDictDO.getVodLength()) { + i++; } + 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 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()) { @@ -862,47 +708,26 @@ public class AdministerServiceImpl extends ServiceImpl exerciseTestVOIPage = this.baseMapper.exerciseTest(pager, classDetailDTO.getId(), classDetailDTO.getUserName()); List classSignVOS = exerciseTestVOIPage.getRecords(); - ExecutorService newCachedThreadPool = Executors.newCachedThreadPool(); - for (ExerciseTestVO exerciseTestVO : classSignVOS) { - newCachedThreadPool.execute(() -> //签到,签到时间 - exerciseTestTask(exerciseTestVO, classDetailDTO.getId(), exerciseTestVO.getPaperId())); - } - //执行后不再接收新任务,如果里面有任务,就执行完 - newCachedThreadPool.shutdown(); - try { - while (true) { - //等待所有任务都结束了继续执行 - if (newCachedThreadPool.isTerminated()) { - break; - } + //学生测试完成情况 + TestScoreInfoVO testScoreInfoVO = exerciseDoneResultMapper.testScoreInfo(classDetailDTO.getPaperId(), exerciseTestVO.getId()); + exerciseTestVO.setPaperId(exerciseTestVO.getPaperId()); + if (null != testScoreInfoVO) { + exerciseTestVO.setScore(testScoreInfoVO.getScore()); + exerciseTestVO.setResult(testScoreInfoVO.getResult()); + //测评次数 + exerciseTestVO.setCount(testScoreInfoVO.getCnt()); + } else { + exerciseTestVO.setScore(0); + exerciseTestVO.setResult("不合格"); + exerciseTestVO.setCount(0); } - - } catch (Exception ex) { - ex.printStackTrace(); } + exerciseTestVOIPage.setRecords(classSignVOS); return exerciseTestVOIPage; } - public void exerciseTestTask(ExerciseTestVO exerciseTestVO, Long classId, Long paperId) { - //学生测试完成情况 - List exerciseDoneResultDOs = exerciseDoneResultMapper.queryExerciseDoneResult(exerciseTestVO.getId(), classId, paperId); - - exerciseTestVO.setPaperId(exerciseTestVO.getPaperId()); - if (exerciseDoneResultDOs.size() > 0) { - exerciseTestVO.setScore(exerciseDoneResultDOs.get(0).getScore()); - exerciseTestVO.setResult(exerciseDoneResultDOs.get(0).getResult()); - //测评次数 - exerciseTestVO.setCount(exerciseDoneResultDOs.size()); - } else { - exerciseTestVO.setScore(0); - exerciseTestVO.setResult("不合格"); - exerciseTestVO.setCount(0); - } - - } - public List exportExerciseTest(ClassDetailDTO classDetailDTO) throws Exception { Page pager = new Page(0, -1L); @@ -912,24 +737,20 @@ public class AdministerServiceImpl extends ServiceImpl //签到,签到时间 - exerciseTestTask(exerciseTestVO, classDetailDTO.getId(), exerciseTestVO.getPaperId())); - } - //执行后不再接收新任务,如果里面有任务,就执行完 - newCachedThreadPool.shutdown(); - try { - while (true) { - //等待所有任务都结束了继续执行 - if (newCachedThreadPool.isTerminated()) { - break; - } + //学生测试完成情况 + TestScoreInfoVO testScoreInfoVO = exerciseDoneResultMapper.testScoreInfo(classDetailDTO.getPaperId(), exerciseTestVO.getId()); + exerciseTestVO.setPaperId(exerciseTestVO.getPaperId()); + if (null != testScoreInfoVO) { + exerciseTestVO.setScore(testScoreInfoVO.getScore()); + exerciseTestVO.setResult(testScoreInfoVO.getResult()); + //测评次数 + exerciseTestVO.setCount(testScoreInfoVO.getCnt()); + } else { + exerciseTestVO.setScore(0); + exerciseTestVO.setResult("不合格"); + exerciseTestVO.setCount(0); } - } catch (Exception ex) { - ex.printStackTrace(); } if (classDetailDTO.getFlag()) { @@ -976,6 +797,7 @@ public class AdministerServiceImpl extends ServiceImpl memberIds = classMemberMappingMapper.getClassMembers(classVodInfoDTO.getClassId()); + //获取课程下的视频 List vodDictDOS = vodDictMapper.getCourseVods(classVodInfoDTO.getCourseId(), classVodInfoDTO.getVodName()); for (VodDictDO vodDictDO : vodDictDOS) { //获取这个视频的学习人数和平均学习时长 @@ -1007,14 +829,17 @@ public class AdministerServiceImpl extends ServiceImpl dayInfoItemVOS = new ArrayList<>(); + int total = 0; for (GetMemberStudyInfoVO getMemberStudyInfoVO : getMemberStudyInfoVOS) { if (classDailyInfoVO.getId().equals(getMemberStudyInfoVO.getMemberId())) { DayInfoItemVO dayInfoItemVO = new DayInfoItemVO(); dayInfoItemVO.setStudyDate(getMemberStudyInfoVO.getStudyDate()); dayInfoItemVO.setTotalLength(getMemberStudyInfoVO.getPlayLength()); + total += getMemberStudyInfoVO.getPlayLength(); dayInfoItemVOS.add(dayInfoItemVO); } } + classDailyInfoVO.setTotal(total); classDailyInfoVO.setDayInfoItemVOS(dayInfoItemVOS); } return classDailyInfoVOIPage; @@ -1027,6 +852,7 @@ public class AdministerServiceImpl extends ServiceImpl title = new ArrayList<>(); title.add("姓名"); title.addAll(findDaysStr(classDailyInfoDTO.getStartDate(), classDailyInfoDTO.getEndDate())); + title.add("合计总时长"); //获取班级成员 IPage classDailyInfoVOIPage = classMemberMappingMapper.getClassMembersWithName(pager, classDailyInfoDTO.getClassId(), classDailyInfoDTO.getUserName()); @@ -1095,16 +921,21 @@ public class AdministerServiceImpl extends ServiceImpl hashMap1 = hashMap.get(data); Cell namecell = r.createCell(a.getAndIncrement()); namecell.setCellValue(memberMapper.selectById(data).getUserName()); - dates.forEach(field -> { - if (!field.equals("姓名")) { + int total = 0 ; + for (String date : dates){ + if (!date.equals("姓名")&&!"合计总时长".equals(date)) { Cell cell1 = r.createCell(a.getAndIncrement()); 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 { cell1.setCellValue("00:00:00"); } } - }); + } + + Cell totalCell = r.createCell(a.getAndIncrement()); + totalCell.setCellValue(MathUtil.secToTime(total)); }); } String fileName = String.valueOf(new Date().getTime()); @@ -1916,11 +1747,7 @@ public class AdministerServiceImpl extends ServiceImpl= 60) { - newCell.setCellValue("合格"); - } else { - newCell.setCellValue("不合格"); - } + newCell.setCellValue(exerciseTestVO.getScore() >= 60 ? "合格" : "不合格"); rowIndex++; seq++; diff --git a/src/main/java/com/subsidy/service/impl/AnsweringQuestionServiceImpl.java b/src/main/java/com/subsidy/service/impl/AnsweringQuestionServiceImpl.java index f9e74e7..3eaba90 100644 --- a/src/main/java/com/subsidy/service/impl/AnsweringQuestionServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/AnsweringQuestionServiceImpl.java @@ -29,19 +29,16 @@ public class AnsweringQuestionServiceImpl extends ServiceImpl } } - - @Async public String addCategory(CategoryDO categoryDO) { - int count = 0; + int count; if (null == categoryDO.getCompanyId()) { count = this.baseMapper.selectCount(new QueryWrapper() @@ -82,20 +80,20 @@ public class CategoryServiceImpl extends ServiceImpl return ConstantUtils.ADD_SUCCESS; } - @Async public String deleteCategory(CategoryDO categoryDO) { this.baseMapper.deleteById(categoryDO.getId()); return ConstantUtils.DELETE_SUCCESS; } - @Async public String updateCategory(CategoryDO categoryDO) { int count = this.baseMapper.selectCount(new QueryWrapper() .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); } diff --git a/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java index 7d571c1..b1caad6 100644 --- a/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java @@ -57,7 +57,6 @@ public class ClassDictServiceImpl extends ServiceImpl0){ - classDictDO.setClassType("平台支持"); - }else{ - classDictDO.setClassType("企业自建"); - } + classDictDO.setClassType(count>0?"平台支持":"企业自建"); this.baseMapper.insert(classDictDO); return ConstantUtils.ADD_SUCCESS; } - @Async public String updateClass(ClassDictDO classDictDO) { this.baseMapper.updateById(classDictDO); return ConstantUtils.SET_SUCCESS; @@ -99,7 +92,6 @@ public class ClassDictServiceImpl extends ServiceImpl() .lambda() @@ -125,7 +117,6 @@ public class ClassDictServiceImpl extends ServiceImpl() .lambda() - .eq(RoleAdministerMappingDO::getAdministerId,operatorsDTO.getId()) - .eq(RoleAdministerMappingDO::getRoleId,1)); + .eq(RoleAdministerMappingDO::getAdministerId, operatorsDTO.getId()) + .eq(RoleAdministerMappingDO::getRoleId, 1)); - if (count > 0){ + if (count > 0) { + //后台管理员 operatorsDTO.setId(null); } - return this.baseMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getId(),operatorsDTO.getUserName(),1); + return this.baseMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getId(), operatorsDTO.getUserName(), 1); } public String addOperator(AddCompanyDTO addCompanyDTO) { @@ -75,16 +76,20 @@ public class CompanyDictServiceImpl extends ServiceImpl 0 ) { + throw new HttpException(20002); + } + Integer count1 = administerMapper.selectCount(new QueryWrapper() - .lambda() - .eq(AdministerDO::getAccountName, addCompanyDTO.getAccountName())); + .lambda() + .eq(AdministerDO::getAccountName, addCompanyDTO.getAccountName())); - if (count > 0 || count1>0) { + if (count1 > 0) { throw new HttpException(20002); } - CompanyDictDO companyDictDO =new CompanyDictDO(); - BeanUtils.copyProperties(addCompanyDTO,companyDictDO); + CompanyDictDO companyDictDO = new CompanyDictDO(); + BeanUtils.copyProperties(addCompanyDTO, companyDictDO); this.baseMapper.insert(companyDictDO); AdministerDO administerDO = new AdministerDO(); @@ -108,7 +113,6 @@ public class CompanyDictServiceImpl extends ServiceImpl() - .lambda() - .eq(AdministerDO::getCompanyId,companyDictDO.getId())); + .lambda() + .eq(AdministerDO::getCompanyId, companyDictDO.getId())); + redisUtil.del(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX+companyDictDO.getId()); return ConstantUtils.DELETE_SUCCESS; } - @Async public String updateAdminister(AddCompanyDTO addCompanyDTO) { CompanyDictDO companyDictDO = new CompanyDictDO(); - BeanUtils.copyProperties(addCompanyDTO,companyDictDO); + BeanUtils.copyProperties(addCompanyDTO, companyDictDO); this.baseMapper.updateById(companyDictDO); //查找企业管理员 AdministerDO administerDO = administerMapper.selectOne(new QueryWrapper() - .lambda() - .eq(AdministerDO::getCompanyId,addCompanyDTO.getId()) - .eq(AdministerDO::getRole,1)); - if (StringUtils.isNotBlank(addCompanyDTO.getAccountName())){ + .lambda() + .eq(AdministerDO::getCompanyId, addCompanyDTO.getId()) + .eq(AdministerDO::getRole, 1)); + if (StringUtils.isNotBlank(addCompanyDTO.getAccountName())) { administerDO.setAccountName(addCompanyDTO.getAccountName()); } - if (StringUtils.isBlank(addCompanyDTO.getPassword())){ + if (StringUtils.isBlank(addCompanyDTO.getPassword())) { addCompanyDTO.setPassword(addCompanyDTO.getPassword()); } administerMapper.updateById(administerDO); return ConstantUtils.SET_SUCCESS; } - public List getAllCompany(CompanyDictDO companyDictDO){ + public List getAllCompany(CompanyDictDO companyDictDO) { return this.baseMapper.getAllCompany(companyDictDO); } diff --git a/src/main/java/com/subsidy/service/impl/CourseContentServiceImpl.java b/src/main/java/com/subsidy/service/impl/CourseContentServiceImpl.java index 04e572e..2673a5d 100644 --- a/src/main/java/com/subsidy/service/impl/CourseContentServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/CourseContentServiceImpl.java @@ -31,39 +31,34 @@ public class CourseContentServiceImpl extends ServiceImpl courseContentDOS = this.baseMapper.selectList(new QueryWrapper() - .lambda() - .eq(CourseContentDO::getCourseId,courseContentDO.getCourseId()) - .orderByDesc(CourseContentDO::getOrderNo)); + Integer orderNoTmp = this.baseMapper.selectMaxOrderNo(courseContentDO.getCourseId()); int orderNo = 1 ; - if (courseContentDOS.size()>0){ - orderNo = courseContentDOS.get(0).getOrderNo()+1; + if (null!=orderNoTmp){ + orderNo = orderNoTmp+1; } courseContentDO.setOrderNo(orderNo); this.baseMapper.insert(courseContentDO); return ConstantUtils.ADD_SUCCESS; } - @Async public String updateContent(CourseContentDO courseContentDO){ - List courseContentDOS = this.baseMapper.selectList(new QueryWrapper() + int count = this.baseMapper.selectCount(new QueryWrapper() .lambda() .eq(CourseContentDO::getCourseId,courseContentDO.getCourseId()) - .eq(CourseContentDO::getContent,courseContentDO.getContent())); + .eq(CourseContentDO::getContent,courseContentDO.getContent()) + .ne(CourseContentDO::getId,courseContentDO.getId())); - if (courseContentDOS.size()>0){ + if (count>0){ throw new HttpException(40001); } this.baseMapper.updateById(courseContentDO); diff --git a/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java index ac33235..f90c7fd 100644 --- a/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java @@ -30,10 +30,9 @@ public class CourseDictServiceImpl extends ServiceImpl() @@ -56,7 +55,6 @@ public class CourseDictServiceImpl extends ServiceImpl 0){ + //后台管理员 queryCoursesDTO.setCompanyId(null); } @@ -80,7 +79,7 @@ public class CourseDictServiceImpl extends ServiceImpl() diff --git a/src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java index 044cb5e..a04de54 100644 --- a/src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/ExerciseDictServiceImpl.java @@ -1,32 +1,25 @@ package com.subsidy.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.subsidy.dto.exercise.GetAllExercisesDTO; import com.subsidy.dto.exercise.GetPaperExerciseDTO; import com.subsidy.dto.exercise.SubmitDTO; import com.subsidy.mapper.ExerciseDictMapper; import com.subsidy.mapper.ExerciseDoneHistoryMapper; import com.subsidy.mapper.ExerciseDoneResultMapper; -import com.subsidy.model.CourseDictDO; import com.subsidy.model.ExerciseDictDO; import com.subsidy.model.ExerciseDoneHistoryDO; import com.subsidy.model.ExerciseDoneResultDO; import com.subsidy.service.ExerciseDictService; import com.subsidy.util.ConstantUtils; import com.subsidy.util.MathUtil; -import com.subsidy.vo.course.ExerciseVO; import com.subsidy.vo.exercise.GetPaperExerciseVO; import com.subsidy.vo.exercise.MemberExerciseVO; -import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; import java.util.List; /** @@ -46,67 +39,31 @@ public class ExerciseDictServiceImpl extends ServiceImpl getAllExercises(GetAllExercisesDTO getAllExercisesDTO) { - - Page pager = new Page(getAllExercisesDTO.getPageNum(), getAllExercisesDTO.getPageSize()); - - return this.baseMapper.selectPage(pager, new QueryWrapper() - .lambda() - .eq(ExerciseDictDO::getCourseId, getAllExercisesDTO.getCourseId()) - .like(ExerciseDictDO::getDifficulty, getAllExercisesDTO.getDifficulty()) - .like(ExerciseDictDO::getExerciseType, getAllExercisesDTO.getExerciseType()) - .like(ExerciseDictDO::getTitle, getAllExercisesDTO.getTitle()) - .orderByAsc(ExerciseDictDO::getOrderNo)); - } - - @Async public String addExercise(ExerciseDictDO exerciseDictDO){ - List exerciseDictDOS = this.baseMapper.selectList(new QueryWrapper() - .lambda() - .eq(ExerciseDictDO::getCourseId,exerciseDictDO.getCourseId()) - .orderByDesc(ExerciseDictDO::getOrderNo)); + Integer orderNoTmp = this.baseMapper.getMaximumNo(exerciseDictDO.getPaperId()); int orderNo = 1; - if (exerciseDictDOS.size() > 0) { - orderNo = exerciseDictDOS.get(0).getOrderNo() + 1; + if (null!= orderNoTmp) { + orderNo = orderNoTmp + 1; } exerciseDictDO.setOrderNo(orderNo); this.baseMapper.insert(exerciseDictDO); return ConstantUtils.ADD_SUCCESS; } - @Async public String deleteExercise(ExerciseDictDO exerciseDictDO) { this.baseMapper.deleteById(exerciseDictDO.getId()); return ConstantUtils.DELETE_SUCCESS; } - @Async public String updateExercise(ExerciseDictDO exerciseDictDO) { this.baseMapper.updateById(exerciseDictDO); return ConstantUtils.SET_SUCCESS; } - public List getCourseExercises(CourseDictDO courseDictDO) { - - List exerciseVOS = new ArrayList<>(); - - List exerciseDictDOS = this.baseMapper.selectList(new QueryWrapper() - .lambda() - .eq(ExerciseDictDO::getCourseId, courseDictDO.getId())); - - for (ExerciseDictDO exerciseDictDO : exerciseDictDOS) { - ExerciseVO exerciseVO = new ExerciseVO(); - BeanUtils.copyProperties(exerciseDictDO, exerciseVO); - exerciseVOS.add(exerciseVO); - } - return exerciseVOS; - } - @Transactional(rollbackFor = Exception.class) - @Async public Long submit(SubmitDTO submitDTO) { ExerciseDoneResultDO exerciseDoneResultDO = new ExerciseDoneResultDO(); @@ -134,11 +91,7 @@ public class ExerciseDictServiceImpl extends ServiceImpl= 60) { - exerciseDoneResultDO.setResult("合格"); - } else { - exerciseDoneResultDO.setResult("不合格"); - } + exerciseDoneResultDO.setResult(score>=60?"合格":"不合格"); exerciseDoneResultMapper.insert(exerciseDoneResultDO); diff --git a/src/main/java/com/subsidy/service/impl/ExerciseDoneResultServiceImpl.java b/src/main/java/com/subsidy/service/impl/ExerciseDoneResultServiceImpl.java index b6cb20b..698d535 100644 --- a/src/main/java/com/subsidy/service/impl/ExerciseDoneResultServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/ExerciseDoneResultServiceImpl.java @@ -78,12 +78,6 @@ public class ExerciseDoneResultServiceImpl extends ServiceImpl implements FileDictService { public List getContendFiles(FileDictDO fileDictDO) { - return this.baseMapper.selectList(new QueryWrapper() - .lambda() - .eq(FileDictDO::getContentId,fileDictDO.getContentId()) - .like(FileDictDO::getFileName,fileDictDO.getFileName())); + return this.baseMapper.selectFiles(fileDictDO.getContentId(),fileDictDO.getFileName()); } - @Async public String deleteFile(FileDictDO fileDictDO) { this.baseMapper.deleteById(fileDictDO.getId()); return ConstantUtils.DELETE_SUCCESS; } - @Async public String addFile(FileDictDO fileDictDO) { this.baseMapper.insert(fileDictDO); return ConstantUtils.ADD_SUCCESS; } - @Async public String updateFile(FileDictDO fileDictDO) { this.baseMapper.updateById(fileDictDO); return ConstantUtils.SET_SUCCESS; diff --git a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java index 123bd09..3e13508 100644 --- a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java @@ -37,6 +37,7 @@ import com.subsidy.model.VodDictDO; import com.subsidy.model.VodPlayHistoryDO; import com.subsidy.service.MemberService; import com.subsidy.util.ConstantUtils; +import com.subsidy.util.DateFormatUtil; import com.subsidy.util.RedisUtil; import com.subsidy.vo.administer.UserRoleVO; import com.subsidy.vo.member.ContentFilesVO; @@ -50,6 +51,7 @@ import com.subsidy.vo.member.StudyPageVO; import com.subsidy.vo.paper.QueryPapersVO; import org.springframework.beans.BeanUtils; 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.AsyncResult; import org.springframework.stereotype.Service; @@ -58,6 +60,7 @@ import org.springframework.transaction.annotation.Transactional; import java.time.Duration; import java.time.LocalDateTime; import java.util.ArrayList; +import java.util.Date; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -104,6 +107,9 @@ public class MemberServiceImpl extends ServiceImpl imple @Autowired private RedisUtil redisUtil; + @Autowired + private MongoTemplate mongoTemplate; + public IPage getAll(GetAllDTO getAllDTO) { Page pager = new Page(getAllDTO.getPageNum(), getAllDTO.getPageSize()); IPage iPage = this.baseMapper.getMembers(pager, getAllDTO.getDepartmentId(), getAllDTO.getUserName(), getAllDTO.getStatus()); @@ -155,7 +161,7 @@ public class MemberServiceImpl extends ServiceImpl imple //公司赋值 memberDO.setCompanyId(addMemberDTO.getCompanyId()); 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 longs = addMemberDTO.getDepartmentIds(); @@ -194,7 +200,7 @@ public class MemberServiceImpl extends ServiceImpl imple MemberDO memberDO = new MemberDO(); BeanUtils.copyProperties(addMemberDTO, 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()) { memberDepartmentMappingMapper.delete(new QueryWrapper() @@ -224,14 +230,15 @@ public class MemberServiceImpl extends ServiceImpl imple throw new HttpException(10010); } - CompanyDictDO companyDictDO = companyDictMapper.selectById(memberDO.getCompanyId()); - if ("冻结".equals(memberDO.getStatus())) { OprMemDictDO oprMemDictDO = new OprMemDictDO(); oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setOprType("登录"); 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); } @@ -239,7 +246,7 @@ public class MemberServiceImpl extends ServiceImpl imple if (0 == memberDO.getFirstLogin()) { memberDO.setFirstLogin(1); 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); @@ -250,17 +257,21 @@ public class MemberServiceImpl extends ServiceImpl imple oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setOprType("登录"); oprMemDictDO.setResult(0); - oprMemDictDO.setCreateDate(LocalDateTime.now()); - 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() + ":" + LocalDateTime.now(), oprMemDictDO); throw new HttpException(70010); } + //审计日志 OprMemDictDO oprMemDictDO = new OprMemDictDO(); oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setOprType("登录"); oprMemDictDO.setResult(1); - //审计日志 - redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + LocalDateTime.now(), oprMemDictDO); - + oprMemDictDO.setCreateDate(System.currentTimeMillis()+""); + oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd")); + //redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + LocalDateTime.now(), oprMemDictDO); + mongoTemplate.insert(oprMemDictDO); return userRoleVO; } @@ -282,15 +293,17 @@ public class MemberServiceImpl extends ServiceImpl 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(); BeanUtils.copyProperties(memberDO, memberVO); OprMemDictDO oprMemDictDO = new OprMemDictDO(); oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setOprType("登录"); oprMemDictDO.setResult(1); - oprMemDictDO.setCreateDate(LocalDateTime.now()); - redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + "_" + System.currentTimeMillis(), 1); + 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(), 1); return memberVO; } else { if (!memberDO.getPassword().equals(passwordLoginDTO.getPassword())) { @@ -298,7 +311,10 @@ public class MemberServiceImpl extends ServiceImpl imple oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setOprType("登录"); 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); } if (0 == memberDO.getFirstLogin()) { @@ -306,8 +322,10 @@ public class MemberServiceImpl extends ServiceImpl imple oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setOprType("登录"); oprMemDictDO.setResult(0); - oprMemDictDO.setCreateDate(LocalDateTime.now()); - redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + "_" + System.currentTimeMillis(), 0); + 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(), 0); throw new HttpException(10015); } if ("冻结".equals(memberDO.getStatus())) { @@ -332,7 +350,6 @@ public class MemberServiceImpl extends ServiceImpl imple List studyPageVOS = this.baseMapper.studyPage(memberDO); final ExecutorService newCachedThreadPool = Executors.newCachedThreadPool(); - for (StudyPageVO studyPageVO : studyPageVOS) { //查看课程下有几节课 List vodDictDOS = courseContentMapper.getCourseVods(studyPageVO.getId()); @@ -377,13 +394,13 @@ public class MemberServiceImpl extends ServiceImpl imple for (CourseContentDO courseContentDO : courseContentDOS) { ContentVodVO contentVodVO = new ContentVodVO(); contentVodVO.setContent(courseContentDO.getContent()); - contentVodVO.setMemberVodVOS(courseContentMapper.contentVodProcess(courseContentDO.getId(),contentVodDTO.getMemberId())); + contentVodVO.setMemberVodVOS(courseContentMapper.contentVodProcess(courseContentDO.getId(), contentVodDTO.getMemberId())); contentVodVOS.add(contentVodVO); } contentVodNewVO.setContentVodVOS(contentVodVOS); //最新的视频记录 - ContentVodNewVO contentVodNewVO1 = vodPlayHistoryMapper.memberRecentPlay(contentVodDTO.getClassId(),contentVodDTO.getMemberId()); + ContentVodNewVO contentVodNewVO1 = vodPlayHistoryMapper.memberRecentPlay(contentVodDTO.getClassId(), contentVodDTO.getMemberId()); contentVodNewVO.setId(contentVodNewVO1.getId()); contentVodNewVO.setPlayRecord(contentVodNewVO.getPlayRecord()); return contentVodNewVO; @@ -437,20 +454,15 @@ public class MemberServiceImpl extends ServiceImpl imple Integer cnt = paperDictMapper.completeCount(queryPapersVO.getId()); queryPapersVO.setCompleteCnt(cnt); //自己成绩 - List exerciseDoneResultDOS = exerciseDoneResultMapper.selectList(new QueryWrapper() - .lambda() - .eq(ExerciseDoneResultDO::getMemberId, memberId) - .eq(ExerciseDoneResultDO::getPaperId, queryPapersVO.getId()) - .orderByDesc(ExerciseDoneResultDO::getScore)); - - if (exerciseDoneResultDOS.size() > 0) { - queryPapersVO.setRightCounts(exerciseDoneResultDOS.get(0).getRightCounts()); - queryPapersVO.setTotalCount(exerciseDoneResultDOS.get(0).getTotalCounts()); - queryPapersVO.setResult(exerciseDoneResultDOS.get(0).getResult()); + ExerciseDoneResultDO exerciseDoneResultDO = exerciseDoneResultMapper.getMaxScorePaper(queryPapersVO.getId(),memberId); + + if (null!=exerciseDoneResultDO) { + queryPapersVO.setRightCounts(exerciseDoneResultDO.getRightCounts()); + queryPapersVO.setTotalCount(exerciseDoneResultDO.getTotalCounts()); + queryPapersVO.setResult(exerciseDoneResultDO.getResult()); } else { queryPapersVO.setResult("待完成"); } - //截止时间 queryPapersVO.setEndDate(classDictDO.getEndDate()); } @@ -466,81 +478,36 @@ public class MemberServiceImpl extends ServiceImpl imple 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 getStudyInfoTask1(Long memberId, GetStudyInfoVO getStudyInfoVO) { //已学课程 List classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper() .lambda() - .eq(ClassMemberMappingDO::getMemberId, memberId)); + .eq(ClassMemberMappingDO::getMemberId, memberDO.getId())); /** - * 遍历课程,里面的视频都看过80% 则表示已学完 + * 遍历课程,累计学习时长超过视频时长 则表示已学完 */ int i = 0; //已学课程 for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) { List vodDictDOS = classDictMapper.getClassVods(classMemberMappingDO.getClassId()); for (VodDictDO vodDictDO : vodDictDOS) { - List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper() - .lambda() - .eq(VodPlayHistoryDO::getMemberId, memberId) - .eq(VodPlayHistoryDO::getVodId, vodDictDO.getId()) - .orderByDesc(VodPlayHistoryDO::getPlayRecord)); - if (vodPlayHistoryDOS.size() > 0) { - if (vodPlayHistoryDOS.get(0).getPlayRecord() < vodDictDO.getVodLength() * 0.8) { - break; - } + int playLength = vodPlayHistoryMapper.memberVodTotalLength(memberDO.getId(), vodDictDO.getId()); + if (playLength < vodDictDO.getVodLength()) { + break; } } i++; } getStudyInfoVO.setStudyCourse(i); - return new AsyncResult<>(getStudyInfoVO); - } - public Future getStudyInfoTask2(MemberDO memberDO, GetStudyInfoVO getStudyInfoVO) { //累计学习时长 - int studyLength = 0; - List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper() - .lambda() - .eq(VodPlayHistoryDO::getMemberId, memberDO.getId())); - - for (VodPlayHistoryDO vodPlayHistoryDO : vodPlayHistoryDOS) { - studyLength += vodPlayHistoryDO.getPlayLength(); - } + int studyLength = vodPlayHistoryMapper.memberTotalLength(memberDO.getId()); 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); - return new AsyncResult(getStudyInfoVO); - } - public ExerciseDoneResultDO getDoneResult(ExerciseDoneResultDO exerciseDoneResultDO) { - return exerciseDoneResultMapper.selectById(exerciseDoneResultDO.getId()); + return getStudyInfoVO; } public String checkTimes(ExerciseDoneResultDO exerciseDoneResultDO) { diff --git a/src/main/java/com/subsidy/service/impl/OprAdmDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/OprAdmDictServiceImpl.java index ce9fb6a..7fa6f88 100644 --- a/src/main/java/com/subsidy/service/impl/OprAdmDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/OprAdmDictServiceImpl.java @@ -3,13 +3,27 @@ package com.subsidy.service.impl; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.subsidy.dto.opr.GetHistoryDTO; -import com.subsidy.model.OprAdmDictDO; +import com.subsidy.mapper.AdministerMapper; +import com.subsidy.mapper.CompanyDictMapper; +import com.subsidy.model.AdministerDO; +import com.subsidy.model.CompanyDictDO; +import com.subsidy.mongodb.OprAdmDictDO; import com.subsidy.mapper.OprAdmDictMapper; +import com.subsidy.mongodb.PageVO; import com.subsidy.service.OprAdmDictService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.subsidy.util.MongoUtil; import com.subsidy.vo.opr.GetHistoryVO; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.List; + /** *

* 审计表 服务实现类 @@ -21,10 +35,44 @@ import org.springframework.stereotype.Service; @Service public class OprAdmDictServiceImpl extends ServiceImpl implements OprAdmDictService { + @Autowired + private MongoTemplate mongoTemplate; + + @Autowired + private MongoUtil mongoUtil; + + @Autowired + private AdministerMapper administerMapper; + + @Autowired + private CompanyDictMapper companyDictMapper; + + public PageVO getHistory(GetHistoryDTO getHistoryDTO){ + + PageVO pageVO = new PageVO(); + + List 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 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 getHistory(GetHistoryDTO getHistoryDTO){ - Page pager = new Page(getHistoryDTO.getPageNum(), getHistoryDTO.getPageSize()); - return this.baseMapper.getHistory(pager,getHistoryDTO.getUserName(),getHistoryDTO.getStartDate(),getHistoryDTO.getEndDate()); + return pageVO; } } diff --git a/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java b/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java index 6005cdc..10b4ffd 100644 --- a/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java @@ -9,31 +9,29 @@ import com.subsidy.dto.member.GetMemberSignInfoDTO; import com.subsidy.dto.sign.ClassSignInfoDTO; import com.subsidy.mapper.ClassHourDictMapper; import com.subsidy.mapper.ClassMemberMappingMapper; +import com.subsidy.mapper.MemberMapper; import com.subsidy.mapper.SignInRecordMapper; import com.subsidy.mapper.VodPlayHistoryMapper; import com.subsidy.model.ClassDictDO; import com.subsidy.model.ClassHourDictDO; +import com.subsidy.model.MemberDO; import com.subsidy.model.SignInRecordDO; -import com.subsidy.model.VodDictDO; import com.subsidy.service.SignInRecordService; import com.subsidy.util.ConstantUtils; import com.subsidy.util.DateFormatUtil; import com.subsidy.util.MathUtil; import com.subsidy.util.RedisUtil; import com.subsidy.vo.member.GetMemberSignInfoVO; -import com.subsidy.vo.member.StudyPageVO; import com.subsidy.vo.sign.ClassSignInfoVO; import com.subsidy.vo.sign.SignInStatusVO; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.AsyncResult; import org.springframework.stereotype.Service; import java.util.Date; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import java.util.concurrent.Future; /** *

@@ -56,8 +54,11 @@ public class SignInRecordServiceImpl extends ServiceImpl getMemberSignInfo(GetMemberSignInfoDTO getMemberSignInfoDTO) { Page pager = new Page(getMemberSignInfoDTO.getPageNum(), getMemberSignInfoDTO.getPageSize()); @@ -73,7 +74,7 @@ public class SignInRecordServiceImpl extends ServiceImpl classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId()); for (ClassDictDO classDictDO : classDictDOS) { - redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId_" + signInRecordDO.getMemberId() + "_classId_" + classDictDO.getId() + "_" + DateFormatUtil.format(new Date(), "yyyyMMdd") + "_" + System.currentTimeMillis(), null); + redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "memberId:" + signInRecordDO.getMemberId() + ":classId:" + classDictDO.getId() + ":" + DateFormatUtil.format(new Date(), "yyyyMMdd") + ":" + System.currentTimeMillis(), null); } return ConstantUtils.ADD_SUCCESS; @@ -88,24 +89,21 @@ public class SignInRecordServiceImpl extends ServiceImplclassSignInfoTask(classSignInfoVO)); + newCachedThreadPool.execute(()->classSignInfoTask(classSignInfoVO)); } newCachedThreadPool.shutdown(); classSignInfoVOIPage.setRecords(classSignInfoVOS); return classSignInfoVOIPage; } - public Future classSignInfoTask(ClassSignInfoVO classSignInfoVO){ + public void classSignInfoTask(ClassSignInfoVO classSignInfoVO){ ClassSignInfoVO classSignInfoVO1 = vodPlayHistoryMapper.classStudyHistory(classSignInfoVO.getClassId()); BeanUtils.copyProperties(classSignInfoVO1,classSignInfoVO); //平均签到数 向下取整 - long signCount = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "*_classId_" + classSignInfoVO.getClassId() + "_*").stream().count(); + long signCount = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + "*:classId:" + classSignInfoVO.getClassId() + ":*").stream().count(); classSignInfoVO.setAvgSignCount(MathUtil.intDivCeil(signCount, classSignInfoVO1.getMemberCount())); - return new AsyncResult<>(classSignInfoVO); } public SignInStatusVO signInStatus(SignInRecordDO signInRecordDO) { @@ -113,10 +111,10 @@ public class SignInRecordServiceImpl extends ServiceImpl classHourDictDOS = classHourDictMapper.selectList(null); for (ClassHourDictDO classHourDictDO : classHourDictDOS) { - redisUtil.set("subsidySettings_" + classHourDictDO.getCompanyId(), classHourDictDO); + redisUtil.set("subsidySettings:" + classHourDictDO.getCompanyId(), classHourDictDO); } //预写学生账号数据 //List memberDOS = memberMapper.selectList(null); //for (MemberDO memberDO : memberDOS){ - // redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX+memberDO.getCompanyId()+"_"+memberDO.getAccountName(),memberDO); + // redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX+memberDO.getCompanyId()+":"+memberDO.getAccountName(),memberDO); //} } diff --git a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java index 7f70e7d..ef85deb 100644 --- a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java @@ -1,13 +1,29 @@ package com.subsidy.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.subsidy.mapper.ClassDictMapper; +import com.subsidy.mapper.ClassMemberMappingMapper; +import com.subsidy.mapper.CourseContentMapper; +import com.subsidy.mapper.SignInRecordMapper; +import com.subsidy.model.ClassDictDO; +import com.subsidy.model.ClassMemberMappingDO; +import com.subsidy.model.SignInRecordDO; +import com.subsidy.model.VodDictDO; import com.subsidy.model.VodPlayHistoryDO; import com.subsidy.mapper.VodPlayHistoryMapper; import com.subsidy.service.VodPlayHistoryService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.subsidy.util.ConstantUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Arrays; +import java.util.List; +import java.util.Random; + /** *

* 视频播放历史记录表 服务实现类 @@ -19,18 +35,104 @@ import org.springframework.stereotype.Service; @Service public class VodPlayHistoryServiceImpl extends ServiceImpl implements VodPlayHistoryService { - @Async + @Autowired + private ClassMemberMappingMapper classMemberMappingMapper; + + @Autowired + private ClassDictMapper classDictMapper; + + @Autowired + private CourseContentMapper courseContentMapper; + + @Autowired + private SignInRecordMapper signInRecordMapper; + + @Autowired + private VodPlayHistoryMapper vodPlayHistoryMapper; + public String insertHistory(VodPlayHistoryDO vodPlayHistoryDO) { vodPlayHistoryDO.setPlayCount(1); this.baseMapper.insert(vodPlayHistoryDO); return ConstantUtils.ADD_SUCCESS; } - @Async - public String insertHistoryNew(VodPlayHistoryDO vodPlayHistoryDO){ + public String insertHistoryNew(VodPlayHistoryDO vodPlayHistoryDO) { vodPlayHistoryDO.setPlayCount(1); this.baseMapper.insert(vodPlayHistoryDO); return ConstantUtils.ADD_SUCCESS; } + public void dataFix() { + + //班级ids + List classIds = Arrays.asList(new String[]{"28"}); + + for (String str : classIds) { + + ClassDictDO classDictDO = classDictMapper.selectById(str); + + //找到班级里的学生 + List classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper() + .lambda() + .eq(ClassMemberMappingDO::getClassId, Long.valueOf(str))); + + //查找课程里的所有视频 + List vodDictDOS = courseContentMapper.getCourseVods(classDictDO.getCourseId()); + + //遍历班级学生 + for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) { + + //查询这个人 这节课 排序 + List signInRecordDOS = signInRecordMapper.selectList(new QueryWrapper() + .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() + .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(); + + } + } diff --git a/src/main/java/com/subsidy/util/ConstantUtils.java b/src/main/java/com/subsidy/util/ConstantUtils.java index 977b5e2..5f05c6f 100644 --- a/src/main/java/com/subsidy/util/ConstantUtils.java +++ b/src/main/java/com/subsidy/util/ConstantUtils.java @@ -52,8 +52,6 @@ public class ConstantUtils { public static final String COMPRESS_SUCCESS = "压缩成功"; - public static final String SCHOOL = "上海市市西中学"; - public static final String CHECK_STATUS = "审核通过"; /** diff --git a/src/main/java/com/subsidy/util/ExcelFormatUtils.java b/src/main/java/com/subsidy/util/ExcelFormatUtils.java index 280e5e9..aac6018 100644 --- a/src/main/java/com/subsidy/util/ExcelFormatUtils.java +++ b/src/main/java/com/subsidy/util/ExcelFormatUtils.java @@ -14,6 +14,6 @@ public class ExcelFormatUtils { public static final List answersList = Arrays.asList("序号", "提问", "答疑", "提问时间", "提问成员", "答疑时间"); - public static final List studyLogList = Arrays.asList("开始时间","结束时间","操作对象","类型","平台","学习时长","有效时长"); + public static final List studyLogList = Arrays.asList("开始时间","结束时间","操作对象","类型","平台","学习时长","累计有效时长"); } diff --git a/src/main/java/com/subsidy/util/MathUtil.java b/src/main/java/com/subsidy/util/MathUtil.java index 5d81796..70a9d8e 100644 --- a/src/main/java/com/subsidy/util/MathUtil.java +++ b/src/main/java/com/subsidy/util/MathUtil.java @@ -137,17 +137,17 @@ public class MathUtil { // } public static String secToTime(int time) { - String timeStr = null; - int hour = 0; - int minute = 0; - int second = 0; + String timeStr ; + int hour; + int minute; + int second; if (time <= 0) { - return "00:00"; + return "00:00:00"; } else { minute = time / 60; if (minute < 60) { second = time % 60; - timeStr = unitFormat(minute) + ":" + unitFormat(second); + timeStr = "00:"+unitFormat(minute) + ":" + unitFormat(second); } else { hour = minute / 60; minute = minute % 60; diff --git a/src/main/java/com/subsidy/util/MongoUtil.java b/src/main/java/com/subsidy/util/MongoUtil.java new file mode 100644 index 0000000..aba131e --- /dev/null +++ b/src/main/java/com/subsidy/util/MongoUtil.java @@ -0,0 +1,53 @@ +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 { + 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 list) { + return new PageHelper(this.currentPage, total, this.pageSize, list); + } + + public PageHelper pageHelper(List list) { + return new PageHelper(this.currentPage, this.pageSize, list); + } + + public PageHelper pageHelper(long currentPage, long total, long pageSize, List list) { + return new PageHelper(currentPage, total, pageSize, list); + } + + public PageHelper pageHelper(long currentPage, long pageSize, List 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; + } + +} diff --git a/src/main/java/com/subsidy/util/PageHelper.java b/src/main/java/com/subsidy/util/PageHelper.java new file mode 100644 index 0000000..bf37716 --- /dev/null +++ b/src/main/java/com/subsidy/util/PageHelper.java @@ -0,0 +1,30 @@ +package com.subsidy.util; + +import lombok.Data; +import org.apache.poi.ss.formula.functions.T; + +import java.util.List; + +@Data +public class PageHelper { + + private long currentPage; + private long total; + private long pageSize; + private List list; + + public PageHelper(long pageNum, long total, long pageSize, List list) { + this.currentPage = pageNum; + this.total = total; + this.pageSize = pageSize; + this.list = list; + } + + public PageHelper(long pageNum, long pageSize, List list) { + this.currentPage = pageNum; + this.pageSize = pageSize; + this.list = list; + } + + +} diff --git a/src/main/java/com/subsidy/util/RedisUtil.java b/src/main/java/com/subsidy/util/RedisUtil.java index b74d000..03e08ff 100644 --- a/src/main/java/com/subsidy/util/RedisUtil.java +++ b/src/main/java/com/subsidy/util/RedisUtil.java @@ -557,14 +557,14 @@ public class RedisUtil { } } - /** - * 模糊查询获取key值 - * @param pattern - * @return - */ - public Set keys(String pattern){ - return redisTemplate.keys(pattern); - } + ///** + // * 模糊查询获取key值 + // * @param pattern + // * @return + // */ + //public Set keys(String pattern){ + // return redisTemplate.keys(pattern); + //} /** * 模糊查询 diff --git a/src/main/java/com/subsidy/vo/administer/ClassDailyInfoVO.java b/src/main/java/com/subsidy/vo/administer/ClassDailyInfoVO.java index 6859989..44d1cb4 100644 --- a/src/main/java/com/subsidy/vo/administer/ClassDailyInfoVO.java +++ b/src/main/java/com/subsidy/vo/administer/ClassDailyInfoVO.java @@ -13,4 +13,6 @@ public class ClassDailyInfoVO { private String userName; private List dayInfoItemVOS; + + private Integer total; } diff --git a/src/main/java/com/subsidy/vo/administer/GetMemberPapersVO.java b/src/main/java/com/subsidy/vo/administer/GetMemberPapersVO.java index 836bac9..d75e3c4 100644 --- a/src/main/java/com/subsidy/vo/administer/GetMemberPapersVO.java +++ b/src/main/java/com/subsidy/vo/administer/GetMemberPapersVO.java @@ -5,17 +5,12 @@ import lombok.Data; @Data public class GetMemberPapersVO { - private Long id; + private Long paperId; - private String paperName; + private String score; - private Integer rightCounts; + private Integer cnt; - private Integer totalCounts; + private Integer result; - private String result; - - private String createDate; - - private Integer score; } diff --git a/src/main/java/com/subsidy/vo/answer/GetCourseQuestionVO.java b/src/main/java/com/subsidy/vo/answer/GetCourseQuestionVO.java index c9db152..782aff7 100644 --- a/src/main/java/com/subsidy/vo/answer/GetCourseQuestionVO.java +++ b/src/main/java/com/subsidy/vo/answer/GetCourseQuestionVO.java @@ -44,6 +44,5 @@ public class GetCourseQuestionVO { private String updateDate; - private String deleteDate; } diff --git a/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java b/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java index 63480bf..a8521cf 100644 --- a/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java +++ b/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java @@ -33,12 +33,12 @@ public class ClassDetailVO{ /** * 已看视频 */ - private Integer studyVodCounts; + //private Integer studyVodCounts; /** * 全部视频 */ - private Integer allVodCounts; + //private Integer allVodCounts; @ExcelColumn(col = 6,value = "课程进度") private String classProcess; diff --git a/src/main/java/com/subsidy/vo/done/GetMaxScoreVO.java b/src/main/java/com/subsidy/vo/done/GetMaxScoreVO.java index 36178a3..acd8d34 100644 --- a/src/main/java/com/subsidy/vo/done/GetMaxScoreVO.java +++ b/src/main/java/com/subsidy/vo/done/GetMaxScoreVO.java @@ -11,4 +11,5 @@ public class GetMaxScoreVO { private Long score; + private Integer result; } diff --git a/src/main/java/com/subsidy/vo/done/TestScoreInfoVO.java b/src/main/java/com/subsidy/vo/done/TestScoreInfoVO.java new file mode 100644 index 0000000..855d040 --- /dev/null +++ b/src/main/java/com/subsidy/vo/done/TestScoreInfoVO.java @@ -0,0 +1,16 @@ +package com.subsidy.vo.done; + +import lombok.Data; + +@Data +public class TestScoreInfoVO { + + private Long paperId; + + private Integer score; + + private Integer cnt; + + private String result; + +} diff --git a/src/main/java/com/subsidy/vo/member/ClassSignVO.java b/src/main/java/com/subsidy/vo/member/ClassSignVO.java index 9390669..3aa3ef7 100644 --- a/src/main/java/com/subsidy/vo/member/ClassSignVO.java +++ b/src/main/java/com/subsidy/vo/member/ClassSignVO.java @@ -34,15 +34,6 @@ public class ClassSignVO { @ExcelColumn(col = 4,value = "培训时长") private String trainingLengthStr; - /** - * 已看视频 - */ - private Integer studyVodCounts; - - /** - * 全部视频 - */ - private Integer allVodCounts; @ExcelColumn(col = 5,value = "课程进度") private String classProcess; diff --git a/src/main/java/com/subsidy/vo/member/StudyPageVO.java b/src/main/java/com/subsidy/vo/member/StudyPageVO.java index dc234c6..6c06e4b 100644 --- a/src/main/java/com/subsidy/vo/member/StudyPageVO.java +++ b/src/main/java/com/subsidy/vo/member/StudyPageVO.java @@ -5,7 +5,7 @@ import lombok.Data; @Data public class StudyPageVO { - private Integer id; + private Long id; private Integer classId; diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties index a02ed62..0f8bf7b 100644 --- a/src/main/resources/application-dev.properties +++ b/src/main/resources/application-dev.properties @@ -2,7 +2,7 @@ # 数据源配置 spring.datasource.url=jdbc:mysql://47.97.19.66:3306/subsidy_test?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8 -#spring.datasource.url=jdbc:mysql://rm-uf606h696n5qod70cfo.mysql.rds.aliyuncs.com:3306/subsidy_test?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8 +#spring.datasource.url=jdbc:mysql://rm-uf6rab73w0qg843opxo.mysql.rds.aliyuncs.com:3306/subsidy_test?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8 spring.datasource.type=com.alibaba.druid.pool.DruidDataSource spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver #spring.datasource.username=ykadmin_new @@ -27,9 +27,19 @@ spring.datasource.druid.useGlobalDataSourceStat=true # 控制台日志打印 mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl -#spring.redis.host=r-uf6thsc3bzt5b6f7fdpd.redis.rds.aliyuncs.com -#spring.redis.password=r-uf6thsc3bzt5b6f7fd:Ykhl@208 +#spring.redis.host=r-uf6meywj6ysuehg148pd.redis.rds.aliyuncs.com +#spring.redis.password=r-uf6meywj6ysuehg148:Ykhl@208 #spring.redis.port=6379 #spring.redis.lettuce.pool.max-idle=16 #spring.redis.lettuce.pool.max-active=32 -#spring.redis.lettuce.pool.min-idle=8 \ No newline at end of file +#spring.redis.lettuce.pool.min-idle=8 + +spring.application.name=spring-boot-mongodb +# mongodb +#spring.data.mongodb.uri=mongodb://47.97.19.66:27017/subsidy +spring.data.mongodb.username=root +spring.data.mongodb.password=123456 +#spring.data.mongodb.authentication-database=subsidy +spring.data.mongodb.database=subsidy +spring.data.mongodb.host=47.97.19.66 +spring.data.mongodb.port=27017 diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index e4f49f3..33a6e52 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,7 +1,7 @@ # 环境配置 spring.profiles.active=dev # 端口号 -spring.server.port=23454 +spring.server.port=23457 #嵌入tomcat配置 #和CPU数 spring.server.acceptorThreadCount=600 @@ -64,24 +64,6 @@ spring.quartz.overwrite-existing-jobs=false #spring.quartz.jdbc.initialize-schema=always #spring.datasource.initialization-mode=embedded -#spring.task.execution.pool.allow-core-thread-timeout=true -#spring.task.execution.pool.core-size=8 -#spring.task.execution.pool.keep-alive=60 -#spring.task.execution.pool.max-size=200 -#spring.task.execution.pool.queue-capacity=200 -#spring.task.execution.thread-name-prefix=subsidy- - -#spring.task.scheduling.pool.size=2 -#spring.task.scheduling.thread-name-prefix=subsidy- - -#spring.redis.cluster.nodes=47.97.19.66:6377,47.97.19.66:6378,47.97.19.66:6379 -##spring.redis.port=6379 -#spring.redis.password=Ykhl@208 -## spring.redis.cluster.max-redirects=3 -#spring.redis.lettuce.pool.max-idle=16 -#spring.redis.lettuce.pool.max-active=32 -#spring.redis.lettuce.pool.min-idle=8 - #spring.redis.host=r-uf6m4cpkjrgpzywjm3pd.redis.rds.aliyuncs.com #spring.redis.port=6379 #spring.redis.password=r-uf6m4cpkjrgpzywjm3:Ykhl@208 diff --git a/src/main/resources/mapper/AnsweringQuestionMapper.xml b/src/main/resources/mapper/AnsweringQuestionMapper.xml index efd56ac..595c4d7 100644 --- a/src/main/resources/mapper/AnsweringQuestionMapper.xml +++ b/src/main/resources/mapper/AnsweringQuestionMapper.xml @@ -4,15 +4,15 @@ - - - - - - - - - + + + + + + + + + @@ -25,23 +25,30 @@ diff --git a/src/main/resources/mapper/ClassDictMapper.xml b/src/main/resources/mapper/ClassDictMapper.xml index 7d84003..b621c71 100644 --- a/src/main/resources/mapper/ClassDictMapper.xml +++ b/src/main/resources/mapper/ClassDictMapper.xml @@ -65,7 +65,17 @@ SELECT - t2.* + t2.id, + t2.company_id, + t2.user_name, + t2.account_name, + t2.telephone, + t2.PASSWORD, + t2.gender, + t2.image, + t2.id_card, + t2.STATUS, + t2.first_login FROM class_member_mapping t LEFT JOIN member t2 ON t.member_id = t2.id diff --git a/src/main/resources/mapper/CourseContentMapper.xml b/src/main/resources/mapper/CourseContentMapper.xml index 6147558..1b62f54 100644 --- a/src/main/resources/mapper/CourseContentMapper.xml +++ b/src/main/resources/mapper/CourseContentMapper.xml @@ -21,7 +21,7 @@ id, course_id, content, order_no - SELECT t2.id, t2.content_id, @@ -81,4 +81,14 @@ t2.order_no + + diff --git a/src/main/resources/mapper/CourseDictMapper.xml b/src/main/resources/mapper/CourseDictMapper.xml index f4f8fbf..af12a15 100644 --- a/src/main/resources/mapper/CourseDictMapper.xml +++ b/src/main/resources/mapper/CourseDictMapper.xml @@ -92,7 +92,12 @@ + diff --git a/src/main/resources/mapper/ExerciseDoneResultMapper.xml b/src/main/resources/mapper/ExerciseDoneResultMapper.xml index f798a14..7e7b4ba 100644 --- a/src/main/resources/mapper/ExerciseDoneResultMapper.xml +++ b/src/main/resources/mapper/ExerciseDoneResultMapper.xml @@ -93,4 +93,68 @@ t.member_id + + + + + diff --git a/src/main/resources/mapper/FileDictMapper.xml b/src/main/resources/mapper/FileDictMapper.xml index 8ef3647..238fac6 100644 --- a/src/main/resources/mapper/FileDictMapper.xml +++ b/src/main/resources/mapper/FileDictMapper.xml @@ -22,4 +22,22 @@ id, content_id, file_name, file_size, order_no + + diff --git a/src/main/resources/mapper/OprAdmDictMapper.xml b/src/main/resources/mapper/OprAdmDictMapper.xml index aeccd0c..649e177 100644 --- a/src/main/resources/mapper/OprAdmDictMapper.xml +++ b/src/main/resources/mapper/OprAdmDictMapper.xml @@ -3,7 +3,7 @@ - + @@ -50,7 +50,7 @@ t.create_date DESC - SELECT * FROM @@ -68,7 +68,7 @@ LIMIT 5)t2 - SELECT * FROM diff --git a/src/main/resources/mapper/VodPlayHistoryMapper.xml b/src/main/resources/mapper/VodPlayHistoryMapper.xml index 992c0a0..830eb1a 100644 --- a/src/main/resources/mapper/VodPlayHistoryMapper.xml +++ b/src/main/resources/mapper/VodPlayHistoryMapper.xml @@ -228,7 +228,7 @@ @@ -286,4 +286,25 @@ ORDER BY t1.create_date DESC + + + + -- libgit2 0.25.0