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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
37 deletions
+60
-37
src/main/java/cn/timer/api/bean/qyzx/QyzxSms.java
+3
-0
src/main/java/cn/timer/api/controller/LoginController.java
+18
-14
src/main/java/cn/timer/api/utils/aliyun/AliyunSMS.java
+39
-23
No files found.
src/main/java/cn/timer/api/bean/qyzx/QyzxSms.java
View file @
d3cad1db
...
@@ -37,6 +37,9 @@ public class QyzxSms extends Model<QyzxSms> {
...
@@ -37,6 +37,9 @@ public class QyzxSms extends Model<QyzxSms> {
@TableId
(
type
=
IdType
.
AUTO
)
@TableId
(
type
=
IdType
.
AUTO
)
@ApiModelProperty
(
value
=
"主键"
,
example
=
"101"
)
@ApiModelProperty
(
value
=
"主键"
,
example
=
"101"
)
private
Integer
id
;
private
Integer
id
;
@ApiModelProperty
(
value
=
"使用记录表id"
,
example
=
"101"
)
private
Integer
useId
;
@ApiModelProperty
(
value
=
"组织机构代码 组织机构代码"
,
example
=
"101"
)
@ApiModelProperty
(
value
=
"组织机构代码 组织机构代码"
,
example
=
"101"
)
private
Integer
orgCode
;
private
Integer
orgCode
;
...
...
src/main/java/cn/timer/api/controller/LoginController.java
View file @
d3cad1db
...
@@ -138,19 +138,21 @@ public class LoginController {
...
@@ -138,19 +138,21 @@ public class LoginController {
public
Result
<
String
>
sendCode
(
@RequestBody
EntRegisterDto
entRegisterDto
)
{
public
Result
<
String
>
sendCode
(
@RequestBody
EntRegisterDto
entRegisterDto
)
{
String
phone
=
entRegisterDto
.
getPhone
();
String
phone
=
entRegisterDto
.
getPhone
();
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
));
Date
date
=
null
;
Integer
remainder
=
null
;
if
(
quantity
!=
null
)
{
remainder
=
quantity
.
getRemainder
();
date
=
quantity
.
getExpireDate
();
}
Integer
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
));
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
)
{
// 判断充了钱没
if
(
quantity
==
null
||
remainder
==
null
||
remainder
<=
0
)
{
// 判断充了钱没
return
ResultUtil
.
error
(
"请充值后使用短信功能!"
);
return
ResultUtil
.
error
(
"请充值后使用短信功能!"
);
}
}
...
@@ -168,8 +170,9 @@ public class LoginController {
...
@@ -168,8 +170,9 @@ public class LoginController {
phone
=
entRegisterDto
.
getUsername
();
phone
=
entRegisterDto
.
getUsername
();
entRegisterDto
.
setPhone
(
phone
);
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
();
String
today
=
DateUtil
.
today
();
// yyyy-MM-dd
// yyyy-MM-dd
...
@@ -191,6 +194,7 @@ public class LoginController {
...
@@ -191,6 +194,7 @@ public class LoginController {
qyzxSms
.
setMessageType
(
entRegisterDto
.
getTc
());
qyzxSms
.
setMessageType
(
entRegisterDto
.
getTc
());
qyzxSms
.
setPhone
(
phoneNum
);
qyzxSms
.
setPhone
(
phoneNum
);
qyzxSms
.
setOrgCode
(
orgCode
);
qyzxSms
.
setOrgCode
(
orgCode
);
qyzxSms
.
setUseId
(
useId
);
qyzxSms
.
insert
();
qyzxSms
.
insert
();
String
message
=
j
.
getString
(
"Message"
);
String
message
=
j
.
getString
(
"Message"
);
...
...
src/main/java/cn/timer/api/utils/aliyun/AliyunSMS.java
View file @
d3cad1db
package
cn
.
timer
.
api
.
utils
.
aliyun
;
package
cn
.
timer
.
api
.
utils
.
aliyun
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -64,21 +66,26 @@ public class AliyunSMS {
...
@@ -64,21 +66,26 @@ public class AliyunSMS {
* 5."修改密码验证码" 6."信息变更验证码"
* 5."修改密码验证码" 6."信息变更验证码"
*/
*/
@SuppressWarnings
(
"deprecation"
)
@SuppressWarnings
(
"deprecation"
)
public
JSONObject
authCode
(
EntRegisterDto
entRegisterDto
,
public
List
<
Object
>
authCode
(
EntRegisterDto
entRegisterDto
,
@RequestParam
(
required
=
false
,
defaultValue
=
"1"
)
Integer
templateCode
,
Integer
code
)
{
@RequestParam
(
required
=
false
,
defaultValue
=
"1"
)
Integer
templateCode
,
Integer
code
)
{
String
phone
=
entRegisterDto
.
getPhone
();
String
phone
=
entRegisterDto
.
getPhone
();
Integer
orgCode
=
QyzxEmpLogin
.
builder
().
build
()
QyzxRemainingQuantity
quantity
=
null
;
.
selectOne
(
new
LambdaQueryWrapper
<
QyzxEmpLogin
>().
eq
(
QyzxEmpLogin:
:
getPhone
,
phone
)).
getOrgId
();
Integer
remainder
=
null
;
QyzxRemainingQuantity
quantity
=
QyzxRemainingQuantity
.
builder
().
build
().
selectOne
(
String
orderNo
=
null
;
new
LambdaQueryWrapper
<
QyzxRemainingQuantity
>().
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
orgCode
)
Integer
orgCode
=
null
;
.
eq
(
QyzxRemainingQuantity:
:
getPmid
,
1
).
gt
(
QyzxRemainingQuantity:
:
getRemainder
,
0
));
Integer
remainder
=
quantity
.
getRemainder
();
Date
date
=
quantity
.
getExpireDate
();
String
orderNo
=
quantity
.
getOrderNo
();
if
(
templateCode
!=
4
)
{
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
(
quantity
==
null
||
remainder
==
null
||
remainder
<=
0
)
{
if
(
quantity
==
null
||
remainder
==
null
||
remainder
<=
0
)
{
System
.
err
.
println
(
"企业 "
+
orgCode
+
" :套餐余额不足,请充钱"
);
System
.
err
.
println
(
"企业 "
+
orgCode
+
" :套餐余额不足,请充钱"
);
return
null
;
return
null
;
...
@@ -145,21 +152,30 @@ public class AliyunSMS {
...
@@ -145,21 +152,30 @@ public class AliyunSMS {
}
catch
(
ClientException
e
)
{
}
catch
(
ClientException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
Integer
id
=
null
;
if
(
a
!=
null
&&
a
.
contains
(
"OK"
))
{
if
(
a
!=
null
&&
a
.
contains
(
"OK"
))
{
qyzxUseRecord
.
setOriginalTotalNum
(
remainder
);
// 原数量
if
(
templateCode
!=
4
)
{
qyzxUseRecord
.
setNowTotalNum
(--
remainder
);
qyzxUseRecord
.
setOriginalTotalNum
(
remainder
);
// 原数量
qyzxUseRecord
.
setUserPhone
(
phone
);
qyzxUseRecord
.
setNowTotalNum
(--
remainder
);
qyzxUseRecord
.
setOrderNo
(
orderNo
);
qyzxUseRecord
.
setUserPhone
(
phone
);
qyzxUseRecord
.
setUseNum
(
1
);
qyzxUseRecord
.
setOrderNo
(
orderNo
);
qyzxUseRecord
.
setPmid
(
quantity
.
getPmid
());
qyzxUseRecord
.
setUseNum
(
1
);
qyzxUseRecord
.
setCreateUser
(
"System"
);
qyzxUseRecord
.
setPmid
(
quantity
.
getPmid
());
qyzxUseRecord
.
insert
();
qyzxUseRecord
.
setCreateUser
(
"System"
);
qyzxUseRecord
.
insert
();
id
=
qyzxUseRecord
.
getId
();
quantity
.
setRemainder
(
remainder
);
quantity
.
update
(
new
LambdaUpdateWrapper
<
QyzxRemainingQuantity
>()
.
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
orgCode
).
eq
(
QyzxRemainingQuantity:
:
getOrderNo
,
orderNo
));
}
quantity
.
setRemainder
(
remainder
);
List
<
Object
>
list
=
new
ArrayList
<
Object
>();
quantity
.
update
(
new
LambdaUpdateWrapper
<
QyzxRemainingQuantity
>()
.
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
orgCode
).
eq
(
QyzxRemainingQuantity:
:
getOrderNo
,
orderNo
));
list
.
add
(
id
);
return
JSONObject
.
parseObject
(
response
.
getData
());
// 代表请求成功
list
.
add
(
JSONObject
.
parseObject
(
response
.
getData
()));
return
list
;
// 代表请求成功
}
}
return
null
;
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