From c06779f7aca7ba9d7be4d03da1b9ce2b56a52b1c Mon Sep 17 00:00:00 2001 From: Administrator Date: Thu, 3 Mar 2022 09:56:44 +0800 Subject: [PATCH] 去掉了redis --- pom.xml | 20 ++++++++++---------- src/main/java/com/subsidy/common/configure/RedisConfig.java | 234 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------- src/main/java/com/subsidy/controller/AdministerController.java | 6 +++--- src/main/java/com/subsidy/controller/ClassDictController.java | 9 +++++---- src/main/java/com/subsidy/controller/ClassHourDictController.java | 9 +++++---- src/main/java/com/subsidy/controller/ClassNoticeController.java | 2 +- src/main/java/com/subsidy/controller/CompanyDictController.java | 2 +- src/main/java/com/subsidy/controller/CourseDictController.java | 2 +- src/main/java/com/subsidy/controller/DepartmentDictController.java | 10 ++++++++-- src/main/java/com/subsidy/controller/MemberController.java | 10 ++++++++-- src/main/java/com/subsidy/controller/RotationImgDictController.java | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/dto/classDict/GetClassBaseInfoDTO.java | 12 ++++++++++++ src/main/java/com/subsidy/dto/course/AddCourseDTO.java | 9 +++++---- src/main/java/com/subsidy/dto/course/UpdateCoursesDTO.java | 5 +++++ src/main/java/com/subsidy/dto/department/GetDepartmentMembersDTO.java | 4 ++++ src/main/java/com/subsidy/dto/member/ChangeDepartmentsDTO.java | 13 +++++++++++++ src/main/java/com/subsidy/dto/member/GetAllDTO.java | 4 ++++ src/main/java/com/subsidy/dto/member/ImportMemberDTO.java | 13 +++++++++++++ src/main/java/com/subsidy/jobs/CourseNotificationJob.java | 23 ++++++++++++++++------- src/main/java/com/subsidy/jobs/SchedulerJob.java | 58 +++++++++++++++++++++++++++++----------------------------- src/main/java/com/subsidy/mapper/ClassDictMapper.java | 5 +++++ src/main/java/com/subsidy/mapper/CompanyDictMapper.java | 4 ++-- src/main/java/com/subsidy/mapper/CourseContentMapper.java | 2 +- src/main/java/com/subsidy/mapper/ExerciseDoneResultMapper.java | 2 +- src/main/java/com/subsidy/mapper/MemberMapper.java | 16 +++++++++++++--- src/main/java/com/subsidy/mapper/PaperDictMapper.java | 2 +- src/main/java/com/subsidy/mapper/RoleAdministerMappingMapper.java | 8 ++++++++ src/main/java/com/subsidy/mapper/RotationImgDictMapper.java | 18 ++++++++++++++++++ src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java | 2 +- src/main/java/com/subsidy/model/ClassDictDO.java | 2 ++ src/main/java/com/subsidy/model/CourseDictDO.java | 4 ++++ src/main/java/com/subsidy/model/DepartmentDictDO.java | 5 +++++ src/main/java/com/subsidy/model/MemberDO.java | 19 +++++++++++++++++++ src/main/java/com/subsidy/model/RotationImgDictDO.java | 36 ++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/service/ClassDictService.java | 3 ++- src/main/java/com/subsidy/service/ClassHourDictService.java | 5 +++-- src/main/java/com/subsidy/service/DepartmentDictService.java | 3 +++ src/main/java/com/subsidy/service/MemberService.java | 3 +++ src/main/java/com/subsidy/service/RotationImgDictService.java | 25 +++++++++++++++++++++++++ src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java | 143 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------- src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java | 31 +++++++++++++++++++++++++++++-- src/main/java/com/subsidy/service/impl/ClassHourDictServiceImpl.java | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------- src/main/java/com/subsidy/service/impl/ClassNoticeServiceImpl.java | 24 +++++++++++++----------- src/main/java/com/subsidy/service/impl/ClassTypeDictServiceImpl.java | 7 +++---- src/main/java/com/subsidy/service/impl/CompanyDictServiceImpl.java | 35 ++++++++++++++++++++++------------- src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java | 1 + src/main/java/com/subsidy/service/impl/DepartmentDictServiceImpl.java | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- src/main/java/com/subsidy/service/impl/MemberServiceImpl.java | 160 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------- src/main/java/com/subsidy/service/impl/RotationImgDictServiceImpl.java | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java | 74 +++++++++++++++++++++++++++++++++++++++++++++++--------------------------- src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java | 12 ++++++++---- src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java | 17 +++++++++++++++++ src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java | 37 +++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/util/RedisUtil.java | 1266 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- src/main/java/com/subsidy/vo/administer/UserRoleVO.java | 9 +++++++++ src/main/java/com/subsidy/vo/classdict/ClassAndCompanyInfoVO.java | 17 +++++++++++++++++ src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java | 2 +- src/main/java/com/subsidy/vo/classdict/GetClassBaseInfoVO.java | 8 ++++++++ src/main/java/com/subsidy/vo/classdict/GetSettingVO.java | 16 ++++++++++++++++ src/main/java/com/subsidy/vo/course/QueryCoursesVO.java | 5 +++++ src/main/java/com/subsidy/vo/department/GetMembersVO.java | 35 +++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/vo/member/GetAllVO.java | 9 +++++++++ src/main/java/com/subsidy/vo/member/MemberVO.java | 9 +++++++++ src/main/java/com/subsidy/vo/member/MyCoursesVO.java | 4 ++++ src/main/resources/code.properties | 4 ++++ src/main/resources/mapper/ClassDictMapper.xml | 23 ++++++++++++++++++++++- src/main/resources/mapper/CompanyDictMapper.xml | 5 ++++- src/main/resources/mapper/CourseContentMapper.xml | 11 ++++++++--- src/main/resources/mapper/CourseDictMapper.xml | 3 ++- src/main/resources/mapper/ExerciseDoneResultMapper.xml | 1 + src/main/resources/mapper/MemberMapper.xml | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------ src/main/resources/mapper/PaperDictMapper.xml | 3 ++- src/main/resources/mapper/RoleAdministerMappingMapper.xml | 13 +++++++++++++ src/main/resources/mapper/RotationImgDictMapper.xml | 23 +++++++++++++++++++++++ src/main/resources/mapper/VodDictMapper.xml | 2 +- src/main/resources/mapper/VodPlayHistoryMapper.xml | 8 ++++---- 76 files changed, 1987 insertions(+), 1060 deletions(-) create mode 100644 src/main/java/com/subsidy/controller/RotationImgDictController.java create mode 100644 src/main/java/com/subsidy/dto/classDict/GetClassBaseInfoDTO.java create mode 100644 src/main/java/com/subsidy/dto/member/ChangeDepartmentsDTO.java create mode 100644 src/main/java/com/subsidy/mapper/RotationImgDictMapper.java create mode 100644 src/main/java/com/subsidy/model/RotationImgDictDO.java create mode 100644 src/main/java/com/subsidy/service/RotationImgDictService.java create mode 100644 src/main/java/com/subsidy/service/impl/RotationImgDictServiceImpl.java create mode 100644 src/main/java/com/subsidy/vo/classdict/ClassAndCompanyInfoVO.java create mode 100644 src/main/java/com/subsidy/vo/classdict/GetSettingVO.java create mode 100644 src/main/java/com/subsidy/vo/department/GetMembersVO.java create mode 100644 src/main/resources/mapper/RotationImgDictMapper.xml diff --git a/pom.xml b/pom.xml index 911b12b..faa6f00 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ 5.2.0 5.4.1 3.10.3 - 3.3.0 + @@ -192,21 +192,21 @@ 1.0.7 - - org.springframework.boot - spring-boot-starter-data-redis - + + + + org.springframework.boot spring-boot-starter-quartz - - redis.clients - jedis - ${jedis.version} - + + + + + diff --git a/src/main/java/com/subsidy/common/configure/RedisConfig.java b/src/main/java/com/subsidy/common/configure/RedisConfig.java index dffdaeb..3a4abf8 100644 --- a/src/main/java/com/subsidy/common/configure/RedisConfig.java +++ b/src/main/java/com/subsidy/common/configure/RedisConfig.java @@ -1,119 +1,115 @@ -package com.subsidy.common.configure; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.PropertyAccessor; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.springframework.cache.annotation.CachingConfigurerSupport; -import org.springframework.cache.annotation.EnableCaching; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.data.redis.connection.RedisConnectionFactory; -import org.springframework.data.redis.core.*; -import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; -import org.springframework.data.redis.serializer.StringRedisSerializer; - -@EnableCaching - -/** - *

- * Redis - *

- * - * @author DengMin - * @since 2020/12/14 - */ -@Configuration -public class RedisConfig extends CachingConfigurerSupport { - - /** - * retemplate相关配置 - * @param factory - * @return - */ - @Bean - public RedisTemplate redisTemplate(RedisConnectionFactory factory) { - - RedisTemplate template = new RedisTemplate<>(); - // 配置连接工厂 - template.setConnectionFactory(factory); - - //使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值(默认使用JDK的序列化方式) - Jackson2JsonRedisSerializer jacksonSeial = new Jackson2JsonRedisSerializer(Object.class); - - ObjectMapper om = new ObjectMapper(); - // 指定要序列化的域,field,get和set,以及修饰符范围,ANY是都有包括private和public - om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); - // 指定序列化输入的类型,类必须是非final修饰的,final修饰的类,比如String,Integer等会跑出异常 - om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); - jacksonSeial.setObjectMapper(om); - - // 值采用json序列化 - template.setValueSerializer(jacksonSeial); - //使用StringRedisSerializer来序列化和反序列化redis的key值 - template.setKeySerializer(new StringRedisSerializer()); - - // 设置hash key 和value序列化模式 - template.setHashKeySerializer(new StringRedisSerializer()); - template.setHashValueSerializer(jacksonSeial); - template.afterPropertiesSet(); - - return template; - } - - /** - * 对hash类型的数据操作 - * - * @param redisTemplate - * @return - */ - @Bean - public HashOperations hashOperations(RedisTemplate redisTemplate) { - return redisTemplate.opsForHash(); - } - - /** - * 对redis字符串类型数据操作 - * - * @param redisTemplate - * @return - */ - @Bean - public ValueOperations valueOperations(RedisTemplate redisTemplate) { - return redisTemplate.opsForValue(); - } - - /** - * 对链表类型的数据操作 - * - * @param redisTemplate - * @return - */ - @Bean - public ListOperations listOperations(RedisTemplate redisTemplate) { - return redisTemplate.opsForList(); - } - - /** - * 对无序集合类型的数据操作 - * - * @param redisTemplate - * @return - */ - @Bean - public SetOperations setOperations(RedisTemplate redisTemplate) { - return redisTemplate.opsForSet(); - } - - /** - * 对有序集合类型的数据操作 - * - * @param redisTemplate - * @return - */ - @Bean - public ZSetOperations zSetOperations(RedisTemplate redisTemplate) { - return redisTemplate.opsForZSet(); - } - - -} \ No newline at end of file +//package com.subsidy.common.configure; +// +//import com.fasterxml.jackson.annotation.JsonAutoDetect; +//import com.fasterxml.jackson.annotation.PropertyAccessor; +//import com.fasterxml.jackson.databind.ObjectMapper; +//import org.springframework.cache.annotation.CachingConfigurerSupport; +//import org.springframework.cache.annotation.EnableCaching; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +// +//@EnableCaching +// +///** +// *

+// * Redis +// *

+// * +// * @author DengMin +// * @since 2020/12/14 +// */ +//@Configuration +//public class RedisConfig extends CachingConfigurerSupport { +// +// /** +// * retemplate相关配置 +// * @param factory +// * @return +// */ +// @Bean +// public RedisTemplate redisTemplate(RedisConnectionFactory factory) { +// +// RedisTemplate template = new RedisTemplate<>(); +// // 配置连接工厂 +// template.setConnectionFactory(factory); +// +// //使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值(默认使用JDK的序列化方式) +// Jackson2JsonRedisSerializer jacksonSeial = new Jackson2JsonRedisSerializer(Object.class); +// +// ObjectMapper om = new ObjectMapper(); +// // 指定要序列化的域,field,get和set,以及修饰符范围,ANY是都有包括private和public +// om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); +// // 指定序列化输入的类型,类必须是非final修饰的,final修饰的类,比如String,Integer等会跑出异常 +// om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); +// jacksonSeial.setObjectMapper(om); +// +// // 值采用json序列化 +// template.setValueSerializer(jacksonSeial); +// //使用StringRedisSerializer来序列化和反序列化redis的key值 +// template.setKeySerializer(new StringRedisSerializer()); +// +// // 设置hash key 和value序列化模式 +// template.setHashKeySerializer(new StringRedisSerializer()); +// template.setHashValueSerializer(jacksonSeial); +// template.afterPropertiesSet(); +// +// return template; +// } +// +// /** +// * 对hash类型的数据操作 +// * +// * @param redisTemplate +// * @return +// */ +// @Bean +// public HashOperations hashOperations(RedisTemplate redisTemplate) { +// return redisTemplate.opsForHash(); +// } +// +// /** +// * 对redis字符串类型数据操作 +// * +// * @param redisTemplate +// * @return +// */ +// @Bean +// public ValueOperations valueOperations(RedisTemplate redisTemplate) { +// return redisTemplate.opsForValue(); +// } +// +// /** +// * 对链表类型的数据操作 +// * +// * @param redisTemplate +// * @return +// */ +// @Bean +// public ListOperations listOperations(RedisTemplate redisTemplate) { +// return redisTemplate.opsForList(); +// } +// +// /** +// * 对无序集合类型的数据操作 +// * +// * @param redisTemplate +// * @return +// */ +// @Bean +// public SetOperations setOperations(RedisTemplate redisTemplate) { +// return redisTemplate.opsForSet(); +// } +// +// /** +// * 对有序集合类型的数据操作 +// * +// * @param redisTemplate +// * @return +// */ +// @Bean +// public ZSetOperations zSetOperations(RedisTemplate redisTemplate) { +// return redisTemplate.opsForZSet(); +// } +// +// +//} \ No newline at end of file diff --git a/src/main/java/com/subsidy/controller/AdministerController.java b/src/main/java/com/subsidy/controller/AdministerController.java index e7347f2..d13e30b 100644 --- a/src/main/java/com/subsidy/controller/AdministerController.java +++ b/src/main/java/com/subsidy/controller/AdministerController.java @@ -63,7 +63,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)); } @@ -125,7 +125,7 @@ public class AdministerController { @PostMapping("exerciseTest") @ApiOperation("班级管理--测评成绩 id 班级id userName paperId") - @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO exerciseTest(@RequestBody ClassDetailDTO classDetailDTO){ return ResponseData.generateCreatedResponse(0,administerService.exerciseTest(classDetailDTO)); } @@ -198,7 +198,7 @@ public class AdministerController { @PostMapping("exportZip") @ApiOperation("下载压缩包 id 班级id") @CrossOrigin - @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public void exportZip(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{ administerService.export(classDetailDTO); } diff --git a/src/main/java/com/subsidy/controller/ClassDictController.java b/src/main/java/com/subsidy/controller/ClassDictController.java index 143848a..20edd88 100644 --- a/src/main/java/com/subsidy/controller/ClassDictController.java +++ b/src/main/java/com/subsidy/controller/ClassDictController.java @@ -6,6 +6,7 @@ import com.subsidy.common.ResponseVO; import com.subsidy.common.interceptor.LoginRequired; import com.subsidy.dto.classDict.AddClassDTO; import com.subsidy.dto.classDict.AddMemberToClassDTO; +import com.subsidy.dto.classDict.GetClassBaseInfoDTO; import com.subsidy.dto.classDict.GetSpareMembersDTO; import com.subsidy.model.ClassDictDO; import com.subsidy.model.ClassMemberMappingDO; @@ -92,15 +93,15 @@ public class ClassDictController { } @PostMapping("batchSms") - @ApiOperation(" 批量发送班级短信 {id 班级id}") + @ApiOperation(" 批量发送班级短信通知 {id 班级id }") public ResponseVO batchSms(@RequestBody ClassDictDO classDictDO){ return ResponseData.generateCreatedResponse(0,classDictService.batchSms(classDictDO)); } @PostMapping("getClassBaseInfo") - @ApiOperation("班级详情--获取课程基本信息") - public ResponseVO getClassBaseInfo(@RequestBody ClassDictDO classDictDO){ - return ResponseData.generateCreatedResponse(0,classDictService.getClassBaseInfo(classDictDO)); + @ApiOperation("班级详情--获取课程基本信息 id") + public ResponseVO getClassBaseInfo(@RequestBody GetClassBaseInfoDTO getClassBaseInfoDTO){ + return ResponseData.generateCreatedResponse(0,classDictService.getClassBaseInfo(getClassBaseInfoDTO)); } diff --git a/src/main/java/com/subsidy/controller/ClassHourDictController.java b/src/main/java/com/subsidy/controller/ClassHourDictController.java index 9cfe407..75ba8ad 100644 --- a/src/main/java/com/subsidy/controller/ClassHourDictController.java +++ b/src/main/java/com/subsidy/controller/ClassHourDictController.java @@ -8,6 +8,7 @@ import com.subsidy.model.ClassHourDictDO; import com.subsidy.model.VodPlayHistoryDO; import com.subsidy.service.ClassHourDictService; import com.subsidy.util.ConstantUtils; +import com.subsidy.vo.classdict.GetSettingVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; @@ -40,10 +41,10 @@ public class ClassHourDictController { } @PostMapping("updateSetting") - @ApiOperation("修改当天设置时长 companyId 主键 classHour status interrupt interruptStatus repeatTime repeatStatus") - //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) - public ResponseVO updateSetting(@RequestBody ClassHourDictDO classHourDictDO){ - return ResponseData.generateCreatedResponse(0,classHourDictService.updateSetting(classHourDictDO)); + @ApiOperation("修改当天设置时长 companyId 主键 logo classHour status interrupt interruptStatus repeatTime repeatStatus rotationImgDictDOS[companyId rotationImg]") + @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + public ResponseVO updateSetting(@RequestBody GetSettingVO getSettingVO){ + return ResponseData.generateCreatedResponse(0,classHourDictService.updateSetting(getSettingVO)); } @PostMapping("pollingGet") diff --git a/src/main/java/com/subsidy/controller/ClassNoticeController.java b/src/main/java/com/subsidy/controller/ClassNoticeController.java index 8097ff0..1e7540f 100644 --- a/src/main/java/com/subsidy/controller/ClassNoticeController.java +++ b/src/main/java/com/subsidy/controller/ClassNoticeController.java @@ -51,7 +51,7 @@ public class ClassNoticeController { @PostMapping("queryClassNotices") @ApiOperation("查看某个课程的通知提醒 classId 课程id status 状态(待发送/已发送)") - public ResponseVO queryClassNotices(ClassNoticeDO classNoticeDO){ + public ResponseVO queryClassNotices(@RequestBody ClassNoticeDO classNoticeDO){ return ResponseData.generateCreatedResponse(0,classNoticeService.queryClassNotices(classNoticeDO)); } diff --git a/src/main/java/com/subsidy/controller/CompanyDictController.java b/src/main/java/com/subsidy/controller/CompanyDictController.java index b4c0a4d..8eef2ae 100644 --- a/src/main/java/com/subsidy/controller/CompanyDictController.java +++ b/src/main/java/com/subsidy/controller/CompanyDictController.java @@ -55,7 +55,7 @@ public class CompanyDictController { } @PostMapping("updateCompany") - @ApiOperation("修改企业 id accountName:账号 companyName:企业名称 address 企业所在地 shortName 简称 banner:标语 field[]:领域 role 1:超级管理员 2:普通成员") + @ApiOperation("修改企业 id accountName:账号 logo companyName:企业名称 address 企业所在地 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/CourseDictController.java b/src/main/java/com/subsidy/controller/CourseDictController.java index fa6a20b..e40b22b 100644 --- a/src/main/java/com/subsidy/controller/CourseDictController.java +++ b/src/main/java/com/subsidy/controller/CourseDictController.java @@ -35,7 +35,7 @@ public class CourseDictController { private CourseDictService courseDictService; @PostMapping("addCourse") - @ApiOperation("添加课程 companyId courseName courseType coverPage openStatus fieldDictDOS[] categoryDOS[] jobDictDOS[] rankDictDOS[]") + @ApiOperation("添加课程 companyId courseName courseType coverPage openStatus remark fieldDictDOS[] categoryDOS[] jobDictDOS[] rankDictDOS[]") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO addCourse(@RequestBody AddCourseDTO addCourseDTO){ return ResponseData.generateCreatedResponse(0,courseDictService.addCourse(addCourseDTO)); diff --git a/src/main/java/com/subsidy/controller/DepartmentDictController.java b/src/main/java/com/subsidy/controller/DepartmentDictController.java index 5845bad..69957dd 100644 --- a/src/main/java/com/subsidy/controller/DepartmentDictController.java +++ b/src/main/java/com/subsidy/controller/DepartmentDictController.java @@ -42,7 +42,7 @@ public class DepartmentDictController { @PostMapping("addDepartment") @ApiOperation("添加部门 companyId departmentName leaderName parentId 父节点") - @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) + //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO addDepartment(@RequestBody DepartmentDictDO departmentDictDO){ return ResponseData.generateCreatedResponse(0,departmentDictService.addDepartment(departmentDictDO)); } @@ -62,11 +62,17 @@ public class DepartmentDictController { } @PostMapping("getDepartmentMembers") - @ApiOperation("获取部门成员 companyId 公司id departmentId 部门id userName") + @ApiOperation("获取部门成员 companyId 公司id departmentId 部门id userName startDate endDate") public ResponseVO getDepartmentMembers(@RequestBody GetDepartmentMembersDTO getDepartmentMembersDTO){ return ResponseData.generateCreatedResponse(0,departmentDictService.getDepartmentMembers(getDepartmentMembersDTO)); } + @PostMapping("getMembers") + @ApiOperation("获取成员(树) companyId 公司id startDate endDate ") + public ResponseVO getMembers(@RequestBody GetDepartmentMembersDTO getDepartmentMembersDTO){ + return ResponseData.generateCreatedResponse(0,departmentDictService.getMembers(getDepartmentMembersDTO)); + } + diff --git a/src/main/java/com/subsidy/controller/MemberController.java b/src/main/java/com/subsidy/controller/MemberController.java index da6c573..79033d8 100644 --- a/src/main/java/com/subsidy/controller/MemberController.java +++ b/src/main/java/com/subsidy/controller/MemberController.java @@ -6,6 +6,7 @@ import com.subsidy.common.ResponseVO; import com.subsidy.common.interceptor.LoginRequired; import com.subsidy.dto.administer.VerifyCodeDTO; import com.subsidy.dto.member.AddMemberDTO; +import com.subsidy.dto.member.ChangeDepartmentsDTO; import com.subsidy.dto.member.ContentMemberDTO; import com.subsidy.dto.member.GetAllDTO; import com.subsidy.dto.member.MyCoursesDTO; @@ -40,7 +41,7 @@ public class MemberController { private MemberService memberService; @PostMapping("getAll") - @ApiOperation("查询某部门成员 pageNum pageSize departmentId userName status") + @ApiOperation("查询某部门成员 pageNum pageSize departmentId userName status startDate endDate") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO getAll(@RequestBody GetAllDTO getAllDTO){ return ResponseData.generateCreatedResponse(0,memberService.getAll(getAllDTO)); @@ -54,7 +55,7 @@ public class MemberController { } @PostMapping("addMember") - @ApiOperation("新增成员 companyId userName accountName accountNameEn telephone gender image idCard departmentIds jobIds") + @ApiOperation("新增成员 companyId userName accountName accountNameEn telephone gender image idCard departmentIds jobIds workNo inductionDate email") @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) public ResponseVO addMember(@RequestBody AddMemberDTO addMemberDTO){ return ResponseData.generateCreatedResponse(0,memberService.addMember(addMemberDTO)); @@ -145,5 +146,10 @@ public class MemberController { memberService.importRedis(); } + @PostMapping("changeDepartments") + @ApiOperation("修改部门 desDepId[] 目的部门 memberIds[] 成员id") + public ResponseVO changeDepartments(@RequestBody ChangeDepartmentsDTO changeDepartmentsDTO){ + return ResponseData.generateCreatedResponse(0,memberService.changeDepartments(changeDepartmentsDTO)); + } } diff --git a/src/main/java/com/subsidy/controller/RotationImgDictController.java b/src/main/java/com/subsidy/controller/RotationImgDictController.java new file mode 100644 index 0000000..e3ed440 --- /dev/null +++ b/src/main/java/com/subsidy/controller/RotationImgDictController.java @@ -0,0 +1,57 @@ +package com.subsidy.controller; + + +import com.subsidy.common.ResponseData; +import com.subsidy.common.ResponseVO; +import com.subsidy.model.RotationImgDictDO; +import com.subsidy.service.RotationImgDictService; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 轮播图 前端控制器 + *

+ * + * @author DengMin + * @since 2022-02-23 + */ +@RestController +@Api(tags = "轮播图") +@RequestMapping("/rotationImgDict") +public class RotationImgDictController { + + @Autowired + private RotationImgDictService rotationImgDictService; + + @PostMapping("addRotation") + @ApiOperation("添加轮播图 {companyId 公司id rotationImg 轮播图地址}") + public ResponseVO addRotation(@RequestBody RotationImgDictDO rotationImgDictDO){ + return ResponseData.generateCreatedResponse(0,rotationImgDictService.addRotation(rotationImgDictDO)); + } + + @PostMapping("deleteRotation") + @ApiOperation("删除轮播图 {id}") + public ResponseVO deleteRotation(@RequestBody RotationImgDictDO rotationImgDictDO){ + return ResponseData.generateCreatedResponse(0,rotationImgDictService.deleteRotation(rotationImgDictDO)); + } + + @PostMapping("updateRotation") + @ApiOperation("编辑轮播图 id") + public ResponseVO updateRotation(@RequestBody RotationImgDictDO rotationImgDictDO){ + return ResponseData.generateCreatedResponse(0,rotationImgDictService.updateRotation(rotationImgDictDO)); + } + + @PostMapping("getAllRotations") + @ApiOperation("获取某企业的轮播图 companyId") + public ResponseVO getAllRotations(@RequestBody RotationImgDictDO rotationImgDictDO){ + return ResponseData.generateCreatedResponse(0,rotationImgDictService.getAllRotations(rotationImgDictDO)); + } + +} diff --git a/src/main/java/com/subsidy/dto/classDict/GetClassBaseInfoDTO.java b/src/main/java/com/subsidy/dto/classDict/GetClassBaseInfoDTO.java new file mode 100644 index 0000000..615ec91 --- /dev/null +++ b/src/main/java/com/subsidy/dto/classDict/GetClassBaseInfoDTO.java @@ -0,0 +1,12 @@ +package com.subsidy.dto.classDict; + +import lombok.Data; + +@Data +public class GetClassBaseInfoDTO { + + private Long userId; + + private Long id; + +} diff --git a/src/main/java/com/subsidy/dto/course/AddCourseDTO.java b/src/main/java/com/subsidy/dto/course/AddCourseDTO.java index 83a9cc5..5b576b9 100644 --- a/src/main/java/com/subsidy/dto/course/AddCourseDTO.java +++ b/src/main/java/com/subsidy/dto/course/AddCourseDTO.java @@ -1,9 +1,5 @@ package com.subsidy.dto.course; -import com.subsidy.model.CategoryDO; -import com.subsidy.model.FieldDictDO; -import com.subsidy.model.JobDictDO; -import com.subsidy.model.RankDictDO; import lombok.Data; import java.util.List; @@ -37,6 +33,11 @@ public class AddCourseDTO { private String coverPage; /** + * 备注 + */ + private String remark; + + /** * 开放状态 */ private Integer openStatus; diff --git a/src/main/java/com/subsidy/dto/course/UpdateCoursesDTO.java b/src/main/java/com/subsidy/dto/course/UpdateCoursesDTO.java index 672c497..f60bf41 100644 --- a/src/main/java/com/subsidy/dto/course/UpdateCoursesDTO.java +++ b/src/main/java/com/subsidy/dto/course/UpdateCoursesDTO.java @@ -30,6 +30,11 @@ public class UpdateCoursesDTO { private String courseType; /** + * 备注 + */ + private String remark; + + /** * 行业范围 */ private List fieldDictDOS; diff --git a/src/main/java/com/subsidy/dto/department/GetDepartmentMembersDTO.java b/src/main/java/com/subsidy/dto/department/GetDepartmentMembersDTO.java index 3229730..9608a82 100644 --- a/src/main/java/com/subsidy/dto/department/GetDepartmentMembersDTO.java +++ b/src/main/java/com/subsidy/dto/department/GetDepartmentMembersDTO.java @@ -14,4 +14,8 @@ public class GetDepartmentMembersDTO { private Long companyId; private String userName; + + private String startDate; + + private String endDate; } diff --git a/src/main/java/com/subsidy/dto/member/ChangeDepartmentsDTO.java b/src/main/java/com/subsidy/dto/member/ChangeDepartmentsDTO.java new file mode 100644 index 0000000..45ba5ea --- /dev/null +++ b/src/main/java/com/subsidy/dto/member/ChangeDepartmentsDTO.java @@ -0,0 +1,13 @@ +package com.subsidy.dto.member; + +import lombok.Data; + +import java.util.List; + +@Data +public class ChangeDepartmentsDTO { + + private List desDepId; + + private List memberIds; +} diff --git a/src/main/java/com/subsidy/dto/member/GetAllDTO.java b/src/main/java/com/subsidy/dto/member/GetAllDTO.java index 72f32c9..4ac9950 100644 --- a/src/main/java/com/subsidy/dto/member/GetAllDTO.java +++ b/src/main/java/com/subsidy/dto/member/GetAllDTO.java @@ -11,6 +11,10 @@ public class GetAllDTO{ private Long departmentId; + private String startDate; + + private String endDate; + private Integer pageNum; private Integer pageSize; diff --git a/src/main/java/com/subsidy/dto/member/ImportMemberDTO.java b/src/main/java/com/subsidy/dto/member/ImportMemberDTO.java index 9f4f60b..b05f9b7 100644 --- a/src/main/java/com/subsidy/dto/member/ImportMemberDTO.java +++ b/src/main/java/com/subsidy/dto/member/ImportMemberDTO.java @@ -1,9 +1,12 @@ package com.subsidy.dto.member; +import com.fasterxml.jackson.annotation.JsonFormat; import com.subsidy.util.excel.ExcelColumn; import com.subsidy.util.excel.ExcelColumnUtil; import lombok.Data; +import java.util.Date; + @Data public class ImportMemberDTO { @@ -26,5 +29,15 @@ public class ImportMemberDTO { @ExcelColumnUtil(value = "英文名", col = 6) private String accountNameEn; + @ExcelColumnUtil(value = "邮箱", col = 7) + private String email; + + @ExcelColumnUtil(value = "工号", col = 8) + private String workNo; + + @ExcelColumnUtil(value = "入职时间", col = 9) + private String inductionDate; + + } diff --git a/src/main/java/com/subsidy/jobs/CourseNotificationJob.java b/src/main/java/com/subsidy/jobs/CourseNotificationJob.java index 2a01b57..7f3c762 100644 --- a/src/main/java/com/subsidy/jobs/CourseNotificationJob.java +++ b/src/main/java/com/subsidy/jobs/CourseNotificationJob.java @@ -2,11 +2,13 @@ package com.subsidy.jobs; import com.subsidy.common.constant.CourseNotification; import com.subsidy.common.constant.SmsCode; +import com.subsidy.mapper.ClassDictMapper; import com.subsidy.mapper.ClassNoticeMapper; import com.subsidy.mapper.MemberMapper; import com.subsidy.model.ClassNoticeDO; import com.subsidy.model.MemberDO; import com.subsidy.util.SMSUtils; +import com.subsidy.vo.classdict.ClassAndCompanyInfoVO; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; @@ -36,7 +38,7 @@ public class CourseNotificationJob implements Job { private ClassNoticeMapper classNoticeMapper; @Autowired - private SMSUtils smsUtils; + private ClassDictMapper classDictMapper; @Override public void execute(JobExecutionContext jobExecutionContext) { @@ -45,20 +47,27 @@ public class CourseNotificationJob implements Job { if(params != null) { ClassNoticeDO classNoticeDO = classNoticeMapper.selectById((Long) params.get("id")); if(classNoticeDO != null) { + ClassAndCompanyInfoVO cmInfo = classDictMapper.getClassAndCompanyInfoVO((Long) params.get("classId")); List list = memberMapper.getMemberList((Long) params.get("classId")); if(list != null && list.size() > 0) { for (MemberDO memberDO : list) { if(memberDO != null) { Map data = Arrays.stream(SmsCode.values()).collect(Collectors.toMap(SmsCode::getType, SmsCode::getCode)); - smsUtils.send(memberDO.getTelephone(), data.get(classNoticeDO.getNoticeType())); + String sms = ""; + if(classNoticeDO.getNoticeType().equals(SmsCode.CLASS_START.getType())) { + sms = "{\"company\": \""+ cmInfo.getCompany() +"\", \"course\":\""+ cmInfo.getCourseName() +"\",\" startDate\": \""+ cmInfo.getStartDate()+"\", \"endDate\": \""+ cmInfo.getEndDate()+"\"}"; + } else if(classNoticeDO.getNoticeType().equals(SmsCode.SIGN_IN.getType()) || + classNoticeDO.getNoticeType().equals(SmsCode.TEST.getType())) { + sms = "{\"name\": \""+ cmInfo.getName() +"\", \"course\": \""+ cmInfo.getCourseName()+"\"}"; + } + SMSUtils.sendNoticeSMS(data.get(classNoticeDO.getNoticeType()), memberDO.getTelephone(), sms); } } - - ClassNoticeDO classNotice = new ClassNoticeDO(); - classNotice.setId(classNoticeDO.getId()); - classNotice.setStatus(CourseNotification.SENT); - classNoticeMapper.updateById(classNotice); } + ClassNoticeDO classNotice = new ClassNoticeDO(); + classNotice.setId(classNoticeDO.getId()); + classNotice.setStatus(CourseNotification.SENT); + classNoticeMapper.updateById(classNotice); } } } diff --git a/src/main/java/com/subsidy/jobs/SchedulerJob.java b/src/main/java/com/subsidy/jobs/SchedulerJob.java index 49b8900..433afaf 100644 --- a/src/main/java/com/subsidy/jobs/SchedulerJob.java +++ b/src/main/java/com/subsidy/jobs/SchedulerJob.java @@ -9,7 +9,7 @@ import com.subsidy.mapper.VodPlayHistoryMapper; import com.subsidy.model.OprAdmDictDO; import com.subsidy.model.SignInRecordDO; import com.subsidy.util.DateFormatUtil; -import com.subsidy.util.RedisUtil; +//import com.subsidy.util.RedisUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -41,8 +41,8 @@ public class SchedulerJob { @Autowired private SignInRecordMapper signInRecordMapper; - @Autowired - private RedisUtil redisUtil; + //@Autowired + //private RedisUtil redisUtil; /** 删除十天前登录记录(管理端) @@ -115,34 +115,34 @@ public class SchedulerJob { * 1天前的 * 增量版 */ - @Transactional(rollbackFor = Exception.class) - public void synchronizeSignInRecord() { - List list = signInRecordMapper.getSignInRecord(); - if(list != null && list.size() > 0) { - for (SignInRecordDO signInRecordDO : list) { - Set set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + signInRecordDO.getClassId() + ":" + DateFormatUtil.format(signInRecordDO.getSignInDate(), "yyyy-MM-dd")+":*"); - if(set != null && set.size() > 0) { - redisUtil.del(set); - } - redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + signInRecordDO.getClassId() + ":" + DateFormatUtil.format(signInRecordDO.getSignInDate(), "yyyy-MM-dd") + ":" + DateFormatUtil.LocalDateTimeToSecond(signInRecordDO.getSignInDate()), null); - } - } - } + //@Transactional(rollbackFor = Exception.class) + //public void synchronizeSignInRecord() { + // List list = signInRecordMapper.getSignInRecord(); + // if(list != null && list.size() > 0) { + // for (SignInRecordDO signInRecordDO : list) { + // Set set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + signInRecordDO.getClassId() + ":" + DateFormatUtil.format(signInRecordDO.getSignInDate(), "yyyy-MM-dd")+":*"); + // if(set != null && set.size() > 0) { + // redisUtil.del(set); + // } + // redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + signInRecordDO.getClassId() + ":" + DateFormatUtil.format(signInRecordDO.getSignInDate(), "yyyy-MM-dd") + ":" + DateFormatUtil.LocalDateTimeToSecond(signInRecordDO.getSignInDate()), null); + // } + // } + //} /** * 全部同步Redis签到数据 */ - @Transactional(rollbackFor = Exception.class) - public void synchronizeSignInRecordAll() { - Set set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX+"*"); - if(set != null && set.size() > 0) { - redisUtil.del(set); - } - - List list = signInRecordMapper.selectList(new QueryWrapper<>()); - for (SignInRecordDO signInRecordDO : list) { - redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + signInRecordDO.getClassId() + ":" + DateFormatUtil.format(signInRecordDO.getSignInDate(), "yyyy-MM-dd") + ":" + DateFormatUtil.LocalDateTimeToSecond(signInRecordDO.getSignInDate()), null); - } - - } + //@Transactional(rollbackFor = Exception.class) + //public void synchronizeSignInRecordAll() { + // Set set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX+"*"); + // if(set != null && set.size() > 0) { + // redisUtil.del(set); + // } + // + // List list = signInRecordMapper.selectList(new QueryWrapper<>()); + // for (SignInRecordDO signInRecordDO : list) { + // redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + signInRecordDO.getClassId() + ":" + DateFormatUtil.format(signInRecordDO.getSignInDate(), "yyyy-MM-dd") + ":" + DateFormatUtil.LocalDateTimeToSecond(signInRecordDO.getSignInDate()), null); + // } + // + //} } diff --git a/src/main/java/com/subsidy/mapper/ClassDictMapper.java b/src/main/java/com/subsidy/mapper/ClassDictMapper.java index 6a55eec..b33a537 100644 --- a/src/main/java/com/subsidy/mapper/ClassDictMapper.java +++ b/src/main/java/com/subsidy/mapper/ClassDictMapper.java @@ -5,6 +5,7 @@ import com.subsidy.dto.classDict.GetSpareMembersDTO; import com.subsidy.model.ClassDictDO; import com.subsidy.model.MemberDO; import com.subsidy.model.VodDictDO; +import com.subsidy.vo.classdict.ClassAndCompanyInfoVO; import com.subsidy.vo.classdict.GetAllClassesVO; import com.subsidy.vo.classdict.GetClassBaseInfoVO; import org.springframework.stereotype.Repository; @@ -48,4 +49,8 @@ public interface ClassDictMapper extends BaseMapper { */ GetClassBaseInfoVO getClassBaseInfo(Long classId); + /** + * 班级信息 -- 获取课程信息 + 公司信息 + * */ + ClassAndCompanyInfoVO getClassAndCompanyInfoVO(Long classId); } diff --git a/src/main/java/com/subsidy/mapper/CompanyDictMapper.java b/src/main/java/com/subsidy/mapper/CompanyDictMapper.java index 7239059..d47635c 100644 --- a/src/main/java/com/subsidy/mapper/CompanyDictMapper.java +++ b/src/main/java/com/subsidy/mapper/CompanyDictMapper.java @@ -21,10 +21,10 @@ import java.util.List; public interface CompanyDictMapper extends BaseMapper { /** - * 企业管理--查找所有主账号 + * 企业管理--查找所有主账号 、运营者 * @return */ - IPage operators(IPage page, String companyName,Long fieldId,Long id); + IPage operators(IPage page, String companyName,Long fieldId,Long id,Integer role); /** * 查找所有的公司名称 diff --git a/src/main/java/com/subsidy/mapper/CourseContentMapper.java b/src/main/java/com/subsidy/mapper/CourseContentMapper.java index b4d559e..3c156c2 100644 --- a/src/main/java/com/subsidy/mapper/CourseContentMapper.java +++ b/src/main/java/com/subsidy/mapper/CourseContentMapper.java @@ -29,7 +29,7 @@ public interface CourseContentMapper extends BaseMapper { /** * 查看某个目录下 某个成员看视频的进度 */ - List contentVodProcess(Long contentId, Long memberId); + List contentVodProcess(Long contentId, Long memberId,Long classId); /** * 查看某个课程下的文件/课件 diff --git a/src/main/java/com/subsidy/mapper/ExerciseDoneResultMapper.java b/src/main/java/com/subsidy/mapper/ExerciseDoneResultMapper.java index 01e6463..d71378c 100644 --- a/src/main/java/com/subsidy/mapper/ExerciseDoneResultMapper.java +++ b/src/main/java/com/subsidy/mapper/ExerciseDoneResultMapper.java @@ -46,7 +46,7 @@ public interface ExerciseDoneResultMapper extends BaseMapper getMaxScorePaper(Long paperId,Long memberId); + List getMaxScorePaper(Long paperId,Long memberId,Long classId); /** * 测试成绩 最高成绩 测试测试 总评价 diff --git a/src/main/java/com/subsidy/mapper/MemberMapper.java b/src/main/java/com/subsidy/mapper/MemberMapper.java index 8e229dc..f46e2a0 100644 --- a/src/main/java/com/subsidy/mapper/MemberMapper.java +++ b/src/main/java/com/subsidy/mapper/MemberMapper.java @@ -46,14 +46,24 @@ public interface MemberMapper extends BaseMapper { List getDepartments(Long memberId); /** - * 查询部门所有的学生 + * 查询部门所有的学生 分页 */ - IPage getMembers(IPage iPage,Long departmentId,String userName,String status); + IPage getMembers(IPage iPage,Long departmentId,String userName,String status,String startDate,String endDate); + + /** + * 查询某个部门的员工 不分页 + */ + List getMemberWithoutPage(Long departmentId,String userName,String status,String startDate,String endDate); + + /** + * 查询某公司的学生 + */ + IPage getCompanyMember(IPage iPage,Long companyId,String userName,String status,String startDate,String endDate); /** * 查询某公司所有的学生 公司不传就是查平台所有学生 */ - IPage manageMember(IPage iPage,Long companyId,String userName); + IPage manageMember(IPage iPage,Long companyId,String userName,String startDate,String endDate); List getMemberList(Long classId); diff --git a/src/main/java/com/subsidy/mapper/PaperDictMapper.java b/src/main/java/com/subsidy/mapper/PaperDictMapper.java index c5c16de..14bdb23 100644 --- a/src/main/java/com/subsidy/mapper/PaperDictMapper.java +++ b/src/main/java/com/subsidy/mapper/PaperDictMapper.java @@ -27,7 +27,7 @@ public interface PaperDictMapper extends BaseMapper { /** * 查看某个卷子有多少人完成 卷子id */ - Integer completeCount(Long paperId); + Integer completeCount(Long paperId,Long classId); /** * 查看某个课程下有多少卷子 diff --git a/src/main/java/com/subsidy/mapper/RoleAdministerMappingMapper.java b/src/main/java/com/subsidy/mapper/RoleAdministerMappingMapper.java index f1c3259..7fc919a 100644 --- a/src/main/java/com/subsidy/mapper/RoleAdministerMappingMapper.java +++ b/src/main/java/com/subsidy/mapper/RoleAdministerMappingMapper.java @@ -1,5 +1,6 @@ package com.subsidy.mapper; +import com.subsidy.model.AdministerDO; import com.subsidy.model.RoleAdministerMappingDO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.springframework.stereotype.Repository; @@ -15,4 +16,11 @@ import org.springframework.stereotype.Repository; @Repository public interface RoleAdministerMappingMapper extends BaseMapper { + /** + * 查看企业的管理者 + * @param companyId + * @return + */ + AdministerDO getAdminister(Long companyId); + } diff --git a/src/main/java/com/subsidy/mapper/RotationImgDictMapper.java b/src/main/java/com/subsidy/mapper/RotationImgDictMapper.java new file mode 100644 index 0000000..ff146ad --- /dev/null +++ b/src/main/java/com/subsidy/mapper/RotationImgDictMapper.java @@ -0,0 +1,18 @@ +package com.subsidy.mapper; + +import com.subsidy.model.RotationImgDictDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 轮播图 Mapper 接口 + *

+ * + * @author DengMin + * @since 2022-02-23 + */ + @Repository +public interface RotationImgDictMapper extends BaseMapper { + +} diff --git a/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java b/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java index 506639e..41a4238 100644 --- a/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java +++ b/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java @@ -80,7 +80,7 @@ public interface VodPlayHistoryMapper extends BaseMapper { /** * 查看某个人某个视频的累计时长 */ - Integer memberVodTotalLength(Long memberId,Long vodId); + Integer memberVodTotalLength(Long classId,Long memberId,Long vodId); /** * 跑脚本 前一天的学习情况 diff --git a/src/main/java/com/subsidy/model/ClassDictDO.java b/src/main/java/com/subsidy/model/ClassDictDO.java index 512ff4c..98cdd7c 100644 --- a/src/main/java/com/subsidy/model/ClassDictDO.java +++ b/src/main/java/com/subsidy/model/ClassDictDO.java @@ -79,4 +79,6 @@ public class ClassDictDO extends BaseModel { private Integer testRule; + + } diff --git a/src/main/java/com/subsidy/model/CourseDictDO.java b/src/main/java/com/subsidy/model/CourseDictDO.java index 7bdecd5..84d91b0 100644 --- a/src/main/java/com/subsidy/model/CourseDictDO.java +++ b/src/main/java/com/subsidy/model/CourseDictDO.java @@ -54,4 +54,8 @@ public class CourseDictDO extends BaseModel { */ private Integer openStatus; + /** + * 备注 + */ + private String remark; } diff --git a/src/main/java/com/subsidy/model/DepartmentDictDO.java b/src/main/java/com/subsidy/model/DepartmentDictDO.java index f2215ed..6a71f6c 100644 --- a/src/main/java/com/subsidy/model/DepartmentDictDO.java +++ b/src/main/java/com/subsidy/model/DepartmentDictDO.java @@ -52,6 +52,11 @@ public class DepartmentDictDO extends BaseModel { private Long parentId; /** + * 部门全路径 + */ + private String fullName; + + /** * 为写程序方便,数据库里为null */ private List children; diff --git a/src/main/java/com/subsidy/model/MemberDO.java b/src/main/java/com/subsidy/model/MemberDO.java index 9640093..b7cf9e2 100644 --- a/src/main/java/com/subsidy/model/MemberDO.java +++ b/src/main/java/com/subsidy/model/MemberDO.java @@ -1,5 +1,6 @@ package com.subsidy.model; +import com.fasterxml.jackson.annotation.JsonFormat; import com.subsidy.util.BaseModel; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.IdType; @@ -7,6 +8,8 @@ import com.baomidou.mybatisplus.annotation.TableId; import lombok.Data; import lombok.EqualsAndHashCode; +import java.util.Date; + /** *

* 学生表 @@ -56,6 +59,22 @@ public class MemberDO extends BaseModel { private String password; /** + * 工号 + */ + private String workNo; + + /** + * 入职时间 + */ + @JsonFormat + private String inductionDate; + + /** + * 邮箱 + */ + private String email; + + /** * 性别 */ private String gender; diff --git a/src/main/java/com/subsidy/model/RotationImgDictDO.java b/src/main/java/com/subsidy/model/RotationImgDictDO.java new file mode 100644 index 0000000..2805cdb --- /dev/null +++ b/src/main/java/com/subsidy/model/RotationImgDictDO.java @@ -0,0 +1,36 @@ +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 2022-02-23 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("rotation_img_dict") +public class RotationImgDictDO extends BaseModel { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private Long companyId; + + /** + * 轮播图 + */ + private String rotationImg; + + +} diff --git a/src/main/java/com/subsidy/service/ClassDictService.java b/src/main/java/com/subsidy/service/ClassDictService.java index 7c93c14..96ccd31 100644 --- a/src/main/java/com/subsidy/service/ClassDictService.java +++ b/src/main/java/com/subsidy/service/ClassDictService.java @@ -3,6 +3,7 @@ package com.subsidy.service; import com.baomidou.mybatisplus.extension.service.IService; import com.subsidy.dto.classDict.AddClassDTO; import com.subsidy.dto.classDict.AddMemberToClassDTO; +import com.subsidy.dto.classDict.GetClassBaseInfoDTO; import com.subsidy.dto.classDict.GetSpareMembersDTO; import com.subsidy.model.ClassDictDO; import com.subsidy.model.ClassMemberMappingDO; @@ -40,6 +41,6 @@ public interface ClassDictService extends IService { String batchSms(ClassDictDO classDictDO); - GetClassBaseInfoVO getClassBaseInfo(ClassDictDO classDictDO); + GetClassBaseInfoVO getClassBaseInfo(GetClassBaseInfoDTO getClassBaseInfoDTO); } diff --git a/src/main/java/com/subsidy/service/ClassHourDictService.java b/src/main/java/com/subsidy/service/ClassHourDictService.java index 6196c30..fa47f7f 100644 --- a/src/main/java/com/subsidy/service/ClassHourDictService.java +++ b/src/main/java/com/subsidy/service/ClassHourDictService.java @@ -3,6 +3,7 @@ package com.subsidy.service; import com.subsidy.model.ClassHourDictDO; import com.baomidou.mybatisplus.extension.service.IService; import com.subsidy.model.VodPlayHistoryDO; +import com.subsidy.vo.classdict.GetSettingVO; import com.subsidy.vo.hour.PollingGetVO; /** @@ -15,9 +16,9 @@ import com.subsidy.vo.hour.PollingGetVO; */ public interface ClassHourDictService extends IService { - ClassHourDictDO getSetting(ClassHourDictDO classHourDictDO); + GetSettingVO getSetting(ClassHourDictDO classHourDictDO); - String updateSetting(ClassHourDictDO classHourDictDO); + String updateSetting(GetSettingVO getSettingVO); PollingGetVO pollingGet(VodPlayHistoryDO vodPlayHistoryDO); } diff --git a/src/main/java/com/subsidy/service/DepartmentDictService.java b/src/main/java/com/subsidy/service/DepartmentDictService.java index cf2eccc..58e6fa8 100644 --- a/src/main/java/com/subsidy/service/DepartmentDictService.java +++ b/src/main/java/com/subsidy/service/DepartmentDictService.java @@ -5,6 +5,7 @@ import com.subsidy.dto.department.GetDepartmentMembersDTO; import com.subsidy.dto.department.GetDepartmentsVO; import com.subsidy.model.DepartmentDictDO; import com.baomidou.mybatisplus.extension.service.IService; +import com.subsidy.vo.department.GetMembersVO; import java.util.List; @@ -27,4 +28,6 @@ public interface DepartmentDictService extends IService { String updateDepartment(DepartmentDictDO departmentDictDO); IPage getDepartmentMembers(GetDepartmentMembersDTO getDepartmentMembersDTO); + + List getMembers(GetDepartmentMembersDTO getDepartmentMembersDTO); } diff --git a/src/main/java/com/subsidy/service/MemberService.java b/src/main/java/com/subsidy/service/MemberService.java index 662c197..8d40a11 100644 --- a/src/main/java/com/subsidy/service/MemberService.java +++ b/src/main/java/com/subsidy/service/MemberService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.subsidy.dto.administer.VerifyCodeDTO; import com.subsidy.dto.member.AddMemberDTO; +import com.subsidy.dto.member.ChangeDepartmentsDTO; import com.subsidy.dto.member.ContentMemberDTO; import com.subsidy.dto.member.GetAllDTO; import com.subsidy.dto.member.MyCoursesDTO; @@ -68,4 +69,6 @@ public interface MemberService extends IService { void importRedis(); + String changeDepartments(ChangeDepartmentsDTO changeDepartmentsDTO); + } diff --git a/src/main/java/com/subsidy/service/RotationImgDictService.java b/src/main/java/com/subsidy/service/RotationImgDictService.java new file mode 100644 index 0000000..c582e60 --- /dev/null +++ b/src/main/java/com/subsidy/service/RotationImgDictService.java @@ -0,0 +1,25 @@ +package com.subsidy.service; + +import com.subsidy.model.RotationImgDictDO; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + *

+ * 轮播图 服务类 + *

+ * + * @author DengMin + * @since 2022-02-23 + */ +public interface RotationImgDictService extends IService { + + String addRotation(RotationImgDictDO rotationImgDictDO); + + String deleteRotation(RotationImgDictDO rotationImgDictDO); + + String updateRotation(RotationImgDictDO rotationImgDictDO); + + List getAllRotations(RotationImgDictDO rotationImgDictDO); +} diff --git a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java index 3f5416f..dc8b5d3 100644 --- a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java @@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.subsidy.common.RedisPrefixConstant; import com.subsidy.common.exception.HttpException; import com.subsidy.dto.administer.ClassDailyInfoDTO; import com.subsidy.dto.administer.ClassDetailDTO; @@ -41,19 +40,16 @@ import com.subsidy.model.ExerciseDoneHistoryDO; import com.subsidy.model.ExerciseDoneResultDO; import com.subsidy.model.MemberDO; import com.subsidy.model.MemberDepartmentMappingDO; +import com.subsidy.model.OprAdmDictDO; import com.subsidy.model.RoleAdministerMappingDO; import com.subsidy.model.SignInRecordDO; import com.subsidy.model.VodDictDO; -import com.subsidy.model.OprAdmDictDO; import com.subsidy.service.AdministerService; -import com.subsidy.service.FieldDictService; 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; import com.subsidy.util.MathUtil; -import com.subsidy.util.RedisUtil; import com.subsidy.util.excel.ExcelUtil; import com.subsidy.vo.administer.AdministerPermissionVO; import com.subsidy.vo.administer.ClassDailyInfoVO; @@ -81,7 +77,6 @@ import net.sourceforge.pinyin4j.PinyinHelper; import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType; import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat; import net.sourceforge.pinyin4j.format.HanyuPinyinToneType; -import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; import org.apache.commons.lang3.StringUtils; import org.apache.poi.hssf.usermodel.HSSFCellStyle; import org.apache.poi.hssf.usermodel.HSSFFont; @@ -100,7 +95,6 @@ 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.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.context.request.RequestContextHolder; @@ -122,13 +116,10 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; -import java.util.Comparator; import java.util.Date; import java.util.HashMap; import java.util.List; -import java.util.Set; -import java.util.TreeSet; -import java.util.concurrent.ExecutionException; +import java.util.Locale; import java.util.concurrent.atomic.AtomicInteger; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; @@ -181,8 +172,8 @@ public class AdministerServiceImpl extends ServiceImpl() + AdministerDO administerDO1 = this.baseMapper.selectOne(new QueryWrapper() .lambda() .eq(AdministerDO::getAccountName, administerDO.getAccountName())); - redisUtil.set(RedisPrefixConstant.SUBSIDY_ADMINISTER_PREFIX + administerDO.getAccountName(), administerDO1); - } + //redisUtil.set(RedisPrefixConstant.SUBSIDY_ADMINISTER_PREFIX + administerDO.getAccountName(), administerDO1); + //} - if (null == administerDO1){ + if (null == administerDO1) { throw new HttpException(10012); } @@ -331,7 +322,7 @@ public class AdministerServiceImpl extends ServiceImpl operators(OperatorsDTO operatorsDTO) { Page pager = new Page(operatorsDTO.getPageNum(), operatorsDTO.getPageSize()); - IPage operatorsVOIPage = companyDictMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getFieldId(),null); + IPage operatorsVOIPage = companyDictMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getFieldId(), null,0); List operatorsVOS = operatorsVOIPage.getRecords(); for (OperatorsVO operatorsVO : operatorsVOS) { @@ -351,7 +342,7 @@ public class AdministerServiceImpl extends ServiceImpl= vodDictDO.getVodLength()) { i++; } @@ -481,7 +472,7 @@ public class AdministerServiceImpl extends ServiceImpl= vodDictDO.getVodLength()) { i++; } @@ -519,7 +510,12 @@ public class AdministerServiceImpl extends ServiceImpl() + .lambda() + .eq(SignInRecordDO::getClassId,classDetailDTO.getId()) + .eq(SignInRecordDO::getMemberId,classDetailVO.getId())); + classDetailVO.setSignCounts(set); } @@ -547,7 +543,7 @@ public class AdministerServiceImpl extends ServiceImpl= vodDictDO.getVodLength()) { i++; } @@ -593,7 +589,12 @@ public class AdministerServiceImpl extends ServiceImpl() + .lambda() + .eq(SignInRecordDO::getClassId,classDetailDTO.getId()) + .eq(SignInRecordDO::getMemberId,classDetailVO.getId())); + classDetailVO.setSignCounts(set); } @@ -623,7 +624,7 @@ public class AdministerServiceImpl extends ServiceImpl= vodDictDO.getVodLength()) { i++; } @@ -640,25 +641,21 @@ public class AdministerServiceImpl extends ServiceImpl sortSet = new TreeSet(new Comparator() { - @Override - public int compare(String o1, String o2) { - return -o2.compareTo(o1);//降序排列 - } - }); - //签到 - Set set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + classSignVO.getId() + ":classId:" + classDetailDTO.getId() + "*"); - classSignVO.setSignCounts(set.size()); + //Set set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + classSignVO.getId() + ":classId:" + classDetailDTO.getId() + "*"); + List signInRecordDOS = signInRecordMapper.selectList(new QueryWrapper() + .lambda() + .eq(SignInRecordDO::getClassId,classDetailDTO.getId()) + .eq(SignInRecordDO::getMemberId,classSignVO.getId()) + .orderByAsc(SignInRecordDO::getSignInDate)); + classSignVO.setSignCounts(signInRecordDOS.size()); StringBuilder stringBuilder = new StringBuilder(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - sortSet.addAll(set); //签到时间 - for (String signInRecordDO : sortSet) { - String[] array = signInRecordDO.split(":"); + for (SignInRecordDO signInRecordDO : signInRecordDOS) { + //String[] array = signInRecordDO.split(":"); //时间戳转时间 - stringBuilder.append(sdf.format(new Date(Long.valueOf(array[array.length - 1])))).append(";"); + stringBuilder.append(signInRecordDO.getSignInDate().toString().replace("T"," ").split(" " )[0]).append(";"); } if (StringUtils.isNotBlank(stringBuilder.toString())) { String signInDate = stringBuilder.toString().substring(0, stringBuilder.length() - 1); @@ -686,7 +683,7 @@ public class AdministerServiceImpl extends ServiceImpl= vodDictDO.getVodLength()) { i++; } @@ -702,31 +699,28 @@ public class AdministerServiceImpl extends ServiceImpl set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + classSignVO.getId() + ":classId:" + classDetailDTO.getId() + "*"); - classSignVO.setSignCounts(set.size()); - - Set sortSet = new TreeSet(new Comparator() { - @Override - public int compare(String o1, String o2) { - return -o2.compareTo(o1);//降序排列 - } - }); + //Set set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + classSignVO.getId() + ":classId:" + classDetailDTO.getId() + "*"); + List signInRecordDOS = signInRecordMapper.selectList(new QueryWrapper() + .lambda() + .eq(SignInRecordDO::getClassId,classDetailDTO.getId()) + .eq(SignInRecordDO::getMemberId,classSignVO.getId()) + .orderByAsc(SignInRecordDO::getSignInDate)); + classSignVO.setSignCounts(signInRecordDOS.size()); - sortSet.addAll(set); + //sortSet.addAll(set); StringBuilder stringBuilder = new StringBuilder(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //签到时间 - for (String signInRecordDO : sortSet) { - String[] array = signInRecordDO.split(":"); + for (SignInRecordDO signInRecordDO : signInRecordDOS) { + //String[] array = signInRecordDO.split(":"); //时间戳转时间 - stringBuilder.append(sdf.format(new Date(Long.valueOf(array[array.length - 1])))).append(";"); + stringBuilder.append(signInRecordDO.getSignInDate().toString().replace("T"," ").split(" ")[0]).append(";"); } if (StringUtils.isNotBlank(stringBuilder.toString())) { String signInDate = stringBuilder.toString().substring(0, stringBuilder.length() - 1); classSignVO.setSignInDateList(signInDate); } - } if (classDetailDTO.getFlag()) { @@ -778,6 +772,7 @@ public class AdministerServiceImpl extends ServiceImpl exerciseTestVOS = exportExerciseTest(classDetailDTO); - testListExcel(companyDictDO.getCompanyName(), studyDate, courseDictDO.getCourseName(), "测试成绩", ExcelFormatUtils.scoreList, exerciseTestVOS, null, 0, baos2); + testListExcel(companyDictDO.getCompanyName(), studyDate, courseDictDO.getCourseName(), "测试成绩表", ExcelFormatUtils.scoreList, exerciseTestVOS, null, 0, baos2); compressFileToZipStream(zipOutputStream, baos2, "test.xlsx"); @@ -1307,7 +1302,19 @@ public class AdministerServiceImpl extends ServiceImpl memberDOS = memberMapper.selectList(new QueryWrapper() .lambda() @@ -1319,7 +1326,7 @@ public class AdministerServiceImpl extends ServiceImpl() - .lambda() - .eq(DepartmentDictDO::getCompanyId,companyId) - .eq(DepartmentDictDO::getDepartmentName,deps[deps.length-1])); + .lambda() + .eq(DepartmentDictDO::getFullName, dep)); MemberDepartmentMappingDO memberDepartmentMappingDO = new MemberDepartmentMappingDO(); memberDepartmentMappingDO.setDepartmentId(departmentDictDO.getId()); @@ -1350,7 +1352,8 @@ public class AdministerServiceImpl extends ServiceImpl manageMember(ManageMemberDTO manageMemberDTO) { Page pager = new Page(manageMemberDTO.getPageNum(), manageMemberDTO.getPageSize()); - return memberMapper.manageMember(pager, null, manageMemberDTO.getUserName()); + return memberMapper.manageMember(pager, null, manageMemberDTO.getUserName(), null, null); } public String userName(String originName, int i, Long companyId) { diff --git a/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java index c99d1af..4b95206 100644 --- a/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java @@ -6,6 +6,7 @@ import com.subsidy.common.constant.CourseNotification; import com.subsidy.common.exception.HttpException; import com.subsidy.dto.classDict.AddClassDTO; import com.subsidy.dto.classDict.AddMemberToClassDTO; +import com.subsidy.dto.classDict.GetClassBaseInfoDTO; import com.subsidy.dto.classDict.GetSpareMembersDTO; import com.subsidy.jobs.CourseNotificationJob; import com.subsidy.mapper.AnsweringQuestionMapper; @@ -15,14 +16,18 @@ import com.subsidy.mapper.ClassNoticeMapper; import com.subsidy.mapper.CompanyDictMapper; import com.subsidy.mapper.CourseDictMapper; import com.subsidy.mapper.RoleAdministerMappingMapper; +import com.subsidy.mapper.VodDictMapper; +import com.subsidy.mapper.VodPlayHistoryMapper; import com.subsidy.model.AnsweringQuestionDO; import com.subsidy.model.ClassDictDO; import com.subsidy.model.ClassMemberMappingDO; import com.subsidy.model.ClassNoticeDO; import com.subsidy.model.CompanyDictDO; import com.subsidy.model.CourseDictDO; +import com.subsidy.model.FieldDictDO; import com.subsidy.model.MemberDO; import com.subsidy.model.RoleAdministerMappingDO; +import com.subsidy.model.VodDictDO; import com.subsidy.service.ClassDictService; import com.subsidy.util.ConstantUtils; import com.subsidy.util.DateFormatUtil; @@ -72,6 +77,12 @@ public class ClassDictServiceImpl extends ServiceImpl getAllClasses(ClassDictDO classDictDO) throws Exception { DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); @@ -203,8 +214,24 @@ public class ClassDictServiceImpl extends ServiceImpl vodDictDOS = vodDictMapper.getCourseVods(getClassBaseInfoVO.getCourseId(),null); + int completeNum = 0 ; + //查看每个视频的状态 + for (VodDictDO vodDictDO : vodDictDOS){ + int i = vodPlayHistoryMapper.completeVodOrNot(getClassBaseInfoDTO.getUserId(),vodDictDO.getId()); + completeNum += i; + } + if (completeNum == vodDictDOS.size()){ + getClassBaseInfoVO.setTestFlag(true); + }else { + getClassBaseInfoVO.setTestFlag(false); + } + return getClassBaseInfoVO; } } diff --git a/src/main/java/com/subsidy/service/impl/ClassHourDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/ClassHourDictServiceImpl.java index a36748c..a16fa8f 100644 --- a/src/main/java/com/subsidy/service/impl/ClassHourDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/ClassHourDictServiceImpl.java @@ -1,31 +1,30 @@ package com.subsidy.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.subsidy.common.RedisPrefixConstant; import com.subsidy.mapper.ClassHourDictMapper; +import com.subsidy.mapper.CompanyDictMapper; import com.subsidy.mapper.MemberMapper; +import com.subsidy.mapper.RotationImgDictMapper; import com.subsidy.mapper.VodPlayHistoryMapper; +import com.subsidy.model.ClassDictDO; import com.subsidy.model.ClassHourDictDO; +import com.subsidy.model.CompanyDictDO; import com.subsidy.model.MemberDO; +import com.subsidy.model.RotationImgDictDO; import com.subsidy.model.VodPlayHistoryDO; import com.subsidy.service.ClassHourDictService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.subsidy.util.ConstantUtils; import com.subsidy.util.MyBeanUtils; -import com.subsidy.util.RedisUtil; +import com.subsidy.vo.classdict.GetSettingVO; import com.subsidy.vo.hour.PollingGetVO; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; -import org.springframework.scheduling.annotation.AsyncResult; import org.springframework.stereotype.Service; -import java.time.LocalDate; import java.util.List; -import java.util.Set; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; /** *

@@ -44,20 +43,66 @@ public class ClassHourDictServiceImpl extends ServiceImpl() + .lambda() + .eq(ClassHourDictDO::getCompanyId,classHourDictDO.getCompanyId())); + //redisUtil.set(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX+classHourDictDO.getCompanyId(),classDictDO); + //} - public ClassHourDictDO getSetting(ClassHourDictDO classHourDictDO) { - return (ClassHourDictDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX+classHourDictDO.getCompanyId()); + BeanUtils.copyProperties(classDictDO,getSettingVO); + + List rotationImgDictDOS = rotationImgDictMapper.selectList(new QueryWrapper() + .lambda() + .eq(RotationImgDictDO::getCompanyId,classHourDictDO.getCompanyId())); + + getSettingVO.setRotationImgDictDOS(rotationImgDictDOS); + + CompanyDictDO companyDictDO = companyDictMapper.selectById(classHourDictDO.getCompanyId()); + getSettingVO.setLogo(companyDictDO.getLogo()); + return getSettingVO; } - public String updateSetting(ClassHourDictDO classHourDictDO) { + public String updateSetting(GetSettingVO getSettingVO) { - ClassHourDictDO classHourDictDO1 = (ClassHourDictDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + classHourDictDO.getCompanyId()); - classHourDictDO.setId(classHourDictDO1.getId()); - String[] nullParams = MyBeanUtils.getNullPropertyNames(classHourDictDO); - BeanUtils.copyProperties(classHourDictDO, classHourDictDO1,nullParams); - redisUtil.set(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX+classHourDictDO.getCompanyId(), classHourDictDO1); + if (!StringUtils.isEmpty(getSettingVO.getLogo())){ + CompanyDictDO companyDictDO = companyDictMapper.selectById(getSettingVO.getCompanyId()); + companyDictDO.setLogo(getSettingVO.getLogo()); + companyDictMapper.updateById(companyDictDO); + } + + //ClassHourDictDO classHourDictDO1 = (ClassHourDictDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + getSettingVO.getCompanyId()); + //getSettingVO.setId(classHourDictDO1.getId()); + //String[] nullParams = MyBeanUtils.getNullPropertyNames(getSettingVO); + //BeanUtils.copyProperties(getSettingVO, classHourDictDO1,nullParams); + //redisUtil.set(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX+getSettingVO.getCompanyId(), classHourDictDO1); + //this.baseMapper.updateById(classHourDictDO1); + + if (getSettingVO.getRotationImgDictDOS().size()>0){ + List rotationImgDictDOS = getSettingVO.getRotationImgDictDOS(); + rotationImgDictMapper.delete(new QueryWrapper() + .lambda() + .eq(RotationImgDictDO::getCompanyId,getSettingVO.getCompanyId())); + + for (RotationImgDictDO rotationImgDictDO : rotationImgDictDOS){ + rotationImgDictDO.setCompanyId(getSettingVO.getCompanyId()); + rotationImgDictMapper.insert(rotationImgDictDO); + } + } return ConstantUtils.SET_SUCCESS; } @@ -68,7 +113,9 @@ public class ClassHourDictServiceImpl extends ServiceImpl() + .lambda() + .eq(ClassHourDictDO::getCompanyId,memberDO.getCompanyId())); if (classHourDictDO.getStatus() == 0) { pollingGetVO.setBool(false); diff --git a/src/main/java/com/subsidy/service/impl/ClassNoticeServiceImpl.java b/src/main/java/com/subsidy/service/impl/ClassNoticeServiceImpl.java index 62b7c25..a249d1e 100644 --- a/src/main/java/com/subsidy/service/impl/ClassNoticeServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/ClassNoticeServiceImpl.java @@ -6,18 +6,19 @@ import com.subsidy.common.constant.SmsCode; import com.subsidy.common.exception.HttpException; import com.subsidy.dto.classNotice.SendNotificationDTO; import com.subsidy.jobs.CourseNotificationJob; +import com.subsidy.mapper.ClassDictMapper; import com.subsidy.mapper.MemberMapper; import com.subsidy.model.ClassDictDO; import com.subsidy.model.ClassNoticeDO; import com.subsidy.mapper.ClassNoticeMapper; import com.subsidy.model.MemberDO; -import com.subsidy.service.ClassDictService; import com.subsidy.service.ClassNoticeService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.subsidy.util.ConstantUtils; import com.subsidy.util.DateFormatUtil; import com.subsidy.util.QuartzUtil; import com.subsidy.util.SMSUtils; +import com.subsidy.vo.classdict.ClassAndCompanyInfoVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -41,14 +42,11 @@ public class ClassNoticeServiceImpl extends ServiceImpl params = new HashMap<>(); params.put("classId", classNoticeDO.getClassId()); params.put("id", classNoticeDO.getId()); String name = classDictDO.getClassName()+"-"+classNoticeDO.getNoticeType()+"-"+classNoticeDO.getNoticeTime(); - quartzUtil.addSimpleJob(CourseNotificationJob.class,DateFormatUtil.parse(classNoticeDO.getNoticeTime(), "yyyy-MM-dd") , params, name, "CourseNotificationJob"); + quartzUtil.addSimpleJob(CourseNotificationJob.class,DateFormatUtil.parse(classNoticeDO.getNoticeTime(), "yyyy-MM-dd HH:mm:ss") , params, name, "CourseNotificationJob"); return ConstantUtils.ADD_SUCCESS; } @@ -79,7 +77,7 @@ public class ClassNoticeServiceImpl extends ServiceImpl list = memberMapper.getMemberList(sendNotificationDTO.getClassId()); if(list != null) { for (MemberDO memberDO : list) { - smsUtils.send(memberDO.getTelephone(), SmsCode.ALL.getCode()); + SMSUtils.sendNoticeSMS(SmsCode.ALL.getCode(), memberDO.getTelephone(), params); } } } else if(sendNotificationDTO.getSendType().equals(SmsCode.NOT_SIGNED_IN.getType())) { + String params = "{ \"name\": \""+ cmInfo.getName() +"\", \"course\":\""+ cmInfo.getCourseName()+"\"}"; List list = memberMapper.getMemberListBySignInRecord(sendNotificationDTO.getClassId()); if(list != null) { for (MemberDO memberDO : list) { - smsUtils.send(memberDO.getTelephone(), SmsCode.NOT_SIGNED_IN.getCode()); + SMSUtils.sendNoticeSMS(SmsCode.NOT_SIGNED_IN.getCode(), memberDO.getTelephone(), params); } } } else if(sendNotificationDTO.getSendType().equals(SmsCode.UNFINISHED.getType())) { + String params = "{ \"name\": \""+ cmInfo.getName() +"\", \"course\":\""+ cmInfo.getCourseName()+"\"}"; List list = memberMapper.getUnfinishedMemberList(sendNotificationDTO.getClassId()); if(list != null) { for (MemberDO memberDO : list) { - smsUtils.send(memberDO.getTelephone(), SmsCode.UNFINISHED.getCode()); + SMSUtils.sendNoticeSMS(SmsCode.UNFINISHED.getCode(), memberDO.getTelephone(), params); } } } diff --git a/src/main/java/com/subsidy/service/impl/ClassTypeDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/ClassTypeDictServiceImpl.java index e83a42a..16c71e9 100644 --- a/src/main/java/com/subsidy/service/impl/ClassTypeDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/ClassTypeDictServiceImpl.java @@ -50,7 +50,7 @@ public class ClassTypeDictServiceImpl extends ServiceImpl classTypeDictDOS = new ArrayList<>(); - //查看当前登录人的角色 + //查看当前登录人的角色 角色映射表 int count = roleAdministerMappingMapper.selectCount(new QueryWrapper() .lambda() .eq(RoleAdministerMappingDO::getAdministerId,classTypeDTO.getUserId()) @@ -67,9 +67,8 @@ public class ClassTypeDictServiceImpl extends ServiceImpl operators(OperatorsDTO operatorsDTO) { Page pager = new Page(operatorsDTO.getPageNum(), operatorsDTO.getPageSize()); - - AdministerDO administerDO = administerMapper.selectById(operatorsDTO.getId()); //判断该用户的角色 @@ -100,7 +102,7 @@ public class CompanyDictServiceImpl extends ServiceImpl 0){ administerDO.setCompanyId(null); } - IPage page = this.baseMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getFieldId(),administerDO.getCompanyId()); + IPage page = this.baseMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getFieldId(),administerDO.getCompanyId(),null); List operatorsVOS = page.getRecords(); for (OperatorsVO operatorsVO : operatorsVOS) { //查看公司所在行业 @@ -138,7 +140,7 @@ public class CompanyDictServiceImpl extends ServiceImpl rotationImgDictDOS = rotationImgDictMapper.selectList(new QueryWrapper() + .lambda() + .isNull(RotationImgDictDO::getCompanyId)); + for (RotationImgDictDO rotationImgDictDO : rotationImgDictDOS){ + rotationImgDictDO.setCompanyId(companyDictDO.getId()); + rotationImgDictMapper.insert(rotationImgDictDO); + } + //班级类型 ClassTypeDictDO classTypeDictDO = new ClassTypeDictDO(); classTypeDictDO.setClassType("企业内训"); @@ -210,7 +221,7 @@ public class CompanyDictServiceImpl extends ServiceImpl() - .lambda() - .eq(AdministerDO::getCompanyId, addCompanyDTO.getId()) - .eq(AdministerDO::getRole, 1)); + AdministerDO administerDO = roleAdministerMappingMapper.getAdminister(addCompanyDTO.getId()); + if (StringUtils.isNotBlank(addCompanyDTO.getAccountName())) { administerDO.setAccountName(addCompanyDTO.getAccountName()); } diff --git a/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java index 059f7b1..d04cca1 100644 --- a/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java @@ -110,6 +110,7 @@ public class CourseDictServiceImpl extends ServiceImpl() - .lambda() - .eq(MemberDepartmentMappingDO::getDepartmentId, dd.getId())); - getDepartmentsVO.setCnt(count); + //Integer count = memberDepartmentMappingMapper.selectCount(new QueryWrapper() + // .lambda() + // .eq(MemberDepartmentMappingDO::getDepartmentId, dd.getId())); + //getDepartmentsVO.setCnt(count); getDepartmentsVO.setChildren(getChildNodes(getDepartmentsVO)); DepartmentDictDO departmentDictDO1 = this.baseMapper.selectById(dd.getParentId()); if (null != departmentDictDO1) { @@ -107,16 +112,32 @@ public class DepartmentDictServiceImpl extends ServiceImpl() .lambda() .eq(DepartmentDictDO::getCompanyId, departmentDictDO.getCompanyId()) - .eq(DepartmentDictDO::getDepartmentName, departmentDictDO.getDepartmentName())); + .eq(DepartmentDictDO::getFullName, departmentDictDO.getFullName())); if (counter > 0) { throw new HttpException(30001); } - this.baseMapper.insert(departmentDictDO); + List depNames = new ArrayList<>(); + + StringBuilder fullName = new StringBuilder(); + //fullName 遍历生成全名称 + do { + depNames.add("/"+departmentDictDO.getDepartmentName()); + departmentDictDO = this.baseMapper.selectById(departmentDictDO.getParentId()); + } while(null != departmentDictDO.getParentId()); + + depNames.add(departmentDictDO.getDepartmentName()); + + for (int i = depNames.size()-1; i >=0 ; i--){ + fullName.append(depNames.get(i)); + } + departmentDictDO1.setFullName(fullName.toString()); + this.baseMapper.insert(departmentDictDO1); return ConstantUtils.ADD_SUCCESS; } @@ -170,13 +191,93 @@ public class DepartmentDictServiceImpl extends ServiceImpl getMembers(GetDepartmentMembersDTO getDepartmentMembersDTO){ + + List getMembersVOS = new ArrayList<>(); + + GetMembersVO getMembersVO = new GetMembersVO(); + + //找到父节点 + DepartmentDictDO departmentDictDO = this.baseMapper.selectOne(new QueryWrapper() + .lambda() + .eq(DepartmentDictDO::getCompanyId,getDepartmentMembersDTO.getCompanyId()) + .isNull(DepartmentDictDO::getParentId)); + BeanUtils.copyProperties(departmentDictDO,getMembersVO); + + List departmentDictDOS = new ArrayList<>(); + departmentDictDOS.add(departmentDictDO); + + for (DepartmentDictDO dpt : departmentDictDOS){ + GetMembersVO gmv = new GetMembersVO(); + BeanUtils.copyProperties(dpt,gmv); + if (null!=departmentDictDO.getParentId()){ + DepartmentDictDO departmentDictDO1 =this.baseMapper.selectById(departmentDictDO.getParentId()); + gmv.setParentDepartmentName(departmentDictDO1.getDepartmentName()); + } + gmv.setChildren(getChildNodes(gmv)); + + if (dpt.getParentId()!=null){ + //部门人员 + List memberDOS1 = memberMapper.getMemberWithoutPage(dpt.getId(),getMembersVO.getUserName(),null,null,null); + gmv.setMemberDOS(memberDOS1); + getMembersVOS.add(gmv); + }else { + //公司人员 + List memberDOS = memberMapper.selectList(new QueryWrapper() + .lambda() + .eq(MemberDO::getCompanyId,getDepartmentMembersDTO.getCompanyId())); + gmv.setMemberDOS(memberDOS); + getMembersVOS.add(gmv); + } + } + return getMembersVOS; + } + + + /** + * 递归 带上部门总数,部门负责人等参数 + * + * @param getMembersVO 父节点查找该节点的children + * @return 子节点 + */ + public List getChildNodes(GetMembersVO getMembersVO) { + + List getAllDepartmentVOS = new ArrayList<>(); + + //查询该节点的子节点 + List departmentDictDOS = this.baseMapper.selectList(new QueryWrapper() + .lambda() + .eq(DepartmentDictDO::getParentId, getMembersVO.getId())); + + //递归 + for (DepartmentDictDO dd : departmentDictDOS) { + GetMembersVO gmv = new GetMembersVO(); + BeanUtils.copyProperties(dd, gmv); + if (null!=dd.getParentId()){ + DepartmentDictDO departmentDictDO = this.baseMapper.selectById(dd.getParentId()); + gmv.setParentDepartmentName(departmentDictDO.getDepartmentName()); + } + gmv.setChildren(getChildNodes(gmv)); + + + //部门人员 + List memberDOS = memberMapper.getMemberWithoutPage(dd.getId(),getMembersVO.getUserName(),null,null,null); + gmv.setMemberDOS(memberDOS); + getAllDepartmentVOS.add(gmv); + } + if (departmentDictDOS.size() == 0) { + return null; + } + + return getAllDepartmentVOS; + } } diff --git a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java index 2d5544e..b1e89d1 100644 --- a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java @@ -8,16 +8,19 @@ import com.subsidy.common.RedisPrefixConstant; import com.subsidy.common.exception.HttpException; import com.subsidy.dto.administer.VerifyCodeDTO; import com.subsidy.dto.member.AddMemberDTO; +import com.subsidy.dto.member.ChangeDepartmentsDTO; import com.subsidy.dto.member.ContentMemberDTO; import com.subsidy.dto.member.GetAllDTO; import com.subsidy.dto.member.MyCoursesDTO; import com.subsidy.dto.member.PasswordLoginDTO; import com.subsidy.dto.member.StudyHistoryDTO; import com.subsidy.mapper.ClassDictMapper; +import com.subsidy.mapper.ClassHourDictMapper; import com.subsidy.mapper.ClassMemberMappingMapper; import com.subsidy.mapper.CompanyDictMapper; import com.subsidy.mapper.CourseContentMapper; import com.subsidy.mapper.CourseFieldMappingMapper; +import com.subsidy.mapper.DepartmentDictMapper; import com.subsidy.mapper.ExerciseDoneResultMapper; import com.subsidy.mapper.FileDictMapper; import com.subsidy.mapper.JobDictMapper; @@ -26,6 +29,9 @@ import com.subsidy.mapper.MemberDepartmentMappingMapper; import com.subsidy.mapper.MemberMapper; import com.subsidy.mapper.OprMemDictMapper; import com.subsidy.mapper.PaperDictMapper; +import com.subsidy.mapper.RotationImgDictMapper; +import com.subsidy.mapper.SmsVerifyCodeMapper; +import com.subsidy.mapper.VodDictMapper; import com.subsidy.mapper.VodPlayHistoryMapper; import com.subsidy.model.ClassDictDO; import com.subsidy.model.ClassHourDictDO; @@ -41,10 +47,12 @@ import com.subsidy.model.JobMemberMappingDO; import com.subsidy.model.MemberDO; import com.subsidy.model.MemberDepartmentMappingDO; import com.subsidy.model.OprMemDictDO; +import com.subsidy.model.RotationImgDictDO; +import com.subsidy.model.SmsVerifyCodeDO; import com.subsidy.model.VodDictDO; import com.subsidy.service.MemberService; import com.subsidy.util.ConstantUtils; -import com.subsidy.util.RedisUtil; +//import com.subsidy.util.RedisUtil; import com.subsidy.vo.administer.UserRoleVO; import com.subsidy.vo.member.ContentFilesVO; import com.subsidy.vo.member.ContentVodNewVO; @@ -106,8 +114,8 @@ public class MemberServiceImpl extends ServiceImpl imple @Autowired private MemberDepartmentMappingMapper memberDepartmentMappingMapper; - @Autowired - private RedisUtil redisUtil; + //@Autowired + //private RedisUtil redisUtil; @Autowired private CourseFieldMappingMapper courseFieldMappingMapper; @@ -124,9 +132,33 @@ public class MemberServiceImpl extends ServiceImpl imple @Autowired private JobMemberMappingMapper jobMemberMappingMapper; + @Autowired + private DepartmentDictMapper departmentDictMapper; + + @Autowired + private RotationImgDictMapper rotationImgDictMapper; + + @Autowired + private VodDictMapper vodDictMapper; + + @Autowired + private SmsVerifyCodeMapper smsVerifyCodeMapper; + + @Autowired + private ClassHourDictMapper classHourDictMapper; + 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()); + + DepartmentDictDO departmentDictDO = departmentDictMapper.selectById(getAllDTO.getDepartmentId()); + + IPage iPage = null; + + if (null != departmentDictDO.getParentId()) { + iPage = this.baseMapper.getMembers(pager, getAllDTO.getDepartmentId(), getAllDTO.getUserName(), getAllDTO.getStatus(), getAllDTO.getStartDate(), getAllDTO.getEndDate()); + } else { + iPage = this.baseMapper.getCompanyMember(pager, departmentDictDO.getCompanyId(), getAllDTO.getUserName(), getAllDTO.getStatus(), getAllDTO.getStartDate(), getAllDTO.getEndDate()); + } List getAllVOS = iPage.getRecords(); for (GetAllVO getAllVO : getAllVOS) { @@ -181,7 +213,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); if (null != addMemberDTO.getDepartmentIds()) { //部门 @@ -238,8 +270,8 @@ public class MemberServiceImpl extends ServiceImpl imple MemberDO memberDO = new MemberDO(); BeanUtils.copyProperties(addMemberDTO, memberDO); this.baseMapper.updateById(memberDO); - MemberDO memberDO1 = this.baseMapper.selectById(addMemberDTO.getId()); - redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO1); + //MemberDO memberDO1 = this.baseMapper.selectById(addMemberDTO.getId()); + //redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO1); if (null != addMemberDTO.getDepartmentIds()) { memberDepartmentMappingMapper.delete(new QueryWrapper() @@ -308,13 +340,18 @@ 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); - String code = redisUtil.get(RedisPrefixConstant.SUBSIDY_TELEPHONE_PREFIX + verifyCodeDTO.getTelephone()).toString(); + //String code = redisUtil.get(RedisPrefixConstant.SUBSIDY_TELEPHONE_PREFIX + verifyCodeDTO.getTelephone()).toString(); + SmsVerifyCodeDO smsCodeDO = smsVerifyCodeMapper.selectOne(new QueryWrapper() + .lambda() + .eq(SmsVerifyCodeDO::getTelephone, verifyCodeDTO.getTelephone()) + .eq(SmsVerifyCodeDO::getVerifyCode, verifyCodeDTO.getVerifyCode()) + .gt(SmsVerifyCodeDO::getCreateDate, LocalDateTime.now().minusMinutes(30L))); - if (code == null || !verifyCodeDTO.getVerifyCode().equals(code)) { + if (null != smsCodeDO || !verifyCodeDTO.getVerifyCode().equals(smsCodeDO.getVerifyCode())) { OprMemDictDO oprMemDictDO = new OprMemDictDO(); oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setOprType("登录"); @@ -340,6 +377,13 @@ public class MemberServiceImpl extends ServiceImpl imple //oprMemDictDO.setCompanyName(companyDictDO.getCompanyName()); oprMemDictMapper.insert(oprMemDictDO); //mongoTemplate.insert(oprMemDictDO); + userRoleVO.setCompanyId(companyDictDO.getId()); + userRoleVO.setCompanyName(companyDictDO.getCompanyName()); + userRoleVO.setLogo(companyDictDO.getLogo()); + List rotationImgDictDOS = rotationImgDictMapper.selectList(new QueryWrapper() + .lambda() + .eq(RotationImgDictDO::getCompanyId, companyDictDO.getId())); + userRoleVO.setRotationImgDictDOS(rotationImgDictDOS); return userRoleVO; } @@ -347,7 +391,8 @@ public class MemberServiceImpl extends ServiceImpl imple /** * 先从redis里查 */ - MemberDO memberDO = (MemberDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + passwordLoginDTO.getCompanyId() + ":" + passwordLoginDTO.getAccountName()); + //MemberDO memberDO = (MemberDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + passwordLoginDTO.getCompanyId() + ":" + passwordLoginDTO.getAccountName()); + MemberDO memberDO = null; if (null == memberDO) { /** * redis里没有,从数据库里查 @@ -363,9 +408,11 @@ public class MemberServiceImpl extends ServiceImpl imple CompanyDictDO companyDictDO = companyDictMapper.selectById(memberDO.getCompanyId()); + if (memberDO.getPassword().equals(passwordLoginDTO.getPassword()) && 1 == memberDO.getFirstLogin() && !"冻结".equals(memberDO.getStatus())) { MemberVO memberVO = new MemberVO(); BeanUtils.copyProperties(memberDO, memberVO); + memberVO.setCompanyId(companyDictDO.getId()); memberVO.setCompanyName(companyDictDO.getCompanyName()); OprMemDictDO oprMemDictDO = new OprMemDictDO(); oprMemDictDO.setUserId(memberDO.getId()); @@ -378,7 +425,14 @@ public class MemberServiceImpl extends ServiceImpl imple //oprMemDictDO.setCompanyName(companyDictDO.getCompanyName()); //mongoTemplate.insert(oprMemDictDO); oprMemDictMapper.insert(oprMemDictDO); - redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + passwordLoginDTO.getCompanyId() + ":" + passwordLoginDTO.getAccountName(), memberDO); + memberVO.setCompanyId(companyDictDO.getId()); + memberVO.setCompanyName(companyDictDO.getCompanyName()); + memberVO.setLogo(companyDictDO.getLogo()); + List rotationImgDictDOS = rotationImgDictMapper.selectList(new QueryWrapper() + .lambda() + .eq(RotationImgDictDO::getCompanyId, companyDictDO.getId())); + memberVO.setRotationImgDictDOS(rotationImgDictDOS); + //redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + passwordLoginDTO.getCompanyId() + ":" + passwordLoginDTO.getAccountName(), memberDO); //redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + System.currentTimeMillis(), 1); return memberVO; } else { @@ -421,8 +475,8 @@ public class MemberServiceImpl extends ServiceImpl imple public String updatePassword(MemberDO memberDO) { this.baseMapper.updateById(memberDO); - MemberDO memberDO1 = this.baseMapper.selectById(memberDO.getId()); - redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO1.getCompanyId() + ":" + memberDO.getAccountName(), memberDO); + //MemberDO memberDO1 = this.baseMapper.selectById(memberDO.getId()); + //redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO1.getCompanyId() + ":" + memberDO.getAccountName(), memberDO); return ConstantUtils.SET_SUCCESS; } @@ -490,23 +544,49 @@ public class MemberServiceImpl extends ServiceImpl imple .eq(CourseContentDO::getCourseId, contentVodDTO.getCourseId()) .orderByAsc(CourseContentDO::getOrderNo)); + ClassDictDO classDictDO1 = classDictMapper.selectById(contentVodDTO.getClassId()); + + //目录状态 + Boolean contentStatus = true; + for (CourseContentDO courseContentDO : courseContentDOS) { ContentVodVO contentVodVO = new ContentVodVO(); contentVodVO.setContent(courseContentDO.getContent()); - List memberVodVOS = courseContentMapper.contentVodProcess(courseContentDO.getId(), contentVodDTO.getMemberId()); + List memberVodVOS = courseContentMapper.contentVodProcess(courseContentDO.getId(), contentVodDTO.getMemberId(),contentVodDTO.getClassId()); Boolean flag = false; - for (MemberVodVO memberVodVO : memberVodVOS) { - if (memberVodVO.getPercent() == 100 && !flag) { - //这个视频看完了,已解锁 + int i = 0; + + if (1 == classDictDO1.getIsOrder()) { + for (MemberVodVO memberVodVO : memberVodVOS) { + + if (i == 0 && contentStatus) { + //第一个视频默认打开 + memberVodVO.setStatus(true); + } else if (memberVodVO.getPercent() == 100) { + //这个视频看完了,已解锁 + memberVodVO.setStatus(true); + } else { + //这个视频没看完,未解锁 + if (!flag) { + //这个视频可见 ===> 第一个没看完但可以看的视频 + memberVodVO.setStatus(true); + flag = true; + } else { + memberVodVO.setStatus(false); + } + contentStatus = false; + } + + i++; + } + } else { + for (MemberVodVO memberVodVO : memberVodVOS) { memberVodVO.setStatus(true); - } else { - //这个视频没看完,未解锁 - memberVodVO.setStatus(false); - flag = true; } } + int playCount = 0; for (MemberVodVO memberVodVO : memberVodVOS) { if (100 == memberVodVO.getPercent()) { @@ -567,10 +647,10 @@ public class MemberServiceImpl extends ServiceImpl imple List queryPapersVOS = paperDictMapper.queryPapers(contentMemberDTO.getCourseId(), null, 1); for (QueryPapersVO queryPapersVO : queryPapersVOS) { //多少人已完成 - Integer cnt = paperDictMapper.completeCount(queryPapersVO.getId()); + Integer cnt = paperDictMapper.completeCount(queryPapersVO.getId(),contentMemberDTO.getClassId()); queryPapersVO.setCompleteCnt(cnt); //自己成绩 - List exerciseDoneResultDOS = exerciseDoneResultMapper.getMaxScorePaper(queryPapersVO.getId(), contentMemberDTO.getMemberId()); + List exerciseDoneResultDOS = exerciseDoneResultMapper.getMaxScorePaper(queryPapersVO.getId(), contentMemberDTO.getMemberId(),contentMemberDTO.getClassId()); if (exerciseDoneResultDOS.size() > 0) { queryPapersVO.setRightCounts(exerciseDoneResultDOS.get(0).getRightCounts()); @@ -607,7 +687,7 @@ public class MemberServiceImpl extends ServiceImpl imple for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) { List vodDictDOS = classDictMapper.getClassVods(classMemberMappingDO.getClassId()); for (VodDictDO vodDictDO : vodDictDOS) { - int playLength = vodPlayHistoryMapper.memberVodTotalLength(memberDO.getId(), vodDictDO.getId()); + int playLength = vodPlayHistoryMapper.memberVodTotalLength(memberDO.getId(), vodDictDO.getId(), classMemberMappingDO.getClassId()); if (playLength < vodDictDO.getVodLength()) { break; } @@ -631,7 +711,9 @@ public class MemberServiceImpl extends ServiceImpl imple public String checkTimes(ExerciseDoneResultDO exerciseDoneResultDO) { MemberDO memberDO = this.baseMapper.selectById(exerciseDoneResultDO.getMemberId()); - ClassHourDictDO classHourDictDO = (ClassHourDictDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + memberDO.getCompanyId()); + ClassHourDictDO classHourDictDO = classHourDictMapper.selectOne(new QueryWrapper() + .lambda() + .eq(ClassHourDictDO::getCompanyId, memberDO.getCompanyId())); if (null != classHourDictDO) { Integer status = classHourDictDO.getRepeatStatus(); @@ -655,8 +737,32 @@ public class MemberServiceImpl extends ServiceImpl imple public void importRedis() { List memberDOS = this.baseMapper.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); } } + public String changeDepartments(ChangeDepartmentsDTO changeDepartmentsDTO) { + + List memberIds = changeDepartmentsDTO.getMemberIds(); + + //清掉以前的部门 + for (Long lg : memberIds) { + memberDepartmentMappingMapper.delete(new QueryWrapper() + .lambda() + .eq(MemberDepartmentMappingDO::getMemberId, lg)); + } + + //加入新的部门 + List depIds = changeDepartmentsDTO.getDesDepId(); + for (Long lg : memberIds) { + for (Long depId : depIds) { + MemberDepartmentMappingDO memberDepartmentMappingDO = new MemberDepartmentMappingDO(); + memberDepartmentMappingDO.setMemberId(lg); + memberDepartmentMappingDO.setDepartmentId(depId); + memberDepartmentMappingMapper.insert(memberDepartmentMappingDO); + } + } + return ConstantUtils.SET_SUCCESS; + } + } diff --git a/src/main/java/com/subsidy/service/impl/RotationImgDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/RotationImgDictServiceImpl.java new file mode 100644 index 0000000..59ee887 --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/RotationImgDictServiceImpl.java @@ -0,0 +1,44 @@ +package com.subsidy.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.subsidy.model.RotationImgDictDO; +import com.subsidy.mapper.RotationImgDictMapper; +import com.subsidy.service.RotationImgDictService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.subsidy.util.ConstantUtils; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 轮播图 服务实现类 + *

+ * + * @author DengMin + * @since 2022-02-23 + */ +@Service +public class RotationImgDictServiceImpl extends ServiceImpl implements RotationImgDictService { + + public String addRotation(RotationImgDictDO rotationImgDictDO) { + this.baseMapper.insert(rotationImgDictDO); + return ConstantUtils.ADD_SUCCESS; + } + + public String deleteRotation(RotationImgDictDO rotationImgDictDO) { + this.baseMapper.deleteById(rotationImgDictDO.getId()); + return ConstantUtils.DELETE_SUCCESS; + } + + public String updateRotation(RotationImgDictDO rotationImgDictDO) { + this.baseMapper.updateById(rotationImgDictDO); + return ConstantUtils.SET_SUCCESS; + } + + public List getAllRotations(RotationImgDictDO rotationImgDictDO){ + return this.baseMapper.selectList(new QueryWrapper() + .lambda() + .eq(RotationImgDictDO::getCompanyId,rotationImgDictDO.getCompanyId())); + } +} diff --git a/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java b/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java index 6c1aba2..52c75e9 100644 --- a/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java @@ -4,15 +4,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.subsidy.common.RedisPrefixConstant; import com.subsidy.dto.member.GetMemberSignInfoDTO; import com.subsidy.dto.sign.DataViewDTO; import com.subsidy.mapper.AnsweringQuestionMapper; import com.subsidy.mapper.ClassDictMapper; -import com.subsidy.mapper.ClassHourDictMapper; import com.subsidy.mapper.ClassMemberMappingMapper; import com.subsidy.mapper.ExerciseDoneResultMapper; -import com.subsidy.mapper.MemberMapper; import com.subsidy.mapper.SignInRecordMapper; import com.subsidy.mapper.VodPlayHistoryMapper; import com.subsidy.model.AnsweringQuestionDO; @@ -24,22 +21,19 @@ 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.MyBeanUtils; -import com.subsidy.util.RedisUtil; import com.subsidy.vo.member.GetMemberSignInfoVO; import com.subsidy.vo.sign.DataViewVO; import com.subsidy.vo.sign.SignInStatusVO; -import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDate; import java.time.LocalDateTime; -import java.time.ZoneOffset; import java.util.Date; import java.util.List; -import java.util.Set; + +//import com.subsidy.util.RedisUtil; /** *

@@ -58,8 +52,8 @@ public class SignInRecordServiceImpl extends ServiceImpl classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId()); for (ClassDictDO classDictDO : classDictDOS) { - Set set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + signInRecordDO.getClassId() + ":" + DateFormatUtil.format(signInRecordDO.getSignInDate(), "yyyy-MM-dd")+":*"); - if(set != null && set.size() > 0) { - redisUtil.del(set); - } - redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + classDictDO.getId() + ":" + DateFormatUtil.format(new Date(), "yyyy-MM-dd") + ":" + System.currentTimeMillis(), null); + //Set set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + signInRecordDO.getClassId() + ":" + DateFormatUtil.format(signInRecordDO.getSignInDate(), "yyyy-MM-dd")+":*"); + //if(set != null && set.size() > 0) { + // redisUtil.del(set); + //} + //redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + classDictDO.getId() + ":" + DateFormatUtil.format(new Date(), "yyyy-MM-dd") + ":" + System.currentTimeMillis(), null); + + signInRecordMapper.delete(new QueryWrapper() + .lambda() + .eq(SignInRecordDO::getMemberId,signInRecordDO.getMemberId()) + .eq(SignInRecordDO::getClassId,classDictDO.getId())); // 存储到缓存到同时保存到数据库 SignInRecordDO sign = this.baseMapper.selectOne(new QueryWrapper() @@ -159,7 +158,7 @@ public class SignInRecordServiceImpl extends ServiceImpl= vodDictDO.getVodLength()) { i++; } @@ -196,13 +195,34 @@ public class SignInRecordServiceImpl extends ServiceImpl signInRecordDOS = signInRecordMapper.selectList(new QueryWrapper() + //.lambda() + //.eq(SignInRecordDO::getMemberId,signInRecordDO.getMemberId()) + //.eq(SignInRecordDO::getClassId)) + //if (size <= count) { + // signInStatusVO.setStatus(false); + //} + //获取有效课程 + List classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId()); - if (size < count) { - signInStatusVO.setStatus(false); - } + for (ClassDictDO classDictDO : classDictDOS) { + Integer count = this.baseMapper.selectCount(new QueryWrapper() + .lambda() + .eq(SignInRecordDO::getClassId, classDictDO.getId()) + .eq(SignInRecordDO::getMemberId, signInRecordDO.getMemberId()) + .gt(SignInRecordDO::getSignInDate, LocalDate.now())); + + //String count = redisUtil.get("signInStatus:"+signInRecordDO.getMemberId()+":"+classDictDO.getId()).toString(); + + if (count == 0) { + flag = false; //没有签到 + } + } + signInStatusVO.setStatus(flag); return signInStatusVO; } @@ -227,11 +247,11 @@ public class SignInRecordServiceImpl extends ServiceImpl signInRecordDOS = signInRecordMapper.selectList(null); - for (SignInRecordDO signInRecordDO : signInRecordDOS){ - redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX+signInRecordDO.getMemberId()+":classId:"+ - signInRecordDO.getClassId()+":"+signInRecordDO.getSignInDate().toString().split("T")[0]+":"+signInRecordDO.getSignInDate().toInstant(ZoneOffset.of("+8")).toEpochMilli(),signInRecordDO); - } + //List signInRecordDOS = signInRecordMapper.selectList(null); + //for (SignInRecordDO signInRecordDO : signInRecordDOS){ + // redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX+signInRecordDO.getMemberId()+":classId:"+ + // signInRecordDO.getClassId()+":"+signInRecordDO.getSignInDate().toString().split("T")[0]+":"+signInRecordDO.getSignInDate().toInstant(ZoneOffset.of("+8")).toEpochMilli(),signInRecordDO); + //} // redisUtil.scan("*20220126*"); // redisUtil.("*20220126*"); diff --git a/src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java b/src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java index ef6d289..beccc4e 100644 --- a/src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java @@ -11,7 +11,6 @@ import com.subsidy.model.MemberDO; import com.subsidy.model.SmsVerifyCodeDO; import com.subsidy.service.SmsVerifyCodeService; import com.subsidy.util.RandomUtil; -import com.subsidy.util.RedisUtil; import com.subsidy.util.SMSUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; @@ -34,8 +33,8 @@ public class SmsVerifyCodeServiceImpl extends ServiceImpl() @@ -47,10 +46,15 @@ public class SmsVerifyCodeServiceImpl extends ServiceImpl im } public String addVod(VodDictDO vodDictDO) { + + //排序 + int orderNo = 1; + + List vodDictDOS = this.baseMapper.selectList(new QueryWrapper() + .lambda() + .eq(VodDictDO::getContentId,vodDictDO.getContentId()) + .orderByDesc(VodDictDO::getOrderNo)); + + if (vodDictDOS.size()>0){ + VodDictDO vodDictDO1 = vodDictDOS.get(0); + if (null!=vodDictDO1){ + orderNo = vodDictDOS.get(0).getOrderNo()+1; + } + } + vodDictDO.setOrderNo(orderNo); this.baseMapper.insert(vodDictDO); //测试环境就不转码了 diff --git a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java index 7d70fb4..c40e517 100644 --- a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java @@ -2,6 +2,7 @@ package com.subsidy.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.subsidy.common.exception.HttpException; import com.subsidy.dto.vod.FixDataTwoDTO; import com.subsidy.dto.vod.RemainSecondsDTO; import com.subsidy.dto.vod.SignDatePlaysDTO; @@ -51,13 +52,49 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl() + .lambda() + .eq(ClassHourDictDO::getCompanyId,memberDO.getCompanyId())); + + if (classHourDictDO.getStatus() == 1) { + //查看当天这个人看了多少时间 + Integer total = vodPlayHistoryMapper.memberDailyStudyLength(memberDO.getId()); + + //是否超过时长 没超过 false 超过 true + if (total + vodPlayHistoryDO.getPlayLength() >= classHourDictDO.getClassHour() * 3600) { + throw new HttpException(13001); + } + } vodPlayHistoryDO.setPlayCount(1); this.baseMapper.insert(vodPlayHistoryDO); return ConstantUtils.ADD_SUCCESS; } public String insertHistoryNew(VodPlayHistoryDO vodPlayHistoryDO) { + MemberDO memberDO = memberMapper.selectById(vodPlayHistoryDO.getMemberId()); + //查看系统设定的时长 + ClassHourDictDO classHourDictDO = classHourDictMapper.selectOne (new QueryWrapper() + .lambda() + .eq(ClassHourDictDO::getCompanyId,memberDO.getCompanyId())); + + if (classHourDictDO.getStatus() == 1) { + //查看当天这个人看了多少时间 + Integer total = vodPlayHistoryMapper.memberDailyStudyLength(memberDO.getId()); + + //是否超过时长 没超过 false 超过 true + if (total + vodPlayHistoryDO.getPlayLength() >= classHourDictDO.getClassHour() * 3600) { + throw new HttpException(13001); + } + } vodPlayHistoryDO.setPlayCount(1); this.baseMapper.insert(vodPlayHistoryDO); return ConstantUtils.ADD_SUCCESS; diff --git a/src/main/java/com/subsidy/util/RedisUtil.java b/src/main/java/com/subsidy/util/RedisUtil.java index 6ca603e..118f178 100644 --- a/src/main/java/com/subsidy/util/RedisUtil.java +++ b/src/main/java/com/subsidy/util/RedisUtil.java @@ -1,633 +1,633 @@ -package com.subsidy.util; - -import com.google.common.collect.Sets; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.connection.jedis.JedisConnection; -import org.springframework.data.redis.core.BoundListOperations; -import org.springframework.data.redis.core.Cursor; -import org.springframework.data.redis.core.RedisCallback; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.data.redis.core.ScanOptions; -import org.springframework.data.redis.serializer.RedisSerializer; -import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import redis.clients.jedis.ScanParams; -import redis.clients.jedis.commands.JedisCommands; -import redis.clients.jedis.commands.MultiKeyCommands; - -import javax.annotation.Resource; -import java.io.Serializable; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.TimeUnit; - -/** - *

- * redisTemplate封装 - *

- * - * @author DengMin - * @since 2020/12/17 - */ - -@Component -public class RedisUtil { - - - @Autowired - private RedisTemplate redisTemplate; - - public RedisUtil(RedisTemplate redisTemplate) { - this.redisTemplate = redisTemplate; - } - - /** - * 指定缓存失效时间 - * @param key 键 - * @param time 时间(秒) - * @return - */ - public boolean expire(String key,long time){ - try { - if(time>0){ - redisTemplate.expire(key, time, TimeUnit.SECONDS); - } - return true; - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - - /** - * 根据key 获取过期时间 - * @param key 键 不能为null - * @return 时间(秒) 返回0代表为永久有效 - */ - public long getExpire(String key){ - return redisTemplate.getExpire(key,TimeUnit.SECONDS); - } - - /** - * 判断key是否存在 - * @param key 键 - * @return true 存在 false不存在 - */ - public boolean hasKey(String key){ - try { - return redisTemplate.hasKey(key); - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - - /** - * 删除缓存 - * @param key 可以传一个值 或多个 - */ - @SuppressWarnings("unchecked") - public void del(String ... key){ - if(key!=null&&key.length>0){ - if(key.length==1){ - redisTemplate.delete(key[0]); - }else{ - redisTemplate.delete(CollectionUtils.arrayToList(key)); - } - } - } - - /** - * 删除缓存 - * @param key 集合数据 - */ - public void del(Set key) { - if (key != null && key.size() > 0) { - redisTemplate.delete(key); - } - } - - //============================String============================= - /** - * 普通缓存获取 - * @param key 键 - * @return 值 - */ - public Object get(String key){ - return key==null?null:redisTemplate.opsForValue().get(key); - } - - /** - * 普通缓存放入 - * @param key 键 - * @param value 值 - * @return true成功 false失败 - */ - public boolean set(String key,Object value) { - try { - redisTemplate.opsForValue().set(key, value); - return true; - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - - /** - * 普通缓存放入并设置时间 - * @param key 键 - * @param value 值 - * @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期 - * @return true成功 false 失败 - */ - public boolean set(String key,Object value,long time){ - try { - if(time>0){ - redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS); - }else{ - set(key, value); - } - return true; - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - - /** - * 递增 - * @param key 键 - * @param delta 要增加几(大于0) - * @return - */ - public long incr(String key, long delta){ - if(delta<0){ - throw new RuntimeException("递增因子必须大于0"); - } - return redisTemplate.opsForValue().increment(key, delta); - } - - /** - * 递减 - * @param key 键 - * @param delta 要减少几(小于0) - * @return - */ - public long decr(String key, long delta){ - if(delta<0){ - throw new RuntimeException("递减因子必须大于0"); - } - return redisTemplate.opsForValue().increment(key, -delta); - } - - //================================Map================================= - /** - * HashGet - * @param key 键 不能为null - * @param item 项 不能为null - * @return 值 - */ - public Object hget(String key,String item){ - return redisTemplate.opsForHash().get(key, item); - } - - /** - * 获取hashKey对应的所有键值 - * @param key 键 - * @return 对应的多个键值 - */ - public Map hmget(String key){ - return redisTemplate.opsForHash().entries(key); - } - - /** - * HashSet - * @param key 键 - * @param map 对应多个键值 - * @return true 成功 false 失败 - */ - public boolean hmset(String key, Map map){ - try { - redisTemplate.opsForHash().putAll(key, map); - return true; - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - - /** - * HashSet 并设置时间 - * @param key 键 - * @param map 对应多个键值 - * @param time 时间(秒) - * @return true成功 false失败 - */ - public boolean hmset(String key, Map map, long time){ - try { - redisTemplate.opsForHash().putAll(key, map); - if(time>0){ - expire(key, time); - } - return true; - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - - /** - * 向一张hash表中放入数据,如果不存在将创建 - * @param key 键 - * @param item 项 - * @param value 值 - * @return true 成功 false失败 - */ - public boolean hset(String key,String item,Object value) { - try { - redisTemplate.opsForHash().put(key, item, value); - return true; - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - - /** - * 向一张hash表中放入数据,如果不存在将创建 - * @param key 键 - * @param item 项 - * @param value 值 - * @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间 - * @return true 成功 false失败 - */ - public boolean hset(String key,String item,Object value,long time) { - try { - redisTemplate.opsForHash().put(key, item, value); - if(time>0){ - expire(key, time); - } - return true; - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - - /** - * 删除hash表中的值 - * @param key 键 不能为null - * @param item 项 可以使多个 不能为null - */ - public void hdel(String key, Object... item){ - redisTemplate.opsForHash().delete(key,item); - } - - /** - * 判断hash表中是否有该项的值 - * @param key 键 不能为null - * @param item 项 不能为null - * @return true 存在 false不存在 - */ - public boolean hHasKey(String key, String item){ - return redisTemplate.opsForHash().hasKey(key, item); - } - - /** - * hash递增 如果不存在,就会创建一个 并把新增后的值返回 - * @param key 键 - * @param item 项 - * @param by 要增加几(大于0) - * @return - */ - public double hincr(String key, String item,double by){ - return redisTemplate.opsForHash().increment(key, item, by); - } - - /** - * hash递减 - * @param key 键 - * @param item 项 - * @param by 要减少记(小于0) - * @return - */ - public double hdecr(String key, String item,double by){ - return redisTemplate.opsForHash().increment(key, item,-by); - } - - //============================set============================= - /** - * 根据key获取Set中的所有值 - * @param key 键 - * @return - */ - public Set sGet(String key){ - try { - return redisTemplate.opsForSet().members(key); - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } - - /** - * 根据value从一个set中查询,是否存在 - * @param key 键 - * @param value 值 - * @return true 存在 false不存在 - */ - public boolean sHasKey(String key,Object value){ - try { - return redisTemplate.opsForSet().isMember(key, value); - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - - /** - * 将数据放入set缓存 - * @param key 键 - * @param values 值 可以是多个 - * @return 成功个数 - */ - public long sSet(String key, Object...values) { - try { - return redisTemplate.opsForSet().add(key, values); - } catch (Exception e) { - e.printStackTrace(); - return 0; - } - } - - /** - * 将set数据放入缓存 - * @param key 键 - * @param time 时间(秒) - * @param values 值 可以是多个 - * @return 成功个数 - */ - public long sSetAndTime(String key,long time,Object...values) { - try { - Long count = redisTemplate.opsForSet().add(key, values); - if(time>0) { - expire(key, time); - } - return count; - } catch (Exception e) { - e.printStackTrace(); - return 0; - } - } - - /** - * 获取set缓存的长度 - * @param key 键 - * @return - */ - public long sGetSetSize(String key){ - try { - return redisTemplate.opsForSet().size(key); - } catch (Exception e) { - e.printStackTrace(); - return 0; - } - } - - /** - * 移除值为value的 - * @param key 键 - * @param values 值 可以是多个 - * @return 移除的个数 - */ - public long setRemove(String key, Object ...values) { - try { - Long count = redisTemplate.opsForSet().remove(key, values); - return count; - } catch (Exception e) { - e.printStackTrace(); - return 0; - } - } - //===============================list================================= - - /** - * 获取list缓存的内容 - * @param key 键 - * @param start 开始 - * @param end 结束 0 到 -1代表所有值 - * @return - */ - public List lGet(String key, long start, long end){ - try { - return redisTemplate.opsForList().range(key, start, end); - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } - - /** - * 获取list缓存的长度 - * @param key 键 - * @return - */ - public long lGetListSize(String key){ - try { - return redisTemplate.opsForList().size(key); - } catch (Exception e) { - e.printStackTrace(); - return 0; - } - } - - /** - * 通过索引 获取list中的值 - * @param key 键 - * @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推 - * @return - */ - public Object lGetIndex(String key,long index){ - try { - return redisTemplate.opsForList().index(key, index); - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } - - /** - * 将list放入缓存 - * @param key 键 - * @param value 值 - * @return - */ - public boolean lSet(String key, Object value) { - try { - redisTemplate.opsForList().rightPush(key, value); - return true; - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - - /** - * 将list放入缓存 - * @param key 键 - * @param value 值 - * @param time 时间(秒) - * @return - */ - public boolean lSet(String key, Object value, long time) { - try { - redisTemplate.opsForList().rightPush(key, value); - if (time > 0) { - expire(key, time); - } - return true; - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - - /** - * 将list放入缓存 - * @param key 键 - * @param value 值 - * @return - */ - public boolean lSet(String key, List value) { - try { - redisTemplate.opsForList().rightPushAll(key, value); - return true; - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - - /** - * 将list放入缓存 - * @param key 键 - * @param value 值 - * @param time 时间(秒) - * @return - */ - public boolean lSet(String key, List value, long time) { - try { - redisTemplate.opsForList().rightPushAll(key, value); - if (time > 0) { - expire(key, time); - } - return true; - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - - /** - * 根据索引修改list中的某条数据 - * @param key 键 - * @param index 索引 - * @param value 值 - * @return - */ - public boolean lUpdateIndex(String key, long index,Object value) { - try { - redisTemplate.opsForList().set(key, index, value); - return true; - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - - /** - * 移除N个值为value - * @param key 键 - * @param count 移除多少个 - * @param value 值 - * @return 移除的个数 - */ - public long lRemove(String key,long count,Object value) { - try { - Long remove = redisTemplate.opsForList().remove(key, count, value); - return remove; - } catch (Exception e) { - e.printStackTrace(); - return 0; - } - } - - ///** - // * 模糊查询获取key值 - // * @param pattern - // * @return - // */ - public Set keys(String pattern){ - return redisTemplate.keys(pattern); - } - - /** - * 模糊查询 - * @param pattern - * @return - */ - public Set scan(String pattern) { - return redisTemplate.execute((RedisCallback>) redisConnection -> { - Set keys = new HashSet<>(); - Cursor cursor = redisConnection.scan(new ScanOptions.ScanOptionsBuilder().match(pattern).count(Integer.MAX_VALUE).build()); - while (cursor.hasNext()) { - keys.add(new String(cursor.next())); - } - return keys; - }); - } - - /** - * 使用Redis的消息队列 - * @param channel - * @param message 消息内容 - */ - public void convertAndSend(String channel, Object message){ - redisTemplate.convertAndSend(channel,message); - } - - - //=========BoundListOperations 用法 start============ - - - /** - * 根据起始结束序号遍历Redis中的list - * @param listKey - * @param start 起始序号 - * @param end 结束序号 - * @return - */ - public List rangeList(String listKey, long start, long end) { - //绑定操作 - BoundListOperations boundValueOperations = redisTemplate.boundListOps(listKey); - //查询数据 - return boundValueOperations.range(start, end); - } - /** - * 弹出右边的值 --- 并且移除这个值 - * @param listKey - */ - public Object rifhtPop(String listKey){ - //绑定操作 - BoundListOperations boundValueOperations = redisTemplate.boundListOps(listKey); - return boundValueOperations.rightPop(); - } - - //=========BoundListOperations 用法 End============ - -} \ No newline at end of file +//package com.subsidy.util; +// +//import com.google.common.collect.Sets; +//import lombok.extern.slf4j.Slf4j; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.data.redis.connection.jedis.JedisConnection; +//import org.springframework.data.redis.core.BoundListOperations; +//import org.springframework.data.redis.core.Cursor; +//import org.springframework.data.redis.core.RedisCallback; +//import org.springframework.data.redis.core.RedisTemplate; +//import org.springframework.data.redis.core.ScanOptions; +//import org.springframework.data.redis.serializer.RedisSerializer; +//import org.springframework.stereotype.Component; +//import org.springframework.util.CollectionUtils; +//import org.springframework.web.bind.annotation.RequestMapping; +//import org.springframework.web.bind.annotation.RestController; +//import redis.clients.jedis.ScanParams; +//import redis.clients.jedis.commands.JedisCommands; +//import redis.clients.jedis.commands.MultiKeyCommands; +// +//import javax.annotation.Resource; +//import java.io.Serializable; +//import java.util.HashSet; +//import java.util.List; +//import java.util.Map; +//import java.util.Set; +//import java.util.concurrent.TimeUnit; +// +///** +// *

+// * redisTemplate封装 +// *

+// * +// * @author DengMin +// * @since 2020/12/17 +// */ +// +//@Component +//public class RedisUtil { +// +// +// @Autowired +// private RedisTemplate redisTemplate; +// +// public RedisUtil(RedisTemplate redisTemplate) { +// this.redisTemplate = redisTemplate; +// } +// +// /** +// * 指定缓存失效时间 +// * @param key 键 +// * @param time 时间(秒) +// * @return +// */ +// public boolean expire(String key,long time){ +// try { +// if(time>0){ +// redisTemplate.expire(key, time, TimeUnit.SECONDS); +// } +// return true; +// } catch (Exception e) { +// e.printStackTrace(); +// return false; +// } +// } +// +// /** +// * 根据key 获取过期时间 +// * @param key 键 不能为null +// * @return 时间(秒) 返回0代表为永久有效 +// */ +// public long getExpire(String key){ +// return redisTemplate.getExpire(key,TimeUnit.SECONDS); +// } +// +// /** +// * 判断key是否存在 +// * @param key 键 +// * @return true 存在 false不存在 +// */ +// public boolean hasKey(String key){ +// try { +// return redisTemplate.hasKey(key); +// } catch (Exception e) { +// e.printStackTrace(); +// return false; +// } +// } +// +// /** +// * 删除缓存 +// * @param key 可以传一个值 或多个 +// */ +// @SuppressWarnings("unchecked") +// public void del(String ... key){ +// if(key!=null&&key.length>0){ +// if(key.length==1){ +// redisTemplate.delete(key[0]); +// }else{ +// redisTemplate.delete(CollectionUtils.arrayToList(key)); +// } +// } +// } +// +// /** +// * 删除缓存 +// * @param key 集合数据 +// */ +// public void del(Set key) { +// if (key != null && key.size() > 0) { +// redisTemplate.delete(key); +// } +// } +// +// //============================String============================= +// /** +// * 普通缓存获取 +// * @param key 键 +// * @return 值 +// */ +// public Object get(String key){ +// return key==null?null:redisTemplate.opsForValue().get(key); +// } +// +// /** +// * 普通缓存放入 +// * @param key 键 +// * @param value 值 +// * @return true成功 false失败 +// */ +// public boolean set(String key,Object value) { +// try { +// redisTemplate.opsForValue().set(key, value); +// return true; +// } catch (Exception e) { +// e.printStackTrace(); +// return false; +// } +// } +// +// /** +// * 普通缓存放入并设置时间 +// * @param key 键 +// * @param value 值 +// * @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期 +// * @return true成功 false 失败 +// */ +// public boolean set(String key,Object value,long time){ +// try { +// if(time>0){ +// redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS); +// }else{ +// set(key, value); +// } +// return true; +// } catch (Exception e) { +// e.printStackTrace(); +// return false; +// } +// } +// +// /** +// * 递增 +// * @param key 键 +// * @param delta 要增加几(大于0) +// * @return +// */ +// public long incr(String key, long delta){ +// if(delta<0){ +// throw new RuntimeException("递增因子必须大于0"); +// } +// return redisTemplate.opsForValue().increment(key, delta); +// } +// +// /** +// * 递减 +// * @param key 键 +// * @param delta 要减少几(小于0) +// * @return +// */ +// public long decr(String key, long delta){ +// if(delta<0){ +// throw new RuntimeException("递减因子必须大于0"); +// } +// return redisTemplate.opsForValue().increment(key, -delta); +// } +// +// //================================Map================================= +// /** +// * HashGet +// * @param key 键 不能为null +// * @param item 项 不能为null +// * @return 值 +// */ +// public Object hget(String key,String item){ +// return redisTemplate.opsForHash().get(key, item); +// } +// +// /** +// * 获取hashKey对应的所有键值 +// * @param key 键 +// * @return 对应的多个键值 +// */ +// public Map hmget(String key){ +// return redisTemplate.opsForHash().entries(key); +// } +// +// /** +// * HashSet +// * @param key 键 +// * @param map 对应多个键值 +// * @return true 成功 false 失败 +// */ +// public boolean hmset(String key, Map map){ +// try { +// redisTemplate.opsForHash().putAll(key, map); +// return true; +// } catch (Exception e) { +// e.printStackTrace(); +// return false; +// } +// } +// +// /** +// * HashSet 并设置时间 +// * @param key 键 +// * @param map 对应多个键值 +// * @param time 时间(秒) +// * @return true成功 false失败 +// */ +// public boolean hmset(String key, Map map, long time){ +// try { +// redisTemplate.opsForHash().putAll(key, map); +// if(time>0){ +// expire(key, time); +// } +// return true; +// } catch (Exception e) { +// e.printStackTrace(); +// return false; +// } +// } +// +// /** +// * 向一张hash表中放入数据,如果不存在将创建 +// * @param key 键 +// * @param item 项 +// * @param value 值 +// * @return true 成功 false失败 +// */ +// public boolean hset(String key,String item,Object value) { +// try { +// redisTemplate.opsForHash().put(key, item, value); +// return true; +// } catch (Exception e) { +// e.printStackTrace(); +// return false; +// } +// } +// +// /** +// * 向一张hash表中放入数据,如果不存在将创建 +// * @param key 键 +// * @param item 项 +// * @param value 值 +// * @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间 +// * @return true 成功 false失败 +// */ +// public boolean hset(String key,String item,Object value,long time) { +// try { +// redisTemplate.opsForHash().put(key, item, value); +// if(time>0){ +// expire(key, time); +// } +// return true; +// } catch (Exception e) { +// e.printStackTrace(); +// return false; +// } +// } +// +// /** +// * 删除hash表中的值 +// * @param key 键 不能为null +// * @param item 项 可以使多个 不能为null +// */ +// public void hdel(String key, Object... item){ +// redisTemplate.opsForHash().delete(key,item); +// } +// +// /** +// * 判断hash表中是否有该项的值 +// * @param key 键 不能为null +// * @param item 项 不能为null +// * @return true 存在 false不存在 +// */ +// public boolean hHasKey(String key, String item){ +// return redisTemplate.opsForHash().hasKey(key, item); +// } +// +// /** +// * hash递增 如果不存在,就会创建一个 并把新增后的值返回 +// * @param key 键 +// * @param item 项 +// * @param by 要增加几(大于0) +// * @return +// */ +// public double hincr(String key, String item,double by){ +// return redisTemplate.opsForHash().increment(key, item, by); +// } +// +// /** +// * hash递减 +// * @param key 键 +// * @param item 项 +// * @param by 要减少记(小于0) +// * @return +// */ +// public double hdecr(String key, String item,double by){ +// return redisTemplate.opsForHash().increment(key, item,-by); +// } +// +// //============================set============================= +// /** +// * 根据key获取Set中的所有值 +// * @param key 键 +// * @return +// */ +// public Set sGet(String key){ +// try { +// return redisTemplate.opsForSet().members(key); +// } catch (Exception e) { +// e.printStackTrace(); +// return null; +// } +// } +// +// /** +// * 根据value从一个set中查询,是否存在 +// * @param key 键 +// * @param value 值 +// * @return true 存在 false不存在 +// */ +// public boolean sHasKey(String key,Object value){ +// try { +// return redisTemplate.opsForSet().isMember(key, value); +// } catch (Exception e) { +// e.printStackTrace(); +// return false; +// } +// } +// +// /** +// * 将数据放入set缓存 +// * @param key 键 +// * @param values 值 可以是多个 +// * @return 成功个数 +// */ +// public long sSet(String key, Object...values) { +// try { +// return redisTemplate.opsForSet().add(key, values); +// } catch (Exception e) { +// e.printStackTrace(); +// return 0; +// } +// } +// +// /** +// * 将set数据放入缓存 +// * @param key 键 +// * @param time 时间(秒) +// * @param values 值 可以是多个 +// * @return 成功个数 +// */ +// public long sSetAndTime(String key,long time,Object...values) { +// try { +// Long count = redisTemplate.opsForSet().add(key, values); +// if(time>0) { +// expire(key, time); +// } +// return count; +// } catch (Exception e) { +// e.printStackTrace(); +// return 0; +// } +// } +// +// /** +// * 获取set缓存的长度 +// * @param key 键 +// * @return +// */ +// public long sGetSetSize(String key){ +// try { +// return redisTemplate.opsForSet().size(key); +// } catch (Exception e) { +// e.printStackTrace(); +// return 0; +// } +// } +// +// /** +// * 移除值为value的 +// * @param key 键 +// * @param values 值 可以是多个 +// * @return 移除的个数 +// */ +// public long setRemove(String key, Object ...values) { +// try { +// Long count = redisTemplate.opsForSet().remove(key, values); +// return count; +// } catch (Exception e) { +// e.printStackTrace(); +// return 0; +// } +// } +// //===============================list================================= +// +// /** +// * 获取list缓存的内容 +// * @param key 键 +// * @param start 开始 +// * @param end 结束 0 到 -1代表所有值 +// * @return +// */ +// public List lGet(String key, long start, long end){ +// try { +// return redisTemplate.opsForList().range(key, start, end); +// } catch (Exception e) { +// e.printStackTrace(); +// return null; +// } +// } +// +// /** +// * 获取list缓存的长度 +// * @param key 键 +// * @return +// */ +// public long lGetListSize(String key){ +// try { +// return redisTemplate.opsForList().size(key); +// } catch (Exception e) { +// e.printStackTrace(); +// return 0; +// } +// } +// +// /** +// * 通过索引 获取list中的值 +// * @param key 键 +// * @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推 +// * @return +// */ +// public Object lGetIndex(String key,long index){ +// try { +// return redisTemplate.opsForList().index(key, index); +// } catch (Exception e) { +// e.printStackTrace(); +// return null; +// } +// } +// +// /** +// * 将list放入缓存 +// * @param key 键 +// * @param value 值 +// * @return +// */ +// public boolean lSet(String key, Object value) { +// try { +// redisTemplate.opsForList().rightPush(key, value); +// return true; +// } catch (Exception e) { +// e.printStackTrace(); +// return false; +// } +// } +// +// /** +// * 将list放入缓存 +// * @param key 键 +// * @param value 值 +// * @param time 时间(秒) +// * @return +// */ +// public boolean lSet(String key, Object value, long time) { +// try { +// redisTemplate.opsForList().rightPush(key, value); +// if (time > 0) { +// expire(key, time); +// } +// return true; +// } catch (Exception e) { +// e.printStackTrace(); +// return false; +// } +// } +// +// /** +// * 将list放入缓存 +// * @param key 键 +// * @param value 值 +// * @return +// */ +// public boolean lSet(String key, List value) { +// try { +// redisTemplate.opsForList().rightPushAll(key, value); +// return true; +// } catch (Exception e) { +// e.printStackTrace(); +// return false; +// } +// } +// +// /** +// * 将list放入缓存 +// * @param key 键 +// * @param value 值 +// * @param time 时间(秒) +// * @return +// */ +// public boolean lSet(String key, List value, long time) { +// try { +// redisTemplate.opsForList().rightPushAll(key, value); +// if (time > 0) { +// expire(key, time); +// } +// return true; +// } catch (Exception e) { +// e.printStackTrace(); +// return false; +// } +// } +// +// /** +// * 根据索引修改list中的某条数据 +// * @param key 键 +// * @param index 索引 +// * @param value 值 +// * @return +// */ +// public boolean lUpdateIndex(String key, long index,Object value) { +// try { +// redisTemplate.opsForList().set(key, index, value); +// return true; +// } catch (Exception e) { +// e.printStackTrace(); +// return false; +// } +// } +// +// /** +// * 移除N个值为value +// * @param key 键 +// * @param count 移除多少个 +// * @param value 值 +// * @return 移除的个数 +// */ +// public long lRemove(String key,long count,Object value) { +// try { +// Long remove = redisTemplate.opsForList().remove(key, count, value); +// return remove; +// } catch (Exception e) { +// e.printStackTrace(); +// return 0; +// } +// } +// +// ///** +// // * 模糊查询获取key值 +// // * @param pattern +// // * @return +// // */ +// public Set keys(String pattern){ +// return redisTemplate.keys(pattern); +// } +// +// /** +// * 模糊查询 +// * @param pattern +// * @return +// */ +// public Set scan(String pattern) { +// return redisTemplate.execute((RedisCallback>) redisConnection -> { +// Set keys = new HashSet<>(); +// Cursor cursor = redisConnection.scan(new ScanOptions.ScanOptionsBuilder().match(pattern).count(Integer.MAX_VALUE).build()); +// while (cursor.hasNext()) { +// keys.add(new String(cursor.next())); +// } +// return keys; +// }); +// } +// +// /** +// * 使用Redis的消息队列 +// * @param channel +// * @param message 消息内容 +// */ +// public void convertAndSend(String channel, Object message){ +// redisTemplate.convertAndSend(channel,message); +// } +// +// +// //=========BoundListOperations 用法 start============ +// +// +// /** +// * 根据起始结束序号遍历Redis中的list +// * @param listKey +// * @param start 起始序号 +// * @param end 结束序号 +// * @return +// */ +// public List rangeList(String listKey, long start, long end) { +// //绑定操作 +// BoundListOperations boundValueOperations = redisTemplate.boundListOps(listKey); +// //查询数据 +// return boundValueOperations.range(start, end); +// } +// /** +// * 弹出右边的值 --- 并且移除这个值 +// * @param listKey +// */ +// public Object rifhtPop(String listKey){ +// //绑定操作 +// BoundListOperations boundValueOperations = redisTemplate.boundListOps(listKey); +// return boundValueOperations.rightPop(); +// } +// +// //=========BoundListOperations 用法 End============ +// +//} \ No newline at end of file diff --git a/src/main/java/com/subsidy/vo/administer/UserRoleVO.java b/src/main/java/com/subsidy/vo/administer/UserRoleVO.java index 6e2a9f5..b21bc08 100644 --- a/src/main/java/com/subsidy/vo/administer/UserRoleVO.java +++ b/src/main/java/com/subsidy/vo/administer/UserRoleVO.java @@ -1,7 +1,10 @@ package com.subsidy.vo.administer; +import com.subsidy.model.RotationImgDictDO; import lombok.Data; +import java.util.List; + @Data public class UserRoleVO { @@ -21,4 +24,10 @@ public class UserRoleVO { private String companyName; + private Long companyId; + + private String logo; + + private List rotationImgDictDOS; + } diff --git a/src/main/java/com/subsidy/vo/classdict/ClassAndCompanyInfoVO.java b/src/main/java/com/subsidy/vo/classdict/ClassAndCompanyInfoVO.java new file mode 100644 index 0000000..32fbc29 --- /dev/null +++ b/src/main/java/com/subsidy/vo/classdict/ClassAndCompanyInfoVO.java @@ -0,0 +1,17 @@ +package com.subsidy.vo.classdict; + +import lombok.Data; + +@Data +public class ClassAndCompanyInfoVO { + + private String company; + + private String name; + + private String courseName; + + private String startDate; + + private String endDate; +} diff --git a/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java b/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java index b3a19d6..b2aab3d 100644 --- a/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java +++ b/src/main/java/com/subsidy/vo/classdict/ClassDetailVO.java @@ -34,7 +34,7 @@ public class ClassDetailVO{ * 签到次数 */ @ExcelColumn(col = 6,value = "签到次数") - private Long signCounts; + private Integer signCounts; /** * 已看视频 diff --git a/src/main/java/com/subsidy/vo/classdict/GetClassBaseInfoVO.java b/src/main/java/com/subsidy/vo/classdict/GetClassBaseInfoVO.java index 14b0642..cd6d309 100644 --- a/src/main/java/com/subsidy/vo/classdict/GetClassBaseInfoVO.java +++ b/src/main/java/com/subsidy/vo/classdict/GetClassBaseInfoVO.java @@ -21,4 +21,12 @@ public class GetClassBaseInfoVO { private Long classTypeId; + private Integer isOrder; + + private Integer isFastPlay; + + private Integer testRule; + + private Boolean testFlag; + } diff --git a/src/main/java/com/subsidy/vo/classdict/GetSettingVO.java b/src/main/java/com/subsidy/vo/classdict/GetSettingVO.java new file mode 100644 index 0000000..4dd97a0 --- /dev/null +++ b/src/main/java/com/subsidy/vo/classdict/GetSettingVO.java @@ -0,0 +1,16 @@ +package com.subsidy.vo.classdict; + +import com.subsidy.model.ClassHourDictDO; +import com.subsidy.model.RotationImgDictDO; +import lombok.Data; + +import java.util.List; + +@Data +public class GetSettingVO extends ClassHourDictDO { + + private List rotationImgDictDOS; + + private String logo; + +} diff --git a/src/main/java/com/subsidy/vo/course/QueryCoursesVO.java b/src/main/java/com/subsidy/vo/course/QueryCoursesVO.java index 2f20fbd..575819e 100644 --- a/src/main/java/com/subsidy/vo/course/QueryCoursesVO.java +++ b/src/main/java/com/subsidy/vo/course/QueryCoursesVO.java @@ -46,6 +46,11 @@ public class QueryCoursesVO { private Integer vodCounts; /** + * 备注 + */ + private String remark; + + /** * 测试数量 */ private Integer paperCount; diff --git a/src/main/java/com/subsidy/vo/department/GetMembersVO.java b/src/main/java/com/subsidy/vo/department/GetMembersVO.java new file mode 100644 index 0000000..9c70059 --- /dev/null +++ b/src/main/java/com/subsidy/vo/department/GetMembersVO.java @@ -0,0 +1,35 @@ +package com.subsidy.vo.department; + +import com.subsidy.model.AdministerDO; +import com.subsidy.model.MemberDO; +import lombok.Data; + +import java.util.List; + +@Data +public class GetMembersVO { + + private Long id; + + private String departmentName; + + private Long parentId; + + private String parentDepartmentName; + + private Long administerId; + + private String userName; + + private String img; + + private List memberDOS; + + //private List administerDepartmentMappingDOS; + + private List children; + + + + +} diff --git a/src/main/java/com/subsidy/vo/member/GetAllVO.java b/src/main/java/com/subsidy/vo/member/GetAllVO.java index 73f78fe..712e9b1 100644 --- a/src/main/java/com/subsidy/vo/member/GetAllVO.java +++ b/src/main/java/com/subsidy/vo/member/GetAllVO.java @@ -2,11 +2,13 @@ package com.subsidy.vo.member; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; import com.subsidy.model.DepartmentDictDO; import com.subsidy.model.JobDictDO; import com.subsidy.model.MemberDO; import lombok.Data; +import java.util.Date; import java.util.List; @Data @@ -28,6 +30,13 @@ public class GetAllVO { private String status; + private String email; + + private String workNo; + + //@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") + private String inductionDate; + private List departmentDictDOS; private List jobDictDOS; diff --git a/src/main/java/com/subsidy/vo/member/MemberVO.java b/src/main/java/com/subsidy/vo/member/MemberVO.java index c0ca4d9..a193b84 100644 --- a/src/main/java/com/subsidy/vo/member/MemberVO.java +++ b/src/main/java/com/subsidy/vo/member/MemberVO.java @@ -1,7 +1,10 @@ package com.subsidy.vo.member; +import com.subsidy.model.RotationImgDictDO; import lombok.Data; +import java.util.List; + @Data public class MemberVO { @@ -18,4 +21,10 @@ public class MemberVO { private Integer firstLogin; private String companyName; + + private Long companyId; + + private String logo; + + private List rotationImgDictDOS; } diff --git a/src/main/java/com/subsidy/vo/member/MyCoursesVO.java b/src/main/java/com/subsidy/vo/member/MyCoursesVO.java index 63eea18..1b5acee 100644 --- a/src/main/java/com/subsidy/vo/member/MyCoursesVO.java +++ b/src/main/java/com/subsidy/vo/member/MyCoursesVO.java @@ -26,5 +26,9 @@ public class MyCoursesVO { private Integer ttlMember; + private Integer isOrder; + + private Integer isFastPlay; + private List fieldDictDOS; } diff --git a/src/main/resources/code.properties b/src/main/resources/code.properties index 478c33e..99b7c12 100644 --- a/src/main/resources/code.properties +++ b/src/main/resources/code.properties @@ -50,3 +50,7 @@ meishu.code-message[70002]=定时任务创建失败 meishu.code-message[70003]=定时任务删除失败 meishu.code-message[12001]=该职级已存在 + +meishu.code-message[13001]=已达到当日最大时长 + + diff --git a/src/main/resources/mapper/ClassDictMapper.xml b/src/main/resources/mapper/ClassDictMapper.xml index f50fdbe..12bb5da 100644 --- a/src/main/resources/mapper/ClassDictMapper.xml +++ b/src/main/resources/mapper/ClassDictMapper.xml @@ -133,7 +133,10 @@ t.end_date, ifnull( t4.cnt, 0 ) AS count, t2.id as courseId, - t3.id as classTypeId + t3.id as classTypeId, + t.is_order, + t.is_fast_play, + t.test_rule FROM class_dict t LEFT JOIN course_dict t2 ON t.course_id = t2.id @@ -145,4 +148,22 @@ AND t3.delete_date IS NULL AND t.id = #{classId} + + diff --git a/src/main/resources/mapper/CompanyDictMapper.xml b/src/main/resources/mapper/CompanyDictMapper.xml index f39635c..1fe08f4 100644 --- a/src/main/resources/mapper/CompanyDictMapper.xml +++ b/src/main/resources/mapper/CompanyDictMapper.xml @@ -21,7 +21,7 @@ @@ -170,7 +172,10 @@ t2.telephone, t2.gender, t2.id_card, - t2.status + t2.status, + t2.email, + t2.work_no, + t2.induction_date FROM member_department_mapping t LEFT JOIN member t2 ON t.member_id = t2.id @@ -184,8 +189,79 @@ and t2.status = #{status} + + and DATE_FORMAT(t2.induction_date ,'%Y-%m-%d')>=DATE_FORMAT(#{startDate}, '%Y-%m-%d') + + + and DATE_FORMAT(t2.induction_date ,'%Y-%m-%d') <= DATE_FORMAT(#{endDate}, '%Y-%m-%d') + + + + @@ -239,29 +315,11 @@ m.* FROM member m - LEFT JOIN class_member_mapping cmm ON cmm.member_id = m.id - LEFT JOIN ( - SELECT - vph.member_id, - vph.class_id, - vd.vod_length, - IF - ( sum( vph.play_length ) >= vd.vod_length, 1, 0 ) AS ps - FROM - vod_play_history vph - LEFT JOIN vod_dict vd ON vd.id = vph.vod_id - WHERE - vph.delete_date IS NULL - AND vd.delete_date IS NULL - GROUP BY - vod_id, - member_id - ) h ON h.member_id = m.id - AND h.class_id = cmm.class_id + LEFT JOIN class_member_mapping cm ON cm.member_id = m.id + LEFT JOIN ( SELECT member_id, count( 1 ) AS ts FROM exercise_done_result WHERE score >= 60 GROUP BY class_id ) AS r ON r.member_id = m.id WHERE - cmm.class_id = #{classId} - AND h.ps = 0 - GROUP BY - m.id + cm.class_id = #{classId} + AND r.ts is NULL + and m.delete_date is null diff --git a/src/main/resources/mapper/PaperDictMapper.xml b/src/main/resources/mapper/PaperDictMapper.xml index 640b614..a6e33a4 100644 --- a/src/main/resources/mapper/PaperDictMapper.xml +++ b/src/main/resources/mapper/PaperDictMapper.xml @@ -39,7 +39,7 @@ - SELECT count( DISTINCT t.member_id ) AS cnt FROM @@ -47,6 +47,7 @@ WHERE t.delete_date IS NULL AND t.paper_id = #{paperId} + and t.class_id = #{classId} + SELECT + t.* + FROM + administer t + LEFT JOIN role_administer_mapping t2 ON t.id = t2.administer_id + WHERE + t.delete_date IS NULL + AND t2.delete_date IS NULL + AND t.company_id = #{companyId} + AND t2.role_id = 2 + diff --git a/src/main/resources/mapper/RotationImgDictMapper.xml b/src/main/resources/mapper/RotationImgDictMapper.xml new file mode 100644 index 0000000..cf4be5f --- /dev/null +++ b/src/main/resources/mapper/RotationImgDictMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, company_id, rotation_img + + + diff --git a/src/main/resources/mapper/VodDictMapper.xml b/src/main/resources/mapper/VodDictMapper.xml index 1d68a8f..486168a 100644 --- a/src/main/resources/mapper/VodDictMapper.xml +++ b/src/main/resources/mapper/VodDictMapper.xml @@ -49,7 +49,7 @@ and vod_name like concat('%',#{vodName} ,'%') - order by t.order_no + order by t2.order_no,t.order_no SELECT - t.vod_id, - t.member_id, IF ( sum( t.play_length )>= t2.vod_length, 1, 0 ) AS count FROM @@ -236,8 +234,9 @@ SELECT - sum( play_length ) + ifnull(sum( play_length ),0) FROM vod_play_history t WHERE @@ -347,6 +346,7 @@ t.delete_date IS NULL AND t.vod_id = #{vodId} AND t.member_id = #{memberId} + and t.class_id = #{classId}