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 02f2f1a7
authored
Oct 15, 2022
by
weiss
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1
1 parent
c5b9c8c9
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
102 additions
and
21 deletions
src/main/java/com/pipihelper/project/feishu/controller/FeiShuEventController.java
src/main/java/com/pipihelper/project/feishu/controller/SendMsgUseFeiShu.java
src/main/java/com/pipihelper/project/feishu/service/FeiShuEventService.java
src/main/resources/application-dev.yml
src/main/resources/application-prod.yml
src/main/resources/massage-msg-card.json → src/main/resources/templates/massage-msg-card.json
src/main/resources/templates/massage-singel-msg-card.json
src/main/java/com/pipihelper/project/feishu/controller/FeiShuEventController.java
View file @
02f2f1a
...
@@ -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:
//// }
//// }
...
...
src/main/java/com/pipihelper/project/feishu/controller/SendMsgUseFeiShu.java
View file @
02f2f1a
...
@@ -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
();
}
}
}
}
src/main/java/com/pipihelper/project/feishu/service/FeiShuEventService.java
View file @
02f2f1a
...
@@ -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
.
get
Fk
ChatId
())
if
(
message
.
getChat_id
().
equals
(
feiShuConfig
.
getChatId
())
||
message
.
getChat_id
().
equals
(
feiShuConfig
.
get
FkChatIdTest
()))
{
//判断是否为指定群消息
||
message
.
getChat_id
().
equals
(
feiShuConfig
.
get
ChatId
()))
{
//判断是否为指定群消息
return
;
return
;
}
}
else
{
else
{
...
...
src/main/resources/application-dev.yml
View file @
02f2f1a
...
@@ -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_a
3c2be2801f8500d
appId
:
cli_a
2cff17bd3f8d013
appSecret
:
bw3ZXzSj47DgHT19YT268bcwYVVnRTZD
appSecret
:
E5vXXmRipOD6vyolib186b25XXLbdYfE
ChatId
:
oc_5124ee21dbdecf5d802f9e9e33dab722
ChatId
:
oc_5124ee21dbdecf5d802f9e9e33dab722
# 腾讯云配置参数
# 腾讯云配置参数
...
...
src/main/resources/application-prod.yml
View file @
02f2f1a
...
@@ -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
:
...
...
src/main/resources/massage-msg-card.json
→
src/main/resources/
templates/
massage-msg-card.json
View file @
02f2f1a
File moved
src/main/resources/templates/massage-singel-msg-card.json
0 → 100644
View file @
02f2f1a
{
"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
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