From 8cf3e3302b022c57815331871730f26e935ba37f Mon Sep 17 00:00:00 2001 From: wangchaoxu Date: Mon, 4 Sep 2023 21:26:36 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E8=B4=AD=E9=85=8D=E7=BD=AE=E7=9B=B8?= =?UTF-8?q?=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../spi/order/SavePurchaseSettingService.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/spi/order/SavePurchaseSettingService.java b/ms-biz/src/main/java/com/ms/api/spi/order/SavePurchaseSettingService.java index 35a31fdd..8b7d7653 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/order/SavePurchaseSettingService.java +++ b/ms-biz/src/main/java/com/ms/api/spi/order/SavePurchaseSettingService.java @@ -1,5 +1,6 @@ package com.ms.api.spi.order; +import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -21,6 +22,7 @@ import com.ms.api.util.PurchaseOrderUtil; import com.ms.dal.entity.DsAutoPurchaseAgreement; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import java.util.ArrayList; @@ -49,6 +51,7 @@ public class SavePurchaseSettingService extends SPIBaseService implements Extens SavePurchaseSettingRequestDTO requestDTO = req.getData(); boolean error = false; + String reason = ""; // purchaseSetting 为采购配置 【存储到下游 - 下游店铺级别配置 对应table: purchase_setting】 【包含 自动备注|自动发货】 if (requestDTO.getPurchaseSetting() != null) { @@ -114,6 +117,7 @@ public class SavePurchaseSettingService extends SPIBaseService implements Extens Map retMap = JSON.parseObject(res, Map.class); if (retMap.get("result").equals("fail")) { error = true; + reason = ObjectUtil.isNotEmpty(retMap.get("reason")) ? retMap.get("reason").toString() : ""; }; // 为下游店铺增加允许密文下单1688买家 @@ -127,15 +131,16 @@ public class SavePurchaseSettingService extends SPIBaseService implements Extens sellerReqParams.put("platform", "ddMicroApp"); sellerReqParams.put("sellers", sellers); String sellerRes = dsJsonRequestTemplate.execute("/ds_setting/addPlatformShopAllowDsEncryptOrderSourceSellers", sellerReqParams); - log.info(sellerRes); + log.info("/ds_setting/addPlatformShopAllowDsEncryptOrderSourceSellers:" + sellerRes); Map sellerRetMap = JSON.parseObject(sellerRes, Map.class); if (sellerRetMap.get("result").equals("fail")) { error = true; + reason = ObjectUtil.isNotEmpty(sellerRetMap.get("reason")) ? sellerRetMap.get("reason").toString() : ""; }; } } catch (Exception e) { error = true; - log.error("1688分销配置保存失败,原因:" + e.getMessage()); + log.error("增加允许密文下单1688买家失败,原因:" + e.getMessage()); } } @@ -175,16 +180,22 @@ public class SavePurchaseSettingService extends SPIBaseService implements Extens Map dsSettingRetMap = JSON.parseObject(dsSettingRes, Map.class); if (dsSettingRetMap.get("result").equals("fail")) { error = true; + reason = ObjectUtil.isNotEmpty(dsSettingRetMap.get("reason")) ? dsSettingRetMap.get("reason").toString() : ""; }; // dsSetting = (Map) retMap.get("purchaseSetting"); } catch (Exception e) { error = true; - log.error("1688分销配置保存失败,原因:" + e.getMessage()); + log.error("采购配置dsSetting保存失败,原因:" + e.getMessage()); } } if (error) { - return R.ok(Ret.fail("1688分销配置保存失败")); + if (StringUtils.isEmpty(reason)) { + reason = "采购配置保存失败"; + } else { + reason = "采购配置保存失败,原因:" + reason; + } + return R.ok(Ret.fail(reason)); } return R.ok(Ret.success()); }