Commit be81e3f1 by 涂亚平

支付前备份

1 parent fc42d8d5
...@@ -73,11 +73,18 @@ public class MemberController { ...@@ -73,11 +73,18 @@ public class MemberController {
} }
@PostMapping("qingxuetangLogin") @PostMapping("qingxuetangLogin")
@ApiOperation("轻学堂登录 手机号") @ApiOperation("轻学堂登录 手机号mobile")
public ResponseVO qingxuetangLogin(@RequestBody QingxuetangLoginDTO qingxuetangLoginDTO){ public ResponseVO qingxuetangLogin(@RequestBody QingxuetangLoginDTO qingxuetangLoginDTO){
return ResponseData.generateCreatedResponse(0,memberService.qingxuetangLogin(qingxuetangLoginDTO)); return ResponseData.generateCreatedResponse(0,memberService.qingxuetangLogin(qingxuetangLoginDTO));
} }
@PostMapping("kunchiLogin")
@ApiOperation("鲲驰登陆 authCorpName 手机号mobile nickname timestamp sign")
public ResponseVO kunchiLogin(@RequestBody QingxuetangLoginDTO qingxuetangLoginDTO){
return ResponseData.generateCreatedResponse(0,memberService.kunchiLogin(qingxuetangLoginDTO));
}
@PostMapping("updatePassword") @PostMapping("updatePassword")
@ApiOperation("修改密码 {id password}") @ApiOperation("修改密码 {id password}")
@LoginRequired @LoginRequired
......
...@@ -37,6 +37,8 @@ public interface MemberService extends IService<MemberDO> { ...@@ -37,6 +37,8 @@ public interface MemberService extends IService<MemberDO> {
UserRoleVO qingxuetangLogin(QingxuetangLoginDTO qingxuetangLoginDTO); UserRoleVO qingxuetangLogin(QingxuetangLoginDTO qingxuetangLoginDTO);
UserRoleVO kunchiLogin(QingxuetangLoginDTO qingxuetangLoginDTO);
String updatePassword(MemberDO memberDO); String updatePassword(MemberDO memberDO);
MemberStudyPageVO studyPage(MemberDO memberDO); MemberStudyPageVO studyPage(MemberDO memberDO);
......
...@@ -63,6 +63,7 @@ import java.time.Duration; ...@@ -63,6 +63,7 @@ import java.time.Duration;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.Future; import java.util.concurrent.Future;
...@@ -469,6 +470,13 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -469,6 +470,13 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
return null; return null;
} }
// 9a79cda9ef6f4a52a8
// 552a4147db2d4026bc4e9021acd614f8
public static void main(String[] args) {
String uuid = UUID.randomUUID().toString().replace("-","");
System.out.println(uuid);
}
public UserRoleVO qingxuetangLogin(QingxuetangLoginDTO qingxuetangLoginDTO) { public UserRoleVO qingxuetangLogin(QingxuetangLoginDTO qingxuetangLoginDTO) {
UserRoleVO userRoleVO = new UserRoleVO(); UserRoleVO userRoleVO = new UserRoleVO();
...@@ -539,15 +547,100 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple ...@@ -539,15 +547,100 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
throw new HttpException(10013); throw new HttpException(10013);
} }
//是否登陆过 1:是 0:否 // //是否登陆过 1:是 0:否
if (0 == memberDO.getFirstLogin()) { // if (0 == memberDO.getFirstLogin()) {
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(0);
// oprMemDictMapper.insert(oprMemDictDO);
// throw new HttpException(10015);
// }
BeanUtils.copyProperties(memberDO, userRoleVO);
//审计日志
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(1);
oprMemDictMapper.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 UserRoleVO kunchiLogin(QingxuetangLoginDTO qingxuetangLoginDTO){
UserRoleVO userRoleVO = new UserRoleVO();
// appId:9a79cda9ef6f4a52a8
// appSecret:552a4147db2d4026bc4e9021acd614f8
MemberDO memberDO = this.baseMapper.selectOne(new QueryWrapper<MemberDO>()
.lambda()
.eq(MemberDO::getTelephone, qingxuetangLoginDTO.getMobile()));
if (memberDO == null) {
throw new HttpException(10010);
}
/**
* 时间戳有没有过期
*/
if (qingxuetangLoginDTO.getTimestamp()-System.currentTimeMillis()>=5*60*1000 || System.currentTimeMillis()-qingxuetangLoginDTO.getTimestamp()>=5*60*1000){
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(14002);
}
//鉴权逻辑 对不对
String preAuthen = "appId=9a79cda9ef6f4a52a8"
+"&authCorpName="+ qingxuetangLoginDTO.getAuthCorpName()
+"&mobile="+qingxuetangLoginDTO.getMobile()
+"&nickname="+qingxuetangLoginDTO.getNickname()
+"&timestamp="+qingxuetangLoginDTO.getTimestamp()
+"&appSecret=552a4147db2d4026bc4e9021acd614f8" ;
String result = SecretUtils.getMD5String(preAuthen);
if (!qingxuetangLoginDTO.getSign().equals(result)){
OprMemDictDO oprMemDictDO = new OprMemDictDO(); OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录"); oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0); oprMemDictDO.setResult(0);
oprMemDictMapper.insert(oprMemDictDO); oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(10015); throw new HttpException(14001);
} }
CompanyDictDO companyDictDO = companyDictMapper.selectById(memberDO.getCompanyId());
if ("冻结".equals(memberDO.getStatus())) {
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(10013);
}
// //是否登陆过 1:是 0:否
// if (0 == memberDO.getFirstLogin()) {
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(0);
// oprMemDictMapper.insert(oprMemDictDO);
// throw new HttpException(10015);
// }
BeanUtils.copyProperties(memberDO, userRoleVO); BeanUtils.copyProperties(memberDO, userRoleVO);
//审计日志 //审计日志
......
...@@ -67,60 +67,66 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -67,60 +67,66 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
private RedisUtil redisUtil; private RedisUtil redisUtil;
public String insertHistory(VodPlayHistoryDO vodPlayHistoryDO) { public String insertHistory(VodPlayHistoryDO vodPlayHistoryDO) {
MemberDO memberDO = memberMapper.selectById(vodPlayHistoryDO.getMemberId());
//查看系统设定的时长 if (vodPlayHistoryDO.getPlayLength()>3){
ClassHourDictDO classHourDictDO = classHourDictMapper.selectOne(new QueryWrapper<ClassHourDictDO>() MemberDO memberDO = memberMapper.selectById(vodPlayHistoryDO.getMemberId());
.lambda() //查看系统设定的时长
.eq(ClassHourDictDO::getCompanyId, memberDO.getCompanyId())); ClassHourDictDO classHourDictDO = classHourDictMapper.selectOne(new QueryWrapper<ClassHourDictDO>()
.lambda()
if (classHourDictDO.getStatus() == 1) { .eq(ClassHourDictDO::getCompanyId, memberDO.getCompanyId()));
//查看当天这个人看了多少时间
Integer total = vodPlayHistoryMapper.memberDailyStudyLength(memberDO.getId()); if (classHourDictDO.getStatus() == 1) {
//查看当天这个人看了多少时间
//是否超过时长 没超过 false 超过 true Integer total = vodPlayHistoryMapper.memberDailyStudyLength(memberDO.getId());
if (total + vodPlayHistoryDO.getPlayLength() >= classHourDictDO.getClassHour() * 3600) {
int playLength = classHourDictDO.getClassHour() * 3600 - total; //是否超过时长 没超过 false 超过 true
vodPlayHistoryDO.setPlayLength(playLength); if (total + vodPlayHistoryDO.getPlayLength() >= classHourDictDO.getClassHour() * 3600) {
this.baseMapper.insert(vodPlayHistoryDO); int playLength = classHourDictDO.getClassHour() * 3600 - total;
throw new HttpException(13001); vodPlayHistoryDO.setPlayLength(playLength);
this.baseMapper.insert(vodPlayHistoryDO);
throw new HttpException(13001);
}
} }
vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO);
} }
vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO);
return ConstantUtils.ADD_SUCCESS; return ConstantUtils.ADD_SUCCESS;
} }
public String insertHistoryNew(InsertHistoryNewDTO insertHistoryNewDTO) { public String insertHistoryNew(InsertHistoryNewDTO insertHistoryNewDTO) {
//对比redis上的token if (insertHistoryNewDTO.getPlayLength()>3){
String token = redisUtil.get("mobile_"+insertHistoryNewDTO.getMemberId()).toString(); //对比redis上的token
if (!insertHistoryNewDTO.getToken().equals(token)){ String token = redisUtil.get("mobile_"+insertHistoryNewDTO.getMemberId()).toString();
throw new HttpException(1010); if (!insertHistoryNewDTO.getToken().equals(token)){
} throw new HttpException(1010);
}
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO(); VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
BeanUtils.copyProperties(insertHistoryNewDTO,vodPlayHistoryDO); BeanUtils.copyProperties(insertHistoryNewDTO,vodPlayHistoryDO);
MemberDO memberDO = memberMapper.selectById(vodPlayHistoryDO.getMemberId()); MemberDO memberDO = memberMapper.selectById(vodPlayHistoryDO.getMemberId());
//查看系统设定的时长 //查看系统设定的时长
ClassHourDictDO classHourDictDO = classHourDictMapper.selectOne(new QueryWrapper<ClassHourDictDO>() ClassHourDictDO classHourDictDO = classHourDictMapper.selectOne(new QueryWrapper<ClassHourDictDO>()
.lambda() .lambda()
.eq(ClassHourDictDO::getCompanyId, memberDO.getCompanyId())); .eq(ClassHourDictDO::getCompanyId, memberDO.getCompanyId()));
if (classHourDictDO.getStatus() == 1) { if (classHourDictDO.getStatus() == 1) {
//查看当天这个人看了多少时间 //查看当天这个人看了多少时间
Integer total = vodPlayHistoryMapper.memberDailyStudyLength(memberDO.getId()); Integer total = vodPlayHistoryMapper.memberDailyStudyLength(memberDO.getId());
//是否超过时长 没超过 false 超过 true //是否超过时长 没超过 false 超过 true
if (total + vodPlayHistoryDO.getPlayLength() >= classHourDictDO.getClassHour() * 3600) { if (total + vodPlayHistoryDO.getPlayLength() >= classHourDictDO.getClassHour() * 3600) {
int playLength = classHourDictDO.getClassHour() * 3600 - total; int playLength = classHourDictDO.getClassHour() * 3600 - total;
vodPlayHistoryDO.setPlayLength(playLength); vodPlayHistoryDO.setPlayLength(playLength);
this.baseMapper.insert(vodPlayHistoryDO); this.baseMapper.insert(vodPlayHistoryDO);
throw new HttpException(13001); throw new HttpException(13001);
}
} }
vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO);
} }
vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO);
return ConstantUtils.ADD_SUCCESS; return ConstantUtils.ADD_SUCCESS;
} }
...@@ -615,10 +621,14 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -615,10 +621,14 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
public List<Long> testPlays(){ public List<Long> testPlays(){
List<MemberDO> memberDOS = memberMapper.selectList(null); List<ClassMemberMappingDO> classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper<ClassMemberMappingDO>()
.lambda()
.eq(ClassMemberMappingDO::getClassId,168));
// List<MemberDO> memberDOS = memberMapper.selectList(null);
List<Long> result = new ArrayList<>(); List<Long> result = new ArrayList<>();
for (MemberDO memberDO : memberDOS){ for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS){
List<VodPlayStateVO> vodPlayStateVOS = vodDictMapper.testPlays(memberDO.getId()); List<VodPlayStateVO> vodPlayStateVOS = vodDictMapper.testPlays(classMemberMappingDO.getMemberId());
for (int i = 0 ; i < vodPlayStateVOS.size() ; i ++){ for (int i = 0 ; i < vodPlayStateVOS.size() ; i ++){
for ( int k = i+1 ; k < vodPlayStateVOS.size() ; k ++){ for ( int k = i+1 ; k < vodPlayStateVOS.size() ; k ++){
VodPlayStateVO vodPlayStateVO = vodPlayStateVOS.get(k); VodPlayStateVO vodPlayStateVO = vodPlayStateVOS.get(k);
......
...@@ -52,7 +52,7 @@ public class SMSUtils { ...@@ -52,7 +52,7 @@ public class SMSUtils {
//必填:短信签名-可在短信控制台中找到 //必填:短信签名-可在短信控制台中找到
request.setSignName("有课互联"); request.setSignName("有课互联");
//必填:短信模板-可在短信控制台中找到 //必填:短信模板-可在短信控制台中找到
request.setTemplateCode("SMS_229640297"); request.setTemplateCode("SMS_190945394");
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为 //可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
request.setTemplateParam("{\"code\":\""+ code +"\"}"); request.setTemplateParam("{\"code\":\""+ code +"\"}");
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!