Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
zhangshaowu
/
pipi-helper
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 866ea06c
authored
Oct 15, 2022
by
weiss
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
2 parents
d303d706
ad390268
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
6 deletions
src/main/java/com/pipihelper/project/feishu/controller/FeiShuEventController.java
src/main/resources/application-dev.yml
src/main/resources/templates/massage-singel-msg-card-end.json
src/main/java/com/pipihelper/project/feishu/controller/FeiShuEventController.java
View file @
866ea06
...
...
@@ -19,8 +19,13 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
java.io.BufferedReader
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
/**
* @Description: TODO
...
...
@@ -76,17 +81,51 @@ public class FeiShuEventController {
}
FeiShuMsgCardEventDTO
feiShuMsgCardEventDTO
=
reqJsonObject
.
toJavaObject
(
FeiShuMsgCardEventDTO
.
class
);
String
actionType
=
feiShuMsgCardEventDTO
.
getAction
().
getValue
().
getKey
().
split
(
"\\."
)[
0
];
/* switch (actionType) {
case "massage-singel":*/
String
actionTypeSecond
=
feiShuMsgCardEventDTO
.
getAction
().
getValue
().
getKey
().
split
(
"\\."
)[
1
];
//
//// default:
//// }
// }
switch
(
actionType
)
{
case
"massage-singel"
:
// 都需要返回 不能点击的卡片json
if
(
"revice"
.
equals
(
actionTypeSecond
))
{
// 接受按摩
return
getInteractiveCardStr
(
"感谢支持"
);
}
else
if
(
"giveUp"
.
equals
(
actionTypeSecond
))
{
// 放弃 - 往大群中发送抢按摩机会卡片
return
getInteractiveCardStr
(
"遗憾放弃"
);
}
else
if
(
"wait"
.
equals
(
actionTypeSecond
))
{
// 推迟 将当前用户放到队列最后 - 给下一个用户发送按摩卡片
return
getInteractiveCardStr
(
"已推迟到最后"
);
}
default
:
}
return
null
;
}
/**
* 读取模板文件
*
* @return
*/
public
JSONObject
getInteractiveCardStr
(
String
msg
)
{
String
fileName
=
String
.
format
(
"/templates/massage-singel-msg-card-end.json.json"
);
try
{
InputStream
in
=
this
.
getClass
().
getResourceAsStream
(
fileName
);
InputStreamReader
inputStreamReader
=
new
InputStreamReader
(
in
);
Stream
<
String
>
streamOfString
=
new
BufferedReader
(
inputStreamReader
).
lines
();
String
streamToString
=
streamOfString
.
collect
(
Collectors
.
joining
());
String
msgCardContent
=
String
.
format
(
streamToString
,
msg
);
return
JSON
.
parseObject
(
msgCardContent
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
@PostMapping
(
"/employee-list"
)
public
Object
event
()
{
...
...
src/main/resources/application-dev.yml
View file @
866ea06
...
...
@@ -6,6 +6,11 @@ spring:
username
:
weishuangshuang
password
:
weishuangshuang2020PipiTest
driver-class-name
:
com.mysql.cj.jdbc.Driver
redis
:
host
:
10.1.10.33
database
:
2
port
:
6379
password
:
123456
# 飞书相关配置参数
...
...
src/main/resources/templates/massage-singel-msg-card-end.json
0 → 100644
View file @
866ea06
{
"config"
:
{
"wide_screen_mode"
:
true
,
"update_multi"
:
true
},
"elements"
:
[
{
"tag"
:
"div"
,
"text"
:
{
"content"
:
"%s"
,
"tag"
:
"lark_md"
}
}
],
"header"
:
{
"template"
:
"turquoise"
,
"title"
:
{
"content"
:
"👻 按摩提醒请查收!"
,
"tag"
:
"plain_text"
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment