diff --git a/src/main/java/com/subsidy/common/configure/WebLogAspect.java b/src/main/java/com/subsidy/common/configure/WebLogAspect.java index 0f193cd..ebfe688 100644 --- a/src/main/java/com/subsidy/common/configure/WebLogAspect.java +++ b/src/main/java/com/subsidy/common/configure/WebLogAspect.java @@ -30,13 +30,13 @@ public class WebLogAspect { public void logBeforeController(JoinPoint joinPoint) { - RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); +// RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); //这个RequestContextHolder是Springmvc提供来获得请求的东西 - HttpServletRequest request = ((ServletRequestAttributes)requestAttributes).getRequest(); +// HttpServletRequest request = ((ServletRequestAttributes)requestAttributes).getRequest(); // 记录下请求内容 - logger.info("####requestUrl : " + request.getRequestURL().toString()); - logger.info("####requestParam : " + Arrays.toString(joinPoint.getArgs())); +// logger.info("####requestUrl : " + request.getRequestURL().toString()); +// logger.info("####requestParam : " + Arrays.toString(joinPoint.getArgs())); } diff --git a/src/main/java/com/subsidy/controller/MemberController.java b/src/main/java/com/subsidy/controller/MemberController.java index ca7bab2..dbcf814 100644 --- a/src/main/java/com/subsidy/controller/MemberController.java +++ b/src/main/java/com/subsidy/controller/MemberController.java @@ -4,13 +4,7 @@ import com.subsidy.common.ResponseData; import com.subsidy.common.ResponseVO; import com.subsidy.common.interceptor.LoginRequired; import com.subsidy.dto.administer.VerifyCodeDTO; -import com.subsidy.dto.member.AddMemberDTO; -import com.subsidy.dto.member.ChangeDepartmentsDTO; -import com.subsidy.dto.member.ContentMemberDTO; -import com.subsidy.dto.member.GetAllDTO; -import com.subsidy.dto.member.MyCoursesDTO; -import com.subsidy.dto.member.PasswordLoginDTO; -import com.subsidy.dto.member.StudyHistoryDTO; +import com.subsidy.dto.member.*; import com.subsidy.model.ExerciseDoneResultDO; import com.subsidy.model.MemberDO; import com.subsidy.service.MemberService; @@ -78,6 +72,13 @@ public class MemberController { return ResponseData.generateCreatedResponse(0,memberService.passwordLogin(passwordLoginDTO)); } + @PostMapping("qingxuetangLogin") + @ApiOperation("轻学堂登录 手机号") + public ResponseVO qingxuetangLogin(@RequestBody QingxuetangLoginDTO qingxuetangLoginDTO){ + return ResponseData.generateCreatedResponse(0,memberService.qingxuetangLogin(qingxuetangLoginDTO)); + } + + @PostMapping("updatePassword") @ApiOperation("修改密码 {id password}") @LoginRequired diff --git a/src/main/java/com/subsidy/dto/member/QingxuetangLoginDTO.java b/src/main/java/com/subsidy/dto/member/QingxuetangLoginDTO.java new file mode 100644 index 0000000..a4cad32 --- /dev/null +++ b/src/main/java/com/subsidy/dto/member/QingxuetangLoginDTO.java @@ -0,0 +1,10 @@ +package com.subsidy.dto.member; + +import lombok.Data; + +@Data +public class QingxuetangLoginDTO { + + private String telephone; + +} diff --git a/src/main/java/com/subsidy/service/MemberService.java b/src/main/java/com/subsidy/service/MemberService.java index 8d40a11..8888a19 100644 --- a/src/main/java/com/subsidy/service/MemberService.java +++ b/src/main/java/com/subsidy/service/MemberService.java @@ -3,13 +3,7 @@ package com.subsidy.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.subsidy.dto.administer.VerifyCodeDTO; -import com.subsidy.dto.member.AddMemberDTO; -import com.subsidy.dto.member.ChangeDepartmentsDTO; -import com.subsidy.dto.member.ContentMemberDTO; -import com.subsidy.dto.member.GetAllDTO; -import com.subsidy.dto.member.MyCoursesDTO; -import com.subsidy.dto.member.PasswordLoginDTO; -import com.subsidy.dto.member.StudyHistoryDTO; +import com.subsidy.dto.member.*; import com.subsidy.model.ExerciseDoneResultDO; import com.subsidy.model.FileDictDO; import com.subsidy.model.MemberDO; @@ -47,6 +41,8 @@ public interface MemberService extends IService { MemberVO passwordLogin(PasswordLoginDTO passwordLoginDTO); + UserRoleVO qingxuetangLogin(QingxuetangLoginDTO qingxuetangLoginDTO); + String updatePassword(MemberDO memberDO); MemberStudyPageVO studyPage(MemberDO memberDO); diff --git a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java index 1dfdc5c..a704fcc 100644 --- a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java @@ -7,13 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.dto.member.*; import com.subsidy.mapper.ClassDictMapper; import com.subsidy.mapper.ClassHourDictMapper; import com.subsidy.mapper.ClassMemberMappingMapper; @@ -387,8 +381,8 @@ public class MemberServiceImpl extends ServiceImpl imple .eq(RotationImgDictDO::getCompanyId, companyDictDO.getId())); userRoleVO.setRotationImgDictDOS(rotationImgDictDOS); - String token = JwtUtil.generateToken(memberDO.getId() ,ConstantUtils.MOBILE_TERMINATE); - redisUtil.set(ConstantUtils.MOBILE_TERMINATE+"_"+memberDO.getId(), token); + String token = JwtUtil.generateToken(memberDO.getId(), ConstantUtils.MOBILE_TERMINATE); + redisUtil.set(ConstantUtils.MOBILE_TERMINATE + "_" + memberDO.getId(), token); userRoleVO.setToken(token); return userRoleVO; } @@ -439,8 +433,8 @@ public class MemberServiceImpl extends ServiceImpl imple //redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + passwordLoginDTO.getCompanyId() + ":" + passwordLoginDTO.getAccountName(), memberDO); //redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + System.currentTimeMillis(), 1); - String token = JwtUtil.generateToken(memberDO.getId() ,ConstantUtils.MOBILE_TERMINATE); - redisUtil.set(ConstantUtils.MOBILE_TERMINATE+"_"+memberDO.getId(), token); + String token = JwtUtil.generateToken(memberDO.getId(), ConstantUtils.MOBILE_TERMINATE); + redisUtil.set(ConstantUtils.MOBILE_TERMINATE + "_" + memberDO.getId(), token); memberVO.setToken(token); return memberVO; } else { @@ -483,6 +477,72 @@ public class MemberServiceImpl extends ServiceImpl imple return null; } + public UserRoleVO qingxuetangLogin(QingxuetangLoginDTO qingxuetangLoginDTO) { + + UserRoleVO userRoleVO = new UserRoleVO(); + + //鉴权逻辑 + + //先从redis里拿 还得从数据库先查公司。。还是直接查人快 + MemberDO memberDO = this.baseMapper.selectOne(new QueryWrapper() + .lambda() + .eq(MemberDO::getTelephone, qingxuetangLoginDTO.getTelephone())); + if (memberDO == null) { + throw new HttpException(10010); + } + + CompanyDictDO companyDictDO = companyDictMapper.selectById(memberDO.getCompanyId()); + + if ("冻结".equals(memberDO.getStatus())) { + OprMemDictDO oprMemDictDO = new OprMemDictDO(); + oprMemDictDO.setUserId(memberDO.getId()); + oprMemDictDO.setOprType("登录"); + oprMemDictDO.setResult(0); + //oprMemDictDO.setUserName(memberDO.getUserName()); + //oprMemDictDO.setCreateDate(System.currentTimeMillis() + ""); + //oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd")); + //oprMemDictDO.setCompanyId(companyDictDO.getId()); + //oprMemDictDO.setCompanyName(companyDictDO.getCompanyName()); + //mongoTemplate.insert(oprMemDictDO); + oprMemDictMapper.insert(oprMemDictDO); + //redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + memberDO.getUserName() + ":" + companyDictDO.getCompanyName() + ":" + LocalDateTime.now(), oprMemDictDO); + throw new HttpException(10013); + } + + //是否登陆过 1:是 0:否 + if (0 == memberDO.getFirstLogin()) { + memberDO.setFirstLogin(1); + this.baseMapper.updateById(memberDO); + //redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO); + } + BeanUtils.copyProperties(memberDO, userRoleVO); + + //审计日志 + OprMemDictDO oprMemDictDO = new OprMemDictDO(); + oprMemDictDO.setUserId(memberDO.getId()); + oprMemDictDO.setOprType("登录"); + //oprMemDictDO.setUserName(memberDO.getUserName()); + oprMemDictDO.setResult(1); + //oprMemDictDO.setCreateDate(System.currentTimeMillis() + ""); + //oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd")); + //oprMemDictDO.setCompanyId(companyDictDO.getId()); + //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); + + String token = JwtUtil.generateToken(memberDO.getId(), ConstantUtils.MOBILE_TERMINATE); + redisUtil.set(ConstantUtils.MOBILE_TERMINATE + "_" + memberDO.getId(), token); + userRoleVO.setToken(token); + return userRoleVO; + } + public String updatePassword(MemberDO memberDO) { this.baseMapper.updateById(memberDO); //MemberDO memberDO1 = this.baseMapper.selectById(memberDO.getId()); @@ -515,7 +575,7 @@ public class MemberServiceImpl extends ServiceImpl imple //该成员完成了几个视频 for (VodDictDO vodDictDO : vodDictDOS) { - int completeVodOrNot = vodPlayHistoryMapper.completeVodOrNot(memberId, vodDictDO.getId(),studyPageVO.getClassId()); + int completeVodOrNot = vodPlayHistoryMapper.completeVodOrNot(memberId, vodDictDO.getId(), studyPageVO.getClassId()); i += completeVodOrNot; } studyPageVO.setDoneVods(i); @@ -563,7 +623,7 @@ public class MemberServiceImpl extends ServiceImpl imple ContentVodVO contentVodVO = new ContentVodVO(); contentVodVO.setContent(courseContentDO.getContent()); - List memberVodVOS = courseContentMapper.contentVodProcess(courseContentDO.getId(), contentVodDTO.getMemberId(),contentVodDTO.getClassId()); + List memberVodVOS = courseContentMapper.contentVodProcess(courseContentDO.getId(), contentVodDTO.getMemberId(), contentVodDTO.getClassId()); Boolean flag = false; int i = 0; @@ -657,10 +717,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(),contentMemberDTO.getClassId()); + Integer cnt = paperDictMapper.completeCount(queryPapersVO.getId(), contentMemberDTO.getClassId()); queryPapersVO.setCompleteCnt(cnt); //自己成绩 - List exerciseDoneResultDOS = exerciseDoneResultMapper.getMaxScorePaper(queryPapersVO.getId(), contentMemberDTO.getMemberId(),contentMemberDTO.getClassId()); + List exerciseDoneResultDOS = exerciseDoneResultMapper.getMaxScorePaper(queryPapersVO.getId(), contentMemberDTO.getMemberId(), contentMemberDTO.getClassId()); if (exerciseDoneResultDOS.size() > 0) { queryPapersVO.setRightCounts(exerciseDoneResultDOS.get(0).getRightCounts()); @@ -697,7 +757,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(classMemberMappingDO.getClassId(),memberDO.getId(), vodDictDO.getId()); + int playLength = vodPlayHistoryMapper.memberVodTotalLength(classMemberMappingDO.getClassId(), memberDO.getId(), vodDictDO.getId()); if (playLength < vodDictDO.getVodLength()) { break; }