Commit c06779f7 by 涂亚平

去掉了redis

1 parent 8fab15d4
Showing with 1979 additions and 1052 deletions
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<itext-asian.version>5.2.0</itext-asian.version> <itext-asian.version>5.2.0</itext-asian.version>
<itextpdf.version>5.4.1</itextpdf.version> <itextpdf.version>5.4.1</itextpdf.version>
<java-jwt.version>3.10.3</java-jwt.version> <java-jwt.version>3.10.3</java-jwt.version>
<jedis.version>3.3.0</jedis.version> <!-- <jedis.version>3.3.0</jedis.version>-->
</properties> </properties>
<dependencies> <dependencies>
...@@ -192,21 +192,21 @@ ...@@ -192,21 +192,21 @@
<version>1.0.7</version> <version>1.0.7</version>
</dependency> </dependency>
<dependency> <!-- <dependency>-->
<groupId>org.springframework.boot</groupId> <!-- <groupId>org.springframework.boot</groupId>-->
<artifactId>spring-boot-starter-data-redis</artifactId> <!-- <artifactId>spring-boot-starter-data-redis</artifactId>-->
</dependency> <!-- </dependency>-->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-quartz</artifactId> <artifactId>spring-boot-starter-quartz</artifactId>
</dependency> </dependency>
<dependency> <!-- <dependency>-->
<groupId>redis.clients</groupId> <!-- <groupId>redis.clients</groupId>-->
<artifactId>jedis</artifactId> <!-- <artifactId>jedis</artifactId>-->
<version>${jedis.version}</version> <!-- <version>${jedis.version}</version>-->
</dependency> <!-- </dependency>-->
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>--> <!-- <groupId>org.springframework.boot</groupId>-->
......
package com.subsidy.common.configure; //package com.subsidy.common.configure;
//
import com.fasterxml.jackson.annotation.JsonAutoDetect; //import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor; //import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper; //import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.cache.annotation.CachingConfigurerSupport; //import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching; //import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean; //import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; //import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory; //
import org.springframework.data.redis.core.*; //@EnableCaching
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; //
import org.springframework.data.redis.serializer.StringRedisSerializer; ///**
// * <p>
@EnableCaching // * Redis
// * </p>
/** // *
* <p> // * @author DengMin
* Redis // * @since 2020/12/14
* </p> // */
* //@Configuration
* @author DengMin //public class RedisConfig extends CachingConfigurerSupport {
* @since 2020/12/14 //
*/ // /**
@Configuration // * retemplate相关配置
public class RedisConfig extends CachingConfigurerSupport { // * @param factory
// * @return
/** // */
* retemplate相关配置 // @Bean
* @param factory // public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
* @return //
*/ // RedisTemplate<String, Object> template = new RedisTemplate<>();
@Bean // // 配置连接工厂
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) { // template.setConnectionFactory(factory);
//
RedisTemplate<String, Object> template = new RedisTemplate<>(); // //使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值(默认使用JDK的序列化方式)
// 配置连接工厂 // Jackson2JsonRedisSerializer jacksonSeial = new Jackson2JsonRedisSerializer(Object.class);
template.setConnectionFactory(factory); //
// ObjectMapper om = new ObjectMapper();
//使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值(默认使用JDK的序列化方式) // // 指定要序列化的域,field,get和set,以及修饰符范围,ANY是都有包括private和public
Jackson2JsonRedisSerializer jacksonSeial = new Jackson2JsonRedisSerializer(Object.class); // om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
// // 指定序列化输入的类型,类必须是非final修饰的,final修饰的类,比如String,Integer等会跑出异常
ObjectMapper om = new ObjectMapper(); // om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
// 指定要序列化的域,field,get和set,以及修饰符范围,ANY是都有包括private和public // jacksonSeial.setObjectMapper(om);
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); //
// 指定序列化输入的类型,类必须是非final修饰的,final修饰的类,比如String,Integer等会跑出异常 // // 值采用json序列化
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); // template.setValueSerializer(jacksonSeial);
jacksonSeial.setObjectMapper(om); // //使用StringRedisSerializer来序列化和反序列化redis的key值
// template.setKeySerializer(new StringRedisSerializer());
// 值采用json序列化 //
template.setValueSerializer(jacksonSeial); // // 设置hash key 和value序列化模式
//使用StringRedisSerializer来序列化和反序列化redis的key值 // template.setHashKeySerializer(new StringRedisSerializer());
template.setKeySerializer(new StringRedisSerializer()); // template.setHashValueSerializer(jacksonSeial);
// template.afterPropertiesSet();
// 设置hash key 和value序列化模式 //
template.setHashKeySerializer(new StringRedisSerializer()); // return template;
template.setHashValueSerializer(jacksonSeial); // }
template.afterPropertiesSet(); //
// /**
return template; // * 对hash类型的数据操作
} // *
// * @param redisTemplate
/** // * @return
* 对hash类型的数据操作 // */
* // @Bean
* @param redisTemplate // public HashOperations<String, String, Object> hashOperations(RedisTemplate<String, Object> redisTemplate) {
* @return // return redisTemplate.opsForHash();
*/ // }
@Bean //
public HashOperations<String, String, Object> hashOperations(RedisTemplate<String, Object> redisTemplate) { // /**
return redisTemplate.opsForHash(); // * 对redis字符串类型数据操作
} // *
// * @param redisTemplate
/** // * @return
* 对redis字符串类型数据操作 // */
* // @Bean
* @param redisTemplate // public ValueOperations<String, Object> valueOperations(RedisTemplate<String, Object> redisTemplate) {
* @return // return redisTemplate.opsForValue();
*/ // }
@Bean //
public ValueOperations<String, Object> valueOperations(RedisTemplate<String, Object> redisTemplate) { // /**
return redisTemplate.opsForValue(); // * 对链表类型的数据操作
} // *
// * @param redisTemplate
/** // * @return
* 对链表类型的数据操作 // */
* // @Bean
* @param redisTemplate // public ListOperations<String, Object> listOperations(RedisTemplate<String, Object> redisTemplate) {
* @return // return redisTemplate.opsForList();
*/ // }
@Bean //
public ListOperations<String, Object> listOperations(RedisTemplate<String, Object> redisTemplate) { // /**
return redisTemplate.opsForList(); // * 对无序集合类型的数据操作
} // *
// * @param redisTemplate
/** // * @return
* 对无序集合类型的数据操作 // */
* // @Bean
* @param redisTemplate // public SetOperations<String, Object> setOperations(RedisTemplate<String, Object> redisTemplate) {
* @return // return redisTemplate.opsForSet();
*/ // }
@Bean //
public SetOperations<String, Object> setOperations(RedisTemplate<String, Object> redisTemplate) { // /**
return redisTemplate.opsForSet(); // * 对有序集合类型的数据操作
} // *
// * @param redisTemplate
/** // * @return
* 对有序集合类型的数据操作 // */
* // @Bean
* @param redisTemplate // public ZSetOperations<String, Object> zSetOperations(RedisTemplate<String, Object> redisTemplate) {
* @return // return redisTemplate.opsForZSet();
*/ // }
@Bean //
public ZSetOperations<String, Object> zSetOperations(RedisTemplate<String, Object> redisTemplate) { //
return redisTemplate.opsForZSet(); //}
} \ No newline at end of file
}
\ No newline at end of file
...@@ -63,7 +63,7 @@ public class AdministerController { ...@@ -63,7 +63,7 @@ public class AdministerController {
@PostMapping("/administers") @PostMapping("/administers")
@ApiOperation("查询所有运营者 { userName pageNum pageSize }") @ApiOperation("查询所有运营者 { userName pageNum pageSize }")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO operators(@RequestBody OperatorsDTO operatorsDTO){ public ResponseVO operators(@RequestBody OperatorsDTO operatorsDTO){
return ResponseData.generateCreatedResponse(0,administerService.operators(operatorsDTO)); return ResponseData.generateCreatedResponse(0,administerService.operators(operatorsDTO));
} }
...@@ -125,7 +125,7 @@ public class AdministerController { ...@@ -125,7 +125,7 @@ public class AdministerController {
@PostMapping("exerciseTest") @PostMapping("exerciseTest")
@ApiOperation("班级管理--测评成绩 id 班级id userName paperId") @ApiOperation("班级管理--测评成绩 id 班级id userName paperId")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO exerciseTest(@RequestBody ClassDetailDTO classDetailDTO){ public ResponseVO exerciseTest(@RequestBody ClassDetailDTO classDetailDTO){
return ResponseData.generateCreatedResponse(0,administerService.exerciseTest(classDetailDTO)); return ResponseData.generateCreatedResponse(0,administerService.exerciseTest(classDetailDTO));
} }
...@@ -198,7 +198,7 @@ public class AdministerController { ...@@ -198,7 +198,7 @@ public class AdministerController {
@PostMapping("exportZip") @PostMapping("exportZip")
@ApiOperation("下载压缩包 id 班级id") @ApiOperation("下载压缩包 id 班级id")
@CrossOrigin @CrossOrigin
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public void exportZip(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{ public void exportZip(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{
administerService.export(classDetailDTO); administerService.export(classDetailDTO);
} }
......
...@@ -6,6 +6,7 @@ import com.subsidy.common.ResponseVO; ...@@ -6,6 +6,7 @@ import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired; import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.classDict.AddClassDTO; import com.subsidy.dto.classDict.AddClassDTO;
import com.subsidy.dto.classDict.AddMemberToClassDTO; import com.subsidy.dto.classDict.AddMemberToClassDTO;
import com.subsidy.dto.classDict.GetClassBaseInfoDTO;
import com.subsidy.dto.classDict.GetSpareMembersDTO; import com.subsidy.dto.classDict.GetSpareMembersDTO;
import com.subsidy.model.ClassDictDO; import com.subsidy.model.ClassDictDO;
import com.subsidy.model.ClassMemberMappingDO; import com.subsidy.model.ClassMemberMappingDO;
...@@ -92,15 +93,15 @@ public class ClassDictController { ...@@ -92,15 +93,15 @@ public class ClassDictController {
} }
@PostMapping("batchSms") @PostMapping("batchSms")
@ApiOperation(" 批量发送班级短信 {id 班级id}") @ApiOperation(" 批量发送班级短信通知 {id 班级id }")
public ResponseVO batchSms(@RequestBody ClassDictDO classDictDO){ public ResponseVO batchSms(@RequestBody ClassDictDO classDictDO){
return ResponseData.generateCreatedResponse(0,classDictService.batchSms(classDictDO)); return ResponseData.generateCreatedResponse(0,classDictService.batchSms(classDictDO));
} }
@PostMapping("getClassBaseInfo") @PostMapping("getClassBaseInfo")
@ApiOperation("班级详情--获取课程基本信息") @ApiOperation("班级详情--获取课程基本信息 id")
public ResponseVO getClassBaseInfo(@RequestBody ClassDictDO classDictDO){ public ResponseVO getClassBaseInfo(@RequestBody GetClassBaseInfoDTO getClassBaseInfoDTO){
return ResponseData.generateCreatedResponse(0,classDictService.getClassBaseInfo(classDictDO)); return ResponseData.generateCreatedResponse(0,classDictService.getClassBaseInfo(getClassBaseInfoDTO));
} }
......
...@@ -8,6 +8,7 @@ import com.subsidy.model.ClassHourDictDO; ...@@ -8,6 +8,7 @@ import com.subsidy.model.ClassHourDictDO;
import com.subsidy.model.VodPlayHistoryDO; import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.service.ClassHourDictService; import com.subsidy.service.ClassHourDictService;
import com.subsidy.util.ConstantUtils; import com.subsidy.util.ConstantUtils;
import com.subsidy.vo.classdict.GetSettingVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -40,10 +41,10 @@ public class ClassHourDictController { ...@@ -40,10 +41,10 @@ public class ClassHourDictController {
} }
@PostMapping("updateSetting") @PostMapping("updateSetting")
@ApiOperation("修改当天设置时长 companyId 主键 classHour status interrupt interruptStatus repeatTime repeatStatus") @ApiOperation("修改当天设置时长 companyId 主键 logo classHour status interrupt interruptStatus repeatTime repeatStatus rotationImgDictDOS[companyId rotationImg]")
//@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateSetting(@RequestBody ClassHourDictDO classHourDictDO){ public ResponseVO updateSetting(@RequestBody GetSettingVO getSettingVO){
return ResponseData.generateCreatedResponse(0,classHourDictService.updateSetting(classHourDictDO)); return ResponseData.generateCreatedResponse(0,classHourDictService.updateSetting(getSettingVO));
} }
@PostMapping("pollingGet") @PostMapping("pollingGet")
......
...@@ -51,7 +51,7 @@ public class ClassNoticeController { ...@@ -51,7 +51,7 @@ public class ClassNoticeController {
@PostMapping("queryClassNotices") @PostMapping("queryClassNotices")
@ApiOperation("查看某个课程的通知提醒 classId 课程id status 状态(待发送/已发送)") @ApiOperation("查看某个课程的通知提醒 classId 课程id status 状态(待发送/已发送)")
public ResponseVO queryClassNotices(ClassNoticeDO classNoticeDO){ public ResponseVO queryClassNotices(@RequestBody ClassNoticeDO classNoticeDO){
return ResponseData.generateCreatedResponse(0,classNoticeService.queryClassNotices(classNoticeDO)); return ResponseData.generateCreatedResponse(0,classNoticeService.queryClassNotices(classNoticeDO));
} }
......
...@@ -55,7 +55,7 @@ public class CompanyDictController { ...@@ -55,7 +55,7 @@ public class CompanyDictController {
} }
@PostMapping("updateCompany") @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}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateAdminister(@RequestBody AddCompanyDTO addCompanyDTO){ public ResponseVO updateAdminister(@RequestBody AddCompanyDTO addCompanyDTO){
return ResponseData.generateCreatedResponse(0,companyDictService.updateAdminister(addCompanyDTO)); return ResponseData.generateCreatedResponse(0,companyDictService.updateAdminister(addCompanyDTO));
......
...@@ -35,7 +35,7 @@ public class CourseDictController { ...@@ -35,7 +35,7 @@ public class CourseDictController {
private CourseDictService courseDictService; private CourseDictService courseDictService;
@PostMapping("addCourse") @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}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addCourse(@RequestBody AddCourseDTO addCourseDTO){ public ResponseVO addCourse(@RequestBody AddCourseDTO addCourseDTO){
return ResponseData.generateCreatedResponse(0,courseDictService.addCourse(addCourseDTO)); return ResponseData.generateCreatedResponse(0,courseDictService.addCourse(addCourseDTO));
......
...@@ -42,7 +42,7 @@ public class DepartmentDictController { ...@@ -42,7 +42,7 @@ public class DepartmentDictController {
@PostMapping("addDepartment") @PostMapping("addDepartment")
@ApiOperation("添加部门 companyId departmentName leaderName parentId 父节点") @ApiOperation("添加部门 companyId departmentName leaderName parentId 父节点")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addDepartment(@RequestBody DepartmentDictDO departmentDictDO){ public ResponseVO addDepartment(@RequestBody DepartmentDictDO departmentDictDO){
return ResponseData.generateCreatedResponse(0,departmentDictService.addDepartment(departmentDictDO)); return ResponseData.generateCreatedResponse(0,departmentDictService.addDepartment(departmentDictDO));
} }
...@@ -62,11 +62,17 @@ public class DepartmentDictController { ...@@ -62,11 +62,17 @@ public class DepartmentDictController {
} }
@PostMapping("getDepartmentMembers") @PostMapping("getDepartmentMembers")
@ApiOperation("获取部门成员 companyId 公司id departmentId 部门id userName") @ApiOperation("获取部门成员 companyId 公司id departmentId 部门id userName startDate endDate")
public ResponseVO getDepartmentMembers(@RequestBody GetDepartmentMembersDTO getDepartmentMembersDTO){ public ResponseVO getDepartmentMembers(@RequestBody GetDepartmentMembersDTO getDepartmentMembersDTO){
return ResponseData.generateCreatedResponse(0,departmentDictService.getDepartmentMembers(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));
}
......
...@@ -6,6 +6,7 @@ import com.subsidy.common.ResponseVO; ...@@ -6,6 +6,7 @@ import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired; import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.administer.VerifyCodeDTO; import com.subsidy.dto.administer.VerifyCodeDTO;
import com.subsidy.dto.member.AddMemberDTO; import com.subsidy.dto.member.AddMemberDTO;
import com.subsidy.dto.member.ChangeDepartmentsDTO;
import com.subsidy.dto.member.ContentMemberDTO; import com.subsidy.dto.member.ContentMemberDTO;
import com.subsidy.dto.member.GetAllDTO; import com.subsidy.dto.member.GetAllDTO;
import com.subsidy.dto.member.MyCoursesDTO; import com.subsidy.dto.member.MyCoursesDTO;
...@@ -40,7 +41,7 @@ public class MemberController { ...@@ -40,7 +41,7 @@ public class MemberController {
private MemberService memberService; private MemberService memberService;
@PostMapping("getAll") @PostMapping("getAll")
@ApiOperation("查询某部门成员 pageNum pageSize departmentId userName status") @ApiOperation("查询某部门成员 pageNum pageSize departmentId userName status startDate endDate")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getAll(@RequestBody GetAllDTO getAllDTO){ public ResponseVO getAll(@RequestBody GetAllDTO getAllDTO){
return ResponseData.generateCreatedResponse(0,memberService.getAll(getAllDTO)); return ResponseData.generateCreatedResponse(0,memberService.getAll(getAllDTO));
...@@ -54,7 +55,7 @@ public class MemberController { ...@@ -54,7 +55,7 @@ public class MemberController {
} }
@PostMapping("addMember") @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}) @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addMember(@RequestBody AddMemberDTO addMemberDTO){ public ResponseVO addMember(@RequestBody AddMemberDTO addMemberDTO){
return ResponseData.generateCreatedResponse(0,memberService.addMember(addMemberDTO)); return ResponseData.generateCreatedResponse(0,memberService.addMember(addMemberDTO));
...@@ -145,5 +146,10 @@ public class MemberController { ...@@ -145,5 +146,10 @@ public class MemberController {
memberService.importRedis(); memberService.importRedis();
} }
@PostMapping("changeDepartments")
@ApiOperation("修改部门 desDepId[] 目的部门 memberIds[] 成员id")
public ResponseVO changeDepartments(@RequestBody ChangeDepartmentsDTO changeDepartmentsDTO){
return ResponseData.generateCreatedResponse(0,memberService.changeDepartments(changeDepartmentsDTO));
}
} }
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;
/**
* <p>
* 轮播图 前端控制器
* </p>
*
* @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));
}
}
package com.subsidy.dto.classDict;
import lombok.Data;
@Data
public class GetClassBaseInfoDTO {
private Long userId;
private Long id;
}
package com.subsidy.dto.course; 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 lombok.Data;
import java.util.List; import java.util.List;
...@@ -37,6 +33,11 @@ public class AddCourseDTO { ...@@ -37,6 +33,11 @@ public class AddCourseDTO {
private String coverPage; private String coverPage;
/** /**
* 备注
*/
private String remark;
/**
* 开放状态 * 开放状态
*/ */
private Integer openStatus; private Integer openStatus;
......
...@@ -30,6 +30,11 @@ public class UpdateCoursesDTO { ...@@ -30,6 +30,11 @@ public class UpdateCoursesDTO {
private String courseType; private String courseType;
/** /**
* 备注
*/
private String remark;
/**
* 行业范围 * 行业范围
*/ */
private List<Long> fieldDictDOS; private List<Long> fieldDictDOS;
......
...@@ -14,4 +14,8 @@ public class GetDepartmentMembersDTO { ...@@ -14,4 +14,8 @@ public class GetDepartmentMembersDTO {
private Long companyId; private Long companyId;
private String userName; private String userName;
private String startDate;
private String endDate;
} }
package com.subsidy.dto.member;
import lombok.Data;
import java.util.List;
@Data
public class ChangeDepartmentsDTO {
private List<Long> desDepId;
private List<Long> memberIds;
}
...@@ -11,6 +11,10 @@ public class GetAllDTO{ ...@@ -11,6 +11,10 @@ public class GetAllDTO{
private Long departmentId; private Long departmentId;
private String startDate;
private String endDate;
private Integer pageNum; private Integer pageNum;
private Integer pageSize; private Integer pageSize;
......
package com.subsidy.dto.member; package com.subsidy.dto.member;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.subsidy.util.excel.ExcelColumn; import com.subsidy.util.excel.ExcelColumn;
import com.subsidy.util.excel.ExcelColumnUtil; import com.subsidy.util.excel.ExcelColumnUtil;
import lombok.Data; import lombok.Data;
import java.util.Date;
@Data @Data
public class ImportMemberDTO { public class ImportMemberDTO {
...@@ -26,5 +29,15 @@ public class ImportMemberDTO { ...@@ -26,5 +29,15 @@ public class ImportMemberDTO {
@ExcelColumnUtil(value = "英文名", col = 6) @ExcelColumnUtil(value = "英文名", col = 6)
private String accountNameEn; private String accountNameEn;
@ExcelColumnUtil(value = "邮箱", col = 7)
private String email;
@ExcelColumnUtil(value = "工号", col = 8)
private String workNo;
@ExcelColumnUtil(value = "入职时间", col = 9)
private String inductionDate;
} }
...@@ -2,11 +2,13 @@ package com.subsidy.jobs; ...@@ -2,11 +2,13 @@ package com.subsidy.jobs;
import com.subsidy.common.constant.CourseNotification; import com.subsidy.common.constant.CourseNotification;
import com.subsidy.common.constant.SmsCode; import com.subsidy.common.constant.SmsCode;
import com.subsidy.mapper.ClassDictMapper;
import com.subsidy.mapper.ClassNoticeMapper; import com.subsidy.mapper.ClassNoticeMapper;
import com.subsidy.mapper.MemberMapper; import com.subsidy.mapper.MemberMapper;
import com.subsidy.model.ClassNoticeDO; import com.subsidy.model.ClassNoticeDO;
import com.subsidy.model.MemberDO; import com.subsidy.model.MemberDO;
import com.subsidy.util.SMSUtils; import com.subsidy.util.SMSUtils;
import com.subsidy.vo.classdict.ClassAndCompanyInfoVO;
import org.quartz.Job; import org.quartz.Job;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException; import org.quartz.JobExecutionException;
...@@ -36,7 +38,7 @@ public class CourseNotificationJob implements Job { ...@@ -36,7 +38,7 @@ public class CourseNotificationJob implements Job {
private ClassNoticeMapper classNoticeMapper; private ClassNoticeMapper classNoticeMapper;
@Autowired @Autowired
private SMSUtils smsUtils; private ClassDictMapper classDictMapper;
@Override @Override
public void execute(JobExecutionContext jobExecutionContext) { public void execute(JobExecutionContext jobExecutionContext) {
...@@ -45,15 +47,23 @@ public class CourseNotificationJob implements Job { ...@@ -45,15 +47,23 @@ public class CourseNotificationJob implements Job {
if(params != null) { if(params != null) {
ClassNoticeDO classNoticeDO = classNoticeMapper.selectById((Long) params.get("id")); ClassNoticeDO classNoticeDO = classNoticeMapper.selectById((Long) params.get("id"));
if(classNoticeDO != null) { if(classNoticeDO != null) {
ClassAndCompanyInfoVO cmInfo = classDictMapper.getClassAndCompanyInfoVO((Long) params.get("classId"));
List<MemberDO> list = memberMapper.getMemberList((Long) params.get("classId")); List<MemberDO> list = memberMapper.getMemberList((Long) params.get("classId"));
if(list != null && list.size() > 0) { if(list != null && list.size() > 0) {
for (MemberDO memberDO : list) { for (MemberDO memberDO : list) {
if(memberDO != null) { if(memberDO != null) {
Map<String, String> data = Arrays.stream(SmsCode.values()).collect(Collectors.toMap(SmsCode::getType, SmsCode::getCode)); Map<String, String> 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(); ClassNoticeDO classNotice = new ClassNoticeDO();
classNotice.setId(classNoticeDO.getId()); classNotice.setId(classNoticeDO.getId());
classNotice.setStatus(CourseNotification.SENT); classNotice.setStatus(CourseNotification.SENT);
...@@ -61,5 +71,4 @@ public class CourseNotificationJob implements Job { ...@@ -61,5 +71,4 @@ public class CourseNotificationJob implements Job {
} }
} }
} }
}
} }
...@@ -9,7 +9,7 @@ import com.subsidy.mapper.VodPlayHistoryMapper; ...@@ -9,7 +9,7 @@ import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.model.OprAdmDictDO; import com.subsidy.model.OprAdmDictDO;
import com.subsidy.model.SignInRecordDO; import com.subsidy.model.SignInRecordDO;
import com.subsidy.util.DateFormatUtil; import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.RedisUtil; //import com.subsidy.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -41,8 +41,8 @@ public class SchedulerJob { ...@@ -41,8 +41,8 @@ public class SchedulerJob {
@Autowired @Autowired
private SignInRecordMapper signInRecordMapper; private SignInRecordMapper signInRecordMapper;
@Autowired //@Autowired
private RedisUtil redisUtil; //private RedisUtil redisUtil;
/** /**
删除十天前登录记录(管理端) 删除十天前登录记录(管理端)
...@@ -115,34 +115,34 @@ public class SchedulerJob { ...@@ -115,34 +115,34 @@ public class SchedulerJob {
* 1天前的 * 1天前的
* 增量版 * 增量版
*/ */
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public void synchronizeSignInRecord() { //public void synchronizeSignInRecord() {
List<SignInRecordDO> list = signInRecordMapper.getSignInRecord(); // List<SignInRecordDO> list = signInRecordMapper.getSignInRecord();
if(list != null && list.size() > 0) { // if(list != null && list.size() > 0) {
for (SignInRecordDO signInRecordDO : list) { // for (SignInRecordDO signInRecordDO : list) {
Set<String> set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + signInRecordDO.getClassId() + ":" + DateFormatUtil.format(signInRecordDO.getSignInDate(), "yyyy-MM-dd")+":*"); // Set<String> 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) { // if(set != null && set.size() > 0) {
redisUtil.del(set); // 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); // 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签到数据 * 全部同步Redis签到数据
*/ */
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public void synchronizeSignInRecordAll() { //public void synchronizeSignInRecordAll() {
Set<String> set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX+"*"); // Set<String> set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX+"*");
if(set != null && set.size() > 0) { // if(set != null && set.size() > 0) {
redisUtil.del(set); // redisUtil.del(set);
} // }
//
List<SignInRecordDO> list = signInRecordMapper.selectList(new QueryWrapper<>()); // List<SignInRecordDO> list = signInRecordMapper.selectList(new QueryWrapper<>());
for (SignInRecordDO signInRecordDO : list) { // 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); // redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + signInRecordDO.getClassId() + ":" + DateFormatUtil.format(signInRecordDO.getSignInDate(), "yyyy-MM-dd") + ":" + DateFormatUtil.LocalDateTimeToSecond(signInRecordDO.getSignInDate()), null);
} // }
//
} //}
} }
...@@ -5,6 +5,7 @@ import com.subsidy.dto.classDict.GetSpareMembersDTO; ...@@ -5,6 +5,7 @@ import com.subsidy.dto.classDict.GetSpareMembersDTO;
import com.subsidy.model.ClassDictDO; import com.subsidy.model.ClassDictDO;
import com.subsidy.model.MemberDO; import com.subsidy.model.MemberDO;
import com.subsidy.model.VodDictDO; import com.subsidy.model.VodDictDO;
import com.subsidy.vo.classdict.ClassAndCompanyInfoVO;
import com.subsidy.vo.classdict.GetAllClassesVO; import com.subsidy.vo.classdict.GetAllClassesVO;
import com.subsidy.vo.classdict.GetClassBaseInfoVO; import com.subsidy.vo.classdict.GetClassBaseInfoVO;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -48,4 +49,8 @@ public interface ClassDictMapper extends BaseMapper<ClassDictDO> { ...@@ -48,4 +49,8 @@ public interface ClassDictMapper extends BaseMapper<ClassDictDO> {
*/ */
GetClassBaseInfoVO getClassBaseInfo(Long classId); GetClassBaseInfoVO getClassBaseInfo(Long classId);
/**
* 班级信息 -- 获取课程信息 + 公司信息
* */
ClassAndCompanyInfoVO getClassAndCompanyInfoVO(Long classId);
} }
...@@ -21,10 +21,10 @@ import java.util.List; ...@@ -21,10 +21,10 @@ import java.util.List;
public interface CompanyDictMapper extends BaseMapper<CompanyDictDO> { public interface CompanyDictMapper extends BaseMapper<CompanyDictDO> {
/** /**
* 企业管理--查找所有主账号 * 企业管理--查找所有主账号 、运营者
* @return * @return
*/ */
IPage<OperatorsVO> operators(IPage page, String companyName,Long fieldId,Long id); IPage<OperatorsVO> operators(IPage page, String companyName,Long fieldId,Long id,Integer role);
/** /**
* 查找所有的公司名称 * 查找所有的公司名称
......
...@@ -29,7 +29,7 @@ public interface CourseContentMapper extends BaseMapper<CourseContentDO> { ...@@ -29,7 +29,7 @@ public interface CourseContentMapper extends BaseMapper<CourseContentDO> {
/** /**
* 查看某个目录下 某个成员看视频的进度 * 查看某个目录下 某个成员看视频的进度
*/ */
List<MemberVodVO> contentVodProcess(Long contentId, Long memberId); List<MemberVodVO> contentVodProcess(Long contentId, Long memberId,Long classId);
/** /**
* 查看某个课程下的文件/课件 * 查看某个课程下的文件/课件
......
...@@ -46,7 +46,7 @@ public interface ExerciseDoneResultMapper extends BaseMapper<ExerciseDoneResultD ...@@ -46,7 +46,7 @@ public interface ExerciseDoneResultMapper extends BaseMapper<ExerciseDoneResultD
/** /**
* 查看某个人某个卷子完成的最好成绩 * 查看某个人某个卷子完成的最好成绩
*/ */
List<ExerciseDoneResultDO> getMaxScorePaper(Long paperId,Long memberId); List<ExerciseDoneResultDO> getMaxScorePaper(Long paperId,Long memberId,Long classId);
/** /**
* 测试成绩 最高成绩 测试测试 总评价 * 测试成绩 最高成绩 测试测试 总评价
......
...@@ -46,14 +46,24 @@ public interface MemberMapper extends BaseMapper<MemberDO> { ...@@ -46,14 +46,24 @@ public interface MemberMapper extends BaseMapper<MemberDO> {
List<DepartmentDictDO> getDepartments(Long memberId); List<DepartmentDictDO> getDepartments(Long memberId);
/** /**
* 查询部门所有的学生 * 查询部门所有的学生 分页
*/ */
IPage<GetAllVO> getMembers(IPage iPage,Long departmentId,String userName,String status); IPage<GetAllVO> getMembers(IPage iPage,Long departmentId,String userName,String status,String startDate,String endDate);
/**
* 查询某个部门的员工 不分页
*/
List<MemberDO> getMemberWithoutPage(Long departmentId,String userName,String status,String startDate,String endDate);
/**
* 查询某公司的学生
*/
IPage<GetAllVO> getCompanyMember(IPage iPage,Long companyId,String userName,String status,String startDate,String endDate);
/** /**
* 查询某公司所有的学生 公司不传就是查平台所有学生 * 查询某公司所有的学生 公司不传就是查平台所有学生
*/ */
IPage<ManageMemberVO> manageMember(IPage iPage,Long companyId,String userName); IPage<ManageMemberVO> manageMember(IPage iPage,Long companyId,String userName,String startDate,String endDate);
List<MemberDO> getMemberList(Long classId); List<MemberDO> getMemberList(Long classId);
......
...@@ -27,7 +27,7 @@ public interface PaperDictMapper extends BaseMapper<PaperDictDO> { ...@@ -27,7 +27,7 @@ public interface PaperDictMapper extends BaseMapper<PaperDictDO> {
/** /**
* 查看某个卷子有多少人完成 卷子id * 查看某个卷子有多少人完成 卷子id
*/ */
Integer completeCount(Long paperId); Integer completeCount(Long paperId,Long classId);
/** /**
* 查看某个课程下有多少卷子 * 查看某个课程下有多少卷子
......
package com.subsidy.mapper; package com.subsidy.mapper;
import com.subsidy.model.AdministerDO;
import com.subsidy.model.RoleAdministerMappingDO; import com.subsidy.model.RoleAdministerMappingDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -15,4 +16,11 @@ import org.springframework.stereotype.Repository; ...@@ -15,4 +16,11 @@ import org.springframework.stereotype.Repository;
@Repository @Repository
public interface RoleAdministerMappingMapper extends BaseMapper<RoleAdministerMappingDO> { public interface RoleAdministerMappingMapper extends BaseMapper<RoleAdministerMappingDO> {
/**
* 查看企业的管理者
* @param companyId
* @return
*/
AdministerDO getAdminister(Long companyId);
} }
package com.subsidy.mapper;
import com.subsidy.model.RotationImgDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 轮播图 Mapper 接口
* </p>
*
* @author DengMin
* @since 2022-02-23
*/
@Repository
public interface RotationImgDictMapper extends BaseMapper<RotationImgDictDO> {
}
...@@ -80,7 +80,7 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> { ...@@ -80,7 +80,7 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
/** /**
* 查看某个人某个视频的累计时长 * 查看某个人某个视频的累计时长
*/ */
Integer memberVodTotalLength(Long memberId,Long vodId); Integer memberVodTotalLength(Long classId,Long memberId,Long vodId);
/** /**
* 跑脚本 前一天的学习情况 * 跑脚本 前一天的学习情况
......
...@@ -79,4 +79,6 @@ public class ClassDictDO extends BaseModel { ...@@ -79,4 +79,6 @@ public class ClassDictDO extends BaseModel {
private Integer testRule; private Integer testRule;
} }
...@@ -54,4 +54,8 @@ public class CourseDictDO extends BaseModel { ...@@ -54,4 +54,8 @@ public class CourseDictDO extends BaseModel {
*/ */
private Integer openStatus; private Integer openStatus;
/**
* 备注
*/
private String remark;
} }
...@@ -52,6 +52,11 @@ public class DepartmentDictDO extends BaseModel { ...@@ -52,6 +52,11 @@ public class DepartmentDictDO extends BaseModel {
private Long parentId; private Long parentId;
/** /**
* 部门全路径
*/
private String fullName;
/**
* 为写程序方便,数据库里为null * 为写程序方便,数据库里为null
*/ */
private List<GetDepartmentsVO> children; private List<GetDepartmentsVO> children;
......
package com.subsidy.model; package com.subsidy.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.subsidy.util.BaseModel; import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
...@@ -7,6 +8,8 @@ import com.baomidou.mybatisplus.annotation.TableId; ...@@ -7,6 +8,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.Date;
/** /**
* <p> * <p>
* 学生表 * 学生表
...@@ -56,6 +59,22 @@ public class MemberDO extends BaseModel { ...@@ -56,6 +59,22 @@ public class MemberDO extends BaseModel {
private String password; private String password;
/** /**
* 工号
*/
private String workNo;
/**
* 入职时间
*/
@JsonFormat
private String inductionDate;
/**
* 邮箱
*/
private String email;
/**
* 性别 * 性别
*/ */
private String gender; private String gender;
......
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;
/**
* <p>
* 轮播图
* </p>
*
* @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;
}
...@@ -3,6 +3,7 @@ package com.subsidy.service; ...@@ -3,6 +3,7 @@ package com.subsidy.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.dto.classDict.AddClassDTO; import com.subsidy.dto.classDict.AddClassDTO;
import com.subsidy.dto.classDict.AddMemberToClassDTO; import com.subsidy.dto.classDict.AddMemberToClassDTO;
import com.subsidy.dto.classDict.GetClassBaseInfoDTO;
import com.subsidy.dto.classDict.GetSpareMembersDTO; import com.subsidy.dto.classDict.GetSpareMembersDTO;
import com.subsidy.model.ClassDictDO; import com.subsidy.model.ClassDictDO;
import com.subsidy.model.ClassMemberMappingDO; import com.subsidy.model.ClassMemberMappingDO;
...@@ -40,6 +41,6 @@ public interface ClassDictService extends IService<ClassDictDO> { ...@@ -40,6 +41,6 @@ public interface ClassDictService extends IService<ClassDictDO> {
String batchSms(ClassDictDO classDictDO); String batchSms(ClassDictDO classDictDO);
GetClassBaseInfoVO getClassBaseInfo(ClassDictDO classDictDO); GetClassBaseInfoVO getClassBaseInfo(GetClassBaseInfoDTO getClassBaseInfoDTO);
} }
...@@ -3,6 +3,7 @@ package com.subsidy.service; ...@@ -3,6 +3,7 @@ package com.subsidy.service;
import com.subsidy.model.ClassHourDictDO; import com.subsidy.model.ClassHourDictDO;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.model.VodPlayHistoryDO; import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.vo.classdict.GetSettingVO;
import com.subsidy.vo.hour.PollingGetVO; import com.subsidy.vo.hour.PollingGetVO;
/** /**
...@@ -15,9 +16,9 @@ import com.subsidy.vo.hour.PollingGetVO; ...@@ -15,9 +16,9 @@ import com.subsidy.vo.hour.PollingGetVO;
*/ */
public interface ClassHourDictService extends IService<ClassHourDictDO> { public interface ClassHourDictService extends IService<ClassHourDictDO> {
ClassHourDictDO getSetting(ClassHourDictDO classHourDictDO); GetSettingVO getSetting(ClassHourDictDO classHourDictDO);
String updateSetting(ClassHourDictDO classHourDictDO); String updateSetting(GetSettingVO getSettingVO);
PollingGetVO pollingGet(VodPlayHistoryDO vodPlayHistoryDO); PollingGetVO pollingGet(VodPlayHistoryDO vodPlayHistoryDO);
} }
...@@ -5,6 +5,7 @@ import com.subsidy.dto.department.GetDepartmentMembersDTO; ...@@ -5,6 +5,7 @@ import com.subsidy.dto.department.GetDepartmentMembersDTO;
import com.subsidy.dto.department.GetDepartmentsVO; import com.subsidy.dto.department.GetDepartmentsVO;
import com.subsidy.model.DepartmentDictDO; import com.subsidy.model.DepartmentDictDO;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.vo.department.GetMembersVO;
import java.util.List; import java.util.List;
...@@ -27,4 +28,6 @@ public interface DepartmentDictService extends IService<DepartmentDictDO> { ...@@ -27,4 +28,6 @@ public interface DepartmentDictService extends IService<DepartmentDictDO> {
String updateDepartment(DepartmentDictDO departmentDictDO); String updateDepartment(DepartmentDictDO departmentDictDO);
IPage getDepartmentMembers(GetDepartmentMembersDTO getDepartmentMembersDTO); IPage getDepartmentMembers(GetDepartmentMembersDTO getDepartmentMembersDTO);
List<GetMembersVO> getMembers(GetDepartmentMembersDTO getDepartmentMembersDTO);
} }
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.dto.administer.VerifyCodeDTO; import com.subsidy.dto.administer.VerifyCodeDTO;
import com.subsidy.dto.member.AddMemberDTO; import com.subsidy.dto.member.AddMemberDTO;
import com.subsidy.dto.member.ChangeDepartmentsDTO;
import com.subsidy.dto.member.ContentMemberDTO; import com.subsidy.dto.member.ContentMemberDTO;
import com.subsidy.dto.member.GetAllDTO; import com.subsidy.dto.member.GetAllDTO;
import com.subsidy.dto.member.MyCoursesDTO; import com.subsidy.dto.member.MyCoursesDTO;
...@@ -68,4 +69,6 @@ public interface MemberService extends IService<MemberDO> { ...@@ -68,4 +69,6 @@ public interface MemberService extends IService<MemberDO> {
void importRedis(); void importRedis();
String changeDepartments(ChangeDepartmentsDTO changeDepartmentsDTO);
} }
package com.subsidy.service;
import com.subsidy.model.RotationImgDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 轮播图 服务类
* </p>
*
* @author DengMin
* @since 2022-02-23
*/
public interface RotationImgDictService extends IService<RotationImgDictDO> {
String addRotation(RotationImgDictDO rotationImgDictDO);
String deleteRotation(RotationImgDictDO rotationImgDictDO);
String updateRotation(RotationImgDictDO rotationImgDictDO);
List<RotationImgDictDO> getAllRotations(RotationImgDictDO rotationImgDictDO);
}
...@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.common.RedisPrefixConstant;
import com.subsidy.common.exception.HttpException; import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.administer.ClassDailyInfoDTO; import com.subsidy.dto.administer.ClassDailyInfoDTO;
import com.subsidy.dto.administer.ClassDetailDTO; import com.subsidy.dto.administer.ClassDetailDTO;
...@@ -41,19 +40,16 @@ import com.subsidy.model.ExerciseDoneHistoryDO; ...@@ -41,19 +40,16 @@ import com.subsidy.model.ExerciseDoneHistoryDO;
import com.subsidy.model.ExerciseDoneResultDO; import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.model.MemberDO; import com.subsidy.model.MemberDO;
import com.subsidy.model.MemberDepartmentMappingDO; import com.subsidy.model.MemberDepartmentMappingDO;
import com.subsidy.model.OprAdmDictDO;
import com.subsidy.model.RoleAdministerMappingDO; import com.subsidy.model.RoleAdministerMappingDO;
import com.subsidy.model.SignInRecordDO; import com.subsidy.model.SignInRecordDO;
import com.subsidy.model.VodDictDO; import com.subsidy.model.VodDictDO;
import com.subsidy.model.OprAdmDictDO;
import com.subsidy.service.AdministerService; import com.subsidy.service.AdministerService;
import com.subsidy.service.FieldDictService;
import com.subsidy.util.ConstantUtils; import com.subsidy.util.ConstantUtils;
import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.ExcelFormatUtils; import com.subsidy.util.ExcelFormatUtils;
import com.subsidy.util.JwtUtil; import com.subsidy.util.JwtUtil;
import com.subsidy.util.Localstorage; import com.subsidy.util.Localstorage;
import com.subsidy.util.MathUtil; import com.subsidy.util.MathUtil;
import com.subsidy.util.RedisUtil;
import com.subsidy.util.excel.ExcelUtil; import com.subsidy.util.excel.ExcelUtil;
import com.subsidy.vo.administer.AdministerPermissionVO; import com.subsidy.vo.administer.AdministerPermissionVO;
import com.subsidy.vo.administer.ClassDailyInfoVO; import com.subsidy.vo.administer.ClassDailyInfoVO;
...@@ -81,7 +77,6 @@ import net.sourceforge.pinyin4j.PinyinHelper; ...@@ -81,7 +77,6 @@ import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType; import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat; import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType; import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFCellStyle; import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont; import org.apache.poi.hssf.usermodel.HSSFFont;
...@@ -100,7 +95,6 @@ import org.apache.poi.xssf.streaming.SXSSFWorkbook; ...@@ -100,7 +95,6 @@ import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
...@@ -122,13 +116,10 @@ import java.text.SimpleDateFormat; ...@@ -122,13 +116,10 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Locale;
import java.util.TreeSet;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
...@@ -181,8 +172,8 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -181,8 +172,8 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
@Autowired @Autowired
private VodDictMapper vodDictMapper; private VodDictMapper vodDictMapper;
@Autowired //@Autowired
private RedisUtil redisUtil; //private RedisUtil redisUtil;
@Autowired @Autowired
private OprAdmDictMapper oprAdmDictMapper; private OprAdmDictMapper oprAdmDictMapper;
...@@ -203,18 +194,18 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -203,18 +194,18 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
/** /**
* 先从redis里拿 * 先从redis里拿
*/ */
AdministerDO administerDO1 = (AdministerDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_ADMINISTER_PREFIX + administerDO.getAccountName()); //AdministerDO administerDO1 = (AdministerDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_ADMINISTER_PREFIX + administerDO.getAccountName());
if (null == administerDO1) { //if (null == administerDO1) {
/** /**
* 查表,并将数据写入到redis * 查表,并将数据写入到redis
*/ */
administerDO1 = this.baseMapper.selectOne(new QueryWrapper<AdministerDO>() AdministerDO administerDO1 = this.baseMapper.selectOne(new QueryWrapper<AdministerDO>()
.lambda() .lambda()
.eq(AdministerDO::getAccountName, administerDO.getAccountName())); .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); throw new HttpException(10012);
} }
...@@ -331,7 +322,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -331,7 +322,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
public IPage<OperatorsVO> operators(OperatorsDTO operatorsDTO) { public IPage<OperatorsVO> operators(OperatorsDTO operatorsDTO) {
Page pager = new Page(operatorsDTO.getPageNum(), operatorsDTO.getPageSize()); Page pager = new Page(operatorsDTO.getPageNum(), operatorsDTO.getPageSize());
IPage<OperatorsVO> operatorsVOIPage = companyDictMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getFieldId(),null); IPage<OperatorsVO> operatorsVOIPage = companyDictMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getFieldId(), null,0);
List<OperatorsVO> operatorsVOS = operatorsVOIPage.getRecords(); List<OperatorsVO> operatorsVOS = operatorsVOIPage.getRecords();
for (OperatorsVO operatorsVO : operatorsVOS) { for (OperatorsVO operatorsVO : operatorsVOS) {
...@@ -351,7 +342,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -351,7 +342,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
throw new HttpException(20002); throw new HttpException(20002);
} }
administerDO.setRole(0); //administerDO.setRole(0);
administerDO.setPassword("admin123"); administerDO.setPassword("admin123");
administerDO.setStatus("1"); administerDO.setStatus("1");
this.baseMapper.insert(administerDO); this.baseMapper.insert(administerDO);
...@@ -386,7 +377,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -386,7 +377,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
this.baseMapper.updateById(administerDO); this.baseMapper.updateById(administerDO);
AdministerDO administerDO1 = this.baseMapper.selectById(administerDO.getId()); AdministerDO administerDO1 = this.baseMapper.selectById(administerDO.getId());
//更新redis里该老师的数据 //更新redis里该老师的数据
redisUtil.set(RedisPrefixConstant.SUBSIDY_ADMINISTER_PREFIX + administerDO1.getAccountName(), administerDO1); //redisUtil.set(RedisPrefixConstant.SUBSIDY_ADMINISTER_PREFIX + administerDO1.getAccountName(), administerDO1);
return ConstantUtils.SET_SUCCESS; return ConstantUtils.SET_SUCCESS;
} }
...@@ -430,7 +421,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -430,7 +421,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
//视频 //视频
int i = 0; int i = 0;
for (VodDictDO vodDictDO : vodDictDOS) { for (VodDictDO vodDictDO : vodDictDOS) {
int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classMemberMappingDO.getMemberId(), vodDictDO.getId()); int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classMemberMappingDO.getMemberId(), vodDictDO.getId(),classDetailDTO.getId());
if (totalPlayLength >= vodDictDO.getVodLength()) { if (totalPlayLength >= vodDictDO.getVodLength()) {
i++; i++;
} }
...@@ -481,7 +472,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -481,7 +472,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
int playLength = 0; int playLength = 0;
//该成员完成了几个视频 //该成员完成了几个视频
for (VodDictDO vodDictDO : vodDictDOS) { for (VodDictDO vodDictDO : vodDictDOS) {
int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classDetailVO.getId(), vodDictDO.getId()); int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classDetailVO.getId(), vodDictDO.getId(),classDetailDTO.getId());
if (totalPlayLength >= vodDictDO.getVodLength()) { if (totalPlayLength >= vodDictDO.getVodLength()) {
i++; i++;
} }
...@@ -519,7 +510,12 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -519,7 +510,12 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
.eq(AnsweringQuestionDO::getClassId, classDetailDTO.getId())); .eq(AnsweringQuestionDO::getClassId, classDetailDTO.getId()));
classDetailVO.setAskCounts(count); classDetailVO.setAskCounts(count);
//签到次数 //签到次数
long set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + classDetailVO.getId() + ":classId:" + classDetailDTO.getId() + "*").stream().count(); //long set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + classDetailVO.getId() + ":classId:" + classDetailDTO.getId() + "*").stream().count();
Integer set = signInRecordMapper.selectCount(new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getClassId,classDetailDTO.getId())
.eq(SignInRecordDO::getMemberId,classDetailVO.getId()));
classDetailVO.setSignCounts(set); classDetailVO.setSignCounts(set);
} }
...@@ -547,7 +543,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -547,7 +543,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
int playLength = 0; int playLength = 0;
//该成员完成了几个视频 //该成员完成了几个视频
for (VodDictDO vodDictDO : vodDictDOS) { for (VodDictDO vodDictDO : vodDictDOS) {
int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classDetailVO.getId(), vodDictDO.getId()); int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classDetailVO.getId(), vodDictDO.getId(),classDetailDTO.getId());
if (totalPlayLength >= vodDictDO.getVodLength()) { if (totalPlayLength >= vodDictDO.getVodLength()) {
i++; i++;
} }
...@@ -593,7 +589,12 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -593,7 +589,12 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
classDetailVO.setAskCounts(count); classDetailVO.setAskCounts(count);
//签到次数 //签到次数
long set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + classDetailVO.getId() + ":classId:" + classDetailDTO.getId() + "*").stream().count(); //long set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + classDetailVO.getId() + ":classId:" + classDetailDTO.getId() + "*").stream().count();
Integer set = signInRecordMapper.selectCount(new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getClassId,classDetailDTO.getId())
.eq(SignInRecordDO::getMemberId,classDetailVO.getId()));
classDetailVO.setSignCounts(set); classDetailVO.setSignCounts(set);
} }
...@@ -623,7 +624,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -623,7 +624,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
int playLength = 0; int playLength = 0;
//该成员完成了几个视频 //该成员完成了几个视频
for (VodDictDO vodDictDO : vodDictDOS) { for (VodDictDO vodDictDO : vodDictDOS) {
int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classSignVO.getId(), vodDictDO.getId()); int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classSignVO.getId(), vodDictDO.getId(),classDetailDTO.getId());
if (totalPlayLength >= vodDictDO.getVodLength()) { if (totalPlayLength >= vodDictDO.getVodLength()) {
i++; i++;
} }
...@@ -640,25 +641,21 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -640,25 +641,21 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
classSignVO.setTrainingLength(playLength); classSignVO.setTrainingLength(playLength);
classSignVO.setTrainingLengthStr(MathUtil.secToTime(playLength)); classSignVO.setTrainingLengthStr(MathUtil.secToTime(playLength));
Set<String> sortSet = new TreeSet<String>(new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
return -o2.compareTo(o1);//降序排列
}
});
//签到 //签到
Set<String> set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + classSignVO.getId() + ":classId:" + classDetailDTO.getId() + "*"); //Set<String> set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + classSignVO.getId() + ":classId:" + classDetailDTO.getId() + "*");
classSignVO.setSignCounts(set.size()); List<SignInRecordDO> signInRecordDOS = signInRecordMapper.selectList(new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getClassId,classDetailDTO.getId())
.eq(SignInRecordDO::getMemberId,classSignVO.getId())
.orderByAsc(SignInRecordDO::getSignInDate));
classSignVO.setSignCounts(signInRecordDOS.size());
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
sortSet.addAll(set);
//签到时间 //签到时间
for (String signInRecordDO : sortSet) { for (SignInRecordDO signInRecordDO : signInRecordDOS) {
String[] array = signInRecordDO.split(":"); //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())) { if (StringUtils.isNotBlank(stringBuilder.toString())) {
String signInDate = stringBuilder.toString().substring(0, stringBuilder.length() - 1); String signInDate = stringBuilder.toString().substring(0, stringBuilder.length() - 1);
...@@ -686,7 +683,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -686,7 +683,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
int playLength = 0; int playLength = 0;
//该成员完成了几个视频 //该成员完成了几个视频
for (VodDictDO vodDictDO : vodDictDOS) { for (VodDictDO vodDictDO : vodDictDOS) {
int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classSignVO.getId(), vodDictDO.getId()); int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classSignVO.getId(), vodDictDO.getId(),classDetailDTO.getId());
if (totalPlayLength >= vodDictDO.getVodLength()) { if (totalPlayLength >= vodDictDO.getVodLength()) {
i++; i++;
} }
...@@ -702,31 +699,28 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -702,31 +699,28 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
classSignVO.setTrainingLengthStr(MathUtil.secToTime(playLength)); classSignVO.setTrainingLengthStr(MathUtil.secToTime(playLength));
//签到 //签到
Set<String> set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + classSignVO.getId() + ":classId:" + classDetailDTO.getId() + "*"); //Set<String> set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + classSignVO.getId() + ":classId:" + classDetailDTO.getId() + "*");
classSignVO.setSignCounts(set.size()); List<SignInRecordDO> signInRecordDOS = signInRecordMapper.selectList(new QueryWrapper<SignInRecordDO>()
.lambda()
Set<String> sortSet = new TreeSet<String>(new Comparator<String>() { .eq(SignInRecordDO::getClassId,classDetailDTO.getId())
@Override .eq(SignInRecordDO::getMemberId,classSignVO.getId())
public int compare(String o1, String o2) { .orderByAsc(SignInRecordDO::getSignInDate));
return -o2.compareTo(o1);//降序排列 classSignVO.setSignCounts(signInRecordDOS.size());
}
});
sortSet.addAll(set); //sortSet.addAll(set);
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//签到时间 //签到时间
for (String signInRecordDO : sortSet) { for (SignInRecordDO signInRecordDO : signInRecordDOS) {
String[] array = signInRecordDO.split(":"); //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())) { if (StringUtils.isNotBlank(stringBuilder.toString())) {
String signInDate = stringBuilder.toString().substring(0, stringBuilder.length() - 1); String signInDate = stringBuilder.toString().substring(0, stringBuilder.length() - 1);
classSignVO.setSignInDateList(signInDate); classSignVO.setSignInDateList(signInDate);
} }
} }
if (classDetailDTO.getFlag()) { if (classDetailDTO.getFlag()) {
...@@ -778,6 +772,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -778,6 +772,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
for (ExerciseTestVO exerciseTestVO : exerciseTestVOS) { for (ExerciseTestVO exerciseTestVO : exerciseTestVOS) {
//学生测试完成情况 //学生测试完成情况
//查看课程卷子
TestScoreInfoVO testScoreInfoVO = exerciseDoneResultMapper.testScoreInfo(classDetailDTO.getPaperId(), exerciseTestVO.getId()); TestScoreInfoVO testScoreInfoVO = exerciseDoneResultMapper.testScoreInfo(classDetailDTO.getPaperId(), exerciseTestVO.getId());
exerciseTestVO.setPaperId(exerciseTestVO.getPaperId()); exerciseTestVO.setPaperId(exerciseTestVO.getPaperId());
if (null != testScoreInfoVO) { if (null != testScoreInfoVO) {
...@@ -1235,7 +1230,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -1235,7 +1230,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
ByteArrayOutputStream baos2 = new ByteArrayOutputStream(); ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
classDetailDTO.setFlag(false); classDetailDTO.setFlag(false);
List<ExerciseTestVO> exerciseTestVOS = exportExerciseTest(classDetailDTO); List<ExerciseTestVO> 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"); compressFileToZipStream(zipOutputStream, baos2, "test.xlsx");
...@@ -1307,7 +1302,19 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -1307,7 +1302,19 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
MemberDO memberDO1 = new MemberDO(); MemberDO memberDO1 = new MemberDO();
memberDO1.setUserName(s.getUserName()); memberDO1.setUserName(s.getUserName());
memberDO1.setGender(s.getGender()); memberDO1.setGender(s.getGender());
memberDO1.setEmail(s.getEmail());
memberDO1.setWorkNo(s.getWorkNo());
try { try {
//日期格式
if (!StringUtils.isEmpty(s.getInductionDate())){
String DATE_PATTERN = "yyyy-MM-dd";
SimpleDateFormat sdf = new SimpleDateFormat("E MMM dd HH:mm:ss z yyyy", Locale.US);
Date date = sdf.parse(s.getInductionDate());
SimpleDateFormat d = new SimpleDateFormat(DATE_PATTERN);
memberDO1.setInductionDate(d.format(date));
}
String accountName = PinyinHelper.toHanYuPinyinString(s.getUserName(), format, "", true); String accountName = PinyinHelper.toHanYuPinyinString(s.getUserName(), format, "", true);
List<MemberDO> memberDOS = memberMapper.selectList(new QueryWrapper<MemberDO>() List<MemberDO> memberDOS = memberMapper.selectList(new QueryWrapper<MemberDO>()
.lambda() .lambda()
...@@ -1319,7 +1326,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -1319,7 +1326,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
} else { } else {
memberDO1.setAccountName(accountName.replace("u:", "v")); memberDO1.setAccountName(accountName.replace("u:", "v"));
} }
} catch (BadHanyuPinyinOutputFormatCombination ex) { } catch (Exception ex) {
} }
memberDO1.setCompanyId(companyId); memberDO1.setCompanyId(companyId);
...@@ -1332,16 +1339,11 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -1332,16 +1339,11 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
memberMapper.insert(memberDO1); memberMapper.insert(memberDO1);
//找到对应的部门 //找到对应的部门
String[] departments = s.getDepartments().split(","); String[] fullName = s.getDepartments().split(",");
for (String dep : fullName) {
for (String dpt : departments){
//找到最后一个部门对应id
String[] deps = dpt.split("/");
DepartmentDictDO departmentDictDO = departmentDictMapper.selectOne(new QueryWrapper<DepartmentDictDO>() DepartmentDictDO departmentDictDO = departmentDictMapper.selectOne(new QueryWrapper<DepartmentDictDO>()
.lambda() .lambda()
.eq(DepartmentDictDO::getCompanyId,companyId) .eq(DepartmentDictDO::getFullName, dep));
.eq(DepartmentDictDO::getDepartmentName,deps[deps.length-1]));
MemberDepartmentMappingDO memberDepartmentMappingDO = new MemberDepartmentMappingDO(); MemberDepartmentMappingDO memberDepartmentMappingDO = new MemberDepartmentMappingDO();
memberDepartmentMappingDO.setDepartmentId(departmentDictDO.getId()); memberDepartmentMappingDO.setDepartmentId(departmentDictDO.getId());
...@@ -1350,7 +1352,8 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -1350,7 +1352,8 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
} }
} }
}); });
} catch (Exception e) { } catch (
Exception e) {
throw new HttpException(10001); throw new HttpException(10001);
} }
return ConstantUtils.ADD_SUCCESS; return ConstantUtils.ADD_SUCCESS;
...@@ -1358,7 +1361,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis ...@@ -1358,7 +1361,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
public IPage<ManageMemberVO> manageMember(ManageMemberDTO manageMemberDTO) { public IPage<ManageMemberVO> manageMember(ManageMemberDTO manageMemberDTO) {
Page pager = new Page(manageMemberDTO.getPageNum(), manageMemberDTO.getPageSize()); 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) { public String userName(String originName, int i, Long companyId) {
......
...@@ -6,6 +6,7 @@ import com.subsidy.common.constant.CourseNotification; ...@@ -6,6 +6,7 @@ import com.subsidy.common.constant.CourseNotification;
import com.subsidy.common.exception.HttpException; import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.classDict.AddClassDTO; import com.subsidy.dto.classDict.AddClassDTO;
import com.subsidy.dto.classDict.AddMemberToClassDTO; import com.subsidy.dto.classDict.AddMemberToClassDTO;
import com.subsidy.dto.classDict.GetClassBaseInfoDTO;
import com.subsidy.dto.classDict.GetSpareMembersDTO; import com.subsidy.dto.classDict.GetSpareMembersDTO;
import com.subsidy.jobs.CourseNotificationJob; import com.subsidy.jobs.CourseNotificationJob;
import com.subsidy.mapper.AnsweringQuestionMapper; import com.subsidy.mapper.AnsweringQuestionMapper;
...@@ -15,14 +16,18 @@ import com.subsidy.mapper.ClassNoticeMapper; ...@@ -15,14 +16,18 @@ import com.subsidy.mapper.ClassNoticeMapper;
import com.subsidy.mapper.CompanyDictMapper; import com.subsidy.mapper.CompanyDictMapper;
import com.subsidy.mapper.CourseDictMapper; import com.subsidy.mapper.CourseDictMapper;
import com.subsidy.mapper.RoleAdministerMappingMapper; import com.subsidy.mapper.RoleAdministerMappingMapper;
import com.subsidy.mapper.VodDictMapper;
import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.model.AnsweringQuestionDO; import com.subsidy.model.AnsweringQuestionDO;
import com.subsidy.model.ClassDictDO; import com.subsidy.model.ClassDictDO;
import com.subsidy.model.ClassMemberMappingDO; import com.subsidy.model.ClassMemberMappingDO;
import com.subsidy.model.ClassNoticeDO; import com.subsidy.model.ClassNoticeDO;
import com.subsidy.model.CompanyDictDO; import com.subsidy.model.CompanyDictDO;
import com.subsidy.model.CourseDictDO; import com.subsidy.model.CourseDictDO;
import com.subsidy.model.FieldDictDO;
import com.subsidy.model.MemberDO; import com.subsidy.model.MemberDO;
import com.subsidy.model.RoleAdministerMappingDO; import com.subsidy.model.RoleAdministerMappingDO;
import com.subsidy.model.VodDictDO;
import com.subsidy.service.ClassDictService; import com.subsidy.service.ClassDictService;
import com.subsidy.util.ConstantUtils; import com.subsidy.util.ConstantUtils;
import com.subsidy.util.DateFormatUtil; import com.subsidy.util.DateFormatUtil;
...@@ -72,6 +77,12 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict ...@@ -72,6 +77,12 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
@Autowired @Autowired
private QuartzUtil quartzUtil; private QuartzUtil quartzUtil;
@Autowired
private VodDictMapper vodDictMapper;
@Autowired
private VodPlayHistoryMapper vodPlayHistoryMapper;
public List<GetAllClassesVO> getAllClasses(ClassDictDO classDictDO) throws Exception { public List<GetAllClassesVO> getAllClasses(ClassDictDO classDictDO) throws Exception {
DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd");
...@@ -203,8 +214,24 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict ...@@ -203,8 +214,24 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
return ConstantUtils.SUCCESS_SEND_OUT; return ConstantUtils.SUCCESS_SEND_OUT;
} }
public GetClassBaseInfoVO getClassBaseInfo(ClassDictDO classDictDO) { public GetClassBaseInfoVO getClassBaseInfo(GetClassBaseInfoDTO getClassBaseInfoDTO) {
return this.baseMapper.getClassBaseInfo(classDictDO.getId());
GetClassBaseInfoVO getClassBaseInfoVO = this.baseMapper.getClassBaseInfo(getClassBaseInfoDTO.getId());
//查看课程完成状态
//查看某个课程都有哪些视频
List<VodDictDO> 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;
} }
} }
package com.subsidy.service.impl; package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.common.RedisPrefixConstant; import com.subsidy.common.RedisPrefixConstant;
import com.subsidy.mapper.ClassHourDictMapper; import com.subsidy.mapper.ClassHourDictMapper;
import com.subsidy.mapper.CompanyDictMapper;
import com.subsidy.mapper.MemberMapper; import com.subsidy.mapper.MemberMapper;
import com.subsidy.mapper.RotationImgDictMapper;
import com.subsidy.mapper.VodPlayHistoryMapper; import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.model.ClassDictDO;
import com.subsidy.model.ClassHourDictDO; import com.subsidy.model.ClassHourDictDO;
import com.subsidy.model.CompanyDictDO;
import com.subsidy.model.MemberDO; import com.subsidy.model.MemberDO;
import com.subsidy.model.RotationImgDictDO;
import com.subsidy.model.VodPlayHistoryDO; import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.service.ClassHourDictService; import com.subsidy.service.ClassHourDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils; import com.subsidy.util.ConstantUtils;
import com.subsidy.util.MyBeanUtils; import com.subsidy.util.MyBeanUtils;
import com.subsidy.util.RedisUtil; import com.subsidy.vo.classdict.GetSettingVO;
import com.subsidy.vo.hour.PollingGetVO; import com.subsidy.vo.hour.PollingGetVO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
/** /**
* <p> * <p>
...@@ -44,20 +43,66 @@ public class ClassHourDictServiceImpl extends ServiceImpl<ClassHourDictMapper, C ...@@ -44,20 +43,66 @@ public class ClassHourDictServiceImpl extends ServiceImpl<ClassHourDictMapper, C
@Autowired @Autowired
private MemberMapper memberMapper; private MemberMapper memberMapper;
//@Autowired
//private RedisUtil redisUtil;
@Autowired
private RotationImgDictMapper rotationImgDictMapper;
@Autowired @Autowired
private RedisUtil redisUtil; private CompanyDictMapper companyDictMapper;
public GetSettingVO getSetting(ClassHourDictDO classHourDictDO) {
GetSettingVO getSettingVO = new GetSettingVO();
//ClassHourDictDO classDictDO = (ClassHourDictDO)redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX+classHourDictDO.getCompanyId());
//if (null == classDictDO){
ClassHourDictDO classDictDO = this.baseMapper.selectOne(new QueryWrapper<ClassHourDictDO>()
.lambda()
.eq(ClassHourDictDO::getCompanyId,classHourDictDO.getCompanyId()));
//redisUtil.set(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX+classHourDictDO.getCompanyId(),classDictDO);
//}
public ClassHourDictDO getSetting(ClassHourDictDO classHourDictDO) { BeanUtils.copyProperties(classDictDO,getSettingVO);
return (ClassHourDictDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX+classHourDictDO.getCompanyId());
List<RotationImgDictDO> rotationImgDictDOS = rotationImgDictMapper.selectList(new QueryWrapper<RotationImgDictDO>()
.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()); if (!StringUtils.isEmpty(getSettingVO.getLogo())){
classHourDictDO.setId(classHourDictDO1.getId()); CompanyDictDO companyDictDO = companyDictMapper.selectById(getSettingVO.getCompanyId());
String[] nullParams = MyBeanUtils.getNullPropertyNames(classHourDictDO); companyDictDO.setLogo(getSettingVO.getLogo());
BeanUtils.copyProperties(classHourDictDO, classHourDictDO1,nullParams); companyDictMapper.updateById(companyDictDO);
redisUtil.set(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX+classHourDictDO.getCompanyId(), classHourDictDO1); }
//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<RotationImgDictDO> rotationImgDictDOS = getSettingVO.getRotationImgDictDOS();
rotationImgDictMapper.delete(new QueryWrapper<RotationImgDictDO>()
.lambda()
.eq(RotationImgDictDO::getCompanyId,getSettingVO.getCompanyId()));
for (RotationImgDictDO rotationImgDictDO : rotationImgDictDOS){
rotationImgDictDO.setCompanyId(getSettingVO.getCompanyId());
rotationImgDictMapper.insert(rotationImgDictDO);
}
}
return ConstantUtils.SET_SUCCESS; return ConstantUtils.SET_SUCCESS;
} }
...@@ -68,7 +113,9 @@ public class ClassHourDictServiceImpl extends ServiceImpl<ClassHourDictMapper, C ...@@ -68,7 +113,9 @@ public class ClassHourDictServiceImpl extends ServiceImpl<ClassHourDictMapper, C
MemberDO memberDO = memberMapper.selectById(vodPlayHistoryDO.getMemberId()); MemberDO memberDO = memberMapper.selectById(vodPlayHistoryDO.getMemberId());
//查看系统设定的时长 //查看系统设定的时长
ClassHourDictDO classHourDictDO = (ClassHourDictDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + memberDO.getCompanyId()); ClassHourDictDO classHourDictDO = this.baseMapper.selectOne (new QueryWrapper<ClassHourDictDO>()
.lambda()
.eq(ClassHourDictDO::getCompanyId,memberDO.getCompanyId()));
if (classHourDictDO.getStatus() == 0) { if (classHourDictDO.getStatus() == 0) {
pollingGetVO.setBool(false); pollingGetVO.setBool(false);
......
...@@ -6,18 +6,19 @@ import com.subsidy.common.constant.SmsCode; ...@@ -6,18 +6,19 @@ import com.subsidy.common.constant.SmsCode;
import com.subsidy.common.exception.HttpException; import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.classNotice.SendNotificationDTO; import com.subsidy.dto.classNotice.SendNotificationDTO;
import com.subsidy.jobs.CourseNotificationJob; import com.subsidy.jobs.CourseNotificationJob;
import com.subsidy.mapper.ClassDictMapper;
import com.subsidy.mapper.MemberMapper; import com.subsidy.mapper.MemberMapper;
import com.subsidy.model.ClassDictDO; import com.subsidy.model.ClassDictDO;
import com.subsidy.model.ClassNoticeDO; import com.subsidy.model.ClassNoticeDO;
import com.subsidy.mapper.ClassNoticeMapper; import com.subsidy.mapper.ClassNoticeMapper;
import com.subsidy.model.MemberDO; import com.subsidy.model.MemberDO;
import com.subsidy.service.ClassDictService;
import com.subsidy.service.ClassNoticeService; import com.subsidy.service.ClassNoticeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils; import com.subsidy.util.ConstantUtils;
import com.subsidy.util.DateFormatUtil; import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.QuartzUtil; import com.subsidy.util.QuartzUtil;
import com.subsidy.util.SMSUtils; import com.subsidy.util.SMSUtils;
import com.subsidy.vo.classdict.ClassAndCompanyInfoVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -41,14 +42,11 @@ public class ClassNoticeServiceImpl extends ServiceImpl<ClassNoticeMapper, Class ...@@ -41,14 +42,11 @@ public class ClassNoticeServiceImpl extends ServiceImpl<ClassNoticeMapper, Class
private QuartzUtil quartzUtil; private QuartzUtil quartzUtil;
@Autowired @Autowired
private ClassDictService classDictService; private ClassDictMapper classDictMapper;
@Autowired @Autowired
private MemberMapper memberMapper; private MemberMapper memberMapper;
@Autowired
private SMSUtils smsUtils;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public String addNotice(ClassNoticeDO classNoticeDO) { public String addNotice(ClassNoticeDO classNoticeDO) {
...@@ -59,12 +57,12 @@ public class ClassNoticeServiceImpl extends ServiceImpl<ClassNoticeMapper, Class ...@@ -59,12 +57,12 @@ public class ClassNoticeServiceImpl extends ServiceImpl<ClassNoticeMapper, Class
classNoticeDO.setStatus(CourseNotification.UNSENT); classNoticeDO.setStatus(CourseNotification.UNSENT);
this.baseMapper.insert(classNoticeDO); this.baseMapper.insert(classNoticeDO);
ClassDictDO classDictDO = classDictService.getById(classNoticeDO.getClassId()); ClassDictDO classDictDO = classDictMapper.selectById(classNoticeDO.getClassId());
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("classId", classNoticeDO.getClassId()); params.put("classId", classNoticeDO.getClassId());
params.put("id", classNoticeDO.getId()); params.put("id", classNoticeDO.getId());
String name = classDictDO.getClassName()+"-"+classNoticeDO.getNoticeType()+"-"+classNoticeDO.getNoticeTime(); 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; return ConstantUtils.ADD_SUCCESS;
} }
...@@ -79,7 +77,7 @@ public class ClassNoticeServiceImpl extends ServiceImpl<ClassNoticeMapper, Class ...@@ -79,7 +77,7 @@ public class ClassNoticeServiceImpl extends ServiceImpl<ClassNoticeMapper, Class
this.baseMapper.deleteById(classNoticeDO.getId()); this.baseMapper.deleteById(classNoticeDO.getId());
ClassDictDO classDictDO = classDictService.getById(noticeDO.getClassId()); ClassDictDO classDictDO = classDictMapper.selectById(noticeDO.getClassId());
String name = classDictDO.getClassName()+"-"+noticeDO.getNoticeType()+"-"+noticeDO.getNoticeTime(); String name = classDictDO.getClassName()+"-"+noticeDO.getNoticeType()+"-"+noticeDO.getNoticeTime();
quartzUtil.deleteJob(name, "CourseNotificationJob"); quartzUtil.deleteJob(name, "CourseNotificationJob");
return ConstantUtils.DELETE_SUCCESS; return ConstantUtils.DELETE_SUCCESS;
...@@ -94,25 +92,29 @@ public class ClassNoticeServiceImpl extends ServiceImpl<ClassNoticeMapper, Class ...@@ -94,25 +92,29 @@ public class ClassNoticeServiceImpl extends ServiceImpl<ClassNoticeMapper, Class
@Override @Override
public void sendNotification(SendNotificationDTO sendNotificationDTO) { public void sendNotification(SendNotificationDTO sendNotificationDTO) {
ClassAndCompanyInfoVO cmInfo = classDictMapper.getClassAndCompanyInfoVO(sendNotificationDTO.getClassId());
if(sendNotificationDTO.getSendType().equals(SmsCode.ALL.getType())) { if(sendNotificationDTO.getSendType().equals(SmsCode.ALL.getType())) {
String params = "{\"company\":\""+ cmInfo.getCompany() +"\", \"course\":\""+ cmInfo.getCourseName() +"\", \"startDate\": \""+ cmInfo.getStartDate()+"\", \"endDate\": \""+ cmInfo.getEndDate()+"\"}";
List<MemberDO> list = memberMapper.getMemberList(sendNotificationDTO.getClassId()); List<MemberDO> list = memberMapper.getMemberList(sendNotificationDTO.getClassId());
if(list != null) { if(list != null) {
for (MemberDO memberDO : list) { 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())) { } else if(sendNotificationDTO.getSendType().equals(SmsCode.NOT_SIGNED_IN.getType())) {
String params = "{ \"name\": \""+ cmInfo.getName() +"\", \"course\":\""+ cmInfo.getCourseName()+"\"}";
List<MemberDO> list = memberMapper.getMemberListBySignInRecord(sendNotificationDTO.getClassId()); List<MemberDO> list = memberMapper.getMemberListBySignInRecord(sendNotificationDTO.getClassId());
if(list != null) { if(list != null) {
for (MemberDO memberDO : list) { 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())) { } else if(sendNotificationDTO.getSendType().equals(SmsCode.UNFINISHED.getType())) {
String params = "{ \"name\": \""+ cmInfo.getName() +"\", \"course\":\""+ cmInfo.getCourseName()+"\"}";
List<MemberDO> list = memberMapper.getUnfinishedMemberList(sendNotificationDTO.getClassId()); List<MemberDO> list = memberMapper.getUnfinishedMemberList(sendNotificationDTO.getClassId());
if(list != null) { if(list != null) {
for (MemberDO memberDO : list) { for (MemberDO memberDO : list) {
smsUtils.send(memberDO.getTelephone(), SmsCode.UNFINISHED.getCode()); SMSUtils.sendNoticeSMS(SmsCode.UNFINISHED.getCode(), memberDO.getTelephone(), params);
} }
} }
} }
......
...@@ -50,7 +50,7 @@ public class ClassTypeDictServiceImpl extends ServiceImpl<ClassTypeDictMapper, C ...@@ -50,7 +50,7 @@ public class ClassTypeDictServiceImpl extends ServiceImpl<ClassTypeDictMapper, C
List<ClassTypeDictDO> classTypeDictDOS = new ArrayList<>(); List<ClassTypeDictDO> classTypeDictDOS = new ArrayList<>();
//查看当前登录人的角色 //查看当前登录人的角色 角色映射表
int count = roleAdministerMappingMapper.selectCount(new QueryWrapper<RoleAdministerMappingDO>() int count = roleAdministerMappingMapper.selectCount(new QueryWrapper<RoleAdministerMappingDO>()
.lambda() .lambda()
.eq(RoleAdministerMappingDO::getAdministerId,classTypeDTO.getUserId()) .eq(RoleAdministerMappingDO::getAdministerId,classTypeDTO.getUserId())
...@@ -68,8 +68,7 @@ public class ClassTypeDictServiceImpl extends ServiceImpl<ClassTypeDictMapper, C ...@@ -68,8 +68,7 @@ public class ClassTypeDictServiceImpl extends ServiceImpl<ClassTypeDictMapper, C
.eq(ClassTypeDictDO::getCompanyId,classTypeDTO.getCompanyId())); .eq(ClassTypeDictDO::getCompanyId,classTypeDTO.getCompanyId()));
classTypeDictDOS.addAll(classTypeDictDOList); classTypeDictDOS.addAll(classTypeDictDOList);
return classTypeDictDOS;
return classTypeDictDOList;
} }
} }
...@@ -18,6 +18,7 @@ import com.subsidy.mapper.FieldDictMapper; ...@@ -18,6 +18,7 @@ import com.subsidy.mapper.FieldDictMapper;
import com.subsidy.mapper.JobDictMapper; import com.subsidy.mapper.JobDictMapper;
import com.subsidy.mapper.RankDictMapper; import com.subsidy.mapper.RankDictMapper;
import com.subsidy.mapper.RoleAdministerMappingMapper; import com.subsidy.mapper.RoleAdministerMappingMapper;
import com.subsidy.mapper.RotationImgDictMapper;
import com.subsidy.model.AdministerDO; import com.subsidy.model.AdministerDO;
import com.subsidy.model.ClassHourDictDO; import com.subsidy.model.ClassHourDictDO;
import com.subsidy.model.ClassTypeDictDO; import com.subsidy.model.ClassTypeDictDO;
...@@ -28,10 +29,10 @@ import com.subsidy.model.FieldDictDO; ...@@ -28,10 +29,10 @@ import com.subsidy.model.FieldDictDO;
import com.subsidy.model.JobDictDO; import com.subsidy.model.JobDictDO;
import com.subsidy.model.RankDictDO; import com.subsidy.model.RankDictDO;
import com.subsidy.model.RoleAdministerMappingDO; import com.subsidy.model.RoleAdministerMappingDO;
import com.subsidy.model.RotationImgDictDO;
import com.subsidy.service.CompanyDictService; import com.subsidy.service.CompanyDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils; import com.subsidy.util.ConstantUtils;
import com.subsidy.util.RedisUtil;
import com.subsidy.vo.administer.OperatorsVO; import com.subsidy.vo.administer.OperatorsVO;
import com.subsidy.vo.company.GetAllCompanyVO; import com.subsidy.vo.company.GetAllCompanyVO;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -63,8 +64,8 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa ...@@ -63,8 +64,8 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
@Autowired @Autowired
private DepartmentDictMapper departmentDictMapper; private DepartmentDictMapper departmentDictMapper;
@Autowired //@Autowired
private RedisUtil redisUtil; //private RedisUtil redisUtil;
@Autowired @Autowired
private FieldDictMapper fieldDictMapper; private FieldDictMapper fieldDictMapper;
...@@ -84,11 +85,12 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa ...@@ -84,11 +85,12 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
@Autowired @Autowired
private RankDictMapper rankDictMapper; private RankDictMapper rankDictMapper;
@Autowired
private RotationImgDictMapper rotationImgDictMapper;
public IPage<OperatorsVO> operators(OperatorsDTO operatorsDTO) { public IPage<OperatorsVO> operators(OperatorsDTO operatorsDTO) {
Page pager = new Page(operatorsDTO.getPageNum(), operatorsDTO.getPageSize()); Page pager = new Page(operatorsDTO.getPageNum(), operatorsDTO.getPageSize());
AdministerDO administerDO = administerMapper.selectById(operatorsDTO.getId()); AdministerDO administerDO = administerMapper.selectById(operatorsDTO.getId());
//判断该用户的角色 //判断该用户的角色
...@@ -100,7 +102,7 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa ...@@ -100,7 +102,7 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
if (count > 0){ if (count > 0){
administerDO.setCompanyId(null); 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<OperatorsVO> operatorsVOS = page.getRecords(); List<OperatorsVO> operatorsVOS = page.getRecords();
for (OperatorsVO operatorsVO : operatorsVOS) { for (OperatorsVO operatorsVO : operatorsVOS) {
//查看公司所在行业 //查看公司所在行业
...@@ -138,7 +140,7 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa ...@@ -138,7 +140,7 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
administerDO.setCompanyId(companyDictDO.getId()); administerDO.setCompanyId(companyDictDO.getId());
administerDO.setPassword("admin123"); administerDO.setPassword("admin123");
administerDO.setStatus("1"); administerDO.setStatus("1");
administerDO.setRole(1); //administerDO.setRole(1);
administerMapper.insert(administerDO); administerMapper.insert(administerDO);
RoleAdministerMappingDO roleAdministerMappingDO = new RoleAdministerMappingDO(); RoleAdministerMappingDO roleAdministerMappingDO = new RoleAdministerMappingDO();
...@@ -164,7 +166,7 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa ...@@ -164,7 +166,7 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
classHourDictDO2.setRepeatStatus(0); classHourDictDO2.setRepeatStatus(0);
classHourDictDO2.setRepeatTime(3); classHourDictDO2.setRepeatTime(3);
redisUtil.set(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + companyDictDO.getId(), classHourDictDO2); //redisUtil.set(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + companyDictDO.getId(), classHourDictDO2);
classHourDictMapper.insert(classHourDictDO2); classHourDictMapper.insert(classHourDictDO2);
//行业 //行业
...@@ -194,6 +196,15 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa ...@@ -194,6 +196,15 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
rankDictMapper.insert(rankDictDO); rankDictMapper.insert(rankDictDO);
} }
//初始化轮播图
List<RotationImgDictDO> rotationImgDictDOS = rotationImgDictMapper.selectList(new QueryWrapper<RotationImgDictDO>()
.lambda()
.isNull(RotationImgDictDO::getCompanyId));
for (RotationImgDictDO rotationImgDictDO : rotationImgDictDOS){
rotationImgDictDO.setCompanyId(companyDictDO.getId());
rotationImgDictMapper.insert(rotationImgDictDO);
}
//班级类型 //班级类型
ClassTypeDictDO classTypeDictDO = new ClassTypeDictDO(); ClassTypeDictDO classTypeDictDO = new ClassTypeDictDO();
classTypeDictDO.setClassType("企业内训"); classTypeDictDO.setClassType("企业内训");
...@@ -210,7 +221,7 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa ...@@ -210,7 +221,7 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
.lambda() .lambda()
.eq(AdministerDO::getCompanyId, companyDictDO.getId())); .eq(AdministerDO::getCompanyId, companyDictDO.getId()));
redisUtil.del(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + companyDictDO.getId()); //redisUtil.del(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + companyDictDO.getId());
return ConstantUtils.DELETE_SUCCESS; return ConstantUtils.DELETE_SUCCESS;
} }
...@@ -235,10 +246,8 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa ...@@ -235,10 +246,8 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
} }
//查找企业管理员 //查找企业管理员
AdministerDO administerDO = administerMapper.selectOne(new QueryWrapper<AdministerDO>() AdministerDO administerDO = roleAdministerMappingMapper.getAdminister(addCompanyDTO.getId());
.lambda()
.eq(AdministerDO::getCompanyId, addCompanyDTO.getId())
.eq(AdministerDO::getRole, 1));
if (StringUtils.isNotBlank(addCompanyDTO.getAccountName())) { if (StringUtils.isNotBlank(addCompanyDTO.getAccountName())) {
administerDO.setAccountName(addCompanyDTO.getAccountName()); administerDO.setAccountName(addCompanyDTO.getAccountName());
} }
......
...@@ -110,6 +110,7 @@ public class CourseDictServiceImpl extends ServiceImpl<CourseDictMapper, CourseD ...@@ -110,6 +110,7 @@ public class CourseDictServiceImpl extends ServiceImpl<CourseDictMapper, CourseD
CourseDictDO courseDictDO = new CourseDictDO(); CourseDictDO courseDictDO = new CourseDictDO();
BeanUtils.copyProperties(addCourseDTO, courseDictDO); BeanUtils.copyProperties(addCourseDTO, courseDictDO);
courseDictDO.setOpenStatus(0);
this.baseMapper.insert(courseDictDO); this.baseMapper.insert(courseDictDO);
if (null != addCourseDTO.getCategoryDOS()) { if (null != addCourseDTO.getCategoryDOS()) {
......
...@@ -8,12 +8,17 @@ import com.subsidy.dto.department.GetDepartmentMembersDTO; ...@@ -8,12 +8,17 @@ import com.subsidy.dto.department.GetDepartmentMembersDTO;
import com.subsidy.dto.department.GetDepartmentsVO; import com.subsidy.dto.department.GetDepartmentsVO;
import com.subsidy.mapper.MemberDepartmentMappingMapper; import com.subsidy.mapper.MemberDepartmentMappingMapper;
import com.subsidy.mapper.MemberMapper; import com.subsidy.mapper.MemberMapper;
import com.subsidy.model.AdministerDO;
import com.subsidy.model.DepartmentDictDO; import com.subsidy.model.DepartmentDictDO;
import com.subsidy.mapper.DepartmentDictMapper; import com.subsidy.mapper.DepartmentDictMapper;
import com.subsidy.model.MemberDO;
import com.subsidy.model.MemberDepartmentMappingDO; import com.subsidy.model.MemberDepartmentMappingDO;
import com.subsidy.service.DepartmentDictService; import com.subsidy.service.DepartmentDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils; import com.subsidy.util.ConstantUtils;
import com.subsidy.vo.department.GetMembersVO;
import com.subsidy.vo.member.MemberVodVO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
...@@ -53,10 +58,10 @@ public class DepartmentDictServiceImpl extends ServiceImpl<DepartmentDictMapper, ...@@ -53,10 +58,10 @@ public class DepartmentDictServiceImpl extends ServiceImpl<DepartmentDictMapper,
GetDepartmentsVO getDepartmentsVO = new GetDepartmentsVO(); GetDepartmentsVO getDepartmentsVO = new GetDepartmentsVO();
BeanUtils.copyProperties(dd, getDepartmentsVO); BeanUtils.copyProperties(dd, getDepartmentsVO);
Integer count = memberDepartmentMappingMapper.selectCount(new QueryWrapper<MemberDepartmentMappingDO>() //Integer count = memberDepartmentMappingMapper.selectCount(new QueryWrapper<MemberDepartmentMappingDO>()
.lambda() // .lambda()
.eq(MemberDepartmentMappingDO::getDepartmentId, dd.getId())); // .eq(MemberDepartmentMappingDO::getDepartmentId, dd.getId()));
getDepartmentsVO.setCnt(count); //getDepartmentsVO.setCnt(count);
getDepartmentsVO.setChildren(getChildNodes(getDepartmentsVO)); getDepartmentsVO.setChildren(getChildNodes(getDepartmentsVO));
DepartmentDictDO departmentDictDO1 = this.baseMapper.selectById(dd.getParentId()); DepartmentDictDO departmentDictDO1 = this.baseMapper.selectById(dd.getParentId());
if (null != departmentDictDO1) { if (null != departmentDictDO1) {
...@@ -107,16 +112,32 @@ public class DepartmentDictServiceImpl extends ServiceImpl<DepartmentDictMapper, ...@@ -107,16 +112,32 @@ public class DepartmentDictServiceImpl extends ServiceImpl<DepartmentDictMapper,
public String addDepartment(DepartmentDictDO departmentDictDO) { public String addDepartment(DepartmentDictDO departmentDictDO) {
DepartmentDictDO departmentDictDO1 = departmentDictDO;
Integer counter = this.baseMapper.selectCount(new QueryWrapper<DepartmentDictDO>() Integer counter = this.baseMapper.selectCount(new QueryWrapper<DepartmentDictDO>()
.lambda() .lambda()
.eq(DepartmentDictDO::getCompanyId, departmentDictDO.getCompanyId()) .eq(DepartmentDictDO::getCompanyId, departmentDictDO.getCompanyId())
.eq(DepartmentDictDO::getDepartmentName, departmentDictDO.getDepartmentName())); .eq(DepartmentDictDO::getFullName, departmentDictDO.getFullName()));
if (counter > 0) { if (counter > 0) {
throw new HttpException(30001); throw new HttpException(30001);
} }
this.baseMapper.insert(departmentDictDO); List<String> 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; return ConstantUtils.ADD_SUCCESS;
} }
...@@ -170,13 +191,93 @@ public class DepartmentDictServiceImpl extends ServiceImpl<DepartmentDictMapper, ...@@ -170,13 +191,93 @@ public class DepartmentDictServiceImpl extends ServiceImpl<DepartmentDictMapper,
if (null != getDepartmentMembersDTO.getDepartmentId()){ if (null != getDepartmentMembersDTO.getDepartmentId()){
//查询某个部门 //查询某个部门
IPage iPage = memberMapper.getMembers(pager,getDepartmentMembersDTO.getDepartmentId(),getDepartmentMembersDTO.getUserName(),null); IPage iPage = memberMapper.getMembers(pager,getDepartmentMembersDTO.getDepartmentId(),getDepartmentMembersDTO.getUserName(),null,getDepartmentMembersDTO.getStartDate(),getDepartmentMembersDTO.getEndDate());
return iPage; return iPage;
}else { }else {
//查询整个公司 //查询整个公司
IPage iPage = memberMapper.manageMember(pager,getDepartmentMembersDTO.getCompanyId(),getDepartmentMembersDTO.getUserName()); IPage iPage = memberMapper.manageMember(pager,getDepartmentMembersDTO.getCompanyId(),getDepartmentMembersDTO.getUserName(),getDepartmentMembersDTO.getStartDate(),getDepartmentMembersDTO.getEndDate());
return iPage; return iPage;
} }
} }
public List<GetMembersVO> getMembers(GetDepartmentMembersDTO getDepartmentMembersDTO){
List<GetMembersVO> getMembersVOS = new ArrayList<>();
GetMembersVO getMembersVO = new GetMembersVO();
//找到父节点
DepartmentDictDO departmentDictDO = this.baseMapper.selectOne(new QueryWrapper<DepartmentDictDO>()
.lambda()
.eq(DepartmentDictDO::getCompanyId,getDepartmentMembersDTO.getCompanyId())
.isNull(DepartmentDictDO::getParentId));
BeanUtils.copyProperties(departmentDictDO,getMembersVO);
List<DepartmentDictDO> 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<MemberDO> memberDOS1 = memberMapper.getMemberWithoutPage(dpt.getId(),getMembersVO.getUserName(),null,null,null);
gmv.setMemberDOS(memberDOS1);
getMembersVOS.add(gmv);
}else {
//公司人员
List<MemberDO> memberDOS = memberMapper.selectList(new QueryWrapper<MemberDO>()
.lambda()
.eq(MemberDO::getCompanyId,getDepartmentMembersDTO.getCompanyId()));
gmv.setMemberDOS(memberDOS);
getMembersVOS.add(gmv);
}
}
return getMembersVOS;
}
/**
* 递归 带上部门总数,部门负责人等参数
*
* @param getMembersVO 父节点查找该节点的children
* @return 子节点
*/
public List<GetMembersVO> getChildNodes(GetMembersVO getMembersVO) {
List<GetMembersVO> getAllDepartmentVOS = new ArrayList<>();
//查询该节点的子节点
List<DepartmentDictDO> departmentDictDOS = this.baseMapper.selectList(new QueryWrapper<DepartmentDictDO>()
.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<MemberDO> memberDOS = memberMapper.getMemberWithoutPage(dd.getId(),getMembersVO.getUserName(),null,null,null);
gmv.setMemberDOS(memberDOS);
getAllDepartmentVOS.add(gmv);
}
if (departmentDictDOS.size() == 0) {
return null;
}
return getAllDepartmentVOS;
}
} }
...@@ -8,16 +8,19 @@ import com.subsidy.common.RedisPrefixConstant; ...@@ -8,16 +8,19 @@ import com.subsidy.common.RedisPrefixConstant;
import com.subsidy.common.exception.HttpException; import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.administer.VerifyCodeDTO; import com.subsidy.dto.administer.VerifyCodeDTO;
import com.subsidy.dto.member.AddMemberDTO; import com.subsidy.dto.member.AddMemberDTO;
import com.subsidy.dto.member.ChangeDepartmentsDTO;
import com.subsidy.dto.member.ContentMemberDTO; import com.subsidy.dto.member.ContentMemberDTO;
import com.subsidy.dto.member.GetAllDTO; import com.subsidy.dto.member.GetAllDTO;
import com.subsidy.dto.member.MyCoursesDTO; import com.subsidy.dto.member.MyCoursesDTO;
import com.subsidy.dto.member.PasswordLoginDTO; import com.subsidy.dto.member.PasswordLoginDTO;
import com.subsidy.dto.member.StudyHistoryDTO; import com.subsidy.dto.member.StudyHistoryDTO;
import com.subsidy.mapper.ClassDictMapper; import com.subsidy.mapper.ClassDictMapper;
import com.subsidy.mapper.ClassHourDictMapper;
import com.subsidy.mapper.ClassMemberMappingMapper; import com.subsidy.mapper.ClassMemberMappingMapper;
import com.subsidy.mapper.CompanyDictMapper; import com.subsidy.mapper.CompanyDictMapper;
import com.subsidy.mapper.CourseContentMapper; import com.subsidy.mapper.CourseContentMapper;
import com.subsidy.mapper.CourseFieldMappingMapper; import com.subsidy.mapper.CourseFieldMappingMapper;
import com.subsidy.mapper.DepartmentDictMapper;
import com.subsidy.mapper.ExerciseDoneResultMapper; import com.subsidy.mapper.ExerciseDoneResultMapper;
import com.subsidy.mapper.FileDictMapper; import com.subsidy.mapper.FileDictMapper;
import com.subsidy.mapper.JobDictMapper; import com.subsidy.mapper.JobDictMapper;
...@@ -26,6 +29,9 @@ import com.subsidy.mapper.MemberDepartmentMappingMapper; ...@@ -26,6 +29,9 @@ import com.subsidy.mapper.MemberDepartmentMappingMapper;
import com.subsidy.mapper.MemberMapper; import com.subsidy.mapper.MemberMapper;
import com.subsidy.mapper.OprMemDictMapper; import com.subsidy.mapper.OprMemDictMapper;
import com.subsidy.mapper.PaperDictMapper; 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.mapper.VodPlayHistoryMapper;
import com.subsidy.model.ClassDictDO; import com.subsidy.model.ClassDictDO;
import com.subsidy.model.ClassHourDictDO; import com.subsidy.model.ClassHourDictDO;
...@@ -41,10 +47,12 @@ import com.subsidy.model.JobMemberMappingDO; ...@@ -41,10 +47,12 @@ import com.subsidy.model.JobMemberMappingDO;
import com.subsidy.model.MemberDO; import com.subsidy.model.MemberDO;
import com.subsidy.model.MemberDepartmentMappingDO; import com.subsidy.model.MemberDepartmentMappingDO;
import com.subsidy.model.OprMemDictDO; import com.subsidy.model.OprMemDictDO;
import com.subsidy.model.RotationImgDictDO;
import com.subsidy.model.SmsVerifyCodeDO;
import com.subsidy.model.VodDictDO; import com.subsidy.model.VodDictDO;
import com.subsidy.service.MemberService; import com.subsidy.service.MemberService;
import com.subsidy.util.ConstantUtils; 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.administer.UserRoleVO;
import com.subsidy.vo.member.ContentFilesVO; import com.subsidy.vo.member.ContentFilesVO;
import com.subsidy.vo.member.ContentVodNewVO; import com.subsidy.vo.member.ContentVodNewVO;
...@@ -106,8 +114,8 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -106,8 +114,8 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
@Autowired @Autowired
private MemberDepartmentMappingMapper memberDepartmentMappingMapper; private MemberDepartmentMappingMapper memberDepartmentMappingMapper;
@Autowired //@Autowired
private RedisUtil redisUtil; //private RedisUtil redisUtil;
@Autowired @Autowired
private CourseFieldMappingMapper courseFieldMappingMapper; private CourseFieldMappingMapper courseFieldMappingMapper;
...@@ -124,9 +132,33 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -124,9 +132,33 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
@Autowired @Autowired
private JobMemberMappingMapper jobMemberMappingMapper; 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<GetAllVO> getAll(GetAllDTO getAllDTO) { public IPage<GetAllVO> getAll(GetAllDTO getAllDTO) {
Page pager = new Page(getAllDTO.getPageNum(), getAllDTO.getPageSize()); Page pager = new Page(getAllDTO.getPageNum(), getAllDTO.getPageSize());
IPage iPage = this.baseMapper.getMembers(pager, getAllDTO.getDepartmentId(), getAllDTO.getUserName(), getAllDTO.getStatus());
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<GetAllVO> getAllVOS = iPage.getRecords(); List<GetAllVO> getAllVOS = iPage.getRecords();
for (GetAllVO getAllVO : getAllVOS) { for (GetAllVO getAllVO : getAllVOS) {
...@@ -181,7 +213,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -181,7 +213,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
//公司赋值 //公司赋值
memberDO.setCompanyId(addMemberDTO.getCompanyId()); memberDO.setCompanyId(addMemberDTO.getCompanyId());
this.baseMapper.insert(memberDO); this.baseMapper.insert(memberDO);
redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO); //redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
if (null != addMemberDTO.getDepartmentIds()) { if (null != addMemberDTO.getDepartmentIds()) {
//部门 //部门
...@@ -238,8 +270,8 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -238,8 +270,8 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
MemberDO memberDO = new MemberDO(); MemberDO memberDO = new MemberDO();
BeanUtils.copyProperties(addMemberDTO, memberDO); BeanUtils.copyProperties(addMemberDTO, memberDO);
this.baseMapper.updateById(memberDO); this.baseMapper.updateById(memberDO);
MemberDO memberDO1 = this.baseMapper.selectById(addMemberDTO.getId()); //MemberDO memberDO1 = this.baseMapper.selectById(addMemberDTO.getId());
redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO1); //redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO1);
if (null != addMemberDTO.getDepartmentIds()) { if (null != addMemberDTO.getDepartmentIds()) {
memberDepartmentMappingMapper.delete(new QueryWrapper<MemberDepartmentMappingDO>() memberDepartmentMappingMapper.delete(new QueryWrapper<MemberDepartmentMappingDO>()
...@@ -308,13 +340,18 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -308,13 +340,18 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
if (0 == memberDO.getFirstLogin()) { if (0 == memberDO.getFirstLogin()) {
memberDO.setFirstLogin(1); memberDO.setFirstLogin(1);
this.baseMapper.updateById(memberDO); this.baseMapper.updateById(memberDO);
redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO); //redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
} }
BeanUtils.copyProperties(memberDO, userRoleVO); BeanUtils.copyProperties(memberDO, userRoleVO);
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<SmsVerifyCodeDO>()
.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 oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录"); oprMemDictDO.setOprType("登录");
...@@ -340,6 +377,13 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -340,6 +377,13 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
//oprMemDictDO.setCompanyName(companyDictDO.getCompanyName()); //oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
oprMemDictMapper.insert(oprMemDictDO); oprMemDictMapper.insert(oprMemDictDO);
//mongoTemplate.insert(oprMemDictDO); //mongoTemplate.insert(oprMemDictDO);
userRoleVO.setCompanyId(companyDictDO.getId());
userRoleVO.setCompanyName(companyDictDO.getCompanyName());
userRoleVO.setLogo(companyDictDO.getLogo());
List<RotationImgDictDO> rotationImgDictDOS = rotationImgDictMapper.selectList(new QueryWrapper<RotationImgDictDO>()
.lambda()
.eq(RotationImgDictDO::getCompanyId, companyDictDO.getId()));
userRoleVO.setRotationImgDictDOS(rotationImgDictDOS);
return userRoleVO; return userRoleVO;
} }
...@@ -347,7 +391,8 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -347,7 +391,8 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
/** /**
* 先从redis里查 * 先从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) { if (null == memberDO) {
/** /**
* redis里没有,从数据库里查 * redis里没有,从数据库里查
...@@ -363,9 +408,11 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -363,9 +408,11 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
CompanyDictDO companyDictDO = companyDictMapper.selectById(memberDO.getCompanyId()); CompanyDictDO companyDictDO = companyDictMapper.selectById(memberDO.getCompanyId());
if (memberDO.getPassword().equals(passwordLoginDTO.getPassword()) && 1 == memberDO.getFirstLogin() && !"冻结".equals(memberDO.getStatus())) { if (memberDO.getPassword().equals(passwordLoginDTO.getPassword()) && 1 == memberDO.getFirstLogin() && !"冻结".equals(memberDO.getStatus())) {
MemberVO memberVO = new MemberVO(); MemberVO memberVO = new MemberVO();
BeanUtils.copyProperties(memberDO, memberVO); BeanUtils.copyProperties(memberDO, memberVO);
memberVO.setCompanyId(companyDictDO.getId());
memberVO.setCompanyName(companyDictDO.getCompanyName()); memberVO.setCompanyName(companyDictDO.getCompanyName());
OprMemDictDO oprMemDictDO = new OprMemDictDO(); OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setUserId(memberDO.getId());
...@@ -378,7 +425,14 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -378,7 +425,14 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
//oprMemDictDO.setCompanyName(companyDictDO.getCompanyName()); //oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
//mongoTemplate.insert(oprMemDictDO); //mongoTemplate.insert(oprMemDictDO);
oprMemDictMapper.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<RotationImgDictDO> rotationImgDictDOS = rotationImgDictMapper.selectList(new QueryWrapper<RotationImgDictDO>()
.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); //redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + System.currentTimeMillis(), 1);
return memberVO; return memberVO;
} else { } else {
...@@ -421,8 +475,8 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -421,8 +475,8 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
public String updatePassword(MemberDO memberDO) { public String updatePassword(MemberDO memberDO) {
this.baseMapper.updateById(memberDO); this.baseMapper.updateById(memberDO);
MemberDO memberDO1 = this.baseMapper.selectById(memberDO.getId()); //MemberDO memberDO1 = this.baseMapper.selectById(memberDO.getId());
redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO1.getCompanyId() + ":" + memberDO.getAccountName(), memberDO); //redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO1.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
return ConstantUtils.SET_SUCCESS; return ConstantUtils.SET_SUCCESS;
} }
...@@ -490,23 +544,49 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -490,23 +544,49 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
.eq(CourseContentDO::getCourseId, contentVodDTO.getCourseId()) .eq(CourseContentDO::getCourseId, contentVodDTO.getCourseId())
.orderByAsc(CourseContentDO::getOrderNo)); .orderByAsc(CourseContentDO::getOrderNo));
ClassDictDO classDictDO1 = classDictMapper.selectById(contentVodDTO.getClassId());
//目录状态
Boolean contentStatus = true;
for (CourseContentDO courseContentDO : courseContentDOS) { for (CourseContentDO courseContentDO : courseContentDOS) {
ContentVodVO contentVodVO = new ContentVodVO(); ContentVodVO contentVodVO = new ContentVodVO();
contentVodVO.setContent(courseContentDO.getContent()); contentVodVO.setContent(courseContentDO.getContent());
List<MemberVodVO> memberVodVOS = courseContentMapper.contentVodProcess(courseContentDO.getId(), contentVodDTO.getMemberId()); List<MemberVodVO> memberVodVOS = courseContentMapper.contentVodProcess(courseContentDO.getId(), contentVodDTO.getMemberId(),contentVodDTO.getClassId());
Boolean flag = false; Boolean flag = false;
int i = 0;
if (1 == classDictDO1.getIsOrder()) {
for (MemberVodVO memberVodVO : memberVodVOS) { for (MemberVodVO memberVodVO : memberVodVOS) {
if (memberVodVO.getPercent() == 100 && !flag) {
if (i == 0 && contentStatus) {
//第一个视频默认打开
memberVodVO.setStatus(true);
} else if (memberVodVO.getPercent() == 100) {
//这个视频看完了,已解锁 //这个视频看完了,已解锁
memberVodVO.setStatus(true); memberVodVO.setStatus(true);
} else { } else {
//这个视频没看完,未解锁 //这个视频没看完,未解锁
memberVodVO.setStatus(false); if (!flag) {
//这个视频可见 ===> 第一个没看完但可以看的视频
memberVodVO.setStatus(true);
flag = true; flag = true;
} else {
memberVodVO.setStatus(false);
}
contentStatus = false;
}
i++;
} }
} else {
for (MemberVodVO memberVodVO : memberVodVOS) {
memberVodVO.setStatus(true);
} }
}
int playCount = 0; int playCount = 0;
for (MemberVodVO memberVodVO : memberVodVOS) { for (MemberVodVO memberVodVO : memberVodVOS) {
if (100 == memberVodVO.getPercent()) { if (100 == memberVodVO.getPercent()) {
...@@ -567,10 +647,10 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -567,10 +647,10 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
List<QueryPapersVO> queryPapersVOS = paperDictMapper.queryPapers(contentMemberDTO.getCourseId(), null, 1); List<QueryPapersVO> queryPapersVOS = paperDictMapper.queryPapers(contentMemberDTO.getCourseId(), null, 1);
for (QueryPapersVO queryPapersVO : queryPapersVOS) { for (QueryPapersVO queryPapersVO : queryPapersVOS) {
//多少人已完成 //多少人已完成
Integer cnt = paperDictMapper.completeCount(queryPapersVO.getId()); Integer cnt = paperDictMapper.completeCount(queryPapersVO.getId(),contentMemberDTO.getClassId());
queryPapersVO.setCompleteCnt(cnt); queryPapersVO.setCompleteCnt(cnt);
//自己成绩 //自己成绩
List<ExerciseDoneResultDO> exerciseDoneResultDOS = exerciseDoneResultMapper.getMaxScorePaper(queryPapersVO.getId(), contentMemberDTO.getMemberId()); List<ExerciseDoneResultDO> exerciseDoneResultDOS = exerciseDoneResultMapper.getMaxScorePaper(queryPapersVO.getId(), contentMemberDTO.getMemberId(),contentMemberDTO.getClassId());
if (exerciseDoneResultDOS.size() > 0) { if (exerciseDoneResultDOS.size() > 0) {
queryPapersVO.setRightCounts(exerciseDoneResultDOS.get(0).getRightCounts()); queryPapersVO.setRightCounts(exerciseDoneResultDOS.get(0).getRightCounts());
...@@ -607,7 +687,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -607,7 +687,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) { for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) {
List<VodDictDO> vodDictDOS = classDictMapper.getClassVods(classMemberMappingDO.getClassId()); List<VodDictDO> vodDictDOS = classDictMapper.getClassVods(classMemberMappingDO.getClassId());
for (VodDictDO vodDictDO : vodDictDOS) { for (VodDictDO vodDictDO : vodDictDOS) {
int playLength = vodPlayHistoryMapper.memberVodTotalLength(memberDO.getId(), vodDictDO.getId()); int playLength = vodPlayHistoryMapper.memberVodTotalLength(memberDO.getId(), vodDictDO.getId(), classMemberMappingDO.getClassId());
if (playLength < vodDictDO.getVodLength()) { if (playLength < vodDictDO.getVodLength()) {
break; break;
} }
...@@ -631,7 +711,9 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -631,7 +711,9 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
public String checkTimes(ExerciseDoneResultDO exerciseDoneResultDO) { public String checkTimes(ExerciseDoneResultDO exerciseDoneResultDO) {
MemberDO memberDO = this.baseMapper.selectById(exerciseDoneResultDO.getMemberId()); MemberDO memberDO = this.baseMapper.selectById(exerciseDoneResultDO.getMemberId());
ClassHourDictDO classHourDictDO = (ClassHourDictDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + memberDO.getCompanyId()); ClassHourDictDO classHourDictDO = classHourDictMapper.selectOne(new QueryWrapper<ClassHourDictDO>()
.lambda()
.eq(ClassHourDictDO::getCompanyId, memberDO.getCompanyId()));
if (null != classHourDictDO) { if (null != classHourDictDO) {
Integer status = classHourDictDO.getRepeatStatus(); Integer status = classHourDictDO.getRepeatStatus();
...@@ -655,8 +737,32 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -655,8 +737,32 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
public void importRedis() { public void importRedis() {
List<MemberDO> memberDOS = this.baseMapper.selectList(null); List<MemberDO> memberDOS = this.baseMapper.selectList(null);
for (MemberDO memberDO : memberDOS) { for (MemberDO memberDO : memberDOS) {
redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO); //redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
} }
} }
public String changeDepartments(ChangeDepartmentsDTO changeDepartmentsDTO) {
List<Long> memberIds = changeDepartmentsDTO.getMemberIds();
//清掉以前的部门
for (Long lg : memberIds) {
memberDepartmentMappingMapper.delete(new QueryWrapper<MemberDepartmentMappingDO>()
.lambda()
.eq(MemberDepartmentMappingDO::getMemberId, lg));
}
//加入新的部门
List<Long> 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;
}
} }
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;
/**
* <p>
* 轮播图 服务实现类
* </p>
*
* @author DengMin
* @since 2022-02-23
*/
@Service
public class RotationImgDictServiceImpl extends ServiceImpl<RotationImgDictMapper, RotationImgDictDO> 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<RotationImgDictDO> getAllRotations(RotationImgDictDO rotationImgDictDO){
return this.baseMapper.selectList(new QueryWrapper<RotationImgDictDO>()
.lambda()
.eq(RotationImgDictDO::getCompanyId,rotationImgDictDO.getCompanyId()));
}
}
...@@ -4,15 +4,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -4,15 +4,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.common.RedisPrefixConstant;
import com.subsidy.dto.member.GetMemberSignInfoDTO; import com.subsidy.dto.member.GetMemberSignInfoDTO;
import com.subsidy.dto.sign.DataViewDTO; import com.subsidy.dto.sign.DataViewDTO;
import com.subsidy.mapper.AnsweringQuestionMapper; import com.subsidy.mapper.AnsweringQuestionMapper;
import com.subsidy.mapper.ClassDictMapper; import com.subsidy.mapper.ClassDictMapper;
import com.subsidy.mapper.ClassHourDictMapper;
import com.subsidy.mapper.ClassMemberMappingMapper; import com.subsidy.mapper.ClassMemberMappingMapper;
import com.subsidy.mapper.ExerciseDoneResultMapper; import com.subsidy.mapper.ExerciseDoneResultMapper;
import com.subsidy.mapper.MemberMapper;
import com.subsidy.mapper.SignInRecordMapper; import com.subsidy.mapper.SignInRecordMapper;
import com.subsidy.mapper.VodPlayHistoryMapper; import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.model.AnsweringQuestionDO; import com.subsidy.model.AnsweringQuestionDO;
...@@ -24,22 +21,19 @@ import com.subsidy.model.VodDictDO; ...@@ -24,22 +21,19 @@ import com.subsidy.model.VodDictDO;
import com.subsidy.service.SignInRecordService; import com.subsidy.service.SignInRecordService;
import com.subsidy.util.ConstantUtils; import com.subsidy.util.ConstantUtils;
import com.subsidy.util.DateFormatUtil; import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.MathUtil;
import com.subsidy.util.MyBeanUtils;
import com.subsidy.util.RedisUtil;
import com.subsidy.vo.member.GetMemberSignInfoVO; import com.subsidy.vo.member.GetMemberSignInfoVO;
import com.subsidy.vo.sign.DataViewVO; import com.subsidy.vo.sign.DataViewVO;
import com.subsidy.vo.sign.SignInStatusVO; import com.subsidy.vo.sign.SignInStatusVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Set;
//import com.subsidy.util.RedisUtil;
/** /**
* <p> * <p>
...@@ -58,8 +52,8 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig ...@@ -58,8 +52,8 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
@Autowired @Autowired
private VodPlayHistoryMapper vodPlayHistoryMapper; private VodPlayHistoryMapper vodPlayHistoryMapper;
@Autowired //@Autowired
private RedisUtil redisUtil; //private RedisUtil redisUtil;
@Autowired @Autowired
private SignInRecordMapper signInRecordMapper; private SignInRecordMapper signInRecordMapper;
...@@ -89,11 +83,16 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig ...@@ -89,11 +83,16 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
List<ClassDictDO> classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId()); List<ClassDictDO> classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId());
for (ClassDictDO classDictDO : classDictDOS) { for (ClassDictDO classDictDO : classDictDOS) {
Set<String> set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + signInRecordDO.getClassId() + ":" + DateFormatUtil.format(signInRecordDO.getSignInDate(), "yyyy-MM-dd")+":*"); //Set<String> 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) { //if(set != null && set.size() > 0) {
redisUtil.del(set); // 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); //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<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getMemberId,signInRecordDO.getMemberId())
.eq(SignInRecordDO::getClassId,classDictDO.getId()));
// 存储到缓存到同时保存到数据库 // 存储到缓存到同时保存到数据库
SignInRecordDO sign = this.baseMapper.selectOne(new QueryWrapper<SignInRecordDO>() SignInRecordDO sign = this.baseMapper.selectOne(new QueryWrapper<SignInRecordDO>()
...@@ -159,7 +158,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig ...@@ -159,7 +158,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
//视频 //视频
int i = 0; int i = 0;
for (VodDictDO vodDictDO : vodDictDOS) { for (VodDictDO vodDictDO : vodDictDOS) {
int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classMemberMappingDO.getMemberId(), vodDictDO.getId()); int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classMemberMappingDO.getMemberId(), vodDictDO.getId(),classMemberMappingDO.getClassId());
if (totalPlayLength >= vodDictDO.getVodLength()) { if (totalPlayLength >= vodDictDO.getVodLength()) {
i++; i++;
} }
...@@ -196,13 +195,34 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig ...@@ -196,13 +195,34 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
Boolean flag = true; // 已经签过到了 Boolean flag = true; // 已经签过到了
signInStatusVO.setStatus(flag); signInStatusVO.setStatus(flag);
//获取有效课程 //获取有效课程
long count = classMemberMappingMapper.getMemberClassCount(signInRecordDO.getMemberId()); //long count = classMemberMappingMapper.getMemberClassCount(signInRecordDO.getMemberId());
long size = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + "*:" + DateFormatUtil.format(new Date(), "yyyy-MM-dd")+"*").stream().count(); //long size = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + "*:" + DateFormatUtil.format(new Date(), "yyyy-MM-dd")+"*").stream().count();
//List<SignInRecordDO> signInRecordDOS = signInRecordMapper.selectList(new QueryWrapper<SignInRecordDO>()
//.lambda()
//.eq(SignInRecordDO::getMemberId,signInRecordDO.getMemberId())
//.eq(SignInRecordDO::getClassId))
//if (size <= count) {
// signInStatusVO.setStatus(false);
//}
//获取有效课程
List<ClassDictDO> classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId());
if (size < count) {
signInStatusVO.setStatus(false);
}
for (ClassDictDO classDictDO : classDictDOS) {
Integer count = this.baseMapper.selectCount(new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getClassId, classDictDO.getId())
.eq(SignInRecordDO::getMemberId, signInRecordDO.getMemberId())
.gt(SignInRecordDO::getSignInDate, LocalDate.now()));
//String count = redisUtil.get("signInStatus:"+signInRecordDO.getMemberId()+":"+classDictDO.getId()).toString();
if (count == 0) {
flag = false; //没有签到
}
}
signInStatusVO.setStatus(flag);
return signInStatusVO; return signInStatusVO;
} }
...@@ -227,11 +247,11 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig ...@@ -227,11 +247,11 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
//} //}
//签到数据 //签到数据
List<SignInRecordDO> signInRecordDOS = signInRecordMapper.selectList(null); //List<SignInRecordDO> signInRecordDOS = signInRecordMapper.selectList(null);
for (SignInRecordDO signInRecordDO : signInRecordDOS){ //for (SignInRecordDO signInRecordDO : signInRecordDOS){
redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX+signInRecordDO.getMemberId()+":classId:"+ // 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); // signInRecordDO.getClassId()+":"+signInRecordDO.getSignInDate().toString().split("T")[0]+":"+signInRecordDO.getSignInDate().toInstant(ZoneOffset.of("+8")).toEpochMilli(),signInRecordDO);
} //}
// redisUtil.scan("*20220126*"); // redisUtil.scan("*20220126*");
// redisUtil.("*20220126*"); // redisUtil.("*20220126*");
......
...@@ -11,7 +11,6 @@ import com.subsidy.model.MemberDO; ...@@ -11,7 +11,6 @@ import com.subsidy.model.MemberDO;
import com.subsidy.model.SmsVerifyCodeDO; import com.subsidy.model.SmsVerifyCodeDO;
import com.subsidy.service.SmsVerifyCodeService; import com.subsidy.service.SmsVerifyCodeService;
import com.subsidy.util.RandomUtil; import com.subsidy.util.RandomUtil;
import com.subsidy.util.RedisUtil;
import com.subsidy.util.SMSUtils; import com.subsidy.util.SMSUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
...@@ -34,8 +33,8 @@ public class SmsVerifyCodeServiceImpl extends ServiceImpl<SmsVerifyCodeMapper, S ...@@ -34,8 +33,8 @@ public class SmsVerifyCodeServiceImpl extends ServiceImpl<SmsVerifyCodeMapper, S
@Autowired @Autowired
private MemberMapper memberMapper; private MemberMapper memberMapper;
@Autowired //@Autowired
private RedisUtil redisUtil; //private RedisUtil redisUtil;
public void sendVerifyCode(SendVerifyCodeDTO sendVerifyCodeDTO) { public void sendVerifyCode(SendVerifyCodeDTO sendVerifyCodeDTO) {
MemberDO memberDO = memberMapper.selectOne(new QueryWrapper<MemberDO>() MemberDO memberDO = memberMapper.selectOne(new QueryWrapper<MemberDO>()
...@@ -47,10 +46,15 @@ public class SmsVerifyCodeServiceImpl extends ServiceImpl<SmsVerifyCodeMapper, S ...@@ -47,10 +46,15 @@ public class SmsVerifyCodeServiceImpl extends ServiceImpl<SmsVerifyCodeMapper, S
String code = RandomUtil.getRandomCode(6); String code = RandomUtil.getRandomCode(6);
smsUtils.send(sendVerifyCodeDTO.getTelephone(), code); smsUtils.send(sendVerifyCodeDTO.getTelephone(), code);
/** /**
* 验证码存在redis * 验证码存在redis
*/ */
redisUtil.set(RedisPrefixConstant.SUBSIDY_TELEPHONE_PREFIX + sendVerifyCodeDTO.getTelephone(), code, 30 * 60); //redisUtil.set(RedisPrefixConstant.SUBSIDY_TELEPHONE_PREFIX + sendVerifyCodeDTO.getTelephone(), code, 30 * 60);
SmsVerifyCodeDO smsCodeDO = new SmsVerifyCodeDO();
smsCodeDO.setVerifyCode(code);
smsCodeDO.setTelephone(sendVerifyCodeDTO.getTelephone());
this.baseMapper.insert(smsCodeDO);
} }
} }
package com.subsidy.service.impl; package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...@@ -100,6 +101,22 @@ public class VodDictServiceImpl extends ServiceImpl<VodDictMapper, VodDictDO> im ...@@ -100,6 +101,22 @@ public class VodDictServiceImpl extends ServiceImpl<VodDictMapper, VodDictDO> im
} }
public String addVod(VodDictDO vodDictDO) { public String addVod(VodDictDO vodDictDO) {
//排序
int orderNo = 1;
List<VodDictDO> vodDictDOS = this.baseMapper.selectList(new QueryWrapper<VodDictDO>()
.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); this.baseMapper.insert(vodDictDO);
//测试环境就不转码了 //测试环境就不转码了
......
...@@ -2,6 +2,7 @@ package com.subsidy.service.impl; ...@@ -2,6 +2,7 @@ package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.FixDataTwoDTO;
import com.subsidy.dto.vod.RemainSecondsDTO; import com.subsidy.dto.vod.RemainSecondsDTO;
import com.subsidy.dto.vod.SignDatePlaysDTO; import com.subsidy.dto.vod.SignDatePlaysDTO;
...@@ -51,13 +52,49 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -51,13 +52,49 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
@Autowired @Autowired
private MemberStudyLengthMapper memberStudyLengthMapper; private MemberStudyLengthMapper memberStudyLengthMapper;
@Autowired
private ClassHourDictMapper classHourDictMapper;
@Autowired
private MemberMapper memberMapper;
public String insertHistory(VodPlayHistoryDO vodPlayHistoryDO) { public String insertHistory(VodPlayHistoryDO vodPlayHistoryDO) {
MemberDO memberDO = memberMapper.selectById(vodPlayHistoryDO.getMemberId());
//查看系统设定的时长
ClassHourDictDO classHourDictDO = classHourDictMapper.selectOne (new QueryWrapper<ClassHourDictDO>()
.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); vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO); this.baseMapper.insert(vodPlayHistoryDO);
return ConstantUtils.ADD_SUCCESS; return ConstantUtils.ADD_SUCCESS;
} }
public String insertHistoryNew(VodPlayHistoryDO vodPlayHistoryDO) { public String insertHistoryNew(VodPlayHistoryDO vodPlayHistoryDO) {
MemberDO memberDO = memberMapper.selectById(vodPlayHistoryDO.getMemberId());
//查看系统设定的时长
ClassHourDictDO classHourDictDO = classHourDictMapper.selectOne (new QueryWrapper<ClassHourDictDO>()
.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); vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO); this.baseMapper.insert(vodPlayHistoryDO);
return ConstantUtils.ADD_SUCCESS; return ConstantUtils.ADD_SUCCESS;
......
package com.subsidy.util; //package com.subsidy.util;
//
import com.google.common.collect.Sets; //import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j; //import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.jedis.JedisConnection; //import org.springframework.data.redis.connection.jedis.JedisConnection;
import org.springframework.data.redis.core.BoundListOperations; //import org.springframework.data.redis.core.BoundListOperations;
import org.springframework.data.redis.core.Cursor; //import org.springframework.data.redis.core.Cursor;
import org.springframework.data.redis.core.RedisCallback; //import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate; //import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ScanOptions; //import org.springframework.data.redis.core.ScanOptions;
import org.springframework.data.redis.serializer.RedisSerializer; //import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; //import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestMapping; //import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; //import org.springframework.web.bind.annotation.RestController;
import redis.clients.jedis.ScanParams; //import redis.clients.jedis.ScanParams;
import redis.clients.jedis.commands.JedisCommands; //import redis.clients.jedis.commands.JedisCommands;
import redis.clients.jedis.commands.MultiKeyCommands; //import redis.clients.jedis.commands.MultiKeyCommands;
//
import javax.annotation.Resource; //import javax.annotation.Resource;
import java.io.Serializable; //import java.io.Serializable;
import java.util.HashSet; //import java.util.HashSet;
import java.util.List; //import java.util.List;
import java.util.Map; //import java.util.Map;
import java.util.Set; //import java.util.Set;
import java.util.concurrent.TimeUnit; //import java.util.concurrent.TimeUnit;
//
/** ///**
* <p> // * <p>
* redisTemplate封装 // * redisTemplate封装
* </p> // * </p>
* // *
* @author DengMin // * @author DengMin
* @since 2020/12/17 // * @since 2020/12/17
*/ // */
//
@Component //@Component
public class RedisUtil { //public class RedisUtil {
//
//
@Autowired // @Autowired
private RedisTemplate<String, Object> redisTemplate; // private RedisTemplate<String, Object> redisTemplate;
//
public RedisUtil(RedisTemplate<String, Object> redisTemplate) { // public RedisUtil(RedisTemplate<String, Object> redisTemplate) {
this.redisTemplate = redisTemplate; // this.redisTemplate = redisTemplate;
} // }
//
/** // /**
* 指定缓存失效时间 // * 指定缓存失效时间
* @param key 键 // * @param key 键
* @param time 时间(秒) // * @param time 时间(秒)
* @return // * @return
*/ // */
public boolean expire(String key,long time){ // public boolean expire(String key,long time){
try { // try {
if(time>0){ // if(time>0){
redisTemplate.expire(key, time, TimeUnit.SECONDS); // redisTemplate.expire(key, time, TimeUnit.SECONDS);
} // }
return true; // return true;
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return false; // return false;
} // }
} // }
//
/** // /**
* 根据key 获取过期时间 // * 根据key 获取过期时间
* @param key 键 不能为null // * @param key 键 不能为null
* @return 时间(秒) 返回0代表为永久有效 // * @return 时间(秒) 返回0代表为永久有效
*/ // */
public long getExpire(String key){ // public long getExpire(String key){
return redisTemplate.getExpire(key,TimeUnit.SECONDS); // return redisTemplate.getExpire(key,TimeUnit.SECONDS);
} // }
//
/** // /**
* 判断key是否存在 // * 判断key是否存在
* @param key 键 // * @param key 键
* @return true 存在 false不存在 // * @return true 存在 false不存在
*/ // */
public boolean hasKey(String key){ // public boolean hasKey(String key){
try { // try {
return redisTemplate.hasKey(key); // return redisTemplate.hasKey(key);
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return false; // return false;
} // }
} // }
//
/** // /**
* 删除缓存 // * 删除缓存
* @param key 可以传一个值 或多个 // * @param key 可以传一个值 或多个
*/ // */
@SuppressWarnings("unchecked") // @SuppressWarnings("unchecked")
public void del(String ... key){ // public void del(String ... key){
if(key!=null&&key.length>0){ // if(key!=null&&key.length>0){
if(key.length==1){ // if(key.length==1){
redisTemplate.delete(key[0]); // redisTemplate.delete(key[0]);
}else{ // }else{
redisTemplate.delete(CollectionUtils.arrayToList(key)); // redisTemplate.delete(CollectionUtils.arrayToList(key));
} // }
} // }
} // }
//
/** // /**
* 删除缓存 // * 删除缓存
* @param key 集合数据 // * @param key 集合数据
*/ // */
public void del(Set<String> key) { // public void del(Set<String> key) {
if (key != null && key.size() > 0) { // if (key != null && key.size() > 0) {
redisTemplate.delete(key); // redisTemplate.delete(key);
} // }
} // }
//
//============================String============================= // //============================String=============================
/** // /**
* 普通缓存获取 // * 普通缓存获取
* @param key 键 // * @param key 键
* @return 值 // * @return 值
*/ // */
public Object get(String key){ // public Object get(String key){
return key==null?null:redisTemplate.opsForValue().get(key); // return key==null?null:redisTemplate.opsForValue().get(key);
} // }
//
/** // /**
* 普通缓存放入 // * 普通缓存放入
* @param key 键 // * @param key 键
* @param value 值 // * @param value 值
* @return true成功 false失败 // * @return true成功 false失败
*/ // */
public boolean set(String key,Object value) { // public boolean set(String key,Object value) {
try { // try {
redisTemplate.opsForValue().set(key, value); // redisTemplate.opsForValue().set(key, value);
return true; // return true;
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return false; // return false;
} // }
} // }
//
/** // /**
* 普通缓存放入并设置时间 // * 普通缓存放入并设置时间
* @param key 键 // * @param key 键
* @param value 值 // * @param value 值
* @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期 // * @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期
* @return true成功 false 失败 // * @return true成功 false 失败
*/ // */
public boolean set(String key,Object value,long time){ // public boolean set(String key,Object value,long time){
try { // try {
if(time>0){ // if(time>0){
redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS); // redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
}else{ // }else{
set(key, value); // set(key, value);
} // }
return true; // return true;
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return false; // return false;
} // }
} // }
//
/** // /**
* 递增 // * 递增
* @param key 键 // * @param key 键
* @param delta 要增加几(大于0) // * @param delta 要增加几(大于0)
* @return // * @return
*/ // */
public long incr(String key, long delta){ // public long incr(String key, long delta){
if(delta<0){ // if(delta<0){
throw new RuntimeException("递增因子必须大于0"); // throw new RuntimeException("递增因子必须大于0");
} // }
return redisTemplate.opsForValue().increment(key, delta); // return redisTemplate.opsForValue().increment(key, delta);
} // }
//
/** // /**
* 递减 // * 递减
* @param key 键 // * @param key 键
* @param delta 要减少几(小于0) // * @param delta 要减少几(小于0)
* @return // * @return
*/ // */
public long decr(String key, long delta){ // public long decr(String key, long delta){
if(delta<0){ // if(delta<0){
throw new RuntimeException("递减因子必须大于0"); // throw new RuntimeException("递减因子必须大于0");
} // }
return redisTemplate.opsForValue().increment(key, -delta); // return redisTemplate.opsForValue().increment(key, -delta);
} // }
//
//================================Map================================= // //================================Map=================================
/** // /**
* HashGet // * HashGet
* @param key 键 不能为null // * @param key 键 不能为null
* @param item 项 不能为null // * @param item 项 不能为null
* @return 值 // * @return 值
*/ // */
public Object hget(String key,String item){ // public Object hget(String key,String item){
return redisTemplate.opsForHash().get(key, item); // return redisTemplate.opsForHash().get(key, item);
} // }
//
/** // /**
* 获取hashKey对应的所有键值 // * 获取hashKey对应的所有键值
* @param key 键 // * @param key 键
* @return 对应的多个键值 // * @return 对应的多个键值
*/ // */
public Map<Object,Object> hmget(String key){ // public Map<Object,Object> hmget(String key){
return redisTemplate.opsForHash().entries(key); // return redisTemplate.opsForHash().entries(key);
} // }
//
/** // /**
* HashSet // * HashSet
* @param key 键 // * @param key 键
* @param map 对应多个键值 // * @param map 对应多个键值
* @return true 成功 false 失败 // * @return true 成功 false 失败
*/ // */
public boolean hmset(String key, Map<String,Object> map){ // public boolean hmset(String key, Map<String,Object> map){
try { // try {
redisTemplate.opsForHash().putAll(key, map); // redisTemplate.opsForHash().putAll(key, map);
return true; // return true;
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return false; // return false;
} // }
} // }
//
/** // /**
* HashSet 并设置时间 // * HashSet 并设置时间
* @param key 键 // * @param key 键
* @param map 对应多个键值 // * @param map 对应多个键值
* @param time 时间(秒) // * @param time 时间(秒)
* @return true成功 false失败 // * @return true成功 false失败
*/ // */
public boolean hmset(String key, Map<String,Object> map, long time){ // public boolean hmset(String key, Map<String,Object> map, long time){
try { // try {
redisTemplate.opsForHash().putAll(key, map); // redisTemplate.opsForHash().putAll(key, map);
if(time>0){ // if(time>0){
expire(key, time); // expire(key, time);
} // }
return true; // return true;
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return false; // return false;
} // }
} // }
//
/** // /**
* 向一张hash表中放入数据,如果不存在将创建 // * 向一张hash表中放入数据,如果不存在将创建
* @param key 键 // * @param key 键
* @param item 项 // * @param item 项
* @param value 值 // * @param value 值
* @return true 成功 false失败 // * @return true 成功 false失败
*/ // */
public boolean hset(String key,String item,Object value) { // public boolean hset(String key,String item,Object value) {
try { // try {
redisTemplate.opsForHash().put(key, item, value); // redisTemplate.opsForHash().put(key, item, value);
return true; // return true;
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return false; // return false;
} // }
} // }
//
/** // /**
* 向一张hash表中放入数据,如果不存在将创建 // * 向一张hash表中放入数据,如果不存在将创建
* @param key 键 // * @param key 键
* @param item 项 // * @param item 项
* @param value 值 // * @param value 值
* @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间 // * @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间
* @return true 成功 false失败 // * @return true 成功 false失败
*/ // */
public boolean hset(String key,String item,Object value,long time) { // public boolean hset(String key,String item,Object value,long time) {
try { // try {
redisTemplate.opsForHash().put(key, item, value); // redisTemplate.opsForHash().put(key, item, value);
if(time>0){ // if(time>0){
expire(key, time); // expire(key, time);
} // }
return true; // return true;
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return false; // return false;
} // }
} // }
//
/** // /**
* 删除hash表中的值 // * 删除hash表中的值
* @param key 键 不能为null // * @param key 键 不能为null
* @param item 项 可以使多个 不能为null // * @param item 项 可以使多个 不能为null
*/ // */
public void hdel(String key, Object... item){ // public void hdel(String key, Object... item){
redisTemplate.opsForHash().delete(key,item); // redisTemplate.opsForHash().delete(key,item);
} // }
//
/** // /**
* 判断hash表中是否有该项的值 // * 判断hash表中是否有该项的值
* @param key 键 不能为null // * @param key 键 不能为null
* @param item 项 不能为null // * @param item 项 不能为null
* @return true 存在 false不存在 // * @return true 存在 false不存在
*/ // */
public boolean hHasKey(String key, String item){ // public boolean hHasKey(String key, String item){
return redisTemplate.opsForHash().hasKey(key, item); // return redisTemplate.opsForHash().hasKey(key, item);
} // }
//
/** // /**
* hash递增 如果不存在,就会创建一个 并把新增后的值返回 // * hash递增 如果不存在,就会创建一个 并把新增后的值返回
* @param key 键 // * @param key 键
* @param item 项 // * @param item 项
* @param by 要增加几(大于0) // * @param by 要增加几(大于0)
* @return // * @return
*/ // */
public double hincr(String key, String item,double by){ // public double hincr(String key, String item,double by){
return redisTemplate.opsForHash().increment(key, item, by); // return redisTemplate.opsForHash().increment(key, item, by);
} // }
//
/** // /**
* hash递减 // * hash递减
* @param key 键 // * @param key 键
* @param item 项 // * @param item 项
* @param by 要减少记(小于0) // * @param by 要减少记(小于0)
* @return // * @return
*/ // */
public double hdecr(String key, String item,double by){ // public double hdecr(String key, String item,double by){
return redisTemplate.opsForHash().increment(key, item,-by); // return redisTemplate.opsForHash().increment(key, item,-by);
} // }
//
//============================set============================= // //============================set=============================
/** // /**
* 根据key获取Set中的所有值 // * 根据key获取Set中的所有值
* @param key 键 // * @param key 键
* @return // * @return
*/ // */
public Set<Object> sGet(String key){ // public Set<Object> sGet(String key){
try { // try {
return redisTemplate.opsForSet().members(key); // return redisTemplate.opsForSet().members(key);
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return null; // return null;
} // }
} // }
//
/** // /**
* 根据value从一个set中查询,是否存在 // * 根据value从一个set中查询,是否存在
* @param key 键 // * @param key 键
* @param value 值 // * @param value 值
* @return true 存在 false不存在 // * @return true 存在 false不存在
*/ // */
public boolean sHasKey(String key,Object value){ // public boolean sHasKey(String key,Object value){
try { // try {
return redisTemplate.opsForSet().isMember(key, value); // return redisTemplate.opsForSet().isMember(key, value);
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return false; // return false;
} // }
} // }
//
/** // /**
* 将数据放入set缓存 // * 将数据放入set缓存
* @param key 键 // * @param key 键
* @param values 值 可以是多个 // * @param values 值 可以是多个
* @return 成功个数 // * @return 成功个数
*/ // */
public long sSet(String key, Object...values) { // public long sSet(String key, Object...values) {
try { // try {
return redisTemplate.opsForSet().add(key, values); // return redisTemplate.opsForSet().add(key, values);
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return 0; // return 0;
} // }
} // }
//
/** // /**
* 将set数据放入缓存 // * 将set数据放入缓存
* @param key 键 // * @param key 键
* @param time 时间(秒) // * @param time 时间(秒)
* @param values 值 可以是多个 // * @param values 值 可以是多个
* @return 成功个数 // * @return 成功个数
*/ // */
public long sSetAndTime(String key,long time,Object...values) { // public long sSetAndTime(String key,long time,Object...values) {
try { // try {
Long count = redisTemplate.opsForSet().add(key, values); // Long count = redisTemplate.opsForSet().add(key, values);
if(time>0) { // if(time>0) {
expire(key, time); // expire(key, time);
} // }
return count; // return count;
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return 0; // return 0;
} // }
} // }
//
/** // /**
* 获取set缓存的长度 // * 获取set缓存的长度
* @param key 键 // * @param key 键
* @return // * @return
*/ // */
public long sGetSetSize(String key){ // public long sGetSetSize(String key){
try { // try {
return redisTemplate.opsForSet().size(key); // return redisTemplate.opsForSet().size(key);
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return 0; // return 0;
} // }
} // }
//
/** // /**
* 移除值为value的 // * 移除值为value的
* @param key 键 // * @param key 键
* @param values 值 可以是多个 // * @param values 值 可以是多个
* @return 移除的个数 // * @return 移除的个数
*/ // */
public long setRemove(String key, Object ...values) { // public long setRemove(String key, Object ...values) {
try { // try {
Long count = redisTemplate.opsForSet().remove(key, values); // Long count = redisTemplate.opsForSet().remove(key, values);
return count; // return count;
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return 0; // return 0;
} // }
} // }
//===============================list================================= // //===============================list=================================
//
/** // /**
* 获取list缓存的内容 // * 获取list缓存的内容
* @param key 键 // * @param key 键
* @param start 开始 // * @param start 开始
* @param end 结束 0 到 -1代表所有值 // * @param end 结束 0 到 -1代表所有值
* @return // * @return
*/ // */
public List<Object> lGet(String key, long start, long end){ // public List<Object> lGet(String key, long start, long end){
try { // try {
return redisTemplate.opsForList().range(key, start, end); // return redisTemplate.opsForList().range(key, start, end);
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return null; // return null;
} // }
} // }
//
/** // /**
* 获取list缓存的长度 // * 获取list缓存的长度
* @param key 键 // * @param key 键
* @return // * @return
*/ // */
public long lGetListSize(String key){ // public long lGetListSize(String key){
try { // try {
return redisTemplate.opsForList().size(key); // return redisTemplate.opsForList().size(key);
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return 0; // return 0;
} // }
} // }
//
/** // /**
* 通过索引 获取list中的值 // * 通过索引 获取list中的值
* @param key 键 // * @param key 键
* @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推 // * @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推
* @return // * @return
*/ // */
public Object lGetIndex(String key,long index){ // public Object lGetIndex(String key,long index){
try { // try {
return redisTemplate.opsForList().index(key, index); // return redisTemplate.opsForList().index(key, index);
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return null; // return null;
} // }
} // }
//
/** // /**
* 将list放入缓存 // * 将list放入缓存
* @param key 键 // * @param key 键
* @param value 值 // * @param value 值
* @return // * @return
*/ // */
public boolean lSet(String key, Object value) { // public boolean lSet(String key, Object value) {
try { // try {
redisTemplate.opsForList().rightPush(key, value); // redisTemplate.opsForList().rightPush(key, value);
return true; // return true;
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return false; // return false;
} // }
} // }
//
/** // /**
* 将list放入缓存 // * 将list放入缓存
* @param key 键 // * @param key 键
* @param value 值 // * @param value 值
* @param time 时间(秒) // * @param time 时间(秒)
* @return // * @return
*/ // */
public boolean lSet(String key, Object value, long time) { // public boolean lSet(String key, Object value, long time) {
try { // try {
redisTemplate.opsForList().rightPush(key, value); // redisTemplate.opsForList().rightPush(key, value);
if (time > 0) { // if (time > 0) {
expire(key, time); // expire(key, time);
} // }
return true; // return true;
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return false; // return false;
} // }
} // }
//
/** // /**
* 将list放入缓存 // * 将list放入缓存
* @param key 键 // * @param key 键
* @param value 值 // * @param value 值
* @return // * @return
*/ // */
public boolean lSet(String key, List<Object> value) { // public boolean lSet(String key, List<Object> value) {
try { // try {
redisTemplate.opsForList().rightPushAll(key, value); // redisTemplate.opsForList().rightPushAll(key, value);
return true; // return true;
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return false; // return false;
} // }
} // }
//
/** // /**
* 将list放入缓存 // * 将list放入缓存
* @param key 键 // * @param key 键
* @param value 值 // * @param value 值
* @param time 时间(秒) // * @param time 时间(秒)
* @return // * @return
*/ // */
public boolean lSet(String key, List<Object> value, long time) { // public boolean lSet(String key, List<Object> value, long time) {
try { // try {
redisTemplate.opsForList().rightPushAll(key, value); // redisTemplate.opsForList().rightPushAll(key, value);
if (time > 0) { // if (time > 0) {
expire(key, time); // expire(key, time);
} // }
return true; // return true;
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return false; // return false;
} // }
} // }
//
/** // /**
* 根据索引修改list中的某条数据 // * 根据索引修改list中的某条数据
* @param key 键 // * @param key 键
* @param index 索引 // * @param index 索引
* @param value 值 // * @param value 值
* @return // * @return
*/ // */
public boolean lUpdateIndex(String key, long index,Object value) { // public boolean lUpdateIndex(String key, long index,Object value) {
try { // try {
redisTemplate.opsForList().set(key, index, value); // redisTemplate.opsForList().set(key, index, value);
return true; // return true;
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return false; // return false;
} // }
} // }
//
/** // /**
* 移除N个值为value // * 移除N个值为value
* @param key 键 // * @param key 键
* @param count 移除多少个 // * @param count 移除多少个
* @param value 值 // * @param value 值
* @return 移除的个数 // * @return 移除的个数
*/ // */
public long lRemove(String key,long count,Object value) { // public long lRemove(String key,long count,Object value) {
try { // try {
Long remove = redisTemplate.opsForList().remove(key, count, value); // Long remove = redisTemplate.opsForList().remove(key, count, value);
return remove; // return remove;
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
return 0; // return 0;
} // }
} // }
//
///** // ///**
// * 模糊查询获取key值 // // * 模糊查询获取key值
// * @param pattern // // * @param pattern
// * @return // // * @return
// */ // // */
public Set keys(String pattern){ // public Set keys(String pattern){
return redisTemplate.keys(pattern); // return redisTemplate.keys(pattern);
} // }
//
/** // /**
* 模糊查询 // * 模糊查询
* @param pattern // * @param pattern
* @return // * @return
*/ // */
public Set scan(String pattern) { // public Set scan(String pattern) {
return redisTemplate.execute((RedisCallback<Set<String>>) redisConnection -> { // return redisTemplate.execute((RedisCallback<Set<String>>) redisConnection -> {
Set keys = new HashSet<>(); // Set keys = new HashSet<>();
Cursor<byte[]> cursor = redisConnection.scan(new ScanOptions.ScanOptionsBuilder().match(pattern).count(Integer.MAX_VALUE).build()); // Cursor<byte[]> cursor = redisConnection.scan(new ScanOptions.ScanOptionsBuilder().match(pattern).count(Integer.MAX_VALUE).build());
while (cursor.hasNext()) { // while (cursor.hasNext()) {
keys.add(new String(cursor.next())); // keys.add(new String(cursor.next()));
} // }
return keys; // return keys;
}); // });
} // }
//
/** // /**
* 使用Redis的消息队列 // * 使用Redis的消息队列
* @param channel // * @param channel
* @param message 消息内容 // * @param message 消息内容
*/ // */
public void convertAndSend(String channel, Object message){ // public void convertAndSend(String channel, Object message){
redisTemplate.convertAndSend(channel,message); // redisTemplate.convertAndSend(channel,message);
} // }
//
//
//=========BoundListOperations 用法 start============ // //=========BoundListOperations 用法 start============
//
//
/** // /**
* 根据起始结束序号遍历Redis中的list // * 根据起始结束序号遍历Redis中的list
* @param listKey // * @param listKey
* @param start 起始序号 // * @param start 起始序号
* @param end 结束序号 // * @param end 结束序号
* @return // * @return
*/ // */
public List<Object> rangeList(String listKey, long start, long end) { // public List<Object> rangeList(String listKey, long start, long end) {
//绑定操作 // //绑定操作
BoundListOperations<String, Object> boundValueOperations = redisTemplate.boundListOps(listKey); // BoundListOperations<String, Object> boundValueOperations = redisTemplate.boundListOps(listKey);
//查询数据 // //查询数据
return boundValueOperations.range(start, end); // return boundValueOperations.range(start, end);
} // }
/** // /**
* 弹出右边的值 --- 并且移除这个值 // * 弹出右边的值 --- 并且移除这个值
* @param listKey // * @param listKey
*/ // */
public Object rifhtPop(String listKey){ // public Object rifhtPop(String listKey){
//绑定操作 // //绑定操作
BoundListOperations<String, Object> boundValueOperations = redisTemplate.boundListOps(listKey); // BoundListOperations<String, Object> boundValueOperations = redisTemplate.boundListOps(listKey);
return boundValueOperations.rightPop(); // return boundValueOperations.rightPop();
} // }
//
//=========BoundListOperations 用法 End============ // //=========BoundListOperations 用法 End============
//
} //}
\ No newline at end of file \ No newline at end of file
package com.subsidy.vo.administer; package com.subsidy.vo.administer;
import com.subsidy.model.RotationImgDictDO;
import lombok.Data; import lombok.Data;
import java.util.List;
@Data @Data
public class UserRoleVO { public class UserRoleVO {
...@@ -21,4 +24,10 @@ public class UserRoleVO { ...@@ -21,4 +24,10 @@ public class UserRoleVO {
private String companyName; private String companyName;
private Long companyId;
private String logo;
private List<RotationImgDictDO> rotationImgDictDOS;
} }
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;
}
...@@ -34,7 +34,7 @@ public class ClassDetailVO{ ...@@ -34,7 +34,7 @@ public class ClassDetailVO{
* 签到次数 * 签到次数
*/ */
@ExcelColumn(col = 6,value = "签到次数") @ExcelColumn(col = 6,value = "签到次数")
private Long signCounts; private Integer signCounts;
/** /**
* 已看视频 * 已看视频
......
...@@ -21,4 +21,12 @@ public class GetClassBaseInfoVO { ...@@ -21,4 +21,12 @@ public class GetClassBaseInfoVO {
private Long classTypeId; private Long classTypeId;
private Integer isOrder;
private Integer isFastPlay;
private Integer testRule;
private Boolean testFlag;
} }
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<RotationImgDictDO> rotationImgDictDOS;
private String logo;
}
...@@ -46,6 +46,11 @@ public class QueryCoursesVO { ...@@ -46,6 +46,11 @@ public class QueryCoursesVO {
private Integer vodCounts; private Integer vodCounts;
/** /**
* 备注
*/
private String remark;
/**
* 测试数量 * 测试数量
*/ */
private Integer paperCount; private Integer paperCount;
......
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<MemberDO> memberDOS;
//private List<AdministerDepartmentMappingDO> administerDepartmentMappingDOS;
private List<GetMembersVO> children;
}
...@@ -2,11 +2,13 @@ package com.subsidy.vo.member; ...@@ -2,11 +2,13 @@ package com.subsidy.vo.member;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.subsidy.model.DepartmentDictDO; import com.subsidy.model.DepartmentDictDO;
import com.subsidy.model.JobDictDO; import com.subsidy.model.JobDictDO;
import com.subsidy.model.MemberDO; import com.subsidy.model.MemberDO;
import lombok.Data; import lombok.Data;
import java.util.Date;
import java.util.List; import java.util.List;
@Data @Data
...@@ -28,6 +30,13 @@ public class GetAllVO { ...@@ -28,6 +30,13 @@ public class GetAllVO {
private String status; private String status;
private String email;
private String workNo;
//@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private String inductionDate;
private List<DepartmentDictDO> departmentDictDOS; private List<DepartmentDictDO> departmentDictDOS;
private List<JobDictDO> jobDictDOS; private List<JobDictDO> jobDictDOS;
......
package com.subsidy.vo.member; package com.subsidy.vo.member;
import com.subsidy.model.RotationImgDictDO;
import lombok.Data; import lombok.Data;
import java.util.List;
@Data @Data
public class MemberVO { public class MemberVO {
...@@ -18,4 +21,10 @@ public class MemberVO { ...@@ -18,4 +21,10 @@ public class MemberVO {
private Integer firstLogin; private Integer firstLogin;
private String companyName; private String companyName;
private Long companyId;
private String logo;
private List<RotationImgDictDO> rotationImgDictDOS;
} }
...@@ -26,5 +26,9 @@ public class MyCoursesVO { ...@@ -26,5 +26,9 @@ public class MyCoursesVO {
private Integer ttlMember; private Integer ttlMember;
private Integer isOrder;
private Integer isFastPlay;
private List<FieldDictDO> fieldDictDOS; private List<FieldDictDO> fieldDictDOS;
} }
...@@ -50,3 +50,7 @@ meishu.code-message[70002]=定时任务创建失败 ...@@ -50,3 +50,7 @@ meishu.code-message[70002]=定时任务创建失败
meishu.code-message[70003]=定时任务删除失败 meishu.code-message[70003]=定时任务删除失败
meishu.code-message[12001]=该职级已存在 meishu.code-message[12001]=该职级已存在
meishu.code-message[13001]=已达到当日最大时长
...@@ -133,7 +133,10 @@ ...@@ -133,7 +133,10 @@
t.end_date, t.end_date,
ifnull( t4.cnt, 0 ) AS count, ifnull( t4.cnt, 0 ) AS count,
t2.id as courseId, t2.id as courseId,
t3.id as classTypeId t3.id as classTypeId,
t.is_order,
t.is_fast_play,
t.test_rule
FROM FROM
class_dict t class_dict t
LEFT JOIN course_dict t2 ON t.course_id = t2.id LEFT JOIN course_dict t2 ON t.course_id = t2.id
...@@ -145,4 +148,22 @@ ...@@ -145,4 +148,22 @@
AND t3.delete_date IS NULL AND t3.delete_date IS NULL
AND t.id = #{classId} AND t.id = #{classId}
</select> </select>
<select id="getClassAndCompanyInfoVO" resultType="com.subsidy.vo.classdict.ClassAndCompanyInfoVO">
SELECT
cd.company_name AS company,
cd.short_name AS NAME,
d.course_name,
c.start_date,
c.end_date
FROM
class_dict c
LEFT JOIN company_dict cd ON cd.id = c.company_id
LEFT JOIN course_dict d ON d.id = c.course_id
WHERE
c.id = #{classId}
AND c.delete_date IS NULL
AND cd.delete_date IS NULL
AND d.delete_date IS NULL
</select>
</mapper> </mapper>
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<select id="operators" resultType="com.subsidy.vo.administer.OperatorsVO"> <select id="operators" resultType="com.subsidy.vo.administer.OperatorsVO">
SELECT SELECT
t.id, distinct t.id,
t2.id as companyId, t2.id as companyId,
t.telephone, t.telephone,
t.user_name, t.user_name,
...@@ -40,6 +40,9 @@ ...@@ -40,6 +40,9 @@
t.delete_date IS NULL t.delete_date IS NULL
and t2.delete_date is null and t2.delete_date is null
and t3.delete_date is null and t3.delete_date is null
<if test="role != null">
and t.role = #{role}
</if>
<if test="id != null and id != ''"> <if test="id != null and id != ''">
and t2.id = #{id} and t2.id = #{id}
</if> </if>
......
...@@ -75,10 +75,13 @@ ...@@ -75,10 +75,13 @@
FROM FROM
vod_play_history t vod_play_history t
WHERE WHERE
t.member_id = #{memberId} t.delete_date is null
and t.member_id = #{memberId}
and t.class_id = #{classId}
GROUP BY GROUP BY
t.vod_id, t.vod_id,
t.member_id t.member_id,
t.class_id
) t2 ON t.id = t2.vod_id ) t2 ON t.id = t2.vod_id
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
...@@ -96,9 +99,11 @@ ...@@ -96,9 +99,11 @@
WHERE WHERE
t.delete_date IS NULL t.delete_date IS NULL
AND t.member_id = #{memberId} AND t.member_id = #{memberId}
and t.class_id = #{classId}
GROUP BY GROUP BY
t.member_id, t.member_id,
t.vod_id t.vod_id,
t.class_id
) t ) t
LEFT JOIN vod_play_history t2 ON t.vod_id = t2.vod_id LEFT JOIN vod_play_history t2 ON t.vod_id = t2.vod_id
AND t.member_id = t2.member_id AND t.member_id = t2.member_id
......
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
t.course_name, t.course_name,
t.course_type, t.course_type,
t.open_status, t.open_status,
t.cover_page t.cover_page,
t.remark
FROM FROM
course_dict t course_dict t
LEFT JOIN course_field_mapping t2 ON t.id = t2.course_id LEFT JOIN course_field_mapping t2 ON t.id = t2.course_id
......
...@@ -109,6 +109,7 @@ ...@@ -109,6 +109,7 @@
t.delete_date IS NULL t.delete_date IS NULL
AND t.paper_id = #{paperId} AND t.paper_id = #{paperId}
AND t.member_id = #{memberId} AND t.member_id = #{memberId}
and t.class_id = #{classId}
) t1 ) t1
LEFT JOIN exercise_done_result t2 ON t1.score = t2.score LEFT JOIN exercise_done_result t2 ON t1.score = t2.score
WHERE WHERE
......
...@@ -70,6 +70,8 @@ ...@@ -70,6 +70,8 @@
t4.cnt AS totalCnt, t4.cnt AS totalCnt,
t5.result AS studyCnt, t5.result AS studyCnt,
t6.ttlMember, t6.ttlMember,
t2.is_order,
t2.is_fast_play,
if( if(
TIMESTAMPDIFF( TIMESTAMPDIFF(
DAY, DAY,
...@@ -134,16 +136,16 @@ ...@@ -134,16 +136,16 @@
AND t3.delete_date IS NULL AND t3.delete_date IS NULL
AND t.member_id = #{memberId} AND t.member_id = #{memberId}
<if test="status ==1"> <if test="status ==1">
AND now()>= start_date AND DATE_FORMAT(now(), '%Y-%m-%d') >= DATE_FORMAT(start_date, '%Y-%m-%d')
AND now() &lt; end_date AND DATE_FORMAT(now(), '%Y-%m-%d') &lt; DATE_FORMAT(end_date, '%Y-%m-%d')
</if> </if>
<if test="status ==2"> <if test="status ==2">
AND now() &lt; start_date AND DATE_FORMAT(now(), '%Y-%m-%d') &lt; DATE_FORMAT(start_date, '%Y-%m-%d')
</if> </if>
<if test="status ==3"> <if test="status ==3">
AND now() > end_date AND DATE_FORMAT(now(), '%Y-%m-%d') > DATE_FORMAT(end_date, '%Y-%m-%d')
</if> </if>
order by t2.end_date desc order by t2.create_date desc
</select> </select>
...@@ -170,7 +172,10 @@ ...@@ -170,7 +172,10 @@
t2.telephone, t2.telephone,
t2.gender, t2.gender,
t2.id_card, t2.id_card,
t2.status t2.status,
t2.email,
t2.work_no,
t2.induction_date
FROM FROM
member_department_mapping t member_department_mapping t
LEFT JOIN member t2 ON t.member_id = t2.id LEFT JOIN member t2 ON t.member_id = t2.id
...@@ -184,8 +189,79 @@ ...@@ -184,8 +189,79 @@
<if test="status != null and status !=''"> <if test="status != null and status !=''">
and t2.status = #{status} and t2.status = #{status}
</if> </if>
<if test="startDate != null and startEndDate !=''">
and DATE_FORMAT(t2.induction_date ,'%Y-%m-%d')>=DATE_FORMAT(#{startDate}, '%Y-%m-%d')
</if>
<if test="endDate != null and endDate !=''">
and DATE_FORMAT(t2.induction_date ,'%Y-%m-%d') &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
</if>
</select> </select>
<select id="getMemberWithoutPage" resultType="com.subsidy.model.MemberDO">
SELECT
t2.id,
t2.user_name,
t2.account_name,
t2.account_name_en,
t2.telephone,
t2.gender,
t2.id_card,
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
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
and t.department_id = #{departmentId}
<if test="userName != null and userName !=''">
and t2.user_name like concat('%',#{userName} ,'%')
</if>
<if test="status != null and status !=''">
and t2.status = #{status}
</if>
<if test="startDate != null and startEndDate !=''">
and DATE_FORMAT(t2.induction_date ,'%Y-%m-%d')>=DATE_FORMAT(#{startDate}, '%Y-%m-%d')
</if>
<if test="endDate != null and endDate !=''">
and DATE_FORMAT(t2.induction_date ,'%Y-%m-%d') &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
</if>
</select>
<select id="getCompanyMember" resultType="com.subsidy.vo.member.GetAllVO">
SELECT
t2.id,
t2.user_name,
t2.account_name,
t2.account_name_en,
t2.telephone,
t2.gender,
t2.id_card,
t2.status,
t2.email,
t2.work_no,
t2.induction_date
FROM
member t2
WHERE
t2.delete_date IS NULL
and t2.company_id = #{companyId}
<if test="userName != null and userName !=''">
and t2.user_name like concat('%',#{userName} ,'%')
</if>
<if test="status != null and status !=''">
and t2.status = #{status}
</if>
<if test="startDate != null and startEndDate !=''">
and DATE_FORMAT(t2.induction_date ,'%Y-%m-%d')>=DATE_FORMAT(#{startDate}, '%Y-%m-%d')
</if>
<if test="endDate != null and endDate !=''">
and DATE_FORMAT(t2.induction_date ,'%Y-%m-%d') &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
</if>
</select>
<select id="manageMember" parameterType="string" resultType="com.subsidy.vo.administer.ManageMemberVO"> <select id="manageMember" parameterType="string" resultType="com.subsidy.vo.administer.ManageMemberVO">
SELECT SELECT
t.id, t.id,
...@@ -229,7 +305,7 @@ ...@@ -229,7 +305,7 @@
cmm.class_id = #{classId} cmm.class_id = #{classId}
AND m.delete_date IS NULL AND m.delete_date IS NULL
AND cmm.delete_date IS NULL AND cmm.delete_date IS NULL
AND s.signInCount > 0 AND s.signInCount = 0
GROUP BY GROUP BY
m.id m.id
</select> </select>
...@@ -239,29 +315,11 @@ ...@@ -239,29 +315,11 @@
m.* m.*
FROM FROM
member m member m
LEFT JOIN class_member_mapping cmm ON cmm.member_id = m.id LEFT JOIN class_member_mapping cm ON cm.member_id = m.id
LEFT JOIN ( 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
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
WHERE WHERE
cmm.class_id = #{classId} cm.class_id = #{classId}
AND h.ps = 0 AND r.ts is NULL
GROUP BY and m.delete_date is null
m.id
</select> </select>
</mapper> </mapper>
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
</if> </if>
</select> </select>
<select id="completeCount" parameterType="long" resultType="integer"> <select id="completeCount" resultType="integer">
SELECT SELECT
count( DISTINCT t.member_id ) AS cnt count( DISTINCT t.member_id ) AS cnt
FROM FROM
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
WHERE WHERE
t.delete_date IS NULL t.delete_date IS NULL
AND t.paper_id = #{paperId} AND t.paper_id = #{paperId}
and t.class_id = #{classId}
</select> </select>
<select id="queryCoursePapersCnt" parameterType="long" resultType="integer"> <select id="queryCoursePapersCnt" parameterType="long" resultType="integer">
......
...@@ -20,4 +20,17 @@ ...@@ -20,4 +20,17 @@
id, administer_id, role_id id, administer_id, role_id
</sql> </sql>
<select id="getAdminister" parameterType="long" resultType="com.subsidy.model.AdministerDO">
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
</select>
</mapper> </mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.RotationImgDictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.RotationImgDictDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="company_id" property="companyId" />
<result column="rotation_img" property="rotationImg" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, company_id, rotation_img
</sql>
</mapper>
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<if test="vodName != null and vodName !=''"> <if test="vodName != null and vodName !=''">
and vod_name like concat('%',#{vodName} ,'%') and vod_name like concat('%',#{vodName} ,'%')
</if> </if>
order by t.order_no order by t2.order_no,t.order_no
</select> </select>
<select id="getCourseVods" parameterType="long" resultType="com.subsidy.model.VodDictDO"> <select id="getCourseVods" parameterType="long" resultType="com.subsidy.model.VodDictDO">
......
...@@ -118,8 +118,6 @@ ...@@ -118,8 +118,6 @@
<select id="completeVodOrNot" resultType="integer"> <select id="completeVodOrNot" resultType="integer">
SELECT SELECT
t.vod_id,
t.member_id,
IF IF
( sum( t.play_length )>= t2.vod_length, 1, 0 ) AS count ( sum( t.play_length )>= t2.vod_length, 1, 0 ) AS count
FROM FROM
...@@ -236,8 +234,9 @@ ...@@ -236,8 +234,9 @@
<select id="memberRecentPlay" resultType="com.subsidy.vo.member.ContentVodNewVO"> <select id="memberRecentPlay" resultType="com.subsidy.vo.member.ContentVodNewVO">
SELECT SELECT
t2.play_record, t2.play_record,
t2.vod_id t2.vod_id as id
FROM FROM
( SELECT max( t.create_date ) AS create_date FROM vod_play_history t WHERE t.delete_date is null and t.member_id = #{memberId} AND t.class_id = #{classId} ) t ( SELECT max( t.create_date ) AS create_date FROM vod_play_history t WHERE t.delete_date is null and t.member_id = #{memberId} AND t.class_id = #{classId} ) t
LEFT JOIN vod_play_history t2 ON t.create_date = t2.create_date LEFT JOIN vod_play_history t2 ON t.create_date = t2.create_date
...@@ -330,7 +329,7 @@ ...@@ -330,7 +329,7 @@
<select id="memberTotalLength" parameterType="long" resultType="integer"> <select id="memberTotalLength" parameterType="long" resultType="integer">
SELECT SELECT
sum( play_length ) ifnull(sum( play_length ),0)
FROM FROM
vod_play_history t vod_play_history t
WHERE WHERE
...@@ -347,6 +346,7 @@ ...@@ -347,6 +346,7 @@
t.delete_date IS NULL t.delete_date IS NULL
AND t.vod_id = #{vodId} AND t.vod_id = #{vodId}
AND t.member_id = #{memberId} AND t.member_id = #{memberId}
and t.class_id = #{classId}
</select> </select>
<select id="exPlayInfo" resultType="com.subsidy.model.VodPlayHistoryDO"> <select id="exPlayInfo" resultType="com.subsidy.model.VodPlayHistoryDO">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!