Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
16da533a
Commit
16da533a
authored
Jun 30, 2020
by
yuquan.zhu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
取消登录短信验证码扣费
parent
da53c5d2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
84 deletions
+86
-84
src/main/java/cn/timer/api/controller/LoginController.java
+40
-38
src/main/java/cn/timer/api/utils/aliyun/AliyunSMS.java
+46
-46
No files found.
src/main/java/cn/timer/api/controller/LoginController.java
View file @
16da533a
...
...
@@ -191,30 +191,32 @@ public class LoginController {
if
(
phone
==
null
||
StrUtil
.
hasBlank
(
phone
))
{
return
ResultUtil
.
error
(
"请输入手机号"
);
}
Integer
orgCode
=
null
;
if
(
entRegisterDto
.
getTc
()
!=
4
)
{
// 如果不是注册,则判断
QyzxEmpLogin
qyzxEmpLogin
=
QyzxEmpLogin
.
builder
().
build
()
.
selectOne
(
new
LambdaQueryWrapper
<
QyzxEmpLogin
>().
eq
(
QyzxEmpLogin:
:
getPhone
,
phone
));
orgCode
=
qyzxEmpLogin
.
getOrgId
();
QyzxRemainingQuantity
quantity
=
QyzxRemainingQuantity
.
builder
().
build
()
.
selectOne
(
new
LambdaQueryWrapper
<
QyzxRemainingQuantity
>()
.
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
orgCode
).
eq
(
QyzxRemainingQuantity:
:
getPmid
,
1
)
.
gt
(
QyzxRemainingQuantity:
:
getRemainder
,
0
));
Date
date
=
null
;
Integer
remainder
=
null
;
if
(
quantity
!=
null
)
{
remainder
=
quantity
.
getRemainder
();
date
=
quantity
.
getExpireDate
();
}
if
(
remainder
==
null
||
remainder
<=
0
)
{
// 判断充了钱没
return
ResultUtil
.
error
(
"请充值后使用短信功能!"
);
}
if
(
date
!=
null
&&
date
.
getTime
()
<=
new
Date
().
getTime
())
{
System
.
err
.
println
(
"企业 "
+
orgCode
+
" :短信套餐已过期"
);
return
ResultUtil
.
error
(
"短信套餐已到期!"
);
}
}
// Integer orgCode = null;
// if (entRegisterDto.getTc() != 4) { // 如果不是注册,则判断
// QyzxEmpLogin qyzxEmpLogin = QyzxEmpLogin.builder().build()
// .selectOne(new LambdaQueryWrapper<QyzxEmpLogin>().eq(QyzxEmpLogin::getPhone, phone));
// if(qyzxEmpLogin!=null) {
// orgCode = qyzxEmpLogin.getOrgId();
// QyzxRemainingQuantity quantity = QyzxRemainingQuantity.builder().build()
// .selectOne(new LambdaQueryWrapper<QyzxRemainingQuantity>()
// .eq(QyzxRemainingQuantity::getOrgCode, orgCode).eq(QyzxRemainingQuantity::getPmid, 1)
// .gt(QyzxRemainingQuantity::getRemainder, 0));
// }
// Date date = null;
// Integer remainder = null;
// if (quantity != null) {
// remainder = quantity.getRemainder();
// date = quantity.getExpireDate();
// }
//
// if (remainder == null || remainder <= 0) { // 判断充了钱没
// return ResultUtil.error("请充值后使用短信功能!");
// }
// if (date != null && date.getTime() <= new Date().getTime()) {
// System.err.println("企业 " + orgCode + " :短信套餐已过期");
// return ResultUtil.error("短信套餐已到期!");
// }
// }
// 6位随机数验证码
try
{
...
...
@@ -232,24 +234,24 @@ public class LoginController {
// yyyy-MM-dd
today
=
today
.
replace
(
"-"
,
""
);
Thread
.
sleep
(
1000
);
JSONObject
jsonObject
=
(
JSONObject
)
JSONObject
.
parseObject
(
aliyunSMS
.
QuerySendDetails
(
phone
,
today
,
j
.
getString
(
"BizId"
)))
.
getJSONObject
(
"SmsSendDetailDTOs"
).
getJSONArray
(
"SmsSendDetailDTO"
).
get
(
0
);
String
phoneNum
=
jsonObject
.
getString
(
"PhoneNum"
);
String
content
=
jsonObject
.
getString
(
"Content"
);
//
Thread.sleep(1000);
//
JSONObject jsonObject = (JSONObject) JSONObject
//
.parseObject(aliyunSMS.QuerySendDetails(phone, today, j.getString("BizId")))
//
.getJSONObject("SmsSendDetailDTOs").getJSONArray("SmsSendDetailDTO").get(0);
//
String phoneNum = jsonObject.getString("PhoneNum");
//
String content = jsonObject.getString("Content");
// String templateCode = jsonObject.getString("TemplateCode");
// String sendStatus = jsonObject.getString("SendStatus");
// String sendDate = jsonObject.getString("SendDate");
QyzxSms
qyzxSms
=
new
QyzxSms
();
qyzxSms
.
setContent
(
content
);
qyzxSms
.
setCreateTime
(
new
Date
());
qyzxSms
.
setMessageType
(
entRegisterDto
.
getTc
());
qyzxSms
.
setPhone
(
phoneNum
);
qyzxSms
.
setOrgCode
(
orgCode
);
qyzxSms
.
setUseId
(
useId
);
qyzxSms
.
insert
();
//
QyzxSms qyzxSms = new QyzxSms();
//
qyzxSms.setContent(content);
//
qyzxSms.setCreateTime(new Date());
//
qyzxSms.setMessageType(entRegisterDto.getTc());
//
qyzxSms.setPhone(phoneNum);
//
qyzxSms.setOrgCode(orgCode);
//
qyzxSms.setUseId(useId);
//
qyzxSms.insert();
String
message
=
j
.
getString
(
"Message"
);
if
(
"OK"
.
equals
(
message
))
{
...
...
src/main/java/cn/timer/api/utils/aliyun/AliyunSMS.java
View file @
16da533a
...
...
@@ -75,28 +75,28 @@ public class AliyunSMS {
Integer
remainder
=
null
;
String
orderNo
=
null
;
Integer
orgCode
=
null
;
if
(
templateCode
!=
4
)
{
orgCode
=
QyzxEmpLogin
.
builder
().
build
()
.
selectOne
(
new
LambdaQueryWrapper
<
QyzxEmpLogin
>().
eq
(
QyzxEmpLogin:
:
getPhone
,
phone
)).
getOrgId
();
quantity
=
QyzxRemainingQuantity
.
builder
().
build
()
.
selectOne
(
new
LambdaQueryWrapper
<
QyzxRemainingQuantity
>()
.
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
orgCode
).
eq
(
QyzxRemainingQuantity:
:
getPmid
,
1
)
.
gt
(
QyzxRemainingQuantity:
:
getRemainder
,
0
));
remainder
=
quantity
.
getRemainder
();
Date
date
=
quantity
.
getExpireDate
();
orderNo
=
quantity
.
getOrderNo
();
if
(
remainder
==
null
||
remainder
<=
0
)
{
System
.
err
.
println
(
"企业 "
+
orgCode
+
" :套餐余额不足,请充钱"
);
return
null
;
}
if
(
date
!=
null
&&
date
.
getTime
()
<=
new
Date
().
getTime
())
{
System
.
err
.
println
(
"企业 "
+
orgCode
+
" :短信套餐已过期"
);
return
null
;
}
}
QyzxUseRecord
qyzxUseRecord
=
new
QyzxUseRecord
();
//
if (templateCode != 4) {
//
orgCode = QyzxEmpLogin.builder().build()
//
.selectOne(new LambdaQueryWrapper<QyzxEmpLogin>().eq(QyzxEmpLogin::getPhone, phone)).getOrgId();
//
quantity = QyzxRemainingQuantity.builder().build()
//
.selectOne(new LambdaQueryWrapper<QyzxRemainingQuantity>()
//
.eq(QyzxRemainingQuantity::getOrgCode, orgCode).eq(QyzxRemainingQuantity::getPmid, 1)
//
.gt(QyzxRemainingQuantity::getRemainder, 0));
//
remainder = quantity.getRemainder();
//
Date date = quantity.getExpireDate();
//
orderNo = quantity.getOrderNo();
//
//
if (remainder == null || remainder <= 0) {
//
System.err.println("企业 " + orgCode + " :套餐余额不足,请充钱");
//
return null;
//
}
//
if (date != null && date.getTime() <= new Date().getTime()) {
//
System.err.println("企业 " + orgCode + " :短信套餐已过期");
//
return null;
//
}
//
}
//
QyzxUseRecord qyzxUseRecord = new QyzxUseRecord();
DefaultProfile
profile
=
DefaultProfile
.
getProfile
(
REGION_ID
,
ACCESSKEY_ID
,
SECRET
);
IAcsClient
client
=
new
DefaultAcsClient
(
profile
);
...
...
@@ -112,31 +112,31 @@ public class AliyunSMS {
switch
(
templateCode
)
{
case
1
:
request
.
putQueryParameter
(
CODE_NAME
,
PinType
.
AUTHENTICATION
.
getCode
());
qyzxUseRecord
.
setScene
(
QyzxScene
.
MSG_AUTHENTICATION
.
getMessage
());
//
qyzxUseRecord.setScene(QyzxScene.MSG_AUTHENTICATION.getMessage());
break
;
case
2
:
request
.
putQueryParameter
(
CODE_NAME
,
PinType
.
LOGIN_CONFIRMATION
.
getCode
());
qyzxUseRecord
.
setScene
(
QyzxScene
.
MSG_LOGIN_CONFIRM
.
getMessage
());
//
qyzxUseRecord.setScene(QyzxScene.MSG_LOGIN_CONFIRM.getMessage());
break
;
case
3
:
request
.
putQueryParameter
(
CODE_NAME
,
PinType
.
LOGIN_ABNORMAL
.
getCode
());
qyzxUseRecord
.
setScene
(
QyzxScene
.
MSG_LOGIN_CONFIRM
.
getMessage
());
//
qyzxUseRecord.setScene(QyzxScene.MSG_LOGIN_CONFIRM.getMessage());
break
;
case
4
:
request
.
putQueryParameter
(
CODE_NAME
,
PinType
.
REGISTER
.
getCode
());
qyzxUseRecord
.
setScene
(
QyzxScene
.
MSG_REGISTER
.
getMessage
());
//
qyzxUseRecord.setScene(QyzxScene.MSG_REGISTER.getMessage());
break
;
case
5
:
request
.
putQueryParameter
(
CODE_NAME
,
PinType
.
CHANGE_PASSWORD
.
getCode
());
qyzxUseRecord
.
setScene
(
QyzxScene
.
MSG_CHANGE_PWD
.
getMessage
());
//
qyzxUseRecord.setScene(QyzxScene.MSG_CHANGE_PWD.getMessage());
break
;
case
6
:
request
.
putQueryParameter
(
CODE_NAME
,
PinType
.
CHANGE_INFORMATION
.
getCode
());
qyzxUseRecord
.
setScene
(
QyzxScene
.
MSG_CHANGE_IMP
.
getMessage
());
//
qyzxUseRecord.setScene(QyzxScene.MSG_CHANGE_IMP.getMessage());
break
;
default
:
request
.
putQueryParameter
(
CODE_NAME
,
PinType
.
AUTHENTICATION
.
getCode
());
qyzxUseRecord
.
setScene
(
QyzxScene
.
MSG_AUTHENTICATION
.
getMessage
());
//
qyzxUseRecord.setScene(QyzxScene.MSG_AUTHENTICATION.getMessage());
}
// 【8小时人事管家】验证码934169,您正在尝试修改登录密码,请妥善保管账户信息。
request
.
putQueryParameter
(
TEMPLATE_PARAM
,
"{\"code\":\""
+
code
+
"\"}"
);
...
...
@@ -153,23 +153,23 @@ public class AliyunSMS {
}
Integer
id
=
null
;
if
(
a
!=
null
&&
a
.
contains
(
"OK"
))
{
if
(
templateCode
!=
4
)
{
qyzxUseRecord
.
setOriginalTotalNum
(
remainder
);
// 原数量
qyzxUseRecord
.
setNowTotalNum
(--
remainder
);
qyzxUseRecord
.
setUserPhone
(
phone
);
qyzxUseRecord
.
setOrderNo
(
orderNo
);
qyzxUseRecord
.
setUseNum
(
1
);
qyzxUseRecord
.
setPmid
(
quantity
.
getPmid
());
qyzxUseRecord
.
setCreateUser
(
"System"
);
qyzxUseRecord
.
setOrgCode
(
orgCode
);
qyzxUseRecord
.
insert
();
id
=
qyzxUseRecord
.
getId
();
quantity
.
setRemainder
(
remainder
);
quantity
.
update
(
new
LambdaUpdateWrapper
<
QyzxRemainingQuantity
>()
.
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
orgCode
).
eq
(
QyzxRemainingQuantity:
:
getOrderNo
,
orderNo
));
}
//
if (templateCode != 4) {
//
qyzxUseRecord.setOriginalTotalNum(remainder); // 原数量
//
qyzxUseRecord.setNowTotalNum(--remainder);
//
qyzxUseRecord.setUserPhone(phone);
//
qyzxUseRecord.setOrderNo(orderNo);
//
qyzxUseRecord.setUseNum(1);
//
qyzxUseRecord.setPmid(quantity.getPmid());
//
qyzxUseRecord.setCreateUser("System");
//
qyzxUseRecord.setOrgCode(orgCode);
//
qyzxUseRecord.insert();
//
//
id = qyzxUseRecord.getId();
//
//
quantity.setRemainder(remainder);
//
quantity.update(new LambdaUpdateWrapper<QyzxRemainingQuantity>()
//
.eq(QyzxRemainingQuantity::getOrgCode, orgCode).eq(QyzxRemainingQuantity::getOrderNo, orderNo));
//
}
List
<
Object
>
list
=
new
ArrayList
<
Object
>();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment