Commit c4adc855 by 涂亚平

2022.03.29 疫情备份 轻学堂

1 parent e37f68ee
...@@ -30,13 +30,13 @@ public class WebLogAspect { ...@@ -30,13 +30,13 @@ public class WebLogAspect {
public void logBeforeController(JoinPoint joinPoint) { public void logBeforeController(JoinPoint joinPoint) {
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); // RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
//这个RequestContextHolder是Springmvc提供来获得请求的东西 //这个RequestContextHolder是Springmvc提供来获得请求的东西
HttpServletRequest request = ((ServletRequestAttributes)requestAttributes).getRequest(); // HttpServletRequest request = ((ServletRequestAttributes)requestAttributes).getRequest();
// 记录下请求内容 // 记录下请求内容
logger.info("####requestUrl : " + request.getRequestURL().toString()); // logger.info("####requestUrl : " + request.getRequestURL().toString());
logger.info("####requestParam : " + Arrays.toString(joinPoint.getArgs())); // logger.info("####requestParam : " + Arrays.toString(joinPoint.getArgs()));
} }
......
...@@ -4,13 +4,7 @@ import com.subsidy.common.ResponseData; ...@@ -4,13 +4,7 @@ import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO; 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.*;
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.model.ExerciseDoneResultDO; import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.model.MemberDO; import com.subsidy.model.MemberDO;
import com.subsidy.service.MemberService; import com.subsidy.service.MemberService;
...@@ -78,6 +72,13 @@ public class MemberController { ...@@ -78,6 +72,13 @@ public class MemberController {
return ResponseData.generateCreatedResponse(0,memberService.passwordLogin(passwordLoginDTO)); 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") @PostMapping("updatePassword")
@ApiOperation("修改密码 {id password}") @ApiOperation("修改密码 {id password}")
@LoginRequired @LoginRequired
......
package com.subsidy.dto.member;
import lombok.Data;
@Data
public class QingxuetangLoginDTO {
private String telephone;
}
...@@ -3,13 +3,7 @@ package com.subsidy.service; ...@@ -3,13 +3,7 @@ package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.*;
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.model.ExerciseDoneResultDO; import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.model.FileDictDO; import com.subsidy.model.FileDictDO;
import com.subsidy.model.MemberDO; import com.subsidy.model.MemberDO;
...@@ -47,6 +41,8 @@ public interface MemberService extends IService<MemberDO> { ...@@ -47,6 +41,8 @@ public interface MemberService extends IService<MemberDO> {
MemberVO passwordLogin(PasswordLoginDTO passwordLoginDTO); MemberVO passwordLogin(PasswordLoginDTO passwordLoginDTO);
UserRoleVO qingxuetangLogin(QingxuetangLoginDTO qingxuetangLoginDTO);
String updatePassword(MemberDO memberDO); String updatePassword(MemberDO memberDO);
MemberStudyPageVO studyPage(MemberDO memberDO); MemberStudyPageVO studyPage(MemberDO memberDO);
......
...@@ -7,13 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -7,13 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.common.RedisPrefixConstant; 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.*;
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.ClassDictMapper;
import com.subsidy.mapper.ClassHourDictMapper; import com.subsidy.mapper.ClassHourDictMapper;
import com.subsidy.mapper.ClassMemberMappingMapper; import com.subsidy.mapper.ClassMemberMappingMapper;
...@@ -387,8 +381,8 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -387,8 +381,8 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
.eq(RotationImgDictDO::getCompanyId, companyDictDO.getId())); .eq(RotationImgDictDO::getCompanyId, companyDictDO.getId()));
userRoleVO.setRotationImgDictDOS(rotationImgDictDOS); userRoleVO.setRotationImgDictDOS(rotationImgDictDOS);
String token = JwtUtil.generateToken(memberDO.getId() ,ConstantUtils.MOBILE_TERMINATE); String token = JwtUtil.generateToken(memberDO.getId(), ConstantUtils.MOBILE_TERMINATE);
redisUtil.set(ConstantUtils.MOBILE_TERMINATE+"_"+memberDO.getId(), token); redisUtil.set(ConstantUtils.MOBILE_TERMINATE + "_" + memberDO.getId(), token);
userRoleVO.setToken(token); userRoleVO.setToken(token);
return userRoleVO; return userRoleVO;
} }
...@@ -439,8 +433,8 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -439,8 +433,8 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
//redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + passwordLoginDTO.getCompanyId() + ":" + passwordLoginDTO.getAccountName(), memberDO); //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);
String token = JwtUtil.generateToken(memberDO.getId() ,ConstantUtils.MOBILE_TERMINATE); String token = JwtUtil.generateToken(memberDO.getId(), ConstantUtils.MOBILE_TERMINATE);
redisUtil.set(ConstantUtils.MOBILE_TERMINATE+"_"+memberDO.getId(), token); redisUtil.set(ConstantUtils.MOBILE_TERMINATE + "_" + memberDO.getId(), token);
memberVO.setToken(token); memberVO.setToken(token);
return memberVO; return memberVO;
} else { } else {
...@@ -483,6 +477,72 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -483,6 +477,72 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
return null; return null;
} }
public UserRoleVO qingxuetangLogin(QingxuetangLoginDTO qingxuetangLoginDTO) {
UserRoleVO userRoleVO = new UserRoleVO();
//鉴权逻辑
//先从redis里拿 还得从数据库先查公司。。还是直接查人快
MemberDO memberDO = this.baseMapper.selectOne(new QueryWrapper<MemberDO>()
.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<RotationImgDictDO> rotationImgDictDOS = rotationImgDictMapper.selectList(new QueryWrapper<RotationImgDictDO>()
.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) { 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());
...@@ -515,7 +575,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -515,7 +575,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
//该成员完成了几个视频 //该成员完成了几个视频
for (VodDictDO vodDictDO : vodDictDOS) { for (VodDictDO vodDictDO : vodDictDOS) {
int completeVodOrNot = vodPlayHistoryMapper.completeVodOrNot(memberId, vodDictDO.getId(),studyPageVO.getClassId()); int completeVodOrNot = vodPlayHistoryMapper.completeVodOrNot(memberId, vodDictDO.getId(), studyPageVO.getClassId());
i += completeVodOrNot; i += completeVodOrNot;
} }
studyPageVO.setDoneVods(i); studyPageVO.setDoneVods(i);
...@@ -563,7 +623,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -563,7 +623,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
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(),contentVodDTO.getClassId()); List<MemberVodVO> memberVodVOS = courseContentMapper.contentVodProcess(courseContentDO.getId(), contentVodDTO.getMemberId(), contentVodDTO.getClassId());
Boolean flag = false; Boolean flag = false;
int i = 0; int i = 0;
...@@ -657,10 +717,10 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -657,10 +717,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(),contentMemberDTO.getClassId()); Integer cnt = paperDictMapper.completeCount(queryPapersVO.getId(), contentMemberDTO.getClassId());
queryPapersVO.setCompleteCnt(cnt); queryPapersVO.setCompleteCnt(cnt);
//自己成绩 //自己成绩
List<ExerciseDoneResultDO> exerciseDoneResultDOS = exerciseDoneResultMapper.getMaxScorePaper(queryPapersVO.getId(), contentMemberDTO.getMemberId(),contentMemberDTO.getClassId()); 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());
...@@ -697,7 +757,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -697,7 +757,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(classMemberMappingDO.getClassId(),memberDO.getId(), vodDictDO.getId()); int playLength = vodPlayHistoryMapper.memberVodTotalLength(classMemberMappingDO.getClassId(), memberDO.getId(), vodDictDO.getId());
if (playLength < vodDictDO.getVodLength()) { if (playLength < vodDictDO.getVodLength()) {
break; break;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!