|
|
|
@ -170,5 +170,75 @@ public class LabelTransactionLogServiceImpl implements LabelTransactionLogServic |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, Object> batchReverse(List<Map<String, Object>> reverseList, String username) { |
|
|
|
logger.info("批量单据回冲开始,记录数: {}", reverseList.size()); |
|
|
|
|
|
|
|
int successCount = 0; |
|
|
|
int failureCount = 0; |
|
|
|
List<Map<String, Object>> details = new ArrayList<>(); |
|
|
|
|
|
|
|
for (Map<String, Object> reverseItem : reverseList) { |
|
|
|
String site = (String) reverseItem.get("site"); |
|
|
|
String buNo = (String) reverseItem.get("buNo"); |
|
|
|
String transactionId = (String) reverseItem.get("transactionId"); |
|
|
|
String transactionType = (String) reverseItem.get("documentType"); |
|
|
|
|
|
|
|
Map<String, Object> detail = new HashMap<>(); |
|
|
|
detail.put("transactionId", transactionId); |
|
|
|
|
|
|
|
try { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("site", site); |
|
|
|
params.put("buNo", buNo); |
|
|
|
params.put("transactionId", transactionId); |
|
|
|
params.put("transactionType", transactionType); |
|
|
|
params.put("username", username); |
|
|
|
|
|
|
|
// 调用存储过程 |
|
|
|
List<Map<String, Object>> resultList = labelTransactionLogMapper.reverseInboundByTransaction(params); |
|
|
|
|
|
|
|
if (resultList != null && !resultList.isEmpty()) { |
|
|
|
Map<String, Object> spResult = resultList.get(0); |
|
|
|
String resultCode = spResult.get("resultCode") != null ? spResult.get("resultCode").toString() : ""; |
|
|
|
String resultMsg = spResult.get("resultMsg") != null ? spResult.get("resultMsg").toString() : ""; |
|
|
|
|
|
|
|
if ("200".equals(resultCode)) { |
|
|
|
successCount++; |
|
|
|
detail.put("status", "success"); |
|
|
|
detail.put("message", resultMsg); |
|
|
|
logger.info("单据回冲成功,transactionId: {}", transactionId); |
|
|
|
} else { |
|
|
|
failureCount++; |
|
|
|
detail.put("status", "failure"); |
|
|
|
detail.put("message", resultMsg); |
|
|
|
logger.warn("单据回冲失败,transactionId: {}, 错误: {}", transactionId, resultMsg); |
|
|
|
} |
|
|
|
} else { |
|
|
|
failureCount++; |
|
|
|
detail.put("status", "failure"); |
|
|
|
detail.put("message", "存储过程未返回结果"); |
|
|
|
logger.warn("单据回冲失败,transactionId: {}, 错误: 存储过程未返回结果", transactionId); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("单据回冲异常,transactionId: {}, error: {}", transactionId, e.getMessage(), e); |
|
|
|
detail.put("status", "error"); |
|
|
|
detail.put("message", "回冲异常: " + e.getMessage()); |
|
|
|
failureCount++; |
|
|
|
} |
|
|
|
details.add(detail); |
|
|
|
} |
|
|
|
|
|
|
|
logger.info("批量单据回冲完成,成功: {}, 失败: {}", successCount, failureCount); |
|
|
|
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
result.put("successCount", successCount); |
|
|
|
result.put("failureCount", failureCount); |
|
|
|
result.put("totalCount", reverseList.size()); |
|
|
|
result.put("details", details); |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|