wzy 4 månader sedan
förälder
incheckning
a1cf50a064

+ 4 - 1
mjava-yiyao/src/main/java/com/malk/yiyao/service/impl/YiyaoServiceImpl.java

@@ -1633,6 +1633,7 @@ public class YiyaoServiceImpl implements YiyaoService {
                     SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
                     String formattedDate = sdf.format(timeStamp);
                     formData.put("textField_mbrbdyl4","签到人:" +userName + ",签到时间:" + formattedDate + ",签到地点:" + detailPlace);//标题
+
                     ydClient.operateData(YDParam.builder()
                             .formUuid("FORM-D4389CDAD1704F959E9D38CB64927AD8PKCH")
                             .formDataJson(JSONObject.toJSONString(formData))
@@ -1640,7 +1641,7 @@ public class YiyaoServiceImpl implements YiyaoService {
                 }
 
                 break;
-            } catch (Exception e) {
+            } catch (IORuntimeException e) {
                 if (retryCount < maxRetries){
                     retryCount++;
                     log.info("eventId:{},第{}次重试,异常信息:{}",eventId, retryCount, e.getMessage());
@@ -1653,6 +1654,8 @@ public class YiyaoServiceImpl implements YiyaoService {
                     continue;
                 }
                 throw new RuntimeException("eventId:" + eventId + ",超出最大重试次数,异常信息:" + e.getMessage());
+            }catch (Exception e) {
+                log.error("eventId:{},请求失败:", eventId, e);
             }
         }
     }

+ 1 - 1
mjava-yiyao/src/main/resources/application.yml

@@ -1,6 +1,6 @@
 spring:
   profiles:
-    active: dev
+    active: prod
   servlet:
     multipart:
       max-file-size: 100MB

+ 31 - 7
mjava-yiyao/src/test/java/com/malk/yiyao/YiyaoTest.java

@@ -1,6 +1,12 @@
 package com.malk.yiyao;
 
+import cn.hutool.core.io.IORuntimeException;
 import com.alibaba.fastjson.JSONObject;
+import com.malk.server.aliwork.YDConf;
+import com.malk.server.aliwork.YDParam;
+import com.malk.server.dingtalk.DDR_New;
+import com.malk.utils.UtilHttp;
+import com.malk.utils.UtilMap;
 import com.malk.yiyao.service.YiyaoService;
 import lombok.extern.slf4j.Slf4j;
 import org.junit.Test;
@@ -9,6 +15,13 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
+import java.net.UnknownHostException;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 @Slf4j
 @SpringBootTest
 @RunWith(SpringRunner.class)
@@ -70,17 +83,28 @@ public class YiyaoTest {
     @Test
     public void test11() {
         JSONObject json = new JSONObject();
-        json.put("timeStamp", 1752738143151L);
-        json.put("eventId","7a5a1a4b42724fceb799205f4363bebd");
+        json.put("timeStamp", 1754541812234L);
+        json.put("eventId","50d550f6fb9444c0b99dae58d503a280");
         json.put("CorpId","dingf11f7d6ff834577b");
-        json.put("StaffId","694148202226282223");
+        json.put("StaffId","134213470523662878");
         json.put("EventType","check_in");
-        json.put("EventTime",1752738143151L);
-        json.put("BizId","c3152e9b-793a-4a34-b7a5-86448aba1566");
-        json.put("staffId","694148202226282223");
-        json.put("TimeStamp", 1752738143151L);
+        json.put("EventTime",1754541812234L);
+        json.put("BizId","4566b06c-9167-4dd9-b47f-0531a2e10ce0");
+        json.put("staffId","134213470523662878");
+        json.put("TimeStamp", 1754541812234L);
 
         yiyaoService.getCheckInData(json);
     }
 
+    @Test
+    public void test12() {
+        try {
+           throw new IORuntimeException("测试异常");
+        } catch (IORuntimeException e) {
+            log.info("异常信息:{}", e.getMessage());
+        }catch (Exception e) {
+            log.error("请求失败:", e);
+        }
+    }
+
 }