| | |
| | | Integer maxRetry = logRecord.getMaxRetryCount(); |
| | | Integer intervalSeconds = logRecord.getRetryIntervalSeconds(); |
| | | if (maxRetry == null || intervalSeconds == null || intervalSeconds <= 0) { |
| | | log.warn("云仓上报待办跳过:重试参数缺失,id={},bizRef={},maxRetry={},intervalSeconds={}", |
| | | logRecord.getId(), logRecord.getBizRef(), maxRetry, intervalSeconds); |
| | | continue; |
| | | } |
| | | // if (logRecord.getRetryCount() != null && logRecord.getRetryCount() >= maxRetry) { |
| | | if (!isInfiniteRetry(maxRetry) |
| | | && logRecord.getRetryCount() != null |
| | | && logRecord.getRetryCount() >= maxRetry) { |
| | | log.info("云仓上报待办跳过:重试次数已达上限,id={},bizRef={},retryCount={},maxRetry={}", |
| | | logRecord.getId(), logRecord.getBizRef(), logRecord.getRetryCount(), maxRetry); |
| | | continue; |
| | | } |
| | | if (logRecord.getLastNotifyTime() != null) { |
| | | long elapsed = (nowMs - logRecord.getLastNotifyTime().getTime()) / 1000; |
| | | if (elapsed < intervalSeconds) { |
| | | log.info("云仓上报待办跳过:未到重试间隔,id={},bizRef={},elapsed={}s,interval={}s", |
| | | logRecord.getId(), logRecord.getBizRef(), elapsed, intervalSeconds); |
| | | continue; |
| | | } |
| | | } |
| | |
| | | Date now = new Date(); |
| | | int nextRetry = (logRecord.getRetryCount() == null ? 0 : logRecord.getRetryCount()) + 1; |
| | | int effectiveMaxRetry = logRecord.getMaxRetryCount(); |
| | | log.info("云仓上报开始,id={},bizRef={},reportType={},attempt={},requestBody={}", |
| | | logRecord.getId(), logRecord.getBizRef(), reportType, nextRetry, requestBody); |
| | | |
| | | try { |
| | | if (cloudWmsNotifyLogService.getReportTypeInOutResult().equals(reportType)) { |
| | |
| | | logRecord.setNotifyStatus(status); |
| | | logRecord.setUpdateTime(now); |
| | | cloudWmsNotifyLogService.updateById(logRecord); |
| | | log.info("云仓上报结束,id={},bizRef={},attempt={},notifyStatus={},responseBody={}", |
| | | logRecord.getId(), logRecord.getBizRef(), nextRetry, status, responseJson); |
| | | } |
| | | |
| | | private void setFailResult(CloudWmsNotifyLog logRecord, String requestBody, String errorMsg, int nextRetry, Date now, int effectiveMaxRetry) { |
| | |
| | | : cloudWmsNotifyLogService.getNotifyStatusPending()); |
| | | logRecord.setUpdateTime(now); |
| | | cloudWmsNotifyLogService.updateById(logRecord); |
| | | log.warn("云仓上报失败,id={},bizRef={},attempt={},notifyStatus={},error={}", |
| | | logRecord.getId(), logRecord.getBizRef(), nextRetry, logRecord.getNotifyStatus(), errorMsg); |
| | | } |
| | | |
| | | /** maxRetry = -1 表示无限重发 */ |