|
@@ -43,7 +43,7 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
private final HBSignUtil hbSignUtil;
|
|
|
private final ProductMapper productMapper;
|
|
|
private final SkuMapper skuMapper;
|
|
|
- private final ShopSkuMapper shopProdMapper;
|
|
|
+ private final ShopSkuMapper shopSkuMapper;
|
|
|
private final ShopDetailMapper shopDetailMapper;
|
|
|
|
|
|
@Override
|
|
@@ -94,6 +94,7 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
log.info("商品skuId={},skuName={}已经存在无需添加", productInfo.getString("skuId"), productInfo.getString("skuName"));
|
|
|
} else {
|
|
|
// 创建并填充Sku对象
|
|
|
+
|
|
|
Sku sku = createSkuFromProductInfo(productInfo);
|
|
|
sku.setProdId(prodId);
|
|
|
skuMapper.insert(sku);
|
|
@@ -167,7 +168,14 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
String bodyStr = hbRequest.getString("body");
|
|
|
log.info("商品,body:{}", bodyStr);
|
|
|
JSONObject bodyJson = JSON.parseObject(bodyStr); // 使用Fastjson的解析方法
|
|
|
- String outStationNo = bodyJson.getString("outStationNo");
|
|
|
+// String outStationNo = bodyJson.getString("outStationNo");
|
|
|
+ String skuId = bodyJson.getString("skuId");
|
|
|
+ String stationId = bodyJson.getString("stationId");
|
|
|
+
|
|
|
+ String selfSkuStatus = getSelfSkuStatus(skuId, stationId);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
|
log.error("商品失败:{}", e.getMessage(), e);
|
|
|
return HBR.error("未知异常");
|
|
@@ -202,7 +210,7 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
return HBR.error("更改价格系统找不到对应商品(单品):" + skuId);
|
|
|
}
|
|
|
|
|
|
- ShopSku shopSku = shopProdMapper.selectByShopAndProd(sku.getSkuId(), shopDetail.getShopId());
|
|
|
+ ShopSku shopSku = shopSkuMapper.selectByShopAndProd(sku.getSkuId(), shopDetail.getShopId());
|
|
|
if (ObjectUtil.isEmpty(shopSku)) {
|
|
|
ShopSku shopSkuInfo = new ShopSku();
|
|
|
shopSkuInfo.setShopId(shopDetail.getShopId());
|
|
@@ -210,12 +218,12 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
shopSkuInfo.setSkuId(sku.getSkuId());
|
|
|
shopSkuInfo.setIsDelete(0);
|
|
|
shopSkuInfo.setRecTime(new Date());
|
|
|
- shopProdMapper.insert(shopSkuInfo);
|
|
|
+ shopSkuMapper.insert(shopSkuInfo);
|
|
|
log.info("门店对应商品系统不存在直接添加");
|
|
|
} else {
|
|
|
shopSku.setShopSkuPrice(currentPrice == null ? 0.0 : currentPrice);
|
|
|
shopSku.setUpdateTime(new Date());
|
|
|
- shopProdMapper.updateById(shopSku);
|
|
|
+ shopSkuMapper.updateById(shopSku);
|
|
|
log.info("库存更改成功");
|
|
|
}
|
|
|
}
|
|
@@ -253,20 +261,22 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
return HBR.error("系统找不到对应商品(单品):" + skuId);
|
|
|
}
|
|
|
|
|
|
- ShopSku shopSku = shopProdMapper.selectByShopAndProd(sku.getSkuId(), shopDetail.getShopId());
|
|
|
+ ShopSku shopSku = shopSkuMapper.selectByShopAndProd(sku.getSkuId(), shopDetail.getShopId());
|
|
|
if (ObjectUtil.isEmpty(shopSku)) {
|
|
|
ShopSku shopSkuInfo = new ShopSku();
|
|
|
shopSkuInfo.setShopId(shopDetail.getShopId());
|
|
|
shopSkuInfo.setShopSkuStocks(currentStock);
|
|
|
shopSkuInfo.setSkuId(sku.getSkuId());
|
|
|
+ shopSkuInfo.setSpuId(sku.getProdId());
|
|
|
shopSkuInfo.setIsDelete(0);
|
|
|
shopSkuInfo.setRecTime(new Date());
|
|
|
- shopProdMapper.insert(shopSkuInfo);
|
|
|
+ shopSkuInfo.setUpdateTime(new Date());
|
|
|
+ shopSkuMapper.insert(shopSkuInfo);
|
|
|
log.info("库存添加成功");
|
|
|
} else {
|
|
|
shopSku.setShopSkuStocks(currentStock);
|
|
|
shopSku.setUpdateTime(new Date());
|
|
|
- shopProdMapper.updateById(shopSku);
|
|
|
+ shopSkuMapper.updateById(shopSku);
|
|
|
log.info("库存更改成功");
|
|
|
}
|
|
|
}
|
|
@@ -353,14 +363,17 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- @Override
|
|
|
- public String getSelfSkuStatus() {
|
|
|
+ /**
|
|
|
+ * 商品-门店品售卖状态查询接口
|
|
|
+ * @return 门店品售卖状态信息
|
|
|
+ */
|
|
|
+ public String getSelfSkuStatus(String skuId, String stationId) {
|
|
|
HBBaseReq<Object> build = HBBaseReq.create();
|
|
|
build.setAppId(hbSignUtil.getAppId());
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
List<JSONObject> onlineProductDTO = new ArrayList();
|
|
|
- jsonObject.put("skuId", "0");//海博商品编码
|
|
|
- jsonObject.put("stationId", "0");//海博门店编码
|
|
|
+ jsonObject.put("skuId", skuId);//海博商品编码
|
|
|
+ jsonObject.put("stationId", stationId);//海博门店编码
|
|
|
onlineProductDTO.add(jsonObject);
|
|
|
build.setBody(JSON.toJSONString(onlineProductDTO));
|
|
|
build.setSign(hbSignUtil.signMd5(build));
|
|
@@ -431,13 +444,15 @@ public class HBGoodsService implements IHBGoodsService {
|
|
|
log.info("创建Sku对象数据==========={}===========", productInfo);
|
|
|
Sku sku = new Sku();
|
|
|
// 直接映射字段
|
|
|
- sku.setSkuId(productInfo.getLong("skuId"));//单品id - 关联海博同步
|
|
|
- sku.setProdId(productInfo.getLong("spuId"));//商品id - 关联海博同步
|
|
|
+ sku.setHbSkuId(productInfo.getLong("skuId"));//单品id - 关联海博同步
|
|
|
+ sku.setHbSpuId(productInfo.getLong("spuId"));//商品id - 关联海博同步
|
|
|
sku.setSkuName(productInfo.getString("skuName"));//单品名称
|
|
|
sku.setProdName(productInfo.getString("spuName"));//商品名称
|
|
|
sku.setModelId(productInfo.getString("upc")); // 商品条码
|
|
|
sku.setPartyCode(productInfo.getString("outSkuId"));//商家商品编码
|
|
|
sku.setSkuCode(productInfo.getString("outSkuId"));//商家商品编码
|
|
|
+ sku.setSpec(productInfo.getString("spec"));//规格
|
|
|
+ sku.setPic(productInfo.getString("skuImages"));//sku图片
|
|
|
// Sku.setVolume(productInfo.getString(""));//体积
|
|
|
sku.setStatus(1);
|
|
|
sku.setIsDelete(0);
|