perf(buildpackage): 优化 OFS 接口调用性能

- 在 queryOfsReturnGoods 和 queryOfsPoOrder 方法中添加同步锁,减少接口堵塞
-优化了接口调用逻辑,提高查询效率
- 调整了测试用例中的输入参数
This commit is contained in:
liuy 2025-03-17 12:13:58 +08:00
parent e0f49363db
commit 2108f127fb
2 changed files with 59 additions and 48 deletions

View File

@ -83,6 +83,8 @@ public class OfsStandardUtil {
} }
} }
private static final Object queryOfsReturnGoodsLock = new Object();
/** /**
* OFS入库单查询 * OFS入库单查询
* *
@ -93,6 +95,8 @@ public class OfsStandardUtil {
* @author liuyang * @author liuyang
*/ */
public void queryOfsReturnGoods(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, List<StockinOrderSearchResponse.StockinOrder> headerDetailsDtoList, Long pageNo, String api) throws Exception { public void queryOfsReturnGoods(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, List<StockinOrderSearchResponse.StockinOrder> headerDetailsDtoList, Long pageNo, String api) throws Exception {
//减少 O 接口堵塞临时解决办法
synchronized (queryOfsReturnGoodsLock) {
Assert.notNull(queryOfsSoSaleOutVo, "queryOfsSoSaleOutVo不能为空"); Assert.notNull(queryOfsSoSaleOutVo, "queryOfsSoSaleOutVo不能为空");
Assert.notNull(headerDetailsDtoList, "headerDetailsDtoList不能为空"); Assert.notNull(headerDetailsDtoList, "headerDetailsDtoList不能为空");
Assert.notNull(pageNo, "pageNo不能为空"); Assert.notNull(pageNo, "pageNo不能为空");
@ -120,6 +124,7 @@ public class OfsStandardUtil {
logger.error("rertunGoodsRootBean为空interfaceParamDto对象的结果集json{}", JSON.toJSON(interfaceParamDto)); logger.error("rertunGoodsRootBean为空interfaceParamDto对象的结果集json{}", JSON.toJSON(interfaceParamDto));
} }
} }
}
/** /**
* OFS采退订单查询 * OFS采退订单查询
@ -155,12 +160,16 @@ public class OfsStandardUtil {
} }
} }
private static final Object queryOfsPoOrderlock = new Object();
/** /**
* 2024年8月20日 16:11:46 查询OFS采购订单 * 2024年8月20日 16:11:46 查询OFS采购订单
* *
* @author liuyang * @author liuyang
*/ */
public OfsPoOrderData queryOfsPoOrder(String code) throws Exception { public OfsPoOrderData queryOfsPoOrder(String code) throws Exception {
//减少 O 接口堵塞临时解决办法
synchronized (queryOfsPoOrderlock) {
if (code != null && !"".equals(code)) { if (code != null && !"".equals(code)) {
Long pageSize = 200L; Long pageSize = 200L;
Long pageNo = 1L; Long pageNo = 1L;
@ -199,6 +208,7 @@ public class OfsStandardUtil {
} }
return null; return null;
} }
}
/** /**
* 查询OFS销售订单 * 查询OFS销售订单

View File

@ -29,7 +29,8 @@ public class ConsignmachiningCinfurmInTest {
try { try {
// consignmachiningCinfurmIn.startImplementByTime("2024-01-02 00:00:00", "2024-01-02 23:59:59"); // consignmachiningCinfurmIn.startImplementByTime("2024-01-02 00:00:00", "2024-01-02 23:59:59");
String code = "LETS-RE2024111400002771-confirm"; // String code = "LETS-RE2024111400002771-confirm";
String code = "LETS-RE2025022800002706-confirm";
consignmachiningCinfurmIn.startImplementByCode(code); consignmachiningCinfurmIn.startImplementByCode(code);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();