|
|
@ -1,5 +1,6 @@ |
|
|
package com.gaotao.modules.api.service.impl; |
|
|
package com.gaotao.modules.api.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
@ -27,6 +28,8 @@ import java.util.Date; |
|
|
import java.util.HashMap; |
|
|
import java.util.HashMap; |
|
|
import java.util.Map; |
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
import static com.alibaba.fastjson2.JSON.parseObject; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Description IFS接口调用错误日志服务实现类 - rqrq |
|
|
* @Description IFS接口调用错误日志服务实现类 - rqrq |
|
|
* @Author rqrq |
|
|
* @Author rqrq |
|
|
@ -223,8 +226,8 @@ public class IfsCallErrorLogServiceImpl extends ServiceImpl<IfsCallErrorLogMappe |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 3. 调用IFS接口(独立实现,不影响原有逻辑)- rqrq |
|
|
// 3. 调用IFS接口(独立实现,不影响原有逻辑)- rqrq |
|
|
boolean success = retryCallIfsInterface(errorLog); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 传入当前登录用户,用于替换请求中的domainUserID - rqrq |
|
|
|
|
|
boolean success = retryCallIfsInterface(errorLog, processedBy); |
|
|
// 4. 更新记录状态 - rqrq |
|
|
// 4. 更新记录状态 - rqrq |
|
|
if (success) { |
|
|
if (success) { |
|
|
// 成功 - 标记为已处理 - rqrq |
|
|
// 成功 - 标记为已处理 - rqrq |
|
|
@ -272,11 +275,12 @@ public class IfsCallErrorLogServiceImpl extends ServiceImpl<IfsCallErrorLogMappe |
|
|
/** |
|
|
/** |
|
|
* @Description 重试调用IFS接口(独立方法,复制自syncSingleGroupToIFSForPallet,不影响原有逻辑)- rqrq |
|
|
* @Description 重试调用IFS接口(独立方法,复制自syncSingleGroupToIFSForPallet,不影响原有逻辑)- rqrq |
|
|
* @param errorLog 错误日志 |
|
|
* @param errorLog 错误日志 |
|
|
|
|
|
* @param currentUsername 当前登录用户名(用于替换domainUserID)- rqrq |
|
|
* @return 是否成功 |
|
|
* @return 是否成功 |
|
|
* @author rqrq |
|
|
* @author rqrq |
|
|
* @date 2025/10/08 |
|
|
* @date 2025/10/08 |
|
|
*/ |
|
|
*/ |
|
|
private boolean retryCallIfsInterface(IfsCallErrorLog errorLog) { |
|
|
|
|
|
|
|
|
private boolean retryCallIfsInterface(IfsCallErrorLog errorLog, String currentUsername) { |
|
|
System.out.println("开始调用IFS接口 - " + errorLog.getInterfaceName()); |
|
|
System.out.println("开始调用IFS接口 - " + errorLog.getInterfaceName()); |
|
|
|
|
|
|
|
|
String jsonBody = null; |
|
|
String jsonBody = null; |
|
|
@ -284,7 +288,23 @@ public class IfsCallErrorLogServiceImpl extends ServiceImpl<IfsCallErrorLogMappe |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
jsonBody = errorLog.getRequestData(); |
|
|
jsonBody = errorLog.getRequestData(); |
|
|
System.out.println("请求数据: " + jsonBody); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 替换domainUserID为当前登录用户 - rqrq |
|
|
|
|
|
if (jsonBody != null && currentUsername != null && !currentUsername.isEmpty()) { |
|
|
|
|
|
try { |
|
|
|
|
|
JSONObject jsonObject = parseObject(jsonBody); |
|
|
|
|
|
if (jsonObject != null && jsonObject.containsKey("domainUserID")) { |
|
|
|
|
|
String originalUser = jsonObject.getString("domainUserID"); |
|
|
|
|
|
jsonObject.put("domainUserID", currentUsername); |
|
|
|
|
|
jsonBody = jsonObject.toJSONString(); |
|
|
|
|
|
System.out.println("已将domainUserID从 " + originalUser + " 替换为 " + currentUsername + " - rqrq"); |
|
|
|
|
|
} |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
System.out.println("解析JSON替换domainUserID失败,使用原始数据: " + e.getMessage()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
System.out.println("重试ifs接口: " + jsonBody); |
|
|
// 2. 调用IFS接口 - rqrq |
|
|
// 2. 调用IFS接口 - rqrq |
|
|
ifsResponse = HttpUtils.doPost(ifsUrl + errorLog.getInterfaceName(), jsonBody, null); |
|
|
ifsResponse = HttpUtils.doPost(ifsUrl + errorLog.getInterfaceName(), jsonBody, null); |
|
|
|
|
|
|
|
|
|