From acc8b01cdedb15932439015b9471b71d942485eb Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" <123456> Date: Sat, 2 Dec 2023 09:52:36 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=8F=90=E4=BA=A4=E4=BF=AE=E5=A4=8Dbug?= =?UTF-8?q?=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/constant/RedisKeyConstant.java | 6 ++++++ .../service/impl/OuPaiFactoryServiceImpl.java | 14 ++++++++++++++ 2 files changed, 20 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..9319726bf 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; }