|
@@ -1593,13 +1593,14 @@ public class YiyaoServiceImpl implements YiyaoService {
|
|
@Override
|
|
@Override
|
|
public void getCheckInData(JSONObject eventJson) {
|
|
public void getCheckInData(JSONObject eventJson) {
|
|
int retryCount = 0;
|
|
int retryCount = 0;
|
|
- int maxRetries = 3;
|
|
|
|
|
|
+ int maxRetries = 5;
|
|
|
|
+
|
|
|
|
+ long timeStamp = roundToNearestThousand(Long.parseLong(eventJson.getString("timeStamp")));//签到时间戳
|
|
|
|
+ String staffId = eventJson.getString("StaffId");//签到人userId
|
|
|
|
+ String eventId = eventJson.getString("eventId");//签到事件id
|
|
|
|
+
|
|
while (retryCount <= maxRetries) {
|
|
while (retryCount <= maxRetries) {
|
|
try {
|
|
try {
|
|
- String timeStamp = eventJson.getString("timeStamp");//签到时间戳
|
|
|
|
- timeStamp = roundToNearestThousand(Long.parseLong(timeStamp)) + "";
|
|
|
|
- String staffId = eventJson.getString("StaffId");//签到人userId
|
|
|
|
-
|
|
|
|
//获取签到数据
|
|
//获取签到数据
|
|
Map body = new HashMap();
|
|
Map body = new HashMap();
|
|
body.put("cursor",0);
|
|
body.put("cursor",0);
|
|
@@ -1630,7 +1631,7 @@ public class YiyaoServiceImpl implements YiyaoService {
|
|
formData.put("textField_mbrb3qfx",detailPlace);//签到地点
|
|
formData.put("textField_mbrb3qfx",detailPlace);//签到地点
|
|
formData.put("textareaField_mbypt8rp",remark);//备注
|
|
formData.put("textareaField_mbypt8rp",remark);//备注
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
- String formattedDate = sdf.format(Long.parseLong(timeStamp));
|
|
|
|
|
|
+ String formattedDate = sdf.format(timeStamp);
|
|
formData.put("textField_mbrbdyl4","签到人:" +userName + ",签到时间:" + formattedDate + ",签到地点:" + detailPlace);//标题
|
|
formData.put("textField_mbrbdyl4","签到人:" +userName + ",签到时间:" + formattedDate + ",签到地点:" + detailPlace);//标题
|
|
ydClient.operateData(YDParam.builder()
|
|
ydClient.operateData(YDParam.builder()
|
|
.formUuid("FORM-D4389CDAD1704F959E9D38CB64927AD8PKCH")
|
|
.formUuid("FORM-D4389CDAD1704F959E9D38CB64927AD8PKCH")
|
|
@@ -1642,16 +1643,16 @@ public class YiyaoServiceImpl implements YiyaoService {
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
if (retryCount < maxRetries){
|
|
if (retryCount < maxRetries){
|
|
retryCount++;
|
|
retryCount++;
|
|
- log.info("第{}次重试,异常信息:{}", retryCount, e.getMessage());
|
|
|
|
|
|
+ log.info("eventId:{},第{}次重试,异常信息:{}",eventId, retryCount, e.getMessage());
|
|
try {
|
|
try {
|
|
- Thread.sleep(1000 * retryCount); // 指数退避
|
|
|
|
|
|
+ Thread.sleep(5000);
|
|
} catch (InterruptedException ie) {
|
|
} catch (InterruptedException ie) {
|
|
Thread.currentThread().interrupt();// 如果线程在等待期间被中断,恢复中断状态
|
|
Thread.currentThread().interrupt();// 如果线程在等待期间被中断,恢复中断状态
|
|
throw new RuntimeException("Request interrupted", ie);// 抛出运行时异常,终止重试
|
|
throw new RuntimeException("Request interrupted", ie);// 抛出运行时异常,终止重试
|
|
}
|
|
}
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- throw new RuntimeException("超出最大重试次数,异常信息:" + e.getMessage());
|
|
|
|
|
|
+ throw new RuntimeException("eventId:" + eventId + ",超出最大重试次数,异常信息:" + e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|