Commit 02f2f1a7 by weiss

1

1 parent c5b9c8c9
......@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.pipihelper.project.feishu.dto.FeiShuConfig;
import com.pipihelper.project.feishu.dto.FeiShuEventDTO;
import com.pipihelper.project.feishu.dto.FeiShuMsgCardEventDTO;
import com.pipihelper.project.feishu.dto.employee.FeiShuEmployeeDTO;
import com.pipihelper.project.feishu.dto.employee.SystemFieldsDTO;
import com.pipihelper.project.feishu.entity.Employee;
......@@ -75,12 +76,11 @@ public class FeiShuEventController {
if (reqJsonObject.containsKey("challenge")) {
return reqJsonObject;
}
return null;
}
// FeiShuMsgCardEventDTO feiShuMsgCardEventDTO = reqJsonObject.toJavaObject(FeiShuMsgCardEventDTO.class);
// String actionType = feiShuMsgCardEventDTO.getAction().getValue().getKey().split("\\.")[0];
// switch (actionType) {
// case "TEST_DATA":
FeiShuMsgCardEventDTO feiShuMsgCardEventDTO = reqJsonObject.toJavaObject(FeiShuMsgCardEventDTO.class);
String actionType = feiShuMsgCardEventDTO.getAction().getValue().getKey().split("\\.")[0];
switch (actionType) {
case "massage-singel":
//
//// default:
//// }
......
......@@ -3,13 +3,18 @@ package com.pipihelper.project.feishu.controller;
import com.alibaba.fastjson.JSONObject;
import com.pipihelper.project.core.Result;
import com.pipihelper.project.core.ResultGenerator;
import com.pipihelper.project.feishu.bo.PushPainBO;
import com.pipihelper.project.feishu.dto.FeiShuConfig;
import com.pipihelper.project.feishu.service.FeiShuApiService;
import com.pipihelper.project.feishu.service.massage.MassageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
* @Description: TODO
* @author: charles
......@@ -24,20 +29,36 @@ public class SendMsgUseFeiShu {
@Autowired
private FeiShuConfig feiShuConfig;
@Autowired
private MassageService massageService;
@PostMapping("/send-msg")
public Result sendMsg(String receiveId, String msg, String receiveIdType){
JSONObject sendMsg = new JSONObject();
sendMsg.put("receive_id", receiveId);
sendMsg.put("msg_type", "text");
JSONObject content = new JSONObject();
content.put("text", msg);
sendMsg.put("content", content.toString());
feiShuApiService.sendMsg(receiveIdType, sendMsg);
public Result sendMsg(){
PushPainBO pushPainBO = new PushPainBO();
pushPainBO.setIndex(1);
pushPainBO.setName("柳双武");
pushPainBO.setDepartMentName("技术中心");
pushPainBO.setTimeRange("15:00-16:00");
PushPainBO pushPainBO1 = new PushPainBO();
pushPainBO1.setIndex(1);
pushPainBO1.setName("柳双武");
pushPainBO1.setDepartMentName("技术中心");
pushPainBO1.setTimeRange("15:00-16:00");
PushPainBO pushPainBO2 = new PushPainBO();
pushPainBO2.setIndex(1);
pushPainBO2.setName("柳双武");
pushPainBO2.setDepartMentName("技术中心");
pushPainBO2.setTimeRange("15:00-16:00");
List<PushPainBO> userList = new ArrayList<>();
userList.add(pushPainBO);
userList.add(pushPainBO1);
userList.add(pushPainBO2);
massageService.sendMassageMsgCardToPiPiChat(userList);
return ResultGenerator.genSuccessResult();
}
}
......@@ -46,8 +46,8 @@ public class FeiShuEventService {
FeiShuEventReceiveMessageDTO.Sender sender= feiShuEventReceiveMessageDTO.getSender();
FeiShuEventReceiveMessageDTO.Message message= feiShuEventReceiveMessageDTO.getMessage();
//单独处理群消息
if (message.getChat_id().equals(feiShuConfig.getFkChatId())
|| message.getChat_id().equals(feiShuConfig.getFkChatIdTest())) { //判断是否为指定群消息
if (message.getChat_id().equals(feiShuConfig.getChatId())
|| message.getChat_id().equals(feiShuConfig.getChatId())) { //判断是否为指定群消息
return;
}
else {
......
......@@ -13,8 +13,8 @@ feishu:
feiShuOpenApiHost: https://open.feishu.cn/open-apis
encryptKey: aGTqmJcfXluKWfFWHGw5SdzIg6QIxPsp
verificationToken: ChUEDdWQbyHpHUV6H5fVeL5fOP3HfBE6
appId: cli_a3c2be2801f8500d
appSecret: bw3ZXzSj47DgHT19YT268bcwYVVnRTZD
appId: cli_a2cff17bd3f8d013
appSecret: E5vXXmRipOD6vyolib186b25XXLbdYfE
ChatId: oc_5124ee21dbdecf5d802f9e9e33dab722
# 腾讯云配置参数
......
......@@ -15,7 +15,7 @@ feishu:
verificationToken: iFeLGB7JZQV37zDjIFTw0dUQ0QfFlkm5
appId: cli_a3c0cb967f619013
appSecret: NdqjzD2Bkaif6HyU8KCXGbFJzDhEEimt
ChatId: oc_5124ee21dbdecf5d802f9e9e33dab722
ChatId: oc_2c70ffa8559b1bdd75c4dca0490b7a05
# 腾讯云配置参数
tx:
......
{
"config": {
"wide_screen_mode": true,
"update_multi":true
},
"elements": [
{
"tag": "div",
"text": {
"content": "%s",
"tag": "lark_md"
}
},
{
"actions": [
{
"tag": "button",
"text": {
"content": "😁 接受",
"tag": "plain_text"
},
"type": "default",
"value": {
"key1": "massage-singel.revice"
}
},
{
"tag": "button",
"text": {
"content": "😢 怕疼",
"tag": "plain_text"
},
"type": "default",
"value": {
"key2": "massage-singel.giveUp"
}
},
{
"tag": "button",
"text": {
"content": "😢 等一下",
"tag": "plain_text"
},
"type": "default",
"value": {
"key2": "massage-singel.wait"
}
}
],
"tag": "action"
}
],
"header": {
"template": "turquoise",
"title": {
"content": "👻 按摩提醒请查收!",
"tag": "plain_text"
}
}
}
\ 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!