Commit 02f2f1a7 by weiss

1

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