## 全网产品同步添加开关控制;

This commit is contained in:
cabbage 2025-08-12 09:21:43 +08:00
parent 8a4869e7c4
commit cab7112dd2
2 changed files with 17 additions and 2 deletions

View File

@ -2461,6 +2461,9 @@ public class SaOrderServiceImpl extends ServiceImpl<SaOrderMapper, SaOrder> impl
* @param saOrderExt
*/
private void allProductSync(SaOrderExt saOrderExt) {
if (EYesNo.NO.getIntValue() == BdConfig.getProductSync()) {
return;
}
Map<Integer, BdProduct> productMap = iBdProductService.queryProductMap(saOrderExt.getOrderItemsList().stream().map(SaOrderItems::getPkProduct).collect(Collectors.toSet()), null);
// 开启线程调用全网产品库存
// 请求参数
@ -2478,8 +2481,8 @@ public class SaOrderServiceImpl extends ServiceImpl<SaOrderMapper, SaOrder> impl
// 请求头
String header = Base64Encoder.encode(BdConfig.getSysName() + "!" + saOrderExt.getOrderCode());
ThreadUtils.threadPoolExecutor.submit(() -> {
log.info("===header: {}", header);
log.info("===bodyMap: {}", bodyMap);
log.info("同步产品,header: {}", header);
log.info("同步产品,bodyMap: {}", bodyMap);
HttpRequest httpRequest = HttpUtil.createPost(BdConfig.getProductSyncUrl());
httpRequest.header("authorization", header);
httpRequest.body(JSONUtil.toJsonStr(bodyMap));

View File

@ -37,6 +37,10 @@ public class BdConfig {
*/
private static String android;
/**
* 商品同步是否开启0=开启1=不开启
*/
private static Integer productSync;
/**
* 商品同步地址
*/
@ -90,6 +94,14 @@ public class BdConfig {
BdConfig.android = android;
}
public static Integer getProductSync() {
return productSync;
}
public void setProductSync(Integer productSync) {
BdConfig.productSync = productSync;
}
public static String getProductSyncUrl() {
return productSyncUrl;
}