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
6bf8ef69
Commit
6bf8ef69
authored
4 years ago
by
邓实川
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
短信bug修改,服务器转存文件删除
parent
b013fccf
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
72 additions
and
30 deletions
+72
-30
src/main/java/cn/timer/api/controller/LoginController.java
+8
-7
src/main/java/cn/timer/api/controller/dzht/DzhtController.java
+22
-6
src/main/java/cn/timer/api/utils/aliyun/AliyunSMS.java
+7
-9
src/main/java/cn/timer/api/utils/schedule/RemindUtil.java
+21
-8
src/main/resources/application-dev.yml
+4
-0
src/main/resources/application-pro.yml
+5
-0
src/main/resources/application-test.yml
+5
-0
No files found.
src/main/java/cn/timer/api/controller/LoginController.java
View file @
6bf8ef69
...
...
@@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.
service.additional.query.impl
.LambdaQueryChainWrapper
;
import
com.baomidou.mybatisplus.extension.
conditions.query
.LambdaQueryChainWrapper
;
import
com.github.xiaoymin.knife4j.annotations.ApiOperationSupport
;
import
cn.hutool.core.date.DateUtil
;
...
...
@@ -120,6 +120,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
);
...
...
This diff is collapsed.
Click to expand it.
src/main/java/cn/timer/api/controller/dzht/DzhtController.java
View file @
6bf8ef69
package
cn
.
timer
.
api
.
controller
.
dzht
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Date
;
...
...
@@ -235,15 +236,14 @@ public class DzhtController {
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
;
...
...
@@ -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
,
"查询成功"
);
...
...
This diff is collapsed.
Click to expand it.
src/main/java/cn/timer/api/utils/aliyun/AliyunSMS.java
View file @
6bf8ef69
...
...
@@ -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,19 +33,20 @@ 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"
;
// 自定义参数
...
...
@@ -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
();
...
...
This diff is collapsed.
Click to expand it.
src/main/java/cn/timer/api/utils/schedule/RemindUtil.java
View file @
6bf8ef69
...
...
@@ -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
;
...
...
@@ -29,6 +31,18 @@ import cn.timer.api.utils.aliyun.AliyunSMS;
@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
();
static
String
methodName
=
null
;
...
...
@@ -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
);
// 关闭提醒
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/application-dev.yml
View file @
6bf8ef69
...
...
@@ -170,6 +170,10 @@ config-8timer:
# pro
:
https://openapi.esign.cn
PROJECT_ID
:
4438775940
PROJECT_SECRET
:
7b100813cca2746081c57837855ac5af
remind
:
#合同提醒时间 默认小于等于1天会提醒+三个配置项
one
:
3
two
:
7
three
:
30
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/application-pro.yml
View file @
6bf8ef69
...
...
@@ -142,3 +142,7 @@ config-8timer:
host
:
https://openapi.esign.cn
PROJECT_ID
:
4438775940
PROJECT_SECRET
:
7b100813cca2746081c57837855ac5af
remind
:
#合同提醒时间 默认小于等于1天会提醒+三个配置项
one
:
3
two
:
7
three
:
30
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/resources/application-test.yml
View file @
6bf8ef69
...
...
@@ -142,3 +142,7 @@ config-8timer:
host
:
https://smlopenapi.esign.cn
PROJECT_ID
:
4438775940
PROJECT_SECRET
:
7b100813cca2746081c57837855ac5af
remind
:
#合同提醒时间 默认小于等于1天会提醒+三个配置项
one
:
3
two
:
7
three
:
30
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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