Administrator
2026-07-17 9224ada1ec154d1d50687fba15782f07ab435ab7
fix(gateApi): 修复网格交易服务中的空指针异常

- 在向上遍历网格元素时添加空值检查
- 在向下遍历网格元素时添加空值检查
- 防止因网格元素ID为空导致的程序崩溃
- 提高网格交易逻辑的稳定性
1 files modified
6 ■■■■■ changed files
src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java 6 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/gateApi/GateGridTradeService.java
@@ -1221,7 +1221,8 @@
                                    });
                                }
                            }
                            cancelCursor = GridElement.findById(cancelCursor.getUpId());
                            Integer nextUpId = cancelCursor.getUpId();
                            cancelCursor = nextUpId != null ? GridElement.findById(nextUpId) : null;
                        }
//                        log.info("[Gate-2] 多仓仓位归零 空仓队列触发, 匹配:{},当前价:{}", matched, currentPrice);
                        if (!newEntryGrid.isHasLongOrder()) {
@@ -1275,7 +1276,8 @@
                                    });
                                }
                            }
                            cancelCursor = GridElement.findById(cancelCursor.getDownId());
                            Integer nextDownId = cancelCursor.getDownId();
                            cancelCursor = nextDownId != null ? GridElement.findById(nextDownId) : null;
                        }
//                        log.info("[Gate-4] 空仓仓位归零 多仓队列触发, 匹配:{},当前价:{}", matched, currentPrice);
                        if (!newEntryGrid.isHasShortOrder()){