|
@@ -60,24 +60,26 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
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
|
|
@@ -102,16 +104,16 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
ImmutableBiMap.Builder builder = new ImmutableBiMap.Builder();
|
|
|
builder.put("merchSn", "商户编号");
|
|
|
builder.put("thirdPartyMerchCode", "第三方商户编号");
|
|
|
- builder.put("attributeCategory", "商品分类");
|
|
|
- builder.put("categoryId", "商品二级分类");
|
|
|
+// 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", "商品描述");
|
|
@@ -167,7 +169,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);
|
|
@@ -198,7 +200,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
galleryEntity.setFileType("1");//视频
|
|
|
goodsGalleryDao.save(galleryEntity);
|
|
|
}
|
|
|
-
|
|
|
+/*
|
|
|
// 添加商品参数
|
|
|
List<GoodsAttributeEntity> attributeEntityList = goods.getAttributeEntityList();
|
|
|
if (attributeEntityList != null && attributeEntityList.size() > 0) {
|
|
@@ -215,7 +217,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
// 添加产品
|
|
|
ProductEntity product = new ProductEntity();
|
|
@@ -244,16 +246,16 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
ImmutableBiMap.Builder builder = new ImmutableBiMap.Builder();
|
|
|
builder.put("merchSn", "商户编号");
|
|
|
builder.put("thirdPartyMerchCode", "第三方商户编号");
|
|
|
- builder.put("attributeCategory", "商品分类");
|
|
|
- builder.put("categoryId", "商品二级分类");
|
|
|
+// 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", "商品描述");
|
|
@@ -310,7 +312,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());
|
|
@@ -392,8 +394,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
goodsGalleryDao.save(galleryEntity);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- // 修改商品参数
|
|
|
+ /*// 修改商品参数
|
|
|
List<GoodsAttributeEntity> attributeEntityList = goods.getAttributeEntityList();
|
|
|
if (attributeEntityList != null && attributeEntityList.size() > 0) {
|
|
|
for (GoodsAttributeEntity item : attributeEntityList) {
|
|
@@ -414,10 +415,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();
|
|
|
// 保税商品,普通货物暂不添加商品规格
|
|
@@ -552,27 +553,31 @@ 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", "热销");
|
|
@@ -610,15 +615,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());
|
|
@@ -655,8 +662,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());
|
|
@@ -684,15 +700,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;
|
|
@@ -752,29 +761,30 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
// }
|
|
|
// }
|
|
|
// 修改产品
|
|
|
- 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());
|
|
@@ -804,7 +814,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("导入数据异常,异常信息请在商品管理》》商品导入异常数据中查看检查");
|
|
|
}
|
|
@@ -836,26 +846,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);
|