飞书与oa异步发送
This commit is contained in:
+15
-3
@@ -29,6 +29,8 @@ import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -74,11 +76,16 @@ public class SendFeiShuServiceImpl implements ISendFeiShuService {
|
||||
if(CollectionUtils.isEmpty(unifiedTodoVOList)){
|
||||
return;
|
||||
}
|
||||
sendData(unifiedTodoVOList);
|
||||
try {
|
||||
log.info("发送飞书开始");
|
||||
sendData(unifiedTodoVOList);
|
||||
log.info("发送飞书结束");
|
||||
}catch (Exception e){
|
||||
log.error("飞书发送异常" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void sendData(List<UnifiedTodoVO> unifiedTodoVOList){
|
||||
|
||||
for (UnifiedTodoVO unifiedTodoVO : unifiedTodoVOList) {
|
||||
ProcessApprovalRecord processApprovalRecord =
|
||||
processApprovalRecordService.getById(unifiedTodoVO.getRecordId());
|
||||
@@ -107,6 +114,7 @@ public class SendFeiShuServiceImpl implements ISendFeiShuService {
|
||||
queryProcessApprovalRecord.eq(ProcessApprovalRecord::getNodeId,processApprovalRecord.getNodeId());
|
||||
long l = processApprovalRecordService.count(queryProcessApprovalRecord);
|
||||
if(l == 1 && Objects.equals(processApprovalRecord.getNodeId(),processNode.getXmlNodeId())){
|
||||
log.info("=============结束发送飞书");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -178,7 +186,11 @@ public class SendFeiShuServiceImpl implements ISendFeiShuService {
|
||||
.replace("{nodeId}",processApprovalRecord.getNodeId());
|
||||
String appBusinessLink = appUrl.replace("{url}", Objects.requireNonNull(ProcessTypeEnum.getFontReturnUrlPc(processAll.getPrcType())));
|
||||
instanceDto.setReviewPcLink(appBusinessLink);
|
||||
feiShuDockingService.synchronizeApprovalInstance(instanceDto);
|
||||
log.info("=============发送飞书");
|
||||
ForkJoinPool pool = new ForkJoinPool();
|
||||
CompletableFuture.runAsync(() -> {
|
||||
feiShuDockingService.synchronizeApprovalInstance(instanceDto);
|
||||
},pool);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+15
-14
@@ -40,6 +40,8 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
@@ -99,6 +101,7 @@ public class UnifiedTodoServiceImpl implements PushWorkflowIntegrationAPI {
|
||||
return;
|
||||
// throw new JeroBootException(ResultCommon.EMPTY_COMMON, "unifiedTodoVOList");
|
||||
}
|
||||
long l = System.currentTimeMillis();
|
||||
String newDate = DateUtil.formatDateTime(new Date());
|
||||
for (UnifiedTodoVO unifiedTodoVO : unifiedTodoVOList) {
|
||||
String date = unifiedTodoVO.getDate();
|
||||
@@ -111,26 +114,24 @@ public class UnifiedTodoServiceImpl implements PushWorkflowIntegrationAPI {
|
||||
String reqJsonString = JSONObject.toJSONString(unifiedTodoVOList);
|
||||
String jsonString = JSONObject.toJSONString(unifiedTodoList);
|
||||
log.info("统一待办推送入参" + jsonString);
|
||||
long l = System.currentTimeMillis();
|
||||
push(ip + todoUrl,jsonString,reqJsonString, unifiedTodoList.get(0).getRequestname());
|
||||
long l1 = System.currentTimeMillis();
|
||||
System.out.println("===========================OA" + (l1-l));
|
||||
ForkJoinPool pool = new ForkJoinPool();
|
||||
CompletableFuture.runAsync(() -> {
|
||||
push(ip + todoUrl,jsonString,reqJsonString, unifiedTodoList.get(0).getRequestname());
|
||||
},pool);
|
||||
}catch (Exception e){
|
||||
log.error("统一待办推送异常",e);
|
||||
log.error("统一待办推送异常" + e);
|
||||
}
|
||||
long l1 = System.currentTimeMillis();
|
||||
System.out.println("===========================OA" + (l1-l));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendTodoTaskByFeiShu(List<UnifiedTodoVO> unifiedTodoVOList) {
|
||||
try {
|
||||
long l = System.currentTimeMillis();
|
||||
// 发送飞书
|
||||
sendFeiShuService.sendTodoTask(unifiedTodoVOList);
|
||||
long l1 = System.currentTimeMillis();
|
||||
System.out.println("===========================feishu" + (l1-l));
|
||||
}catch (Exception e){
|
||||
log.error("飞书发送异常",e.getMessage());
|
||||
}
|
||||
long l = System.currentTimeMillis();
|
||||
// 发送飞书
|
||||
sendFeiShuService.sendTodoTask(unifiedTodoVOList);
|
||||
long l1 = System.currentTimeMillis();
|
||||
System.out.println("===========================feishu" + (l1-l));
|
||||
}
|
||||
|
||||
private void push(String url, String jsonString,String reqJsonString, String title) {
|
||||
|
||||
Reference in New Issue
Block a user