Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
涂亚平
/
subsidy
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit c4adc855
authored
Mar 29, 2022
by
涂亚平
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2022.03.29 疫情备份 轻学堂
1 parent
e37f68ee
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
101 additions
and
34 deletions
src/main/java/com/subsidy/common/configure/WebLogAspect.java
src/main/java/com/subsidy/controller/MemberController.java
src/main/java/com/subsidy/dto/member/QingxuetangLoginDTO.java
src/main/java/com/subsidy/service/MemberService.java
src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
src/main/java/com/subsidy/common/configure/WebLogAspect.java
View file @
c4adc85
...
...
@@ -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()));
}
...
...
src/main/java/com/subsidy/controller/MemberController.java
View file @
c4adc85
...
...
@@ -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
...
...
src/main/java/com/subsidy/dto/member/QingxuetangLoginDTO.java
0 → 100644
View file @
c4adc85
package
com
.
subsidy
.
dto
.
member
;
import
lombok.Data
;
@Data
public
class
QingxuetangLoginDTO
{
private
String
telephone
;
}
src/main/java/com/subsidy/service/MemberService.java
View file @
c4adc85
...
...
@@ -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<MemberDO> {
MemberVO
passwordLogin
(
PasswordLoginDTO
passwordLoginDTO
);
UserRoleVO
qingxuetangLogin
(
QingxuetangLoginDTO
qingxuetangLoginDTO
);
String
updatePassword
(
MemberDO
memberDO
);
MemberStudyPageVO
studyPage
(
MemberDO
memberDO
);
...
...
src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
View file @
c4adc85
...
...
@@ -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<MemberMapper, MemberDO> 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<MemberMapper, MemberDO> 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<MemberMapper, MemberDO> imple
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
)
{
this
.
baseMapper
.
updateById
(
memberDO
);
//MemberDO memberDO1 = this.baseMapper.selectById(memberDO.getId());
...
...
@@ -515,7 +575,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> 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<MemberMapper, MemberDO> imple
ContentVodVO
contentVodVO
=
new
ContentVodVO
();
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
;
int
i
=
0
;
...
...
@@ -657,10 +717,10 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
List
<
QueryPapersVO
>
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
<
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
)
{
queryPapersVO
.
setRightCounts
(
exerciseDoneResultDOS
.
get
(
0
).
getRightCounts
());
...
...
@@ -697,7 +757,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
for
(
ClassMemberMappingDO
classMemberMappingDO
:
classMemberMappingDOS
)
{
List
<
VodDictDO
>
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
;
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment