Przeglądaj źródła

排查官方群发漏发日志

xw 3 dni temu
rodzic
commit
bad08fb4cc

+ 27 - 2
fs-service/src/main/java/com/fs/sop/service/impl/QwSopLogsServiceImpl.java

@@ -1814,7 +1814,15 @@ public class QwSopLogsServiceImpl extends ServiceImpl<QwSopLogsMapper, QwSopLogs
                                             templateSop.setAttachments(attachments);
                                             try {
                                                 QwAddMsgTemplateResult result = qwApiService.addMsgTemplateBySop(templateSop, corpId);
-                                                if (result.getErrCode() == 0 || result.getErrCode() == 41063){
+                                                if (result == null) {
+                                                    logger.error("【官方群发-单链】企微接口无响应, corpId={}, qwUserid={}, externalUserId={}, logId={}",
+                                                            corpId, qwUserid, externalUserId, userLogs.get(0).getId());
+                                                    for (QwSopLogs log : userLogs) {
+                                                        log.setSendStatus(3L);
+                                                        log.setRemark("企微接口无响应");
+                                                        updateList.add(log);
+                                                    }
+                                                } else if (result.getErrCode() == 0 || result.getErrCode() == 41063){
                                                     for (QwSopLogs log : userLogs) {
                                                         log.setSendStatus(1L);
                                                         log.setMsgId(result.getMsgId());
@@ -2135,6 +2143,16 @@ public class QwSopLogsServiceImpl extends ServiceImpl<QwSopLogsMapper, QwSopLogs
 
             // 调用企业微信接口
             QwAddMsgTemplateResult result = qwApiService.addMsgTemplateBySop(template, corpId);
+            if (result == null) {
+                logger.error("【官方群发-营期】企微接口无响应, corpId={}, qwUserid={}, sopId={}, 客户数={}, logId={}",
+                        corpId, qwUserid, first.getSopId(), externalUserIds.size(), first.getId());
+                logsGroup.forEach(log -> {
+                    log.setSendStatus(3L);
+                    log.setRemark("企微接口无响应");
+                    updateQueue.add(log);
+                });
+                return;
+            }
 
             int errCode = result.getErrCode();
             String errMsg = result.getErrMsg();
@@ -2173,7 +2191,14 @@ public class QwSopLogsServiceImpl extends ServiceImpl<QwSopLogsMapper, QwSopLogs
             }
 
         } catch (Exception e) {
-            logger.error("处理分组异常", e);
+            QwSopLogs first = logsGroup.isEmpty() ? null : logsGroup.get(0);
+            logger.error("【官方群发-营期】处理分组异常, corpId={}, qwUserid={}, sopId={}, 记录数={}, logId={}, 原因={}",
+                    first != null ? first.getCorpId() : null,
+                    first != null ? first.getQwUserid() : null,
+                    first != null ? first.getSopId() : null,
+                    logsGroup.size(),
+                    first != null ? first.getId() : null,
+                    e.getMessage(), e);
         }
     }