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 be81e3f1
authored
May 09, 2022
by
涂亚平
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支付前备份
1 parent
fc42d8d5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
120 additions
and
8 deletions
src/main/java/com/subsidy/controller/MemberController.java
src/main/java/com/subsidy/service/MemberService.java
src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
src/main/java/com/subsidy/util/SMSUtils.java
src/main/java/com/subsidy/controller/MemberController.java
View file @
be81e3f
...
...
@@ -73,11 +73,18 @@ public class MemberController {
}
@PostMapping
(
"qingxuetangLogin"
)
@ApiOperation
(
"轻学堂登录 手机号"
)
@ApiOperation
(
"轻学堂登录 手机号
mobile
"
)
public
ResponseVO
qingxuetangLogin
(
@RequestBody
QingxuetangLoginDTO
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"
)
@ApiOperation
(
"修改密码 {id password}"
)
@LoginRequired
...
...
src/main/java/com/subsidy/service/MemberService.java
View file @
be81e3f
...
...
@@ -37,6 +37,8 @@ public interface MemberService extends IService<MemberDO> {
UserRoleVO
qingxuetangLogin
(
QingxuetangLoginDTO
qingxuetangLoginDTO
);
UserRoleVO
kunchiLogin
(
QingxuetangLoginDTO
qingxuetangLoginDTO
);
String
updatePassword
(
MemberDO
memberDO
);
MemberStudyPageVO
studyPage
(
MemberDO
memberDO
);
...
...
src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
View file @
be81e3f
...
...
@@ -63,6 +63,7 @@ import java.time.Duration;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.UUID
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.Future
;
...
...
@@ -469,6 +470,13 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
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
)
{
UserRoleVO
userRoleVO
=
new
UserRoleVO
();
...
...
@@ -539,15 +547,100 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
throw
new
HttpException
(
10013
);
}
//是否登陆过 1:是 0:否
if
(
0
==
memberDO
.
getFirstLogin
())
{
// //是否登陆过 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
);
//审计日志
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
(
1
0015
);
throw
new
HttpException
(
1
4002
);
}
//鉴权逻辑 对不对
String
preAuthen
=
"appId=9a79cda9ef6f4a52a8"
+
"&authCorpName="
+
qingxuetangLoginDTO
.
getAuthCorpName
()
+
"&mobile="
+
qingxuetangLoginDTO
.
getMobile
()
+
"&nickname="
+
qingxuetangLoginDTO
.
getNickname
()
+
"×tamp="
+
qingxuetangLoginDTO
.
getTimestamp
()
+
"&appSecret=552a4147db2d4026bc4e9021acd614f8"
;
String
result
=
SecretUtils
.
getMD5String
(
preAuthen
);
if
(!
qingxuetangLoginDTO
.
getSign
().
equals
(
result
)){
OprMemDictDO
oprMemDictDO
=
new
OprMemDictDO
();
oprMemDictDO
.
setUserId
(
memberDO
.
getId
());
oprMemDictDO
.
setOprType
(
"登录"
);
oprMemDictDO
.
setResult
(
0
);
oprMemDictMapper
.
insert
(
oprMemDictDO
);
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
);
//审计日志
...
...
src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
View file @
be81e3f
...
...
@@ -67,6 +67,8 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
private
RedisUtil
redisUtil
;
public
String
insertHistory
(
VodPlayHistoryDO
vodPlayHistoryDO
)
{
if
(
vodPlayHistoryDO
.
getPlayLength
()>
3
){
MemberDO
memberDO
=
memberMapper
.
selectById
(
vodPlayHistoryDO
.
getMemberId
());
//查看系统设定的时长
ClassHourDictDO
classHourDictDO
=
classHourDictMapper
.
selectOne
(
new
QueryWrapper
<
ClassHourDictDO
>()
...
...
@@ -87,11 +89,13 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
}
vodPlayHistoryDO
.
setPlayCount
(
1
);
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
}
return
ConstantUtils
.
ADD_SUCCESS
;
}
public
String
insertHistoryNew
(
InsertHistoryNewDTO
insertHistoryNewDTO
)
{
if
(
insertHistoryNewDTO
.
getPlayLength
()>
3
){
//对比redis上的token
String
token
=
redisUtil
.
get
(
"mobile_"
+
insertHistoryNewDTO
.
getMemberId
()).
toString
();
if
(!
insertHistoryNewDTO
.
getToken
().
equals
(
token
)){
...
...
@@ -121,6 +125,8 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
}
vodPlayHistoryDO
.
setPlayCount
(
1
);
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
}
return
ConstantUtils
.
ADD_SUCCESS
;
}
...
...
@@ -615,10 +621,14 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
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
<>();
for
(
MemberDO
memberDO
:
member
DOS
){
List
<
VodPlayStateVO
>
vodPlayStateVOS
=
vodDictMapper
.
testPlays
(
memberDO
.
get
Id
());
for
(
ClassMemberMappingDO
classMemberMappingDO
:
classMemberMapping
DOS
){
List
<
VodPlayStateVO
>
vodPlayStateVOS
=
vodDictMapper
.
testPlays
(
classMemberMappingDO
.
getMember
Id
());
for
(
int
i
=
0
;
i
<
vodPlayStateVOS
.
size
()
;
i
++){
for
(
int
k
=
i
+
1
;
k
<
vodPlayStateVOS
.
size
()
;
k
++){
VodPlayStateVO
vodPlayStateVO
=
vodPlayStateVOS
.
get
(
k
);
...
...
src/main/java/com/subsidy/util/SMSUtils.java
View file @
be81e3f
...
...
@@ -52,7 +52,7 @@ public class SMSUtils {
//必填:短信签名-可在短信控制台中找到
request
.
setSignName
(
"有课互联"
);
//必填:短信模板-可在短信控制台中找到
request
.
setTemplateCode
(
"SMS_
229640297
"
);
request
.
setTemplateCode
(
"SMS_
190945394
"
);
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
request
.
setTemplateParam
(
"{\"code\":\""
+
code
+
"\"}"
);
...
...
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