|
|
@@ -93,6 +93,14 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
log.info("SPU创建成功: prodId={}, hbSpuId={}, spuName={}", productAdd.getProdId(), productAdd.getProdId(), productAdd.getProdName());
|
|
|
}
|
|
|
|
|
|
+ try {
|
|
|
+ String syncUrl = "http://192.168.1.101:8080/smqjh-pms/api/v1/sync/syncProductData";
|
|
|
+ String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, productAdd);
|
|
|
+ log.info("推送商品到同步服务器结果: {}", response);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("推送商品到同步服务器失败: {}", e.getMessage(), e);
|
|
|
+ }
|
|
|
+
|
|
|
convertCategoryCodeToId(productInfo.getJSONArray("relationFrontCategories"), productAdd.getProdId()); // 一品多类目
|
|
|
|
|
|
|
|
|
@@ -110,6 +118,15 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
skuMapper.insert(sku);
|
|
|
log.info("SKU创建成功: skuId={}, skuName={}", sku.getSkuId(), sku.getSkuName());
|
|
|
}
|
|
|
+
|
|
|
+ try {
|
|
|
+ String syncUrl = "http://192.168.1.101:8080/smqjh-pms/api/v1/sync/syncSkuData";
|
|
|
+ // 将frontCategory对象作为JSON放入请求体
|
|
|
+ String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, sku);
|
|
|
+ log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("推送frontCategory到同步服务器失败: {}", e.getMessage(), e);
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
log.info("===================进入多规格商品操作===================");
|
|
|
@@ -139,6 +156,15 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
prodId = productAdd.getProdId();
|
|
|
log.info("生成的商品ID: {}", productAdd.getProdId());
|
|
|
}
|
|
|
+ try {
|
|
|
+ String syncUrl = "http://192.168.1.101:8080/smqjh-pms/api/v1/sync/syncProductData";
|
|
|
+ // 将frontCategory对象作为JSON放入请求体
|
|
|
+ String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, productAdd);
|
|
|
+ log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("推送frontCategory到同步服务器失败: {}", e.getMessage(), e);
|
|
|
+ }
|
|
|
+
|
|
|
convertCategoryCodeToId(productInfo.getJSONArray("relationFrontCategories"), productAdd.getProdId()); // 一品多类目
|
|
|
|
|
|
JSONArray skuList = productInfo.getJSONArray("skuList");
|
|
|
@@ -156,6 +182,13 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
} else {
|
|
|
skuMapper.insert(sku);
|
|
|
}
|
|
|
+ try {
|
|
|
+ String syncUrl = "http://192.168.1.101:8080/smqjh-pms/api/v1/sync/syncSkuData";
|
|
|
+ String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, sku);
|
|
|
+ log.info("推送商品到同步服务器结果: {}", response);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("推送商品到同步服务器失败: {}", e.getMessage(), e);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -191,6 +224,17 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
.eq(ShopSku::getSkuId, sku.getSkuId())
|
|
|
.eq(ShopSku::getShopId, shopDetail.getShopId()));
|
|
|
|
|
|
+ try {
|
|
|
+ ShopSku shopSku = shopSkuMapper.selectOne(new LambdaUpdateWrapper<ShopSku>()
|
|
|
+ .eq(ShopSku::getSkuId, sku.getSkuId())
|
|
|
+ .eq(ShopSku::getShopId, shopDetail.getShopId()));
|
|
|
+ String syncUrl = "http://192.168.1.101:8080/smqjh-pms/api/v1/sync/syncShopSkuData";
|
|
|
+ String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, shopSku);
|
|
|
+ log.info("推送商品到同步服务器结果: {}", response);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("推送商品到同步服务器失败: {}", e.getMessage(), e);
|
|
|
+ }
|
|
|
+
|
|
|
//处理门店-分类管理
|
|
|
List<CategoryProdHb> categoryProds = categoryProdHbMapper.selectList(new LambdaQueryWrapper<CategoryProdHb>()
|
|
|
.eq(CategoryProdHb::getProdId, sku.getProdId())
|
|
|
@@ -267,6 +311,15 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
shopCategory.setRecTime(new Date());
|
|
|
|
|
|
shopCategoryMapper.insert(shopCategory);
|
|
|
+
|
|
|
+ try {
|
|
|
+ String syncUrl = "http://192.168.1.101:8080/smqjh-pms/api/v1/sync/syncShopCategoryData";
|
|
|
+ String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, shopCategory);
|
|
|
+ log.info("推送门店分类到同步服务器结果: {}", response);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("推送门店分类到同步服务器失败: {}", e.getMessage(), e);
|
|
|
+ }
|
|
|
+
|
|
|
log.info("门店分类添加成功:{}", shopCategory);
|
|
|
//二级添加门店-分类绑定商品管理
|
|
|
addCategoryProd(prodId, shopCategory);
|
|
|
@@ -302,6 +355,15 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
categoryProd.setCreateTime(new Date());
|
|
|
|
|
|
categoryProdMapper.insert(categoryProd);
|
|
|
+
|
|
|
+ try {
|
|
|
+ String syncUrl = "http://192.168.1.101:8080/smqjh-pms/api/v1/sync/syncCategoryProdData";
|
|
|
+ // 将frontCategory对象作为JSON放入请求体
|
|
|
+ String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, categoryProd);
|
|
|
+ log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("推送frontCategory到同步服务器失败: {}", e.getMessage(), e);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -343,12 +405,28 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
shopSkuInfo.setRecTime(new Date());
|
|
|
shopSkuMapper.insert(shopSkuInfo);
|
|
|
log.info("门店对应商品系统不存在直接添加");
|
|
|
+ try {
|
|
|
+ String syncUrl = "http://192.168.1.101:8080/smqjh-pms/api/v1/sync/syncShopSkuData";
|
|
|
+ // 将frontCategory对象作为JSON放入请求体
|
|
|
+ String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, shopSkuInfo);
|
|
|
+ log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("推送frontCategory到同步服务器失败: {}", e.getMessage(), e);
|
|
|
+ }
|
|
|
} else {
|
|
|
shopSku.setSpuId(sku.getProdId());
|
|
|
shopSku.setShopSkuPrice(currentPrice == null ? 0.0 : currentPrice);
|
|
|
shopSku.setUpdateTime(new Date());
|
|
|
shopSkuMapper.updateById(shopSku);
|
|
|
log.info("价格更改成功");
|
|
|
+ try {
|
|
|
+ String syncUrl = "http://192.168.1.101:8080/smqjh-pms/api/v1/sync/syncShopSkuData";
|
|
|
+ // 将frontCategory对象作为JSON放入请求体
|
|
|
+ String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, shopSku);
|
|
|
+ log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("推送frontCategory到同步服务器失败: {}", e.getMessage(), e);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
@@ -396,14 +474,29 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
shopSkuInfo.setRecTime(new Date());
|
|
|
shopSkuInfo.setUpdateTime(new Date());
|
|
|
shopSkuMapper.insert(shopSkuInfo);
|
|
|
-
|
|
|
log.info("库存添加成功");
|
|
|
+ try {
|
|
|
+ String syncUrl = "http://192.168.1.101:8080/smqjh-pms/api/v1/sync/syncShopSkuData";
|
|
|
+ // 将frontCategory对象作为JSON放入请求体
|
|
|
+ String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, shopSkuInfo);
|
|
|
+ log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("推送frontCategory到同步服务器失败: {}", e.getMessage(), e);
|
|
|
+ }
|
|
|
} else {
|
|
|
shopSku.setSpuId(sku.getProdId());
|
|
|
shopSku.setShopSkuStocks(currentStock);
|
|
|
shopSku.setUpdateTime(new Date());
|
|
|
shopSkuMapper.updateById(shopSku);
|
|
|
log.info("库存更改成功");
|
|
|
+ try {
|
|
|
+ String syncUrl = "http://192.168.1.101:8080/smqjh-pms/api/v1/sync/syncShopSkuData";
|
|
|
+ // 将frontCategory对象作为JSON放入请求体
|
|
|
+ String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, shopSku);
|
|
|
+ log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("推送frontCategory到同步服务器失败: {}", e.getMessage(), e);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
@@ -435,6 +528,15 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
if (!ObjectUtil.isEmpty(product)) {
|
|
|
product.setIsDelete(1);
|
|
|
productMapper.updateById(product);
|
|
|
+ try {
|
|
|
+ String syncUrl = "http://192.168.1.101:8080/smqjh-pms/api/v1/sync/syncProductDel" + product.getHbSpuId();
|
|
|
+ // 将frontCategory对象作为JSON放入请求体
|
|
|
+ String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, product);
|
|
|
+ log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("推送frontCategory到同步服务器失败: {}", e.getMessage(), e);
|
|
|
+ }
|
|
|
+
|
|
|
skuMapper.deleteByProdId(product.getProdId());
|
|
|
//删除门店对应商品
|
|
|
shopSkuMapper.deleteByProdId(product.getProdId());
|
|
|
@@ -467,6 +569,7 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
return post;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 多规格查询
|
|
|
*
|
|
|
@@ -651,11 +754,24 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
List<CategoryProdHb> categoryProdsHb = categoryProdHbMapper.selectList(new LambdaQueryWrapper<CategoryProdHb>()
|
|
|
.eq(CategoryProdHb::getProdId, spuId)
|
|
|
.notIn(CategoryProdHb::getCode, list)
|
|
|
- .eq(CategoryProdHb::getIsDelete, 0) );
|
|
|
+ .eq(CategoryProdHb::getIsDelete, 0));
|
|
|
for (CategoryProdHb categoryProdHb : categoryProdsHb) {
|
|
|
categoryProdHb.setIsDelete(1);
|
|
|
categoryProdHbMapper.updateById(categoryProdHb);
|
|
|
categoryProdMapper.deleteByCodeAndProdId(categoryProdHb.getCode(), spuId);
|
|
|
+
|
|
|
+ try {
|
|
|
+ String syncUrl = "http://192.168.1.101:8080/smqjh-pms/api/v1/sync/syncCategoryProdData";
|
|
|
+ // 将frontCategory对象作为JSON放入请求体
|
|
|
+ List<CategoryProd> categoryProds = categoryProdMapper.selectList(new LambdaQueryWrapper<CategoryProd>().eq(CategoryProd::getCode, categoryProdHb.getCode()));
|
|
|
+ for (CategoryProd categoryProd : categoryProds) {
|
|
|
+ String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, categoryProd);
|
|
|
+ log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("推送frontCategory到同步服务器失败: {}", e.getMessage(), e);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|