From b59f8cd667fe7f5a071612ac37ef410a20ea37e2 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 18 Apr 2025 11:22:54 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=86=E7=B1=BB=20?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ShopSyncServiceImpl.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cash-service/product-service/src/main/java/com/czg/service/product/service/impl/ShopSyncServiceImpl.java b/cash-service/product-service/src/main/java/com/czg/service/product/service/impl/ShopSyncServiceImpl.java index 7b734e85b..223636958 100644 --- a/cash-service/product-service/src/main/java/com/czg/service/product/service/impl/ShopSyncServiceImpl.java +++ b/cash-service/product-service/src/main/java/com/czg/service/product/service/impl/ShopSyncServiceImpl.java @@ -68,6 +68,8 @@ public class ShopSyncServiceImpl implements ShopSyncService { @Resource private ProdConsRelationService prodConsRelationService; @Resource + private ProductRpcService productRpcService; + @Resource private ShopUserService shopUserService; @Resource private ShopVendorService vendorService; @@ -158,6 +160,9 @@ public class ShopSyncServiceImpl implements ShopSyncService { syncConsPro(sourceShopId, targetShopId, consInfoMap, proMap); syncVendor(sourceShopId, targetShopId, mainMapList); syncNoticeService.addNotice(targetShopId, sysUserId, "数据同步", JSON.toJSONString(mainMapList), null); + categoryMap.forEach((k, v) -> { + productRpcService.cleanCategoryProduct(targetShopId, v); + }); } catch (Exception e) { log.error("同步异常", e); throw new CzgException("同步失败"); @@ -617,6 +622,7 @@ public class ShopSyncServiceImpl implements ShopSyncService { } Map finalMap = map; for (Long shopId : shopIds) { + List cateGoryIds = new ArrayList<>(); List> mainMapList = new ArrayList<>(); Map dataMap = new HashMap<>(); Product newEntity = BeanUtil.copyProperties(mainEntity, Product.class); @@ -631,6 +637,9 @@ public class ShopSyncServiceImpl implements ShopSyncService { } if (finalMap.containsKey(shopId)) { Product childEntity = finalMap.get(shopId); + if (childEntity.getCategoryId() != null) { + cateGoryIds.add(childEntity.getCategoryId()); + } newEntity.setId(childEntity.getId()); newEntity.setStartTime(null); newEntity.setEndTime(null); @@ -648,6 +657,9 @@ public class ShopSyncServiceImpl implements ShopSyncService { newEntity.setStockNumber(0); productService.save(newEntity); } + if (newEntity.getCategoryId() != null) { + cateGoryIds.add(newEntity.getCategoryId()); + } syncSkuBySourceShop(sourceShopId, shopId, productId, newEntity.getId()); if ("package".equals(newEntity.getType()) || "coupon".equals(newEntity.getType())) { syncProductPackageBySourceShop(newEntity, shopId); @@ -655,6 +667,11 @@ public class ShopSyncServiceImpl implements ShopSyncService { dataMap.put(newEntity.getId(), newEntity.getName()); buildNotice(mainMapList, "商品变动", 1, "product", dataMap); syncNoticeService.addNotice(shopId, sysUserId, "数据变动", JSON.toJSONString(mainMapList), JSON.toJSONString(newEntity)); + if (CollUtil.isNotEmpty(cateGoryIds)) { + for (Long cateGoryId : cateGoryIds) { + productRpcService.cleanCategoryProduct(shopId, cateGoryId); + } + } } } catch (Exception e) { log.error("商品同步异常", e); From e60c18a085d8eb548caf742839171ab0a0be4d82 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 18 Apr 2025 13:35:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=80=80=E6=AC=BE=20=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/czg/service/order/service/impl/PayServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cash-service/order-service/src/main/java/com/czg/service/order/service/impl/PayServiceImpl.java b/cash-service/order-service/src/main/java/com/czg/service/order/service/impl/PayServiceImpl.java index 4d6aa3af7..8b8fa7a9d 100644 --- a/cash-service/order-service/src/main/java/com/czg/service/order/service/impl/PayServiceImpl.java +++ b/cash-service/order-service/src/main/java/com/czg/service/order/service/impl/PayServiceImpl.java @@ -690,6 +690,9 @@ public class PayServiceImpl implements PayService { CzgResult refund = refund(shopId, new CzgRefundReq(refPayOrderNo, refundReason, refundAmount.multiply(MONEY_RATE).longValue(), payment.getOrderNo(), "")); if (refund.getCode() != 200 || refund.getData() == null || !"SUCCESS".equals(refund.getData().getState())) { + if (refund.getData() != null && refund.getData().getNote() != null) { + throw new CzgException(refund.getData().getNote()); + } throw new CzgException(refund.getMsg()); } else { paymentService.updateChain()