Parcourir la source

OA消息通知的查询条件处理

Zimo il y a 1 jour
Parent
commit
04e4080db0

+ 12 - 1
yudao-server/src/main/java/cn/iocoder/yudao/server/service/PortalOaFlow.java

@@ -26,6 +26,8 @@ import org.springframework.util.MultiValueMap;
 import org.springframework.web.client.RestClientException;
 import org.springframework.web.client.RestTemplate;
 
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -186,7 +188,16 @@ public class PortalOaFlow {
         Map<String, Object> params = new HashMap<>();
         params.put("userId", oaId);
         if (oaNoticeDO != null) {
-            params.put("dateTime", oaNoticeDO.getOaCreateTime());
+            if (StringUtils.isNotBlank(oaNoticeDO.getOaCreateTime())) {
+                DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+                // 2. 字符串转时间对象
+                LocalDateTime dateTime = LocalDateTime.parse(oaNoticeDO.getOaCreateTime(), formatter);
+                // 3. 往前推 1 秒(核心)
+                LocalDateTime newTime = dateTime.plusSeconds(1);
+                // 4. 转回字符串输出
+                String result = newTime.format(formatter);
+                params.put("dateTime", result);
+            }
         }
 
         HttpEntity<Map<String, Object>> requestEntityOut = new HttpEntity<>(params, headersOut);