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 ebc9ed34
authored
Oct 16, 2022
by
zhangshaowu
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
2 parents
1c7adc53
e84d0497
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
12 deletions
src/main/java/com/pipihelper/project/feishu/controller/FeiShuEventController.java
src/main/java/com/pipihelper/project/feishu/dto/FeiShuConfig.java
src/main/java/com/pipihelper/project/feishu/service/FeiShuApiService.java
src/main/java/com/pipihelper/project/scheduled/MassageNoticeScheduleService.java
src/main/resources/application-prod.yml
src/main/java/com/pipihelper/project/feishu/controller/FeiShuEventController.java
View file @
ebc9ed3
...
@@ -29,6 +29,7 @@ import com.pipihelper.project.feishu.service.massage.MassageService;
...
@@ -29,6 +29,7 @@ import com.pipihelper.project.feishu.service.massage.MassageService;
import
com.pipihelper.project.feishu.utils.FeiShuEventDataDecrypter
;
import
com.pipihelper.project.feishu.utils.FeiShuEventDataDecrypter
;
import
com.pipihelper.project.utils.CacheUtil
;
import
com.pipihelper.project.utils.CacheUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
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.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
@@ -92,13 +93,14 @@ public class FeiShuEventController {
...
@@ -92,13 +93,14 @@ public class FeiShuEventController {
if
(
encryptJsonObject
.
containsKey
(
"challenge"
))
{
if
(
encryptJsonObject
.
containsKey
(
"challenge"
))
{
return
encryptJsonObject
;
return
encryptJsonObject
;
}
}
FeiShuEventDTO
feiShuEventDTO
=
encryptJsonObject
.
toJavaObject
(
FeiShuEventDTO
.
class
);
FeiShuEventDTO
feiShuEventDTO
=
encryptJsonObject
.
toJavaObject
(
FeiShuEventDTO
.
class
);
if
(!
feiShuEventDTO
.
getHeader
().
getToken
().
equalsIgnoreCase
(
feiShuConfig
.
getVerificationToken
()))
{
if
(!
feiShuEventDTO
.
getHeader
().
getToken
().
equalsIgnoreCase
(
feiShuConfig
.
getVerificationToken
()))
{
return
null
;
return
null
;
}
}
if
(
"im.message.receive_v1"
.
equalsIgnoreCase
(
feiShuEventDTO
.
getHeader
().
getEvent_type
()))
{
if
(
"im.message.receive_v1"
.
equalsIgnoreCase
(
feiShuEventDTO
.
getHeader
().
getEvent_type
()))
{
log
.
info
(
"处理单聊事件:{}"
,
feiShuEventDTO
);
log
.
info
(
"处理单聊事件:{}"
,
feiShuEventDTO
);
feiShuEventService
.
imMessageReceiveV1
(
feiShuEventDTO
);
feiShuEventService
.
imMessageReceiveV1
(
feiShuEventDTO
);
}
}
return
null
;
return
null
;
}
}
...
@@ -182,7 +184,7 @@ public class FeiShuEventController {
...
@@ -182,7 +184,7 @@ public class FeiShuEventController {
String
robUserId
=
feiShuMsgCardEventDTO
.
getOpen_id
();
String
robUserId
=
feiShuMsgCardEventDTO
.
getOpen_id
();
Employee
employee
=
employeeService
.
findByOpenId
(
robUserId
);
Employee
employee
=
employeeService
.
findByOpenId
(
robUserId
);
massageService
.
robSingle
(
robUserId
,
oldUserId
,
employee
.
getName
());
massageService
.
robSingle
(
robUserId
,
oldUserId
,
employee
.
getName
());
String
fileName1
=
String
.
format
(
"/templates/massage-msg-card-rob-end.json"
);
String
fileName1
=
String
.
format
(
"/templates/massage-msg-card-rob-end.json"
);
return
getInteractiveCardStr
(
fileName1
,
"已经被"
+
employee
.
getName
()
+
"抢啦,啦啦~"
);
return
getInteractiveCardStr
(
fileName1
,
"已经被"
+
employee
.
getName
()
+
"抢啦,啦啦~"
);
}
}
...
@@ -208,8 +210,10 @@ public class FeiShuEventController {
...
@@ -208,8 +210,10 @@ public class FeiShuEventController {
}
}
@PostMapping
(
"/delete-chat-list"
)
@PostMapping
(
"/delete-chat-list"
)
public
Object
deleteChat
()
{
public
Object
deleteChat
(
String
chatId
)
{
String
chatId
=
(
String
)
CacheUtil
.
get
(
"chatId"
);
if
(
StringUtils
.
isBlank
(
chatId
))
{
chatId
=
(
String
)
CacheUtil
.
get
(
"chatId"
);
}
log
.
info
(
"删除群组id:{}"
,
chatId
);
log
.
info
(
"删除群组id:{}"
,
chatId
);
feiShuApiService
.
deleteChatList
(
chatId
);
feiShuApiService
.
deleteChatList
(
chatId
);
return
null
;
return
null
;
...
...
src/main/java/com/pipihelper/project/feishu/dto/FeiShuConfig.java
View file @
ebc9ed3
...
@@ -26,6 +26,7 @@ public class FeiShuConfig {
...
@@ -26,6 +26,7 @@ public class FeiShuConfig {
private
String
appId
;
private
String
appId
;
private
String
appSecret
;
private
String
appSecret
;
private
String
ChatId
;
private
String
ChatId
;
private
String
xiaoshanOpenId
;
//小单openId
private
String
tableId
;
private
String
tableId
;
private
String
peopleTableId
;
private
String
peopleTableId
;
...
...
src/main/java/com/pipihelper/project/feishu/service/FeiShuApiService.java
View file @
ebc9ed3
...
@@ -454,7 +454,7 @@ public class FeiShuApiService {
...
@@ -454,7 +454,7 @@ public class FeiShuApiService {
}
}
public
String
deleteChatList
(
String
chatId
)
{
public
String
deleteChatList
(
String
chatId
)
{
String
api
=
"/im/v1/chats/
:
{chat_id}"
;
String
api
=
"/im/v1/chats/{chat_id}"
;
RestTemplate
restTemplate
=
new
RestTemplate
();
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpHeaders
headers
=
new
HttpHeaders
();
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
set
(
"Authorization"
,
"Bearer "
+
getTenantToken
());
headers
.
set
(
"Authorization"
,
"Bearer "
+
getTenantToken
());
...
...
src/main/java/com/pipihelper/project/scheduled/MassageNoticeScheduleService.java
View file @
ebc9ed3
...
@@ -20,8 +20,8 @@ import com.pipihelper.project.feishu.service.PainService;
...
@@ -20,8 +20,8 @@ import com.pipihelper.project.feishu.service.PainService;
import
com.pipihelper.project.feishu.service.massage.MassageService
;
import
com.pipihelper.project.feishu.service.massage.MassageService
;
import
com.pipihelper.project.utils.CacheUtil
;
import
com.pipihelper.project.utils.CacheUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -70,11 +70,11 @@ public class MassageNoticeScheduleService {
...
@@ -70,11 +70,11 @@ public class MassageNoticeScheduleService {
floorCountMap
.
put
(
14
,
30
);
floorCountMap
.
put
(
14
,
30
);
}
}
// /**
// /**
// * 每周四定时生成要按摩的人员名单,并发送大群和单人消息
// * 每周四定时生成要按摩的人员名单,并发送大群和单人消息
// */
// */
// @Async
// @Async
// @Scheduled(cron = "0 0 10 * * ?
")
@Scheduled
(
cron
=
"0 0 11 ? * THU
"
)
public
void
sendMsgCardToPipiChat
()
{
public
void
sendMsgCardToPipiChat
()
{
employeeService
.
uprsetAllEmployee
();
employeeService
.
uprsetAllEmployee
();
chatMessageService
.
deleteAll
();
chatMessageService
.
deleteAll
();
...
@@ -139,7 +139,7 @@ public class MassageNoticeScheduleService {
...
@@ -139,7 +139,7 @@ public class MassageNoticeScheduleService {
FeiShuChatDTO
feiShuChatDTO
=
new
FeiShuChatDTO
();
FeiShuChatDTO
feiShuChatDTO
=
new
FeiShuChatDTO
();
feiShuChatDTO
.
setName
(
"按摩群 "
+
DateUtil
.
today
());
feiShuChatDTO
.
setName
(
"按摩群 "
+
DateUtil
.
today
());
feiShuChatDTO
.
setOwnerId
(
pushPainBOList
.
get
(
0
).
getOpen
Id
());
feiShuChatDTO
.
setOwnerId
(
feiShuConfig
.
getChat
Id
());
feiShuChatDTO
.
setUserIdList
(
userIdList
);
feiShuChatDTO
.
setUserIdList
(
userIdList
);
String
chatId
=
feiShuApiService
.
createChatList
(
feiShuChatDTO
);
String
chatId
=
feiShuApiService
.
createChatList
(
feiShuChatDTO
);
massageService
.
sendMassageMsgCardToPiPiChat
(
pushPainBOList
,
chatId
);
massageService
.
sendMassageMsgCardToPiPiChat
(
pushPainBOList
,
chatId
);
...
@@ -156,13 +156,17 @@ public class MassageNoticeScheduleService {
...
@@ -156,13 +156,17 @@ public class MassageNoticeScheduleService {
}
}
}
}
}
}
/**
/**
* 每周四18:00删除当天的群聊
* 每周四18:00删除当天的群聊
*/
*/
// @Async
// @Async
// @Scheduled(cron = "0 0 18
* * ?")
@Scheduled
(
cron
=
"0 0 19
* * ?"
)
public
void
deleteChatList
()
{
public
void
deleteChatList
()
{
String
chatId
=
(
String
)
CacheUtil
.
get
(
"chatId"
);
String
chatId
=
(
String
)
CacheUtil
.
get
(
"chatId"
);
if
(
StringUtils
.
isEmpty
(
chatId
))
{
return
;
}
feiShuApiService
.
deleteChatList
(
chatId
);
feiShuApiService
.
deleteChatList
(
chatId
);
}
}
...
@@ -171,7 +175,7 @@ public class MassageNoticeScheduleService {
...
@@ -171,7 +175,7 @@ public class MassageNoticeScheduleService {
* 当天时间2:55,给第一波三个人更新卡片,并发送应用内提醒
* 当天时间2:55,给第一波三个人更新卡片,并发送应用内提醒
*/
*/
// @Async
// @Async
// @Scheduled(cron = "0 0 10 * * ?
")
@Scheduled
(
cron
=
"0 55 14 ? * THU
"
)
public
void
massageStart
()
{
public
void
massageStart
()
{
List
<
Pain
>
pains
=
painService
.
findListAsc
(
3
);
List
<
Pain
>
pains
=
painService
.
findListAsc
(
3
);
// String msg = "{\"text\":\"当前按摩进度:<at user_id=\\\"%s\\\">%s</at> <at user_id=\\\"%s\\\">%s</at> <at user_id=\\\"%s\\\">%s</at>\"}";
// String msg = "{\"text\":\"当前按摩进度:<at user_id=\\\"%s\\\">%s</at> <at user_id=\\\"%s\\\">%s</at> <at user_id=\\\"%s\\\">%s</at>\"}";
...
...
src/main/resources/application-prod.yml
View file @
ebc9ed3
...
@@ -16,6 +16,7 @@ feishu:
...
@@ -16,6 +16,7 @@ feishu:
appId
:
cli_a3c0cb967f619013
appId
:
cli_a3c0cb967f619013
appSecret
:
NdqjzD2Bkaif6HyU8KCXGbFJzDhEEimt
appSecret
:
NdqjzD2Bkaif6HyU8KCXGbFJzDhEEimt
ChatId
:
oc_2c70ffa8559b1bdd75c4dca0490b7a05
ChatId
:
oc_2c70ffa8559b1bdd75c4dca0490b7a05
xiaoshanOpenId
:
od-41a0dc296e8761e3708560eeea68bbf6
# 腾讯云配置参数
# 腾讯云配置参数
tx
:
tx
:
...
...
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