Commit ebc9ed34 by zhangshaowu

Merge remote-tracking branch 'origin/master'

2 parents 1c7adc53 e84d0497
......@@ -29,6 +29,7 @@ import com.pipihelper.project.feishu.service.massage.MassageService;
import com.pipihelper.project.feishu.utils.FeiShuEventDataDecrypter;
import com.pipihelper.project.utils.CacheUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -92,13 +93,14 @@ public class FeiShuEventController {
if (encryptJsonObject.containsKey("challenge")) {
return encryptJsonObject;
}
FeiShuEventDTO feiShuEventDTO = encryptJsonObject.toJavaObject(FeiShuEventDTO.class);
if (!feiShuEventDTO.getHeader().getToken().equalsIgnoreCase(feiShuConfig.getVerificationToken())) {
return null;
}
if ("im.message.receive_v1".equalsIgnoreCase(feiShuEventDTO.getHeader().getEvent_type())) {
log.info("处理单聊事件:{}",feiShuEventDTO);
feiShuEventService.imMessageReceiveV1(feiShuEventDTO);
log.info("处理单聊事件:{}", feiShuEventDTO);
feiShuEventService.imMessageReceiveV1(feiShuEventDTO);
}
return null;
}
......@@ -182,7 +184,7 @@ public class FeiShuEventController {
String robUserId = feiShuMsgCardEventDTO.getOpen_id();
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");
return getInteractiveCardStr(fileName1, "已经被" + employee.getName() + "抢啦,啦啦~");
}
......@@ -208,8 +210,10 @@ public class FeiShuEventController {
}
@PostMapping("/delete-chat-list")
public Object deleteChat() {
String chatId = (String) CacheUtil.get("chatId");
public Object deleteChat(String chatId) {
if (StringUtils.isBlank(chatId)) {
chatId = (String) CacheUtil.get("chatId");
}
log.info("删除群组id:{}", chatId);
feiShuApiService.deleteChatList(chatId);
return null;
......
......@@ -26,6 +26,7 @@ public class FeiShuConfig {
private String appId;
private String appSecret;
private String ChatId;
private String xiaoshanOpenId;//小单openId
private String tableId;
private String peopleTableId;
......
......@@ -454,7 +454,7 @@ public class FeiShuApiService {
}
public String deleteChatList(String chatId) {
String api = "/im/v1/chats/:{chat_id}";
String api = "/im/v1/chats/{chat_id}";
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", "Bearer " + getTenantToken());
......
......@@ -20,8 +20,8 @@ import com.pipihelper.project.feishu.service.PainService;
import com.pipihelper.project.feishu.service.massage.MassageService;
import com.pipihelper.project.utils.CacheUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
......@@ -70,11 +70,11 @@ public class MassageNoticeScheduleService {
floorCountMap.put(14, 30);
}
// /**
// /**
// * 每周四定时生成要按摩的人员名单,并发送大群和单人消息
// */
// @Async
// @Scheduled(cron = "0 0 10 * * ?")
@Scheduled(cron = "0 0 11 ? * THU")
public void sendMsgCardToPipiChat() {
employeeService.uprsetAllEmployee();
chatMessageService.deleteAll();
......@@ -139,7 +139,7 @@ public class MassageNoticeScheduleService {
FeiShuChatDTO feiShuChatDTO = new FeiShuChatDTO();
feiShuChatDTO.setName("按摩群 " + DateUtil.today());
feiShuChatDTO.setOwnerId(pushPainBOList.get(0).getOpenId());
feiShuChatDTO.setOwnerId(feiShuConfig.getChatId());
feiShuChatDTO.setUserIdList(userIdList);
String chatId = feiShuApiService.createChatList(feiShuChatDTO);
massageService.sendMassageMsgCardToPiPiChat(pushPainBOList, chatId);
......@@ -156,13 +156,17 @@ public class MassageNoticeScheduleService {
}
}
}
/**
* 每周四18:00删除当天的群聊
*/
// @Async
// @Scheduled(cron = "0 0 18 * * ?")
@Scheduled(cron = "0 0 19 * * ?")
public void deleteChatList() {
String chatId = (String) CacheUtil.get("chatId");
if (StringUtils.isEmpty(chatId)) {
return;
}
feiShuApiService.deleteChatList(chatId);
}
......@@ -171,7 +175,7 @@ public class MassageNoticeScheduleService {
* 当天时间2:55,给第一波三个人更新卡片,并发送应用内提醒
*/
// @Async
// @Scheduled(cron = "0 0 10 * * ?")
@Scheduled(cron = "0 55 14 ? * THU")
public void massageStart() {
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>\"}";
......
......@@ -16,6 +16,7 @@ feishu:
appId: cli_a3c0cb967f619013
appSecret: NdqjzD2Bkaif6HyU8KCXGbFJzDhEEimt
ChatId: oc_2c70ffa8559b1bdd75c4dca0490b7a05
xiaoshanOpenId: od-41a0dc296e8761e3708560eeea68bbf6
# 腾讯云配置参数
tx:
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!