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
d3cad1db
Commit
d3cad1db
authored
Apr 28, 2020
by
邓实川
Committed by
chenzg
Jul 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
短信优化,bug修复
parent
f2a88eeb
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
18 deletions
+41
-18
src/main/java/cn/timer/api/bean/qyzx/QyzxSms.java
+3
-0
src/main/java/cn/timer/api/controller/LoginController.java
+12
-8
src/main/java/cn/timer/api/utils/aliyun/AliyunSMS.java
+26
-10
No files found.
src/main/java/cn/timer/api/bean/qyzx/QyzxSms.java
View file @
d3cad1db
...
...
@@ -38,6 +38,9 @@ public class QyzxSms extends Model<QyzxSms> {
@ApiModelProperty
(
value
=
"主键"
,
example
=
"101"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"使用记录表id"
,
example
=
"101"
)
private
Integer
useId
;
@ApiModelProperty
(
value
=
"组织机构代码 组织机构代码"
,
example
=
"101"
)
private
Integer
orgCode
;
...
...
src/main/java/cn/timer/api/controller/LoginController.java
View file @
d3cad1db
...
...
@@ -138,19 +138,21 @@ public class LoginController {
public
Result
<
String
>
sendCode
(
@RequestBody
EntRegisterDto
entRegisterDto
)
{
String
phone
=
entRegisterDto
.
getPhone
();
Integer
orgCode
=
QyzxEmpLogin
.
builder
().
build
()
Integer
orgCode
=
null
;
if
(
entRegisterDto
.
getTc
()
!=
4
)
{
// 如果不是注册,则判断
orgCode
=
QyzxEmpLogin
.
builder
().
build
()
.
selectOne
(
new
LambdaQueryWrapper
<
QyzxEmpLogin
>().
eq
(
QyzxEmpLogin:
:
getPhone
,
phone
)).
getOrgId
();
QyzxRemainingQuantity
quantity
=
QyzxRemainingQuantity
.
builder
().
build
().
selectOne
(
new
LambdaQueryWrapper
<
QyzxRemainingQuantity
>().
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
orgCode
)
.
eq
(
QyzxRemainingQuantity:
:
getPmid
,
1
).
gt
(
QyzxRemainingQuantity:
:
getRemainder
,
0
));
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
(
entRegisterDto
.
getTc
()
!=
4
)
{
//如果不是注册,则判断套餐余额
if
(
quantity
==
null
||
remainder
==
null
||
remainder
<=
0
)
{
// 判断充了钱没
return
ResultUtil
.
error
(
"请充值后使用短信功能!"
);
}
...
...
@@ -168,8 +170,9 @@ public class LoginController {
phone
=
entRegisterDto
.
getUsername
();
entRegisterDto
.
setPhone
(
phone
);
}
JSONObject
j
=
aliyunSMS
.
authCode
(
entRegisterDto
,
entRegisterDto
.
getTc
(),
code
);
List
<
Object
>
list
=
aliyunSMS
.
authCode
(
entRegisterDto
,
entRegisterDto
.
getTc
(),
code
);
Integer
useId
=
(
Integer
)
list
.
get
(
0
);
JSONObject
j
=
(
JSONObject
)
list
.
get
(
1
);
// 获取当前日期的字符串格式
String
today
=
DateUtil
.
today
();
// yyyy-MM-dd
...
...
@@ -191,6 +194,7 @@ public class LoginController {
qyzxSms
.
setMessageType
(
entRegisterDto
.
getTc
());
qyzxSms
.
setPhone
(
phoneNum
);
qyzxSms
.
setOrgCode
(
orgCode
);
qyzxSms
.
setUseId
(
useId
);
qyzxSms
.
insert
();
String
message
=
j
.
getString
(
"Message"
);
...
...
src/main/java/cn/timer/api/utils/aliyun/AliyunSMS.java
View file @
d3cad1db
package
cn
.
timer
.
api
.
utils
.
aliyun
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
...
...
@@ -64,21 +66,26 @@ public class AliyunSMS {
* 5."修改密码验证码" 6."信息变更验证码"
*/
@SuppressWarnings
(
"deprecation"
)
public
JSONObject
authCode
(
EntRegisterDto
entRegisterDto
,
public
List
<
Object
>
authCode
(
EntRegisterDto
entRegisterDto
,
@RequestParam
(
required
=
false
,
defaultValue
=
"1"
)
Integer
templateCode
,
Integer
code
)
{
String
phone
=
entRegisterDto
.
getPhone
();
Integer
orgCode
=
QyzxEmpLogin
.
builder
().
build
()
QyzxRemainingQuantity
quantity
=
null
;
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
();
QyzxRemainingQuantity
quantity
=
QyzxRemainingQuantity
.
builder
().
build
().
selectOne
(
new
LambdaQueryWrapper
<
QyzxRemainingQuantity
>().
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
orgCode
)
.
eq
(
QyzxRemainingQuantity:
:
getPmid
,
1
).
gt
(
QyzxRemainingQuantity:
:
getRemainder
,
0
));
Integer
remainder
=
quantity
.
getRemainder
();
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
();
String
orderNo
=
quantity
.
getOrderNo
();
orderNo
=
quantity
.
getOrderNo
();
if
(
templateCode
!=
4
)
{
if
(
quantity
==
null
||
remainder
==
null
||
remainder
<=
0
)
{
System
.
err
.
println
(
"企业 "
+
orgCode
+
" :套餐余额不足,请充钱"
);
return
null
;
...
...
@@ -145,8 +152,9 @@ public class AliyunSMS {
}
catch
(
ClientException
e
)
{
e
.
printStackTrace
();
}
Integer
id
=
null
;
if
(
a
!=
null
&&
a
.
contains
(
"OK"
))
{
if
(
templateCode
!=
4
)
{
qyzxUseRecord
.
setOriginalTotalNum
(
remainder
);
// 原数量
qyzxUseRecord
.
setNowTotalNum
(--
remainder
);
qyzxUseRecord
.
setUserPhone
(
phone
);
...
...
@@ -156,10 +164,18 @@ public class AliyunSMS {
qyzxUseRecord
.
setCreateUser
(
"System"
);
qyzxUseRecord
.
insert
();
id
=
qyzxUseRecord
.
getId
();
quantity
.
setRemainder
(
remainder
);
quantity
.
update
(
new
LambdaUpdateWrapper
<
QyzxRemainingQuantity
>()
.
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
orgCode
).
eq
(
QyzxRemainingQuantity:
:
getOrderNo
,
orderNo
));
return
JSONObject
.
parseObject
(
response
.
getData
());
// 代表请求成功
}
List
<
Object
>
list
=
new
ArrayList
<
Object
>();
list
.
add
(
id
);
list
.
add
(
JSONObject
.
parseObject
(
response
.
getData
()));
return
list
;
// 代表请求成功
}
return
null
;
...
...
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