|
@@ -1,6 +1,7 @@
|
|
|
package com.kmall.admin.service.impl;
|
|
|
|
|
|
import com.google.common.collect.ImmutableBiMap;
|
|
|
+import com.google.common.collect.Maps;
|
|
|
import com.kmall.admin.dao.*;
|
|
|
import com.kmall.admin.dto.GoodsDto;
|
|
|
import com.kmall.admin.entity.*;
|
|
@@ -58,24 +59,28 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
private MerchDao merchDao;
|
|
|
@Autowired
|
|
|
private ExportExceptionDataDao exportExceptionDataDao;
|
|
|
+ @Autowired
|
|
|
+ private CartDao cartDao;
|
|
|
+ @Autowired
|
|
|
+ private ThirdMerchantBizDao thirdMerchantBizDao;
|
|
|
|
|
|
@Override
|
|
|
public GoodsEntity queryObject(Integer id) {
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
map.put("goodsId", id);
|
|
|
- List<GoodsAttributeEntity> attributeEntities = goodsAttributeDao.queryList(map);
|
|
|
+// List<GoodsAttributeEntity> attributeEntities = goodsAttributeDao.queryList(map);
|
|
|
List<ProductEntity> productEntityList = productDao.queryList(map);
|
|
|
GoodsEntity entity = goodsDao.queryObject(id);
|
|
|
- entity.setAttributeEntityList(attributeEntities);
|
|
|
+// entity.setAttributeEntityList(attributeEntities);
|
|
|
entity.setProductEntityList(productEntityList);
|
|
|
return entity;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public GoodsEntity queryObjectByProdBarcodeAndBizType(String prodBarcode){
|
|
|
+ public GoodsEntity queryObjectByProdBarcodeAndBizType(String prodBarcode, Integer storeId){
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
map.put("prodBarcode", prodBarcode);
|
|
|
- GoodsEntity entity = goodsDao.queryObjectByProdBarcodeAndBizType(prodBarcode);
|
|
|
+ GoodsEntity entity = goodsDao.queryObjectByProdBarcodeAndBizType(prodBarcode, storeId);
|
|
|
return entity;
|
|
|
}
|
|
|
@Override
|
|
@@ -99,16 +104,17 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
Map<String, Object> valideDate = MapBeanUtil.fromObject(goods);
|
|
|
ImmutableBiMap.Builder builder = new ImmutableBiMap.Builder();
|
|
|
builder.put("merchSn", "商户编号");
|
|
|
- builder.put("attributeCategory", "商品分类");
|
|
|
- builder.put("categoryId", "商品二级分类");
|
|
|
+ builder.put("thirdPartyMerchCode", "第三方商户编号");
|
|
|
+// builder.put("attributeCategory", "商品分类");
|
|
|
+// builder.put("categoryId", "商品二级分类");
|
|
|
builder.put("goodsSn", "商品编码");
|
|
|
builder.put("name", "商品名称");
|
|
|
builder.put("goodsUnit", "商品单位");
|
|
|
builder.put("prodBarcode", "产品条码");
|
|
|
builder.put("goodsBizType", "货品业务类型");
|
|
|
- builder.put("brandId", "品牌");
|
|
|
+// builder.put("brandId", "品牌");
|
|
|
builder.put("supplierId", "供应商");
|
|
|
- builder.put("freightId", "运费模版");
|
|
|
+// builder.put("freightId", "运费模版");
|
|
|
builder.put("primaryPicUrl", "商品主图");
|
|
|
builder.put("listPicUrl", "商品列表图");
|
|
|
builder.put("goodsDesc", "商品描述");
|
|
@@ -123,7 +129,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
// 海关信息,普通货物可不添加
|
|
|
builder.put("sku", "SKU");
|
|
|
builder.put("goodsRate", "商品税率");
|
|
|
- builder.put("retailPrice", "零售价");
|
|
|
+// builder.put("retailPrice", "零售价");
|
|
|
builder.put("brand", "产品品牌");
|
|
|
builder.put("unitCode", "计量单位代码");
|
|
|
builder.put("cusGoodsCode", "海关商品编码");
|
|
@@ -164,7 +170,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
|| Dict.orderBizType.item_10.getItem().equals(goods.getGoodsBizType())) {
|
|
|
goods.setIsHot(0);
|
|
|
}
|
|
|
- goods.setAttributeCategory(categoryDao.queryObject(goods.getCategoryId()).getParentId());
|
|
|
+// goods.setAttributeCategory(categoryDao.queryObject(goods.getCategoryId()).getParentId());
|
|
|
goods.setAddTime(new Date());
|
|
|
goods.setIsDelete(Integer.parseInt(Dict.isDelete.item_0.getItem()));
|
|
|
goods.setIsNew(0);
|
|
@@ -195,7 +201,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
galleryEntity.setFileType("1");//视频
|
|
|
goodsGalleryDao.save(galleryEntity);
|
|
|
}
|
|
|
-
|
|
|
+/*
|
|
|
// 添加商品参数
|
|
|
List<GoodsAttributeEntity> attributeEntityList = goods.getAttributeEntityList();
|
|
|
if (attributeEntityList != null && attributeEntityList.size() > 0) {
|
|
@@ -212,7 +218,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
// 添加产品
|
|
|
ProductEntity product = new ProductEntity();
|
|
@@ -240,16 +246,17 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
Map<String, Object> valideDate = MapBeanUtil.fromObject(goods);
|
|
|
ImmutableBiMap.Builder builder = new ImmutableBiMap.Builder();
|
|
|
builder.put("merchSn", "商户编号");
|
|
|
- builder.put("attributeCategory", "商品分类");
|
|
|
- builder.put("categoryId", "商品二级分类");
|
|
|
+ builder.put("thirdPartyMerchCode", "第三方商户编号");
|
|
|
+// builder.put("attributeCategory", "商品分类");
|
|
|
+// builder.put("categoryId", "商品二级分类");
|
|
|
builder.put("goodsSn", "商品编码");
|
|
|
builder.put("name", "商品名称");
|
|
|
builder.put("goodsUnit", "商品单位");
|
|
|
builder.put("prodBarcode", "产品条码");
|
|
|
builder.put("goodsBizType", "货品业务类型");
|
|
|
- builder.put("brandId", "品牌");
|
|
|
+// builder.put("brandId", "品牌");
|
|
|
builder.put("supplierId", "供应商");
|
|
|
- builder.put("freightId", "运费模版");
|
|
|
+// builder.put("freightId", "运费模版");
|
|
|
builder.put("primaryPicUrl", "商品主图");
|
|
|
builder.put("listPicUrl", "商品列表图");
|
|
|
builder.put("goodsDesc", "商品描述");
|
|
@@ -265,7 +272,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
// 海关信息,普通货物可不添加
|
|
|
builder.put("sku", "SKU");
|
|
|
builder.put("goodsRate", "商品税率");
|
|
|
- builder.put("retailPrice", "零售价");
|
|
|
+// builder.put("retailPrice", "零售价");
|
|
|
builder.put("brand", "产品品牌");
|
|
|
builder.put("unitCode", "计量单位代码");
|
|
|
builder.put("cusGoodsCode", "海关商品编码");
|
|
@@ -306,7 +313,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
|| Dict.orderBizType.item_10.getItem().equals(goods.getGoodsBizType())) {
|
|
|
goods.setIsHot(0);
|
|
|
}
|
|
|
- goods.setAttributeCategory(categoryDao.queryObject(goods.getCategoryId()).getParentId());
|
|
|
+// goods.setAttributeCategory(categoryDao.queryObject(goods.getCategoryId()).getParentId());
|
|
|
goods.setIsDelete(Integer.parseInt(Dict.isDelete.item_0.getItem()));
|
|
|
goods.setIsNew(0);
|
|
|
goods.setUpdateUserId(user.getUserId());
|
|
@@ -317,17 +324,57 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
goodsDao.update(goods);
|
|
|
|
|
|
// 保税商品修改各个门店商品价格
|
|
|
- if (!Dict.orderBizType.item_11.getItem().equals(goods.getGoodsBizType())) {
|
|
|
- List<ProductStoreRelaEntity> productStoreRelaEntityList = productStoreRelaDao.queryByGoodsId(goods.getId());
|
|
|
- if (productStoreRelaEntityList != null && productStoreRelaEntityList.size() > 0) {
|
|
|
- for (ProductStoreRelaEntity productStoreRela : productStoreRelaEntityList) {
|
|
|
- productStoreRela.setRetailPrice(goods.getRetailPrice());
|
|
|
- productStoreRela.setMarketPrice(goods.getMarketPrice());
|
|
|
+ List<ProductStoreRelaEntity> productStoreRelaEntityList = productStoreRelaDao.queryByGoodsId(goods.getId());
|
|
|
+ if (productStoreRelaEntityList != null && productStoreRelaEntityList.size() > 0) {
|
|
|
+ for (ProductStoreRelaEntity productStoreRela : productStoreRelaEntityList) {
|
|
|
+ //修改该商品的所属商户信息,如在该商户门店中有该上架的商品信息,则提示该商品不能修改
|
|
|
+ /*if(org.apache.commons.lang3.StringUtils.isNotEmpty(productStoreRela.getMerchSn()) && productStoreRela.getMerchSn().equalsIgnoreCase(goods.getMerchSn())
|
|
|
+ && goods.getIsOnSale() == Integer.parseInt(Dict.isOnSale.item_1.getItem())) {
|
|
|
+ if (goods.getRetailPrice() != null) {
|
|
|
+ productStoreRela.setRetailPrice(goods.getRetailPrice());
|
|
|
+ }
|
|
|
+ if (goods.getMarketPrice() != null) {
|
|
|
+ productStoreRela.setMarketPrice(goods.getMarketPrice());
|
|
|
+ }
|
|
|
productStoreRelaDao.update(productStoreRela);
|
|
|
+ }else {
|
|
|
+ if (goods.getIsOnSale() == Integer.parseInt(Dict.isOnSale.item_0.getItem())) {
|
|
|
+ if (goods.getRetailPrice() != null) {
|
|
|
+ productStoreRela.setRetailPrice(goods.getRetailPrice());
|
|
|
+ }
|
|
|
+ if (goods.getMarketPrice() != null) {
|
|
|
+ productStoreRela.setMarketPrice(goods.getMarketPrice());
|
|
|
+ }
|
|
|
+ productStoreRela.setMerchSn("");
|
|
|
+ productStoreRelaDao.update(productStoreRela);
|
|
|
+ } else {
|
|
|
+ throw new RRException("商品编码为【" + goods.getGoodsSn() + "】的商品已上架在商户编号为【" + productStoreRela.getMerchSn() + "】的门店中,可先将该商品下架后再进行修改!");
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+ if(org.apache.commons.lang3.StringUtils.isNotEmpty(productStoreRela.getMerchSn()) && productStoreRela.getMerchSn().equalsIgnoreCase(goods.getMerchSn())
|
|
|
+ && goods.getIsOnSale() == Integer.parseInt(Dict.isOnSale.item_1.getItem())) {
|
|
|
+ }else {
|
|
|
+ if (goods.getIsOnSale() != Integer.parseInt(Dict.isOnSale.item_0.getItem())) {
|
|
|
+ throw new RRException("商品编码为【" + goods.getGoodsSn() + "】的商品已上架在商户编号为【" + productStoreRela.getMerchSn() + "】的门店中,可先将该商品下架后再进行修改!");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ Map cartMap = Maps.newHashMap();
|
|
|
+ cartMap.put("goodsId",goods.getId());
|
|
|
+ List<CartEntity> cartList = cartDao.queryList(cartMap);
|
|
|
+ if (cartList != null && cartList.size() > 0) {
|
|
|
+ for (CartEntity cartEntity : cartList) {
|
|
|
+// cartEntity.setRetailPrice(goods.getRetailPrice());
|
|
|
+// cartEntity.setMarketPrice(goods.getMarketPrice());
|
|
|
+ cartEntity.setSku(goods.getSku());
|
|
|
+ cartEntity.setGoodsName(goods.getName());
|
|
|
+ cartEntity.setGoodsSn(goods.getGoodsSn());
|
|
|
+ cartDao.update(cartEntity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 修改商品轮播图
|
|
|
goodsGalleryDao.deleteByGoodsId(goods.getId());
|
|
|
for (int i=0;i<galleryEntityList.size();i++) {
|
|
@@ -348,8 +395,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
goodsGalleryDao.save(galleryEntity);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- // 修改商品参数
|
|
|
+ /*// 修改商品参数
|
|
|
List<GoodsAttributeEntity> attributeEntityList = goods.getAttributeEntityList();
|
|
|
if (attributeEntityList != null && attributeEntityList.size() > 0) {
|
|
|
for (GoodsAttributeEntity item : attributeEntityList) {
|
|
@@ -370,10 +416,10 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
goodsAttributeDao.delete(item.getId());
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
// 修改产品
|
|
|
- ProductEntity product = productDao.queryObjectBySn(goods.getGoodsSn());
|
|
|
+ ProductEntity product = productDao.queryObjectByGoodsId(String.valueOf(goods.getId()));
|
|
|
|
|
|
GoodsSpecificationEntity goodsSpecification = new GoodsSpecificationEntity();
|
|
|
// 保税商品,普通货物暂不添加商品规格
|
|
@@ -409,7 +455,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
goodsEntity.setIsOnSale(Integer.parseInt(Dict.isOnSale.item_0.getItem()));
|
|
|
goodsEntity.setUpdateUserId(user.getUserId());
|
|
|
goodsEntity.setUpdateTime(new Date());
|
|
|
- Map params = new HashMap();
|
|
|
+ Map params = Maps.newHashMap();
|
|
|
params.put("goodsId", id);
|
|
|
List<GoodsGroupEntity> groupVos = goodsGroupDao.queryList(params);
|
|
|
if (null != groupVos && groupVos.size() > 0) {
|
|
@@ -508,33 +554,37 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
SysUserEntity user = ShiroUtils.getUserEntity();
|
|
|
String merchSn = user.getMerchSn();
|
|
|
boolean isSuccess = false;
|
|
|
- List<String> failSameSkuList = new ArrayList<>(), failHotGoodsSnList = new ArrayList<>(), failCateGoodsSnList = new ArrayList<>(),
|
|
|
- failBrandGoodsSnList = new ArrayList<>(), failFreightGoodsSnList = new ArrayList<>(), failSuppGoodsSnList = new ArrayList<>(),
|
|
|
+ List<String> failSameSkuList = new ArrayList<>(), failHotGoodsSnList = new ArrayList<>(),
|
|
|
+ failSuppGoodsSnList = new ArrayList<>(),
|
|
|
failUnitGoodsSnList = new ArrayList<>(), failNationGoodsSnList = new ArrayList<>(),failProdbarGoodsSnList = new ArrayList<>(),
|
|
|
- failCateL2GoodsSnList = new ArrayList<>(), failTypeGoodsSnList = new ArrayList<>(), failMerchGoodsSnList = new ArrayList<>(),
|
|
|
+ failTypeGoodsSnList = new ArrayList<>(), failMerchGoodsSnList = new ArrayList<>(),
|
|
|
+// failCateL2GoodsSnList = new ArrayList<>(),
|
|
|
+// failCateGoodsSnList = new ArrayList<>(),
|
|
|
+// failBrandGoodsSnList = new ArrayList<>(),
|
|
|
+// failFreightGoodsSnList = new ArrayList<>(),
|
|
|
failMerchUserGoodsSnList = new ArrayList<>();
|
|
|
List<String> failGoodsSnList = new ArrayList<>();
|
|
|
List<String> failGoodsTypeList = new ArrayList<>();
|
|
|
- List<String> failFreightList = new ArrayList<>();
|
|
|
+// List<String> failFreightList = new ArrayList<>();
|
|
|
if (goodsEntityList != null && goodsEntityList.size() > 0) {
|
|
|
for (int i = 0; i < goodsEntityList.size(); i++) {
|
|
|
GoodsDto goodsDto = goodsEntityList.get(i);
|
|
|
GoodsEntity goodsEntity = new GoodsEntity();
|
|
|
Map<String, Object> valideDate = MapBeanUtil.fromObject(goodsDto);
|
|
|
ImmutableBiMap.Builder builder = new ImmutableBiMap.Builder();
|
|
|
- builder.put("merchSn", "商户编号");
|
|
|
builder.put("goodsSn", "商品编码");
|
|
|
- builder.put("categoryName", "商品分类");
|
|
|
+ builder.put("thirdPartyMerchCode", "第三方商户代码");
|
|
|
+// builder.put("categoryName", "商品分类");
|
|
|
builder.put("goodsBizType", "货品业务类型");
|
|
|
builder.put("name", "商品名称");
|
|
|
- builder.put("brandName", "商品品牌名称");
|
|
|
- builder.put("defaultFreight", "运费");
|
|
|
+// builder.put("brandName", "商品品牌名称");
|
|
|
+// builder.put("defaultFreight", "运费");
|
|
|
builder.put("isOnSaleStr", "上架");
|
|
|
builder.put("goodsUnit", "商品单位");
|
|
|
builder.put("isHotStr", "热销");
|
|
|
builder.put("prodBarcode", "产品条码");
|
|
|
- builder.put("marketPrice", "市场价");
|
|
|
- builder.put("retailPrice", "零售价");
|
|
|
+// builder.put("marketPrice", "市场价");
|
|
|
+// builder.put("retailPrice", "零售价");
|
|
|
builder.put("supplierName", "供应商");
|
|
|
R r = ValidatorUtil.isEmpty(builder.build(), valideDate);
|
|
|
if (Integer.valueOf(r.get("code").toString()) != 0) {
|
|
@@ -566,15 +616,17 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
failTypeGoodsSnList.add(goodsDto.getSku());
|
|
|
}
|
|
|
}
|
|
|
- if(!user.getRoleType().equalsIgnoreCase(Dict.roleType.item_1.getItem())) {
|
|
|
- if (!merchSn.equalsIgnoreCase(goodsDto.getMerchSn())) {
|
|
|
- isSuccess = true;
|
|
|
- failMerchUserGoodsSnList.add(goodsDto.getGoodsSn());
|
|
|
+ ThirdMerchantBizEntity thirdMerchantBizEntity = thirdMerchantBizDao.getThirdMerchangByCode(goodsDto.getThirdPartyMerchCode());
|
|
|
+ if(thirdMerchantBizEntity != null){
|
|
|
+ goodsEntity.setMerchSn(thirdMerchantBizEntity.getMerchSn());
|
|
|
+ goodsEntity.setThirdPartyMerchCode(thirdMerchantBizEntity.getThirdPartyMerchCode());
|
|
|
+
|
|
|
+ if(!user.getRoleType().equalsIgnoreCase(Dict.roleType.item_1.getItem())) {
|
|
|
+ if (!merchSn.equalsIgnoreCase(thirdMerchantBizEntity.getMerchSn())) {
|
|
|
+ isSuccess = true;
|
|
|
+ failMerchUserGoodsSnList.add(goodsDto.getGoodsSn());
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- MerchEntity merchEntity = merchDao.findByMerchSn(goodsDto.getMerchSn());
|
|
|
- if(merchEntity != null){
|
|
|
- goodsEntity.setMerchSn(merchEntity.getMerchSn());
|
|
|
}else{//商户不存在
|
|
|
isSuccess = true;
|
|
|
failMerchGoodsSnList.add(goodsDto.getGoodsSn());
|
|
@@ -611,8 +663,17 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
failHotGoodsSnList.add(goodsDto.getGoodsSn());
|
|
|
}
|
|
|
}
|
|
|
+ if(thirdMerchantBizEntity != null) {
|
|
|
+ SupplierEntity supplierEntity = supplierDao.queryObjectByName(goodsDto.getSupplierName(), thirdMerchantBizEntity.getMerchSn());
|
|
|
+ if (supplierEntity == null) {
|
|
|
+ isSuccess = true;
|
|
|
+ failSuppGoodsSnList.add(goodsDto.getGoodsSn());
|
|
|
+ } else {
|
|
|
+ goodsEntity.setSupplierId(supplierEntity.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
//商品配置校验
|
|
|
- CategoryEntity categoryEntity = categoryDao.queryObjectByName(goodsDto.getCategoryName(),goodsDto.getMerchSn());
|
|
|
+ /*CategoryEntity categoryEntity = categoryDao.queryObjectByName(goodsDto.getCategoryName(),goodsDto.getMerchSn());
|
|
|
if(categoryEntity==null){
|
|
|
isSuccess = true;
|
|
|
failCateGoodsSnList.add(goodsDto.getGoodsSn());
|
|
@@ -640,15 +701,8 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
failFreightList.add(goodsDto.getDefaultFreight());
|
|
|
}else {
|
|
|
goodsEntity.setFreightId(freightEntity.getId());
|
|
|
- }
|
|
|
+ }*/
|
|
|
if (!Dict.orderBizType.item_11.getItem().equals(goodsDto.getGoodsBizType())) {
|
|
|
- SupplierEntity supplierEntity = supplierDao.queryObjectByName(goodsDto.getSupplierName(),goodsDto.getMerchSn());
|
|
|
- if (supplierEntity == null) {
|
|
|
- isSuccess = true;
|
|
|
- failSuppGoodsSnList.add(goodsDto.getGoodsSn());
|
|
|
- } else {
|
|
|
- goodsEntity.setSupplierId(supplierEntity.getId());
|
|
|
- }
|
|
|
SysCusUnitCodeEntity sysCusUnitCodeEntity = sysCusUnitCodeDao.queryObjectByName(goodsDto.getUnitName());
|
|
|
if (sysCusUnitCodeEntity == null) {
|
|
|
isSuccess = true;
|
|
@@ -668,8 +722,8 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
}
|
|
|
goodsEntity.setIsOnSale(Integer.parseInt(goodsDto.getIsOnSaleStr()));
|
|
|
goodsEntity.setIsHot(Integer.parseInt(goodsDto.getIsHotStr()));
|
|
|
- goodsEntity.setRetailPrice(BigDecimal.valueOf(Integer.valueOf(goodsDto.getRetailPrice())));
|
|
|
- goodsEntity.setMarketPrice(BigDecimal.valueOf(Integer.valueOf(goodsDto.getMarketPrice())));
|
|
|
+// goodsEntity.setRetailPrice(BigDecimal.valueOf(Integer.valueOf(goodsDto.getRetailPrice())));
|
|
|
+// goodsEntity.setMarketPrice(BigDecimal.valueOf(Integer.valueOf(goodsDto.getMarketPrice())));
|
|
|
goodsEntity.setGoodsSn(goodsDto.getGoodsSn());
|
|
|
goodsEntity.setSku(goodsDto.getSku());
|
|
|
goodsEntity.setName(goodsDto.getName());
|
|
@@ -696,41 +750,42 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
}else{
|
|
|
goodsDao.save(goodsEntity);
|
|
|
}
|
|
|
- // 保税商品修改各个门店商品价格
|
|
|
- if (!Dict.orderBizType.item_11.getItem().equals(goodsDto.getGoodsBizType())) {
|
|
|
- List<ProductStoreRelaEntity> productStoreRelaEntityList = productStoreRelaDao.queryByGoodsId(goodsDto.getId());
|
|
|
- if (productStoreRelaEntityList != null && productStoreRelaEntityList.size() > 0) {
|
|
|
- for (ProductStoreRelaEntity productStoreRela : productStoreRelaEntityList) {
|
|
|
- productStoreRela.setMarketPrice(goodsEntity.getMarketPrice());
|
|
|
- productStoreRela.setRetailPrice(goodsEntity.getRetailPrice());
|
|
|
- productStoreRelaDao.update(productStoreRela);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// // 保税商品修改各个门店商品价格
|
|
|
+// if (!Dict.orderBizType.item_11.getItem().equals(goodsDto.getGoodsBizType())) {
|
|
|
+// List<ProductStoreRelaEntity> productStoreRelaEntityList = productStoreRelaDao.queryByGoodsId(goodsDto.getId());
|
|
|
+// if (productStoreRelaEntityList != null && productStoreRelaEntityList.size() > 0) {
|
|
|
+// for (ProductStoreRelaEntity productStoreRela : productStoreRelaEntityList) {
|
|
|
+// productStoreRela.setMarketPrice(goodsEntity.getMarketPrice());
|
|
|
+// productStoreRela.setRetailPrice(goodsEntity.getRetailPrice());
|
|
|
+// productStoreRelaDao.update(productStoreRela);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
// 修改产品
|
|
|
- ProductEntity product = productDao.queryObjectBySn(goodsDto.getGoodsSn());
|
|
|
+ ProductEntity product = productDao.queryObjectByGoodsId(String.valueOf(goodsEntity.getId()));
|
|
|
|
|
|
GoodsSpecificationEntity goodsSpecification = new GoodsSpecificationEntity();
|
|
|
// 保税商品,普通货物暂不添加商品规格
|
|
|
if (!Dict.orderBizType.item_11.getItem().equals(goodsDto.getGoodsBizType())) {
|
|
|
// 添加商品规格
|
|
|
GoodsSpecificationEntity specificationEntity = goodsSpecificationDao.queryByGoodsId(goodsEntity.getId());
|
|
|
- if(specificationEntity ==null) {
|
|
|
+ if(specificationEntity == null) {
|
|
|
goodsSpecification.setGoodsId(goodsEntity.getId());
|
|
|
goodsSpecification.setValue(goodsEntity.getCiqProdModel());
|
|
|
goodsSpecification.setSpecificationId(1);
|
|
|
goodsSpecificationDao.save(goodsSpecification);
|
|
|
}else {
|
|
|
goodsSpecification.setValue(goodsDto.getCiqProdModel());
|
|
|
+ goodsSpecification.setId(specificationEntity.getId());
|
|
|
goodsSpecificationDao.update(goodsSpecification);
|
|
|
}
|
|
|
+ product.setGoodsSpecificationNameValue(goodsSpecification.getValue());
|
|
|
+ product.setGoodsSpecificationIds(goodsSpecification.getId().toString());
|
|
|
}
|
|
|
|
|
|
if(product == null){
|
|
|
product = new ProductEntity();
|
|
|
product.setGoodsSn(goodsDto.getGoodsSn());
|
|
|
- product.setGoodsSpecificationNameValue(goodsSpecification.getValue());
|
|
|
- product.setGoodsSpecificationIds(goodsSpecification.getId().toString());
|
|
|
product.setGoodsId(goodsEntity.getId());
|
|
|
product.setGoodsDefault(0);
|
|
|
product.setGoodsNumber(goodsEntity.getGoodsNumber());
|
|
@@ -760,7 +815,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
|
|
|
}
|
|
|
if(failMerchGoodsSnList != null && failMerchGoodsSnList.size() > 0){
|
|
|
- exportExceptionDataEntity.setExportExceptionData("商户编号不存在,请检查商品编码【"+failMerchGoodsSnList+"】的商品信息,请先维护用户商户编号信息再继续操作!");
|
|
|
+ exportExceptionDataEntity.setExportExceptionData("第三方商户代码不存在,请在商城配置》第三方商户管理中维护,请检查商品编码【"+failMerchGoodsSnList+"】的商品信息,请先维护再继续操作!");
|
|
|
exportExceptionDataDao.save(exportExceptionDataEntity);
|
|
|
throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
|
|
|
}
|
|
@@ -792,26 +847,26 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
exportExceptionDataDao.save(exportExceptionDataEntity);
|
|
|
throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
|
|
|
}
|
|
|
- if(failCateGoodsSnList != null && failCateGoodsSnList.size() > 0){
|
|
|
- exportExceptionDataEntity.setExportExceptionData("分类信息请在商城配置》商品分类中维护,商品分类与商户信息对应,请检查该商品商户信息下的分类是否维护,不存在的商品编码【"+failCateGoodsSnList+"】");
|
|
|
- exportExceptionDataDao.save(exportExceptionDataEntity);
|
|
|
- throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
|
|
|
- }
|
|
|
- if(failCateL2GoodsSnList != null && failCateL2GoodsSnList.size() > 0){
|
|
|
- exportExceptionDataEntity.setExportExceptionData("分类信息请在商城配置》商品分类中查看,商品分类必须为二级分类,不存在的商品编码【"+failCateL2GoodsSnList+"】");
|
|
|
- exportExceptionDataDao.save(exportExceptionDataEntity);
|
|
|
- throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
|
|
|
- }
|
|
|
- if(failBrandGoodsSnList != null && failBrandGoodsSnList.size() > 0){
|
|
|
- exportExceptionDataEntity.setExportExceptionData("品牌信息请在商城配置》品牌制造商中维护,品牌与商户信息对应,请检查该商品商户信息下的品牌是否维护,不存在的商品编码【" + failBrandGoodsSnList + "】");
|
|
|
- exportExceptionDataDao.save(exportExceptionDataEntity);
|
|
|
- throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
|
|
|
- }
|
|
|
- if(failFreightGoodsSnList != null && failFreightGoodsSnList.size() > 0){
|
|
|
- exportExceptionDataEntity.setExportExceptionData("运费信息请在商城配置》运费模板中维护,运费与商户信息对应,请检查该商品商户信息下的运费是否维护,不存在的商品编码【"+failFreightGoodsSnList+"】,运费【"+failFreightList+"】");
|
|
|
- exportExceptionDataDao.save(exportExceptionDataEntity);
|
|
|
- throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
|
|
|
- }
|
|
|
+// if(failCateGoodsSnList != null && failCateGoodsSnList.size() > 0){
|
|
|
+// exportExceptionDataEntity.setExportExceptionData("分类信息请在商城配置》商品分类中维护,商品分类与商户信息对应,请检查该商品商户信息下的分类是否维护,不存在的商品编码【"+failCateGoodsSnList+"】");
|
|
|
+// exportExceptionDataDao.save(exportExceptionDataEntity);
|
|
|
+// throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
|
|
|
+// }
|
|
|
+// if(failCateL2GoodsSnList != null && failCateL2GoodsSnList.size() > 0){
|
|
|
+// exportExceptionDataEntity.setExportExceptionData("分类信息请在商城配置》商品分类中查看,商品分类必须为二级分类,不存在的商品编码【"+failCateL2GoodsSnList+"】");
|
|
|
+// exportExceptionDataDao.save(exportExceptionDataEntity);
|
|
|
+// throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
|
|
|
+// }
|
|
|
+// if(failBrandGoodsSnList != null && failBrandGoodsSnList.size() > 0){
|
|
|
+// exportExceptionDataEntity.setExportExceptionData("品牌信息请在商城配置》品牌制造商中维护,品牌与商户信息对应,请检查该商品商户信息下的品牌是否维护,不存在的商品编码【" + failBrandGoodsSnList + "】");
|
|
|
+// exportExceptionDataDao.save(exportExceptionDataEntity);
|
|
|
+// throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
|
|
|
+// }
|
|
|
+// if(failFreightGoodsSnList != null && failFreightGoodsSnList.size() > 0){
|
|
|
+// exportExceptionDataEntity.setExportExceptionData("运费信息请在商城配置》运费模板中维护,运费与商户信息对应,请检查该商品商户信息下的运费是否维护,不存在的商品编码【"+failFreightGoodsSnList+"】,运费【"+failFreightList+"】");
|
|
|
+// exportExceptionDataDao.save(exportExceptionDataEntity);
|
|
|
+// throw new RRException("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
|
|
|
+// }
|
|
|
if(failSuppGoodsSnList != null && failSuppGoodsSnList.size() > 0){
|
|
|
exportExceptionDataEntity.setExportExceptionData("供应商信息请在商城配置》商品供应商中维护,供应商与商户信息对应,请检查该商品商户信息下的供应商是否维护,不存在的商品编码【" + failSuppGoodsSnList + "】");
|
|
|
exportExceptionDataDao.save(exportExceptionDataEntity);
|