vodDictDOS = vodDictMapper.getCourseVods(getClassBaseInfoVO.getCourseId(),null);
+ int completeNum = 0 ;
+ //查看每个视频的状态
+ for (VodDictDO vodDictDO : vodDictDOS){
+ int i = vodPlayHistoryMapper.completeVodOrNot(getClassBaseInfoDTO.getUserId(),vodDictDO.getId());
+ completeNum += i;
+ }
+ if (completeNum == vodDictDOS.size()){
+ getClassBaseInfoVO.setTestFlag(true);
+ }else {
+ getClassBaseInfoVO.setTestFlag(false);
+ }
+ return getClassBaseInfoVO;
}
}
diff --git a/src/main/java/com/subsidy/service/impl/ClassHourDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/ClassHourDictServiceImpl.java
index a36748c..a16fa8f 100644
--- a/src/main/java/com/subsidy/service/impl/ClassHourDictServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/ClassHourDictServiceImpl.java
@@ -1,31 +1,30 @@
package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.common.RedisPrefixConstant;
import com.subsidy.mapper.ClassHourDictMapper;
+import com.subsidy.mapper.CompanyDictMapper;
import com.subsidy.mapper.MemberMapper;
+import com.subsidy.mapper.RotationImgDictMapper;
import com.subsidy.mapper.VodPlayHistoryMapper;
+import com.subsidy.model.ClassDictDO;
import com.subsidy.model.ClassHourDictDO;
+import com.subsidy.model.CompanyDictDO;
import com.subsidy.model.MemberDO;
+import com.subsidy.model.RotationImgDictDO;
import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.service.ClassHourDictService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.MyBeanUtils;
-import com.subsidy.util.RedisUtil;
+import com.subsidy.vo.classdict.GetSettingVO;
import com.subsidy.vo.hour.PollingGetVO;
+import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;
-import java.time.LocalDate;
import java.util.List;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
/**
*
@@ -44,20 +43,66 @@ public class ClassHourDictServiceImpl extends ServiceImpl()
+ .lambda()
+ .eq(ClassHourDictDO::getCompanyId,classHourDictDO.getCompanyId()));
+ //redisUtil.set(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX+classHourDictDO.getCompanyId(),classDictDO);
+ //}
- public ClassHourDictDO getSetting(ClassHourDictDO classHourDictDO) {
- return (ClassHourDictDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX+classHourDictDO.getCompanyId());
+ BeanUtils.copyProperties(classDictDO,getSettingVO);
+
+ List rotationImgDictDOS = rotationImgDictMapper.selectList(new QueryWrapper()
+ .lambda()
+ .eq(RotationImgDictDO::getCompanyId,classHourDictDO.getCompanyId()));
+
+ getSettingVO.setRotationImgDictDOS(rotationImgDictDOS);
+
+ CompanyDictDO companyDictDO = companyDictMapper.selectById(classHourDictDO.getCompanyId());
+ getSettingVO.setLogo(companyDictDO.getLogo());
+ return getSettingVO;
}
- public String updateSetting(ClassHourDictDO classHourDictDO) {
+ public String updateSetting(GetSettingVO getSettingVO) {
- ClassHourDictDO classHourDictDO1 = (ClassHourDictDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + classHourDictDO.getCompanyId());
- classHourDictDO.setId(classHourDictDO1.getId());
- String[] nullParams = MyBeanUtils.getNullPropertyNames(classHourDictDO);
- BeanUtils.copyProperties(classHourDictDO, classHourDictDO1,nullParams);
- redisUtil.set(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX+classHourDictDO.getCompanyId(), classHourDictDO1);
+ if (!StringUtils.isEmpty(getSettingVO.getLogo())){
+ CompanyDictDO companyDictDO = companyDictMapper.selectById(getSettingVO.getCompanyId());
+ companyDictDO.setLogo(getSettingVO.getLogo());
+ companyDictMapper.updateById(companyDictDO);
+ }
+
+ //ClassHourDictDO classHourDictDO1 = (ClassHourDictDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + getSettingVO.getCompanyId());
+ //getSettingVO.setId(classHourDictDO1.getId());
+ //String[] nullParams = MyBeanUtils.getNullPropertyNames(getSettingVO);
+ //BeanUtils.copyProperties(getSettingVO, classHourDictDO1,nullParams);
+ //redisUtil.set(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX+getSettingVO.getCompanyId(), classHourDictDO1);
+ //this.baseMapper.updateById(classHourDictDO1);
+
+ if (getSettingVO.getRotationImgDictDOS().size()>0){
+ List rotationImgDictDOS = getSettingVO.getRotationImgDictDOS();
+ rotationImgDictMapper.delete(new QueryWrapper()
+ .lambda()
+ .eq(RotationImgDictDO::getCompanyId,getSettingVO.getCompanyId()));
+
+ for (RotationImgDictDO rotationImgDictDO : rotationImgDictDOS){
+ rotationImgDictDO.setCompanyId(getSettingVO.getCompanyId());
+ rotationImgDictMapper.insert(rotationImgDictDO);
+ }
+ }
return ConstantUtils.SET_SUCCESS;
}
@@ -68,7 +113,9 @@ public class ClassHourDictServiceImpl extends ServiceImpl()
+ .lambda()
+ .eq(ClassHourDictDO::getCompanyId,memberDO.getCompanyId()));
if (classHourDictDO.getStatus() == 0) {
pollingGetVO.setBool(false);
diff --git a/src/main/java/com/subsidy/service/impl/ClassNoticeServiceImpl.java b/src/main/java/com/subsidy/service/impl/ClassNoticeServiceImpl.java
index 62b7c25..a249d1e 100644
--- a/src/main/java/com/subsidy/service/impl/ClassNoticeServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/ClassNoticeServiceImpl.java
@@ -6,18 +6,19 @@ import com.subsidy.common.constant.SmsCode;
import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.classNotice.SendNotificationDTO;
import com.subsidy.jobs.CourseNotificationJob;
+import com.subsidy.mapper.ClassDictMapper;
import com.subsidy.mapper.MemberMapper;
import com.subsidy.model.ClassDictDO;
import com.subsidy.model.ClassNoticeDO;
import com.subsidy.mapper.ClassNoticeMapper;
import com.subsidy.model.MemberDO;
-import com.subsidy.service.ClassDictService;
import com.subsidy.service.ClassNoticeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.QuartzUtil;
import com.subsidy.util.SMSUtils;
+import com.subsidy.vo.classdict.ClassAndCompanyInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -41,14 +42,11 @@ public class ClassNoticeServiceImpl extends ServiceImpl params = new HashMap<>();
params.put("classId", classNoticeDO.getClassId());
params.put("id", classNoticeDO.getId());
String name = classDictDO.getClassName()+"-"+classNoticeDO.getNoticeType()+"-"+classNoticeDO.getNoticeTime();
- quartzUtil.addSimpleJob(CourseNotificationJob.class,DateFormatUtil.parse(classNoticeDO.getNoticeTime(), "yyyy-MM-dd") , params, name, "CourseNotificationJob");
+ quartzUtil.addSimpleJob(CourseNotificationJob.class,DateFormatUtil.parse(classNoticeDO.getNoticeTime(), "yyyy-MM-dd HH:mm:ss") , params, name, "CourseNotificationJob");
return ConstantUtils.ADD_SUCCESS;
}
@@ -79,7 +77,7 @@ public class ClassNoticeServiceImpl extends ServiceImpl list = memberMapper.getMemberList(sendNotificationDTO.getClassId());
if(list != null) {
for (MemberDO memberDO : list) {
- smsUtils.send(memberDO.getTelephone(), SmsCode.ALL.getCode());
+ SMSUtils.sendNoticeSMS(SmsCode.ALL.getCode(), memberDO.getTelephone(), params);
}
}
} else if(sendNotificationDTO.getSendType().equals(SmsCode.NOT_SIGNED_IN.getType())) {
+ String params = "{ \"name\": \""+ cmInfo.getName() +"\", \"course\":\""+ cmInfo.getCourseName()+"\"}";
List list = memberMapper.getMemberListBySignInRecord(sendNotificationDTO.getClassId());
if(list != null) {
for (MemberDO memberDO : list) {
- smsUtils.send(memberDO.getTelephone(), SmsCode.NOT_SIGNED_IN.getCode());
+ SMSUtils.sendNoticeSMS(SmsCode.NOT_SIGNED_IN.getCode(), memberDO.getTelephone(), params);
}
}
} else if(sendNotificationDTO.getSendType().equals(SmsCode.UNFINISHED.getType())) {
+ String params = "{ \"name\": \""+ cmInfo.getName() +"\", \"course\":\""+ cmInfo.getCourseName()+"\"}";
List list = memberMapper.getUnfinishedMemberList(sendNotificationDTO.getClassId());
if(list != null) {
for (MemberDO memberDO : list) {
- smsUtils.send(memberDO.getTelephone(), SmsCode.UNFINISHED.getCode());
+ SMSUtils.sendNoticeSMS(SmsCode.UNFINISHED.getCode(), memberDO.getTelephone(), params);
}
}
}
diff --git a/src/main/java/com/subsidy/service/impl/ClassTypeDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/ClassTypeDictServiceImpl.java
index e83a42a..16c71e9 100644
--- a/src/main/java/com/subsidy/service/impl/ClassTypeDictServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/ClassTypeDictServiceImpl.java
@@ -50,7 +50,7 @@ public class ClassTypeDictServiceImpl extends ServiceImpl classTypeDictDOS = new ArrayList<>();
- //查看当前登录人的角色
+ //查看当前登录人的角色 角色映射表
int count = roleAdministerMappingMapper.selectCount(new QueryWrapper()
.lambda()
.eq(RoleAdministerMappingDO::getAdministerId,classTypeDTO.getUserId())
@@ -67,9 +67,8 @@ public class ClassTypeDictServiceImpl extends ServiceImpl operators(OperatorsDTO operatorsDTO) {
Page pager = new Page(operatorsDTO.getPageNum(), operatorsDTO.getPageSize());
-
-
AdministerDO administerDO = administerMapper.selectById(operatorsDTO.getId());
//判断该用户的角色
@@ -100,7 +102,7 @@ public class CompanyDictServiceImpl extends ServiceImpl 0){
administerDO.setCompanyId(null);
}
- IPage page = this.baseMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getFieldId(),administerDO.getCompanyId());
+ IPage page = this.baseMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getFieldId(),administerDO.getCompanyId(),null);
List operatorsVOS = page.getRecords();
for (OperatorsVO operatorsVO : operatorsVOS) {
//查看公司所在行业
@@ -138,7 +140,7 @@ public class CompanyDictServiceImpl extends ServiceImpl rotationImgDictDOS = rotationImgDictMapper.selectList(new QueryWrapper()
+ .lambda()
+ .isNull(RotationImgDictDO::getCompanyId));
+ for (RotationImgDictDO rotationImgDictDO : rotationImgDictDOS){
+ rotationImgDictDO.setCompanyId(companyDictDO.getId());
+ rotationImgDictMapper.insert(rotationImgDictDO);
+ }
+
//班级类型
ClassTypeDictDO classTypeDictDO = new ClassTypeDictDO();
classTypeDictDO.setClassType("企业内训");
@@ -210,7 +221,7 @@ public class CompanyDictServiceImpl extends ServiceImpl()
- .lambda()
- .eq(AdministerDO::getCompanyId, addCompanyDTO.getId())
- .eq(AdministerDO::getRole, 1));
+ AdministerDO administerDO = roleAdministerMappingMapper.getAdminister(addCompanyDTO.getId());
+
if (StringUtils.isNotBlank(addCompanyDTO.getAccountName())) {
administerDO.setAccountName(addCompanyDTO.getAccountName());
}
diff --git a/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java
index 059f7b1..d04cca1 100644
--- a/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java
@@ -110,6 +110,7 @@ public class CourseDictServiceImpl extends ServiceImpl()
- .lambda()
- .eq(MemberDepartmentMappingDO::getDepartmentId, dd.getId()));
- getDepartmentsVO.setCnt(count);
+ //Integer count = memberDepartmentMappingMapper.selectCount(new QueryWrapper()
+ // .lambda()
+ // .eq(MemberDepartmentMappingDO::getDepartmentId, dd.getId()));
+ //getDepartmentsVO.setCnt(count);
getDepartmentsVO.setChildren(getChildNodes(getDepartmentsVO));
DepartmentDictDO departmentDictDO1 = this.baseMapper.selectById(dd.getParentId());
if (null != departmentDictDO1) {
@@ -107,16 +112,32 @@ public class DepartmentDictServiceImpl extends ServiceImpl()
.lambda()
.eq(DepartmentDictDO::getCompanyId, departmentDictDO.getCompanyId())
- .eq(DepartmentDictDO::getDepartmentName, departmentDictDO.getDepartmentName()));
+ .eq(DepartmentDictDO::getFullName, departmentDictDO.getFullName()));
if (counter > 0) {
throw new HttpException(30001);
}
- this.baseMapper.insert(departmentDictDO);
+ List depNames = new ArrayList<>();
+
+ StringBuilder fullName = new StringBuilder();
+ //fullName 遍历生成全名称
+ do {
+ depNames.add("/"+departmentDictDO.getDepartmentName());
+ departmentDictDO = this.baseMapper.selectById(departmentDictDO.getParentId());
+ } while(null != departmentDictDO.getParentId());
+
+ depNames.add(departmentDictDO.getDepartmentName());
+
+ for (int i = depNames.size()-1; i >=0 ; i--){
+ fullName.append(depNames.get(i));
+ }
+ departmentDictDO1.setFullName(fullName.toString());
+ this.baseMapper.insert(departmentDictDO1);
return ConstantUtils.ADD_SUCCESS;
}
@@ -170,13 +191,93 @@ public class DepartmentDictServiceImpl extends ServiceImpl getMembers(GetDepartmentMembersDTO getDepartmentMembersDTO){
+
+ List getMembersVOS = new ArrayList<>();
+
+ GetMembersVO getMembersVO = new GetMembersVO();
+
+ //找到父节点
+ DepartmentDictDO departmentDictDO = this.baseMapper.selectOne(new QueryWrapper()
+ .lambda()
+ .eq(DepartmentDictDO::getCompanyId,getDepartmentMembersDTO.getCompanyId())
+ .isNull(DepartmentDictDO::getParentId));
+ BeanUtils.copyProperties(departmentDictDO,getMembersVO);
+
+ List departmentDictDOS = new ArrayList<>();
+ departmentDictDOS.add(departmentDictDO);
+
+ for (DepartmentDictDO dpt : departmentDictDOS){
+ GetMembersVO gmv = new GetMembersVO();
+ BeanUtils.copyProperties(dpt,gmv);
+ if (null!=departmentDictDO.getParentId()){
+ DepartmentDictDO departmentDictDO1 =this.baseMapper.selectById(departmentDictDO.getParentId());
+ gmv.setParentDepartmentName(departmentDictDO1.getDepartmentName());
+ }
+ gmv.setChildren(getChildNodes(gmv));
+
+ if (dpt.getParentId()!=null){
+ //部门人员
+ List memberDOS1 = memberMapper.getMemberWithoutPage(dpt.getId(),getMembersVO.getUserName(),null,null,null);
+ gmv.setMemberDOS(memberDOS1);
+ getMembersVOS.add(gmv);
+ }else {
+ //公司人员
+ List memberDOS = memberMapper.selectList(new QueryWrapper()
+ .lambda()
+ .eq(MemberDO::getCompanyId,getDepartmentMembersDTO.getCompanyId()));
+ gmv.setMemberDOS(memberDOS);
+ getMembersVOS.add(gmv);
+ }
+ }
+ return getMembersVOS;
+ }
+
+
+ /**
+ * 递归 带上部门总数,部门负责人等参数
+ *
+ * @param getMembersVO 父节点查找该节点的children
+ * @return 子节点
+ */
+ public List getChildNodes(GetMembersVO getMembersVO) {
+
+ List getAllDepartmentVOS = new ArrayList<>();
+
+ //查询该节点的子节点
+ List departmentDictDOS = this.baseMapper.selectList(new QueryWrapper()
+ .lambda()
+ .eq(DepartmentDictDO::getParentId, getMembersVO.getId()));
+
+ //递归
+ for (DepartmentDictDO dd : departmentDictDOS) {
+ GetMembersVO gmv = new GetMembersVO();
+ BeanUtils.copyProperties(dd, gmv);
+ if (null!=dd.getParentId()){
+ DepartmentDictDO departmentDictDO = this.baseMapper.selectById(dd.getParentId());
+ gmv.setParentDepartmentName(departmentDictDO.getDepartmentName());
+ }
+ gmv.setChildren(getChildNodes(gmv));
+
+
+ //部门人员
+ List memberDOS = memberMapper.getMemberWithoutPage(dd.getId(),getMembersVO.getUserName(),null,null,null);
+ gmv.setMemberDOS(memberDOS);
+ getAllDepartmentVOS.add(gmv);
+ }
+ if (departmentDictDOS.size() == 0) {
+ return null;
+ }
+
+ return getAllDepartmentVOS;
+ }
}
diff --git a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
index 2d5544e..b1e89d1 100644
--- a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
@@ -8,16 +8,19 @@ import com.subsidy.common.RedisPrefixConstant;
import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.administer.VerifyCodeDTO;
import com.subsidy.dto.member.AddMemberDTO;
+import com.subsidy.dto.member.ChangeDepartmentsDTO;
import com.subsidy.dto.member.ContentMemberDTO;
import com.subsidy.dto.member.GetAllDTO;
import com.subsidy.dto.member.MyCoursesDTO;
import com.subsidy.dto.member.PasswordLoginDTO;
import com.subsidy.dto.member.StudyHistoryDTO;
import com.subsidy.mapper.ClassDictMapper;
+import com.subsidy.mapper.ClassHourDictMapper;
import com.subsidy.mapper.ClassMemberMappingMapper;
import com.subsidy.mapper.CompanyDictMapper;
import com.subsidy.mapper.CourseContentMapper;
import com.subsidy.mapper.CourseFieldMappingMapper;
+import com.subsidy.mapper.DepartmentDictMapper;
import com.subsidy.mapper.ExerciseDoneResultMapper;
import com.subsidy.mapper.FileDictMapper;
import com.subsidy.mapper.JobDictMapper;
@@ -26,6 +29,9 @@ import com.subsidy.mapper.MemberDepartmentMappingMapper;
import com.subsidy.mapper.MemberMapper;
import com.subsidy.mapper.OprMemDictMapper;
import com.subsidy.mapper.PaperDictMapper;
+import com.subsidy.mapper.RotationImgDictMapper;
+import com.subsidy.mapper.SmsVerifyCodeMapper;
+import com.subsidy.mapper.VodDictMapper;
import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.model.ClassDictDO;
import com.subsidy.model.ClassHourDictDO;
@@ -41,10 +47,12 @@ import com.subsidy.model.JobMemberMappingDO;
import com.subsidy.model.MemberDO;
import com.subsidy.model.MemberDepartmentMappingDO;
import com.subsidy.model.OprMemDictDO;
+import com.subsidy.model.RotationImgDictDO;
+import com.subsidy.model.SmsVerifyCodeDO;
import com.subsidy.model.VodDictDO;
import com.subsidy.service.MemberService;
import com.subsidy.util.ConstantUtils;
-import com.subsidy.util.RedisUtil;
+//import com.subsidy.util.RedisUtil;
import com.subsidy.vo.administer.UserRoleVO;
import com.subsidy.vo.member.ContentFilesVO;
import com.subsidy.vo.member.ContentVodNewVO;
@@ -106,8 +114,8 @@ public class MemberServiceImpl extends ServiceImpl imple
@Autowired
private MemberDepartmentMappingMapper memberDepartmentMappingMapper;
- @Autowired
- private RedisUtil redisUtil;
+ //@Autowired
+ //private RedisUtil redisUtil;
@Autowired
private CourseFieldMappingMapper courseFieldMappingMapper;
@@ -124,9 +132,33 @@ public class MemberServiceImpl extends ServiceImpl imple
@Autowired
private JobMemberMappingMapper jobMemberMappingMapper;
+ @Autowired
+ private DepartmentDictMapper departmentDictMapper;
+
+ @Autowired
+ private RotationImgDictMapper rotationImgDictMapper;
+
+ @Autowired
+ private VodDictMapper vodDictMapper;
+
+ @Autowired
+ private SmsVerifyCodeMapper smsVerifyCodeMapper;
+
+ @Autowired
+ private ClassHourDictMapper classHourDictMapper;
+
public IPage getAll(GetAllDTO getAllDTO) {
Page pager = new Page(getAllDTO.getPageNum(), getAllDTO.getPageSize());
- IPage iPage = this.baseMapper.getMembers(pager, getAllDTO.getDepartmentId(), getAllDTO.getUserName(), getAllDTO.getStatus());
+
+ DepartmentDictDO departmentDictDO = departmentDictMapper.selectById(getAllDTO.getDepartmentId());
+
+ IPage iPage = null;
+
+ if (null != departmentDictDO.getParentId()) {
+ iPage = this.baseMapper.getMembers(pager, getAllDTO.getDepartmentId(), getAllDTO.getUserName(), getAllDTO.getStatus(), getAllDTO.getStartDate(), getAllDTO.getEndDate());
+ } else {
+ iPage = this.baseMapper.getCompanyMember(pager, departmentDictDO.getCompanyId(), getAllDTO.getUserName(), getAllDTO.getStatus(), getAllDTO.getStartDate(), getAllDTO.getEndDate());
+ }
List getAllVOS = iPage.getRecords();
for (GetAllVO getAllVO : getAllVOS) {
@@ -181,7 +213,7 @@ public class MemberServiceImpl extends ServiceImpl imple
//公司赋值
memberDO.setCompanyId(addMemberDTO.getCompanyId());
this.baseMapper.insert(memberDO);
- redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
+ //redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
if (null != addMemberDTO.getDepartmentIds()) {
//部门
@@ -238,8 +270,8 @@ public class MemberServiceImpl extends ServiceImpl imple
MemberDO memberDO = new MemberDO();
BeanUtils.copyProperties(addMemberDTO, memberDO);
this.baseMapper.updateById(memberDO);
- MemberDO memberDO1 = this.baseMapper.selectById(addMemberDTO.getId());
- redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO1);
+ //MemberDO memberDO1 = this.baseMapper.selectById(addMemberDTO.getId());
+ //redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO1);
if (null != addMemberDTO.getDepartmentIds()) {
memberDepartmentMappingMapper.delete(new QueryWrapper()
@@ -308,13 +340,18 @@ public class MemberServiceImpl extends ServiceImpl imple
if (0 == memberDO.getFirstLogin()) {
memberDO.setFirstLogin(1);
this.baseMapper.updateById(memberDO);
- redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
+ //redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
}
BeanUtils.copyProperties(memberDO, userRoleVO);
- String code = redisUtil.get(RedisPrefixConstant.SUBSIDY_TELEPHONE_PREFIX + verifyCodeDTO.getTelephone()).toString();
+ //String code = redisUtil.get(RedisPrefixConstant.SUBSIDY_TELEPHONE_PREFIX + verifyCodeDTO.getTelephone()).toString();
+ SmsVerifyCodeDO smsCodeDO = smsVerifyCodeMapper.selectOne(new QueryWrapper()
+ .lambda()
+ .eq(SmsVerifyCodeDO::getTelephone, verifyCodeDTO.getTelephone())
+ .eq(SmsVerifyCodeDO::getVerifyCode, verifyCodeDTO.getVerifyCode())
+ .gt(SmsVerifyCodeDO::getCreateDate, LocalDateTime.now().minusMinutes(30L)));
- if (code == null || !verifyCodeDTO.getVerifyCode().equals(code)) {
+ if (null != smsCodeDO || !verifyCodeDTO.getVerifyCode().equals(smsCodeDO.getVerifyCode())) {
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
@@ -340,6 +377,13 @@ public class MemberServiceImpl extends ServiceImpl imple
//oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
oprMemDictMapper.insert(oprMemDictDO);
//mongoTemplate.insert(oprMemDictDO);
+ userRoleVO.setCompanyId(companyDictDO.getId());
+ userRoleVO.setCompanyName(companyDictDO.getCompanyName());
+ userRoleVO.setLogo(companyDictDO.getLogo());
+ List rotationImgDictDOS = rotationImgDictMapper.selectList(new QueryWrapper()
+ .lambda()
+ .eq(RotationImgDictDO::getCompanyId, companyDictDO.getId()));
+ userRoleVO.setRotationImgDictDOS(rotationImgDictDOS);
return userRoleVO;
}
@@ -347,7 +391,8 @@ public class MemberServiceImpl extends ServiceImpl imple
/**
* 先从redis里查
*/
- MemberDO memberDO = (MemberDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + passwordLoginDTO.getCompanyId() + ":" + passwordLoginDTO.getAccountName());
+ //MemberDO memberDO = (MemberDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + passwordLoginDTO.getCompanyId() + ":" + passwordLoginDTO.getAccountName());
+ MemberDO memberDO = null;
if (null == memberDO) {
/**
* redis里没有,从数据库里查
@@ -363,9 +408,11 @@ public class MemberServiceImpl extends ServiceImpl imple
CompanyDictDO companyDictDO = companyDictMapper.selectById(memberDO.getCompanyId());
+
if (memberDO.getPassword().equals(passwordLoginDTO.getPassword()) && 1 == memberDO.getFirstLogin() && !"冻结".equals(memberDO.getStatus())) {
MemberVO memberVO = new MemberVO();
BeanUtils.copyProperties(memberDO, memberVO);
+ memberVO.setCompanyId(companyDictDO.getId());
memberVO.setCompanyName(companyDictDO.getCompanyName());
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
@@ -378,7 +425,14 @@ public class MemberServiceImpl extends ServiceImpl imple
//oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
//mongoTemplate.insert(oprMemDictDO);
oprMemDictMapper.insert(oprMemDictDO);
- redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + passwordLoginDTO.getCompanyId() + ":" + passwordLoginDTO.getAccountName(), memberDO);
+ memberVO.setCompanyId(companyDictDO.getId());
+ memberVO.setCompanyName(companyDictDO.getCompanyName());
+ memberVO.setLogo(companyDictDO.getLogo());
+ List rotationImgDictDOS = rotationImgDictMapper.selectList(new QueryWrapper()
+ .lambda()
+ .eq(RotationImgDictDO::getCompanyId, companyDictDO.getId()));
+ memberVO.setRotationImgDictDOS(rotationImgDictDOS);
+ //redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + passwordLoginDTO.getCompanyId() + ":" + passwordLoginDTO.getAccountName(), memberDO);
//redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + System.currentTimeMillis(), 1);
return memberVO;
} else {
@@ -421,8 +475,8 @@ public class MemberServiceImpl extends ServiceImpl imple
public String updatePassword(MemberDO memberDO) {
this.baseMapper.updateById(memberDO);
- MemberDO memberDO1 = this.baseMapper.selectById(memberDO.getId());
- redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO1.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
+ //MemberDO memberDO1 = this.baseMapper.selectById(memberDO.getId());
+ //redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO1.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
return ConstantUtils.SET_SUCCESS;
}
@@ -490,23 +544,49 @@ public class MemberServiceImpl extends ServiceImpl imple
.eq(CourseContentDO::getCourseId, contentVodDTO.getCourseId())
.orderByAsc(CourseContentDO::getOrderNo));
+ ClassDictDO classDictDO1 = classDictMapper.selectById(contentVodDTO.getClassId());
+
+ //目录状态
+ Boolean contentStatus = true;
+
for (CourseContentDO courseContentDO : courseContentDOS) {
ContentVodVO contentVodVO = new ContentVodVO();
contentVodVO.setContent(courseContentDO.getContent());
- List memberVodVOS = courseContentMapper.contentVodProcess(courseContentDO.getId(), contentVodDTO.getMemberId());
+ List memberVodVOS = courseContentMapper.contentVodProcess(courseContentDO.getId(), contentVodDTO.getMemberId(),contentVodDTO.getClassId());
Boolean flag = false;
- for (MemberVodVO memberVodVO : memberVodVOS) {
- if (memberVodVO.getPercent() == 100 && !flag) {
- //这个视频看完了,已解锁
+ int i = 0;
+
+ if (1 == classDictDO1.getIsOrder()) {
+ for (MemberVodVO memberVodVO : memberVodVOS) {
+
+ if (i == 0 && contentStatus) {
+ //第一个视频默认打开
+ memberVodVO.setStatus(true);
+ } else if (memberVodVO.getPercent() == 100) {
+ //这个视频看完了,已解锁
+ memberVodVO.setStatus(true);
+ } else {
+ //这个视频没看完,未解锁
+ if (!flag) {
+ //这个视频可见 ===> 第一个没看完但可以看的视频
+ memberVodVO.setStatus(true);
+ flag = true;
+ } else {
+ memberVodVO.setStatus(false);
+ }
+ contentStatus = false;
+ }
+
+ i++;
+ }
+ } else {
+ for (MemberVodVO memberVodVO : memberVodVOS) {
memberVodVO.setStatus(true);
- } else {
- //这个视频没看完,未解锁
- memberVodVO.setStatus(false);
- flag = true;
}
}
+
int playCount = 0;
for (MemberVodVO memberVodVO : memberVodVOS) {
if (100 == memberVodVO.getPercent()) {
@@ -567,10 +647,10 @@ public class MemberServiceImpl extends ServiceImpl imple
List queryPapersVOS = paperDictMapper.queryPapers(contentMemberDTO.getCourseId(), null, 1);
for (QueryPapersVO queryPapersVO : queryPapersVOS) {
//多少人已完成
- Integer cnt = paperDictMapper.completeCount(queryPapersVO.getId());
+ Integer cnt = paperDictMapper.completeCount(queryPapersVO.getId(),contentMemberDTO.getClassId());
queryPapersVO.setCompleteCnt(cnt);
//自己成绩
- List exerciseDoneResultDOS = exerciseDoneResultMapper.getMaxScorePaper(queryPapersVO.getId(), contentMemberDTO.getMemberId());
+ List exerciseDoneResultDOS = exerciseDoneResultMapper.getMaxScorePaper(queryPapersVO.getId(), contentMemberDTO.getMemberId(),contentMemberDTO.getClassId());
if (exerciseDoneResultDOS.size() > 0) {
queryPapersVO.setRightCounts(exerciseDoneResultDOS.get(0).getRightCounts());
@@ -607,7 +687,7 @@ public class MemberServiceImpl extends ServiceImpl imple
for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) {
List vodDictDOS = classDictMapper.getClassVods(classMemberMappingDO.getClassId());
for (VodDictDO vodDictDO : vodDictDOS) {
- int playLength = vodPlayHistoryMapper.memberVodTotalLength(memberDO.getId(), vodDictDO.getId());
+ int playLength = vodPlayHistoryMapper.memberVodTotalLength(memberDO.getId(), vodDictDO.getId(), classMemberMappingDO.getClassId());
if (playLength < vodDictDO.getVodLength()) {
break;
}
@@ -631,7 +711,9 @@ public class MemberServiceImpl extends ServiceImpl imple
public String checkTimes(ExerciseDoneResultDO exerciseDoneResultDO) {
MemberDO memberDO = this.baseMapper.selectById(exerciseDoneResultDO.getMemberId());
- ClassHourDictDO classHourDictDO = (ClassHourDictDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_SETTINGS_PREFIX + memberDO.getCompanyId());
+ ClassHourDictDO classHourDictDO = classHourDictMapper.selectOne(new QueryWrapper()
+ .lambda()
+ .eq(ClassHourDictDO::getCompanyId, memberDO.getCompanyId()));
if (null != classHourDictDO) {
Integer status = classHourDictDO.getRepeatStatus();
@@ -655,8 +737,32 @@ public class MemberServiceImpl extends ServiceImpl imple
public void importRedis() {
List memberDOS = this.baseMapper.selectList(null);
for (MemberDO memberDO : memberDOS) {
- redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
+ //redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
}
}
+ public String changeDepartments(ChangeDepartmentsDTO changeDepartmentsDTO) {
+
+ List memberIds = changeDepartmentsDTO.getMemberIds();
+
+ //清掉以前的部门
+ for (Long lg : memberIds) {
+ memberDepartmentMappingMapper.delete(new QueryWrapper()
+ .lambda()
+ .eq(MemberDepartmentMappingDO::getMemberId, lg));
+ }
+
+ //加入新的部门
+ List depIds = changeDepartmentsDTO.getDesDepId();
+ for (Long lg : memberIds) {
+ for (Long depId : depIds) {
+ MemberDepartmentMappingDO memberDepartmentMappingDO = new MemberDepartmentMappingDO();
+ memberDepartmentMappingDO.setMemberId(lg);
+ memberDepartmentMappingDO.setDepartmentId(depId);
+ memberDepartmentMappingMapper.insert(memberDepartmentMappingDO);
+ }
+ }
+ return ConstantUtils.SET_SUCCESS;
+ }
+
}
diff --git a/src/main/java/com/subsidy/service/impl/RotationImgDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/RotationImgDictServiceImpl.java
new file mode 100644
index 0000000..59ee887
--- /dev/null
+++ b/src/main/java/com/subsidy/service/impl/RotationImgDictServiceImpl.java
@@ -0,0 +1,44 @@
+package com.subsidy.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.subsidy.model.RotationImgDictDO;
+import com.subsidy.mapper.RotationImgDictMapper;
+import com.subsidy.service.RotationImgDictService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.subsidy.util.ConstantUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ *
+ * 轮播图 服务实现类
+ *
+ *
+ * @author DengMin
+ * @since 2022-02-23
+ */
+@Service
+public class RotationImgDictServiceImpl extends ServiceImpl implements RotationImgDictService {
+
+ public String addRotation(RotationImgDictDO rotationImgDictDO) {
+ this.baseMapper.insert(rotationImgDictDO);
+ return ConstantUtils.ADD_SUCCESS;
+ }
+
+ public String deleteRotation(RotationImgDictDO rotationImgDictDO) {
+ this.baseMapper.deleteById(rotationImgDictDO.getId());
+ return ConstantUtils.DELETE_SUCCESS;
+ }
+
+ public String updateRotation(RotationImgDictDO rotationImgDictDO) {
+ this.baseMapper.updateById(rotationImgDictDO);
+ return ConstantUtils.SET_SUCCESS;
+ }
+
+ public List getAllRotations(RotationImgDictDO rotationImgDictDO){
+ return this.baseMapper.selectList(new QueryWrapper()
+ .lambda()
+ .eq(RotationImgDictDO::getCompanyId,rotationImgDictDO.getCompanyId()));
+ }
+}
diff --git a/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java b/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java
index 6c1aba2..52c75e9 100644
--- a/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java
@@ -4,15 +4,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.subsidy.common.RedisPrefixConstant;
import com.subsidy.dto.member.GetMemberSignInfoDTO;
import com.subsidy.dto.sign.DataViewDTO;
import com.subsidy.mapper.AnsweringQuestionMapper;
import com.subsidy.mapper.ClassDictMapper;
-import com.subsidy.mapper.ClassHourDictMapper;
import com.subsidy.mapper.ClassMemberMappingMapper;
import com.subsidy.mapper.ExerciseDoneResultMapper;
-import com.subsidy.mapper.MemberMapper;
import com.subsidy.mapper.SignInRecordMapper;
import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.model.AnsweringQuestionDO;
@@ -24,22 +21,19 @@ import com.subsidy.model.VodDictDO;
import com.subsidy.service.SignInRecordService;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.DateFormatUtil;
-import com.subsidy.util.MathUtil;
-import com.subsidy.util.MyBeanUtils;
-import com.subsidy.util.RedisUtil;
import com.subsidy.vo.member.GetMemberSignInfoVO;
import com.subsidy.vo.sign.DataViewVO;
import com.subsidy.vo.sign.SignInStatusVO;
-import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.time.LocalDate;
import java.time.LocalDateTime;
-import java.time.ZoneOffset;
import java.util.Date;
import java.util.List;
-import java.util.Set;
+
+//import com.subsidy.util.RedisUtil;
/**
*
@@ -58,8 +52,8 @@ public class SignInRecordServiceImpl extends ServiceImpl classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId());
for (ClassDictDO classDictDO : classDictDOS) {
- Set set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + signInRecordDO.getClassId() + ":" + DateFormatUtil.format(signInRecordDO.getSignInDate(), "yyyy-MM-dd")+":*");
- if(set != null && set.size() > 0) {
- redisUtil.del(set);
- }
- redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + classDictDO.getId() + ":" + DateFormatUtil.format(new Date(), "yyyy-MM-dd") + ":" + System.currentTimeMillis(), null);
+ //Set set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + signInRecordDO.getClassId() + ":" + DateFormatUtil.format(signInRecordDO.getSignInDate(), "yyyy-MM-dd")+":*");
+ //if(set != null && set.size() > 0) {
+ // redisUtil.del(set);
+ //}
+ //redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + classDictDO.getId() + ":" + DateFormatUtil.format(new Date(), "yyyy-MM-dd") + ":" + System.currentTimeMillis(), null);
+
+ signInRecordMapper.delete(new QueryWrapper()
+ .lambda()
+ .eq(SignInRecordDO::getMemberId,signInRecordDO.getMemberId())
+ .eq(SignInRecordDO::getClassId,classDictDO.getId()));
// 存储到缓存到同时保存到数据库
SignInRecordDO sign = this.baseMapper.selectOne(new QueryWrapper()
@@ -159,7 +158,7 @@ public class SignInRecordServiceImpl extends ServiceImpl= vodDictDO.getVodLength()) {
i++;
}
@@ -196,13 +195,34 @@ public class SignInRecordServiceImpl extends ServiceImpl signInRecordDOS = signInRecordMapper.selectList(new QueryWrapper()
+ //.lambda()
+ //.eq(SignInRecordDO::getMemberId,signInRecordDO.getMemberId())
+ //.eq(SignInRecordDO::getClassId))
+ //if (size <= count) {
+ // signInStatusVO.setStatus(false);
+ //}
+ //获取有效课程
+ List classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId());
- if (size < count) {
- signInStatusVO.setStatus(false);
- }
+ for (ClassDictDO classDictDO : classDictDOS) {
+ Integer count = this.baseMapper.selectCount(new QueryWrapper()
+ .lambda()
+ .eq(SignInRecordDO::getClassId, classDictDO.getId())
+ .eq(SignInRecordDO::getMemberId, signInRecordDO.getMemberId())
+ .gt(SignInRecordDO::getSignInDate, LocalDate.now()));
+
+ //String count = redisUtil.get("signInStatus:"+signInRecordDO.getMemberId()+":"+classDictDO.getId()).toString();
+
+ if (count == 0) {
+ flag = false; //没有签到
+ }
+ }
+ signInStatusVO.setStatus(flag);
return signInStatusVO;
}
@@ -227,11 +247,11 @@ public class SignInRecordServiceImpl extends ServiceImpl signInRecordDOS = signInRecordMapper.selectList(null);
- for (SignInRecordDO signInRecordDO : signInRecordDOS){
- redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX+signInRecordDO.getMemberId()+":classId:"+
- signInRecordDO.getClassId()+":"+signInRecordDO.getSignInDate().toString().split("T")[0]+":"+signInRecordDO.getSignInDate().toInstant(ZoneOffset.of("+8")).toEpochMilli(),signInRecordDO);
- }
+ //List signInRecordDOS = signInRecordMapper.selectList(null);
+ //for (SignInRecordDO signInRecordDO : signInRecordDOS){
+ // redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX+signInRecordDO.getMemberId()+":classId:"+
+ // signInRecordDO.getClassId()+":"+signInRecordDO.getSignInDate().toString().split("T")[0]+":"+signInRecordDO.getSignInDate().toInstant(ZoneOffset.of("+8")).toEpochMilli(),signInRecordDO);
+ //}
// redisUtil.scan("*20220126*");
// redisUtil.("*20220126*");
diff --git a/src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java b/src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java
index ef6d289..beccc4e 100644
--- a/src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java
@@ -11,7 +11,6 @@ import com.subsidy.model.MemberDO;
import com.subsidy.model.SmsVerifyCodeDO;
import com.subsidy.service.SmsVerifyCodeService;
import com.subsidy.util.RandomUtil;
-import com.subsidy.util.RedisUtil;
import com.subsidy.util.SMSUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
@@ -34,8 +33,8 @@ public class SmsVerifyCodeServiceImpl extends ServiceImpl()
@@ -47,10 +46,15 @@ public class SmsVerifyCodeServiceImpl extends ServiceImpl im
}
public String addVod(VodDictDO vodDictDO) {
+
+ //排序
+ int orderNo = 1;
+
+ List vodDictDOS = this.baseMapper.selectList(new QueryWrapper()
+ .lambda()
+ .eq(VodDictDO::getContentId,vodDictDO.getContentId())
+ .orderByDesc(VodDictDO::getOrderNo));
+
+ if (vodDictDOS.size()>0){
+ VodDictDO vodDictDO1 = vodDictDOS.get(0);
+ if (null!=vodDictDO1){
+ orderNo = vodDictDOS.get(0).getOrderNo()+1;
+ }
+ }
+ vodDictDO.setOrderNo(orderNo);
this.baseMapper.insert(vodDictDO);
//测试环境就不转码了
diff --git a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
index 7d70fb4..c40e517 100644
--- a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
@@ -2,6 +2,7 @@ package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.vod.FixDataTwoDTO;
import com.subsidy.dto.vod.RemainSecondsDTO;
import com.subsidy.dto.vod.SignDatePlaysDTO;
@@ -51,13 +52,49 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl()
+ .lambda()
+ .eq(ClassHourDictDO::getCompanyId,memberDO.getCompanyId()));
+
+ if (classHourDictDO.getStatus() == 1) {
+ //查看当天这个人看了多少时间
+ Integer total = vodPlayHistoryMapper.memberDailyStudyLength(memberDO.getId());
+
+ //是否超过时长 没超过 false 超过 true
+ if (total + vodPlayHistoryDO.getPlayLength() >= classHourDictDO.getClassHour() * 3600) {
+ throw new HttpException(13001);
+ }
+ }
vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO);
return ConstantUtils.ADD_SUCCESS;
}
public String insertHistoryNew(VodPlayHistoryDO vodPlayHistoryDO) {
+ MemberDO memberDO = memberMapper.selectById(vodPlayHistoryDO.getMemberId());
+ //查看系统设定的时长
+ ClassHourDictDO classHourDictDO = classHourDictMapper.selectOne (new QueryWrapper()
+ .lambda()
+ .eq(ClassHourDictDO::getCompanyId,memberDO.getCompanyId()));
+
+ if (classHourDictDO.getStatus() == 1) {
+ //查看当天这个人看了多少时间
+ Integer total = vodPlayHistoryMapper.memberDailyStudyLength(memberDO.getId());
+
+ //是否超过时长 没超过 false 超过 true
+ if (total + vodPlayHistoryDO.getPlayLength() >= classHourDictDO.getClassHour() * 3600) {
+ throw new HttpException(13001);
+ }
+ }
vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO);
return ConstantUtils.ADD_SUCCESS;
diff --git a/src/main/java/com/subsidy/util/RedisUtil.java b/src/main/java/com/subsidy/util/RedisUtil.java
index 6ca603e..118f178 100644
--- a/src/main/java/com/subsidy/util/RedisUtil.java
+++ b/src/main/java/com/subsidy/util/RedisUtil.java
@@ -1,633 +1,633 @@
-package com.subsidy.util;
-
-import com.google.common.collect.Sets;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.connection.jedis.JedisConnection;
-import org.springframework.data.redis.core.BoundListOperations;
-import org.springframework.data.redis.core.Cursor;
-import org.springframework.data.redis.core.RedisCallback;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.data.redis.core.ScanOptions;
-import org.springframework.data.redis.serializer.RedisSerializer;
-import org.springframework.stereotype.Component;
-import org.springframework.util.CollectionUtils;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import redis.clients.jedis.ScanParams;
-import redis.clients.jedis.commands.JedisCommands;
-import redis.clients.jedis.commands.MultiKeyCommands;
-
-import javax.annotation.Resource;
-import java.io.Serializable;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-/**
- *
- * redisTemplate封装
- *
- *
- * @author DengMin
- * @since 2020/12/17
- */
-
-@Component
-public class RedisUtil {
-
-
- @Autowired
- private RedisTemplate redisTemplate;
-
- public RedisUtil(RedisTemplate redisTemplate) {
- this.redisTemplate = redisTemplate;
- }
-
- /**
- * 指定缓存失效时间
- * @param key 键
- * @param time 时间(秒)
- * @return
- */
- public boolean expire(String key,long time){
- try {
- if(time>0){
- redisTemplate.expire(key, time, TimeUnit.SECONDS);
- }
- return true;
- } catch (Exception e) {
- e.printStackTrace();
- return false;
- }
- }
-
- /**
- * 根据key 获取过期时间
- * @param key 键 不能为null
- * @return 时间(秒) 返回0代表为永久有效
- */
- public long getExpire(String key){
- return redisTemplate.getExpire(key,TimeUnit.SECONDS);
- }
-
- /**
- * 判断key是否存在
- * @param key 键
- * @return true 存在 false不存在
- */
- public boolean hasKey(String key){
- try {
- return redisTemplate.hasKey(key);
- } catch (Exception e) {
- e.printStackTrace();
- return false;
- }
- }
-
- /**
- * 删除缓存
- * @param key 可以传一个值 或多个
- */
- @SuppressWarnings("unchecked")
- public void del(String ... key){
- if(key!=null&&key.length>0){
- if(key.length==1){
- redisTemplate.delete(key[0]);
- }else{
- redisTemplate.delete(CollectionUtils.arrayToList(key));
- }
- }
- }
-
- /**
- * 删除缓存
- * @param key 集合数据
- */
- public void del(Set key) {
- if (key != null && key.size() > 0) {
- redisTemplate.delete(key);
- }
- }
-
- //============================String=============================
- /**
- * 普通缓存获取
- * @param key 键
- * @return 值
- */
- public Object get(String key){
- return key==null?null:redisTemplate.opsForValue().get(key);
- }
-
- /**
- * 普通缓存放入
- * @param key 键
- * @param value 值
- * @return true成功 false失败
- */
- public boolean set(String key,Object value) {
- try {
- redisTemplate.opsForValue().set(key, value);
- return true;
- } catch (Exception e) {
- e.printStackTrace();
- return false;
- }
- }
-
- /**
- * 普通缓存放入并设置时间
- * @param key 键
- * @param value 值
- * @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期
- * @return true成功 false 失败
- */
- public boolean set(String key,Object value,long time){
- try {
- if(time>0){
- redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
- }else{
- set(key, value);
- }
- return true;
- } catch (Exception e) {
- e.printStackTrace();
- return false;
- }
- }
-
- /**
- * 递增
- * @param key 键
- * @param delta 要增加几(大于0)
- * @return
- */
- public long incr(String key, long delta){
- if(delta<0){
- throw new RuntimeException("递增因子必须大于0");
- }
- return redisTemplate.opsForValue().increment(key, delta);
- }
-
- /**
- * 递减
- * @param key 键
- * @param delta 要减少几(小于0)
- * @return
- */
- public long decr(String key, long delta){
- if(delta<0){
- throw new RuntimeException("递减因子必须大于0");
- }
- return redisTemplate.opsForValue().increment(key, -delta);
- }
-
- //================================Map=================================
- /**
- * HashGet
- * @param key 键 不能为null
- * @param item 项 不能为null
- * @return 值
- */
- public Object hget(String key,String item){
- return redisTemplate.opsForHash().get(key, item);
- }
-
- /**
- * 获取hashKey对应的所有键值
- * @param key 键
- * @return 对应的多个键值
- */
- public Map