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
bb14a1d4
Commit
bb14a1d4
authored
Apr 28, 2020
by
邓实川
Committed by
chenzg
Jul 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
短信bug修改,服务器转存文件删除
parent
13db0527
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
77 additions
and
37 deletions
+77
-37
src/main/java/cn/timer/api/controller/LoginController.java
+7
-6
src/main/java/cn/timer/api/controller/dzht/DzhtController.java
+24
-8
src/main/java/cn/timer/api/utils/aliyun/AliyunSMS.java
+8
-10
src/main/java/cn/timer/api/utils/schedule/RemindUtil.java
+21
-8
src/main/resources/application-dev.yml
+5
-1
src/main/resources/application-pro.yml
+6
-2
src/main/resources/application-test.yml
+6
-2
No files found.
src/main/java/cn/timer/api/controller/LoginController.java
View file @
bb14a1d4
...
...
@@ -119,6 +119,9 @@ public class LoginController {
@Autowired
private
QyzxEmpEntAssoMapper
qyzxEmpEntAssoMapper
;
@Autowired
private
AliyunSMS
aliyunSMS
;
// @Autowired
// private DataSourceTransactionManager transactionManager;
...
...
@@ -159,8 +162,6 @@ public class LoginController {
try
{
Integer
code
=
(
int
)
((
Math
.
random
()
*
9
+
1
)
*
100000
);
AliyunSMS
aliyunSMS
=
new
AliyunSMS
();
if
(
phone
==
null
||
""
.
equals
(
phone
))
{
phone
=
entRegisterDto
.
getUsername
();
entRegisterDto
.
setPhone
(
phone
);
...
...
@@ -174,13 +175,13 @@ public class LoginController {
Thread
.
sleep
(
1000
);
JSONObject
jsonObject
=
(
JSONObject
)
JSONObject
.
parseObject
(
new
AliyunSMS
()
.
QuerySendDetails
(
phone
,
today
,
j
.
getString
(
"BizId"
)))
.
parseObject
(
aliyunSMS
.
QuerySendDetails
(
phone
,
today
,
j
.
getString
(
"BizId"
)))
.
getJSONObject
(
"SmsSendDetailDTOs"
).
getJSONArray
(
"SmsSendDetailDTO"
).
get
(
0
);
String
templateCode
=
jsonObject
.
getString
(
"TemplateCode"
);
String
phoneNum
=
jsonObject
.
getString
(
"PhoneNum"
);
String
content
=
jsonObject
.
getString
(
"Content"
);
String
sendStatus
=
jsonObject
.
getString
(
"SendStatus"
);
String
sendDate
=
jsonObject
.
getString
(
"SendDate"
);
// String templateCode = jsonObject.getString("TemplateCode");
// String sendStatus = jsonObject.getString("SendStatus");
// String sendDate = jsonObject.getString("SendDate");
QyzxSms
qyzxSms
=
new
QyzxSms
();
qyzxSms
.
setContent
(
content
);
...
...
src/main/java/cn/timer/api/controller/dzht/DzhtController.java
View file @
bb14a1d4
package
cn
.
timer
.
api
.
controller
.
dzht
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Date
;
...
...
@@ -234,21 +235,20 @@ public class DzhtController {
list
.
add
(
map13
);
return
ResultUtil
.
data
(
list
);
}
public
static
String
savePath
()
{
String
savePath
=
null
;
String
name
=
System
.
getProperty
(
"os.name"
);
if
(
name
.
startsWith
(
"Windows"
))
{
savePath
=
"E:\\esignTemplate"
;
// Windows本地服务器文件保存路径包
}
else
if
(
name
.
startsWith
(
"Linux"
))
{
}
else
if
(
name
.
startsWith
(
"Linux"
))
{
savePath
=
"esignTemplate"
;
// Linux远程服务器文件保存路径包
}
else
{
}
else
{
savePath
=
"esignTemplate"
;
// 其他服务器文件保存路径包
}
return
savePath
;
}
final
static
String
APP_ID
=
ConfigConstant
.
PROJECT_ID
;
// 项目id
final
static
String
APP_SECRET
=
ConfigConstant
.
PROJECT_SECRET
;
// 项目密码
// final static String RE_TOKEN = "8b58973c290cc848b67ff0017cd424ff";
...
...
@@ -335,8 +335,8 @@ public class DzhtController {
public
Result
<
Object
>
rzUserNow
(
@CurrentUser
UserBean
userBean
,
Integer
empNum
)
{
DzhtAssoGrrz
grrz
=
new
DzhtAssoGrrz
();
grrz
.
setType
(
0
);
YgglMainEmp
yg
=
YgglMainEmp
.
builder
().
build
()
.
selectOne
(
new
QueryWrapper
<
YgglMainEmp
>().
select
(
"phone"
).
eq
(
"org_code"
,
userBean
.
getOrgCode
()).
eq
(
"emp_num"
,
empNum
));
YgglMainEmp
yg
=
YgglMainEmp
.
builder
().
build
()
.
selectOne
(
new
QueryWrapper
<
YgglMainEmp
>().
select
(
"phone"
)
.
eq
(
"org_code"
,
userBean
.
getOrgCode
()).
eq
(
"emp_num"
,
empNum
));
grrz
.
setMobileNo
(
yg
.
getPhone
());
DzhtAssoGrzc
grzc
=
DzhtAssoGrzc
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
DzhtAssoGrzc
>()
...
...
@@ -661,12 +661,28 @@ public class DzhtController {
if
(
code
.
equals
(
"0"
)
&&
j
.
get
(
"errCode"
).
toString
().
equals
(
"0"
))
{
htmb
.
insert
();
File
file
=
new
File
(
filePath
);
boolean
delete
=
file
.
delete
();
System
.
err
.
println
(
delete
);
return
ResultUtil
.
data
(
a
);
}
else
{
return
ResultUtil
.
data
(
a
,
"创建失败"
);
}
}
// public static void main(String[] args) throws Exception {
// String ossUrl = "https://8time-v2.oss-cn-shenzhen.aliyuncs.com/8timer2.0/117/test/7001.jpg";
// String fileName = System.currentTimeMillis() + UUID.randomUUID().toString()
// + ossUrl.substring(ossUrl.lastIndexOf("."));
// String filePath = FileHelper.downLoadFromUrl(ossUrl, fileName, savePath());
// System.err.println(filePath);
// File file = new File(filePath);
// Thread.sleep(2000);
// System.err.println(file.delete());
// }
// 通过模板创建文件
@PostMapping
(
"/createByTemplate"
)
@ApiOperation
(
value
=
"创建文件"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
...
...
@@ -694,7 +710,7 @@ public class DzhtController {
@GetMapping
(
"/queryName"
)
@ApiOperation
(
value
=
"查名字"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
getName
(
@RequestParam
(
required
=
false
)
Integer
empNum
)
{
public
Result
<
Object
>
getName
(
@RequestParam
(
required
=
false
)
Integer
empNum
)
{
String
name
=
QueryUtil
.
queryEmpName
(
empNum
);
Map
<
String
,
String
>
map
=
QueryUtil
.
queryVersionName
();
return
ResultUtil
.
datas
(
map
,
name
,
"查询成功"
);
...
...
src/main/java/cn/timer/api/utils/aliyun/AliyunSMS.java
View file @
bb14a1d4
...
...
@@ -3,6 +3,7 @@ package cn.timer.api.utils.aliyun;
import
java.util.Date
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.RequestParam
;
...
...
@@ -32,20 +33,21 @@ import cn.timer.api.dto.qyzx.EntRegisterDto;
*
*/
@Transactional
@Component
public
class
AliyunSMS
{
@Value
(
"${config-8timer.Aliyun.PROJECT_NAME}"
)
p
rivate
String
PROJECT_NAME
;
p
ublic
String
PROJECT_NAME
;
@Value
(
"${config-8timer.Aliyun.REGION_ID}"
)
p
rivate
String
REGION_ID
;
p
ublic
String
REGION_ID
;
@Value
(
"${config-8timer.Aliyun.ACCESSKEY_ID}"
)
p
rivate
String
ACCESSKEY_ID
;
p
ublic
String
ACCESSKEY_ID
;
@Value
(
"${config-8timer.Aliyun.SECRET}"
)
private
String
SECRET
;
public
String
SECRET
;
final
static
String
CODE_NAME
=
"TemplateCode"
;
// 短信模板代码参数名
final
static
String
TEMPLATE_PARAM
=
"TemplateParam"
;
// 自定义参数
final
static
String
DOMAIN
=
"dysmsapi.aliyuncs.com"
;
...
...
@@ -143,7 +145,6 @@ public class AliyunSMS {
}
if
(
a
!=
null
&&
a
.
contains
(
"OK"
))
{
qyzxUseRecord
.
setOriginalTotalNum
(
remainder
);
// 原数量
qyzxUseRecord
.
setNowTotalNum
(--
remainder
);
qyzxUseRecord
.
setUserPhone
(
phone
);
...
...
@@ -156,7 +157,6 @@ public class AliyunSMS {
quantity
.
setRemainder
(
remainder
);
quantity
.
update
(
new
LambdaUpdateWrapper
<
QyzxRemainingQuantity
>()
.
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
orgCode
).
eq
(
QyzxRemainingQuantity:
:
getOrderNo
,
orderNo
));
return
JSONObject
.
parseObject
(
response
.
getData
());
// 代表请求成功
}
...
...
@@ -191,7 +191,6 @@ public class AliyunSMS {
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
System
.
err
.
println
(
a
);
if
(
a
!=
null
&&
a
.
contains
(
"OK"
))
{
return
a
;
// 代表请求成功
}
...
...
@@ -248,7 +247,6 @@ public class AliyunSMS {
String
a
=
null
;
try
{
CommonResponse
response
=
client
.
getCommonResponse
(
request
);
System
.
out
.
println
(
response
.
getData
());
a
=
response
.
getData
();
...
...
src/main/java/cn/timer/api/utils/schedule/RemindUtil.java
View file @
bb14a1d4
...
...
@@ -4,6 +4,8 @@ import java.text.SimpleDateFormat;
import
java.util.Date
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.scheduling.annotation.SchedulingConfigurer
;
...
...
@@ -28,6 +30,18 @@ import cn.timer.api.utils.aliyun.AliyunSMS;
@Component
@Lazy
(
false
)
public
class
RemindUtil
implements
SchedulingConfigurer
{
@Autowired
private
AliyunSMS
sms
;
@Value
(
"${config-8timer.remind.one}"
)
private
int
one
;
@Value
(
"${config-8timer.remind.two}"
)
private
int
two
;
@Value
(
"${config-8timer.remind.three}"
)
private
int
three
;
private
static
final
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"HH:mm:ss"
);
static
String
className
=
new
Exception
().
getStackTrace
()[
0
].
getClassName
();
...
...
@@ -57,9 +71,8 @@ public class RemindUtil implements SchedulingConfigurer {
* 每天固定时间提醒
*/
// @Scheduled(cron = "0 0 8 * * ?") // 每天8点扫一下看有没要提醒的,有就发一个
public
static
String
reportCurrentTime
()
{
public
String
reportCurrentTime
()
{
AliyunSMS
sms
=
new
AliyunSMS
();
List
<
HtzzAssoHtgx
>
htgxs
=
HtzzAssoHtgx
.
builder
().
build
().
selectAll
();
for
(
HtzzAssoHtgx
htgx
:
htgxs
)
{
QueryWrapper
<
HtzzAdminZzda
>
q
=
new
QueryWrapper
<
HtzzAdminZzda
>();
...
...
@@ -78,12 +91,12 @@ public class RemindUtil implements SchedulingConfigurer {
if
(
sjc
>
0
)
{
if
(
betweenDay
<=
1
)
{
sms
.
remind
(
name
,
htname
,
time
,
phone
);
// 少于1天短信提醒
}
else
if
(
betweenDay
==
3
)
{
sms
.
remind
(
name
,
htname
,
time
,
phone
);
//
少于3天短信提醒
}
else
if
(
betweenDay
==
7
)
{
sms
.
remind
(
name
,
htname
,
time
,
phone
);
//
少于7天短信提醒
}
else
if
(
betweenDay
==
30
)
{
sms
.
remind
(
name
,
htname
,
time
,
phone
);
//
少于30天短信提醒
}
else
if
(
betweenDay
==
one
)
{
sms
.
remind
(
name
,
htname
,
time
,
phone
);
//
短信提醒1
}
else
if
(
betweenDay
==
two
)
{
sms
.
remind
(
name
,
htname
,
time
,
phone
);
//
短信提醒2
}
else
if
(
betweenDay
==
three
)
{
sms
.
remind
(
name
,
htname
,
time
,
phone
);
//
短信提醒3
}
}
else
{
zzda
.
setTxkgType
(
1
);
// 关闭提醒
...
...
src/main/resources/application-dev.yml
View file @
bb14a1d4
...
...
@@ -164,12 +164,16 @@ config-8timer:
project_package
:
8timer2.0/
expirationTime
:
3153600000000L
expirationTime_pri
:
600000L
esign
:
# e签宝
esign
:
# e签宝
host
:
https://smlopenapi.esign.cn
# test
:
https://smlopenapi.esign.cn
# pro
:
https://openapi.esign.cn
PROJECT_ID
:
4438775940
PROJECT_SECRET
:
7b100813cca2746081c57837855ac5af
remind
:
#合同提醒时间 默认小于等于1天会提醒+三个配置项
one
:
3
two
:
7
three
:
30
...
...
src/main/resources/application-pro.yml
View file @
bb14a1d4
...
...
@@ -141,4 +141,8 @@ config-8timer:
esign
:
# e签宝
host
:
https://openapi.esign.cn
PROJECT_ID
:
4438775940
PROJECT_SECRET
:
7b100813cca2746081c57837855ac5af
\ No newline at end of file
PROJECT_SECRET
:
7b100813cca2746081c57837855ac5af
remind
:
#合同提醒时间 默认小于等于1天会提醒+三个配置项
one
:
3
two
:
7
three
:
30
\ No newline at end of file
src/main/resources/application-test.yml
View file @
bb14a1d4
...
...
@@ -141,4 +141,8 @@ config-8timer:
esign
:
# e签宝
host
:
https://smlopenapi.esign.cn
PROJECT_ID
:
4438775940
PROJECT_SECRET
:
7b100813cca2746081c57837855ac5af
\ No newline at end of file
PROJECT_SECRET
:
7b100813cca2746081c57837855ac5af
remind
:
#合同提醒时间 默认小于等于1天会提醒+三个配置项
one
:
3
two
:
7
three
:
30
\ No newline at end of file
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