|
|
|
@ -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());
|
|
|
|
|
}
|
|
|
|
|