|
@@ -1,13 +1,12 @@
|
|
|
package com.kmall.admin.service.impl;
|
|
|
|
|
|
-import com.kmall.admin.annotation.DataFilter;
|
|
|
+import com.google.common.collect.ImmutableBiMap;
|
|
|
import com.kmall.admin.dao.*;
|
|
|
import com.kmall.admin.entity.*;
|
|
|
import com.kmall.admin.service.GoodsService;
|
|
|
+import com.kmall.api.contants.Dict;
|
|
|
import com.kmall.common.entity.SysUserEntity;
|
|
|
-import com.kmall.common.utils.RRException;
|
|
|
-import com.kmall.common.utils.ShiroUtils;
|
|
|
-import com.kmall.common.utils.StringUtils;
|
|
|
+import com.kmall.common.utils.*;
|
|
|
import com.kmall.common.utils.excel.ExcelImport;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -34,6 +33,8 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
@Autowired
|
|
|
private GoodsAttributeDao goodsAttributeDao;
|
|
|
@Autowired
|
|
|
+ private AttributeCategoryDao attributeCategoryDao;
|
|
|
+ @Autowired
|
|
|
private ProductDao productDao;
|
|
|
@Autowired
|
|
|
private GoodsGalleryDao goodsGalleryDao;
|
|
@@ -45,6 +46,8 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
private StoreDao storeDao;
|
|
|
@Autowired
|
|
|
private GoodsGroupDao goodsGroupDao;
|
|
|
+ @Autowired
|
|
|
+ private CategoryDao categoryDao;
|
|
|
|
|
|
@Override
|
|
|
public GoodsEntity queryObject(Integer id) {
|
|
@@ -55,6 +58,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
GoodsEntity entity = goodsDao.queryObject(id);
|
|
|
entity.setAttributeEntityList(attributeEntities);
|
|
|
entity.setProductEntityList(productEntityList);
|
|
|
+ entity.setAttributeCategory(categoryDao.queryObject(entity.getCategoryId()).getParentId());
|
|
|
return entity;
|
|
|
}
|
|
|
|
|
@@ -71,206 +75,224 @@ public class GoodsServiceImpl implements GoodsService {
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public int save(GoodsEntity goods) {
|
|
|
+ Map<String, Object> valideDate = MapBeanUtil.fromObject(goods);
|
|
|
+ ImmutableBiMap.Builder builder = new ImmutableBiMap.Builder();
|
|
|
+ builder.put("attributeCategory", "商品分类");
|
|
|
+ builder.put("categoryId", "商品二级分类");
|
|
|
+ builder.put("goodsSn", "商品编码");
|
|
|
+ builder.put("goodsBizType", "货品业务类型");
|
|
|
+ builder.put("name", "商品名称");
|
|
|
+ builder.put("brandId", "品牌");
|
|
|
+ builder.put("freightId", "运费模版");
|
|
|
+ builder.put("goodsDesc", "商品描述");
|
|
|
+ builder.put("isOnSale", "上架");
|
|
|
+ builder.put("goodsUnit", "商品单位");
|
|
|
+ builder.put("primaryPicUrl", "商品主图");
|
|
|
+ builder.put("listPicUrl", "商品列表图");
|
|
|
+ builder.put("goodsRate", "商品税率");
|
|
|
+ builder.put("retailPrice", "零售价格");
|
|
|
+ builder.put("isHot", "热销");
|
|
|
+
|
|
|
+ if (!Dict.orderBizType.item_11.equals(goods.getGoodsBizType())) {
|
|
|
+ // 海关信息,普通货物可不添加
|
|
|
+ builder.put("sku", "SKU");
|
|
|
+ builder.put("prodBarcode", "产品编码");
|
|
|
+ builder.put("brand", "产品品牌");
|
|
|
+ builder.put("unitCode", "计量单位代码");
|
|
|
+ builder.put("cusGoodsCode", "海关商品编码");
|
|
|
+ builder.put("ciqProdModel", "国检规格型号");
|
|
|
+ builder.put("oriCntCode", "原产国代码");
|
|
|
+ builder.put("cusDeclEle", "海关申报要素");
|
|
|
+ builder.put("cusRecCode", "海关备案编号");
|
|
|
+ }
|
|
|
+ R r = ValidatorUtil.isEmpty(builder.build(), valideDate);
|
|
|
+ if (Integer.valueOf(r.get("code").toString()) != 0) {
|
|
|
+ throw new RRException(r.get("msg").toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 商品轮播图
|
|
|
+ List<GoodsGalleryEntity> galleryEntityList = goods.getGoodsImgList();
|
|
|
+ if (galleryEntityList == null || galleryEntityList.size() <= 0) {
|
|
|
+ throw new RRException("至少添加一张商品轮播图!");
|
|
|
+ }
|
|
|
+
|
|
|
SysUserEntity user = ShiroUtils.getUserEntity();
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("name", goods.getName());
|
|
|
+ map.put("isSame", "true");
|
|
|
+ map.put("sku", goods.getSku());
|
|
|
+ map.put("goodsSn", goods.getGoodsSn());
|
|
|
+ map.put("goodsBizType", goods.getGoodsBizType());
|
|
|
List<GoodsEntity> list = queryList(map);
|
|
|
- if (null != list && list.size() != 0) {
|
|
|
- throw new RRException("商品名称已存在!");
|
|
|
+ if (list != null && list.size() != 0) {
|
|
|
+ throw new RRException("已存在该商品编码或该货品业务类型下已存在此SKU!");
|
|
|
}
|
|
|
- Long id = goodsDao.queryMaxId() + 1;
|
|
|
- goods.setId(id);
|
|
|
|
|
|
+ // 添加商品
|
|
|
+ goods.setAttributeCategory(categoryDao.queryObject(goods.getCategoryId()).getParentId());
|
|
|
goods.setAddTime(new Date());
|
|
|
+ goods.setIsDelete(0);
|
|
|
+ goods.setIsNew(0);
|
|
|
+ goods.setCreateUserId(user.getUserId());
|
|
|
+ goods.setUpdateUserId(user.getUserId());
|
|
|
+ goods.setUpdateTime(new Date());
|
|
|
+ goods.setModTime(new Date());
|
|
|
+ goods.setCreateTime(new Date());
|
|
|
|
|
|
- //保存商品详情页面显示的属性
|
|
|
- List<GoodsAttributeEntity> attributeEntityList = goods.getAttributeEntityList();
|
|
|
- if (null != attributeEntityList && attributeEntityList.size() > 0) {
|
|
|
- for (GoodsAttributeEntity item : attributeEntityList) {
|
|
|
- if (item.getGoodsId() == null) {
|
|
|
- item.setGoodsId(id);
|
|
|
- goodsAttributeDao.save(item);
|
|
|
- }
|
|
|
- }
|
|
|
+ // 新增商品
|
|
|
+ goodsDao.save(goods);
|
|
|
+ Long id = goods.getId();
|
|
|
+
|
|
|
+ // 添加商品轮播图
|
|
|
+ for (GoodsGalleryEntity galleryEntity : galleryEntityList) {
|
|
|
+ galleryEntity.setGoodsId(id);
|
|
|
+ goodsGalleryDao.save(galleryEntity);
|
|
|
}
|
|
|
|
|
|
- // 产品更新
|
|
|
- List<ProductEntity> productEntityList = goods.getProductEntityList();
|
|
|
- if (null != productEntityList && productEntityList.size() > 0) {
|
|
|
- for (ProductEntity productEntity : productEntityList) {
|
|
|
- if (1 == productEntity.getIsDelete()) {
|
|
|
- productDao.delete(productEntity);
|
|
|
- if (null != productEntity.getGoodsSpecificationIds()) {
|
|
|
- goodsSpecificationDao.delete(productEntity.getGoodsSpecificationIds());
|
|
|
+ // 添加商品参数
|
|
|
+ List<GoodsAttributeEntity> attributeEntityList = goods.getAttributeEntityList();
|
|
|
+ if (attributeEntityList != null && attributeEntityList.size() > 0) {
|
|
|
+ for (GoodsAttributeEntity item : attributeEntityList) {
|
|
|
+ if (item.getIsDelete() == 0) {
|
|
|
+ if (item.getAttributeId() != null && StringUtils.isNotEmpty(item.getValue())) {
|
|
|
+ item.setGoodsId(id);
|
|
|
+ goodsAttributeDao.save(item);
|
|
|
+ } else if (item.getAttributeId() != null && StringUtils.isNullOrEmpty(item.getValue())) {
|
|
|
+ throw new RRException("商品属性【" + attributeCategoryDao.queryObject(item.getAttributeId()).getName() + "】值不能为空!");
|
|
|
+ } else if (item.getAttributeId() == null) {
|
|
|
+ continue;
|
|
|
}
|
|
|
}
|
|
|
- if (StringUtils.isNullOrEmpty(productEntity.getGoodsSn())) {
|
|
|
- throw new RRException("产品编码不能为空!");
|
|
|
- }
|
|
|
- // 判断是否goods_sn重复
|
|
|
- ProductEntity productDb = productDao.queryObjectBySn(productEntity.getGoodsSn());
|
|
|
- if (null != productDb && !productDb.getId().equals(productEntity.getId())) {
|
|
|
- throw new RRException("产品编码重复!"); // 重复不操作
|
|
|
- }
|
|
|
- goods.setPrimaryProductId(productEntity.getId());
|
|
|
- GoodsSpecificationEntity specificationEntity = new GoodsSpecificationEntity();
|
|
|
- // 规格
|
|
|
- if (StringUtils.isNullOrEmpty(productEntity.getGoodsSpecificationIds())
|
|
|
- && StringUtils.isNotEmpty(productEntity.getGoodsSpecificationNameValue())) {
|
|
|
- specificationEntity.setGoodsId(goods.getId());
|
|
|
- specificationEntity.setSpecificationId(1); // 规格写死
|
|
|
- specificationEntity.setValue(productEntity.getGoodsSpecificationNameValue());
|
|
|
- goodsSpecificationDao.save(specificationEntity);
|
|
|
- productEntity.setGoodsSpecificationNameValue(specificationEntity.getId() + "");
|
|
|
- } else if (StringUtils.isNotEmpty(productEntity.getGoodsSpecificationIds())) {
|
|
|
- specificationEntity = goodsSpecificationDao.queryObject(productEntity.getGoodsSpecificationIds());
|
|
|
- specificationEntity.setValue(productEntity.getGoodsSpecificationNameValue());
|
|
|
- goodsSpecificationDao.update(specificationEntity);
|
|
|
- }
|
|
|
- if (null != productEntity.getId()) {
|
|
|
- productDao.save(productEntity);
|
|
|
- } else {
|
|
|
- productDao.update(productEntity);
|
|
|
- }
|
|
|
- // default
|
|
|
- if (null == goods.getPrimaryProductId()) {
|
|
|
- goods.setPrimaryProductId(productEntity.getId());
|
|
|
- } else if (productEntity.getGoodsDefault() == 1) {
|
|
|
- goods.setPrimaryProductId(productEntity.getId());
|
|
|
- }
|
|
|
- }
|
|
|
- // default
|
|
|
- for (ProductEntity productEntity : productEntityList) {
|
|
|
- if (null == goods.getPrimaryProductId() && 1 != productEntity.getIsDelete()) {
|
|
|
- goods.setPrimaryProductId(productEntity.getId());
|
|
|
- break;
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //商品轮播图
|
|
|
- List<GoodsGalleryEntity> galleryEntityList = goods.getGoodsImgList();
|
|
|
- if (null != galleryEntityList && galleryEntityList.size() > 0) {
|
|
|
- for (GoodsGalleryEntity galleryEntity : galleryEntityList) {
|
|
|
- galleryEntity.setGoodsId(id);
|
|
|
- goodsGalleryDao.save(galleryEntity);
|
|
|
- }
|
|
|
+ // 添加产品
|
|
|
+ ProductEntity product = new ProductEntity();
|
|
|
+ product.setGoodsId(id);
|
|
|
+ product.setGoodsSn(goods.getGoodsSn());
|
|
|
+ // 保税商品,普通货物暂不添加商品规格
|
|
|
+ if (!Dict.orderBizType.item_11.equals(goods.getGoodsBizType())) {
|
|
|
+ // 添加商品规格
|
|
|
+ GoodsSpecificationEntity goodsSpecification = new GoodsSpecificationEntity();
|
|
|
+ goodsSpecification.setGoodsId(id);
|
|
|
+ goodsSpecification.setValue(goods.getCiqProdModel());
|
|
|
+ goodsSpecification.setSpecificationId(1);
|
|
|
+ goodsSpecificationDao.save(goodsSpecification);
|
|
|
+
|
|
|
+ product.setGoodsSpecificationIds(goodsSpecification.getId().toString());
|
|
|
+ product.setGoodsSpecificationNameValue(goodsSpecification.getValue());
|
|
|
}
|
|
|
|
|
|
- goods.setIsDelete(0);
|
|
|
- goods.setCreateUserId(user.getUserId());
|
|
|
- goods.setUpdateUserId(user.getUserId());
|
|
|
- goods.setUpdateTime(new Date());
|
|
|
- goods.setModTime(new Date());
|
|
|
- goods.setCreateTime(new Date());
|
|
|
- return goodsDao.save(goods);
|
|
|
+ return productDao.save(product);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public int update(GoodsEntity goods) {
|
|
|
- Map<String, Long> map = new HashMap<String, Long>();
|
|
|
- map.put("goodsId", goods.getId());
|
|
|
+ Map<String, Object> valideDate = MapBeanUtil.fromObject(goods);
|
|
|
+ ImmutableBiMap.Builder builder = new ImmutableBiMap.Builder();
|
|
|
+ builder.put("attributeCategory", "商品分类");
|
|
|
+ builder.put("categoryId", "商品二级分类");
|
|
|
+ builder.put("goodsSn", "商品编码");
|
|
|
+ builder.put("goodsBizType", "货品业务类型");
|
|
|
+ builder.put("name", "商品名称");
|
|
|
+ builder.put("brandId", "品牌");
|
|
|
+ builder.put("freightId", "运费模版");
|
|
|
+ builder.put("goodsDesc", "商品描述");
|
|
|
+ builder.put("isOnSale", "上架");
|
|
|
+ builder.put("goodsUnit", "商品单位");
|
|
|
+ builder.put("primaryPicUrl", "商品主图");
|
|
|
+ builder.put("listPicUrl", "商品列表图");
|
|
|
+ builder.put("goodsRate", "商品税率");
|
|
|
+ builder.put("retailPrice", "零售价格");
|
|
|
+ builder.put("isHot", "热销");
|
|
|
+
|
|
|
+ if (!Dict.orderBizType.item_11.equals(goods.getGoodsBizType())) {
|
|
|
+ // 海关信息,普通货物可不添加
|
|
|
+ builder.put("sku", "SKU");
|
|
|
+ builder.put("prodBarcode", "产品编码");
|
|
|
+ builder.put("brand", "产品品牌");
|
|
|
+ builder.put("unitCode", "计量单位代码");
|
|
|
+ builder.put("cusGoodsCode", "海关商品编码");
|
|
|
+ builder.put("ciqProdModel", "国检规格型号");
|
|
|
+ builder.put("oriCntCode", "原产国代码");
|
|
|
+ builder.put("cusDeclEle", "海关申报要素");
|
|
|
+ builder.put("cusRecCode", "海关备案编号");
|
|
|
+ }
|
|
|
+ R r = ValidatorUtil.isEmpty(builder.build(), valideDate);
|
|
|
+ if (Integer.valueOf(r.get("code").toString()) != 0) {
|
|
|
+ throw new RRException(r.get("msg").toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 商品轮播图
|
|
|
+ List<GoodsGalleryEntity> galleryEntityList = goods.getGoodsImgList();
|
|
|
+ if (galleryEntityList == null || galleryEntityList.size() <= 0) {
|
|
|
+ throw new RRException("至少保留一张商品轮播图!");
|
|
|
+ }
|
|
|
|
|
|
SysUserEntity user = ShiroUtils.getUserEntity();
|
|
|
- List<GoodsAttributeEntity> attributeEntityList = goods.getAttributeEntityList();
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("isSame", "true");
|
|
|
+ map.put("sku", goods.getSku());
|
|
|
+ map.put("goodsSn", goods.getGoodsSn());
|
|
|
+ map.put("goodsBizType", goods.getGoodsBizType());
|
|
|
+ List<GoodsEntity> list = queryList(map);
|
|
|
+ if (list != null && list.size() != 0) {
|
|
|
+ throw new RRException("已存在该商品编码或该货品业务类型下已存在此SKU!");
|
|
|
+ }
|
|
|
|
|
|
- //商品参数
|
|
|
- if (null != attributeEntityList && attributeEntityList.size() > 0) {
|
|
|
- for (GoodsAttributeEntity goodsAttributeEntity : attributeEntityList) {
|
|
|
- if (null == goodsAttributeEntity.getId() && StringUtils.isNullOrEmpty(goodsAttributeEntity.getAttributeId())) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (goodsAttributeEntity.getIsDelete() == 1) {
|
|
|
- goodsAttributeDao.delete(goodsAttributeEntity);
|
|
|
- } else if (null != goodsAttributeEntity.getId()) {
|
|
|
- goodsAttributeEntity.setGoodsId(goods.getId());
|
|
|
- goodsAttributeDao.update(goodsAttributeEntity);
|
|
|
- } else {
|
|
|
- goodsAttributeEntity.setGoodsId(goods.getId());
|
|
|
- goodsAttributeDao.save(goodsAttributeEntity);
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+ // 修改商品
|
|
|
+ goods.setAttributeCategory(categoryDao.queryObject(goods.getCategoryId()).getParentId());
|
|
|
+ goods.setIsDelete(0);
|
|
|
+ goods.setIsNew(0);
|
|
|
+ goods.setUpdateUserId(user.getUserId());
|
|
|
+ goods.setUpdateTime(new Date());
|
|
|
+ goods.setModTime(new Date());
|
|
|
+
|
|
|
+ // 修改商品
|
|
|
+ goodsDao.update(goods);
|
|
|
+
|
|
|
+ // 修改商品轮播图
|
|
|
+ goodsGalleryDao.deleteByGoodsId(goods.getId());
|
|
|
+ for (GoodsGalleryEntity galleryEntity : galleryEntityList) {
|
|
|
+ galleryEntity.setGoodsId(goods.getId());
|
|
|
+ goodsGalleryDao.save(galleryEntity);
|
|
|
}
|
|
|
|
|
|
- // 产品更新
|
|
|
- List<ProductEntity> productEntityList = goods.getProductEntityList();
|
|
|
- if (null != productEntityList && productEntityList.size() > 0) {
|
|
|
- for (ProductEntity productEntity : productEntityList) {
|
|
|
- if (1 == productEntity.getIsDelete()) {
|
|
|
- if (null == productEntity.getId()) {
|
|
|
+ // 修改商品参数
|
|
|
+ List<GoodsAttributeEntity> attributeEntityList = goods.getAttributeEntityList();
|
|
|
+ if (attributeEntityList != null && attributeEntityList.size() > 0) {
|
|
|
+ for (GoodsAttributeEntity item : attributeEntityList) {
|
|
|
+ if (item.getIsDelete() == 0) {
|
|
|
+ if (item.getAttributeId() != null && StringUtils.isNotEmpty(item.getValue())) {
|
|
|
+ item.setGoodsId(goods.getId());
|
|
|
+ goodsAttributeDao.save(item);
|
|
|
+ } else if (item.getAttributeId() != null && StringUtils.isNullOrEmpty(item.getValue())) {
|
|
|
+ throw new RRException("商品属性【" + attributeCategoryDao.queryObject(item.getAttributeId()).getName() + "】值不能为空!");
|
|
|
+ } else if (item.getId() != null) {
|
|
|
+ goodsAttributeDao.update(item);
|
|
|
+ } else if (item.getAttributeId() == null) {
|
|
|
continue;
|
|
|
}
|
|
|
- productDao.delete(productEntity);
|
|
|
- if (null != productEntity.getGoodsSpecificationIds()) {
|
|
|
- goodsSpecificationDao.delete(productEntity.getGoodsSpecificationIds());
|
|
|
- }
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (StringUtils.isNullOrEmpty(productEntity.getGoodsSn())) {
|
|
|
- throw new RRException("产品编码不能为空!");
|
|
|
- }
|
|
|
- // 判断是否goods_sn重复
|
|
|
- ProductEntity productDb = productDao.queryObjectBySn(productEntity.getGoodsSn());
|
|
|
- if (null != productDb && !productDb.getId().equals(productEntity.getId())) {
|
|
|
- throw new RRException("产品编码重复!"); // 重复不操作
|
|
|
- }
|
|
|
- GoodsSpecificationEntity specificationEntity = new GoodsSpecificationEntity();
|
|
|
- // 规格
|
|
|
- if (StringUtils.isNullOrEmpty(productEntity.getGoodsSpecificationIds())
|
|
|
- && StringUtils.isNotEmpty(productEntity.getGoodsSpecificationNameValue())) {
|
|
|
- specificationEntity.setGoodsId(goods.getId());
|
|
|
- specificationEntity.setSpecificationId(1); // 规格写死
|
|
|
- specificationEntity.setValue(productEntity.getGoodsSpecificationNameValue());
|
|
|
- goodsSpecificationDao.save(specificationEntity);
|
|
|
- productEntity.setGoodsSpecificationIds(specificationEntity.getId() + "");
|
|
|
- } else if (StringUtils.isNotEmpty(productEntity.getGoodsSpecificationIds())) {
|
|
|
- specificationEntity = goodsSpecificationDao.queryObject(productEntity.getGoodsSpecificationIds());
|
|
|
- specificationEntity.setValue(productEntity.getGoodsSpecificationNameValue());
|
|
|
- goodsSpecificationDao.update(specificationEntity);
|
|
|
- }
|
|
|
- if (null == productEntity.getId()) {
|
|
|
- productEntity.setGoodsId(goods.getId());
|
|
|
- productDao.save(productEntity);
|
|
|
- } else {
|
|
|
- productDao.update(productEntity);
|
|
|
- }
|
|
|
- // default
|
|
|
- if (null == goods.getPrimaryProductId()) {
|
|
|
- goods.setPrimaryProductId(productEntity.getId());
|
|
|
- } else if (productEntity.getGoodsDefault() == 1) {
|
|
|
- goods.setPrimaryProductId(productEntity.getId());
|
|
|
- }
|
|
|
- }
|
|
|
- // default
|
|
|
- for (ProductEntity productEntity : productEntityList) {
|
|
|
- if (null == goods.getPrimaryProductId() && 1 != productEntity.getIsDelete()) {
|
|
|
- goods.setPrimaryProductId(productEntity.getId());
|
|
|
- break;
|
|
|
+ } else if (item.getIsDelete() == 1) {
|
|
|
+ goodsAttributeDao.delete(item.getId());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //商品轮播图
|
|
|
- List<GoodsGalleryEntity> galleryEntityList = goods.getGoodsImgList();
|
|
|
- if (null != galleryEntityList && galleryEntityList.size() > 0)
|
|
|
-
|
|
|
- {
|
|
|
- for (GoodsGalleryEntity galleryEntity : galleryEntityList) {
|
|
|
- if (galleryEntity.getIsDelete() == 1) {
|
|
|
- goodsGalleryDao.delete(galleryEntity);
|
|
|
- } else if (null != galleryEntity.getId()) {
|
|
|
- galleryEntity.setGoodsId(goods.getId());
|
|
|
- goodsGalleryDao.update(galleryEntity);
|
|
|
- } else {
|
|
|
- galleryEntity.setGoodsId(goods.getId());
|
|
|
- goodsGalleryDao.save(galleryEntity);
|
|
|
- }
|
|
|
- }
|
|
|
+ // 修改产品
|
|
|
+ ProductEntity product = productDao.queryObjectBySn(goods.getGoodsSn());
|
|
|
+ // 保税商品,普通货物暂不添加商品规格
|
|
|
+ if (!Dict.orderBizType.item_11.equals(goods.getGoodsBizType())) {
|
|
|
+ // 添加商品规格
|
|
|
+ GoodsSpecificationEntity goodsSpecification = goodsSpecificationDao.queryByGoodsId(goods.getId());
|
|
|
+ goodsSpecification.setValue(goods.getCiqProdModel());
|
|
|
+ goodsSpecificationDao.update(goodsSpecification);
|
|
|
+
|
|
|
+ product.setGoodsSpecificationNameValue(goodsSpecification.getValue());
|
|
|
}
|
|
|
- goods.setUpdateUserId(user.getUserId());
|
|
|
- goods.setUpdateTime(new Date());
|
|
|
- return goodsDao.update(goods);
|
|
|
+
|
|
|
+ return productDao.update(product);
|
|
|
}
|
|
|
|
|
|
@Override
|