|
@@ -88,7 +88,6 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
|
|
|
ImmutableBiMap.Builder builder = new ImmutableBiMap.Builder();
|
|
|
builder.put("storeId", "门店");
|
|
|
builder.put("goodsId", "商品");
|
|
|
- builder.put("stockNum", "库存");
|
|
|
builder.put("attributeCategory", "一级分类");
|
|
|
builder.put("categoryId", "二级分类");
|
|
|
builder.put("brandId", "品牌");
|
|
@@ -99,6 +98,14 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
|
|
|
throw new RRException(r.get("msg").toString());
|
|
|
} else {
|
|
|
goodsEntity = goodsDao.queryObject(productStoreRela.getGoodsId());
|
|
|
+ if(Dict.orderBizType.item_00.getItem().equalsIgnoreCase(goodsEntity.getGoodsBizType())){
|
|
|
+ if(Dict.isStockShare.item_0.getItem().equalsIgnoreCase(goodsEntity.getIsStockShare())){
|
|
|
+ builder.put("stockNum", "库存");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ builder.put("stockNum", "库存");
|
|
|
+ }
|
|
|
+
|
|
|
if (Dict.orderBizType.item_11.getItem().equals(goodsEntity.getGoodsBizType())) {
|
|
|
// 普通商品校验商品规格
|
|
|
builder.put("specification", "规格");
|
|
@@ -125,16 +132,19 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
|
|
|
if(!goodsEntity.getMerchSn().equalsIgnoreCase(productStoreRela.getMerchSn())) {
|
|
|
throw new RRException("该商品所属商户不属于该门店所属商户!");
|
|
|
}
|
|
|
+ String storeId = String.valueOf(productStoreRela.getStoreId());
|
|
|
+ String goodsId = String.valueOf(goodsEntity.getId());
|
|
|
+
|
|
|
Map<String, Object> map = Maps.newHashMap();
|
|
|
- map.put("goodsId", goodsEntity.getId());
|
|
|
- map.put("storeId", productStoreRela.getStoreId());
|
|
|
+ map.put("goodsId", goodsId);
|
|
|
+ map.put("storeId", storeId);
|
|
|
List<ProductStoreRelaEntity> storeRelaList = querySameList(map);
|
|
|
if (storeRelaList != null && storeRelaList.size() > 0) {
|
|
|
throw new RRException("该门店已存在此商品!");
|
|
|
}
|
|
|
|
|
|
SysUserEntity user = ShiroUtils.getUserEntity();
|
|
|
- ProductEntity product = productDao.queryObjectByGoodsId(String.valueOf(goodsEntity.getId()));
|
|
|
+ ProductEntity product = productDao.queryObjectByGoodsIdAndStoreId(goodsId, "");
|
|
|
|
|
|
// GoodsEntity goods = new GoodsEntity();
|
|
|
// goods.setRetailPrice(productStoreRela.getRetailPrice());
|
|
@@ -153,10 +163,22 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
|
|
|
goodsSpecification.setValue(productStoreRela.getSpecification());
|
|
|
goodsSpecification.setSpecificationId(1);
|
|
|
goodsSpecificationDao.save(goodsSpecification);
|
|
|
+
|
|
|
// 修改产品
|
|
|
- product.setGoodsSpecificationIds(goodsSpecification.getId().toString());
|
|
|
- product.setGoodsSpecificationNameValue(goodsSpecification.getValue());
|
|
|
- productDao.update(product);
|
|
|
+ if(product == null){
|
|
|
+ product = new ProductEntity();
|
|
|
+ product.setGoodsSn(goodsEntity.getGoodsSn());
|
|
|
+ product.setGoodsSpecificationNameValue(goodsSpecification.getValue());
|
|
|
+ product.setGoodsSpecificationIds(goodsSpecification.getId().toString());
|
|
|
+ product.setGoodsId(goodsEntity.getId());
|
|
|
+ product.setGoodsNumber(goodsEntity.getGoodsNumber());
|
|
|
+ product.setGoodsDefault(0);
|
|
|
+ productDao.save(product);
|
|
|
+ }else{
|
|
|
+ product.setGoodsSpecificationIds(goodsSpecification.getId().toString());
|
|
|
+ product.setGoodsSpecificationNameValue(goodsSpecification.getValue());
|
|
|
+ productDao.update(product);
|
|
|
+ }
|
|
|
}/* else {
|
|
|
productStoreRela.setRetailPrice(goodsEntity.getRetailPrice());
|
|
|
productStoreRela.setMarketPrice(goodsEntity.getMarketPrice());
|
|
@@ -230,9 +252,12 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
|
|
|
throw new RRException("该商品所属商户不属于该门店所属商户!");
|
|
|
}
|
|
|
|
|
|
+ String storeId = String.valueOf(productStoreRela.getStoreId());
|
|
|
+ String goodsId = String.valueOf(goodsEntity.getId());
|
|
|
+
|
|
|
Map<String, Object> map = Maps.newHashMap();
|
|
|
- map.put("goodsId", goodsEntity.getId());
|
|
|
- map.put("storeId", productStoreRela.getStoreId());
|
|
|
+ map.put("goodsId", goodsId);
|
|
|
+ map.put("storeId", storeId);
|
|
|
map.put("id", productStoreRela.getId());
|
|
|
List<ProductStoreRelaEntity> storeRelaList = querySameList(map);
|
|
|
if (storeRelaList != null && storeRelaList.size() > 0) {
|
|
@@ -245,6 +270,11 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
|
|
|
// goods.setMarketPrice(productStoreRela.getMarketPrice());
|
|
|
// goods.setId(goodsEntity.getId());
|
|
|
// goodsDao.update(goods);
|
|
|
+ ProductEntity product = productDao.queryObjectByGoodsIdAndStoreId(goodsId, storeId);
|
|
|
+ if(product == null){
|
|
|
+ throw new RRException("该商品规格信息为空!请完善商品数据");
|
|
|
+ }
|
|
|
+ productStoreRela.setProductId(product.getId());
|
|
|
if (Dict.orderBizType.item_11.getItem().equals(goodsEntity.getGoodsBizType())) {
|
|
|
// 添加商品规格
|
|
|
GoodsSpecificationEntity goodsSpecification = goodsSpecificationDao.queryByGoodsId(goodsEntity.getId());
|
|
@@ -252,11 +282,11 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
|
|
|
goodsSpecificationDao.update(goodsSpecification);
|
|
|
|
|
|
// 修改产品
|
|
|
- ProductEntity product = productDao.queryObjectByGoodsId(String.valueOf(goodsEntity.getId()));
|
|
|
product.setGoodsSpecificationIds(goodsSpecification.getId().toString());
|
|
|
product.setGoodsSpecificationNameValue(goodsSpecification.getValue());
|
|
|
productDao.update(product);
|
|
|
}
|
|
|
+
|
|
|
// 修改商品参数
|
|
|
List<GoodsAttributeEntity> attributeEntityList = productStoreRela.getAttributeEntityList();
|
|
|
if (attributeEntityList != null && attributeEntityList.size() > 0) {
|