From e59b3f7b0ae028a214ef574516e7c4533c1f44a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Fri, 5 Sep 2025 17:12:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20bug-658=20=E4=BA=A7=E5=93=81=E6=9C=BA?= =?UTF-8?q?=E5=9E=8B=E7=83=AD=E5=9B=BE=E7=9A=84=E9=83=A8=E4=BB=B6=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E6=98=BE=E7=A4=BA=E5=BD=93=E5=89=8D=E8=AF=AD=E8=A8=80?= =?UTF-8?q?=E7=9A=84=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/bootstrap-dev.properties | 2 +- .../service/IProductModelHotimageService.java | 2 +- .../impl/ProductModelHotimageServiceImpl.java | 43 ++++++++++++++++--- .../service/impl/ProductModelServiceImpl.java | 2 +- 4 files changed, 41 insertions(+), 8 deletions(-) diff --git a/nflg-mobilebroken-product/src/main/resources/bootstrap-dev.properties b/nflg-mobilebroken-product/src/main/resources/bootstrap-dev.properties index 3e8f7af9..2dd2c39e 100644 --- a/nflg-mobilebroken-product/src/main/resources/bootstrap-dev.properties +++ b/nflg-mobilebroken-product/src/main/resources/bootstrap-dev.properties @@ -1,5 +1,5 @@ # Nacos 地址 -nacos.server-addr=${NACOS_SERVER_ADDR:112.74.186.154:8848} +nacos.server-addr=${NACOS_SERVER_ADDR:192.168.0.194:8848} #nacos.server-addr=192.168.0.194:8848 #spring.cloud.nacos.discovery.username=nacos #spring.cloud.nacos.discovery.password=ZLQ8vgmjoJ4?EPJ4]fs_ diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelHotimageService.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelHotimageService.java index 6225efe6..37b9dd47 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelHotimageService.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/IProductModelHotimageService.java @@ -39,5 +39,5 @@ public interface IProductModelHotimageService extends IService implements IProductModelHotimageService { + @Resource + private IProductPartInfoService productPartInfoService; + @Override public Integer add(ProductModelHotImageAddRequest request) { ProductModelHotimage info=new ProductModelHotimage() @@ -143,10 +154,32 @@ public class ProductModelHotimageServiceImpl extends ServiceImpl jsonObjects = new ArrayList<>(); + if (CollectionUtil.isNotEmpty(jsonArray)) { + List ids = new ArrayList<>(); + jsonArray.forEach(item -> { + JSONObject jsonObject = JSONUtil.parseObj(item); + ids.add(jsonObject.getInt("id")); + }); + List partInfos = productPartInfoService.lambdaQuery().eq(ProductPartInfo::getLanguageCode, language).in(ProductPartInfo::getPartId, ids).list(); + jsonArray.forEach(obj -> { + JSONObject jsonObject = (JSONObject) obj; + ProductPartInfo pi = partInfos.stream().filter(partInfo -> Objects.equals(partInfo.getPartId(), jsonObject.getInt("id"))).findFirst().orElse(null); + if (Objects.nonNull(pi) && StrUtil.isNotBlank(pi.getName()) && Objects.equals(jsonObject.getInt("id"), pi.getPartId())) { + jsonObject.set("name", pi.getName()); + } + jsonObjects.add(jsonObject); + }); + } + return new ProductHotImageInfoVO() + .setImage(info.getImage()) + .setImgRect(info.getImgRect()) + .setData(JSONUtil.toJsonStr(jsonObjects)); } -} +} \ No newline at end of file diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelServiceImpl.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelServiceImpl.java index b147e62d..b9793b2e 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelServiceImpl.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/ProductModelServiceImpl.java @@ -298,7 +298,7 @@ public class ProductModelServiceImpl extends ServiceImpl