|
@@ -4,18 +4,24 @@ import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
+import com.alipay.api.domain.ProductBaseVO;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.yami.shop.bean.dto.hb.HBBaseReq;
|
|
import com.yami.shop.bean.dto.hb.HBBaseReq;
|
|
|
import com.yami.shop.bean.model.*;
|
|
import com.yami.shop.bean.model.*;
|
|
|
|
|
+import com.yami.shop.bean.vo.XSBProductVO;
|
|
|
|
|
+import com.yami.shop.bean.vo.XSBSkuVO;
|
|
|
import com.yami.shop.common.util.hb.HBR;
|
|
import com.yami.shop.common.util.hb.HBR;
|
|
|
import com.yami.shop.dao.*;
|
|
import com.yami.shop.dao.*;
|
|
|
import com.yami.shop.service.hb.IHBGoodsService;
|
|
import com.yami.shop.service.hb.IHBGoodsService;
|
|
|
import com.yami.shop.service.impl.FrontCategoryService;
|
|
import com.yami.shop.service.impl.FrontCategoryService;
|
|
|
import com.yami.shop.utils.HBSignUtil;
|
|
import com.yami.shop.utils.HBSignUtil;
|
|
|
|
|
+import com.yami.shop.utils.SmqjhUtil;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
@@ -48,6 +54,8 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
private final CategoryProdHbMapper categoryProdHbMapper;
|
|
private final CategoryProdHbMapper categoryProdHbMapper;
|
|
|
private final CategoryProdMapper categoryProdMapper;
|
|
private final CategoryProdMapper categoryProdMapper;
|
|
|
|
|
|
|
|
|
|
+ private final SmqjhUtil smqjhUtil;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public HBR addHBGoods(JSONObject hbRequest) {
|
|
public HBR addHBGoods(JSONObject hbRequest) {
|
|
@@ -94,8 +102,16 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
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);
|
|
|
|
|
|
|
+ List<XSBProductVO> shopSkuList = new ArrayList<>();
|
|
|
|
|
+ XSBProductVO xsbProductVO = new XSBProductVO();
|
|
|
|
|
+ //复制sku.的值到xsbProductVO 字段一样
|
|
|
|
|
+ BeanUtils.copyProperties(productAdd, xsbProductVO);
|
|
|
|
|
+ xsbProductVO.setThirdSpuId(String.valueOf(productAdd.getProdId()));
|
|
|
|
|
+ xsbProductVO.setBusinessType("XSB");
|
|
|
|
|
+ shopSkuList.add(xsbProductVO);
|
|
|
|
|
+ String syncUrl = smqjhUtil.getSmqjhPmsUrl() + "/syncProductData";
|
|
|
|
|
+ log.info("推送url: {}",syncUrl);
|
|
|
|
|
+ String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, shopSkuList);
|
|
|
log.info("推送商品到同步服务器结果: {}", response);
|
|
log.info("推送商品到同步服务器结果: {}", response);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
log.error("推送商品到同步服务器失败: {}", e.getMessage(), e);
|
|
log.error("推送商品到同步服务器失败: {}", e.getMessage(), e);
|
|
@@ -120,9 +136,17 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- String syncUrl = "http://192.168.1.101:8080/smqjh-pms/api/v1/sync/syncSkuData";
|
|
|
|
|
|
|
+ List<XSBSkuVO> shopSkuList = new ArrayList<>();
|
|
|
|
|
+ XSBSkuVO xsbSkuVO = new XSBSkuVO();
|
|
|
|
|
+ //复制sku.的值到xsbProductVO 字段一样
|
|
|
|
|
+ BeanUtils.copyProperties(sku, xsbSkuVO);
|
|
|
|
|
+ xsbSkuVO.setThirdSkuId(String.valueOf(sku.getProdId()));
|
|
|
|
|
+ xsbSkuVO.setBusinessType("XSB");
|
|
|
|
|
+ shopSkuList.add(xsbSkuVO);
|
|
|
|
|
+ String syncUrl = smqjhUtil.getSmqjhPmsUrl() + "/syncSkuData";
|
|
|
|
|
+ log.info("推送url: {}",syncUrl);
|
|
|
// 将frontCategory对象作为JSON放入请求体
|
|
// 将frontCategory对象作为JSON放入请求体
|
|
|
- String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, sku);
|
|
|
|
|
|
|
+ String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, shopSkuList);
|
|
|
log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
log.error("推送frontCategory到同步服务器失败: {}", e.getMessage(), e);
|
|
log.error("推送frontCategory到同步服务器失败: {}", e.getMessage(), e);
|
|
@@ -157,9 +181,16 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
log.info("生成的商品ID: {}", productAdd.getProdId());
|
|
log.info("生成的商品ID: {}", productAdd.getProdId());
|
|
|
}
|
|
}
|
|
|
try {
|
|
try {
|
|
|
- String syncUrl = "http://192.168.1.101:8080/smqjh-pms/api/v1/sync/syncProductData";
|
|
|
|
|
|
|
+ List<XSBProductVO> shopSkuList = new ArrayList<>();
|
|
|
|
|
+ XSBProductVO xsbProductVO = new XSBProductVO();
|
|
|
|
|
+ //复制sku.的值到xsbProductVO 字段一样
|
|
|
|
|
+ BeanUtils.copyProperties(productAdd, xsbProductVO);
|
|
|
|
|
+ xsbProductVO.setThirdSpuId(String.valueOf(productAdd.getProdId()));
|
|
|
|
|
+ xsbProductVO.setBusinessType("XSB");
|
|
|
|
|
+ shopSkuList.add(xsbProductVO);
|
|
|
|
|
+ String syncUrl = smqjhUtil.getSmqjhPmsUrl() + "/syncProductData";
|
|
|
// 将frontCategory对象作为JSON放入请求体
|
|
// 将frontCategory对象作为JSON放入请求体
|
|
|
- String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, productAdd);
|
|
|
|
|
|
|
+ String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, shopSkuList);
|
|
|
log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
log.error("推送frontCategory到同步服务器失败: {}", e.getMessage(), e);
|
|
log.error("推送frontCategory到同步服务器失败: {}", e.getMessage(), e);
|
|
@@ -183,8 +214,16 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
skuMapper.insert(sku);
|
|
skuMapper.insert(sku);
|
|
|
}
|
|
}
|
|
|
try {
|
|
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);
|
|
|
|
|
|
|
+ List<XSBSkuVO> shopSkuList = new ArrayList<>();
|
|
|
|
|
+ XSBSkuVO xsbSkuVO = new XSBSkuVO();
|
|
|
|
|
+ //复制sku.的值到xsbProductVO 字段一样
|
|
|
|
|
+ BeanUtils.copyProperties(sku, xsbSkuVO);
|
|
|
|
|
+ xsbSkuVO.setThirdSkuId(String.valueOf(sku.getProdId()));
|
|
|
|
|
+ xsbSkuVO.setBusinessType("XSB");
|
|
|
|
|
+ shopSkuList.add(xsbSkuVO);
|
|
|
|
|
+ String syncUrl = smqjhUtil.getSmqjhPmsUrl() + "/syncSkuData";
|
|
|
|
|
+ log.info("推送url: {}",syncUrl);
|
|
|
|
|
+ String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, shopSkuList);
|
|
|
log.info("推送商品到同步服务器结果: {}", response);
|
|
log.info("推送商品到同步服务器结果: {}", response);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
log.error("推送商品到同步服务器失败: {}", e.getMessage(), e);
|
|
log.error("推送商品到同步服务器失败: {}", e.getMessage(), e);
|
|
@@ -228,7 +267,8 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
ShopSku shopSku = shopSkuMapper.selectOne(new LambdaUpdateWrapper<ShopSku>()
|
|
ShopSku shopSku = shopSkuMapper.selectOne(new LambdaUpdateWrapper<ShopSku>()
|
|
|
.eq(ShopSku::getSkuId, sku.getSkuId())
|
|
.eq(ShopSku::getSkuId, sku.getSkuId())
|
|
|
.eq(ShopSku::getShopId, shopDetail.getShopId()));
|
|
.eq(ShopSku::getShopId, shopDetail.getShopId()));
|
|
|
- String syncUrl = "http://192.168.1.101:8080/smqjh-pms/api/v1/sync/syncShopSkuData";
|
|
|
|
|
|
|
+ String syncUrl = smqjhUtil.getSmqjhPmsUrl() + "/syncShopSkuData";
|
|
|
|
|
+ log.info("推送url: {}",syncUrl);
|
|
|
String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, shopSku);
|
|
String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, shopSku);
|
|
|
log.info("推送商品到同步服务器结果: {}", response);
|
|
log.info("推送商品到同步服务器结果: {}", response);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -313,7 +353,8 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
shopCategoryMapper.insert(shopCategory);
|
|
shopCategoryMapper.insert(shopCategory);
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- String syncUrl = "http://192.168.1.101:8080/smqjh-pms/api/v1/sync/syncShopCategoryData";
|
|
|
|
|
|
|
+ String syncUrl = smqjhUtil.getSmqjhPmsUrl() + "/syncShopCategoryData";
|
|
|
|
|
+ log.info("推送url: {}",syncUrl);
|
|
|
String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, shopCategory);
|
|
String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, shopCategory);
|
|
|
log.info("推送门店分类到同步服务器结果: {}", response);
|
|
log.info("推送门店分类到同步服务器结果: {}", response);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -357,7 +398,8 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
categoryProdMapper.insert(categoryProd);
|
|
categoryProdMapper.insert(categoryProd);
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- String syncUrl = "http://192.168.1.101:8080/smqjh-pms/api/v1/sync/syncCategoryProdData";
|
|
|
|
|
|
|
+ String syncUrl = smqjhUtil.getSmqjhPmsUrl() + "/syncCategoryProdData";
|
|
|
|
|
+ log.info("推送url: {}",syncUrl);
|
|
|
// 将frontCategory对象作为JSON放入请求体
|
|
// 将frontCategory对象作为JSON放入请求体
|
|
|
String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, categoryProd);
|
|
String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, categoryProd);
|
|
|
log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
@@ -406,7 +448,8 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
shopSkuMapper.insert(shopSkuInfo);
|
|
shopSkuMapper.insert(shopSkuInfo);
|
|
|
log.info("门店对应商品系统不存在直接添加");
|
|
log.info("门店对应商品系统不存在直接添加");
|
|
|
try {
|
|
try {
|
|
|
- String syncUrl = "http://192.168.1.101:8080/smqjh-pms/api/v1/sync/syncShopSkuData";
|
|
|
|
|
|
|
+ String syncUrl = smqjhUtil.getSmqjhPmsUrl() + "/syncShopSkuData";
|
|
|
|
|
+ log.info("推送url: {}",syncUrl);
|
|
|
// 将frontCategory对象作为JSON放入请求体
|
|
// 将frontCategory对象作为JSON放入请求体
|
|
|
String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, shopSkuInfo);
|
|
String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, shopSkuInfo);
|
|
|
log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
@@ -420,7 +463,8 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
shopSkuMapper.updateById(shopSku);
|
|
shopSkuMapper.updateById(shopSku);
|
|
|
log.info("价格更改成功");
|
|
log.info("价格更改成功");
|
|
|
try {
|
|
try {
|
|
|
- String syncUrl = "http://192.168.1.101:8080/smqjh-pms/api/v1/sync/syncShopSkuData";
|
|
|
|
|
|
|
+ String syncUrl = smqjhUtil.getSmqjhPmsUrl() + "/syncShopSkuData";
|
|
|
|
|
+ log.info("推送url: {}",syncUrl);
|
|
|
// 将frontCategory对象作为JSON放入请求体
|
|
// 将frontCategory对象作为JSON放入请求体
|
|
|
String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, shopSku);
|
|
String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, shopSku);
|
|
|
log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
@@ -476,7 +520,8 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
shopSkuMapper.insert(shopSkuInfo);
|
|
shopSkuMapper.insert(shopSkuInfo);
|
|
|
log.info("库存添加成功");
|
|
log.info("库存添加成功");
|
|
|
try {
|
|
try {
|
|
|
- String syncUrl = "http://192.168.1.101:8080/smqjh-pms/api/v1/sync/syncShopSkuData";
|
|
|
|
|
|
|
+ String syncUrl = smqjhUtil.getSmqjhPmsUrl() + "/syncShopSkuData";
|
|
|
|
|
+ log.info("推送url: {}",syncUrl);
|
|
|
// 将frontCategory对象作为JSON放入请求体
|
|
// 将frontCategory对象作为JSON放入请求体
|
|
|
String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, shopSkuInfo);
|
|
String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, shopSkuInfo);
|
|
|
log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
@@ -490,7 +535,8 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
shopSkuMapper.updateById(shopSku);
|
|
shopSkuMapper.updateById(shopSku);
|
|
|
log.info("库存更改成功");
|
|
log.info("库存更改成功");
|
|
|
try {
|
|
try {
|
|
|
- String syncUrl = "http://192.168.1.101:8080/smqjh-pms/api/v1/sync/syncShopSkuData";
|
|
|
|
|
|
|
+ String syncUrl = smqjhUtil.getSmqjhPmsUrl() + "/syncShopSkuData";
|
|
|
|
|
+ log.info("推送url: {}",syncUrl);
|
|
|
// 将frontCategory对象作为JSON放入请求体
|
|
// 将frontCategory对象作为JSON放入请求体
|
|
|
String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, shopSku);
|
|
String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, shopSku);
|
|
|
log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
@@ -529,7 +575,8 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
product.setIsDelete(1);
|
|
product.setIsDelete(1);
|
|
|
productMapper.updateById(product);
|
|
productMapper.updateById(product);
|
|
|
try {
|
|
try {
|
|
|
- String syncUrl = "http://192.168.1.101:8080/smqjh-pms/api/v1/sync/syncProductDel" + product.getHbSpuId();
|
|
|
|
|
|
|
+ String syncUrl = smqjhUtil.getSmqjhPmsUrl() + "/syncProductDel" + product.getHbSpuId();
|
|
|
|
|
+ log.info("推送url: {}",syncUrl);
|
|
|
// 将frontCategory对象作为JSON放入请求体
|
|
// 将frontCategory对象作为JSON放入请求体
|
|
|
String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, product);
|
|
String response = com.yami.shop.common.util.HttpUtil.post(syncUrl, product);
|
|
|
log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
log.info("推送frontCategory到同步服务器结果: {}", response);
|
|
@@ -761,7 +808,8 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
categoryProdMapper.deleteByCodeAndProdId(categoryProdHb.getCode(), spuId);
|
|
categoryProdMapper.deleteByCodeAndProdId(categoryProdHb.getCode(), spuId);
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- String syncUrl = "http://192.168.1.101:8080/smqjh-pms/api/v1/sync/syncCategoryProdData";
|
|
|
|
|
|
|
+ String syncUrl = smqjhUtil.getSmqjhPmsUrl() + "/syncCategoryProdData";
|
|
|
|
|
+ log.info("推送url: {}",syncUrl);
|
|
|
// 将frontCategory对象作为JSON放入请求体
|
|
// 将frontCategory对象作为JSON放入请求体
|
|
|
List<CategoryProd> categoryProds = categoryProdMapper.selectList(new LambdaQueryWrapper<CategoryProd>().eq(CategoryProd::getCode, categoryProdHb.getCode()));
|
|
List<CategoryProd> categoryProds = categoryProdMapper.selectList(new LambdaQueryWrapper<CategoryProd>().eq(CategoryProd::getCode, categoryProdHb.getCode()));
|
|
|
for (CategoryProd categoryProd : categoryProds) {
|
|
for (CategoryProd categoryProd : categoryProds) {
|