Commit 8e499e62 by zhaolianjie

卡片流程 - 下一位

1 parent b27a6a91
......@@ -17,7 +17,11 @@ import com.pipihelper.project.feishu.dto.msg.FeiShuMsgDTO;
import com.pipihelper.project.feishu.entity.Employee;
import com.pipihelper.project.feishu.entity.LastMaxPain;
import com.pipihelper.project.feishu.entity.Pain;
import com.pipihelper.project.feishu.service.*;
import com.pipihelper.project.feishu.service.EmployeeService;
import com.pipihelper.project.feishu.service.FeiShuApiService;
import com.pipihelper.project.feishu.service.FeiShuEventService;
import com.pipihelper.project.feishu.service.LastMaxPainService;
import com.pipihelper.project.feishu.service.PainService;
import com.pipihelper.project.feishu.service.massage.MassageMsgCardSerivce;
import com.pipihelper.project.feishu.service.massage.MassageService;
import com.pipihelper.project.feishu.utils.FeiShuEventDataDecrypter;
......@@ -33,7 +37,13 @@ import javax.annotation.Resource;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
......@@ -125,7 +135,6 @@ public class FeiShuEventController {
// 推迟 将当前用户放到队列最后 - 掉延迟更新卡片接口 更新大群、按摩群的按摩时间安排卡片
String waitUserId = feiShuMsgCardEventDTO.getOpen_id();
painService.waitPain(waitUserId);
//ToDo 没有按摩群的id
massageService.updateMassageMsgCardToPiPiChat(feiShuConfig.getChatId());
//没有按摩群的id
// massageService.updateMassageMsgCardToPiPiChat();
......@@ -160,16 +169,18 @@ public class FeiShuEventController {
public synchronized JSONObject rob(FeiShuMsgCardEventDTO feiShuMsgCardEventDTO) {
String oldUserId = feiShuMsgCardEventDTO.getAction().getValue().getKey().split("\\.")[2];
String robUserId = feiShuMsgCardEventDTO.getOpen_id();
JSONObject user = feiShuApiService.getUserInfo(robUserId);
Pain oldPain = painService.findByOpenId(oldUserId);
oldPain.setOpenId(robUserId);
oldPain.setName(user.getString("name"));
painService.update(oldPain);
FeiShuChatDTO feiShuChatDTO = new FeiShuChatDTO();
feiShuChatDTO.setChatId((String) CacheUtil.get("chatId"));
feiShuChatDTO.setIdList(new String[]{feiShuMsgCardEventDTO.getOpen_id()});
feiShuApiService.joinChatList(feiShuChatDTO);
//ToDo 更新大群和按摩群的大卡片,异步
String fileName1 = String.format("/templates/massage-msg-card-rob-end.json");
return getInteractiveCardStr(fileName1, "已经被抢啦啦啦~");
return getInteractiveCardStr(fileName1, "已经被" + user.getString("name") + "抢啦,啦啦~");
}
/**
......@@ -203,7 +214,7 @@ public class FeiShuEventController {
}
int countByFloor = employeeService.findCountByFloor(14);
int limit = 30;
if(countByFloor < 30){
if (countByFloor < 30) {
limit = countByFloor;
}
List<Employee> employeeList = employeeService.findStartList(startEmployeeId, 14, limit);
......@@ -248,7 +259,7 @@ public class FeiShuEventController {
pushPainBO.setOpenId(it.getOpenId());
pushPainBO.setTimeRange("15:00-16:00");
pushPainBOList.add(pushPainBO);
userIdList[increment-1] = it.getOpenId();
userIdList[increment - 1] = it.getOpenId();
});
System.out.println(pushPainBOList);
......@@ -257,8 +268,8 @@ public class FeiShuEventController {
feiShuChatDTO.setOwnerId(pushPainBOList.get(0).getOpenId());
feiShuChatDTO.setUserIdList(userIdList);
String chatId = feiShuApiService.createChatList(feiShuChatDTO);
massageService.sendMassageMsgCardToPiPiChat(pushPainBOList,chatId);
massageService.sendMassageMsgCardToPiPiChat(pushPainBOList,feiShuConfig.getChatId());
massageService.sendMassageMsgCardToPiPiChat(pushPainBOList, chatId);
massageService.sendMassageMsgCardToPiPiChat(pushPainBOList, feiShuConfig.getChatId());
if (maxPain != null) {
maxPain.setEmployeeId(maxEmploeeId);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!