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
6f2875d7
Commit
6f2875d7
authored
Nov 11, 2020
by
ilal
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'lal' into develop
parents
edf0762b
ed9035b8
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
6 deletions
+30
-6
src/main/java/cn/timer/api/bean/admin/AdminAssoTxjlb.java
+1
-1
src/main/java/cn/timer/api/controller/htzz/atttimer/AlicloudSMS.java
+27
-3
src/main/java/cn/timer/api/controller/htzz/atttimer/NewsTaskTiming.java
+2
-2
No files found.
src/main/java/cn/timer/api/bean/admin/AdminAssoTxjlb.java
View file @
6f2875d7
...
...
@@ -53,7 +53,7 @@ public class AdminAssoTxjlb extends Model<AdminAssoTxjlb> {
private
Integer
orgCode
;
@ApiModelProperty
(
value
=
"生成时间 生成时间"
,
example
=
"101"
)
private
Integer
addtime
;
private
Long
addtime
;
@ApiModelProperty
(
value
=
"状态 0:未读 1:已读"
,
example
=
"101"
)
private
Integer
txstate
;
...
...
src/main/java/cn/timer/api/controller/htzz/atttimer/AlicloudSMS.java
View file @
6f2875d7
package
cn
.
timer
.
api
.
controller
.
htzz
.
atttimer
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
...
...
@@ -20,6 +23,7 @@ import com.aliyuncs.profile.DefaultProfile;
import
com.google.gson.JsonArray
;
import
com.google.gson.JsonObject
;
import
cn.timer.api.bean.admin.AdminAssoTxjlb
;
import
cn.timer.api.bean.admin.AdminMsgTemplate
;
import
cn.timer.api.bean.htzz.HtzzAdminZzda
;
import
cn.timer.api.config.enums.PinType
;
...
...
@@ -54,7 +58,7 @@ public class AlicloudSMS {
* 提醒功能
*/
@SuppressWarnings
(
"deprecation"
)
public
List
<
Object
>
remind
(
HtzzAdminZzda
zzda
,
String
phone
,
String
tzname
)
{
public
List
<
Object
>
remind
(
HtzzAdminZzda
zzda
,
String
phone
,
String
tzname
,
Integer
tzrid
)
{
//短信模板详情
AdminMsgTemplate
dxmb
=
AdminMsgTemplate
.
builder
().
id
(
zzda
.
getTemplateId
()).
build
().
selectById
();
...
...
@@ -110,7 +114,7 @@ public class AlicloudSMS {
String
SMSformat
=
String
.
valueOf
(
array
).
replace
(
"["
,
""
).
replace
(
"]"
,
""
);
System
.
out
.
println
(
SMSformat
);
//
System.out.println(SMSformat);
//短信模板格式
request
.
putQueryParameter
(
TEMPLATE_PARAM
,
SMSformat
);
...
...
@@ -119,7 +123,7 @@ public class AlicloudSMS {
try
{
response
=
client
.
getCommonResponse
(
request
);
a
=
response
.
getData
();
System
.
err
.
println
(
"response:"
+
a
);
// 短信服务响应内容
//
System.err.println("response:"+a); // 短信服务响应内容
}
catch
(
ServerException
e
)
{
e
.
printStackTrace
();
}
catch
(
ClientException
e
)
{
...
...
@@ -127,6 +131,26 @@ public class AlicloudSMS {
}
Integer
id
=
null
;
if
(
a
!=
null
&&
a
.
contains
(
"OK"
))
{
AdminAssoTxjlb
txs
=
AdminAssoTxjlb
.
builder
().
build
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
SMSformat
);
Map
<
String
,
Object
>
jsonToMap
=
JSONObject
.
parseObject
(
jsonObject
.
toJSONString
());
for
(
Entry
<
String
,
Object
>
entry
:
jsonToMap
.
entrySet
()){
String
mapKey
=
entry
.
getKey
();
String
mapValue
=
String
.
valueOf
(
entry
.
getValue
());
str
=
str
.
replace
(
"${"
+
mapKey
+
"}"
,
mapValue
);
}
// System.out.println(str);
txs
.
setContent
(
str
);
//内容
txs
.
setUserName
(
tzname
);
txs
.
setEmpNum
(
tzrid
);
txs
.
setTxType
(
1
);
txs
.
setOrgCode
(
zzda
.
getOrgCode
());
txs
.
setAddtime
(
new
Date
().
getTime
());
txs
.
setTxstate
(
0
);
txs
.
insert
();
List
<
Object
>
list
=
new
ArrayList
<
Object
>();
list
.
add
(
id
);
...
...
src/main/java/cn/timer/api/controller/htzz/atttimer/NewsTaskTiming.java
View file @
6f2875d7
...
...
@@ -28,7 +28,7 @@ public class NewsTaskTiming {
@Autowired
private
AlicloudSMS
sms
;
@Scheduled
(
cron
=
"0
33 14 * * ?"
)
@Scheduled
(
cron
=
"0
0 8 * * ?"
)
//早上八点
public
void
MessageAlert
()
throws
ParseException
{
//当前时间
String
nowdate
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
new
Date
()).
toString
();
//
...
...
@@ -48,7 +48,7 @@ public class NewsTaskTiming {
List
<
HtzzAssoHtgx
>
txrs
=
HtzzAssoHtgx
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
HtzzAssoHtgx
>().
lambda
().
eq
(
HtzzAssoHtgx:
:
getHtid
,
zz
.
getId
()));
for
(
HtzzAssoHtgx
rt
:
txrs
)
{
//发送短信
List
<
Object
>
list
=
sms
.
remind
(
zz
,
rt
.
getPhone
(),
rt
.
getName
());
List
<
Object
>
list
=
sms
.
remind
(
zz
,
rt
.
getPhone
(),
rt
.
getName
()
,
rt
.
getTzrid
()
);
}
}
...
...
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