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
5e7c7616
Commit
5e7c7616
authored
Apr 28, 2020
by
dengshichuan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dsc' into 'develop'
短信优化,bug修复 See merge request 8timerv2/8timerapiv200!57
parents
4ce10e56
d48db2ed
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 @
5e7c7616
...
@@ -38,6 +38,9 @@ public class QyzxSms extends Model<QyzxSms> {
...
@@ -38,6 +38,9 @@ public class QyzxSms extends Model<QyzxSms> {
@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 @
5e7c7616
...
@@ -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
;
Integer
orgCode
=
QyzxEmpLogin
.
builder
().
build
()
if
(
entRegisterDto
.
getTc
()
!=
4
)
{
// 如果不是注册,则判断
orgCode
=
QyzxEmpLogin
.
builder
().
build
()
.
selectOne
(
new
LambdaQueryWrapper
<
QyzxEmpLogin
>().
eq
(
QyzxEmpLogin:
:
getPhone
,
phone
)).
getOrgId
();
.
selectOne
(
new
LambdaQueryWrapper
<
QyzxEmpLogin
>().
eq
(
QyzxEmpLogin:
:
getPhone
,
phone
)).
getOrgId
();
QyzxRemainingQuantity
quantity
=
QyzxRemainingQuantity
.
builder
().
build
().
selectOne
(
QyzxRemainingQuantity
quantity
=
QyzxRemainingQuantity
.
builder
().
build
()
new
LambdaQueryWrapper
<
QyzxRemainingQuantity
>().
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
orgCode
)
.
selectOne
(
new
LambdaQueryWrapper
<
QyzxRemainingQuantity
>()
.
eq
(
QyzxRemainingQuantity:
:
getPmid
,
1
).
gt
(
QyzxRemainingQuantity:
:
getRemainder
,
0
));
.
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
orgCode
).
eq
(
QyzxRemainingQuantity:
:
getPmid
,
1
)
.
gt
(
QyzxRemainingQuantity:
:
getRemainder
,
0
));
Date
date
=
null
;
Date
date
=
null
;
Integer
remainder
=
null
;
Integer
remainder
=
null
;
if
(
quantity
!=
null
)
{
if
(
quantity
!=
null
)
{
remainder
=
quantity
.
getRemainder
();
remainder
=
quantity
.
getRemainder
();
date
=
quantity
.
getExpireDate
();
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 @
5e7c7616
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
;
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
();
.
selectOne
(
new
LambdaQueryWrapper
<
QyzxEmpLogin
>().
eq
(
QyzxEmpLogin:
:
getPhone
,
phone
)).
getOrgId
();
QyzxRemainingQuantity
quantity
=
QyzxRemainingQuantity
.
builder
().
build
().
selectOne
(
quantity
=
QyzxRemainingQuantity
.
builder
().
build
()
new
LambdaQueryWrapper
<
QyzxRemainingQuantity
>().
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
orgCode
)
.
selectOne
(
new
LambdaQueryWrapper
<
QyzxRemainingQuantity
>()
.
eq
(
QyzxRemainingQuantity:
:
getPmid
,
1
).
gt
(
QyzxRemainingQuantity:
:
getRemainder
,
0
));
.
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
orgCode
).
eq
(
QyzxRemainingQuantity:
:
getPmid
,
1
)
Integer
remainder
=
quantity
.
getRemainder
();
.
gt
(
QyzxRemainingQuantity:
:
getRemainder
,
0
));
remainder
=
quantity
.
getRemainder
();
Date
date
=
quantity
.
getExpireDate
();
Date
date
=
quantity
.
getExpireDate
();
String
orderNo
=
quantity
.
getOrderNo
();
orderNo
=
quantity
.
getOrderNo
();
if
(
templateCode
!=
4
)
{
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,8 +152,9 @@ public class AliyunSMS {
...
@@ -145,8 +152,9 @@ 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"
))
{
if
(
templateCode
!=
4
)
{
qyzxUseRecord
.
setOriginalTotalNum
(
remainder
);
// 原数量
qyzxUseRecord
.
setOriginalTotalNum
(
remainder
);
// 原数量
qyzxUseRecord
.
setNowTotalNum
(--
remainder
);
qyzxUseRecord
.
setNowTotalNum
(--
remainder
);
qyzxUseRecord
.
setUserPhone
(
phone
);
qyzxUseRecord
.
setUserPhone
(
phone
);
...
@@ -156,10 +164,18 @@ public class AliyunSMS {
...
@@ -156,10 +164,18 @@ public class AliyunSMS {
qyzxUseRecord
.
setCreateUser
(
"System"
);
qyzxUseRecord
.
setCreateUser
(
"System"
);
qyzxUseRecord
.
insert
();
qyzxUseRecord
.
insert
();
id
=
qyzxUseRecord
.
getId
();
quantity
.
setRemainder
(
remainder
);
quantity
.
setRemainder
(
remainder
);
quantity
.
update
(
new
LambdaUpdateWrapper
<
QyzxRemainingQuantity
>()
quantity
.
update
(
new
LambdaUpdateWrapper
<
QyzxRemainingQuantity
>()
.
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
orgCode
).
eq
(
QyzxRemainingQuantity:
:
getOrderNo
,
orderNo
));
.
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
;
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