From 99875029def05dfd22359b9822520e834aacb029 Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" Date: Thu, 30 Nov 2023 19:28:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=AC=A7=E6=B4=BE=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=8D=E5=A4=8D=20=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E7=9A=84=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/constant/RedisKeyConstant.java | 6 ++++ .../service/impl/OuPaiFactoryServiceImpl.java | 34 +++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/RedisKeyConstant.java b/blade-biz-common/src/main/java/org/springblade/common/constant/RedisKeyConstant.java index 1ff321801..afa7dc7b0 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/constant/RedisKeyConstant.java +++ b/blade-biz-common/src/main/java/org/springblade/common/constant/RedisKeyConstant.java @@ -3,4 +3,10 @@ package org.springblade.common.constant; public class RedisKeyConstant { + /** + * 欧派入库扫描缓存key + */ + public static final String cache_oupai_key ="cache:oupai-key:"; + + } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java index 24e1e2469..46b833fa0 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java @@ -24,10 +24,12 @@ import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.io.IOUtils; import org.jetbrains.annotations.NotNull; import org.springblade.common.constant.RabbitConstant; +import org.springblade.common.constant.RedisKeyConstant; import org.springblade.common.exception.CustomerException; import org.springblade.common.utils.CommonUtil; import org.springblade.common.utils.FileLogsUtil; import org.springblade.core.oss.model.BladeFile; +import org.springblade.core.redis.cache.BladeRedis; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.StringUtil; import org.springblade.resource.feign.IOssClient; @@ -85,6 +87,9 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { @Autowired private IOpPackagePushLogService opPackagePushLogService; + @Autowired + private BladeRedis bladeRedis; + @Override public String saveOuPaiFactoryOrderDTOByCarCarNumber(String code) { @@ -288,11 +293,20 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { public Boolean checkReceivingOrder(String code) { Boolean isUpdate = false; + + String o = bladeRedis.get(RedisKeyConstant.cache_oupai_key + code); + if(code.equals(o)){ + return true; + } + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(ReceivingOrderEntity::getCode, code); List receivingOrderEntities = receivingOrderMapper.selectList(lambdaQueryWrapper); if (ObjectUtils.isNotNull(receivingOrderEntities)) { isUpdate = true; + // 加入缓存 + bladeRedis.setEx(RedisKeyConstant.cache_oupai_key+code,code,60*60*60L); + } return isUpdate; } @@ -631,6 +645,17 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { //新发车单数据 ReceivingOrderEntity receivingOrderEntity = new ReceivingOrderEntity(); receivingOrderEntity.setCode(code); + + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(ReceivingOrderEntity::getCode,code); + + + List receivingOrderEntities = receivingOrderMapper.selectList(lambdaQueryWrapper); + if(ObjectUtils.isNotNull(receivingOrderEntities)){ + log.info(">>>>>>>>>>>>>>>>>>>>>>> 收货单已存在 {} ",code); + return ; + } + String type = valueObject.getString("Type"); if ("中转".equals(type)) { receivingOrderEntity.setType(1); @@ -796,6 +821,12 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { factoryOrderEntity.setReceiptStatus(0); factoryOrderEntity.setPushStatus(0); factoryOrderEntity.setTurnStatus(0); + + + + // + + boolean save = factoryOrderService.save(factoryOrderEntity); if (!save) { log.warn("############handleData: 保存订单失败 selfCode={}", selfCode); @@ -807,7 +838,10 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { String packageCode = packageEntity.getString("Code"); QueryWrapper packageEntityQueryWrapper = new QueryWrapper<>(); packageEntityQueryWrapper.eq("code", packageCode); + + FactoryPackageEntity factoryPackageEntity = factoryPackageService.getOne(packageEntityQueryWrapper); + if (Objects.isNull(factoryPackageEntity)) { factoryPackageEntity = new FactoryPackageEntity(); factoryPackageEntity.setOrderId(orderId);