|
@@ -37,6 +37,12 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
|
|
|
private GoodsGalleryDao goodsGalleryDao;
|
|
|
@Autowired
|
|
|
private CartDao cartDao;
|
|
|
+ @Autowired
|
|
|
+ private BrandDao brandDao;
|
|
|
+ @Autowired
|
|
|
+ private FreightDao freightDao;
|
|
|
+ @Autowired
|
|
|
+ private CategoryDao categoryDao;
|
|
|
|
|
|
@Override
|
|
|
public ProductStoreRelaEntity queryObject(Integer id) {
|
|
@@ -75,13 +81,27 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
|
|
|
if (Dict.orderBizType.item_11.getItem().equals(goodsEntity.getGoodsBizType())) {
|
|
|
// 普通商品校验商品规格
|
|
|
builder.put("specification", "规格");
|
|
|
- builder.put("retailPrice", "零售价");
|
|
|
- builder.put("marketPrice", "市场价");
|
|
|
}
|
|
|
+ builder.put("retailPrice", "零售价");
|
|
|
+ builder.put("marketPrice", "市场价");
|
|
|
r = ValidatorUtil.isEmpty(builder.build(), valideDate);
|
|
|
if (Integer.valueOf(r.get("code").toString()) != 0) {
|
|
|
throw new RRException(r.get("msg").toString());
|
|
|
}
|
|
|
+
|
|
|
+ //商品配置校验
|
|
|
+ List<CategoryEntity> categoryEntity = categoryDao.queryObjectByStoreId(productStoreRela.getStoreId());
|
|
|
+ if(categoryEntity == null || categoryEntity.size() == 0){
|
|
|
+ throw new RRException("该门店商品类型没有数据!请先在商品配置》商品类型中维护门店编号为【"+productStoreRela.getStoreId()+"】的商品类型信息,再来操作门店商品数据");
|
|
|
+ }
|
|
|
+ List<BrandEntity> brandEntity = brandDao.queryObjectByStoreId(productStoreRela.getStoreId());
|
|
|
+ if(brandEntity == null || brandEntity.size() == 0){
|
|
|
+ throw new RRException("该门店商品品牌没有数据!请先在商品配置》品牌制造商中维护门店编号为【"+productStoreRela.getStoreId()+"】的品牌信息,再来操作门店商品数据");
|
|
|
+ }
|
|
|
+ List<FreightEntity> freightEntity = freightDao.queryObjectByStoreId(productStoreRela.getStoreId());
|
|
|
+ if(freightEntity == null || freightEntity.size() == 0){
|
|
|
+ throw new RRException("该门店商品运费没有数据!请先在商品配置》运费模板中维护门店编号为【"+productStoreRela.getStoreId()+"】的商品运费信息,再来操作门店商品数据");
|
|
|
+ }
|
|
|
if(!StringUtils.isNotEmpty(goodsEntity.getListPicUrl())){
|
|
|
throw new RRException("该商品列表图不能为空!请先在商品管理》所有商品中维护商品编号为【"+goodsEntity.getGoodsSn()+"】的商品列表图信息,再来操作门店商品数据");
|
|
|
}
|
|
@@ -94,6 +114,9 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if(!goodsEntity.getMerchSn().equalsIgnoreCase(productStoreRela.getMerchSn())) {
|
|
|
+ throw new RRException("该商品所属商户不属于该门店所属商户!");
|
|
|
+ }
|
|
|
Map<String, Object> map = new HashMap();
|
|
|
map.put("goodsId", goodsEntity.getId());
|
|
|
map.put("storeId", productStoreRela.getStoreId());
|
|
@@ -104,13 +127,14 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
|
|
|
|
|
|
SysUserEntity user = ShiroUtils.getUserEntity();
|
|
|
ProductEntity product = productDao.queryObjectBySn(goodsEntity.getGoodsSn());
|
|
|
- if (Dict.orderBizType.item_11.getItem().equals(goodsEntity.getGoodsBizType())) {
|
|
|
- GoodsEntity goods = new GoodsEntity();
|
|
|
- goods.setRetailPrice(productStoreRela.getRetailPrice());
|
|
|
- goods.setMarketPrice(productStoreRela.getMarketPrice());
|
|
|
- goods.setId(goodsEntity.getId());
|
|
|
- goodsDao.update(goods);
|
|
|
|
|
|
+// GoodsEntity goods = new GoodsEntity();
|
|
|
+// goods.setRetailPrice(productStoreRela.getRetailPrice());
|
|
|
+// goods.setMarketPrice(productStoreRela.getMarketPrice());
|
|
|
+// goods.setId(goodsEntity.getId());
|
|
|
+// goodsDao.update(goods);
|
|
|
+
|
|
|
+ if (Dict.orderBizType.item_11.getItem().equals(goodsEntity.getGoodsBizType())) {
|
|
|
GoodsSpecificationEntity goodsSpecificationEntity = goodsSpecificationDao.queryByGoodsId(goodsEntity.getId());
|
|
|
if(goodsSpecificationEntity != null){
|
|
|
goodsSpecificationDao.delete(goodsSpecificationEntity.getId());
|
|
@@ -121,16 +145,14 @@ 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);
|
|
|
-
|
|
|
- } else {
|
|
|
+ }/* else {
|
|
|
productStoreRela.setRetailPrice(goodsEntity.getRetailPrice());
|
|
|
productStoreRela.setMarketPrice(goodsEntity.getMarketPrice());
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
productStoreRela.setProductId(product.getId());
|
|
|
productStoreRela.setGoodsBizType(goodsEntity.getGoodsBizType());
|
|
@@ -139,6 +161,7 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
|
|
|
productStoreRela.setCreateTime(new Date());
|
|
|
productStoreRela.setModerSn(user.getUserId().toString());
|
|
|
productStoreRela.setModTime(new Date());
|
|
|
+ productStoreRela.setGoodsBizType(goodsEntity.getGoodsBizType());
|
|
|
return productStoreRelaDao.save(productStoreRela);
|
|
|
}
|
|
|
|
|
@@ -163,14 +186,31 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
|
|
|
if (Dict.orderBizType.item_11.getItem().equals(goodsEntity.getGoodsBizType())) {
|
|
|
// 普通商品校验商品规格
|
|
|
builder.put("specification", "规格");
|
|
|
- builder.put("retailPrice", "零售价");
|
|
|
- builder.put("marketPrice", "市场价");
|
|
|
}
|
|
|
+ builder.put("retailPrice", "零售价");
|
|
|
+ builder.put("marketPrice", "市场价");
|
|
|
r = ValidatorUtil.isEmpty(builder.build(), valideDate);
|
|
|
if (Integer.valueOf(r.get("code").toString()) != 0) {
|
|
|
throw new RRException(r.get("msg").toString());
|
|
|
}
|
|
|
}
|
|
|
+ //商品配置校验
|
|
|
+ List<CategoryEntity> categoryEntity = categoryDao.queryObjectByStoreId(productStoreRela.getStoreId());
|
|
|
+ if(categoryEntity == null || categoryEntity.size() == 0){
|
|
|
+ throw new RRException("该门店商品类型没有数据!请先在商品配置》商品类型中维护门店编号为【"+productStoreRela.getStoreId()+"】的商品类型信息,再来操作门店商品数据");
|
|
|
+ }
|
|
|
+ List<BrandEntity> brandEntity = brandDao.queryObjectByStoreId(productStoreRela.getStoreId());
|
|
|
+ if(brandEntity == null || brandEntity.size() == 0){
|
|
|
+ throw new RRException("该门店商品品牌没有数据!请先在商品配置》品牌制造商中维护门店编号为【"+productStoreRela.getStoreId()+"】的品牌信息,再来操作门店商品数据");
|
|
|
+ }
|
|
|
+ List<FreightEntity> freightEntity = freightDao.queryObjectByStoreId(productStoreRela.getStoreId());
|
|
|
+ if(freightEntity == null || freightEntity.size() == 0){
|
|
|
+ throw new RRException("该门店商品运费没有数据!请先在商品配置》运费模板中维护门店编号为【"+productStoreRela.getStoreId()+"】的商品运费信息,再来操作门店商品数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!goodsEntity.getMerchSn().equalsIgnoreCase(productStoreRela.getMerchSn())) {
|
|
|
+ throw new RRException("该商品所属商户不属于该门店所属商户!");
|
|
|
+ }
|
|
|
|
|
|
Map<String, Object> map = new HashMap();
|
|
|
map.put("goodsId", goodsEntity.getId());
|
|
@@ -182,12 +222,12 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
|
|
|
}
|
|
|
|
|
|
SysUserEntity user = ShiroUtils.getUserEntity();
|
|
|
+// GoodsEntity goods = new GoodsEntity();
|
|
|
+// goods.setRetailPrice(productStoreRela.getRetailPrice());
|
|
|
+// goods.setMarketPrice(productStoreRela.getMarketPrice());
|
|
|
+// goods.setId(goodsEntity.getId());
|
|
|
+// goodsDao.update(goods);
|
|
|
if (Dict.orderBizType.item_11.getItem().equals(goodsEntity.getGoodsBizType())) {
|
|
|
- GoodsEntity goods = new GoodsEntity();
|
|
|
- goods.setRetailPrice(productStoreRela.getRetailPrice());
|
|
|
- goods.setMarketPrice(productStoreRela.getMarketPrice());
|
|
|
- goods.setId(goodsEntity.getId());
|
|
|
- goodsDao.update(goods);
|
|
|
// 添加商品规格
|
|
|
GoodsSpecificationEntity goodsSpecification = goodsSpecificationDao.queryByGoodsId(goodsEntity.getId());
|
|
|
goodsSpecification.setValue(productStoreRela.getSpecification());
|
|
@@ -198,8 +238,6 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
|
|
|
product.setGoodsSpecificationIds(goodsSpecification.getId().toString());
|
|
|
product.setGoodsSpecificationNameValue(goodsSpecification.getValue());
|
|
|
productDao.update(product);
|
|
|
- } else {
|
|
|
- productStoreRela.setRetailPrice(goodsEntity.getRetailPrice());
|
|
|
}
|
|
|
|
|
|
Map cartMap = new HashMap();
|
|
@@ -219,6 +257,7 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
|
|
|
|
|
|
productStoreRela.setModerSn(user.getUserId().toString());
|
|
|
productStoreRela.setModTime(new Date());
|
|
|
+ productStoreRela.setGoodsBizType(goodsEntity.getGoodsBizType());
|
|
|
return productStoreRelaDao.update(productStoreRela);
|
|
|
}
|
|
|
|