From 04bf6c32f6ebce7cdfb23e3e72a9d83dcf531113 Mon Sep 17 00:00:00 2001 From: sunzheng Date: Mon, 29 Jul 2024 15:09:14 +0800 Subject: [PATCH] =?UTF-8?q?update:=E4=BF=9D=E5=AD=98=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=96=B0=E5=A2=9E=E6=A0=87=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/FeiShuDockingServiceImpl.java | 16 +++++++++------- .../hiwork/entity/LawsUnifiedTodoLog.java | 7 +++++++ .../service/impl/UnifiedTodoServiceImpl.java | 5 +++-- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/laws-modules-docking/src/main/java/com/jero/modules/docking/feishu/service/impl/FeiShuDockingServiceImpl.java b/laws-modules-docking/src/main/java/com/jero/modules/docking/feishu/service/impl/FeiShuDockingServiceImpl.java index 801bdcfb..51557f12 100644 --- a/laws-modules-docking/src/main/java/com/jero/modules/docking/feishu/service/impl/FeiShuDockingServiceImpl.java +++ b/laws-modules-docking/src/main/java/com/jero/modules/docking/feishu/service/impl/FeiShuDockingServiceImpl.java @@ -252,9 +252,9 @@ public class FeiShuDockingServiceImpl implements IFeiShuDockingService { HttpEntity entity = new HttpEntity<>(approvalsInstanceVo, headers); ResponseEntity response = restTemplate.exchange(url, HttpMethod.POST, entity, String.class); JSONObject jsonResponse = JSON.parseObject(response.getBody()); - logMessage(JSON.toJSONString(instanceDto), jsonResponse, "/feishu/synchronizeApprovalInstance", Constant.FEISHU_PENDING); + logMessage(JSON.toJSONString(instanceDto), instanceDto.getTitle(), jsonResponse, "/feishu/synchronizeApprovalInstance", Constant.FEISHU_PENDING); }catch (Exception e) { - logError(JSON.toJSONString(instanceDto), e.getMessage(), "/feishu/synchronizeApprovalInstance", Constant.FEISHU_PENDING); + logError(JSON.toJSONString(instanceDto), instanceDto.getTitle(), e.getMessage(), "/feishu/synchronizeApprovalInstance", Constant.FEISHU_PENDING); log.error("同步三方审批实例异常" + e.getMessage()); } } @@ -423,7 +423,7 @@ public class FeiShuDockingServiceImpl implements IFeiShuDockingService { BotMessageDto botMessageDto1 = new BotMessageDto(); BeanUtils.copyProperties(botMessageDto,botMessageDto1); botMessageDto1.setReceiveIds(id); - logError(JSON.toJSONString(botMessageDto1), "用户id:" + id +"对应的飞书账用户不存在", "/feishu/sendHrefMessageByBot", Constant.FEISHU_MESSAGE); + logError(JSON.toJSONString(botMessageDto1), botMessageDto.getTitle(),"用户id:" + id +"对应的飞书账用户不存在", "/feishu/sendHrefMessageByBot", Constant.FEISHU_MESSAGE); } } } @@ -482,30 +482,32 @@ public class FeiShuDockingServiceImpl implements IFeiShuDockingService { HttpEntity entity = new HttpEntity<>(botMessageVo, headers); ResponseEntity response = restTemplate.exchange(builder.toUriString(), HttpMethod.POST, entity, String.class); JSONObject jsonResponse = JSON.parseObject(response.getBody()); - logMessage(JSON.toJSONString(botMessageDto), jsonResponse, "/feishu/sendHrefMessageByBot", Constant.FEISHU_MESSAGE); + logMessage(JSON.toJSONString(botMessageDto), botMessageDto.getTitle(), jsonResponse, "/feishu/sendHrefMessageByBot", Constant.FEISHU_MESSAGE); } } catch (Exception e) { - logError(JSON.toJSONString(botMessageDto), e.getMessage(), "/feishu/sendHrefMessageByBot", Constant.FEISHU_MESSAGE); + logError(JSON.toJSONString(botMessageDto),botMessageDto.getTitle(), e.getMessage(), "/feishu/sendHrefMessageByBot", Constant.FEISHU_MESSAGE); } } - private void logMessage(String dto, JSONObject jsonResponse, String url, Integer messageType) { + private void logMessage(String dto, String title, JSONObject jsonResponse, String url, Integer messageType) { LawsUnifiedTodoLog logEntry = new LawsUnifiedTodoLog(); logEntry.setJsonStr(dto); logEntry.setResponseBody(JSON.toJSONString(jsonResponse)); logEntry.setState("0".equals(jsonResponse.getString("code")) ? 1 : 2); logEntry.setMessageType(messageType); logEntry.setUrl(url); + logEntry.setTitle(title); lawsUnifiedTodoLogService.add(logEntry); } - private void logError(String dto, String errorMessage, String url, Integer messageType) { + private void logError(String dto, String title, String errorMessage, String url, Integer messageType) { LawsUnifiedTodoLog logEntry = new LawsUnifiedTodoLog(); logEntry.setJsonStr(dto); logEntry.setResponseBody(errorMessage); logEntry.setState(2); logEntry.setMessageType(messageType); logEntry.setUrl(url); + logEntry.setTitle(title); lawsUnifiedTodoLogService.add(logEntry); log.error("飞书发送消息异常: " + errorMessage); } diff --git a/laws-modules-docking/src/main/java/com/jero/modules/docking/hiwork/entity/LawsUnifiedTodoLog.java b/laws-modules-docking/src/main/java/com/jero/modules/docking/hiwork/entity/LawsUnifiedTodoLog.java index 6dee5a6c..da7c5ee4 100644 --- a/laws-modules-docking/src/main/java/com/jero/modules/docking/hiwork/entity/LawsUnifiedTodoLog.java +++ b/laws-modules-docking/src/main/java/com/jero/modules/docking/hiwork/entity/LawsUnifiedTodoLog.java @@ -87,4 +87,11 @@ public class LawsUnifiedTodoLog { @ApiModelProperty(value="更新时间") private Date updateTime; + /** + * 标题 + */ + @TableField(value = "title") + @ApiModelProperty(value="标题") + private String title; + } diff --git a/laws-modules-docking/src/main/java/com/jero/modules/docking/hiwork/service/impl/UnifiedTodoServiceImpl.java b/laws-modules-docking/src/main/java/com/jero/modules/docking/hiwork/service/impl/UnifiedTodoServiceImpl.java index 2b36b98b..8c8d2931 100644 --- a/laws-modules-docking/src/main/java/com/jero/modules/docking/hiwork/service/impl/UnifiedTodoServiceImpl.java +++ b/laws-modules-docking/src/main/java/com/jero/modules/docking/hiwork/service/impl/UnifiedTodoServiceImpl.java @@ -111,13 +111,13 @@ public class UnifiedTodoServiceImpl implements PushWorkflowIntegrationAPI { String reqJsonString = JSONObject.toJSONString(unifiedTodoVOList); String jsonString = JSONObject.toJSONString(unifiedTodoList); log.info("统一待办推送入参" + jsonString); - push(ip + todoUrl,jsonString, reqJsonString); + push(ip + todoUrl,jsonString, reqJsonString, unifiedTodoList.get(0).getRequestname()); }catch (Exception e){ log.error("统一待办推送异常",e); } } - private void push(String url, String jsonString, String reqJsonString) { + private void push(String url, String jsonString, String reqJsonString, String title) { // 设置最大重试次数 int maxRetries = 3; // 当前重试次数 @@ -151,6 +151,7 @@ public class UnifiedTodoServiceImpl implements PushWorkflowIntegrationAPI { lawsUnifiedTodoLog.setUrl(url); lawsUnifiedTodoLog.setJsonStr(reqJsonString); lawsUnifiedTodoLog.setMessageType(1); + lawsUnifiedTodoLog.setTitle(title); if (retries == maxRetries){ lawsUnifiedTodoLog.setState(2); }else {