From 6d7e67b8bfa4ff92982693476ede355b0586cfac Mon Sep 17 00:00:00 2001 From: maolei Date: Wed, 4 Jun 2025 18:53:26 +0800 Subject: [PATCH] =?UTF-8?q?bom:=20=E4=BF=AE=E5=A4=8D=20BOM=20=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7=E8=AE=A1=E7=AE=97=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 优化了 BOM 版本号计算逻辑,确保在查询不到数据时默认版本号为 1 - 使用 BigInteger 替代 Long 类型,避免数据类型转换异常 - 重构了代码结构,提高了可读性和维护性 --- .../impl/mmbd/bom/APIBomBusinessServiceImpl.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/uapbd/src/private/nccloud/api/impl/mmbd/bom/APIBomBusinessServiceImpl.java b/uapbd/src/private/nccloud/api/impl/mmbd/bom/APIBomBusinessServiceImpl.java index 40a7657..7efe53a 100644 --- a/uapbd/src/private/nccloud/api/impl/mmbd/bom/APIBomBusinessServiceImpl.java +++ b/uapbd/src/private/nccloud/api/impl/mmbd/bom/APIBomBusinessServiceImpl.java @@ -1600,15 +1600,14 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService { sql.append("AND hcmaterialid = ? "); param.addParam(hcmaterialid); - // ֻѯְ汾ţųְ汾 + // ֻѯְ汾ţųְ汾 sql.append("AND REGEXP_LIKE(hversion, '^[0-9]+$') "); + // ѯݣĬϰ汾Ϊ1汾ż1 + Object mayBeNullVersion = DAO.executeQuery(sql.toString(), param, new ColumnProcessor()); + String number = Objects.isNull(mayBeNullVersion) ? "1" : DAO.executeQuery(sql.toString(), param, new ColumnProcessor()).toString(); + return String.valueOf(Long.parseLong(number)+1); - Long maxVersion = (Long) DAO.executeQuery(sql.toString(), param, new ColumnProcessor()); - - // ѯݣĬϰ汾Ϊ1汾ż1 - return String.valueOf((maxVersion != null ? maxVersion : 0) + 1); - - } catch (Exception e) { + } catch (Exception e) { throw new BusinessException("BOM汾쳣" + e.getMessage()); } }