From f40fca4468af223850c9062c16ef6d8ab5756c7a Mon Sep 17 00:00:00 2001 From: yewj Date: Mon, 23 Dec 2024 17:57:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BB=E4=BF=9D=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../collect/down/ThrOrderDownload.java | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/glxp/api/service/collect/down/ThrOrderDownload.java b/src/main/java/com/glxp/api/service/collect/down/ThrOrderDownload.java index 1ed616656..3c080e846 100644 --- a/src/main/java/com/glxp/api/service/collect/down/ThrOrderDownload.java +++ b/src/main/java/com/glxp/api/service/collect/down/ThrOrderDownload.java @@ -57,7 +57,7 @@ public class ThrOrderDownload implements IDownload { BaseResponse> baseResponse = erpBasicClient.getThrOrders(filterThrOrderRequest); if (baseResponse.getCode() == 20000) { List list = baseResponse.getData().getList(); - if (list == null){ + if (list == null) { return ResultVOUtils.error(500, "未查到此业务单据"); } // TODO: 2024/9/11 2024/9/11 添加一张中间表(io_collect_order_origin)原始表做为转换 @@ -107,12 +107,24 @@ public class ThrOrderDownload implements IDownload { IoCollectOrderBiz collectOrderBiz = new IoCollectOrderBiz(); BeanUtil.copyProperties(entity, collectOrderBiz); - if (BusTypeConstant.QXCF001.getBusType().equals(collectOrderRequest.getBusType())){ + if (BusTypeConstant.QXCF001.getBusType().equals(collectOrderRequest.getBusType())) { collectOrderBiz.setRelId(entity.getRelId()); - if(StrUtil.isNotEmpty(entity.getCheckCode())){ - basicProductsDao.selectOne(new LambdaQueryWrapper().like(BasicProductsEntity::getYbbm,entity.getCheckCode())); - }else{ + if (StrUtil.isNotEmpty(entity.getCheckCode())) { + // 1. 先查询完全匹配的情况 + LambdaQueryWrapper exactMatchWrapper = new LambdaQueryWrapper<>(); + exactMatchWrapper.eq(BasicProductsEntity::getYbbm, entity.getCheckCode()); + List exactMatches = basicProductsDao.selectList(exactMatchWrapper); + if (exactMatches.isEmpty()) { + // 2. 如果没有完全匹配,则查询前20位匹配的情况 + LambdaQueryWrapper prefixMatchWrapper = new LambdaQueryWrapper<>(); + prefixMatchWrapper.apply("LEFT(ybbm, 20) = LEFT({0}, 20)", entity.getCheckCode()); + exactMatches = basicProductsDao.selectList(prefixMatchWrapper); + } + if (exactMatches.isEmpty()) { + errorMsg.append(entity.getCpmctymc()).append("字典未对照").append(";"); + } + } else { BasicProductsEntity basicProductsEntity = basicProductsDao.selectOne(new LambdaQueryWrapper().eq(BasicProductsEntity::getYbbm, entity.getYbbm()).last("limit 1")); if (basicProductsEntity == null || StrUtil.isEmpty(basicProductsEntity.getNameCode())) { errorMsg.append(entity.getCpmctymc()).append("字典未对照").append(";"); @@ -123,7 +135,7 @@ public class ThrOrderDownload implements IDownload { collectOrderBiz.setUnTagCount(0); bizList.add(collectOrderBiz); - }else { + } else { UdiRelevanceEntity basicUdirelEntity = udiRelevanceDao.selectOne(new LambdaQueryWrapper().eq(UdiRelevanceEntity::getMainId, entity.getThrCode()).last("limit 1")); if (basicUdirelEntity != null) { collectOrderBiz.setRelId(basicUdirelEntity.getId());