Commit 866ea06c by weiss

Merge remote-tracking branch 'origin/master'

2 parents d303d706 ad390268
...@@ -19,8 +19,13 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -19,8 +19,13 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* @Description: TODO * @Description: TODO
...@@ -76,17 +81,51 @@ public class FeiShuEventController { ...@@ -76,17 +81,51 @@ public class FeiShuEventController {
} }
FeiShuMsgCardEventDTO feiShuMsgCardEventDTO = reqJsonObject.toJavaObject(FeiShuMsgCardEventDTO.class); FeiShuMsgCardEventDTO feiShuMsgCardEventDTO = reqJsonObject.toJavaObject(FeiShuMsgCardEventDTO.class);
String actionType = feiShuMsgCardEventDTO.getAction().getValue().getKey().split("\\.")[0]; String actionType = feiShuMsgCardEventDTO.getAction().getValue().getKey().split("\\.")[0];
/* switch (actionType) { String actionTypeSecond = feiShuMsgCardEventDTO.getAction().getValue().getKey().split("\\.")[1];
case "massage-singel":*/
// switch (actionType) {
//// default: 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 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") @PostMapping("/employee-list")
public Object event() { public Object event() {
......
...@@ -6,6 +6,11 @@ spring: ...@@ -6,6 +6,11 @@ spring:
username: weishuangshuang username: weishuangshuang
password: weishuangshuang2020PipiTest password: weishuangshuang2020PipiTest
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
redis:
host: 10.1.10.33
database: 2
port: 6379
password: 123456
# 飞书相关配置参数 # 飞书相关配置参数
......
{
"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 \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!